|
|
|
@@ -1,8 +1,5 @@ |
|
|
|
package com.iformall.service.impl; |
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import com.alibaba.druid.support.json.JSONUtils; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
@@ -21,6 +18,7 @@ import com.iformall.utils.Constant; |
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
import org.apache.commons.collections.map.HashedMap; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
import org.flowable.bpmn.model.BpmnModel; |
|
|
|
import org.flowable.engine.*; |
|
|
|
import org.flowable.engine.runtime.Execution; |
|
|
|
@@ -35,9 +33,13 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author luozukai |
|
|
|
@@ -76,6 +78,18 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
private WxMerchantService wxMerchantService; |
|
|
|
@Autowired |
|
|
|
private MqBaseProducer mqBaseProducer; |
|
|
|
@Autowired |
|
|
|
private WxBillActionService wxBillActionService; |
|
|
|
@Autowired |
|
|
|
private WxBillPropertyDepositMapper wxBillPropertyDepositMapper; |
|
|
|
@Autowired |
|
|
|
private WxBillDepositMapper wxBillDepositMapper; |
|
|
|
@Autowired |
|
|
|
private WxBillDailyMapper wxBillDailyMapper; |
|
|
|
@Autowired |
|
|
|
private WxBillOtherMapper wxBillOtherMapper; |
|
|
|
@Autowired |
|
|
|
private WxBillOtherDepositMapper wxBillOtherDepositMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取流程key,1合同 2账单 |
|
|
|
@@ -181,14 +195,100 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
} |
|
|
|
wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); |
|
|
|
} |
|
|
|
}else if(2 == flowType){ //账单审批 |
|
|
|
} else if (2 == flowType) { |
|
|
|
if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { |
|
|
|
//todo:审批完成 |
|
|
|
|
|
|
|
//账单审批 |
|
|
|
Integer billType = (Integer) getVariableByKey(variables, "billType"); |
|
|
|
Integer oldPrice = (Integer) getVariableByKey(variables, "oldPrice"); |
|
|
|
Integer newPrice = (Integer) getVariableByKey(variables, "newPrice"); |
|
|
|
Date updateDate = new Date(); |
|
|
|
MallUserInfo mallUserInfo = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); |
|
|
|
if (billType.equals(EnumBillTypeParam.RENT.getCode())) { |
|
|
|
//租赁账单更新 |
|
|
|
WxBillRent wxBillRent = new WxBillRent(); |
|
|
|
wxBillRent.setId(businessId); |
|
|
|
wxBillRent.setReceivePay(newPrice); |
|
|
|
wxBillRent.setUpdatetime(updateDate); |
|
|
|
wxBillRentMapper.updateByPrimaryKeySelective(wxBillRent); |
|
|
|
//账单日志 |
|
|
|
addBillAction(oldPrice, newPrice, mallUserInfo); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.RENT_DEPOSIT.getCode())) { |
|
|
|
//租赁押金账单更新 |
|
|
|
WxBillDeposit wxBillDeposit = new WxBillDeposit(); |
|
|
|
wxBillDeposit.setId(businessId); |
|
|
|
wxBillDeposit.setReceivePay(newPrice); |
|
|
|
wxBillDeposit.setUpdatetime(updateDate); |
|
|
|
wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); |
|
|
|
//账单日志 |
|
|
|
addBillAction(oldPrice, newPrice, mallUserInfo); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.PROPERTY.getCode())) { |
|
|
|
//物业账单更新 |
|
|
|
WxBillProperty wxBillProperty = new WxBillProperty(); |
|
|
|
wxBillProperty.setId(businessId); |
|
|
|
wxBillProperty.setReceivePay(newPrice); |
|
|
|
wxBillProperty.setUpdatetime(updateDate); |
|
|
|
wxBillPropertyMapper.updateByPrimaryKeySelective(wxBillProperty); |
|
|
|
//账单日志 |
|
|
|
addBillAction(oldPrice, newPrice, mallUserInfo); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode())) { |
|
|
|
//物业押金账单更新 |
|
|
|
WxBillPropertyDeposit wxBillPropertyDeposit = new WxBillPropertyDeposit(); |
|
|
|
wxBillPropertyDeposit.setId(businessId); |
|
|
|
wxBillPropertyDeposit.setReceivePay(newPrice); |
|
|
|
wxBillPropertyDeposit.setUpdatetime(updateDate); |
|
|
|
wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillPropertyDeposit); |
|
|
|
//账单日志 |
|
|
|
addBillAction(oldPrice, newPrice, mallUserInfo); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.WATER.getCode())) { |
|
|
|
//水费账单更新 |
|
|
|
updateDailyBill(businessId, newPrice, updateDate); |
|
|
|
//账单日志 |
|
|
|
addBillAction(oldPrice, newPrice, mallUserInfo); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.POWER.getCode())) { |
|
|
|
//电费账单更新 |
|
|
|
updateDailyBill(businessId, newPrice, updateDate); |
|
|
|
//账单日志 |
|
|
|
addBillAction(oldPrice, newPrice, mallUserInfo); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.ROUTINE.getCode())) { |
|
|
|
//其他费用账单更新 |
|
|
|
WxBillOther wxBillOther = new WxBillOther(); |
|
|
|
wxBillOther.setId(businessId); |
|
|
|
wxBillOther.setReceivePay(newPrice); |
|
|
|
wxBillOther.setUpdatetime(updateDate); |
|
|
|
wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); |
|
|
|
//账单日志 |
|
|
|
addBillAction(oldPrice, newPrice, mallUserInfo); |
|
|
|
} else if (billType.equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) { |
|
|
|
//其他押金账单更新 |
|
|
|
WxBillOtherDeposit wxBillOtherDeposit = new WxBillOtherDeposit(); |
|
|
|
wxBillOtherDeposit.setId(businessId); |
|
|
|
wxBillOtherDeposit.setReceivePay(newPrice); |
|
|
|
wxBillOtherDeposit.setUpdatetime(updateDate); |
|
|
|
wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillOtherDeposit); |
|
|
|
//账单日志 |
|
|
|
addBillAction(oldPrice, newPrice, mallUserInfo); |
|
|
|
} else { |
|
|
|
logger.info("未找到账单类型"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void updateDailyBill(Long businessId, Integer newPrice, Date updateDate) { |
|
|
|
WxBillDaily wxBillDaily = new WxBillDaily(); |
|
|
|
wxBillDaily.setId(businessId); |
|
|
|
wxBillDaily.setReceivePay(newPrice); |
|
|
|
wxBillDaily.setUpdatetime(updateDate); |
|
|
|
wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); |
|
|
|
} |
|
|
|
|
|
|
|
public void addBillAction(Integer oldPrice, Integer newPrice, MallUserInfo mallUserInfo) { |
|
|
|
WxBillAction wxBillAction = new WxBillAction(); |
|
|
|
wxBillAction.setOldPrice(oldPrice); |
|
|
|
wxBillAction.setNewPrice(newPrice); |
|
|
|
wxBillActionService.modifyBill(wxBillAction, mallUserInfo); |
|
|
|
} |
|
|
|
|
|
|
|
public Map<String,Object> mallUserInfoToMap(MallUserInfo userInfo){ |
|
|
|
try { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
@@ -224,7 +324,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
// map info,设置发起人等信息 |
|
|
|
MallUserInfo starterInfo = this.mallUserInfoService.getById(userId); |
|
|
|
map.put("starter", mallUserInfoToMap(starterInfo)); |
|
|
|
map.put("startTime",new Date().getTime()); |
|
|
|
map.put("startTime", System.currentTimeMillis()); |
|
|
|
map.put("businessId",businessId+""); |
|
|
|
map.put("flowType",flowType); |
|
|
|
map.put("taskAssignee",taskAssignee); |
|
|
|
@@ -907,5 +1007,4 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |