| @@ -12,10 +12,7 @@ import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | 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.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -148,5 +145,12 @@ public class WxBillAllController extends BaseController { | |||||
| wxBillAllService.exportOweBill(wxBillAll, request, response); | 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()); | |||||
| } | |||||
| } | } | ||||
| @@ -126,4 +126,11 @@ public class WxBillAll extends BaseEntity { | |||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value = "过滤已收金额1过滤", name = "filterHasPay") | @io.swagger.annotations.ApiModelProperty(value = "过滤已收金额1过滤", name = "filterHasPay") | ||||
| private Integer filterHasPay; | private Integer filterHasPay; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "金额旧值", name = "oldPrice") | |||||
| private Long oldPrice; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "金额新值", name = "newPrice") | |||||
| private Long newPrice; | |||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -51,4 +52,7 @@ public interface WxBillAllService { | |||||
| void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response); | void exportOweBill(WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response); | ||||
| ResultData updateReceivePay(WxBillAll wxBillAll, MallUserInfo user); | |||||
| void addBillAction(Long billId, Long oldPrice, Long newPrice, MallUserInfo mallUserInfo); | |||||
| } | } | ||||
| @@ -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 | @Override | ||||
| public Object getBillInfo(WxBillAll record) { | public Object getBillInfo(WxBillAll record) { | ||||
| @@ -12,6 +12,7 @@ import com.iformall.domain.po.msg.MailMsg; | |||||
| import com.iformall.domain.po.msg.WxMsgRecord; | import com.iformall.domain.po.msg.WxMsgRecord; | ||||
| import com.iformall.domain.vo.FlowUserVo; | import com.iformall.domain.vo.FlowUserVo; | ||||
| import com.iformall.domain.vo.UserTaskVo; | import com.iformall.domain.vo.UserTaskVo; | ||||
| import com.iformall.domain.vo.WxBillAll; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| @@ -100,6 +101,9 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| private WxFlowModelMapper wxFlowModelMapper; | private WxFlowModelMapper wxFlowModelMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxFlowConfigMapper wxFlowConfigMapper; | private WxFlowConfigMapper wxFlowConfigMapper; | ||||
| @Autowired | |||||
| private WxBillAllService wxBillAllService; | |||||
| /** | /** | ||||
| * 获取流程key | * 获取流程key | ||||
| @@ -212,135 +216,17 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| Integer billType = (Integer) getVariableByKey(variables, "billType"); | Integer billType = (Integer) getVariableByKey(variables, "billType"); | ||||
| Long oldPrice = Long.parseLong(getVariableByKey(variables, "oldPrice").toString()); | Long oldPrice = Long.parseLong(getVariableByKey(variables, "oldPrice").toString()); | ||||
| Long newPrice = Long.parseLong(getVariableByKey(variables, "newPrice").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<String,Object> mallUserInfoToMap(MallUserInfo userInfo){ | public Map<String,Object> mallUserInfoToMap(MallUserInfo userInfo){ | ||||
| try { | try { | ||||
| Map<String, Object> map = new HashMap<>(); | Map<String, Object> map = new HashMap<>(); | ||||