1.谐波普测相关功能提交

This commit is contained in:
cdf
2024-04-08 09:31:41 +08:00
parent a3928ab8c6
commit 2512a861bb
8 changed files with 128 additions and 45 deletions

View File

@@ -17,8 +17,7 @@ public enum AuditProcessEnum {
WaitAudit(1,"待审核"),
AuditPass(2,"审核通过"),
AuditRefuse(3,"审核未通过"),
Release(4,"发布"),
Finish(5,"已完成")
Release(4,"完成")
;

View File

@@ -34,7 +34,7 @@ public class FlowableAss{
private String proIndex;
/**
* 步骤主键
* 每个流程唯一id,
*/
private String execIndex;

View File

@@ -1,6 +1,7 @@
package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
@@ -83,7 +84,7 @@ public class RGeneralSurveyPlanPO {
private String leader;
/**
* 计划状态(0:新建 1:待审核 2:审核未通过 3:已发布 4:已完成)
* 计划状态(0:新建 1:待审核 2:审核未通过 3.审核未通过 4:已完成)
*/
@TableField(value = "status")
private int status;

View File

@@ -137,6 +137,17 @@ public class RGeneralSurveyPlanController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanVOS, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryPlanOne")
@ApiOperation("查询普测计划详情")
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
public HttpResult<RGeneralSurveyPlanVO> queryPlanOne(@RequestParam("planId")String planId) {
String methodDescribe = getMethodDescribe("queryPlanOne");
RGeneralSurveyPlanVO rGeneralSurveyPlanVO = rGeneralSurveyPlanPOService.queryPlanOne( planId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanVO, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryPlanAudit")
@ApiOperation("查询普测计划-审核页面")
@@ -281,4 +292,19 @@ public class RGeneralSurveyPlanController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
/**
* 删除新建驳回的计划
* @author cdf
* @date 2024/4/7
*/
@ApiOperation("删除计划")
@PostMapping(value = "deletePlan")
@ApiImplicitParam(name = "planIds", value = "实体参数", required = true)
public HttpResult<Boolean> deletePlan(@RequestBody List<String> planIds) {
String methodDescribe = getMethodDescribe("deletePlan");
rGeneralSurveyPlanPOService.deletePlan(planIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
}

View File

@@ -72,7 +72,7 @@ public class FlowInstanceController extends BaseController {
String methodDescribe = getMethodDescribe("delete");
flowInstanceService.delete(instanceIds,"测试删除666");
flowInstanceService.delete(instanceIds,"测试删除");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);

View File

@@ -6,6 +6,7 @@ import com.njcn.minioss.bo.MinIoUploadResDTO;
import com.njcn.process.pojo.param.*;
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
import com.njcn.process.pojo.vo.*;
import liquibase.pro.packaged.S;
import java.util.List;
@@ -37,6 +38,9 @@ public interface RGeneralSurveyPlanPOService extends IMppService<RGeneralSurveyP
*/
IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm, List<String> statusList, String type);
RGeneralSurveyPlanVO queryPlanOne(String planId);
/**
* @Description: surveyResultUpload
* @Param: [surveyResultUploadParam]
@@ -106,4 +110,7 @@ public interface RGeneralSurveyPlanPOService extends IMppService<RGeneralSurveyP
Boolean submitAuditUser(RGeneralSurveyPlanAuditUserParam rGeneralSurveyPlanAuditUserParam);
Boolean deletePlan(List<String> planIds);
}

View File

@@ -27,6 +27,7 @@ import com.njcn.process.pojo.vo.flowable.FlowTaskVo;
import com.njcn.process.service.RGeneralSurveyPlanDetailService;
import com.njcn.process.service.RGeneralSurveyPlanPOService;
import com.njcn.process.service.flowable.IFlowDefinitionService;
import com.njcn.process.service.flowable.IFlowInstanceService;
import com.njcn.process.service.flowable.IFlowTaskService;
import com.njcn.process.service.impl.flowable.FlowDefinitionServiceImpl;
@@ -35,6 +36,7 @@ import com.njcn.user.api.UserFeignClient;
import com.njcn.user.pojo.po.Dept;
import com.njcn.user.pojo.po.User;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.user.pojo.vo.UserVO;
import com.njcn.web.utils.RequestUtil;
import liquibase.pro.packaged.S;
import lombok.RequiredArgsConstructor;
@@ -75,6 +77,8 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
private final IFlowDefinitionService iFlowDefinitionService;
private final IFlowInstanceService iFlowInstanceService;
private final IFlowTaskService iFlowTaskService;
private final UserFeignClient userFeignClient;
@@ -111,7 +115,6 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
rGeneralSurveyPlanPO.setCreatePerson(RequestUtil.getUserIndex());
RGeneralSurveyPlanPO generalSurveyPlanPO = this.getOne(new LambdaQueryWrapper<RGeneralSurveyPlanPO>()
.eq(RGeneralSurveyPlanPO::getPlanNo, rGeneralSurveyPlanAddParm.getPlanNo()));
@@ -119,9 +122,9 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
if (Objects.isNull(generalSurveyPlanPO)) {
this.save(rGeneralSurveyPlanPO);
} else {
if(rGeneralSurveyPlanPO.getStatus() == AuditProcessEnum.New.getStatus() || rGeneralSurveyPlanPO.getStatus() == AuditProcessEnum.AuditRefuse.getStatus()){
if (rGeneralSurveyPlanPO.getStatus() == AuditProcessEnum.New.getStatus() || rGeneralSurveyPlanPO.getStatus() == AuditProcessEnum.AuditRefuse.getStatus()) {
this.updateByMultiId(rGeneralSurveyPlanPO);
}else {
} else {
throw new BusinessException("存在相同普测计划编号,请勿重复新建");
}
}
@@ -252,6 +255,37 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
return returnpage;
}
@Override
public RGeneralSurveyPlanVO queryPlanOne(String planId) {
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = this.getOne(new LambdaQueryWrapper<RGeneralSurveyPlanPO>().eq(RGeneralSurveyPlanPO::getPlanNo, planId));
LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(RGeneralSurveyPlanDetail::getPlanNo, planId);
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetails = rGeneralSurveyPlanDetailMapper.selectList(lambdaQueryWrapper);
RGeneralSurveyPlanVO rGeneralSurveyPlanVO = new RGeneralSurveyPlanVO();
BeanUtils.copyProperties(rGeneralSurveyPlanPO, rGeneralSurveyPlanVO);
rGeneralSurveyPlanVO.setSubCount(rGeneralSurveyPlanDetails.size());
rGeneralSurveyPlanVO.setSubIds(rGeneralSurveyPlanDetails.stream().map(RGeneralSurveyPlanDetail::getSubId).collect(Collectors.toList()));
rGeneralSurveyPlanVO.setIsFileUpload(ObjectUtil.isNull(rGeneralSurveyPlanPO.getIsFileUpload()) ? 0 : rGeneralSurveyPlanPO.getIsFileUpload());
Dept dept = deptFeignClient.getDeptById(rGeneralSurveyPlanPO.getOrgNo()).getData();
UserVO user = userFeignClient.getUserById(rGeneralSurveyPlanPO.getCreatePerson()).getData();
rGeneralSurveyPlanVO.setOrgName(dept.getName()); //单位名称
rGeneralSurveyPlanVO.setCreatePersonName(user.getName());
if (StrUtil.isNotBlank(rGeneralSurveyPlanPO.getCheckPerson())) {
UserVO checkUser = userFeignClient.getUserById(rGeneralSurveyPlanPO.getCheckPerson()).getData();
rGeneralSurveyPlanVO.setCheckPerson(checkUser.getName());
}
return rGeneralSurveyPlanVO;
}
/**
* @param surveyResultUploadParam
* @Description: surveyResultUpload
@@ -432,8 +466,8 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
@Transactional(rollbackFor = {Exception.class})
public Boolean checkPlanAudit(RGeneralSurveyPlanChcekParm rGeneralSurveyPlanChcekParm) {
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = this.lambdaQuery().eq(RGeneralSurveyPlanPO::getPlanNo,rGeneralSurveyPlanChcekParm.getPlanNo()).one();
if(rGeneralSurveyPlanPO.getStatus() != AuditProcessEnum.WaitAudit.getStatus()){
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = this.lambdaQuery().eq(RGeneralSurveyPlanPO::getPlanNo, rGeneralSurveyPlanChcekParm.getPlanNo()).one();
if (rGeneralSurveyPlanPO.getStatus() != AuditProcessEnum.WaitAudit.getStatus()) {
throw new BusinessException("当前流程非待审核状态");
}
boolean result = true;
@@ -445,36 +479,26 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
result = this.update(updateWrapper);
//处理流程
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getThsIndex,rGeneralSurveyPlanChcekParm.getPlanNo()));
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getThsIndex, rGeneralSurveyPlanChcekParm.getPlanNo()));
String auditResult = Objects.equals("1", rGeneralSurveyPlanChcekParm.getCheckResult()) ? "同意" : "拒绝";
if(Objects.equals("0", rGeneralSurveyPlanChcekParm.getCheckResult())){
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId());
flowTaskVo.setComment(RequestUtil.getUserNickname() + auditResult + " 编号为" + rGeneralSurveyPlanChcekParm.getPlanNo() + "的计划,理由:" + rGeneralSurveyPlanChcekParm.getCheckComment());
if (Objects.equals("0", rGeneralSurveyPlanChcekParm.getCheckResult())) {
//拒绝,则回退到申请步骤
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId());
flowTaskVo.setComment(rGeneralSurveyPlanChcekParm.getCheckComment());
iFlowTaskService.taskReject(flowTaskVo);
}else {
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId());
} else {
//同意
flowTaskVo.setInstanceId(flowableAss.getExecIndex());
flowTaskVo.setComment(RequestUtil.getUserNickname() + auditResult+"编号为"+rGeneralSurveyPlanChcekParm.getPlanNo()+"的计划,结论:"+rGeneralSurveyPlanChcekParm.getCheckComment());
Map<String,Object> map = new HashMap<>();
map.put("auditFlag",1);
Map<String, Object> map = new HashMap<>();
map.put("auditFlag", 1);
flowTaskVo.setVariables(map);
iFlowTaskService.complete(flowTaskVo);
}
return result;
}
@@ -691,8 +715,8 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
//map.put("applyUser",userId);
for (String planId : planIds) {
//需要判断那些流程已经启动,已经启动的则为驳回后的再次提交审核
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getThsIndex,planId));
if(Objects.nonNull(flowableAss)){
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getThsIndex, planId));
if (Objects.nonNull(flowableAss)) {
//不为空则认为是驳回后的重新发起
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo();
@@ -706,10 +730,10 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
flowTaskVoNext.setTaskId(taskNext.getId());
flowTaskVoNext.setAssignee(rGeneralSurveyPlanAuditUserParam.getAuditUser());
iFlowTaskService.toNextTaskUser(flowTaskVoNext);
}else {
} else {
//开始流程
FlowFormAss flowFormAss = flowFormAssMapper.selectOne(new LambdaQueryWrapper<FlowFormAss>().eq(FlowFormAss::getFormId,1));
if(Objects.isNull(flowFormAss)){
FlowFormAss flowFormAss = flowFormAssMapper.selectOne(new LambdaQueryWrapper<FlowFormAss>().eq(FlowFormAss::getFormId, 1));
if (Objects.isNull(flowFormAss)) {
throw new BusinessException("当前功能未绑定流程,请先绑定流程");
}
@@ -718,7 +742,6 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId());
flowTaskVo.setInstanceId(processId);
flowTaskVo.setAssignee(RequestUtil.getUserIndex());
flowTaskVo.setComment(RequestUtil.getUserNickname() + "发起普测计划申请");
iFlowTaskService.complete(flowTaskVo);
@@ -734,6 +757,33 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deletePlan(List<String> planIds) {
//判断是否满足删除条件
long count = this.lambdaQuery().in(RGeneralSurveyPlanPO::getPlanNo, planIds).notIn(RGeneralSurveyPlanPO::getStatus, Stream.of(AuditProcessEnum.New.getStatus(), AuditProcessEnum.AuditRefuse.getStatus()).collect(Collectors.toList())).count();
if (count > 0) {
throw new BusinessException("无法删除新建和未通过状态之外的计划");
}
this.remove(new LambdaQueryWrapper<RGeneralSurveyPlanPO>().in(RGeneralSurveyPlanPO::getPlanNo, planIds));
//删除相关的电站关联信息
rGeneralSurveyPlanDetailMapper.delete(new LambdaQueryWrapper<RGeneralSurveyPlanDetail>().in(RGeneralSurveyPlanDetail::getPlanNo, planIds));
//删除同时如果是驳回状态需要同时删除流程
for (String plan : planIds) {
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getThsIndex, plan));
if (Objects.nonNull(flowableAss)) {
iFlowInstanceService.delete(flowableAss.getExecIndex(), "测试删除");
flowableAssMapper.deleteById(flowableAss.getThsIndex());
}
}
return true;
}
public List<DeptSubstationVO> recursion(DeptSubstationVO result, String orgdid) {
List<DeptSubstationVO> deptSubstationVOList = new ArrayList<>();
if (Objects.equals(result.getId(), orgdid)) {

View File

@@ -88,7 +88,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
try {
List<FlowViewerDto> flowViewerList = new ArrayList<>();
// 获取已经完成的节点
List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
/* List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(procInsId)
.finished()
.list();
@@ -99,7 +99,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
flowViewerDto.setKey(s.getActivityId());
flowViewerDto.setCompleted(true);
flowViewerList.add(flowViewerDto);
});
});*/
// 获取代办节点
List<HistoricActivityInstance> listUnFinished = historyService.createHistoricActivityInstanceQuery()
@@ -225,11 +225,11 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
flowTask.setTaskName(taskList.get(0).getName());
if (StringUtils.isNotBlank(taskList.get(0).getAssignee())) {
// 当前任务节点办理人信息
List<User> userList = userFeignClient.getUserByIdList(Stream.of(taskList.get(0).getAssignee()).collect(Collectors.toList())).getData();
if (CollectionUtil.isNotEmpty(userList)) {
flowTask.setAssigneeId(userList.get(0).getId());
flowTask.setAssigneeName(userList.get(0).getName());
flowTask.setAssigneeDeptName(Objects.nonNull(userList.get(0).getDeptId()) ? userList.get(0).getDeptId() : "");
UserVO user = userFeignClient.getUserById(taskList.get(0).getAssignee()).getData();
if (Objects.nonNull(user)) {
flowTask.setAssigneeId(user.getId());
flowTask.setAssigneeName(user.getName());
flowTask.setAssigneeDeptName(user.getDeptName());
}
}
} else {