|
|
@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.hnac.hzims.message.fegin.IMessagePushClient; |
|
|
|
import com.hnac.hzims.message.fegin.IMessagePushClient; |
|
|
|
import com.hnac.hzims.message.req.PushExtrasReq; |
|
|
|
import com.hnac.hzims.message.req.PushExtrasReq; |
|
|
|
import com.hnac.hzims.operational.OperationalConstants; |
|
|
|
import com.hnac.hzims.operational.OperationalConstants; |
|
|
@ -37,6 +39,7 @@ import com.hnac.hzims.vo.SafeCheckStatisticVO; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.RandomUtils; |
|
|
|
import org.apache.commons.lang3.RandomUtils; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
@ -89,10 +92,10 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R doSave(OperAccessTaskDTO req) { |
|
|
|
public R doSave(OperAccessTaskDTO req) { |
|
|
|
req.setCode("TASK" + DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("###").format(RandomUtils.nextInt(0, 999))); |
|
|
|
req.setCode("TASK" + DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("###").format(RandomUtils.nextInt(0, 999))); |
|
|
|
List<OperAccessMaterialEntity> materialEntityList = JSONObject.parseArray(JSON.toJSONString(req.getAccessMaterials()),OperAccessMaterialEntity.class); |
|
|
|
List<OperAccessMaterialEntity> materialEntityList = JSONObject.parseArray(JSON.toJSONString(req.getAccessMaterials()), OperAccessMaterialEntity.class); |
|
|
|
if(super.save(req)){ |
|
|
|
if (super.save(req)) { |
|
|
|
if(CollectionUtil.isNotEmpty(materialEntityList)) { |
|
|
|
if (CollectionUtil.isNotEmpty(materialEntityList)) { |
|
|
|
materialEntityList.stream().map(material->{ |
|
|
|
materialEntityList.stream().map(material -> { |
|
|
|
material.setPlanId(null); |
|
|
|
material.setPlanId(null); |
|
|
|
material.setId(null); |
|
|
|
material.setId(null); |
|
|
|
material.setTaskId(req.getId()); |
|
|
|
material.setTaskId(req.getId()); |
|
|
@ -102,16 +105,12 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
} |
|
|
|
} |
|
|
|
this.updateDetails(req.getId(), req.getAccessTaskDetails()); |
|
|
|
this.updateDetails(req.getId(), req.getAccessTaskDetails()); |
|
|
|
//开启检修任务流程
|
|
|
|
//开启检修任务流程
|
|
|
|
R<BladeFlow> bladeFlowR = flowClient.startProcessInstanceContainNameByKey( |
|
|
|
R<BladeFlow> bladeFlowR = flowClient.startProcessInstanceContainNameByKey("access_task_execute", FlowUtil.getBusinessKey("hzims_oper_access_task", String.valueOf(req.getId())), req.getName(), new HashMap<String, Object>() {{ |
|
|
|
"access_task_execute", |
|
|
|
|
|
|
|
FlowUtil.getBusinessKey("hzims_oper_access_task",String.valueOf(req.getId())), |
|
|
|
|
|
|
|
req.getName(), |
|
|
|
|
|
|
|
new HashMap<String, Object>() {{ |
|
|
|
|
|
|
|
put("taskId", req.getId()); |
|
|
|
put("taskId", req.getId()); |
|
|
|
put("handler", TaskUtil.getTaskUser(req.getHandler().toString())); |
|
|
|
put("handler", TaskUtil.getTaskUser(req.getHandler().toString())); |
|
|
|
put("creator", TaskUtil.getTaskUser(AuthUtil.getUserId().toString())); |
|
|
|
put("creator", TaskUtil.getTaskUser(AuthUtil.getUserId().toString())); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()),()->{ |
|
|
|
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()), () -> { |
|
|
|
throw new ServiceException("保存检修任务失败,开启检修任务流程失败!"); |
|
|
|
throw new ServiceException("保存检修任务失败,开启检修任务流程失败!"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
String processInstanceId = bladeFlowR.getData().getProcessInstanceId(); |
|
|
|
String processInstanceId = bladeFlowR.getData().getProcessInstanceId(); |
|
|
@ -140,14 +139,14 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
statisticsDTO.setTaskId(entity.getId()); |
|
|
|
statisticsDTO.setTaskId(entity.getId()); |
|
|
|
statisticsDTO.setManager(entity.getHandler()); |
|
|
|
statisticsDTO.setManager(entity.getHandler()); |
|
|
|
OperAccessContentEntity accessContentEntity = contentService.getById(req.getId()); |
|
|
|
OperAccessContentEntity accessContentEntity = contentService.getById(req.getId()); |
|
|
|
if(ObjectUtil.isNotEmpty(accessContentEntity)){ |
|
|
|
if (ObjectUtil.isNotEmpty(accessContentEntity)) { |
|
|
|
statisticsDTO.setPid(accessContentEntity.getLibraryId()); |
|
|
|
statisticsDTO.setPid(accessContentEntity.getLibraryId()); |
|
|
|
} |
|
|
|
} |
|
|
|
statisticsService.doSave(statisticsDTO); |
|
|
|
statisticsService.doSave(statisticsDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//材料库出库
|
|
|
|
//材料库出库
|
|
|
|
if(CollectionUtil.isNotEmpty(req.getAccessMaterials())){ |
|
|
|
if (CollectionUtil.isNotEmpty(req.getAccessMaterials())) { |
|
|
|
List<OperAccessMaterialDTO> materialDTOList = req.getAccessMaterials(); |
|
|
|
List<OperAccessMaterialDTO> materialDTOList = req.getAccessMaterials(); |
|
|
|
for (OperAccessMaterialDTO materialDTO : materialDTOList) { |
|
|
|
for (OperAccessMaterialDTO materialDTO : materialDTOList) { |
|
|
|
SpRecordEntity recordEntity = new SpRecordEntity(); |
|
|
|
SpRecordEntity recordEntity = new SpRecordEntity(); |
|
|
@ -158,7 +157,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
recordEntity.setCreateDept(req.getCreateDept()); |
|
|
|
recordEntity.setCreateDept(req.getCreateDept()); |
|
|
|
recordEntity.setCreateUser(req.getCreateUser()); |
|
|
|
recordEntity.setCreateUser(req.getCreateUser()); |
|
|
|
Boolean result = assetsClient.warehouseOut(recordEntity); |
|
|
|
Boolean result = assetsClient.warehouseOut(recordEntity); |
|
|
|
if(!result) { |
|
|
|
if (!result) { |
|
|
|
return R.fail("出库失败"); |
|
|
|
return R.fail("出库失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
materialDTO.setTaskId(entity.getId()); |
|
|
|
materialDTO.setTaskId(entity.getId()); |
|
|
@ -169,25 +168,23 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
R flowResult = flowClient.completeTask(comleteTask); |
|
|
|
R flowResult = flowClient.completeTask(comleteTask); |
|
|
|
this.finishDefectFlow(entity); |
|
|
|
this.finishDefectFlow(entity); |
|
|
|
|
|
|
|
|
|
|
|
if(!flowResult.isSuccess()) { |
|
|
|
if (!flowResult.isSuccess()) { |
|
|
|
throw new ServiceException(flowResult.getMsg()); |
|
|
|
throw new ServiceException(flowResult.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_2) { |
|
|
|
|
|
|
|
|
|
|
|
else if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_2) { |
|
|
|
|
|
|
|
updateMaterials(entity.getPlanId(), entity.getId(), req.getAccessMaterials()); |
|
|
|
updateMaterials(entity.getPlanId(), entity.getId(), req.getAccessMaterials()); |
|
|
|
//工作流下一步
|
|
|
|
//工作流下一步
|
|
|
|
completeTask(comleteTask, handler, entity.getProcessInstanceId(), entity.getCreateDept()); |
|
|
|
completeTask(comleteTask, handler, entity.getProcessInstanceId(), entity.getCreateDept()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//如果任务审批未通过 需重新开票 将任务ticketId置空
|
|
|
|
//如果任务审批未通过 需重新开票 将任务ticketId置空
|
|
|
|
else if(req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_3) { |
|
|
|
else if (req.getStatus() == AccessConstants.ACCESS_TASK_STATUS_3) { |
|
|
|
LambdaUpdateWrapper<OperAccessTaskEntity> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
LambdaUpdateWrapper<OperAccessTaskEntity> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.set(OperAccessTaskEntity::getTicketId, null); |
|
|
|
updateWrapper.set(OperAccessTaskEntity::getTicketId, null); |
|
|
|
updateWrapper.eq(OperAccessTaskEntity::getId, entity.getId()); |
|
|
|
updateWrapper.eq(OperAccessTaskEntity::getId, entity.getId()); |
|
|
|
super.update(updateWrapper); |
|
|
|
super.update(updateWrapper); |
|
|
|
R result = flowClient.completeTask(comleteTask); |
|
|
|
R result = flowClient.completeTask(comleteTask); |
|
|
|
if(!result.isSuccess()){ |
|
|
|
if (!result.isSuccess()) { |
|
|
|
throw new ServiceException(result.getMsg()); |
|
|
|
throw new ServiceException(result.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -199,17 +196,13 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
public R<OperAccessTaskVO> detail(Long id) { |
|
|
|
public R<OperAccessTaskVO> detail(Long id) { |
|
|
|
OperAccessTaskVO detail = OperAccessTaskWrapper.build().entityVO(super.getById(id)); |
|
|
|
OperAccessTaskVO detail = OperAccessTaskWrapper.build().entityVO(super.getById(id)); |
|
|
|
detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(","))); |
|
|
|
detail.setDangerSources(dangerSourceClient.details(detail.getSafeInfos().split(","))); |
|
|
|
detail.setDetails( |
|
|
|
detail.setDetails(OperAccessTaskDetailWrapper.build().listVO(detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{ |
|
|
|
OperAccessTaskDetailWrapper.build().listVO( |
|
|
|
|
|
|
|
detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{ |
|
|
|
|
|
|
|
eq(OperAccessTaskDetailEntity::getTaskId, id); |
|
|
|
eq(OperAccessTaskDetailEntity::getTaskId, id); |
|
|
|
}}) |
|
|
|
}}))); |
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
detail.setAccessMaterials(materialService.getList(null, String.valueOf(id))); |
|
|
|
detail.setAccessMaterials(materialService.getList(null, String.valueOf(id))); |
|
|
|
if(Func.isNotEmpty(id)){ |
|
|
|
if (Func.isNotEmpty(id)) { |
|
|
|
OperAccessTaskVO operAccessTaskVO = mapper.getAccessPlanByTaskId(id.toString()); |
|
|
|
OperAccessTaskVO operAccessTaskVO = mapper.getAccessPlanByTaskId(id.toString()); |
|
|
|
if(ObjectUtil.isNotEmpty(operAccessTaskVO)){ |
|
|
|
if (ObjectUtil.isNotEmpty(operAccessTaskVO)) { |
|
|
|
detail.setPlanName(operAccessTaskVO.getPlanName()); |
|
|
|
detail.setPlanName(operAccessTaskVO.getPlanName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -226,41 +219,41 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<OperAccessTaskEntity> getByEmCode(String emCode, List<String> list) { |
|
|
|
public List<OperAccessTaskEntity> getByEmCode(String emCode, List<String> list) { |
|
|
|
return this.baseMapper.selectByEmCode(emCode,list); |
|
|
|
return this.baseMapper.selectByEmCode(emCode, list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<AccessReportVO> getAccessTaskByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) { |
|
|
|
public List<AccessReportVO> getAccessTaskByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) { |
|
|
|
List<AccessReportVO> inspectOrAccessReportVOList = new ArrayList<>(); |
|
|
|
List<AccessReportVO> inspectOrAccessReportVOList = new ArrayList<>(); |
|
|
|
//获取月份内的检修任务
|
|
|
|
//获取月份内的检修任务
|
|
|
|
List<OperAccessTaskEntity> operAccessTaskEntityList = this.list(new LambdaQueryWrapper<OperAccessTaskEntity>(){{ |
|
|
|
List<OperAccessTaskEntity> operAccessTaskEntityList = this.list(new LambdaQueryWrapper<OperAccessTaskEntity>() {{ |
|
|
|
ge(OperAccessTaskEntity::getPlanStartTime,startDate); |
|
|
|
ge(OperAccessTaskEntity::getPlanStartTime, startDate); |
|
|
|
le(OperAccessTaskEntity::getPlanStartTime,endDate); |
|
|
|
le(OperAccessTaskEntity::getPlanStartTime, endDate); |
|
|
|
in(OperAccessTaskEntity::getCreateDept,deptIdList); |
|
|
|
in(OperAccessTaskEntity::getCreateDept, deptIdList); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
//组合处理人
|
|
|
|
//组合处理人
|
|
|
|
Map<Long,List<OperAccessTaskEntity>> mapByDisposer = operAccessTaskEntityList.stream().collect(Collectors.groupingBy(OperAccessTaskEntity::getHandler)); |
|
|
|
Map<Long, List<OperAccessTaskEntity>> mapByDisposer = operAccessTaskEntityList.stream().collect(Collectors.groupingBy(OperAccessTaskEntity::getHandler)); |
|
|
|
|
|
|
|
|
|
|
|
mapByDisposer.forEach((userId,list)->{ |
|
|
|
mapByDisposer.forEach((userId, list) -> { |
|
|
|
AccessReportVO accessReportVO = new AccessReportVO(); |
|
|
|
AccessReportVO accessReportVO = new AccessReportVO(); |
|
|
|
accessReportVO.setUserName(UserCache.getUser(userId).getName()); |
|
|
|
accessReportVO.setUserName(UserCache.getUser(userId).getName()); |
|
|
|
accessReportVO.setData(list); |
|
|
|
accessReportVO.setData(list); |
|
|
|
//已完成情况
|
|
|
|
//已完成情况
|
|
|
|
List<OperAccessTaskEntity> finishList = list.stream().filter(o-> AccessConstants.ACCESS_TASK_STATUS_4 == o.getStatus()).collect(Collectors.toList()); |
|
|
|
List<OperAccessTaskEntity> finishList = list.stream().filter(o -> AccessConstants.ACCESS_TASK_STATUS_4 == o.getStatus()).collect(Collectors.toList()); |
|
|
|
accessReportVO.setCompleteNum(finishList.size()); |
|
|
|
accessReportVO.setCompleteNum(finishList.size()); |
|
|
|
accessReportVO.setCompleteSituation(finishList.size()+""); |
|
|
|
accessReportVO.setCompleteSituation(finishList.size() + ""); |
|
|
|
//未完成情况
|
|
|
|
//未完成情况
|
|
|
|
List<OperAccessTaskEntity> immatureList = list.stream().filter(o-> AccessConstants.ACCESS_TASK_STATUS_4 != o.getStatus()).collect(Collectors.toList()); |
|
|
|
List<OperAccessTaskEntity> immatureList = list.stream().filter(o -> AccessConstants.ACCESS_TASK_STATUS_4 != o.getStatus()).collect(Collectors.toList()); |
|
|
|
accessReportVO.setIncompleteNum(immatureList.size()); |
|
|
|
accessReportVO.setIncompleteNum(immatureList.size()); |
|
|
|
accessReportVO.setIncompleteSituation(immatureList.size()+""); |
|
|
|
accessReportVO.setIncompleteSituation(immatureList.size() + ""); |
|
|
|
//工时
|
|
|
|
//工时
|
|
|
|
int hours = list.stream().filter(o->o.getActHours() != null).collect(Collectors.summingInt(OperAccessTaskEntity::getActHours)); |
|
|
|
int hours = list.stream().filter(o -> o.getActHours() != null).collect(Collectors.summingInt(OperAccessTaskEntity::getActHours)); |
|
|
|
accessReportVO.setHours(hours); |
|
|
|
accessReportVO.setHours(hours); |
|
|
|
//发现问题数量
|
|
|
|
//发现问题数量
|
|
|
|
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>(){{ |
|
|
|
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>() {{ |
|
|
|
eq(OperPhenomenonEntity::getFinder,userId); |
|
|
|
eq(OperPhenomenonEntity::getFinder, userId); |
|
|
|
ge(OperPhenomenonEntity::getFindTime,startDate); |
|
|
|
ge(OperPhenomenonEntity::getFindTime, startDate); |
|
|
|
le(OperPhenomenonEntity::getFindTime,endDate); |
|
|
|
le(OperPhenomenonEntity::getFindTime, endDate); |
|
|
|
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.JX.getStatus()); |
|
|
|
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.JX.getStatus()); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
accessReportVO.setFindProblemCount(operPhenomenonEntityList.size()); |
|
|
|
accessReportVO.setFindProblemCount(operPhenomenonEntityList.size()); |
|
|
@ -270,11 +263,11 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<AccessReportVO> getAccessTaskByDisposer(Map<String,Object> params) { |
|
|
|
public List<AccessReportVO> getAccessTaskByDisposer(Map<String, Object> params) { |
|
|
|
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); |
|
|
|
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); |
|
|
|
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); |
|
|
|
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); |
|
|
|
List<Long> deptIdList = (List<Long>)params.get("deptId"); |
|
|
|
List<Long> deptIdList = (List<Long>) params.get("deptId"); |
|
|
|
return getAccessTaskByDisposer(startDate,endDate,deptIdList); |
|
|
|
return getAccessTaskByDisposer(startDate, endDate, deptIdList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -283,8 +276,8 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<OperAccessTaskEntity> getAccessTask(String startTime,String endTime,List<Long> list) { |
|
|
|
public List<OperAccessTaskEntity> getAccessTask(String startTime, String endTime, List<Long> list) { |
|
|
|
return this.baseMapper.selectAccessTask(startTime,endTime,list); |
|
|
|
return this.baseMapper.selectAccessTask(startTime, endTime, list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -329,7 +322,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
* @author xiashandong |
|
|
|
* @author xiashandong |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateMaterials(long planId,long taskId, List<OperAccessMaterialDTO> materials) { |
|
|
|
public void updateMaterials(long planId, long taskId, List<OperAccessMaterialDTO> materials) { |
|
|
|
if (CollectionUtils.isEmpty(materials)) { |
|
|
|
if (CollectionUtils.isEmpty(materials)) { |
|
|
|
materials = new ArrayList<>(); |
|
|
|
materials = new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -344,14 +337,15 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
if (!CollectionUtils.isEmpty(ids)) { |
|
|
|
if (!CollectionUtils.isEmpty(ids)) { |
|
|
|
materialService.deleteLogic(ids); |
|
|
|
materialService.deleteLogic(ids); |
|
|
|
} |
|
|
|
} |
|
|
|
if(CollectionUtil.isNotEmpty(materials)){ |
|
|
|
if (CollectionUtil.isNotEmpty(materials)) { |
|
|
|
List<OperAccessMaterialEntity> materialEntityList = JSONArray.parseArray(JSON.toJSONString(materials),OperAccessMaterialEntity.class); |
|
|
|
List<OperAccessMaterialEntity> materialEntityList = JSONArray.parseArray(JSON.toJSONString(materials), OperAccessMaterialEntity.class); |
|
|
|
materialService.saveOrUpdateBatch(materialEntityList); |
|
|
|
materialService.saveOrUpdateBatch(materialEntityList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 执行检修任务 |
|
|
|
* 执行检修任务 |
|
|
|
|
|
|
|
* |
|
|
|
* @param accessTaskDTO |
|
|
|
* @param accessTaskDTO |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -361,7 +355,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
//TODO 更新任务状态以及 填入数据(待确认)
|
|
|
|
//TODO 更新任务状态以及 填入数据(待确认)
|
|
|
|
taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_2); |
|
|
|
taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_2); |
|
|
|
taskEntity.setActHours(accessTaskDTO.getActHours()); |
|
|
|
taskEntity.setActHours(accessTaskDTO.getActHours()); |
|
|
|
if(updateById(taskEntity)) { |
|
|
|
if (updateById(taskEntity)) { |
|
|
|
//更新材料
|
|
|
|
//更新材料
|
|
|
|
updateMaterials(taskEntity.getPlanId(), taskEntity.getId(), accessTaskDTO.getAccessMaterials()); |
|
|
|
updateMaterials(taskEntity.getPlanId(), taskEntity.getId(), accessTaskDTO.getAccessMaterials()); |
|
|
|
//终结工作流
|
|
|
|
//终结工作流
|
|
|
@ -370,13 +364,14 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
comleteTask.setFlag("ok"); |
|
|
|
comleteTask.setFlag("ok"); |
|
|
|
comleteTask.setPass(true); |
|
|
|
comleteTask.setPass(true); |
|
|
|
comleteTask.setComment("执行任务完成,进行下一步流程"); |
|
|
|
comleteTask.setComment("执行任务完成,进行下一步流程"); |
|
|
|
this.completeTask(comleteTask,AuthUtil.getUserId(),taskEntity.getProcessInstanceId(),taskEntity.getCreateDept()); |
|
|
|
this.completeTask(comleteTask, AuthUtil.getUserId(), taskEntity.getProcessInstanceId(), taskEntity.getCreateDept()); |
|
|
|
} |
|
|
|
} |
|
|
|
return R.success("操作成功"); |
|
|
|
return R.success("操作成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取安全检查定期检修项统计 |
|
|
|
* 获取安全检查定期检修项统计 |
|
|
|
|
|
|
|
* |
|
|
|
* @param startDate 开始时间 |
|
|
|
* @param startDate 开始时间 |
|
|
|
* @param endDate 结束时间 |
|
|
|
* @param endDate 结束时间 |
|
|
|
* @param dept 机构ID |
|
|
|
* @param dept 机构ID |
|
|
@ -385,18 +380,34 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public SafeCheckStatisticVO getAccessTaskCheck(String startDate, String endDate, Long dept) { |
|
|
|
public SafeCheckStatisticVO getAccessTaskCheck(String startDate, String endDate, Long dept) { |
|
|
|
SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); |
|
|
|
SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); |
|
|
|
List<OperAccessTaskEntity> taskEntityList = this.list(Wrappers.<OperAccessTaskEntity>lambdaQuery() |
|
|
|
List<OperAccessTaskEntity> taskEntityList = this.list(Wrappers.<OperAccessTaskEntity>lambdaQuery().eq(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_4).ge(OperAccessTaskEntity::getCreateTime, startDate).le(OperAccessTaskEntity::getCreateTime, endDate).eq(OperAccessTaskEntity::getCreateDept, dept)); |
|
|
|
.eq(OperAccessTaskEntity::getStatus,AccessConstants.ACCESS_TASK_STATUS_4) |
|
|
|
|
|
|
|
.ge(OperAccessTaskEntity::getCreateTime,startDate) |
|
|
|
|
|
|
|
.le(OperAccessTaskEntity::getCreateTime,endDate) |
|
|
|
|
|
|
|
.eq(OperAccessTaskEntity::getCreateDept,dept) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
vo.setProjectType(Constants.SafeCheckProjectEnum.ACCESS_TASK.getType()); |
|
|
|
vo.setProjectType(Constants.SafeCheckProjectEnum.ACCESS_TASK.getType()); |
|
|
|
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.ACCESS_TASK.getName()); |
|
|
|
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.ACCESS_TASK.getName()); |
|
|
|
vo.setTotal(taskEntityList.size()); |
|
|
|
vo.setTotal(taskEntityList.size()); |
|
|
|
return vo; |
|
|
|
return vo; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据区域和月份分页查询检修任务 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param dbPage |
|
|
|
|
|
|
|
* @param result |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public IPage<OperAccessTaskEntity> selectPage(Page<OperAccessTaskEntity> dbPage, OperAccessTaskEntity result) { |
|
|
|
|
|
|
|
QueryWrapper<OperAccessTaskEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
//区域
|
|
|
|
|
|
|
|
queryWrapper.eq(StringUtils.isNotBlank(result.getAreaId()), "CREATE_DEPT", result.getAreaId()); |
|
|
|
|
|
|
|
//月份
|
|
|
|
|
|
|
|
queryWrapper.eq(result.getYearMonth() != null, "date_format(PLAN_START_TIME, '%Y-%m')", result.getYearMonth()); |
|
|
|
|
|
|
|
//任务名称
|
|
|
|
|
|
|
|
queryWrapper.eq(StringUtils.isNotBlank(result.getName()), "name", result.getName()); |
|
|
|
|
|
|
|
//状态
|
|
|
|
|
|
|
|
queryWrapper.eq(result.getStatus() != null, "STATUS", result.getStatus()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return baseMapper.selectPage(dbPage, queryWrapper); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* 根据流程ID和处理人完成任务 |
|
|
|
* 根据流程ID和处理人完成任务 |
|
|
|
* @param comleteTask |
|
|
|
* @param comleteTask |
|
|
@ -404,10 +415,10 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
* @param processInstanceId |
|
|
|
* @param processInstanceId |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void completeTask(ComleteTask comleteTask, Long handler, String processInstanceId, Long deptId) { |
|
|
|
private void completeTask(ComleteTask comleteTask, Long handler, String processInstanceId, Long deptId) { |
|
|
|
if(ObjectUtil.isNotEmpty(handler)){ |
|
|
|
if (ObjectUtil.isNotEmpty(handler)) { |
|
|
|
String taskUser = StringUtil.format("{}_{}",new String[]{"taskUser",String.valueOf(handler)}); |
|
|
|
String taskUser = StringUtil.format("{}_{}", new String[]{"taskUser", String.valueOf(handler)}); |
|
|
|
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId,taskUser); |
|
|
|
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, taskUser); |
|
|
|
if(!bladeFlowR.isSuccess() || ObjectUtil.isEmpty(bladeFlowR.getData())){ |
|
|
|
if (!bladeFlowR.isSuccess() || ObjectUtil.isEmpty(bladeFlowR.getData())) { |
|
|
|
throw new ServiceException("获取检修任务工作流任务失败"); |
|
|
|
throw new ServiceException("获取检修任务工作流任务失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
//若成功则封装CompleteTask 执行任务
|
|
|
|
//若成功则封装CompleteTask 执行任务
|
|
|
@ -416,40 +427,37 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
} |
|
|
|
} |
|
|
|
//获取检修任务审批人角色下的审批人列表
|
|
|
|
//获取检修任务审批人角色下的审批人列表
|
|
|
|
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), deptId, AccessConstants.TASK_REVIEWER); |
|
|
|
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), deptId, AccessConstants.TASK_REVIEWER); |
|
|
|
if(!userListR.isSuccess()){ |
|
|
|
if (!userListR.isSuccess()) { |
|
|
|
throw new ServiceException(userListR.getMsg()); |
|
|
|
throw new ServiceException(userListR.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(ObjectUtil.isNotEmpty(userListR.getData())) { |
|
|
|
if (ObjectUtil.isNotEmpty(userListR.getData())) { |
|
|
|
String reviewer = userListR.getData().stream().map(user->StringUtil.format("{}_{}","taskUser",String.valueOf(user.getId()))) |
|
|
|
String reviewer = userListR.getData().stream().map(user -> StringUtil.format("{}_{}", "taskUser", String.valueOf(user.getId()))).collect(Collectors.joining(",")); |
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
Map<String, Object> variables = new HashMap<>(1); |
|
|
|
Map<String,Object> variables = new HashMap<>(1); |
|
|
|
variables.put("reviewer", reviewer); |
|
|
|
variables.put("reviewer",reviewer); |
|
|
|
|
|
|
|
comleteTask.setVariables(variables); |
|
|
|
comleteTask.setVariables(variables); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
R result = flowClient.completeTask(comleteTask); |
|
|
|
R result = flowClient.completeTask(comleteTask); |
|
|
|
if(!result.isSuccess()){ |
|
|
|
if (!result.isSuccess()) { |
|
|
|
throw new ServiceException(result.getMsg()); |
|
|
|
throw new ServiceException(result.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据检修任务完成缺陷处理流程 |
|
|
|
* 根据检修任务完成缺陷处理流程 |
|
|
|
|
|
|
|
* |
|
|
|
* @param accessTaskEntity |
|
|
|
* @param accessTaskEntity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void finishDefectFlow(OperAccessTaskEntity accessTaskEntity) { |
|
|
|
private void finishDefectFlow(OperAccessTaskEntity accessTaskEntity) { |
|
|
|
if(Func.isNotEmpty(accessTaskEntity.getPhenomenonId())) { |
|
|
|
if (Func.isNotEmpty(accessTaskEntity.getPhenomenonId())) { |
|
|
|
OperPhenomenonEntity operPhenomenonEntity = operPhenomenonMapper.selectById(accessTaskEntity.getPhenomenonId()); |
|
|
|
OperPhenomenonEntity operPhenomenonEntity = operPhenomenonMapper.selectById(accessTaskEntity.getPhenomenonId()); |
|
|
|
operPhenomenonEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM); |
|
|
|
operPhenomenonEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM); |
|
|
|
//operPhenomenonEntity.setCheckHours(accessTaskEntity.getActHours());
|
|
|
|
//operPhenomenonEntity.setCheckHours(accessTaskEntity.getActHours());
|
|
|
|
operPhenomenonMapper.updateById(operPhenomenonEntity); |
|
|
|
operPhenomenonMapper.updateById(operPhenomenonEntity); |
|
|
|
String processInstanceId = operPhenomenonEntity.getCheckProcessInstanceId(); |
|
|
|
String processInstanceId = operPhenomenonEntity.getCheckProcessInstanceId(); |
|
|
|
//获取缺陷
|
|
|
|
//获取缺陷
|
|
|
|
OperDefectEntity operDefectEntity = defectService.getOne(Wrappers.<OperDefectEntity>lambdaQuery() |
|
|
|
OperDefectEntity operDefectEntity = defectService.getOne(Wrappers.<OperDefectEntity>lambdaQuery().eq(OperDefectEntity::getDefectCode, operPhenomenonEntity.getDefectCode()).last("limit 1;")); |
|
|
|
.eq(OperDefectEntity::getDefectCode, operPhenomenonEntity.getDefectCode()) |
|
|
|
if (ObjectUtil.isNotEmpty(operDefectEntity)) { |
|
|
|
.last("limit 1;") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(operDefectEntity)) { |
|
|
|
|
|
|
|
operDefectEntity.setActEndTime(new Date()); |
|
|
|
operDefectEntity.setActEndTime(new Date()); |
|
|
|
operDefectEntity.setActHours(ObjectUtil.isNotEmpty(accessTaskEntity.getActHours()) ? accessTaskEntity.getActHours().toString() : null); |
|
|
|
operDefectEntity.setActHours(ObjectUtil.isNotEmpty(accessTaskEntity.getActHours()) ? accessTaskEntity.getActHours().toString() : null); |
|
|
|
operDefectEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM); |
|
|
|
operDefectEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM); |
|
|
@ -460,21 +468,21 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
ComleteTask comleteTask = new ComleteTask(); |
|
|
|
ComleteTask comleteTask = new ComleteTask(); |
|
|
|
comleteTask.setProcessInstanceId(processInstanceId); |
|
|
|
comleteTask.setProcessInstanceId(processInstanceId); |
|
|
|
//获取当前环节taskId
|
|
|
|
//获取当前环节taskId
|
|
|
|
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, "taskUser_"+AuthUtil.getUserId()); |
|
|
|
R<BladeFlow> bladeFlowR = flowClient.getTaskByProcessInstanceIdAndUserId(processInstanceId, "taskUser_" + AuthUtil.getUserId()); |
|
|
|
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()),()->{ |
|
|
|
Assert.isTrue(bladeFlowR.isSuccess() && ObjectUtil.isNotEmpty(bladeFlowR.getData()), () -> { |
|
|
|
throw new ServiceException("当前操作人获取消缺任务失败"); |
|
|
|
throw new ServiceException("当前操作人获取消缺任务失败"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
comleteTask.setTaskId(bladeFlowR.getData().getTaskId()); |
|
|
|
comleteTask.setTaskId(bladeFlowR.getData().getTaskId()); |
|
|
|
comleteTask.setComment("审批通过工作流结束"); |
|
|
|
comleteTask.setComment("审批通过工作流结束"); |
|
|
|
comleteTask.setFlag("ok"); |
|
|
|
comleteTask.setFlag("ok"); |
|
|
|
comleteTask.setPass(true); |
|
|
|
comleteTask.setPass(true); |
|
|
|
Map<String,Object> variables = new HashMap<>(1); |
|
|
|
Map<String, Object> variables = new HashMap<>(1); |
|
|
|
R<List<User>> listR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), operDefectEntity.getCreateDept(), DefectConstant.PROCESS_VARIABLE_CONCLUSION); |
|
|
|
R<List<User>> listR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), operDefectEntity.getCreateDept(), DefectConstant.PROCESS_VARIABLE_CONCLUSION); |
|
|
|
Assert.isTrue(listR.isSuccess() && ObjectUtil.isNotEmpty(listR.getData()),()->{ |
|
|
|
Assert.isTrue(listR.isSuccess() && ObjectUtil.isNotEmpty(listR.getData()), () -> { |
|
|
|
throw new ServiceException("获取问题定论人失败"); |
|
|
|
throw new ServiceException("获取问题定论人失败"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
String conclusion = listR.getData().stream().map(user->"taskUser_"+user.getId()).collect(Collectors.joining(",")); |
|
|
|
String conclusion = listR.getData().stream().map(user -> "taskUser_" + user.getId()).collect(Collectors.joining(",")); |
|
|
|
variables.put("conclusion",conclusion); |
|
|
|
variables.put("conclusion", conclusion); |
|
|
|
comleteTask.setVariables(variables); |
|
|
|
comleteTask.setVariables(variables); |
|
|
|
flowClient.completeTask(comleteTask); |
|
|
|
flowClient.completeTask(comleteTask); |
|
|
|
} |
|
|
|
} |
|
|
@ -482,16 +490,17 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 巡检任务生成后待办消息提示 |
|
|
|
* 巡检任务生成后待办消息提示 |
|
|
|
|
|
|
|
* |
|
|
|
* @param req |
|
|
|
* @param req |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO,PushExtrasReq req){ |
|
|
|
private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO, PushExtrasReq req) { |
|
|
|
req.setTitle(AccessConstants.MESSAGE_TITLE); |
|
|
|
req.setTitle(AccessConstants.MESSAGE_TITLE); |
|
|
|
req.setType(AccessConstants.MESSAGE_ACCESS_TYPE); |
|
|
|
req.setType(AccessConstants.MESSAGE_ACCESS_TYPE); |
|
|
|
req.setBusinessClassify(OperationalConstants.MessageClassifyEnum.MESSAGE_REMINDSY.getVal()); |
|
|
|
req.setBusinessClassify(OperationalConstants.MessageClassifyEnum.MESSAGE_REMINDSY.getVal()); |
|
|
|
req.setPushAlert(AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg()); |
|
|
|
req.setPushAlert(AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg()); |
|
|
|
log.info("--------消息推送开始----------"); |
|
|
|
log.info("--------消息推送开始----------"); |
|
|
|
messagePushClient.sendMessage(operAccessTaskDTO.getHandler().toString(), req,operAccessTaskDTO.getTenantId(),operAccessTaskDTO.getCreateDept(),operAccessTaskDTO.getCreateUser()); |
|
|
|
messagePushClient.sendMessage(operAccessTaskDTO.getHandler().toString(), req, operAccessTaskDTO.getTenantId(), operAccessTaskDTO.getCreateDept(), operAccessTaskDTO.getCreateUser()); |
|
|
|
log.info("消息推送人为:{},推送消息为:{}",operAccessTaskDTO.getHandler().toString(),AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg()); |
|
|
|
log.info("消息推送人为:{},推送消息为:{}", operAccessTaskDTO.getHandler().toString(), AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg()); |
|
|
|
log.info("--------消息推送成功----------"); |
|
|
|
log.info("--------消息推送成功----------"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|