From 5174b9b9c02977aacd2a84e5430d1b5ec9a392cd Mon Sep 17 00:00:00 2001 From: gongbiao Date: Fri, 14 Jun 2019 13:57:55 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=B4=A6=E5=8D=95][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=BA=94=E6=94=B6=E9=87=91=E9=A2=9D]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/rent/WxBillAllController.java | 12 +- .../com/iformall/domain/vo/WxBillAll.java | 7 + .../iformall/service/WxBillAllService.java | 4 + .../service/impl/WxBillAllServiceImpl.java | 134 +++++++++++++++++ .../service/impl/WxFlowServiceImpl.java | 136 ++---------------- 5 files changed, 164 insertions(+), 129 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 ff17018cb..7be63c8b8 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java @@ -12,10 +12,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -148,5 +145,12 @@ public class WxBillAllController extends BaseController { wxBillAllService.exportOweBill(wxBillAll, request, response); } + @PostMapping("updateReceivePay") + @SystemControllerLog(description = "账单-更新") + public ResultData updateReceivePay(@RequestBody WxBillAll wxBillAll) { + logger.debug("[" + getIpAddr() + "] WxBillRentController::add"); + wxBillAll.setTenantId(getTenantId()); + return wxBillAllService.updateReceivePay(wxBillAll, getUser()); + } } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java index 3012d792f..d71f5c698 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxBillAll.java @@ -126,4 +126,11 @@ public class WxBillAll extends BaseEntity { @Transient @io.swagger.annotations.ApiModelProperty(value = "过滤已收金额1过滤", name = "filterHasPay") private Integer filterHasPay; + + + @io.swagger.annotations.ApiModelProperty(value = "金额旧值", name = "oldPrice") + private Long oldPrice; + @io.swagger.annotations.ApiModelProperty(value = "金额新值", name = "newPrice") + private Long newPrice; + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxBillAllService.java b/mallinkService/src/main/java/com/iformall/service/WxBillAllService.java index 62db32707..ce95a280a 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBillAllService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBillAllService.java @@ -1,6 +1,7 @@ package com.iformall.service; import com.iformall.common.ResultData; +import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.vo.WxBillAll; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -51,4 +52,7 @@ public interface WxBillAllService { void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response); + ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user); + + void addBillAction(Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo); } \ No newline at end of file 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 69db4816a..5bfca0f61 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -751,6 +751,140 @@ public class WxBillAllServiceImpl implements WxBillAllService { } + @Override + public ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user) { + Integer billType = wxBillAll.getBillTypeValue(); + Long oldPrice = wxBillAll.getOldPrice(); + Long newPrice = wxBillAll.getNewPrice(); + Long id = wxBillAll.getId(); + Date updateDate = new Date(); + if (billType.equals(EnumBillTypeParam.RENT.getCode())) { + WxBillRent dbBill = wxBillRentMapper.selectByPrimaryKey(id); + //租赁账单更新 + WxBillRent wxBillRent = new WxBillRent(); + wxBillRent.setId(id); + wxBillRent.setReceivePay(newPrice); + wxBillRent.setOwe(newPrice - dbBill.getPay()); + if (newPrice.equals(dbBill.getPay())) { + wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); + } + wxBillRent.setUpdatetime(updateDate); + wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); + //账单日志 + addBillAction(id, oldPrice, newPrice, user); + } else if (billType.equals(EnumBillTypeParam.RENT_DEPOSIT.getCode())) { + WxBillDeposit dbBill = wxBillDepositMapper.selectByPrimaryKey(id); + //租赁押金账单更新 + WxBillDeposit wxBillDeposit = new WxBillDeposit(); + wxBillDeposit.setId(id); + wxBillDeposit.setReceivePay(newPrice); + wxBillDeposit.setOwe(newPrice - dbBill.getPay()); + if (newPrice.equals(dbBill.getPay())) { + wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); + } + wxBillDeposit.setUpdatetime(updateDate); + wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); + //账单日志 + addBillAction(id, oldPrice, newPrice, user); + } else if (billType.equals(EnumBillTypeParam.PROPERTY.getCode())) { + WxBillProperty dbBill = wxBillPropertyMapper.selectByPrimaryKey(id); + //物业账单更新 + WxBillProperty wxBillProperty = new WxBillProperty(); + wxBillProperty.setId(id); + wxBillProperty.setReceivePay(newPrice); + wxBillProperty.setOwe(newPrice - dbBill.getPay()); + if (newPrice.equals(dbBill.getPay())) { + wxBillProperty.setStatus(EnumBillRentStatus.PAID.getCode()); + } + wxBillProperty.setUpdatetime(updateDate); + wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillProperty); + //账单日志 + addBillAction(id, oldPrice, newPrice, user); + } else if (billType.equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode())) { + WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectByPrimaryKey(id); + //物业押金账单更新 + WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); + wxBillPropertyDeposit.setId(id); + wxBillPropertyDeposit.setReceivePay(newPrice); + wxBillPropertyDeposit.setOwe(newPrice - dbBill.getPay()); + if (newPrice.equals(dbBill.getPay())) { + wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); + } + wxBillPropertyDeposit.setUpdatetime(updateDate); + wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillPropertyDeposit); + //账单日志 + addBillAction(id, oldPrice, newPrice, user); + } else if (billType.equals(EnumBillTypeParam.WATER.getCode())) { + //水费账单更新 + updateDailyBill(id, newPrice, updateDate); + //账单日志 + addBillAction(id, oldPrice, newPrice, user); + } else if (billType.equals(EnumBillTypeParam.POWER.getCode())) { + //电费账单更新 + updateDailyBill(id, newPrice, updateDate); + //账单日志 + addBillAction(id, oldPrice, newPrice, user); + } else if (billType.equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) { + //空调费账单更新 + updateDailyBill(id, newPrice, updateDate); + //账单日志 + addBillAction(id, oldPrice, newPrice, user); + } else if (billType.equals(EnumBillTypeParam.ROUTINE.getCode())) { + WxBillOther dbBill = wxBillOtherMapper.selectByPrimaryKey(id); + //其他费用账单更新 + WxBillOther wxBillOther = new WxBillOther(); + wxBillOther.setId(id); + wxBillOther.setReceivePay(newPrice); + wxBillOther.setOwe(newPrice - dbBill.getPay()); + if (newPrice.equals(dbBill.getPay())) { + wxBillOther.setStatus(EnumBillRentStatus.PAID.getCode()); + } + wxBillOther.setUpdatetime(updateDate); + wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); + //账单日志 + addBillAction(id, oldPrice, newPrice, user); + } else if (billType.equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) { + WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectByPrimaryKey(id); + //其他押金账单更新 + WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); + wxBillOtherDeposit.setId(id); + wxBillOtherDeposit.setReceivePay(newPrice); + wxBillOtherDeposit.setOwe(newPrice - dbBill.getPay()); + if (newPrice.equals(dbBill.getPay())) { + wxBillOtherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); + } + wxBillOtherDeposit.setUpdatetime(updateDate); + wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillOtherDeposit); + //账单日志 + addBillAction(id, oldPrice, newPrice, user); + } else { + logger.info("未找到账单类型"); + } + return new ResultData(); + } + + @Override + public void addBillAction(Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo) { + WxBillAction wxBillAction = new WxBillAction(); + wxBillAction.setBillId(billId); + wxBillAction.setOldPrice(oldPrice); + wxBillAction.setNewPrice(newPrice); + wxBillActionService.modifyBill(wxBillAction, mallUserInfo); + } + + public void updateDailyBill(Long businessId, Long newPrice, Date updateDate) { + WxBillDaily dbBill = wxBillDailyMapper.selectByPrimaryKey(businessId); + WxBillDaily wxBillDaily = new WxBillDaily(); + wxBillDaily.setId(businessId); + wxBillDaily.setReceivePay(newPrice); + wxBillDaily.setOwe(newPrice - dbBill.getPay()); + if (newPrice.equals(dbBill.getPay())) { + wxBillDaily.setStatus(EnumBillRentStatus.PAID.getCode()); + } + wxBillDaily.setUpdatetime(updateDate); + wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); + } + @Override public Object getBillInfo(WxBillAll record) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index 229ac1a22..b634cead5 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -12,6 +12,7 @@ import com.iformall.domain.po.msg.MailMsg; import com.iformall.domain.po.msg.WxMsgRecord; import com.iformall.domain.vo.FlowUserVo; import com.iformall.domain.vo.UserTaskVo; +import com.iformall.domain.vo.WxBillAll; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; @@ -100,6 +101,9 @@ public class WxFlowServiceImpl implements WxFlowService { private WxFlowModelMapper wxFlowModelMapper; @Autowired private WxFlowConfigMapper wxFlowConfigMapper; + @Autowired + private WxBillAllService wxBillAllService; + /** * 获取流程key @@ -212,135 +216,17 @@ public class WxFlowServiceImpl implements WxFlowService { Integer billType = (Integer) getVariableByKey(variables, "billType"); Long oldPrice = Long.parseLong(getVariableByKey(variables, "oldPrice").toString()); Long newPrice = Long.parseLong(getVariableByKey(variables, "newPrice").toString()); - Date updateDate = new Date(); - MallUserInfo mallUserInfo = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); - if (billType.equals(EnumBillTypeParam.RENT.getCode())) { - WxBillRent dbBill = wxBillRentMapper.selectByPrimaryKey(businessId); - //租赁账单更新 - WxBillRent wxBillRent = new WxBillRent(); - wxBillRent.setId(businessId); - wxBillRent.setReceivePay(newPrice); - wxBillRent.setOwe(newPrice - dbBill.getPay()); - if (newPrice.equals(dbBill.getPay())) { - wxBillRent.setStatus(EnumBillRentStatus.PAID.getCode()); - } - wxBillRent.setUpdatetime(updateDate); - wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); - //账单日志 - addBillAction(businessId, oldPrice, newPrice, mallUserInfo); - } else if (billType.equals(EnumBillTypeParam.RENT_DEPOSIT.getCode())) { - WxBillDeposit dbBill = wxBillDepositMapper.selectByPrimaryKey(businessId); - //租赁押金账单更新 - WxBillDeposit wxBillDeposit = new WxBillDeposit(); - wxBillDeposit.setId(businessId); - wxBillDeposit.setReceivePay(newPrice); - wxBillDeposit.setOwe(newPrice - dbBill.getPay()); - if (newPrice.equals(dbBill.getPay())) { - wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); - } - wxBillDeposit.setUpdatetime(updateDate); - wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); - //账单日志 - addBillAction(businessId, oldPrice, newPrice, mallUserInfo); - } else if (billType.equals(EnumBillTypeParam.PROPERTY.getCode())) { - WxBillProperty dbBill = wxBillPropertyMapper.selectByPrimaryKey(businessId); - //物业账单更新 - WxBillProperty wxBillProperty = new WxBillProperty(); - wxBillProperty.setId(businessId); - wxBillProperty.setReceivePay(newPrice); - wxBillProperty.setOwe(newPrice - dbBill.getPay()); - if (newPrice.equals(dbBill.getPay())) { - wxBillProperty.setStatus(EnumBillRentStatus.PAID.getCode()); - } - wxBillProperty.setUpdatetime(updateDate); - wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillProperty); - //账单日志 - addBillAction(businessId, oldPrice, newPrice, mallUserInfo); - } else if (billType.equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode())) { - WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectByPrimaryKey(businessId); - //物业押金账单更新 - WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); - wxBillPropertyDeposit.setId(businessId); - wxBillPropertyDeposit.setReceivePay(newPrice); - wxBillPropertyDeposit.setOwe(newPrice - dbBill.getPay()); - if (newPrice.equals(dbBill.getPay())) { - wxBillPropertyDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); - } - wxBillPropertyDeposit.setUpdatetime(updateDate); - wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillPropertyDeposit); - //账单日志 - addBillAction(businessId, oldPrice, newPrice, mallUserInfo); - } else if (billType.equals(EnumBillTypeParam.WATER.getCode())) { - //水费账单更新 - updateDailyBill(businessId, newPrice, updateDate); - //账单日志 - addBillAction(businessId, oldPrice, newPrice, mallUserInfo); - } else if (billType.equals(EnumBillTypeParam.POWER.getCode())) { - //电费账单更新 - updateDailyBill(businessId, newPrice, updateDate); - //账单日志 - addBillAction(businessId, oldPrice, newPrice, mallUserInfo); - } else if (billType.equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) { - //空调费账单更新 - updateDailyBill(businessId, newPrice, updateDate); - //账单日志 - addBillAction(businessId, oldPrice, newPrice, mallUserInfo); - } else if (billType.equals(EnumBillTypeParam.ROUTINE.getCode())) { - WxBillOther dbBill = wxBillOtherMapper.selectByPrimaryKey(businessId); - //其他费用账单更新 - WxBillOther wxBillOther = new WxBillOther(); - wxBillOther.setId(businessId); - wxBillOther.setReceivePay(newPrice); - wxBillOther.setOwe(newPrice - dbBill.getPay()); - if (newPrice.equals(dbBill.getPay())) { - wxBillOther.setStatus(EnumBillRentStatus.PAID.getCode()); - } - wxBillOther.setUpdatetime(updateDate); - wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); - //账单日志 - addBillAction(businessId, oldPrice, newPrice, mallUserInfo); - } else if (billType.equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) { - WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectByPrimaryKey(businessId); - //其他押金账单更新 - WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); - wxBillOtherDeposit.setId(businessId); - wxBillOtherDeposit.setReceivePay(newPrice); - wxBillOtherDeposit.setOwe(newPrice - dbBill.getPay()); - if (newPrice.equals(dbBill.getPay())) { - wxBillOtherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); - } - wxBillOtherDeposit.setUpdatetime(updateDate); - wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillOtherDeposit); - //账单日志 - addBillAction(businessId, oldPrice, newPrice, mallUserInfo); - } else { - logger.info("未找到账单类型"); - } + MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); + WxBillAll wxBillAll = new WxBillAll(); + wxBillAll.setId(businessId); + wxBillAll.setBillTypeValue(billType); + wxBillAll.setOldPrice(oldPrice); + wxBillAll.setNewPrice(newPrice); + wxBillAllService.updateReceivePay(wxBillAll, user); } } } - public void updateDailyBill(Long businessId, Long newPrice, Date updateDate) { - WxBillDaily dbBill = wxBillDailyMapper.selectByPrimaryKey(businessId); - WxBillDaily wxBillDaily = new WxBillDaily(); - wxBillDaily.setId(businessId); - wxBillDaily.setReceivePay(newPrice); - wxBillDaily.setOwe(newPrice - dbBill.getPay()); - if (newPrice.equals(dbBill.getPay())) { - wxBillDaily.setStatus(EnumBillRentStatus.PAID.getCode()); - } - wxBillDaily.setUpdatetime(updateDate); - wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); - } - - public void addBillAction(Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo) { - WxBillAction wxBillAction = new WxBillAction(); - wxBillAction.setBillId(billId); - wxBillAction.setOldPrice(oldPrice); - wxBillAction.setNewPrice(newPrice); - wxBillActionService.modifyBill(wxBillAction, mallUserInfo); - } - public Map mallUserInfoToMap(MallUserInfo userInfo){ try { Map map = new HashMap<>();