| @@ -148,7 +148,7 @@ public class WxFinancePrintController extends BaseController { | |||||
| @PostMapping("confirmPrint") | @PostMapping("confirmPrint") | ||||
| @TenantIgnore | @TenantIgnore | ||||
| public ResultData confirmPrint(@RequestBody WxFinancePrintTemplate record) { | public ResultData confirmPrint(@RequestBody WxFinancePrintTemplate record) { | ||||
| if (StringUtils.isBlank(record.getTenantId())||null == record.getDataId()) { | |||||
| if (StringUtils.isBlank(record.getTenantId())||null == record.getDataIds() || record.getDataIds().size() <= 0 ) { | |||||
| return new ResultData(Result.ERROR,"参数不对"); | return new ResultData(Result.ERROR,"参数不对"); | ||||
| } | } | ||||
| wxFinancePrintService.confirmPrint(record); | wxFinancePrintService.confirmPrint(record); | ||||
| @@ -59,7 +59,5 @@ public class WxFinancePrintTemplate extends TenantEntity { | |||||
| private List tempItems; | private List tempItems; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private List<Long> dataIds; | private List<Long> dataIds; | ||||
| @TableField(exist = false) | |||||
| private Long dataId; | |||||
| } | } | ||||
| @@ -69,6 +69,16 @@ public class WxFinanceReceive extends TenantEntity { | |||||
| return new BigDecimal(receiveMoney).subtract(new BigDecimal(useMoney)).toPlainString(); | return new BigDecimal(receiveMoney).subtract(new BigDecimal(useMoney)).toPlainString(); | ||||
| } | } | ||||
| public String getAllReceiveMoney() { | |||||
| if (StringUtils.isBlank(receiveMoney)) { | |||||
| receiveMoney = "0"; | |||||
| } | |||||
| if (StringUtils.isBlank(setOffMoney)) { | |||||
| setOffMoney = "0"; | |||||
| } | |||||
| return new BigDecimal(receiveMoney).add(new BigDecimal(setOffMoney)).toPlainString(); | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value = "状态EnumFinanceReceiveStatus", name = "status") | @io.swagger.annotations.ApiModelProperty(value = "状态EnumFinanceReceiveStatus", name = "status") | ||||
| private Integer status; | private Integer status; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @@ -54,10 +54,12 @@ public class PrintCustomedTableDataHandler{ | |||||
| } | } | ||||
| String trclass = titleTr.attr("class"); | String trclass = titleTr.attr("class"); | ||||
| String trstyle = titleTr.attr("style"); | String trstyle = titleTr.attr("style"); | ||||
| Element currentIndexElement = titleTr; | |||||
| for (int i = 0 ; i < listdata.size(); i ++) { | for (int i = 0 ; i < listdata.size(); i ++) { | ||||
| Object object = listdata.get(i); | Object object = listdata.get(i); | ||||
| JSONObject o = JSON.parseObject(JSON.toJSONString(object)); | JSONObject o = JSON.parseObject(JSON.toJSONString(object)); | ||||
| Element tr = titleTr.parent().appendElement("tr"); | Element tr = titleTr.parent().appendElement("tr"); | ||||
| tr.after(currentIndexElement); | |||||
| if (StringUtils.isNotBlank(trclass)) { | if (StringUtils.isNotBlank(trclass)) { | ||||
| tr.attr("class", trclass); | tr.attr("class", trclass); | ||||
| } | } | ||||
| @@ -114,6 +116,7 @@ public class PrintCustomedTableDataHandler{ | |||||
| tre.appendText(tdcontent.toString()); | tre.appendText(tdcontent.toString()); | ||||
| } | } | ||||
| } | } | ||||
| currentIndexElement = tr; | |||||
| } | } | ||||
| return doc.head().html() + doc.body().html(); | return doc.head().html() + doc.body().html(); | ||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.print.data.impl; | package com.iformall.print.data.impl; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -7,12 +8,14 @@ import java.util.Map; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||||
| import com.iformall.domain.po.WxAllBill; | import com.iformall.domain.po.WxAllBill; | ||||
| import com.iformall.domain.po.WxEnergyFees; | import com.iformall.domain.po.WxEnergyFees; | ||||
| import com.iformall.domain.po.WxFinanceReceive; | import com.iformall.domain.po.WxFinanceReceive; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.print.data.PrintDataParser; | import com.iformall.print.data.PrintDataParser; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.PriceUtilV2; | |||||
| /** | /** | ||||
| * 财务数据解析 | * 财务数据解析 | ||||
| @@ -36,10 +39,29 @@ public class PrintFinanceReceiveDataHandler implements PrintDataParser{ | |||||
| return DateUtils.date2String(receive.getCreateTime()); | return DateUtils.date2String(receive.getCreateTime()); | ||||
| }else if (name.equals("receiveMoney")) { | }else if (name.equals("receiveMoney")) { | ||||
| return receive.getReceiveMoney(); | return receive.getReceiveMoney(); | ||||
| }else if (name.equals("receiveMoneyChinese")) { | |||||
| if (StringUtils.isNotBlank(receive.getReceiveMoney())) { | |||||
| return PriceUtilV2.number2CNMontrayUnit(new BigDecimal(receive.getReceiveMoney())); | |||||
| } | |||||
| return ""; | |||||
| }else if (name.equals("payMoney")) { | }else if (name.equals("payMoney")) { | ||||
| return receive.getPayMoney(); | return receive.getPayMoney(); | ||||
| }else if (name.equals("payMoneyChinese")) { | |||||
| if (StringUtils.isNotBlank(receive.getPayMoney())) { | |||||
| return PriceUtilV2.number2CNMontrayUnit(new BigDecimal(receive.getPayMoney())); | |||||
| } | |||||
| return ""; | |||||
| }else if (name.equals("setOffMoney")) { | }else if (name.equals("setOffMoney")) { | ||||
| return receive.getSetOffMoney(); | return receive.getSetOffMoney(); | ||||
| }else if (name.equals("setOffMoneyChinese")) { | |||||
| if (StringUtils.isNotBlank(receive.getSetOffMoney())) { | |||||
| return PriceUtilV2.number2CNMontrayUnit(new BigDecimal(receive.getSetOffMoney())); | |||||
| } | |||||
| return ""; | |||||
| }else if (name.equals("allReceiveMoney")) { | |||||
| return receive.getAllReceiveMoney(); | |||||
| }else if (name.equals("allReceiveMoneyChinese")) { | |||||
| return PriceUtilV2.number2CNMontrayUnit(new BigDecimal(receive.getAllReceiveMoney())); | |||||
| }else if (name.equals("useMoney")) { | }else if (name.equals("useMoney")) { | ||||
| return receive.getUseMoney(); | return receive.getUseMoney(); | ||||
| }else if (name.equals("receiveTypeName")) { | }else if (name.equals("receiveTypeName")) { | ||||
| @@ -278,36 +278,6 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| billList = wxAllBillService.list(billq); | billList = wxAllBillService.list(billq); | ||||
| } | } | ||||
| if (null != billList) { | |||||
| BigDecimal receivePayTotal = new BigDecimal(0); | |||||
| BigDecimal setoffTotal = new BigDecimal(0); | |||||
| BigDecimal payTotal = new BigDecimal(0); | |||||
| BigDecimal returnTotal = new BigDecimal(0); | |||||
| for (int j = 0 ; j < billList.size() ; j++) { | |||||
| WxAllBill ab = billList.get(j); | |||||
| if (StringUtils.isNotBlank(ab.getReceivePay())) { | |||||
| receivePayTotal = receivePayTotal.add(new BigDecimal(ab.getReceivePay())); | |||||
| } | |||||
| if (StringUtils.isNotBlank(ab.getSetOff())) { | |||||
| setoffTotal = setoffTotal.add(new BigDecimal(ab.getSetOff())); | |||||
| } | |||||
| if (StringUtils.isNotBlank(ab.getPay())) { | |||||
| payTotal = payTotal.add(new BigDecimal(ab.getPay())); | |||||
| } | |||||
| if (StringUtils.isNotBlank(ab.getReturnPay())) { | |||||
| returnTotal = returnTotal.add(new BigDecimal(ab.getReturnPay())); | |||||
| } | |||||
| } | |||||
| //合计 | |||||
| WxAllBill totalab = new WxAllBill(); | |||||
| totalab.setShopNumber("合计"); | |||||
| totalab.setReceivePay(receivePayTotal.toPlainString()); | |||||
| totalab.setSetOff(setoffTotal.toPlainString()); | |||||
| totalab.setPay(payTotal.toPlainString()); | |||||
| totalab.setReturnPay(returnTotal.toPlainString()); | |||||
| totalab.setEnergyFeesName(PriceUtilV2.number2CNMontrayUnit(receivePayTotal)); | |||||
| billList.add(totalab); | |||||
| } | |||||
| PrintVo vo = handleComponentData(templateId,o,items, printFinanceReceiveDataHandler,re,printBillDataHandler, billList,merchantMap,feesMap,shopNumber); | PrintVo vo = handleComponentData(templateId,o,items, printFinanceReceiveDataHandler,re,printBillDataHandler, billList,merchantMap,feesMap,shopNumber); | ||||
| if (null != vo) { | if (null != vo) { | ||||
| voList.add(vo); | voList.add(vo); | ||||
| @@ -382,9 +352,12 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| @Override | @Override | ||||
| public void confirmPrint(WxFinancePrintTemplate record) { | public void confirmPrint(WxFinancePrintTemplate record) { | ||||
| if (record.getType().intValue() == EnumFinancePrintDataType.FINANCE_RECEIVE.getCode()) { | if (record.getType().intValue() == EnumFinancePrintDataType.FINANCE_RECEIVE.getCode()) { | ||||
| WxFinanceReceive receive = wxFinanceService.getReceiveById(record, record.getDataId()); | |||||
| if (null != receive) { | |||||
| wxFinanceService.updateReceivePrint(receive); | |||||
| for (int i = 0 ; i < record.getDataIds().size() ; i ++) { | |||||
| Long dataId = record.getDataIds().get(i); | |||||
| WxFinanceReceive receive = wxFinanceService.getReceiveById(record, dataId); | |||||
| if (null != receive) { | |||||
| wxFinanceService.updateReceivePrint(receive); | |||||
| } | |||||
| } | } | ||||
| }else if (record.getType().intValue() == EnumFinancePrintDataType.BILL.getCode()) { | }else if (record.getType().intValue() == EnumFinancePrintDataType.BILL.getCode()) { | ||||