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