Commit cd79b2d2 authored by zhangyingbin's avatar zhangyingbin

ugp任务逻辑添加

parent de3ad050
...@@ -17,7 +17,7 @@ public enum CompanyTypeEnum { ...@@ -17,7 +17,7 @@ public enum CompanyTypeEnum {
建设单位("CONSTRUCTION","建设单位"), 建设单位("CONSTRUCTION","建设单位"),
安装单位("INSTALL","安装单位"), 安装单位("INSTALL","安装单位"),
设计单位("DESIGN","设计单位"), 设计单位("DESIGN","设计单位"),
监检机构("MONITORING","监检机构"), 监检机构("MONITORING","检验检测单位"),
监理单位("SUPERVISOR","监理单位"); 监理单位("SUPERVISOR","监理单位");
String key; String key;
......
...@@ -10,7 +10,9 @@ public enum TaskTypeEnum { ...@@ -10,7 +10,9 @@ public enum TaskTypeEnum {
流程("flow","流程"), 流程("flow","流程"),
企业审核("examine","企业审核"), 企业审核("examine","企业审核"),
待办("false","待办"), 待办("false","待办"),
已办("true","已办"); 已办("true","已办"),
项目立项("project","项目立项"),
质量问题("problem","质量问题");
String key; String key;
String name; String name;
......
package com.yeejoin.amos.boot.module.ugp.api.Enum;
import jdk.nashorn.internal.objects.annotations.Constructor;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum WeldStatusEnum {
进行中(0),
已完成(1);
Integer status;
}
...@@ -33,7 +33,7 @@ public class Task extends BaseEntity { ...@@ -33,7 +33,7 @@ public class Task extends BaseEntity {
@ApiModelProperty(value = "项目id") @ApiModelProperty(value = "项目id")
private Long projectId; private Long sourceId;
@ApiModelProperty(value = "任务状态(0:未开始 1:进行中 2:已结束)") @ApiModelProperty(value = "任务状态(0:未开始 1:进行中 2:已结束)")
private Boolean status; private Boolean status;
...@@ -41,13 +41,15 @@ public class Task extends BaseEntity { ...@@ -41,13 +41,15 @@ public class Task extends BaseEntity {
@ApiModelProperty(value = "任务开始时间") @ApiModelProperty(value = "任务开始时间")
private String statusLabel; private String statusLabel;
@ApiModelProperty(value = "任务结束时间")
private String taskType; private String taskType;
private String taskTypeLabel; private String taskTypeLabel;
private String content; private String content;
private String agencyCode; private String agencyCode;
private Integer companyId; private Date sendTime;
private String type;
private Long unitId;
......
...@@ -16,11 +16,15 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; ...@@ -16,11 +16,15 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.ugp.api.Enum.CompanyExamineEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.CompanyExamineEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.CompanyTypeEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant; import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company; import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.SuperviseRuleServiceImpl;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.TaskServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.AmosRequestContext; import com.yeejoin.amos.component.robot.AmosRequestContext;
...@@ -94,6 +98,12 @@ public class CompanyController extends BaseController { ...@@ -94,6 +98,12 @@ public class CompanyController extends BaseController {
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired
TaskServiceImpl taskService;
@Autowired
SuperviseRuleServiceImpl superviseRuleService;
/** /**
* 新增企业信息表 * 新增企业信息表
...@@ -114,7 +124,17 @@ public class CompanyController extends BaseController { ...@@ -114,7 +124,17 @@ public class CompanyController extends BaseController {
model.setApproved(CompanyExamineEnum.企业审核.getNo()); model.setApproved(CompanyExamineEnum.企业审核.getNo());
model.setAdminLincensePic(JSON.toJSONString(adminLincensePic)); model.setAdminLincensePic(JSON.toJSONString(adminLincensePic));
model.setRecDate(new Date()); model.setRecDate(new Date());
return ResponseHelper.buildResponse(companyServiceImpl.createWithModel(model)); model = companyServiceImpl.createWithModel(model);
//获取当前注册企业的区域规则
SuperviseRule superviseRule = superviseRuleService.getOne(new LambdaQueryWrapper<SuperviseRule>().eq(SuperviseRule::getAdminRegionCode,model.getRegionCode()));
List<Long> unitIds = new ArrayList<>();
unitIds.add(superviseRule.getSuperviseDeptId());
unitIds.add(superviseRule.getInspectionUnitId());
//新增企业审核任务信息
taskService.setTask(null, false, TaskTypeEnum.企业审核.getKey(), new Date(), model.getSequenceNbr(), TaskTypeEnum.企业审核.getKey(), unitIds);
return ResponseHelper.buildResponse(model);
} }
......
package com.yeejoin.amos.boot.module.ugp.biz.controller; package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -7,6 +8,8 @@ import com.yeejoin.amos.boot.biz.common.utils.NameUtils; ...@@ -7,6 +8,8 @@ import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.TaskDto; import com.yeejoin.amos.boot.module.ugp.api.dto.TaskDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Task; import com.yeejoin.amos.boot.module.ugp.api.entity.Task;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.TaskServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.TaskServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -40,6 +43,9 @@ public class TaskController { ...@@ -40,6 +43,9 @@ public class TaskController {
@Autowired @Autowired
TaskServiceImpl iTzUgpTaskService; TaskServiceImpl iTzUgpTaskService;
@Autowired
OrgServiceImpl orgService;
/** /**
* 新增监检任务表 * 新增监检任务表
...@@ -148,26 +154,16 @@ public class TaskController { ...@@ -148,26 +154,16 @@ public class TaskController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@RequestMapping(value = "/getTaskList", method = RequestMethod.GET) @RequestMapping(value = "/getTaskList", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取当前登录人的所有任务列表", notes = "获取当前登录人的所有任务列表") @ApiOperation(httpMethod = "GET", value = "获取当前登录人的所有任务列表", notes = "获取当前登录人的所有任务列表")
public ResponseModel<Page<TaskDto>> getTaskList(@RequestParam(value = "status",required = false) String type,Long current,Long size){ @BusinessIdentify
Page page = new Page(current,size); public ResponseModel<IPage<Task>> getTaskList(@RequestParam(value = "status",required = false) String type,Long current,Long size){
List<TaskDto> taskDtoList = new ArrayList<>(); Long unitId = orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr();
boolean status= false; IPage<Task> page = new Page(current,size);
if(ValidationUtil.isEmpty(type)){ LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
type = TaskTypeEnum.待办.getKey(); wrapper.eq(Task::getUnitId,unitId);
status = true; if(!ValidationUtil.isEmpty(type)){
} wrapper.eq(Task::getTaskType,type);
if(TaskTypeEnum.待办.getKey().equals(type)){
taskDtoList.addAll(iTzUgpTaskService.unDoneTask());
if(status){
type = TaskTypeEnum.已办.getKey();
}
} }
if(TaskTypeEnum.已办.getKey().equals(type)){ iTzUgpTaskService.page(page, wrapper);
taskDtoList.addAll(iTzUgpTaskService.doneTask());
}
taskDtoList = taskDtoList.stream().sorted(Comparator.comparing(TaskDto::getSendTime).reversed()).collect(Collectors.toList());
page.setRecords(taskDtoList);
page.setTotal(taskDtoList.size());
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
...@@ -179,9 +175,22 @@ public class TaskController { ...@@ -179,9 +175,22 @@ public class TaskController {
@RequestMapping(value = "/getTaskCount", method = RequestMethod.GET) @RequestMapping(value = "/getTaskCount", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取当前登录人的所有任务统计", notes = "获取当前登录人的所有任务统计") @ApiOperation(httpMethod = "GET", value = "获取当前登录人的所有任务统计", notes = "获取当前登录人的所有任务统计")
public ResponseModel<Map> getCount(){ public ResponseModel<Map> getCount(){
List myTask = new ArrayList();
List todyCompletedTask = new ArrayList();
Long unitId = orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr();
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Task::getUnitId,unitId);
if(true){
wrapper.eq(Task::getTaskType,false);
myTask = iTzUgpTaskService.list(wrapper);
}else {
wrapper.eq(Task::getTaskType,true);
todyCompletedTask = iTzUgpTaskService.list(wrapper);
}
Map<String,String> map = new HashMap(); Map<String,String> map = new HashMap();
map.put("myTask", String.valueOf(iTzUgpTaskService.unDoneTask().size())); map.put("myTask", String.valueOf(myTask.size()));
map.put("todyCompletedTask", String.valueOf(iTzUgpTaskService.doneTask().size())); map.put("todyCompletedTask", String.valueOf(todyCompletedTask.size()));
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
} }
......
...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company; import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule; import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
...@@ -58,6 +59,12 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company ...@@ -58,6 +59,12 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
@Autowired @Autowired
private SuperviseRuleMapper superviseRuleMapper; private SuperviseRuleMapper superviseRuleMapper;
@Autowired
SuperviseRuleServiceImpl superviseRuleService;
@Autowired
TaskServiceImpl taskService;
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
...@@ -252,6 +259,14 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company ...@@ -252,6 +259,14 @@ public class CompanyServiceImpl extends BaseService<CompanyDto, Company, Company
} }
} }
//获取当前注册企业的区域规则
SuperviseRule superviseRule = superviseRuleService.getOne(new LambdaQueryWrapper<SuperviseRule>().eq(SuperviseRule::getAdminRegionCode,model.getRegionCode()));
List<Long> unitIds = new ArrayList<>();
unitIds.add(superviseRule.getSuperviseDeptId());
unitIds.add(superviseRule.getInspectionUnitId());
//新增企业审核任务信息
taskService.setTask(null, true, TaskTypeEnum.企业审核.getKey(), new Date(), model.getSequenceNbr(), TaskTypeEnum.企业审核.getKey(), unitIds);
return this.updateById(company); return this.updateById(company);
} }
......
...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; ...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProblemProcessEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.ProblemProcessEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.SMSEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.SMSEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.entity.*; import com.yeejoin.amos.boot.module.ugp.api.entity.*;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -19,12 +20,11 @@ import com.yeejoin.amos.feign.workflow.model.AjaxResult; ...@@ -19,12 +20,11 @@ import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO; import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.parsing.Problem;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* @author Dell * @author Dell
...@@ -33,6 +33,9 @@ import java.util.Map; ...@@ -33,6 +33,9 @@ import java.util.Map;
public class ProblemInitiationServiceImpl { public class ProblemInitiationServiceImpl {
@Autowired @Autowired
TaskServiceImpl taskService;
@Autowired
ProjectServiceImpl projectServiceImpl; ProjectServiceImpl projectServiceImpl;
@Autowired @Autowired
...@@ -96,6 +99,9 @@ public class ProblemInitiationServiceImpl { ...@@ -96,6 +99,9 @@ public class ProblemInitiationServiceImpl {
public void execute(String instanceId,QualityProblem objectd, String option){ public void execute(String instanceId,QualityProblem objectd, String option){
List<Long> unitIds = new ArrayList<>();
String taskType = new String();
JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectd)); JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectd));
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId); AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data"))); JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
...@@ -141,15 +147,53 @@ public class ProblemInitiationServiceImpl { ...@@ -141,15 +147,53 @@ public class ProblemInitiationServiceImpl {
e.printStackTrace(); e.printStackTrace();
System.out.println("任务完成失败:"+e.getMessage()); System.out.println("任务完成失败:"+e.getMessage());
} finally { } finally {
//更新任务表的状态 已办
if(!ValidationUtil.isEmpty(unitIds)) {
taskType = getUnitId(unitIds, objectd);
taskService.setTask(objectd.getStatus(), true, taskType, new Date(), object.getLong("sequenceNbr"), TaskTypeEnum.质量问题.getKey(), unitIds);
}
//更新problem中的status字段,表示当前流程下一个执行的任务 //更新problem中的status字段,表示当前流程下一个执行的任务
qualityProblemService.updateById(objectd); qualityProblemService.updateById(objectd);
updateProBlemFlowStatus(instanceId); updateProBlemFlowStatus(instanceId);
QualityProblem quality = qualityProblemService.getById(objectd.getSequenceNbr()); QualityProblem quality = qualityProblemService.getById(objectd.getSequenceNbr());
objectd.setStatus(quality.getStatus()); objectd.setStatus(quality.getStatus());
if(!ValidationUtil.isEmpty(unitIds)) {
taskType = getUnitId(unitIds, objectd);
taskService.setTask(objectd.getStatus(), false, taskType, new Date(), object.getLong("sequenceNbr"), TaskTypeEnum.质量问题.getKey(), unitIds);
}
} }
} }
/** /**
* 获取任务的执行单位id 和 TaskType
* @param unitIds
*/
public String getUnitId(List<Long> unitIds, QualityProblem qualityProblem){
Project project = projectServiceImpl.getById(qualityProblem.getProjectId());
//获取问题所在的区域规则信息
SuperviseRule superviseRule = superviseRuleServiceImpl.getOne(new LambdaQueryWrapper<SuperviseRule>().eq(SuperviseRule::getAdminRegionCode,project.getInstallRegionCode()));
String taskType = "";
if (ProblemProcessEnum.确定问题.getName().equals(qualityProblem.getStatus()) || ProblemProcessEnum.审查整改过程.getName().equals(qualityProblem.getStatus()) || ProblemProcessEnum.问题分类.getName().equals(qualityProblem.getStatus())) {
unitIds.add(superviseRule.getInspectionUnitId());
taskType = TaskTypeEnum.流程.getKey();
}
if (ProblemProcessEnum.编制处理方案.getName().equals(qualityProblem.getStatus()) || ProblemProcessEnum.提交整改书.getName().equals(qualityProblem.getStatus())) {
unitIds.add(project.getInstallationUnitId());
taskType = TaskTypeEnum.填报.getKey();
}
if (ProblemProcessEnum.审查处理方案.getName().equals(qualityProblem.getStatus())) {
unitIds.add(project.getConstructionUnitId());
taskType = TaskTypeEnum.流程.getKey();
}
return taskType;
}
/**
* 项目立项及质量问题闭环处理 发送短信具体模板 * 项目立项及质量问题闭环处理 发送短信具体模板
* @param object * @param object
* @param smsCode * @param smsCode
......
...@@ -18,6 +18,7 @@ import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil; ...@@ -18,6 +18,7 @@ import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.ugp.api.Enum.AuditEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.AuditEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.SMSEnum; import com.yeejoin.amos.boot.module.ugp.api.Enum.SMSEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.TaskTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.Util.CommonResponse; import com.yeejoin.amos.boot.module.ugp.api.Util.CommonResponse;
import com.yeejoin.amos.boot.module.ugp.api.Util.HttpUtil; import com.yeejoin.amos.boot.module.ugp.api.Util.HttpUtil;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant; import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant;
...@@ -36,6 +37,8 @@ import com.yeejoin.amos.feign.workflow.client.TaskClient; ...@@ -36,6 +37,8 @@ import com.yeejoin.amos.feign.workflow.client.TaskClient;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult; import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO; import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import org.bouncycastle.pqc.crypto.newhope.NHOtherInfoGenerator;
import org.drools.core.factmodel.traits.TraitTypeEnum;
import org.slf4j.Logger; 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;
...@@ -54,7 +57,8 @@ import java.util.*; ...@@ -54,7 +57,8 @@ import java.util.*;
@Service @Service
public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationDto, ProjectInitiation, ProjectInitiationMapper> implements IProjectInitiationService { public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationDto, ProjectInitiation, ProjectInitiationMapper> implements IProjectInitiationService {
@Autowired
SuperviseRuleServiceImpl superviseRuleService;
@Autowired @Autowired
ProjectInitiationServiceImpl projectInitiationService; ProjectInitiationServiceImpl projectInitiationService;
...@@ -83,6 +87,9 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD ...@@ -83,6 +87,9 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
@Autowired @Autowired
ProblemInitiationServiceImpl problemInitiationService; ProblemInitiationServiceImpl problemInitiationService;
@Autowired
private TaskServiceImpl taskService;
private final Logger logger = LoggerFactory.getLogger(ProjectInitiationServiceImpl.class); private final Logger logger = LoggerFactory.getLogger(ProjectInitiationServiceImpl.class);
@Value("${params.work.flow.processDefinitionKey}") @Value("${params.work.flow.processDefinitionKey}")
...@@ -121,7 +128,11 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD ...@@ -121,7 +128,11 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
@Override @Override
public void execute(String instanceId,Object objectd, String option){ public void execute(String instanceId,Object objectd, String option){
String taskType = "";
List<Long> unitIds = new ArrayList<>();
JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectd)); JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectd));
Project project = JSON.parseObject(JSONObject.toJSONString(objectd),Project.class);
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId); AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data"))); JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
ProjectInitiation projectInitiation = new ProjectInitiation(); ProjectInitiation projectInitiation = new ProjectInitiation();
...@@ -131,7 +142,16 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD ...@@ -131,7 +142,16 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
projectInitiation.setTaskId(dataObject.getString("id")); projectInitiation.setTaskId(dataObject.getString("id"));
projectInitiation.setTaskName(dataObject.getString("name")); projectInitiation.setTaskName(dataObject.getString("name"));
if (ProjectInitiationEnum.平台审核.getName().equals(dataObject.getString("name"))) { //项目的管辖区域
String regionCode = object.getString("region");
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SuperviseRule :: getAdminRegionCode,regionCode);
SuperviseRule superviseRule = superviseRuleService.getOne(wrapper);
if (ProjectInitiationEnum.告知申请.getName().equals(dataObject.getString("name"))) {
if(!ValidationUtil.isEmpty(objectd)) {
problemInitiationService.sendSms(object, SMSEnum.项目安装告知申请.getCode());
}
} }
if(ProjectInitiationEnum.监检员审核.getName().equals(dataObject.getString("name"))){ if(ProjectInitiationEnum.监检员审核.getName().equals(dataObject.getString("name"))){
...@@ -146,11 +166,7 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD ...@@ -146,11 +166,7 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
} }
} }
if (ProjectInitiationEnum.告知申请.getName().equals(dataObject.getString("name"))) {
if(!ValidationUtil.isEmpty(objectd)) {
problemInitiationService.sendSms(object, SMSEnum.项目安装告知申请.getCode());
}
}
if (ProjectInitiationEnum.项目关闭.getName().equals(dataObject.getString("name"))) { if (ProjectInitiationEnum.项目关闭.getName().equals(dataObject.getString("name"))) {
if(!ValidationUtil.isEmpty(objectd)) { if(!ValidationUtil.isEmpty(objectd)) {
...@@ -175,11 +191,56 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD ...@@ -175,11 +191,56 @@ public class ProjectInitiationServiceImpl extends BaseService<ProjectInitiationD
e.printStackTrace(); e.printStackTrace();
System.out.println("任务完成失败:"+e.getMessage()); System.out.println("任务完成失败:"+e.getMessage());
} finally { } finally {
//更新任务表的状态 已办
if(!ValidationUtil.isEmpty(unitIds)) {
taskType = getUnitId(unitIds, project, superviseRule);
taskService.setTask(project.getStatus(), true, taskType, new Date(), object.getLong("sequenceNbr"), TaskTypeEnum.项目立项.getKey(), unitIds);
}
//更新project种的status字段,表示当前流程下一个执行的任务 //更新project种的status字段,表示当前流程下一个执行的任务
updateProjectFlowStatus(instanceId); updateProjectFlowStatus(instanceId);
//新增任务表的状态 待办
if(!ValidationUtil.isEmpty(unitIds)) {
project = projectService.getById(object.getLong("sequenceNbr"));
taskType = getUnitId(unitIds, project, superviseRule);
taskService.setTask(project.getStatus(), false, taskType, new Date(), object.getLong("sequenceNbr"), TaskTypeEnum.项目立项.getKey(), unitIds);
}
} }
} }
/**
* 获取任务的执行单位id 和 TaskType
* @param unitIds
*/
public String getUnitId(List<Long> unitIds,Project project,SuperviseRule superviseRule){
String taskType = "";
if (ProjectInitiationEnum.项目立项.getName().equals(project.getStatus())) {
unitIds.add(project.getConstructionUnitId());
taskType = TaskTypeEnum.填报.getKey();
}
if (ProjectInitiationEnum.告知申请.getName().equals(project.getStatus())) {
unitIds.add(project.getInstallationUnitId());
taskType = TaskTypeEnum.填报.getKey();
}
if (ProjectInitiationEnum.接受告知.getName().equals(project.getStatus())) {
unitIds.add(superviseRule.getSuperviseDeptId());
}
if (ProjectInitiationEnum.审查项目.getName().equals(project.getStatus()) || ProjectInitiationEnum.监检员分配.getName().equals(project.getStatus()) || ProjectInitiationEnum.监检员审核.getName().equals(project.getStatus()) || ProjectInitiationEnum.监检科室分配.getName().equals(project.getStatus())) {
unitIds.add(superviseRule.getInspectionUnitId());
}
if (ProjectInitiationEnum.提交资料.getName().equals(project.getStatus()) ) {
unitIds.add(project.getInstallationUnitId());
unitIds.add(project.getDesignUnitId());
taskType = TaskTypeEnum.填报.getKey();
}
if(ProjectInitiationEnum.审批人审批.getName().equals(project.getStatus()) || ProjectInitiationEnum.审核人审核.getName().equals(project.getStatus())){
unitIds.add(project.getInstallationUnitId());
unitIds.add(project.getDesignUnitId());
taskType = TaskTypeEnum.流程.getKey();
}
return taskType;
}
/*焊评审核(后期优化) /*焊评审核(后期优化)
......
...@@ -13,7 +13,10 @@ import com.yeejoin.amos.boot.module.ugp.api.mapper.WeldMapper; ...@@ -13,7 +13,10 @@ import com.yeejoin.amos.boot.module.ugp.api.mapper.WeldMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IVerifyService; import com.yeejoin.amos.boot.module.ugp.api.service.IVerifyService;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify; import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -33,6 +36,9 @@ import java.util.stream.Collectors; ...@@ -33,6 +36,9 @@ import java.util.stream.Collectors;
@Service @Service
public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper> implements IVerifyService { public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper> implements IVerifyService {
@Autowired
private EmqKeeper emqKeeper;
@Autowired @Autowired
InstallNoticeServiceImpl installNoticeService; InstallNoticeServiceImpl installNoticeService;
@Autowired @Autowired
...@@ -59,6 +65,9 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -59,6 +65,9 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
private ProblemInitiationServiceImpl problemInitiationService; private ProblemInitiationServiceImpl problemInitiationService;
@Autowired @Autowired
private CompanyServiceImpl companyService; private CompanyServiceImpl companyService;
@Value("${mqtt.topic.weldUpdate}")
private String weldUpdate;
/** /**
* 分页查询 * 分页查询
...@@ -225,6 +234,28 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -225,6 +234,28 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
return page ; return page ;
} }
public void weldUpdate(JSONObject jsonObject,Integer status){
Weld weld = weldService.getOne(new LambdaQueryWrapper<Weld>().eq(Weld::getCode,jsonObject.getString("code")));
String location = jsonObject.getString("location");
if(!ValidationUtil.isEmpty(status)){
weld.setStatus(status);
}
if(!"4.9E-3244.9E-324".equals(location)){
String longitude = location.substring(0,location.indexOf(","));
String latitude = location.substring(longitude.length()+1);
weld.setLongitude(longitude);
weld.setLatitude(latitude);
weldService.updateById(weld);
try {
emqKeeper.getMqttClient().publish(weldUpdate,weld.toString().getBytes(),1,false);
} catch (MqttException e) {
e.printStackTrace();
}
}
}
/** cpp /** cpp
* 智能监检校验数据 * 智能监检校验数据
* @param jsonObject * @param jsonObject
...@@ -237,6 +268,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -237,6 +268,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if (jsonObject == null || jsonObject.size() ==0) { if (jsonObject == null || jsonObject.size() ==0) {
return VerifyEnum.未通过.getName(); return VerifyEnum.未通过.getName();
} }
//通过userid和projectId来对应 //通过userid和projectId来对应
Long welderId = orgService.getReginParams( ).getBusinessInfo( ).getUserSequenceNbr( ); Long welderId = orgService.getReginParams( ).getBusinessInfo( ).getUserSequenceNbr( );
Long random = jsonObject.getLong("random");//随机值 Long random = jsonObject.getLong("random");//随机值
...@@ -252,6 +284,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -252,6 +284,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
verify.setType(TYPE);//检验方式 verify.setType(TYPE);//检验方式
verify.setVerifyTime(time);//获取当前时间 verify.setVerifyTime(time);//获取当前时间
List<Verify> verifyList = verifyMapper.selectByWelder(projectId,welderId,null,null,random); List<Verify> verifyList = verifyMapper.selectByWelder(projectId,welderId,null,null,random);
//人员 //人员
if (stage.equals(StageEnum.焊前人员.getVerifyName())) { if (stage.equals(StageEnum.焊前人员.getVerifyName())) {
verify.setStage(StageEnum.焊前人员.getStage()); //阶段 verify.setStage(StageEnum.焊前人员.getStage()); //阶段
...@@ -299,6 +332,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -299,6 +332,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
} }
//成功 //成功
this.addSuccessData(verify,null,jsonObject); this.addSuccessData(verify,null,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
} }
//管材 //管材
if (stage.equals(StageEnum.焊前管材质量.getVerifyName())){ if (stage.equals(StageEnum.焊前管材质量.getVerifyName())){
...@@ -337,6 +372,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -337,6 +372,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
return VerifyEnum.未通过.getName(); return VerifyEnum.未通过.getName();
} }
this.addSuccessData(verify,null,jsonObject); this.addSuccessData(verify,null,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
} }
//设备 //设备
if (stage.equals(StageEnum.焊前设备.getVerifyName())){ if (stage.equals(StageEnum.焊前设备.getVerifyName())){
...@@ -374,6 +411,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -374,6 +411,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
} }
//效验通过 //效验通过
this.addSuccessData(verify,null,jsonObject); this.addSuccessData(verify,null,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
} }
//工艺 //工艺
if (stage.equals(StageEnum.焊接工艺.getVerifyName())){ if (stage.equals(StageEnum.焊接工艺.getVerifyName())){
...@@ -453,6 +492,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -453,6 +492,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
v1.setStage(StageEnum.管道耐压.getStage()); v1.setStage(StageEnum.管道耐压.getStage());
v1.setSubmitTime(time); v1.setSubmitTime(time);
this.addSuccessData(v1,null,object); this.addSuccessData(v1,null,object);
//更新weld焊口信息表中的经纬度信息,更新焊口状态 已完成
weldUpdate(jsonObject,WeldStatusEnum.已完成.getStatus());
} }
//耐压 //耐压
if (stage.equals(StageEnum.管道耐压.getVerifyName())){ if (stage.equals(StageEnum.管道耐压.getVerifyName())){
...@@ -501,6 +542,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -501,6 +542,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
} }
//效验通过 //效验通过
this.addSuccessData(verify,codeArray,jsonObject); this.addSuccessData(verify,codeArray,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
} }
//埋深 //埋深
if (stage.equals(StageEnum.敷设质量.getVerifyName())){ if (stage.equals(StageEnum.敷设质量.getVerifyName())){
...@@ -573,6 +616,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -573,6 +616,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
//效验通过 //效验通过
String []codeArray =manyCode.split(","); String []codeArray =manyCode.split(",");
this.addSuccessData(verify,codeArray,jsonObject); this.addSuccessData(verify,codeArray,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
} }
//回填 //回填
if (stage.equals(StageEnum.回填.getVerifyName())) { if (stage.equals(StageEnum.回填.getVerifyName())) {
...@@ -607,6 +652,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper ...@@ -607,6 +652,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
//效验通过 //效验通过
String []codeArray =manyCode.split(","); String []codeArray =manyCode.split(",");
this.addSuccessData(verify,codeArray,jsonObject); this.addSuccessData(verify,codeArray,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment