| @@ -277,13 +277,26 @@ public class WxFinanceController extends BaseController { | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("收款记录列表") | |||
| @ApiOperation("收款记录列表(收款列表页面,有子账单)") | |||
| @GetMapping("receiveList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData receiveList(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| PageInfo<WxFinanceReceiveVo> page = wxFinanceService.receiveVoListWithBillsAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("收款记录列表") | |||
| @GetMapping("onlyReceiveList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData onlyReceiveList(@ModelAttribute WxFinanceReceive record, Integer pageNum, Integer pageSize) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| PageInfo<WxFinanceReceiveVo> page = wxFinanceService.receiveVoListAsPage(record, pageNum, pageSize); | |||
| @@ -51,12 +51,16 @@ public class WxFinancePrintController extends BaseController { | |||
| @GetMapping("types") | |||
| public ResultData types() { | |||
| List<Map> list = new ArrayList<Map>(); | |||
| for (EnumFinancePrintDataType t : EnumFinancePrintDataType.values()) { | |||
| Map m = new HashMap(); | |||
| m.put("id", t.getCode()); | |||
| m.put("name", t.getMessage()); | |||
| list.add(m); | |||
| } | |||
| Map m = new HashMap(); | |||
| m.put("id", EnumFinancePrintDataType.FINANCE_RECEIVE.getCode()); | |||
| m.put("name", EnumFinancePrintDataType.FINANCE_RECEIVE.getMessage()); | |||
| list.add(m); | |||
| // for (EnumFinancePrintDataType t : EnumFinancePrintDataType.values()) { | |||
| // Map m = new HashMap(); | |||
| // m.put("id", t.getCode()); | |||
| // m.put("name", t.getMessage()); | |||
| // list.add(m); | |||
| // } | |||
| return new ResultData(list); | |||
| } | |||
| @@ -140,6 +144,17 @@ public class WxFinancePrintController extends BaseController { | |||
| return new ResultData(wxFinancePrintService.parseTemplateData(record.getTenantId(),record.getId(),record.getDataIds(),null)); | |||
| } | |||
| @ApiOperation("确认打印") | |||
| @PostMapping("confirmPrint") | |||
| @TenantIgnore | |||
| public ResultData confirmPrint(@RequestBody WxFinancePrintTemplate record) { | |||
| if (StringUtils.isBlank(record.getTenantId())||null == record.getDataIds() || record.getDataIds().size() <= 0 ) { | |||
| return new ResultData(Result.ERROR,"参数不对"); | |||
| } | |||
| wxFinancePrintService.confirmPrint(record); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("") | |||
| @GetMapping("needUpdate") | |||
| @TenantIgnore | |||
| @@ -110,7 +110,7 @@ public class WxAllBill extends TenantEntity { | |||
| private String starttimeStr; | |||
| public String getStarttimeStr() { | |||
| if (null != starttime) { | |||
| starttimeStr = DateUtils.date2String(starttime); | |||
| starttimeStr = DateUtils.date2String(starttime,DateUtils.DATE_PATTERN); | |||
| } | |||
| return starttimeStr; | |||
| } | |||
| @@ -128,7 +128,7 @@ public class WxAllBill extends TenantEntity { | |||
| private String endtimeStr; | |||
| public String getEndtimeStr() { | |||
| if (null != endtime) { | |||
| endtimeStr = DateUtils.date2String(endtime); | |||
| endtimeStr = DateUtils.date2String(endtime,DateUtils.DATE_PATTERN); | |||
| } | |||
| return endtimeStr; | |||
| } | |||
| @@ -58,6 +58,6 @@ public class WxFinancePrintTemplate extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private List tempItems; | |||
| @TableField(exist = false) | |||
| List<Long> dataIds; | |||
| private List<Long> dataIds; | |||
| } | |||
| @@ -69,6 +69,16 @@ public class WxFinanceReceive extends TenantEntity { | |||
| 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") | |||
| private Integer status; | |||
| @TableField(exist = false) | |||
| @@ -28,7 +28,10 @@ public class WxFinanceReceiveSetoff extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "预收收款编号", name = "advanceId") | |||
| @io.swagger.annotations.ApiModelProperty(value = "收款单编号", name = "advanceId") | |||
| private Long receiveId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "收收款编号", name = "advanceId") | |||
| private Long advanceId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "账单编号", name = "billId") | |||
| @@ -148,6 +148,9 @@ public class WxFinanceReceiveVo implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否已结账完成", name = "isFinish") | |||
| private Integer isFinish; | |||
| @io.swagger.annotations.ApiModelProperty(value = "支付给商户金额", name = "payMoney") | |||
| private String payMoney; | |||
| public void initByReceive(WxFinanceReceive receive,WxFinanceReceiveBill receiveBill) { | |||
| @@ -168,6 +171,8 @@ public class WxFinanceReceiveVo implements Serializable { | |||
| this.remark = receive.getRemark(); | |||
| this.isPrint = receive.getIsPrint(); | |||
| this.isFinish = receive.getIsFinish(); | |||
| this.merchantName = receive.getMerchantName(); | |||
| this.payMoney = receive.getPayMoney(); | |||
| if (null != receiveBill) { | |||
| this.rid = receiveBill.getId(); | |||
| this.receiveId = receiveBill.getReceiveId(); | |||
| @@ -28,6 +28,6 @@ public interface WxFinanceReceiveMapper extends CommonMapper<WxFinanceReceive, L | |||
| List<WxFinanceReceivePayway> getReceivePayWaySum(WxFinanceReceive record); | |||
| void updatePrint(WxFinanceReceive record); | |||
| } | |||
| @@ -31,8 +31,8 @@ public class PrintComponentHandler implements Serializable { | |||
| } | |||
| public static Object parseComponent(WxFinancePrintData data) { | |||
| JSONObject dataJson = JSON.parseObject(data.getPrintDataJson()); | |||
| if("braid-txt".equals(data.getPrintDataType())) { | |||
| JSONObject dataJson = JSON.parseObject(data.getPrintDataJson()); | |||
| PrintBraidTxt txt = new PrintBraidTxt(); | |||
| txt.setTitle(data.getName()); | |||
| txt.setIsEdit(data.getIsEdit()); | |||
| @@ -41,6 +41,7 @@ public class PrintComponentHandler implements Serializable { | |||
| txt.setDefaultValue(txt.getTitle()); | |||
| return txt; | |||
| }else if ("braid-table".equals(data.getPrintDataType())) { | |||
| JSONObject dataJson = JSON.parseObject(data.getPrintDataJson()); | |||
| PrintBraidTable table = new PrintBraidTable(); | |||
| table.setTitle(data.getName()); | |||
| table.setIsEdit(data.getIsEdit()); | |||
| @@ -78,14 +79,14 @@ public class PrintComponentHandler implements Serializable { | |||
| PrintHtml html = new PrintHtml(); | |||
| html.setTitle(data.getName()); | |||
| html.setIsEdit(data.getIsEdit()); | |||
| html.setValue(dataJson.getString("html")); | |||
| html.setValue(data.getPrintDataJson()); | |||
| html.setDefaultValue(data.getDefaultValue()); | |||
| return html; | |||
| }else if ("braid-html-table".equals(data.getPrintDataType())) { | |||
| PrintHtml html = new PrintHtml(); | |||
| html.setTitle(data.getName()); | |||
| html.setIsEdit(data.getIsEdit()); | |||
| html.setValue(dataJson.getString("html")); | |||
| html.setValue(data.getPrintDataJson()); | |||
| html.setIsFmCustomizedTable(EnumYesOrNo.YES.getCode()); | |||
| html.setDefaultValue(data.getDefaultValue()); | |||
| return html; | |||
| @@ -1,11 +1,13 @@ | |||
| package com.iformall.print.data; | |||
| import java.util.ArrayList; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import org.jsoup.Jsoup; | |||
| import org.jsoup.nodes.Document; | |||
| import org.jsoup.nodes.Element; | |||
| import org.jsoup.nodes.Node; | |||
| import org.jsoup.nodes.TextNode; | |||
| import org.springframework.stereotype.Service; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| @@ -42,44 +44,41 @@ public class PrintCustomedTableDataHandler{ | |||
| } | |||
| Document doc = Jsoup.parse(componentContent); | |||
| Element titleTr = doc.getElementById("titletr"); | |||
| List<Node> titleTds = titleTr.childNodes(); | |||
| List<Node> titleAllTds = titleTr.childNodes(); | |||
| List<Node> titleTds = new ArrayList<Node>();; | |||
| for (int i = 0 ; i < titleAllTds.size() ; i ++) { | |||
| Node tatn = titleAllTds.get(i); | |||
| if (tatn instanceof Element) { | |||
| titleTds.add(tatn); | |||
| } | |||
| } | |||
| String trclass = titleTr.attr("class"); | |||
| String trstyle = titleTr.attr("style"); | |||
| StringBuffer sb = new StringBuffer(); | |||
| for (int i = 0 ; i < listdata.size(); i ++) { | |||
| Object object = listdata.get(i); | |||
| JSONObject o = JSON.parseObject(JSON.toJSONString(object)); | |||
| Element tr = titleTr.parent().appendElement("tr"); | |||
| sb.append("<tr "); | |||
| if (StringUtils.isNotBlank(trclass)) { | |||
| sb.append(" class = \"").append(trclass).append("\" "); | |||
| tr.attr("class", trclass); | |||
| } | |||
| if (StringUtils.isNotBlank(trstyle)) { | |||
| sb.append(" style = \"").append(trstyle).append("\" "); | |||
| tr.attr("style", trstyle); | |||
| } | |||
| sb.append(">"); | |||
| for (int j = 0 ; j < titleTds.size() ; j ++) { | |||
| Node td = titleTds.get(j); | |||
| Element tre = tr.appendElement("td"); | |||
| String tdclass = td.attr("class"); | |||
| String tdstyle = td.attr("style"); | |||
| String tdcolspan = td.attr("colspan"); | |||
| sb.append("<td "); | |||
| if (StringUtils.isNotBlank(tdclass)) { | |||
| sb.append(" class = \"").append(tdclass).append("\" "); | |||
| tre.attr("class", tdclass); | |||
| } | |||
| if (StringUtils.isNotBlank(tdstyle)) { | |||
| sb.append(" style = \"").append(tdstyle).append("\" "); | |||
| tre.attr("style", tdstyle); | |||
| } | |||
| if (StringUtils.isNotBlank(tdcolspan)) { | |||
| sb.append(" colspan = \"").append(tdcolspan).append("\" "); | |||
| tre.attr("colspan", tdcolspan); | |||
| } | |||
| sb.append(">"); | |||
| //取什么属性 | |||
| String fieldName = td.attr("fieldName"); | |||
| if (StringUtils.isNotBlank(fieldName)) { | |||
| @@ -114,10 +113,7 @@ public class PrintCustomedTableDataHandler{ | |||
| } | |||
| tre.appendText(tdcontent.toString()); | |||
| } | |||
| sb.append("</td>"); | |||
| } | |||
| sb.append("</tr>"); | |||
| } | |||
| return doc.head().html() + doc.body().html(); | |||
| } | |||
| @@ -4,6 +4,7 @@ import java.util.Map; | |||
| import org.springframework.stereotype.Service; | |||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||
| import com.iformall.domain.po.WxAllBill; | |||
| import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| @@ -23,7 +24,10 @@ public class PrintBillDataHandler implements PrintDataParser{ | |||
| if (name.equals("id")) { | |||
| return receive.getId(); | |||
| }else if (name.equals("createtime")) { | |||
| return DateUtils.date2String(receive.getCreatetime()); | |||
| if (null != receive.getCreatetime()) { | |||
| return DateUtils.date2String(receive.getCreatetime()); | |||
| } | |||
| return ""; | |||
| }else if (name.equals("receivePay")) { | |||
| return receive.getReceivePay(); | |||
| }else if (name.equals("pay")) { | |||
| @@ -33,15 +37,21 @@ public class PrintBillDataHandler implements PrintDataParser{ | |||
| }else if (name.equals("returnPay")) { | |||
| return receive.getReturnPay(); | |||
| }else if (name.equals("starttime")) { | |||
| return DateUtils.date2String(receive.getStarttime(),DateUtils.DATE_PATTERN); | |||
| if (null != receive.getStarttime()) { | |||
| return DateUtils.date2String(receive.getStarttime(),DateUtils.DATE_PATTERN); | |||
| } | |||
| return ""; | |||
| }else if (name.equals("endtime")) { | |||
| return DateUtils.date2String(receive.getEndtime(),DateUtils.DATE_PATTERN); | |||
| if (null != receive.getEndtime()) { | |||
| return DateUtils.date2String(receive.getEndtime(),DateUtils.DATE_PATTERN); | |||
| } | |||
| return ""; | |||
| }else if (name.equals("owe")) { | |||
| return receive.getOwe(); | |||
| }else if (name.equals("statusName")) { | |||
| return receive.getStatusName(); | |||
| }else if (name.equals("merchantName")) { | |||
| if (null != merchantMap) { | |||
| if (null != merchantMap && null != receive.getMerchantId()) { | |||
| WxMerchant m = merchantMap.get(receive.getMerchantId()); | |||
| if (null != m) { | |||
| return m.getName(); | |||
| @@ -49,7 +59,10 @@ public class PrintBillDataHandler implements PrintDataParser{ | |||
| } | |||
| return ""; | |||
| }else if (name.equals("feesName")) { | |||
| if (null != feesMap) { | |||
| if (StringUtils.isNotBlank(receive.getEnergyFeesName())) { | |||
| return receive.getEnergyFeesName(); | |||
| } | |||
| if (null != feesMap && null != receive.getEnergyFeesId()) { | |||
| WxEnergyFees f = feesMap.get(receive.getEnergyFeesId()); | |||
| if (null != f) { | |||
| return f.getName(); | |||
| @@ -59,7 +72,10 @@ public class PrintBillDataHandler implements PrintDataParser{ | |||
| }else if (name.equals("billRemark")) { | |||
| return receive.getBillRemark(); | |||
| }else if (name.equals("shopNumber")) { | |||
| if (null != shopNumber) { | |||
| if (StringUtils.isNotBlank(receive.getShopNumber())) { | |||
| return receive.getShopNumber(); | |||
| } | |||
| if (null != shopNumber && null != receive.getMerchantId()) { | |||
| String m = shopNumber.get(receive.getMerchantId()); | |||
| return m; | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.print.data.impl; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -7,12 +8,14 @@ import java.util.Map; | |||
| import org.springframework.stereotype.Service; | |||
| 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.WxEnergyFees; | |||
| import com.iformall.domain.po.WxFinanceReceive; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.print.data.PrintDataParser; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.PriceUtilV2; | |||
| /** | |||
| * 财务数据解析 | |||
| @@ -36,10 +39,29 @@ public class PrintFinanceReceiveDataHandler implements PrintDataParser{ | |||
| return DateUtils.date2String(receive.getCreateTime()); | |||
| }else if (name.equals("receiveMoney")) { | |||
| 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")) { | |||
| 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")) { | |||
| 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")) { | |||
| return receive.getUseMoney(); | |||
| }else if (name.equals("receiveTypeName")) { | |||
| @@ -17,4 +17,5 @@ public interface WxFinancePrintService { | |||
| void copy(WxFinancePrintTemplate record); | |||
| void setTemplatesDel(WxFinancePrintTemplate record); | |||
| List<PrintVo> parseTemplateData(String tenantId,Long templateId,List<Long> dataIds,Object entity); | |||
| void confirmPrint(WxFinancePrintTemplate record); | |||
| } | |||
| @@ -28,6 +28,7 @@ public interface WxFinanceService { | |||
| void payWayInit(TenantEntity tenantInfo); | |||
| //收付款 | |||
| PageInfo<WxFinanceReceiveVo> receiveVoListWithBillsAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxFinanceReceiveVo> receiveVoListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize); | |||
| List<WxFinanceReceive> findReceiveList(WxFinanceReceive record); | |||
| Map createReceive(WxFinanceReceive record,MallUserInfo user); | |||
| @@ -36,6 +37,7 @@ public interface WxFinanceService { | |||
| void invalidReceive(WxFinanceReceive record,MallUserInfo user,String remark); | |||
| void redSetoffReceive(WxFinanceReceive record,MallUserInfo user); | |||
| List<Long> getReceiveBillIds(WxFinanceReceiveBill record); | |||
| void updateReceivePrint(WxFinanceReceive record); | |||
| //预收款 | |||
| List<WxAllBill> calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user); | |||
| FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record); | |||
| @@ -40,6 +40,7 @@ import com.iformall.service.WxFinancePrintService; | |||
| import com.iformall.service.WxFinanceService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxShopService; | |||
| import com.iformall.utils.PriceUtilV2; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| @@ -192,10 +193,10 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| return isSetDefaultValue; | |||
| } | |||
| private PrintVo handleComponentData(Long templateId,JSONObject templateContent,JSONArray items,PrintDataParser objectParser,Object object,PrintDataParser listParser,List listdata,Object... params) { | |||
| private PrintVo handleComponentData(Long dataId,Long templateId,JSONObject templateContent,JSONArray items,PrintDataParser objectParser,Object object,PrintDataParser listParser,List listdata,Object... params) { | |||
| if (null != items) { | |||
| PrintVo vo = new PrintVo(); | |||
| vo.setDataId(templateId); | |||
| vo.setDataId(dataId); | |||
| for (int j = 0 ; j < items.size() ; j ++) { | |||
| JSONObject ov = items.getJSONObject(j); | |||
| //是否是定制化的表格 | |||
| @@ -213,10 +214,14 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| if (StringUtils.isBlank(fieldName)) { | |||
| }else { | |||
| Object or = objectParser.getObjectValue(fieldName,object,params); | |||
| if (null == or) { | |||
| or = ""; | |||
| } | |||
| if (isSetDefaultValue) { | |||
| ov.put("defaultValue", objectParser.getObjectValue(fieldName,object,params)); | |||
| ov.put("defaultValue", or); | |||
| }else { | |||
| ov.put("value", objectParser.getObjectValue(fieldName,object,params)); | |||
| ov.put("value", or); | |||
| } | |||
| } | |||
| } | |||
| @@ -272,7 +277,17 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| billq.setIds(billIdList); | |||
| billList = wxAllBillService.list(billq); | |||
| } | |||
| PrintVo vo = handleComponentData(templateId,o,items, printFinanceReceiveDataHandler,re,printBillDataHandler, billList,merchantMap,feesMap,shopNumber); | |||
| if (null != billList) { | |||
| WxAllBill billq = new WxAllBill(); | |||
| billq.setShopNumber("合计"); | |||
| billq.setEnergyFeesName(PriceUtilV2.number2CNMontrayUnit(new BigDecimal(re.getAllReceiveMoney()))); | |||
| billq.setReceivePay(re.getReceiveMoney()); | |||
| billq.setSetOff(re.getSetOffMoney()); | |||
| billList.add(billq); | |||
| } | |||
| PrintVo vo = handleComponentData(re.getId(),templateId,o,items, printFinanceReceiveDataHandler,re,printBillDataHandler, billList,merchantMap,feesMap,shopNumber); | |||
| if (null != vo) { | |||
| voList.add(vo); | |||
| } | |||
| @@ -289,7 +304,7 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| List<PrintVo> voList = new ArrayList<PrintVo>(); | |||
| for (int i = 0 ; i < billAllList.size(); i ++) { | |||
| WxAllBill re = billAllList.get(i); | |||
| PrintVo vo = handleComponentData(templateId,o,items, printBillDataHandler,re,null, null,merchantMap,feesMap,shopNumber); | |||
| PrintVo vo = handleComponentData(re.getId(),templateId,o,items, printBillDataHandler,re,null, null,merchantMap,feesMap,shopNumber); | |||
| if (null != vo) { | |||
| voList.add(vo); | |||
| } | |||
| @@ -332,7 +347,7 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| owe.setNeedPay(payTotal.toPlainString()); | |||
| sumlist.add(owe); | |||
| PrintVo vo = handleComponentData(templateId,o,items, printMerchantSettleDataHandler,bq,printMerchantSettleDataHandler, sumlist,merchantMap,feesMap,shopNumber); | |||
| PrintVo vo = handleComponentData(bq.getMerchantId(),templateId,o,items, printMerchantSettleDataHandler,bq,printMerchantSettleDataHandler, sumlist,merchantMap,feesMap,shopNumber); | |||
| if (null != vo) { | |||
| voList.add(vo); | |||
| } | |||
| @@ -343,5 +358,22 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| return null; | |||
| } | |||
| @Override | |||
| public void confirmPrint(WxFinancePrintTemplate record) { | |||
| if (record.getType().intValue() == EnumFinancePrintDataType.FINANCE_RECEIVE.getCode()) { | |||
| 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.RENT_OWE.getCode()) { | |||
| } | |||
| } | |||
| } | |||
| @@ -425,8 +425,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| } | |||
| } | |||
| @Override | |||
| public PageInfo<WxFinanceReceiveVo> receiveVoListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize) { | |||
| private PageInfo<WxFinanceReceiveVo> receiveVoListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize,boolean hasBills) { | |||
| initQueryParam(record); | |||
| PageInfo<WxFinanceReceive> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFinanceReceiveMapper.findList(record)); | |||
| PageInfo<WxFinanceReceiveVo> pageVo = new PageInfo<WxFinanceReceiveVo>(); | |||
| @@ -458,44 +457,50 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| } | |||
| } | |||
| //查询关联的账单记录 | |||
| WxFinanceReceiveBill rb = new WxFinanceReceiveBill(); | |||
| rb.updateTenantInfo(record); | |||
| rb.setReceiveId(fr.getId()); | |||
| List<WxFinanceReceiveBill> bills = wxFinanceReceiveBillMapper.findList(rb); | |||
| if (null != bills && bills.size() > 0 ) { | |||
| for (int j = 0 ; j < bills.size(); j ++) { | |||
| WxFinanceReceiveBill frb = bills.get(j); | |||
| WxFinanceReceiveVo vo = new WxFinanceReceiveVo(); | |||
| vo.initByReceive(fr, frb); | |||
| if (null != paywayMap && null != frb.getPayWay()) { | |||
| WxBillPayWay p = paywayMap.get(vo.getPayWay()); | |||
| if (null != p) { | |||
| vo.setPayWayName(p.getName()); | |||
| } | |||
| } | |||
| if (null != shopNumberMap && null != frb.getMerchantId()) { | |||
| String shopNumber = shopNumberMap.get(vo.getMerchantId()); | |||
| vo.setShopNumber(shopNumber); | |||
| if (null != merchantMap) { | |||
| WxMerchant merchant = merchantMap.get(vo.getMerchantId()); | |||
| if (null != merchant) { | |||
| vo.setMerchantName(merchant.getName()); | |||
| } | |||
| } | |||
| } | |||
| if (null != fmap && null != vo.getFeesId()) { | |||
| WxEnergyFees ef = fmap.get(vo.getFeesId()); | |||
| if (null != ef) { | |||
| vo.setFeesName(ef.getName()); | |||
| } | |||
| } | |||
| volist.add(vo); | |||
| } | |||
| }else { | |||
| if (!hasBills) { | |||
| WxFinanceReceiveVo vo = new WxFinanceReceiveVo(); | |||
| vo.initByReceive(fr, null); | |||
| volist.add(vo); | |||
| }else { | |||
| //查询关联的账单记录 | |||
| WxFinanceReceiveBill rb = new WxFinanceReceiveBill(); | |||
| rb.updateTenantInfo(record); | |||
| rb.setReceiveId(fr.getId()); | |||
| List<WxFinanceReceiveBill> bills = wxFinanceReceiveBillMapper.findList(rb); | |||
| if (null != bills && bills.size() > 0 ) { | |||
| for (int j = 0 ; j < bills.size(); j ++) { | |||
| WxFinanceReceiveBill frb = bills.get(j); | |||
| WxFinanceReceiveVo vo = new WxFinanceReceiveVo(); | |||
| vo.initByReceive(fr, frb); | |||
| if (null != paywayMap && null != frb.getPayWay()) { | |||
| WxBillPayWay p = paywayMap.get(vo.getPayWay()); | |||
| if (null != p) { | |||
| vo.setPayWayName(p.getName()); | |||
| } | |||
| } | |||
| if (null != shopNumberMap && null != frb.getMerchantId()) { | |||
| String shopNumber = shopNumberMap.get(vo.getMerchantId()); | |||
| vo.setShopNumber(shopNumber); | |||
| if (null != merchantMap) { | |||
| WxMerchant merchant = merchantMap.get(vo.getMerchantId()); | |||
| if (null != merchant) { | |||
| vo.setMerchantName(merchant.getName()); | |||
| } | |||
| } | |||
| } | |||
| if (null != fmap && null != vo.getFeesId()) { | |||
| WxEnergyFees ef = fmap.get(vo.getFeesId()); | |||
| if (null != ef) { | |||
| vo.setFeesName(ef.getName()); | |||
| } | |||
| } | |||
| volist.add(vo); | |||
| } | |||
| }else { | |||
| WxFinanceReceiveVo vo = new WxFinanceReceiveVo(); | |||
| vo.initByReceive(fr, null); | |||
| volist.add(vo); | |||
| } | |||
| } | |||
| } | |||
| pageVo.setList(volist); | |||
| @@ -504,6 +509,16 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| return pageVo; | |||
| } | |||
| @Override | |||
| public PageInfo<WxFinanceReceiveVo> receiveVoListWithBillsAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize) { | |||
| return receiveVoListAsPage(record, pageIndex, pageSize, true); | |||
| } | |||
| @Override | |||
| public PageInfo<WxFinanceReceiveVo> receiveVoListAsPage(WxFinanceReceive record, Integer pageIndex, Integer pageSize) { | |||
| return receiveVoListAsPage(record, pageIndex, pageSize, false); | |||
| } | |||
| @Override | |||
| public List<WxFinanceReceive> findReceiveList(WxFinanceReceive record) { | |||
| initQueryParam(record); | |||
| @@ -745,6 +760,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| WxFinanceReceiveSetoff rb = new WxFinanceReceiveSetoff(); | |||
| rb.updateTenantInfo(addreceive); | |||
| rb.setAdvanceId(advance.getId()); | |||
| rb.setReceiveId(addreceive.getId()); | |||
| rb.setBillId(bill.getId()); | |||
| rb.setBillType(bill.getBillType()); | |||
| rb.setFeesId(bill.getEnergyFeesId()); | |||
| @@ -842,8 +858,9 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| BigDecimal oweDecimal = new BigDecimal(bill.getOwe()); | |||
| //只有没有有欠款才会支付 | |||
| if (oweDecimal.compareTo(b0) > 0 ) { | |||
| noNeedCreate = true; | |||
| return noNeedCreate; | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"账单有欠缴,不能付款."); | |||
| //noNeedCreate = true; | |||
| //return noNeedCreate; | |||
| } | |||
| if (calcuteDto.getTotalRemainPay().add(oweDecimal).compareTo(b0) > 0 ) { | |||
| money = oweDecimal.multiply(new BigDecimal(-1)).toPlainString(); | |||
| @@ -990,7 +1007,7 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| rsq.updateTenantInfo(record); | |||
| rsq.setBillId(bill.getId()); | |||
| rsq.setBillType(bill.getBillType()); | |||
| rsq.setAdvanceId(rb.getReceiveId()); | |||
| rsq.setReceiveId(rb.getReceiveId()); | |||
| List<WxFinanceReceiveSetoff> setoffList = wxFinanceReceiveSetoffMapper.findList(rsq); | |||
| if (null != setoffList) { | |||
| for (int j = 0 ; j < setoffList.size() ; j ++) { | |||
| @@ -1035,16 +1052,56 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||
| return wxFinanceReceiveBillMapper.findBillIdList(record); | |||
| } | |||
| @Override | |||
| public void updateReceivePrint(WxFinanceReceive record) { | |||
| wxFinanceReceiveMapper.updatePrint(record); | |||
| } | |||
| @Override | |||
| public void redSetoffReceive(WxFinanceReceive record, MallUserInfo user) { | |||
| invalidReceive(record, user , true); | |||
| copyRedSetOffReceive(record); | |||
| } | |||
| private void copyRedSetOffReceive(WxFinanceReceive record) { | |||
| Long oldRecordId = record.getId(); | |||
| //新增一个红冲,金额是负数 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setReceiveMoney("-"+record.getReceiveMoney()); | |||
| record.setSetOffMoney("-"+record.getSetOffMoney()); | |||
| if (StringUtils.isNotBlank(record.getReceiveMoney())) { | |||
| record.setReceiveMoney("-"+record.getReceiveMoney()); | |||
| } | |||
| if (StringUtils.isNotBlank(record.getSetOffMoney())) { | |||
| record.setSetOffMoney("-"+record.getSetOffMoney()); | |||
| } | |||
| if (StringUtils.isNotBlank(record.getPayMoney())) { | |||
| record.setPayMoney("-"+record.getPayMoney()); | |||
| } | |||
| if (StringUtils.isNotBlank(record.getUseMoney())) { | |||
| record.setUseMoney("-"+record.getUseMoney()); | |||
| } | |||
| record.setStatus(EnumFinanceReceiveStatus.RED_SETOFF.getCode()); | |||
| wxFinanceReceiveMapper.insert(record); | |||
| WxFinanceReceiveBill rbq = new WxFinanceReceiveBill(); | |||
| rbq.updateTenantInfo(record); | |||
| rbq.setReceiveId(oldRecordId); | |||
| rbq.setUpdateTime(new Date()); | |||
| List<WxFinanceReceiveBill> rbList = wxFinanceReceiveBillMapper.findList(rbq); | |||
| if (null != rbList ) { | |||
| for (int i = 0 ; i < rbList.size() ; i++ ) { | |||
| WxFinanceReceiveBill rb = rbList.get(i); | |||
| rb.setId(idWorker.nextId()); | |||
| if (StringUtils.isNotBlank(rb.getReceive())) { | |||
| rb.setReceive("-"+rb.getReceive()); | |||
| } | |||
| if (StringUtils.isNotBlank(rb.getPay())) { | |||
| rb.setPay("-"+rb.getPay()); | |||
| } | |||
| rb.setReceiveId(record.getId()); | |||
| wxFinanceReceiveBillMapper.insert(rb); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| @@ -138,6 +138,10 @@ | |||
| update wx_finance_receive set is_finish = 1 | |||
| <include refid="dynamicWhereConditions"/> | |||
| </update> | |||
| <update id="updatePrint" parameterType="com.iformall.domain.po.WxFinanceReceive"> | |||
| update wx_finance_receive set is_print = 1 where id = #{id} and tenant_id = #{tenantId} | |||
| </update> | |||
| </mapper> | |||
| @@ -7,6 +7,7 @@ | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <result column="receive_id" jdbcType="BIGINT" property="receiveId"/> | |||
| <result column="bill_id" jdbcType="BIGINT" property="billId"/> | |||
| <result column="bill_type" jdbcType="INTEGER" property="billType"/> | |||
| <result column="fees_id" jdbcType="BIGINT" property="feesId"/> | |||
| @@ -20,7 +21,7 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`bill_id`,`bill_type`,`fees_id`, | |||
| `advance_id`,`setoff`,`merchant_id`,`starttime`,`endtime`,`is_del` | |||
| `receive_id`,`advance_id`,`setoff`,`merchant_id`,`starttime`,`endtime`,`is_del` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -33,6 +34,7 @@ | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != billId ">and `bill_id` = #{billId}</if> | |||
| <if test=" null != receiveId ">and `receive_id` = #{receiveId}</if> | |||
| <if test=" null != billType ">and `bill_type` = #{billType}</if> | |||
| <if test=" null != feesId ">and `fees_id` = #{feesId}</if> | |||
| <if test=" null != advanceId ">and `advance_id` = #{advanceId}</if> | |||