Просмотр исходного кода

[账单审批][修改][成功后更改账单与添加账单操作记录]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
89fe9d1d50
5 измененных файлов: 158 добавлений и 9 удалений
  1. +1
    -1
      mallinkAdmin/src/main/resources/processes/endBillflow.bpmn20.xml
  2. +22
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java
  3. +3
    -0
      mallinkService/src/main/java/com/iformall/service/WxBillActionService.java
  4. +25
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxBillActionServiceImpl.java
  5. +107
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java

+ 1
- 1
mallinkAdmin/src/main/resources/processes/endBillflow.bpmn20.xml Просмотреть файл

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef">
<process id="end_bill_flow" name="endBillflow" isExecutable="true">
<documentation>终止合同审批流程</documentation>
<documentation>账单审批流程</documentation>
<startEvent id="startEvent1"></startEvent>
<userTask id="firstTaskUser" name="初审" flowable:candidateUsers="${firstTaskUser}">
<documentation>初审</documentation>


+ 22
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxBillAction.java Просмотреть файл

@@ -70,6 +70,28 @@ public class WxBillAction implements Serializable {
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime")
private Date updatetime;

@Transient
private Integer oldPrice;

@Transient
private Integer newPrice;

public Integer getOldPrice() {
return oldPrice;
}

public void setOldPrice(Integer oldPrice) {
this.oldPrice = oldPrice;
}

public Integer getNewPrice() {
return newPrice;
}

public void setNewPrice(Integer newPrice) {
this.newPrice = newPrice;
}

public String getTenantId() {
return tenantId;
}


+ 3
- 0
mallinkService/src/main/java/com/iformall/service/WxBillActionService.java Просмотреть файл

@@ -1,6 +1,7 @@
package com.iformall.service;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.WxBillAction;

/**
@@ -12,4 +13,6 @@ public interface WxBillActionService {

int save(WxBillAction action);

int modifyBill(WxBillAction wxBillAction, MallUserInfo mallUserInfo);

}

+ 25
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxBillActionServiceImpl.java Просмотреть файл

@@ -3,7 +3,9 @@ package com.iformall.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.WxBillAction;
import com.iformall.enums.EnumBillAction;
import com.iformall.mapper.WxBillActionMapper;
import com.iformall.service.WxBillActionService;
import org.slf4j.Logger;
@@ -11,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;

/**
@@ -38,4 +41,26 @@ public class WxBillActionServiceImpl implements WxBillActionService {
action.setUpdatetime(date);
return wxBillActionMapper.insertSelective(action);
}


@Override
public int modifyBill(WxBillAction action, MallUserInfo user) {
final IdWorker idWorker = IdWorker.get();
WxBillAction wxBillAction = new WxBillAction();
wxBillAction.setId(idWorker.nextId());
wxBillAction.setBillId(action.getBillId());
String oldPrice = new BigDecimal(action.getOldPrice()).divide(new BigDecimal(100)).toPlainString();
String newPrice = new BigDecimal(action.getOldPrice()).divide(new BigDecimal(100)).toPlainString();
wxBillAction.setDetails(oldPrice + "元变更成" + newPrice + "元");
wxBillAction.setAction(EnumBillAction.UPDATE_BILL.getCode());
wxBillAction.setUserId(user.getId());
wxBillAction.setUserName(user.getName());
wxBillAction.setPhone(user.getPhone());
wxBillAction.setTenantId(user.getTenantId());
Date date = new Date();
action.setCreatetime(date);
action.setUpdatetime(date);
return wxBillActionMapper.insertSelective(action);
}

}

+ 107
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java Просмотреть файл

@@ -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 {
}



}

Загрузка…
Отмена
Сохранить