| @@ -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()); | |||
| @@ -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); | |||
| @@ -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<String, Object> 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<String, String> 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<String, Object> 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)); | |||
| } | |||
| /** | |||
| * 配置列表 | |||
| */ | |||
| @@ -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()); | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -4,7 +4,7 @@ import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| /** | |||
| * @author luozukai | |||
| * @author Stormeye | |||
| * @date 2019/4/24 14:32 | |||
| */ | |||
| @Data | |||
| @@ -4,7 +4,7 @@ import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| /** | |||
| * @author luozukai | |||
| * @author Stormeye | |||
| * @date 2019/4/24 14:32 | |||
| */ | |||
| @Data | |||
| @@ -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()); | |||
| } | |||
| } | |||
| @@ -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<String, Object> mapInfo,Integer applyStatus); | |||
| ResultData getTaskStatusList(Long businessId,String tenantId); | |||
| ResultData getTaskStatusList(Long businessId,TenantEntity tenantEntity); | |||
| /** | |||
| * 启动流程 | |||
| * @param params | |||
| * @return | |||
| */ | |||
| ResultData start(Map<String, Object> params,Long userId,String userName,String tenantId); | |||
| ResultData start(Map<String, Object> 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<String, String> params,Long userId,String userName,String tenantId); | |||
| ResultData apply(@RequestBody Map<String, String> params,Long userId,String userName,TenantEntity tenantEntity); | |||
| /** | |||
| * 驳回 | |||
| * @param params | |||
| * @return | |||
| */ | |||
| ResultData reject(@RequestBody Map<String, Object> params,Long userId,String userName,String userPhone,String tenantId); | |||
| ResultData reject(@RequestBody Map<String, Object> params,Long userId,String userName,String userPhone,TenantEntity tenantEntity); | |||
| /** | |||
| * 撤回 | |||
| @@ -126,6 +127,6 @@ public interface WxFlowService { | |||
| */ | |||
| List<WxFlowModel> getModelBybusiness(WxFlowModel wxFlowModel); | |||
| ResultData getTotal(Long userId, String tenantId); | |||
| ResultData getTotal(Long userId, TenantEntity tenantEntity); | |||
| } | |||
| @@ -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(); | |||
| @@ -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<WxFlowModel> 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<String, Object> params,Long userId,String userName,String tenantId) { | |||
| public ResultData start(Map<String, Object> 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<Map<String,Object>> 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<MallUserInfo> 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<Map<String, Object>> variables) { | |||
| public void sendAssigneeMsgAndEmail(TenantEntity tenantEntity, String phone, String email, String userName, Long businessId, Integer flowType, List<Map<String, Object>> variables) { | |||
| Map<String,String> 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<WxFlowRecord> flowRecordList = (List<WxFlowRecord>) 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<String> 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<WxFlowRecord> result; | |||
| WxCoupon query = new WxCoupon(); | |||
| query.setTenantId(tenantId); | |||
| query.updateTenantInfo(tenantEntity); | |||
| query.setId(businessId); | |||
| List<WxCoupon> 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<WxFlowRecord> resultList = wxFlowRecordService.findList(new WxFlowRecord(businessId,tenantId)); | |||
| public ResultData getTaskStatusList(Long businessId, TenantEntity tenantEntity) { | |||
| List<WxFlowRecord> 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<String, String> params,Long userId,String userName,String tenantId) { | |||
| public ResultData apply(Map<String, String> 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<String,Object> mapInfo,String taskKey,String processInstanceId,String tenantId,String userName){ | |||
| public boolean isEndAndSendMsg(Map<String,Object> mapInfo,String taskKey,String processInstanceId,TenantEntity tenantEntity,String userName){ | |||
| // 发送短信 | |||
| Map<String,String> msgReplaceMap; | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(tenantId); | |||
| wxMsgValidationcode.setTenantId(tenantEntity.getTenantId()); | |||
| Map<String,Object> userMap = (Map<String,Object>)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<MallUserInfo> 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<String, Object> params,Long userId,String userName,String userPhone,String tenantId) { | |||
| public ResultData reject(Map<String, Object> 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); | |||
| @@ -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(); | |||
| @@ -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<String> 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(); | |||