From 0fedc52ff1976717b877d7e25f936c382a756404 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 31 Oct 2019 21:46:57 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=9B=86=E5=9B=A2=E7=89=88][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9]:=E9=9B=86=E5=9B=A2=E7=89=88=E9=A2=84=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/car/WxCarController.java | 2 +- .../controller/market/WxCouponController.java | 12 ++-- .../workflow/WxFlowAbleController.java | 20 +++--- .../com/iformall/log/SystemLogAspect.java | 2 +- .../com/iformall/domain/po/WxFlowRecord.java | 12 ++++ .../domain/po/base/BaseTenantEntity.java | 2 +- .../iformall/domain/po/base/TenantEntity.java | 2 +- .../com/iformall/domain/po/msg/BaseMsg.java | 10 +++ .../com/iformall/service/WxFlowService.java | 17 ++--- .../service/impl/WxBillSettleServiceImpl.java | 2 +- .../service/impl/WxFlowServiceImpl.java | 67 ++++++++++--------- .../impl/WxPropertyContractServiceImpl.java | 8 +-- .../impl/WxRentContractServiceImpl.java | 24 +++---- 13 files changed, 101 insertions(+), 79 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/car/WxCarController.java b/mallinkAdmin/src/main/java/com/iformall/controller/car/WxCarController.java index f0b15a4b9..a65d2ea41 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/car/WxCarController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/car/WxCarController.java @@ -256,7 +256,7 @@ public class WxCarController extends BaseController { wc.setId(coupon.getId()); coupon.getFlowParams().put("businessId",coupon.getId()); - wxFlowService.start(coupon.getFlowParams(), getUserId(), getUser().getName(), getTenantId()); + wxFlowService.start(coupon.getFlowParams(), getUserId(), getUser().getName(), tenantEntity); //作废审批 if (EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(coupon.getStatus())) { wc.setCancleApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java index 1cb2aaa18..6af68e0d5 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java @@ -9,6 +9,7 @@ import com.iformall.controller.base.BaseController; import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxCouponPassword; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxCouponStatisVo; import com.iformall.enums.*; import com.iformall.mapper.WxCouponChannelMapper; @@ -86,7 +87,8 @@ public class WxCouponController extends BaseController { @SystemControllerLog(description = "券投放-新增") public ResultData add(@RequestBody WxCoupon wxCoupon) { logger.debug("[" + getIpAddr() + "] WxCouponController::add"); - wxCoupon.updateTenantInfo(getTenantInfo()); + TenantEntity tenantEntity = getTenantInfo(); + wxCoupon.updateTenantInfo(tenantEntity); ResultData resultData = wxCouponService.saveOrUpdate(wxCoupon); if(resultData.code != 200){ @@ -96,7 +98,7 @@ public class WxCouponController extends BaseController { //启动投放审批 if(wxCoupon.getFlowParams() !=null && wxCoupon.getFlowParams().size()>0) { wxCoupon.getFlowParams().put("businessId",wxCoupon.getId()); - wxFlowService.start(wxCoupon.getFlowParams(), getUserId(), getUser().getName(), getTenantId()); + wxFlowService.start(wxCoupon.getFlowParams(), getUserId(), getUser().getName(), tenantEntity); //修改coupon applyStatus状态为审核中 wxCoupon.setPutApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); } @@ -111,6 +113,7 @@ public class WxCouponController extends BaseController { if (wxCoupon.getId() == null) { return new ResultData(ResultData.ERROR, "缺少id"); } + wxCoupon.updateTenantInfo(getTenantInfo()); if(EnumDelFlag.YES.getCode().equals(wxCoupon.getIsDel())){ WxCouponChannel query = new WxCouponChannel(); query.updateTenantInfo(wxCoupon); @@ -120,13 +123,12 @@ public class WxCouponController extends BaseController { return new ResultData(ResultData.ERROR, "有活动正在上架,请先下架。"); } } - wxCoupon.updateTenantInfo(getTenantInfo()); //启动审批流 if (wxCoupon.getFlowParams() != null && wxCoupon.getFlowParams().size() > 0) { logger.info("------coupon.update().businessType:"+wxCoupon.getFlowParams().get("businessType")); wxCoupon.getFlowParams().put("businessId",wxCoupon.getId()); - wxFlowService.start(wxCoupon.getFlowParams(), getUserId(), getUser().getName(), getTenantId()); + wxFlowService.start(wxCoupon.getFlowParams(), getUserId(), getUser().getName(), getTenantInfo()); //作废审批 if (EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())) { wxCoupon.setCancleApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); @@ -235,7 +237,7 @@ public class WxCouponController extends BaseController { map.put("value",wxCoupon.getValidDays()); variables.add(map); wxCoupon.getFlowParams().put("businessId",wxCoupon.getId()); - wxFlowService.start(wxCoupon.getFlowParams(), getUserId(), getUser().getName(), getTenantId()); + wxFlowService.start(wxCoupon.getFlowParams(), getUserId(), getUser().getName(), wxCoupon); //更新状态 WxCoupon updateCoupon = new WxCoupon(); updateCoupon.updateTenantInfo(wxCoupon); 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 ac49f09ff..3627eabd5 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/workflow/WxFlowAbleController.java @@ -4,10 +4,7 @@ import com.github.pagehelper.PageInfo; import com.iformall.annotation.SystemControllerLog; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.MallUserInfo; -import com.iformall.domain.po.WxFlowConfig; -import com.iformall.domain.po.WxFlowModel; -import com.iformall.domain.po.WxFlowRecord; +import com.iformall.domain.po.*; import com.iformall.enums.EnumFlowRecordStatus; import com.iformall.service.WxFlowService; import io.swagger.annotations.Api; @@ -37,7 +34,7 @@ public class WxFlowAbleController extends BaseController { public ResultData start(@RequestBody Map params) { logger.debug("[" + getIpAddr() + "] FlowAbleController::start"); MallUserInfo user = getUser(); - return wxFlowService.start(params, user.getId(),user.getName(),user.getTenantId()); + return wxFlowService.start(params, user.getId(),user.getName(),user); } /** @@ -53,7 +50,7 @@ public class WxFlowAbleController extends BaseController { @SystemControllerLog(description = "工作流-用户代办列表") public ResultData list(String flowType,Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] FlowAbleController::list"); - return wxFlowService.list(flowType,pageNum,pageSize,getUserId(),getTenantId()); + return wxFlowService.list(flowType,pageNum,pageSize,getUserId(),getTenantInfo()); } /** @@ -64,7 +61,7 @@ public class WxFlowAbleController extends BaseController { @SystemControllerLog(description = "工作流-待办总数") public ResultData getTotal() { logger.debug("[" + getIpAddr() + "] FlowAbleController::getTotal"); - return wxFlowService.getTotal(getUserId(), getTenantId()); + return wxFlowService.getTotal(getUserId(), getTenantInfo()); } /** @@ -127,7 +124,7 @@ public class WxFlowAbleController extends BaseController { @SystemControllerLog(description = "工作流-审批历史") public ResultData applyHistory(Long businessId) { logger.debug("[" + getIpAddr() + "] FlowAbleController::applyHistory"); - return wxFlowService.applyHistory(businessId,super.getTenantId()); + return wxFlowService.applyHistory(businessId,getTenantInfo()); } /** @@ -141,7 +138,7 @@ public class WxFlowAbleController extends BaseController { @SystemControllerLog(description = "工作流-审批历史和代办") public ResultData applyHistoryAndAssignee(Long businessId) { logger.debug("[" + getIpAddr() + "] FlowAbleController::applyHistoryAndAssignee"); - return wxFlowService.getTaskStatusList(businessId,super.getTenantId()); + return wxFlowService.getTaskStatusList(businessId,getTenantInfo()); } /** @@ -151,7 +148,7 @@ public class WxFlowAbleController extends BaseController { @PostMapping(value = "apply") public ResultData apply(@RequestBody Map params) { MallUserInfo user = getUser(); - return wxFlowService.apply(params,user.getId(),user.getName(),user.getTenantId()); + return wxFlowService.apply(params,user.getId(),user.getName(),user); } /** @@ -162,7 +159,7 @@ public class WxFlowAbleController extends BaseController { @SystemControllerLog(description = "工作流-驳回") public ResultData reject(@RequestBody Map params) { MallUserInfo user = getUser(); - return wxFlowService.reject(params,user.getId(),user.getName(),user.getPhone(),user.getTenantId()); + return wxFlowService.reject(params,user.getId(),user.getName(),user.getPhone(),user); } @@ -240,7 +237,6 @@ public class WxFlowAbleController extends BaseController { return new ResultData(wxFlowService.getModelBybusiness(wxFlowModel)); } - /** * 配置列表 */ diff --git a/mallinkAdmin/src/main/java/com/iformall/log/SystemLogAspect.java b/mallinkAdmin/src/main/java/com/iformall/log/SystemLogAspect.java index a822318de..465889699 100644 --- a/mallinkAdmin/src/main/java/com/iformall/log/SystemLogAspect.java +++ b/mallinkAdmin/src/main/java/com/iformall/log/SystemLogAspect.java @@ -61,7 +61,7 @@ public class SystemLogAspect { " ip:" + ipaddress); MallUserAction action = new MallUserAction(); - action.setTenantId(user.getTenantId()); + action.updateTenantInfo(user); action.setType(EnumMallUserAction.CONTROLLER.getCode()); action.setIp(ipaddress); action.setUserId(user.getId()); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxFlowRecord.java b/mallinkService/src/main/java/com/iformall/domain/po/WxFlowRecord.java index 1e5a054bf..4db765298 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxFlowRecord.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxFlowRecord.java @@ -74,13 +74,25 @@ public class WxFlowRecord extends TenantEntity { this.processInstanceId = processInstanceId; this.currStatus = currStatus; } + @Deprecated public WxFlowRecord(Long businessId,String tenantId){ this.businessId = businessId; setTenantId(tenantId); } + public WxFlowRecord(TenantEntity tenantEntity, Long businessId){ + updateTenantInfo(tenantEntity); + this.businessId = businessId; + } + @Deprecated public WxFlowRecord(Long businessId,String tenantId,Integer approvalType){ this.businessId = businessId; setTenantId(tenantId); this.approvalType = approvalType; } + + public WxFlowRecord(TenantEntity tenantEntity, Long businessId,Integer approvalType){ + updateTenantInfo(tenantEntity); + this.businessId = businessId; + this.approvalType = approvalType; + } } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java index 7ff55f22c..8325415c8 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java @@ -4,7 +4,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; /** - * @author luozukai + * @author Stormeye * @date 2019/4/24 14:32 */ @Data diff --git a/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntity.java index 7e5e27b04..f9c96156d 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntity.java @@ -4,7 +4,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; /** - * @author luozukai + * @author Stormeye * @date 2019/4/24 14:32 */ @Data diff --git a/mallinkService/src/main/java/com/iformall/domain/po/msg/BaseMsg.java b/mallinkService/src/main/java/com/iformall/domain/po/msg/BaseMsg.java index d9613338b..0d24e45c4 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/msg/BaseMsg.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/msg/BaseMsg.java @@ -2,6 +2,8 @@ package com.iformall.domain.po.msg; import com.baomidou.mybatisplus.annotation.TableField; import com.iformall.domain.po.base.BaseEntity; +import com.iformall.domain.po.base.BaseTenantEntity; +import com.iformall.domain.po.base.TenantEntity; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -49,4 +51,12 @@ public class BaseMsg extends BaseEntity { @TableField(exist = false) private Integer delayTimeLevel = 0; + public void updateTenantInfo(TenantEntity tenantEntity) { + setTenantId(tenantEntity.getTenantId()); + } + + public void updateTenantInfo(BaseTenantEntity tenantEntity) { + setTenantId(tenantEntity.getTenantId()); + } + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java index ce39c1b2b..4f83c9d32 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.base.TenantEntity; import com.iformall.domain.po.WxFlowConfig; import com.iformall.domain.po.WxFlowModel; import com.iformall.domain.po.WxFlowRecord; @@ -15,7 +16,7 @@ import java.util.Map; * 流程审批服务 */ public interface WxFlowService { - WxFlowModel getModelByType(int flowType,String tenantId); + WxFlowModel getModelByType(int flowType,TenantEntity tenantEntity); /** * 更新业务数据状态 @@ -24,14 +25,14 @@ public interface WxFlowService { */ void updateBusinessStatus(Map mapInfo,Integer applyStatus); - ResultData getTaskStatusList(Long businessId,String tenantId); + ResultData getTaskStatusList(Long businessId,TenantEntity tenantEntity); /** * 启动流程 * @param params * @return */ - ResultData start(Map params,Long userId,String userName,String tenantId); + ResultData start(Map params, Long userId, String userName, TenantEntity tenantEntity); /** * 分页代办列表 @@ -40,28 +41,28 @@ public interface WxFlowService { * @param pageSize * @return */ - ResultData list(String flowType,Integer pageNum, Integer pageSize,Long userId,String tenantId); + ResultData list(String flowType,Integer pageNum, Integer pageSize,Long userId,TenantEntity tenantEntity); /** * 审批历史 * @param businessId * @return */ - ResultData applyHistory(Long businessId,String tenantId); + ResultData applyHistory(Long businessId,TenantEntity tenantEntity); /** * 审批 * @param params * @return */ - ResultData apply(@RequestBody Map params,Long userId,String userName,String tenantId); + ResultData apply(@RequestBody Map params,Long userId,String userName,TenantEntity tenantEntity); /** * 驳回 * @param params * @return */ - ResultData reject(@RequestBody Map params,Long userId,String userName,String userPhone,String tenantId); + ResultData reject(@RequestBody Map params,Long userId,String userName,String userPhone,TenantEntity tenantEntity); /** * 撤回 @@ -126,6 +127,6 @@ public interface WxFlowService { */ List getModelBybusiness(WxFlowModel wxFlowModel); - ResultData getTotal(Long userId, String tenantId); + ResultData getTotal(Long userId, TenantEntity tenantEntity); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java index 0b7a9f740..3da819c4c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java @@ -517,7 +517,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { //启动审批流 record.getFlowParams().put("businessId",record.getId()); if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { - wxFlowService.start(record.getFlowParams(), userInfo.getId(), userInfo.getName(), record.getTenantId()); + wxFlowService.start(record.getFlowParams(), userInfo.getId(), userInfo.getName(), record); } } return new ResultData(); 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 10b6369b4..b6c9e5625 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -8,6 +8,7 @@ import com.iformall.common.IdWorker; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.po.*; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.msg.MailMsg; import com.iformall.domain.po.msg.WxMsgRecord; import com.iformall.domain.vo.FlowUserVo; @@ -102,9 +103,9 @@ public class WxFlowServiceImpl implements WxFlowService { * @param flowType * @return */ - public WxFlowModel getModelByType(int flowType,String tenantId){ + public WxFlowModel getModelByType(int flowType, TenantEntity tenantEntity){ WxFlowModel model = new WxFlowModel(); - model.setTenantId(tenantId); + model.updateTenantInfo(tenantEntity); model.setFlowType(flowType); List list = getModelBybusiness(model); if(CollectionUtils.isNotEmpty(list)){ @@ -389,13 +390,13 @@ public class WxFlowServiceImpl implements WxFlowService { @Override @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class}) - public ResultData start(Map params,Long userId,String userName,String tenantId) { + public ResultData start(Map params,Long userId,String userName,TenantEntity tenantEntity) { String remark = (String)params.get("remark"); Long businessId = Long.parseLong(params.get("businessId").toString()); Integer flowType = getIngeter(params.get("businessType")); List> variables = (List)params.get("variables"); - WxFlowModel flowModel = getModelByType(flowType,tenantId); + WxFlowModel flowModel = getModelByType(flowType,tenantEntity); if(flowModel== null || StringUtils.isBlank(flowModel.getFlowId())){ return new ResultData(ResultData.ERROR, "您尚未设置审批模板,请先设置。"); } @@ -413,7 +414,7 @@ public class WxFlowServiceImpl implements WxFlowService { map.put("variables",variables); map.put("taskAssignee",flowModel.getFlow()); setSignAssignee(map,flowModel.getFlow()); - map.put("tenantId",tenantId); + map.put("tenantId",tenantEntity.getTenantId()); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowModel.getFlowId(), map); logger.debug("流程启动,流程id:{}",processInstance.getId()); @@ -439,12 +440,12 @@ public class WxFlowServiceImpl implements WxFlowService { //给审批人发送代办通知短信 List mallUserInfoList = getUserByProcessInstanceId(processInstance.getId()); for (MallUserInfo mallUserInfo:mallUserInfoList) { - sendAssigneeMsgAndEmail(tenantId, mallUserInfo.getPhone(), mallUserInfo.getEmail(), starterInfo.getName(), businessId, flowType, variables); + sendAssigneeMsgAndEmail(tenantEntity, mallUserInfo.getPhone(), mallUserInfo.getEmail(), starterInfo.getName(), businessId, flowType, variables); } return new ResultData(); } - public void sendAssigneeMsgAndEmail(String tenantId, String phone, String email, String userName, Long businessId, Integer flowType, List> variables) { + public void sendAssigneeMsgAndEmail(TenantEntity tenantEntity, String phone, String email, String userName, Long businessId, Integer flowType, List> variables) { Map dynamicContentMap = new HashMap<>(); dynamicContentMap.put("userName",userName); dynamicContentMap.put("page", Constant.adminPage); @@ -452,7 +453,7 @@ public class WxFlowServiceImpl implements WxFlowService { wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); wxMsgRecord.setModelType(EnumMsgModel.FLOW_ASSIGNEE_NODIFY.getCode()); wxMsgRecord.setReceiver(phone); - wxMsgRecord.setTenantId(tenantId); + wxMsgRecord.updateTenantInfo(tenantEntity); if(isContract(flowType)){ dynamicContentMap.put("bustype","合同"); }else if(isBill(flowType)){ @@ -474,7 +475,7 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap.put("name",userName); msgReplaceMap.put("linkName",userName); msgReplaceMap.put("linkPhone",phone); - ResultData resultData = getTaskStatusList(businessId, tenantId); + ResultData resultData = getTaskStatusList(businessId, tenantEntity); List flowRecordList = (List) resultData.data; String taskListHtml = ""; for (int i = flowRecordList.size() -1; i>=0; i--) { @@ -533,7 +534,7 @@ public class WxFlowServiceImpl implements WxFlowService { mailMsg.setModelType(EnumMailMsgModel.MAIL_ASSIGNEE_NODIFY.getCode()); mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); mailMsg.setTo(new String[]{email}); - mailMsg.setTenantId(tenantId); + mailMsg.updateTenantInfo(tenantEntity); if(isContract(flowType)){ msgReplaceMap.put("bustype","合同"); }else if(isBill(flowType)){ @@ -604,13 +605,13 @@ public class WxFlowServiceImpl implements WxFlowService { } @Override - public ResultData list(String flowType, Integer pageNum, Integer pageSize,Long userId,String tenantId) { + public ResultData list(String flowType, Integer pageNum, Integer pageSize,Long userId,TenantEntity tenantEntity) { TaskQuery taskQuery = taskService.createTaskQuery(); //流程过滤条件 if(StringUtils.isNotBlank(flowType)) { List definitionKeyList = new ArrayList<>(); for (String ft : flowType.split(",")) { - WxFlowModel flowModel = getModelByType(Integer.parseInt(ft),tenantId); + WxFlowModel flowModel = getModelByType(Integer.parseInt(ft),tenantEntity); if(flowModel!=null) { definitionKeyList.add(flowModel.getFlowId()); } @@ -665,17 +666,17 @@ public class WxFlowServiceImpl implements WxFlowService { } @Override - public ResultData applyHistory(Long businessId,String tenantId) { + public ResultData applyHistory(Long businessId,TenantEntity tenantEntity) { List result; WxCoupon query = new WxCoupon(); - query.setTenantId(tenantId); + query.updateTenantInfo(tenantEntity); query.setId(businessId); List couponList = wxCouponMapper.findList(query); if(CollectionUtils.isNotEmpty(couponList)) { WxCoupon coupon = couponList.get(0); - result = wxFlowRecordService.findList(new WxFlowRecord(businessId,tenantId,coupon.getApprovalType())); + result = wxFlowRecordService.findList(new WxFlowRecord(tenantEntity, businessId,coupon.getApprovalType())); }else{ - result = wxFlowRecordService.findList(new WxFlowRecord(businessId,tenantId)); + result = wxFlowRecordService.findList(new WxFlowRecord(tenantEntity, businessId)); } if(CollectionUtils.isNotEmpty(result)){ @@ -699,8 +700,8 @@ public class WxFlowServiceImpl implements WxFlowService { } @Override - public ResultData getTaskStatusList(Long businessId, String tenantId) { - List resultList = wxFlowRecordService.findList(new WxFlowRecord(businessId,tenantId)); + public ResultData getTaskStatusList(Long businessId, TenantEntity tenantEntity) { + List resultList = wxFlowRecordService.findList(new WxFlowRecord(tenantEntity, businessId)); if(CollectionUtils.isEmpty(resultList)){ return new ResultData(); } @@ -877,7 +878,7 @@ public class WxFlowServiceImpl implements WxFlowService { @Override @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class}) - public ResultData apply(Map params,Long userId,String userName,String tenantId) { + public ResultData apply(Map params,Long userId,String userName,TenantEntity tenantEntity) { String taskId = params.get("taskId"); String processInstanceId = params.get("processInstanceId"); String remark = params.get("remark"); @@ -914,7 +915,7 @@ public class WxFlowServiceImpl implements WxFlowService { wxFlowRecordService.saveOrUpdate(wxFlowRecord); // 判断流程是否结束,并发送短信通知 - boolean end = isEndAndSendMsg(mapInfo,taskKey,processInstanceId,tenantId,userName); + boolean end = isEndAndSendMsg(mapInfo,taskKey,processInstanceId,tenantEntity,userName); //修改记录表当前状态 if(end){ @@ -929,13 +930,13 @@ public class WxFlowServiceImpl implements WxFlowService { * 判断流程是否结束,并发送短信通知 * @param taskKey * @param processInstanceId - * @param tenantId + * @param tenantEntity */ - public boolean isEndAndSendMsg(Map mapInfo,String taskKey,String processInstanceId,String tenantId,String userName){ + public boolean isEndAndSendMsg(Map mapInfo,String taskKey,String processInstanceId,TenantEntity tenantEntity,String userName){ // 发送短信 Map msgReplaceMap; WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); - wxMsgValidationcode.setTenantId(tenantId); + wxMsgValidationcode.setTenantId(tenantEntity.getTenantId()); Map userMap = (Map)mapInfo.get("starter"); Long businessId = Long.parseLong(mapInfo.get("businessId").toString()); String email = (String)userMap.get("email"); @@ -961,7 +962,7 @@ public class WxFlowServiceImpl implements WxFlowService { List mallUserInfoList = getUserByProcessInstanceId(processInstanceId); for (int i = 0; i < mallUserInfoList.size(); i++) { MallUserInfo mallUserInfo = mallUserInfoList.get(i); - sendAssigneeMsgAndEmail(tenantId, mallUserInfo.getPhone(), mallUserInfo.getEmail(), userName, businessId, flowType, variables); + sendAssigneeMsgAndEmail(tenantEntity, mallUserInfo.getPhone(), mallUserInfo.getEmail(), userName, businessId, flowType, variables); if(i == mallUserInfoList.size()-1){ assignee += mallUserInfo.getName(); }else{ @@ -979,7 +980,7 @@ public class WxFlowServiceImpl implements WxFlowService { wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); wxMsgRecord.setModelType(EnumMsgModel.FLOW_APPLY_NODIFY.getCode()); wxMsgRecord.setReceiver(userMap!=null?(String)userMap.get("phone"):""); - wxMsgRecord.setTenantId(tenantId); + wxMsgRecord.setTenantId(tenantEntity.getTenantId()); if(isContract(flowType)){ msgReplaceMap.put("bustype","合同"); }else if(isBill(flowType)){ @@ -1006,7 +1007,7 @@ public class WxFlowServiceImpl implements WxFlowService { mailMsg.setModelType(EnumMailMsgModel.MAIL_APPLY_NODIFY.getCode()); mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); mailMsg.setTo(new String[]{email}); - mailMsg.setTenantId(tenantId); + mailMsg.setTenantId(tenantEntity.getTenantId()); if(isContract(flowType)){ msgReplaceMap.put("bustype","合同"); }else if(isBill(flowType)){ @@ -1029,7 +1030,7 @@ public class WxFlowServiceImpl implements WxFlowService { return false; }else{ //继续递归判断 - return isEndAndSendMsg(mapInfo,taskKey,processInstanceId,tenantId,userName); + return isEndAndSendMsg(mapInfo,taskKey,processInstanceId,tenantEntity,userName); } }else{ updateBusinessStatus(mapInfo,EnumRentContractAppStatus.FINISH.getCode()); @@ -1043,7 +1044,7 @@ public class WxFlowServiceImpl implements WxFlowService { wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); wxMsgRecord.setModelType(EnumMsgModel.FLOW_PASS_NODIFY.getCode()); wxMsgRecord.setReceiver(userMap!=null?(String)userMap.get("phone"):""); - wxMsgRecord.setTenantId(tenantId); + wxMsgRecord.setTenantId(tenantEntity.getTenantId()); if(isContract(flowType)){ msgReplaceMap.put("bustype","合同"); }else if(isBill(flowType)){ @@ -1070,7 +1071,7 @@ public class WxFlowServiceImpl implements WxFlowService { mailMsg.setModelType(EnumMailMsgModel.MAIL_PASS_NODIFY.getCode()); mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); mailMsg.setTo(new String[]{email}); - mailMsg.setTenantId(tenantId); + mailMsg.setTenantId(tenantEntity.getTenantId()); if(isContract(flowType)){ msgReplaceMap.put("bustype","合同"); }else if(isBill(flowType)){ @@ -1140,7 +1141,7 @@ public class WxFlowServiceImpl implements WxFlowService { @Override @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class}) - public ResultData reject(Map params,Long userId,String userName,String userPhone,String tenantId) { + public ResultData reject(Map params,Long userId,String userName,String userPhone,TenantEntity tenantEntity) { String processInstanceId = (String)params.get("processInstanceId"); String remark = (String)params.get("remark"); @@ -1196,7 +1197,7 @@ public class WxFlowServiceImpl implements WxFlowService { wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); wxMsgRecord.setModelType(EnumMsgModel.FLOW_REJECT_NODIFY.getCode()); wxMsgRecord.setReceiver(userMap != null ? (String) userMap.get("phone") : ""); - wxMsgRecord.setTenantId(tenantId); + wxMsgRecord.setTenantId(tenantEntity.getTenantId()); if (isContract(flowType)) { msgReplaceMap.put("bustype", "合同"); } else if (isBill(flowType)) { @@ -1231,7 +1232,7 @@ public class WxFlowServiceImpl implements WxFlowService { mailMsg.setModelType(EnumMailMsgModel.MAIL_REJECT_NODIFY.getCode()); mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); mailMsg.setTo(new String[]{email}); - mailMsg.setTenantId(tenantId); + mailMsg.setTenantId(tenantEntity.getTenantId()); if(isContract(flowType)){ msgReplaceMap.put("bustype","合同"); }else if(isBill(flowType)){ @@ -1543,7 +1544,7 @@ public class WxFlowServiceImpl implements WxFlowService { } @Override - public ResultData getTotal(Long userId, String tenantId) { + public ResultData getTotal(Long userId, TenantEntity tenantEntity) { TaskQuery taskQuery = taskService.createTaskQuery(); int total = taskQuery.taskCandidateOrAssigned(userId.toString()).list().size(); return new ResultData(total); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index 8e7486c34..51b7a5119 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -403,11 +403,11 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService if (hasFlow) { if (record.getOperationType().equals(EnumContractOperationType.PART.getCode())) { - if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null) { + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record) == null) { updatePropertyContractStatus(record.getId()); } else { record.getFlowParams().put("businessId", record.getId().toString()); - wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); + wxFlowService.start(record.getFlowParams(), userId, userName, record); // 合同状态改成待签约 WxPropertyContract updateRentContract = new WxPropertyContract(); @@ -417,7 +417,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService logger.info("id:{},启动审批流成功", record.getId().toString()); } } else { - if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record) == null && record.getMerchantId() != null) { wxRentContractService.updateRentContractStatus(record.getId()); } else { @@ -425,7 +425,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService if (record.getMerchantId() != null) { record.getFlowParams().put("supplement", true); //设置补录 } - wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); + wxFlowService.start(record.getFlowParams(), userId, userName, record); // 合同状态改成待签约 WxRentContract updateRentContract = new WxRentContract(); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 7d879143c..8a4ea4c6b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -500,7 +500,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //有模板,启动审批流,没有,直接生产账单 if (!CollectionUtils.isEmpty(record.getFlowParams())){ - if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record) == null && record.getMerchantId() != null) { updateRentContractStatus(record.getId()); }else{ @@ -508,7 +508,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (record.getMerchantId() != null) { record.getFlowParams().put("supplement", true); //设置补录 } - wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); + wxFlowService.start(record.getFlowParams(), userId, userName, record); // 合同状态改成待签约 WxRentContract updateRentContract = new WxRentContract(); @@ -589,7 +589,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //有模板,启动审批流,没有,直接生产账单 if (!CollectionUtils.isEmpty(record.getFlowParams())) { - if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record) == null && record.getMerchantId() != null) { updateRentContractStatus(record.getId()); }else{ @@ -598,7 +598,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (record.getMerchantId() != null) { record.getFlowParams().put("supplement", true); //设置补录 } - wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); + wxFlowService.start(record.getFlowParams(), userId, userName, record); //合同状态改成补录状态 WxRentContract updateRentContract = new WxRentContract(); @@ -936,14 +936,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { logger.info("合同id:{},开始停止...", id); //结束审批流 by luozukai - WxFlowModel flowModel = wxFlowService.getModelByType(EnumFlowKey.NEW_RENT_CONTRACT.getCode().intValue(),record.getTenantId()); - WxFlowModel flowModelPoint = wxFlowService.getModelByType(EnumFlowKey.NEW_SHOP_CONTRACT.getCode().intValue(),record.getTenantId()); + WxFlowModel flowModel = wxFlowService.getModelByType(EnumFlowKey.NEW_RENT_CONTRACT.getCode().intValue(),record); + WxFlowModel flowModelPoint = wxFlowService.getModelByType(EnumFlowKey.NEW_SHOP_CONTRACT.getCode().intValue(),record); - WxFlowModel flowModel_pro = wxFlowService.getModelByType(EnumFlowKey.NEW_PRO_CONTRACT.getCode().intValue(),record.getTenantId()); - WxFlowModel flowModelPoint_pro = wxFlowService.getModelByType(EnumFlowKey.NEW_PRO_POINT_CONTRACT.getCode().intValue(),record.getTenantId()); + WxFlowModel flowModel_pro = wxFlowService.getModelByType(EnumFlowKey.NEW_PRO_CONTRACT.getCode().intValue(),record); + WxFlowModel flowModelPoint_pro = wxFlowService.getModelByType(EnumFlowKey.NEW_PRO_POINT_CONTRACT.getCode().intValue(),record); - WxFlowModel flowModel_rent = wxFlowService.getModelByType(EnumFlowKey.NNEW_RENT_CONTRACT.getCode().intValue(),record.getTenantId()); - WxFlowModel flowModelPoint_rent = wxFlowService.getModelByType(EnumFlowKey.NEW_RENT_POINT_CONTRACT.getCode().intValue(),record.getTenantId()); + WxFlowModel flowModel_rent = wxFlowService.getModelByType(EnumFlowKey.NNEW_RENT_CONTRACT.getCode().intValue(),record); + WxFlowModel flowModelPoint_rent = wxFlowService.getModelByType(EnumFlowKey.NEW_RENT_POINT_CONTRACT.getCode().intValue(),record); List keyList = new ArrayList<>(); if(flowModel != null){ @@ -1682,7 +1682,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { //有模板,启动审批流,没有,直接生产账单 if (!CollectionUtils.isEmpty(record.getFlowParams())) { - if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record.getTenantId()) == null + if (wxFlowService.getModelByType((Integer) record.getFlowParams().get("businessType"), record) == null && record.getMerchantId() != null) { updateRentContractStatus(record.getId()); }else{ @@ -1690,7 +1690,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if (record.getMerchantId() != null) { record.getFlowParams().put("supplement", true); //设置补录 } - wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); + wxFlowService.start(record.getFlowParams(), userId, userName, record); // 合同状态改成待签约 WxRentContract updateRentContract = new WxRentContract();