diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java index 9244367dc..42628edef 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java @@ -8,6 +8,7 @@ import com.iformall.common.ResultData; import com.iformall.common.SysConfigConstant; import com.iformall.controller.base.BaseController; import com.iformall.domain.dto.FinanceSetOffDTO; +import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.SysConfig; import com.iformall.domain.po.WxAllBill; import com.iformall.domain.po.WxBillPayWay; @@ -26,6 +27,7 @@ import com.iformall.enums.EnumContractOperationType; import com.iformall.enums.EnumFinanceCashierType; import com.iformall.enums.EnumFinanceFinishStatus; import com.iformall.enums.EnumFinanceReceiveStatus; +import com.iformall.enums.EnumFlowContractType; import com.iformall.enums.EnumFlowKey; import com.iformall.enums.EnumRentShopType; import com.iformall.enums.EnumYesOrNo; @@ -448,17 +450,21 @@ public class WxFinanceController extends BaseController { if (StringUtils.isNotBlank(record.getRemark())) { receive.setRemark(record.getRemark()); } - + MallUserInfo user = getUser(); WxFlowModel wxFlowModel = new WxFlowModel(); - wxFlowModel.setFlowType(EnumFlowKey.NEW_RENT_CONTRACT.getCode()); + wxFlowModel.setFlowType(EnumFlowKey.FINANCE_RED.getCode()); wxFlowModel.updateTenantInfo(receive); List flows = wxFlowService.getModelBybusiness(wxFlowModel); if (null != flows && flows.size() > 0) { - //return true; + Map map = new HashMap(); + map.put("businessType", EnumFlowKey.FINANCE_RED.getCode()); + map.put("remark", record.getRemark()); + map.put("businessId", String.valueOf(record.getId())); + record.setFlowParams(map); + wxFlowService.start(record.getFlowParams(), user.getId(), user.getName(), receive); + }else { + wxFinanceService.redSetoffReceive(receive, user); } - - - wxFinanceService.redSetoffReceive(receive, getUser()); return new ResultData(); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java b/mallinkAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java index 0ee3eeb36..f3ff20e68 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java @@ -181,7 +181,7 @@ public class WxFlowAbleController extends BaseController { @SystemControllerLog(description = "工作流-撤回") public ResultData setBack(@RequestBody Map params) { MallUserInfo user = getUser(); - return wxFlowService.setBack(params,user.getId(),user.getName()); + return wxFlowService.setBack(params,user.getId(),user.getName(),user); } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceive.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceive.java index 998dd62d8..1257553f6 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceive.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxFinanceReceive.java @@ -16,6 +16,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; /** */ @TableName(value = "wx_finance_receive") @@ -184,5 +185,7 @@ public class WxFinanceReceive extends TenantEntity { private Integer finishStatus; @TableField(exist = false) private Long finishId; + @TableField(exist = false) + private Map flowParams; } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumFinanceReceiveStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumFinanceReceiveStatus.java index e0aa92e84..a824e9294 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumFinanceReceiveStatus.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumFinanceReceiveStatus.java @@ -11,7 +11,8 @@ public enum EnumFinanceReceiveStatus { NORMAL(1,"正常"), INVALID(2,"作废"), RED_SETOFF(3, "红冲"), - AUDITING(4,"红冲审核中") + AUDITING(4,"红冲审核中"), + AUDITING_REJECT(5,"红冲拒绝"), ; public static EnumFinanceReceiveStatus getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumFlowKey.java b/mallinkService/src/main/java/com/iformall/enums/EnumFlowKey.java index f20915320..daf6b8be0 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumFlowKey.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumFlowKey.java @@ -41,7 +41,9 @@ public enum EnumFlowKey { CASH_OUT(23,"商户提现审批"), - CARD_ORDER_REFUND(31,"消费卡退款审批") + CARD_ORDER_REFUND(31,"消费卡退款审批"), + + FINANCE_RED(40,"收付款单红冲审核") ; public static EnumFlowKey getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxFinanceReceiveMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxFinanceReceiveMapper.java index 7e88fe9af..00a711e83 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxFinanceReceiveMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxFinanceReceiveMapper.java @@ -27,5 +27,7 @@ public interface WxFinanceReceiveMapper extends CommonMapper getReceivePayWaySum(WxFinanceReceive record); void updatePrint(WxFinanceReceive record); + + void updateStatus(WxFinanceReceive record); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxFinanceService.java b/mallinkService/src/main/java/com/iformall/service/WxFinanceService.java index 54e6aa84a..71a2d6195 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxFinanceService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxFinanceService.java @@ -43,6 +43,7 @@ public interface WxFinanceService { void redSetoffReceive(WxFinanceReceive record,MallUserInfo user); List getReceiveBills(WxFinanceReceiveBill record); void updateReceivePrint(WxFinanceReceive record); + void updateReceiveStatus(WxFinanceReceive record); //预收款 List calcuetSetOff(FinanceSetOffDTO dto,MallUserInfo user); FinanceBillSetoffSum getBillSetoffSum(WxFinanceReceive record); diff --git a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java index 41a54c05e..9c6a3dd6f 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java @@ -2,6 +2,7 @@ package com.iformall.service; import com.github.pagehelper.PageInfo; import com.iformall.common.ResultData; +import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxFlowConfig; import com.iformall.domain.po.WxFlowModel; import com.iformall.domain.po.WxFlowRecord; @@ -30,7 +31,7 @@ public interface WxFlowService { * @param mapInfo * @param applyStatus */ - void updateBusinessStatus(Map mapInfo,Integer applyStatus); + void updateBusinessStatus(TenantEntity tenantEntity,MallUserInfo starterInfo,Map mapInfo,Integer applyStatus); ResultData getTaskStatusList(String businessId,TenantEntity tenantEntity); @@ -76,7 +77,7 @@ public interface WxFlowService { * @param params * @return */ - ResultData setBack(Map params,Long userId,String userName); + ResultData setBack(Map params,Long userId,String userName,TenantEntity tenantEntity); /** * 我的申请列表 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java index 4888443b0..1c16aff56 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFinanceServiceImpl.java @@ -1216,8 +1216,10 @@ public class WxFinanceServiceImpl implements WxFinanceService { //主收款单作废 record.setStatus(EnumFinanceReceiveStatus.INVALID.getCode()); record.setUpdateTime(new Date()); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); + if (null != user) { + record.setUpdateBy(user.getId()); + record.setUpdateByName(user.getName()); + } wxFinanceReceiveMapper.updateById(record); //关联的账单删除 WxFinanceReceiveBill bdel = new WxFinanceReceiveBill(); @@ -1265,8 +1267,10 @@ public class WxFinanceServiceImpl implements WxFinanceService { } advance.setUseMoney(advanceUserMoney.subtract(new BigDecimal(rs.getSetoff())).toPlainString()); record.setUpdateTime(new Date()); - record.setUpdateBy(user.getId()); - record.setUpdateByName(user.getName()); + if (null != user) { + record.setUpdateBy(user.getId()); + record.setUpdateByName(user.getName()); + } wxAllBillService.saveOrUpdate(advance, user); } } @@ -1349,6 +1353,11 @@ public class WxFinanceServiceImpl implements WxFinanceService { wxFinanceReceiveMapper.updatePrint(record); } + @Override + public void updateReceiveStatus(WxFinanceReceive record) { + wxFinanceReceiveMapper.updateStatus(record); + } + @Override public void redSetoffReceive(WxFinanceReceive record, MallUserInfo user) { invalidReceive(record, user , true); 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 de5a6ecf4..f079249e6 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -40,6 +40,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Lazy; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -100,6 +101,9 @@ public class WxFlowServiceImpl implements WxFlowService { RedisTemplate> cdRedisTemplate; @Autowired private WxCashOutService wxCashOutService; + @Lazy + @Autowired + WxFinanceService wxFinanceService; @Override public void wxFlowConfigInit(String tenantId) { @@ -164,7 +168,7 @@ public class WxFlowServiceImpl implements WxFlowService { * @param applyStatus */ @Override - public void updateBusinessStatus(Map mapInfo,Integer applyStatus){ + public void updateBusinessStatus(TenantEntity tenantEntity,MallUserInfo starterInfo,Map mapInfo,Integer applyStatus){ String businessId = mapInfo.get("businessId").toString(); Integer flowType = getIngeter(mapInfo.get("flowType")); List> variables = (List)mapInfo.get("variables"); @@ -502,6 +506,21 @@ public class WxFlowServiceImpl implements WxFlowService { String remark = (String)mapInfo.get("remark"); wxRefundOrderService.refundCardOrderFail(RefundOrder,null,remark); } + }else if(EnumFlowKey.FINANCE_RED.getCode().equals(flowType)){ + WxFinanceReceive receive = wxFinanceService.getReceiveById(tenantEntity, Long.parseLong(businessId)); + // 审批完成 + if (EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { + wxFinanceService.redSetoffReceive(receive, starterInfo); + }else if (EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue()) { + }else if(EnumRentContractAppStatus.REJECT.getCode().intValue() == applyStatus.intValue()){ + String remark = (String)mapInfo.get("remark"); + receive.setStatus(EnumFinanceReceiveStatus.AUDITING_REJECT.getCode()); + receive.setRemark(StringUtils.trimToEmpty(receive.getRemark())+";"+remark); + wxFinanceService.updateReceiveStatus(receive); + }else if(EnumRentContractAppStatus.APPLYING.getCode().intValue() == applyStatus.intValue()){ + receive.setStatus(EnumFinanceReceiveStatus.AUDITING.getCode()); + wxFinanceService.updateReceiveStatus(receive); + } } } @@ -608,7 +627,7 @@ public class WxFlowServiceImpl implements WxFlowService { logger.debug("流程启动,流程id:{}",processInstance.getId()); params.put("flowType",flowType); - updateBusinessStatus(params,EnumRentContractAppStatus.APPLYING.getCode()); + updateBusinessStatus(tenantEntity,starterInfo,params,EnumRentContractAppStatus.APPLYING.getCode()); // 保存wx_flow_record表审批记录 WxFlowRecord wxFlowRecord = new WxFlowRecord(); @@ -1238,7 +1257,7 @@ public class WxFlowServiceImpl implements WxFlowService { return isEndAndSendMsg(mapInfo,taskKey,processInstanceId,tenantEntity,userName); } }else{ - updateBusinessStatus(mapInfo,EnumRentContractAppStatus.FINISH.getCode()); + updateBusinessStatus(tenantEntity,null,mapInfo,EnumRentContractAppStatus.FINISH.getCode()); // 给发起人发送审批通过消息 msgReplaceMap = new HashedMap(); @@ -1372,7 +1391,7 @@ public class WxFlowServiceImpl implements WxFlowService { // 修改合同审核状态为驳回 params.putAll(mapInfo); - updateBusinessStatus(params,EnumRentContractAppStatus.REJECT.getCode()); + updateBusinessStatus(tenantEntity,null,params,EnumRentContractAppStatus.REJECT.getCode()); //保存wx_flow_record表审批记录 WxFlowRecord wxFlowRecord = new WxFlowRecord(); @@ -1462,7 +1481,7 @@ public class WxFlowServiceImpl implements WxFlowService { @Override @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class}) - public ResultData setBack(Map params,Long userId,String userName) { + public ResultData setBack(Map params,Long userId,String userName,TenantEntity tenantEntity) { String processInstanceId = (String)params.get("processInstanceId"); String remark = (String)params.get("remark"); @@ -1485,7 +1504,7 @@ public class WxFlowServiceImpl implements WxFlowService { // 修改合同审核状态为撤回 params.putAll(mapInfo); - updateBusinessStatus(params,EnumRentContractAppStatus.SETBACK.getCode()); + updateBusinessStatus(tenantEntity,null,params,EnumRentContractAppStatus.SETBACK.getCode()); //保存wx_flow_record表审批记录 WxFlowRecord wxFlowRecord = new WxFlowRecord(); diff --git a/mallinkService/src/main/resources/mapper/WxFinanceReceiveMapper.xml b/mallinkService/src/main/resources/mapper/WxFinanceReceiveMapper.xml index 6de87b6b3..20772d5a8 100644 --- a/mallinkService/src/main/resources/mapper/WxFinanceReceiveMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxFinanceReceiveMapper.xml @@ -131,6 +131,14 @@ update wx_finance_receive set is_print = 1 where id = #{id} and tenant_id = #{tenantId} + + + update wx_finance_receive set status = #{status} + + ,`remark` = #{remark} + + where id = #{id} and tenant_id = #{tenantId} + diff --git a/mallinkTTAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java b/mallinkTTAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java index 0ee3eeb36..f3ff20e68 100644 --- a/mallinkTTAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java +++ b/mallinkTTAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java @@ -181,7 +181,7 @@ public class WxFlowAbleController extends BaseController { @SystemControllerLog(description = "工作流-撤回") public ResultData setBack(@RequestBody Map params) { MallUserInfo user = getUser(); - return wxFlowService.setBack(params,user.getId(),user.getName()); + return wxFlowService.setBack(params,user.getId(),user.getName(),user); }