diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java index dfee69e20..2da84c379 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java @@ -89,6 +89,13 @@ public class WxBillAllController extends BaseController { @Autowired ExcelService excelService; + /** + * 商户账单汇总计费列表 + * @param wxMerchant + * @param pageNum + * @param pageSize + * @return + */ @GetMapping("merchantBillList") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @@ -153,7 +160,12 @@ public class WxBillAllController extends BaseController { return new PageInfo(new ArrayList()); } - + /** + * 导出商户账单汇总计费 + * @param wxMerchant + * @param request + * @param response + */ @GetMapping("exportMerchantBillList") public void exportBill(@ModelAttribute WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response) { wxMerchant.updateTenantInfo(getTenantInfo()); @@ -167,7 +179,7 @@ public class WxBillAllController extends BaseController { } /** - * 商户计费详情 + * 商户汇总计费详情 * @param wxMerchant * @return */ @@ -222,6 +234,10 @@ public class WxBillAllController extends BaseController { return new ResultData(vo); } + /** + * 账单类型 + * @return + */ @GetMapping("billTypes") public ResultData billTypes() { Map tmap = new HashMap(); @@ -231,6 +247,30 @@ public class WxBillAllController extends BaseController { return new ResultData(tmap); } + /** + * 欠缴账单统计-红灯区 + * @param wxBillAll + * @param pageNum + * @param pageSize + * @return + */ +// @GetMapping("oweBillHot") +// public ResultData oweBillHot() { +// wxMerchant.updateTenantInfo(getTenantInfo()); +// WxUserDataRule dataRule = this.getCurrentDataFloors(); +// if (null != dataRule) { +// wxMerchant.setFloorForRule(dataRule.getFloorIds()); +// wxMerchant.setBusinessForRule(dataRule.getBussinessIds()); +// } +// wxMerchant.setOnlyOwe(EnumYesOrNo.YES.getCode()); +// EnumBillAllType btype = EnumBillAllType.getEnum(billType); +// if (null == btype) { +// return new ResultData(Result.ERROR,"分类非法"); +// } +// Date starttime = wxMerchant.getStarttime(); +// Date enttime = wxMerchant.getEndtime(); +// return new ResultData(billAllHelper.getBillSum(btype, wxMerchant,starttime,enttime)); +// } /** * 欠缴账单统计 @@ -316,6 +356,46 @@ public class WxBillAllController extends BaseController { excelService.exportExcel(page.getList(), null, "商户账单总览数据", WxBillBaseEntity.class, "商户欠缴账单_"+btype.getMessage()+".xlsx", response, false); } + /** + * 生成单账单催缴 + * @param wxBillAll + * @param pageNum + * @param pageSize + * @return + */ + @GetMapping("exportOneOweBill") + public void exportOneOweBill(Long id,Integer billType, HttpServletRequest request, HttpServletResponse response) { + if (null == billType) { + return ; + } + EnumBillAllType btype = EnumBillAllType.getEnum(billType); + if (null == btype) { + return ; + } + WxBillBaseEntity bill = billAllHelper.getOneBill(getTenantInfo(), btype, id); + if (null == bill) { + return; + } + billAllHelper.exportOneBillOweWord(bill, request, response); + } + + //###################################### 老代码 ###################################### + + @GetMapping("exportOweBill") + @SystemControllerLog(description = "费用收缴数据-生成催缴单") + public void exportOweBill(@ModelAttribute WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) { + logger.debug("[" + getIpAddr() + "] WxBillAllController::exportOweBill"); + if (null == wxBillAll) { + wxBillAll = new WxBillAll(); + } + //默认查当月第一天到今天 + if (StringUtils.isNotBlank(wxBillAll.getEndtime())) { + wxBillAll.setEndtime(wxBillAll.getEndtime() + " 23:59:59"); + } + wxBillAll.updateTenantInfo(getTenantInfo()); + + wxBillAllService.exportOweBill(wxBillAll, request, response); + } /** * 欠缴商户列表 @@ -498,21 +578,6 @@ public class WxBillAllController extends BaseController { } - @GetMapping("exportOweBill") - @SystemControllerLog(description = "费用收缴数据-生成催缴单") - public void exportOweBill(@ModelAttribute WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) { - logger.debug("[" + getIpAddr() + "] WxBillAllController::exportOweBill"); - if (null == wxBillAll) { - wxBillAll = new WxBillAll(); - } - //默认查当月第一天到今天 - if (StringUtils.isNotBlank(wxBillAll.getEndtime())) { - wxBillAll.setEndtime(wxBillAll.getEndtime() + " 23:59:59"); - } - wxBillAll.updateTenantInfo(getTenantInfo()); - - wxBillAllService.exportOweBill(wxBillAll, request, response); - } @PostMapping("updateReceivePay") @SystemControllerLog(description = "账单-更新") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java index fc0176061..94a97394a 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java @@ -447,4 +447,5 @@ public class WxMerchant extends TenantEntity { @TableField(exist = false) private Integer onlyOwe; + } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/base/WxBillBaseEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/base/WxBillBaseEntity.java index fb0404e2d..17f5e26e9 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/base/WxBillBaseEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/base/WxBillBaseEntity.java @@ -36,6 +36,7 @@ public class WxBillBaseEntity extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") protected Integer rentShopType; + @Excel(name = "实际应收总金额(元)", width = 20, orderNum = "8") @io.swagger.annotations.ApiModelProperty(value="实际应收金额(做了减免之后和need可能不一样)",name="receivePay") protected String receivePay; @@ -59,16 +60,16 @@ public class WxBillBaseEntity extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="欠缴",name="owe") protected String owe; - @Excel(name = "实际应收总金额(元)(包括滞纳金服务费等)", width = 20, orderNum = "8") - @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") + //@Excel(name = "实际应收总金额(元)", width = 20, orderNum = "8") + @io.swagger.annotations.ApiModelProperty(value="实际应收金额(加上了滞纳金服务费等费用)",name="realReceivePay") @TableField(exist = false) protected String realReceivePay; - @Excel(name = "实际应收总金额(元)(包括滞纳金服务费等)", width = 20, orderNum = "8") + @Excel(name = "账单类型名称", width = 20, orderNum = "8") @io.swagger.annotations.ApiModelProperty(value="账单类型名称",name="billTypeName") protected String billTypeName; - @Excel(name = "实际应收总金额(元)(包括滞纳金服务费等)", width = 20, orderNum = "9") + @Excel(name = "备注", width = 20, orderNum = "9") @io.swagger.annotations.ApiModelProperty(value="备注",name="billRemark") protected String billRemark; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillHotNotify.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillHotNotify.java new file mode 100644 index 000000000..8f38c2fc6 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillHotNotify.java @@ -0,0 +1,34 @@ +package com.iformall.domain.vo; + +import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Date; + +import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; + +@Data +public class WxBillHotNotify implements Serializable { + + private static final long serialVersionUID = 1L; + + //EnumBillAllType; + private Integer billType; + private String billTypeName; + private Integer totalCount = 0; + private String totalMoney = "0"; + private BigDecimal totalMoneyNumber; + private Date minBeginTime; + + public BigDecimal getTotalMoneyNumber() { + if (StringUtils.isNotBlank(totalMoney)) { + this.totalMoneyNumber = new BigDecimal(totalMoney).setScale(2, RoundingMode.HALF_UP); + }else { + this.totalMoneyNumber = new BigDecimal(0); + } + return totalMoneyNumber; + } + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java index 8d445cebc..58ab26edd 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxBillAllHelper.java @@ -5,7 +5,13 @@ import java.math.RoundingMode; import java.util.ArrayList; import java.util.Collection; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -24,6 +30,7 @@ import com.iformall.domain.po.WxBillRentManage; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.WxBillBaseEntity; +import com.iformall.domain.vo.WxBillHotNotify; import com.iformall.domain.vo.WxBillSum; import com.iformall.domain.vo.WxShopVo; import com.iformall.enums.EnumBillAllType; @@ -39,10 +46,18 @@ import com.iformall.service.WxBillPropertyDepositService; import com.iformall.service.WxBillPropertyService; import com.iformall.service.WxBillRentManageService; import com.iformall.service.WxBillRentService; +import com.iformall.service.WxMallService; +import com.iformall.service.WxMerchantService; import com.iformall.service.WxShopService; +import com.iformall.utils.DateUtils; +import com.iformall.utils.PriceUtil; +import com.iformall.utils.WordUtil; @Service public class WxBillAllHelper { + + @Autowired + private String fmUploadDir; @Autowired private WxBillRentService wxBillRentService; @@ -71,6 +86,12 @@ public class WxBillAllHelper { @Autowired private WxShopService wxShopService; + @Autowired + private WxMerchantService wxMerchantService; + + @Autowired + private WxMallService wxMallService; + private void updateQueryParm(WxMerchant wxMerchant,WxBillBaseEntity bill,Date starttime,Date enttime) { bill.updateTenantInfo(wxMerchant); @@ -103,6 +124,11 @@ public class WxBillAllHelper { return wxBillRentService.getMerchantIds(br); } +// public WxBillHotNotify getBillRentHotNotify(WxMerchant wxMerchant,Date starttime, Date enttime) { +// WxBillRent br = new WxBillRent(); +// updateQueryParm(wxMerchant, br,starttime,enttime); +// } + public WxBillSum getBillRentManageSum(WxMerchant wxMerchant,Date starttime, Date enttime,EnumRentContractManageFeeType manageFeeType) { WxBillRentManage brm = new WxBillRentManage(); if (null != manageFeeType) { @@ -362,4 +388,61 @@ public class WxBillAllHelper { } return null; } + + public WxBillBaseEntity getOneBill(TenantEntity tenantEntity,EnumBillAllType billType,Long id) { + if (billType == EnumBillAllType.RENT) { + return wxBillRentService.getById(tenantEntity, id); + }else if (billType == EnumBillAllType.RENT_BUSSINESS_MANAGE) { + return wxBillRentManageService.getById(tenantEntity, id); + }else if (billType == EnumBillAllType.RENT_OPERATION_MANAGE) { + return wxBillRentManageService.getById(tenantEntity, id); + }else if (billType == EnumBillAllType.RENT_DEPOSIT) { + return wxBillRentDepositService.getById(id); + }else if (billType == EnumBillAllType.PROPERTY) { + return wxBillPropertyService.getById(tenantEntity, id); + }else if (billType == EnumBillAllType.PROPERTY_DEPOSIT) { + return wxBillPropertyDepositService.getById(id); + }else if (billType == EnumBillAllType.DAILY) { + return wxBillDailyService.getById(tenantEntity, id); + }else if (billType == EnumBillAllType.OTHER) { + return wxBillOtherService.getById(tenantEntity, id); + }else if (billType == EnumBillAllType.OTHER_DEPOSIT) { + return wxBillOtherDepositService.getById(tenantEntity, id); + } + return null; + } + + public void exportOneBillOweWord(WxBillBaseEntity bill,HttpServletRequest request, HttpServletResponse response) { + String templatePath = "contract-word-template/bill_owe_one.docx"; + String filepath = fmUploadDir; + String filename = UUID.randomUUID() + ".docx"; + String exportFileName = "催缴单"; + Map result = new HashMap<>(); + result.put("starttime", DateUtils.date2String(bill.getStarttime(),DateUtils.DATE_PATTERN)); + result.put("endtime", DateUtils.date2String(bill.getEndtime(),DateUtils.DATE_PATTERN)); + WxMerchant m = wxMerchantService.selectById(bill.getMerchantId()); + if (null != m) { + result.put("shopNumber", getMerchantShopNumber(m)); + result.put("merchantName", m.getName()); + result.put("linkPerson", m.getLinkPerson()); + result.put("linkPhone", m.getLinkPhone()); + exportFileName = exportFileName+"_"+m.getName(); + } + result.put("billTypeName", bill.getBillTypeName()); + exportFileName = exportFileName +"_"+ bill.getBillTypeName(); + result.put("billRemark", bill.getBillRemark()); + result.put("receivePay", bill.getReceivePay()); + result.put("pay", bill.getPay()); + result.put("owe", bill.getOwe()); + result.put("number", "JF" + DateUtils.getSystemTime("yyyyMMddHHmmss")); + result.put("summaryUpper", PriceUtil.number2CNMontrayUnit(new BigDecimal(bill.getOwe()).setScale(2,RoundingMode.HALF_UP))); + result.put("mall", wxMallService.getByTenantInfo(bill).getName()); + result.put("createtime", DateUtils.date2String(new Date())); + exportFileName = exportFileName +".docx"; + WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, null); + } + +// public WxBillHotNotify getHotNotify() { +// +// } } diff --git a/mallinkService/src/main/resources/contract-word-template/bill_owe.docx b/mallinkService/src/main/resources/contract-word-template/bill_owe.docx index d3f1ba1d4..63718a79e 100644 Binary files a/mallinkService/src/main/resources/contract-word-template/bill_owe.docx and b/mallinkService/src/main/resources/contract-word-template/bill_owe.docx differ diff --git a/mallinkService/src/main/resources/contract-word-template/bill_owe_one.docx b/mallinkService/src/main/resources/contract-word-template/bill_owe_one.docx new file mode 100644 index 000000000..0d64017c0 Binary files /dev/null and b/mallinkService/src/main/resources/contract-word-template/bill_owe_one.docx differ