From 8c48676713c564b8c26a647c6143a4d18cc44cfd Mon Sep 17 00:00:00 2001 From: luozukai Date: Mon, 14 Oct 2019 09:54:35 +0800 Subject: [PATCH 1/4] =?UTF-8?q?[=E4=BF=AE=E6=94=B9][=E6=89=8B=E7=BB=AD?= =?UTF-8?q?=E8=B4=B9][=E5=BC=80=E5=8F=91]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/rent/WxBillAllController.java | 7 ++++ .../com/iformall/domain/po/WxBillRent.java | 6 ++- .../com/iformall/domain/po/WxMerchant.java | 16 ++++++++ .../com/iformall/domain/vo/WxBillAllVo.java | 11 +++++ .../service/impl/WxBillAllServiceImpl.java | 26 ++++++++++++ .../main/resources/mapper/WxBillAllMapper.xml | 40 ++++++++++++------- .../resources/mapper/WxMerchantMapper.xml | 4 +- 7 files changed, 92 insertions(+), 18 deletions(-) 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 bdf437eed..e66a8dcc5 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java @@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONArray; import com.iformall.annotation.SystemControllerLog; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; +import com.iformall.domain.po.WxPayAccountBill; import com.iformall.domain.vo.WxBillAll; import com.iformall.domain.vo.WxBillExcelTemplate; import com.iformall.service.WxBillAllService; +import com.iformall.service.WxPayAccountBillService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Map; @@ -32,6 +35,9 @@ public class WxBillAllController extends BaseController { private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); + @Autowired + WxPayAccountBillService wxPayAccountBillService; + @GetMapping("oweBillCount") @ApiImplicitParams({ @ApiImplicitParam(name = "contractId", value = "合同id", dataType = "long", paramType = "query", required = true), @@ -49,6 +55,7 @@ public class WxBillAllController extends BaseController { @SystemControllerLog(description = "账单总览-列表") public ResultData list(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] WxBillAllController::list"); + WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxBillAll.getTenantId()); if (null == wxBillAll) { wxBillAll = new WxBillAll(); } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java index e3a10aaaf..d3a8db6ec 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java @@ -197,14 +197,16 @@ public class WxBillRent extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value = "联营租金", name = "joinRentPrice") private Long joinRentPrice; - @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") - private Integer serviceChargePay; + @TableField(exist = false) private String serviceChargePayBefore; @TableField(exist = false) private String serviceChargePayUpdate; + @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") + private Integer serviceChargePay; + @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") @TableField(exist = false) private Long realReceivePay; 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 9c2d7f7ac..03cdad497 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java @@ -3,6 +3,7 @@ package com.iformall.domain.po; import cn.afterturn.easypoi.excel.annotation.Excel; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.iformall.common.SortColumn; import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.vo.WxShopVo; import com.iformall.enums.EnumBusiness; @@ -247,4 +248,19 @@ public class WxMerchant extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value = "积分锁定0正常1锁定", name = "creditLocked") private Integer creditLocked; + @TableField(exist = false) + @SortColumn(column = "couponSale") + private String couponSale; + + @TableField(exist = false) + @SortColumn(column = "couponPrice") + private String couponPrice; + + @TableField(exist = false) + @SortColumn(column = "tradeAmt") + private String tradeAmt; + + @TableField(exist = false) + @SortColumn(column = "tradeDate") + private String tradeDate; } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAllVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAllVo.java index fdc980c3d..c5cce0b27 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAllVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAllVo.java @@ -113,4 +113,15 @@ public class WxBillAllVo { } return oweStr; } + + @io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay") + @TableField(exist = false) + private Integer serviceChargePay; + + @io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay") + @TableField(exist = false) + private Long realReceivePay; + + @io.swagger.annotations.ApiModelProperty(value = "滞纳金", name = "latePayPrice") + private Long latePayPrice; } 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 5d4a898be..29f5ea41a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -131,11 +131,14 @@ public class WxBillAllServiceImpl implements WxBillAllService { @Autowired WxBillSettleRecordMapper wxBillSettleRecordMapper; + @Autowired + WxPayAccountBillService wxPayAccountBillService; @Override public Map listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { //更新各账单状态 //updateBillStatus(record); + WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); if (StringUtils.isNotEmpty(record.getTypeStr())) { List typeList = JSONArray.parseArray(record.getTypeStr(), Integer.class); @@ -143,6 +146,23 @@ public class WxBillAllServiceImpl implements WxBillAllService { } PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record)); + //手续费 = 合同应收+手续费+滞纳金 + pageInfo.getList().stream().forEach(e->{ + //手续费 = 合同应收+手续费+滞纳金 + if(e.getReceivePay() != null){ + if(e.getLatePayPrice() == null) e.setLatePayPrice(0l); + BigDecimal servicePay; + if(e.getServiceChargePay() != null){ + servicePay = new BigDecimal(e.getServiceChargePay()); + }else{ + servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); + } + Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); + e.setRealReceivePay(realReceivePay); + e.setServiceChargePay(servicePay.intValue()); + } + }); + Map result = new HashMap<>(); result.put("pageInfo", pageInfo); return result; @@ -1676,6 +1696,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { @Override public Map getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { + WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); PageInfo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record)); List> list = pageInfo.getList(); for (Map map : list) { @@ -1684,6 +1705,11 @@ public class WxBillAllServiceImpl implements WxBillAllService { map.put("depositOwe", subZeroAndDot(map.get("depositOwe").toString())); map.put("otherOwe", subZeroAndDot(map.get("otherOwe").toString())); map.put("totalOwe", subZeroAndDot(map.get("totalOwe").toString())); + + //加上手续费 + //todo:把手续费率传进sql,在sql中算,汇总到max,直接出结果 + map.put("totalReceivePay", subZeroAndDot(map.get("totalOwe").toString())); + } pageInfo.setList(list); Map result = new HashMap<>(); diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index e730f1ab6..8b25ffe46 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -40,10 +40,13 @@ + +