|
|
|
@@ -120,6 +120,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
@Autowired |
|
|
|
WxBillSettleRecordService wxBillSettleRecordService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxBillSettleService wxBillSettleService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { |
|
|
|
//更新各账单状态 |
|
|
|
@@ -788,18 +791,50 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { |
|
|
|
//商场名称 |
|
|
|
WxMall wxMall = wxMallMapper.getByTenantId(wxBillSettle.getTenantId()); |
|
|
|
wxBillSettle = wxBillSettleService.getById(wxBillSettle.getId()); |
|
|
|
if(wxBillSettle.getReceiveBillIds() == null) wxBillSettle.setReceiveBillIds(new ArrayList<>()); |
|
|
|
if(wxBillSettle.getPayBillIds() == null) wxBillSettle.setPayBillIds(new ArrayList<>()); |
|
|
|
|
|
|
|
//映射结果 |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
result.put("mall", wxMall.getName()); |
|
|
|
|
|
|
|
//编号 |
|
|
|
String number = "JF" + DateUtils.getSystemTime("yyyyMMddHHmmss"); |
|
|
|
result.put("number", number); |
|
|
|
|
|
|
|
WxMall wxMall = wxMallMapper.getByTenantId(wxBillSettle.getTenantId()); |
|
|
|
result.put("mall", wxMall.getName()); |
|
|
|
result.put("merchant",wxMerchantMapper.selectByPrimaryKey(wxBillSettle.getMerchantId()).getName()); |
|
|
|
result.put("num", wxBillSettle.getSettleNumber()); |
|
|
|
result.put("cdate", DateUtils.format(wxBillSettle.getCreatetime())); |
|
|
|
|
|
|
|
BigDecimal receiveM = (new BigDecimal(wxBillSettle.getReceiveMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
BigDecimal payM = (new BigDecimal(wxBillSettle.getPayMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
BigDecimal bM = (new BigDecimal(wxBillSettle.getBalance()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
result.put("receiveM", receiveM.toString()+"元"); |
|
|
|
result.put("payM", payM.toString()+"元"); |
|
|
|
result.put("bM", bM.toString()+"元"); |
|
|
|
result.put("receiveMU", PriceUtil.digitUppercase(receiveM.doubleValue())); |
|
|
|
result.put("payMU", PriceUtil.digitUppercase(payM.doubleValue())); |
|
|
|
result.put("bMU", PriceUtil.digitUppercase(bM.doubleValue())); |
|
|
|
|
|
|
|
List<Map<String,String>> rowsParams = new ArrayList<>(); |
|
|
|
int size = wxBillSettle.getReceiveBillIds().size() > wxBillSettle.getPayBillIds().size()?wxBillSettle.getReceiveBillIds().size():wxBillSettle.getPayBillIds().size(); |
|
|
|
int count = 1; |
|
|
|
for (int i = 0; i < size ; i++) { |
|
|
|
WxBillSettleBill bill = wxBillSettle.getReceiveBillIds().get(i); |
|
|
|
Map<String,String> map = new HashedMap(); |
|
|
|
if(bill != null){ |
|
|
|
map.put("s1",count+""); |
|
|
|
map.put("bn1",bill.getBillName()); |
|
|
|
map.put("money1",bill.getReceivePay()); |
|
|
|
} |
|
|
|
WxBillSettleBill payBill = wxBillSettle.getPayBillIds().get(i); |
|
|
|
if(payBill != null){ |
|
|
|
map.put("bn2",payBill.getBillName()); |
|
|
|
map.put("money2",payBill.getReceivePay()); |
|
|
|
} |
|
|
|
rowsParams.add(map); |
|
|
|
count++; |
|
|
|
} |
|
|
|
|
|
|
|
String templatePath = "contract-word-template/bill_owe.docx"; |
|
|
|
String templatePath = "contract-word-template/settle.docx"; |
|
|
|
String filepath = fmUploadDir; |
|
|
|
String filename = UUID.randomUUID() + ".docx"; |
|
|
|
String exportFileName = "催缴单.docx"; |
|
|
|
|