diff --git a/mallinkAdmin/src/main/resources/db/migration/V201909031716__L_CONTRACT.sql b/mallinkAdmin/src/main/resources/db/migration/V201909031716__L_CONTRACT.sql new file mode 100644 index 000000000..e33453878 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201909031716__L_CONTRACT.sql @@ -0,0 +1 @@ +update wx_flow_config set type=21 where name = '结算单审核'; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 1bd1f9838..156f2c22c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -120,6 +120,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { @Autowired WxBillSettleRecordService wxBillSettleRecordService; + @Autowired + WxBillSettleService wxBillSettleService; + @Override public Map 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 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> 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 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";