| @@ -127,7 +127,7 @@ public class WxFinancePrintController extends BaseController { | |||||
| if (StringUtils.isBlank(tenantId)||null == dataIds || dataIds.size() <= 0 || null == templateId) { | if (StringUtils.isBlank(tenantId)||null == dataIds || dataIds.size() <= 0 || null == templateId) { | ||||
| return new ResultData(Result.ERROR,"参数不对"); | return new ResultData(Result.ERROR,"参数不对"); | ||||
| } | } | ||||
| return new ResultData(wxFinancePrintService.parseTemplateData(tenantId,templateId,dataIds)); | |||||
| return new ResultData(wxFinancePrintService.parseTemplateData(tenantId,templateId,dataIds,null)); | |||||
| } | } | ||||
| @ApiOperation("") | @ApiOperation("") | ||||
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.annotation.TenantIgnore; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| @@ -36,6 +37,7 @@ import com.iformall.service.SysConfigService; | |||||
| import com.iformall.service.WxAllBillService; | import com.iformall.service.WxAllBillService; | ||||
| import com.iformall.service.WxBillActionService; | import com.iformall.service.WxBillActionService; | ||||
| import com.iformall.service.WxEnergyService; | import com.iformall.service.WxEnergyService; | ||||
| import com.iformall.service.WxFinancePrintService; | |||||
| import com.iformall.service.WxFinanceService; | import com.iformall.service.WxFinanceService; | ||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxPayAccountBillService; | import com.iformall.service.WxPayAccountBillService; | ||||
| @@ -98,6 +100,9 @@ public class WxAllBillController extends BillBaseController { | |||||
| @Autowired | @Autowired | ||||
| WxAllBillService wxAllBillService; | WxAllBillService wxAllBillService; | ||||
| @Autowired | |||||
| private WxFinancePrintService wxFinancePrintService; | |||||
| /** | /** | ||||
| * 商户账单汇总计费列表 | * 商户账单汇总计费列表 | ||||
| * @param wxMerchant | * @param wxMerchant | ||||
| @@ -772,5 +777,16 @@ public class WxAllBillController extends BillBaseController { | |||||
| record.setIsPreview(EnumYesOrNo.NO.getCode()); | record.setIsPreview(EnumYesOrNo.NO.getCode()); | ||||
| return new ResultData(wxAllBillService.getBillMonthSum(record)); | return new ResultData(wxAllBillService.getBillMonthSum(record)); | ||||
| } | } | ||||
| @ApiOperation("预览结算单") | |||||
| @PostMapping("viewSettleTemplate") | |||||
| @TenantIgnore | |||||
| public ResultData viewSettleTemplate(@RequestBody WxMerchant merchant,Long templateId) { | |||||
| if (null == merchant.getId()) { | |||||
| return new ResultData(Result.ERROR,"清选择商户"); | |||||
| } | |||||
| merchant.updateTenantInfo(getTenantInfo()); | |||||
| return new ResultData(wxFinancePrintService.parseTemplateData(merchant.getTenantId(),templateId,null,merchant)); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| @Data | |||||
| public class PrintMerchantSettleVo implements Serializable{ | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Date startDate; | |||||
| private Date endDate; | |||||
| private Date ReceiveDate; | |||||
| } | |||||
| @@ -2,8 +2,9 @@ package com.iformall.enums; | |||||
| public enum EnumFinancePrintDataType { | public enum EnumFinancePrintDataType { | ||||
| FINANCE_RECEIVE(1,"财务收付款数据"), | |||||
| BILL(2,"账单数据") | |||||
| FINANCE_RECEIVE(1,"财务收付款单"), | |||||
| BILL(2,"账单"), | |||||
| RENT_OWE(3,"结算单") | |||||
| ; | ; | ||||
| public static EnumFinancePrintDataType getEnum(Integer code) { | public static EnumFinancePrintDataType getEnum(Integer code) { | ||||
| @@ -56,7 +56,7 @@ public class PrintBillDataHandler extends AbstractPrintDataParser { | |||||
| }else if (name.equals("billRemark")) { | }else if (name.equals("billRemark")) { | ||||
| return receive.getBillRemark(); | return receive.getBillRemark(); | ||||
| } | } | ||||
| return o; | |||||
| return null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -51,7 +51,7 @@ public class PrintFinanceReceiveDataHandler extends AbstractPrintDataParser { | |||||
| } | } | ||||
| return ""; | return ""; | ||||
| } | } | ||||
| return o; | |||||
| return null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,63 @@ | |||||
| package com.iformall.print.data; | |||||
| import java.util.Map; | |||||
| import org.springframework.stereotype.Service; | |||||
| 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.domain.vo.PrintMerchantSettleVo; | |||||
| import com.iformall.utils.DateUtils; | |||||
| @Service | |||||
| public class PrintMerchantSettleDataHandler extends AbstractPrintDataParser { | |||||
| @Override | |||||
| public Object getObjectValue(String name, Object o,Map<Long,WxMerchant> merchantMap,Map<Long,WxEnergyFees> feesMap) { | |||||
| PrintMerchantSettleVo receive = (PrintMerchantSettleVo) o; | |||||
| // if (name.equals("id")) { | |||||
| // return receive.getId(); | |||||
| // }else if (name.equals("createtime")) { | |||||
| // return DateUtils.date2String(receive.getCreatetime()); | |||||
| // }else if (name.equals("receivePay")) { | |||||
| // return receive.getReceivePay(); | |||||
| // }else if (name.equals("pay")) { | |||||
| // return receive.getPay(); | |||||
| // }else if (name.equals("setOff")) { | |||||
| // return receive.getSetOff(); | |||||
| // }else if (name.equals("starttime")) { | |||||
| // return DateUtils.date2String(receive.getStarttime()); | |||||
| // }else if (name.equals("endtime")) { | |||||
| // return DateUtils.date2String(receive.getEndtime()); | |||||
| // }else if (name.equals("owe")) { | |||||
| // return receive.getOwe(); | |||||
| // }else if (name.equals("statusName")) { | |||||
| // return receive.getStatusName(); | |||||
| // }else if (name.equals("merchantName")) { | |||||
| // if (null != merchantMap) { | |||||
| // WxMerchant m = merchantMap.get(receive.getMerchantId()); | |||||
| // if (null != m) { | |||||
| // return m.getName(); | |||||
| // } | |||||
| // } | |||||
| // return ""; | |||||
| // }else if (name.equals("energyFeesName")) { | |||||
| // if (null != feesMap) { | |||||
| // WxEnergyFees f = feesMap.get(receive.getEnergyFeesId()); | |||||
| // if (null != f) { | |||||
| // return f.getName(); | |||||
| // } | |||||
| // } | |||||
| // return ""; | |||||
| // }else if (name.equals("returnPay")) { | |||||
| // return receive.getReturnPay(); | |||||
| // }else if (name.equals("billRemark")) { | |||||
| // return receive.getBillRemark(); | |||||
| // } | |||||
| return null; | |||||
| } | |||||
| } | |||||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||||
| import java.util.List; | import java.util.List; | ||||
| import com.iformall.domain.po.WxFinancePrintData; | import com.iformall.domain.po.WxFinancePrintData; | ||||
| import com.iformall.domain.po.WxFinancePrintTemplate; | import com.iformall.domain.po.WxFinancePrintTemplate; | ||||
| import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.domain.vo.PrintVo; | import com.iformall.domain.vo.PrintVo; | ||||
| /** | /** | ||||
| */ | */ | ||||
| @@ -15,5 +16,5 @@ public interface WxFinancePrintService { | |||||
| void update(WxFinancePrintTemplate record); | void update(WxFinancePrintTemplate record); | ||||
| void copy(WxFinancePrintTemplate record); | void copy(WxFinancePrintTemplate record); | ||||
| void setTemplatesDel(WxFinancePrintTemplate record); | void setTemplatesDel(WxFinancePrintTemplate record); | ||||
| List<PrintVo> parseTemplateData(String tenantId,Long templateId,List<Long> dataIds); | |||||
| List<PrintVo> parseTemplateData(String tenantId,Long templateId,List<Long> dataIds,BaseEntity entity); | |||||
| } | } | ||||
| @@ -17,7 +17,9 @@ import com.iformall.domain.po.WxFinancePrintData; | |||||
| import com.iformall.domain.po.WxFinancePrintTemplate; | import com.iformall.domain.po.WxFinancePrintTemplate; | ||||
| 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.domain.po.base.BaseEntity; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.PrintMerchantSettleVo; | |||||
| import com.iformall.domain.vo.PrintVo; | import com.iformall.domain.vo.PrintVo; | ||||
| import com.iformall.enums.EnumFinancePrintDataType; | import com.iformall.enums.EnumFinancePrintDataType; | ||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| @@ -26,6 +28,7 @@ import com.iformall.mapper.WxFinancePrintDataMapper; | |||||
| import com.iformall.mapper.WxFinancePrintTemplateMapper; | import com.iformall.mapper.WxFinancePrintTemplateMapper; | ||||
| import com.iformall.print.data.PrintBillDataHandler; | import com.iformall.print.data.PrintBillDataHandler; | ||||
| import com.iformall.print.data.PrintFinanceReceiveDataHandler; | import com.iformall.print.data.PrintFinanceReceiveDataHandler; | ||||
| import com.iformall.print.data.PrintMerchantSettleDataHandler; | |||||
| import com.iformall.service.WxAllBillService; | import com.iformall.service.WxAllBillService; | ||||
| import com.iformall.service.WxEnergyService; | import com.iformall.service.WxEnergyService; | ||||
| import com.iformall.service.WxFinancePrintService; | import com.iformall.service.WxFinancePrintService; | ||||
| @@ -67,6 +70,9 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| @Autowired | @Autowired | ||||
| PrintBillDataHandler printBillDataHandler; | PrintBillDataHandler printBillDataHandler; | ||||
| @Autowired | |||||
| PrintMerchantSettleDataHandler printMerchantSettleDataHandler; | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| WxMerchantService wxMerchantService; | WxMerchantService wxMerchantService; | ||||
| @@ -157,7 +163,7 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<PrintVo> parseTemplateData(String tenantId, Long templateId, List<Long> dataIds) { | |||||
| public List<PrintVo> parseTemplateData(String tenantId, Long templateId, List<Long> dataIds,BaseEntity entity) { | |||||
| WxFinancePrintTemplate template = this.getTemplateById(templateId); | WxFinancePrintTemplate template = this.getTemplateById(templateId); | ||||
| if (null == template) { | if (null == template) { | ||||
| return null; | return null; | ||||
| @@ -204,6 +210,22 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||||
| voList.add(vo); | voList.add(vo); | ||||
| } | } | ||||
| return voList; | return voList; | ||||
| }else if (printDatatype.getCode().intValue() == EnumFinancePrintDataType.RENT_OWE.getCode()) { | |||||
| WxMerchant bq = (WxMerchant) entity; | |||||
| List<WxMerchant> merchantList = wxMerchantService.findList(bq); | |||||
| if (null == merchantList || merchantList.size() <= 0 ) { | |||||
| return null; | |||||
| } | |||||
| WxMerchant m = merchantList.get(0); | |||||
| List<PrintVo> voList = new ArrayList<PrintVo>(); | |||||
| //TODO 获取结算单信息 | |||||
| PrintMerchantSettleVo sv = null; | |||||
| PrintVo vo = new PrintVo(); | |||||
| vo.setDataId(templateId); | |||||
| vo.setTemplate(printMerchantSettleDataHandler.parse(template.getContent(), sv,merchantMap,feesMap)); | |||||
| voList.add(vo); | |||||
| return voList; | |||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||