|
|
|
@ -4,14 +4,19 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
import com.hnac.hzims.operational.access.constants.AccessConstants; |
|
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; |
|
|
|
|
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; |
|
|
|
|
import com.hnac.hzims.operational.maintenance.feign.ITaskClient; |
|
|
|
|
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; |
|
|
|
|
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; |
|
|
|
|
import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo; |
|
|
|
|
import com.hnac.hzims.ticket.aspect.AroundFlow; |
|
|
|
|
import com.hnac.hzims.ticket.constants.TicketConstants; |
|
|
|
|
import com.hnac.hzims.ticket.utils.ExcelUtil; |
|
|
|
@ -29,10 +34,12 @@ import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketInfoWrapper;
|
|
|
|
|
import com.hnac.hzims.vo.SafeCheckStatisticVO; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import lombok.var; |
|
|
|
|
import org.apache.commons.collections.map.HashedMap; |
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.mp.support.BladePage; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
@ -43,6 +50,7 @@ import org.springblade.flow.core.feign.IFlowClient;
|
|
|
|
|
import org.springblade.flow.core.vo.ComleteTask; |
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
@ -86,10 +94,10 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
private final IOperAccessTaskClient operAccessTaskClient; |
|
|
|
|
private final ITaskClient taskClient; |
|
|
|
|
|
|
|
|
|
/**生成两票编号锁**/ |
|
|
|
|
/** 生成两票编号锁 **/ |
|
|
|
|
private Lock lock = new ReentrantLock(); |
|
|
|
|
|
|
|
|
|
/**word模板预览导出保存路径**/ |
|
|
|
|
/** word模板预览导出保存路径 **/ |
|
|
|
|
@Value("${hzims.ticket.path.xlsx.savePath}") |
|
|
|
|
private String xlsSavePath; |
|
|
|
|
|
|
|
|
@ -110,22 +118,22 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
req.setStatus(Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers()) ? TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus() : TicketConstants.FirstWorkTicketFlowStatusEnum.SIGN.getStatus()); |
|
|
|
|
boolean flag = this.save(req); |
|
|
|
|
/**保存安全措施**/ |
|
|
|
|
if(flag && CollectionUtil.isNotEmpty(req.getWorkTicketSafetyMeasureDtoList())){ |
|
|
|
|
if (flag && CollectionUtil.isNotEmpty(req.getWorkTicketSafetyMeasureDtoList())) { |
|
|
|
|
req.getWorkTicketSafetyMeasureDtoList().forEach(workTicketSafetyMeasureDto -> { |
|
|
|
|
workTicketSafetyMeasureDto.setTicketId(req.getId()); |
|
|
|
|
workTicketSafetyMeasureService.save(workTicketSafetyMeasureDto); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
if(Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers())){ |
|
|
|
|
if (Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers())) { |
|
|
|
|
//将票据ID会传至计划/任务内
|
|
|
|
|
returnTicket(req); |
|
|
|
|
return R.success("开票成功!该票走线下未开启流程"); |
|
|
|
|
} |
|
|
|
|
/**开启工作流**/ |
|
|
|
|
BladeFlow bladeFlow = this.startProcessInstance(firstWorkTicketFlowKey,req); |
|
|
|
|
BladeFlow bladeFlow = this.startProcessInstance(firstWorkTicketFlowKey, req); |
|
|
|
|
this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() |
|
|
|
|
.set(WorkTicketInfoEntity::getProcessInstanceId,bladeFlow.getProcessInstanceId()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId,req.getId())); |
|
|
|
|
.set(WorkTicketInfoEntity::getProcessInstanceId, bladeFlow.getProcessInstanceId()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId, req.getId())); |
|
|
|
|
//将票据ID会传至计划/任务内
|
|
|
|
|
returnTicket(req); |
|
|
|
|
return R.success("保存成功"); |
|
|
|
@ -133,32 +141,33 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 工作票延期 进入许可人确认工作票延期 |
|
|
|
|
* |
|
|
|
|
* @param ticketId 工作票ID |
|
|
|
|
* @param status 状态 |
|
|
|
|
* @param completeTask 工作流进行 |
|
|
|
|
*/ |
|
|
|
|
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED) |
|
|
|
|
public void delay(Long ticketId, Integer status,ComleteTask completeTask) { |
|
|
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
|
|
|
|
public void delay(Long ticketId, Integer status, ComleteTask completeTask) { |
|
|
|
|
//新增延期信息
|
|
|
|
|
Assert.notNull(completeTask.getVariables().get("delay"),"延期信息不能为空"); |
|
|
|
|
Assert.notNull(completeTask.getVariables().get("delay"), "延期信息不能为空"); |
|
|
|
|
WorkTicketDelayEntity delayEntity = (WorkTicketDelayEntity) completeTask.getVariables().get("delay"); |
|
|
|
|
delayService.save(delayEntity); |
|
|
|
|
//更新负责人确认执行情况流程 填充信息
|
|
|
|
|
WorkTicketFlowEntity workTicketFlowEntity = workTicketFlowService.getOne(Wrappers.<WorkTicketFlowEntity>lambdaQuery() |
|
|
|
|
.eq(WorkTicketFlowEntity::getTicketId,ticketId) |
|
|
|
|
.eq(WorkTicketFlowEntity::getFlowCode,TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_WORK_FINISH.getStatus()) |
|
|
|
|
.eq(WorkTicketFlowEntity::getTicketId, ticketId) |
|
|
|
|
.eq(WorkTicketFlowEntity::getFlowCode, TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_WORK_FINISH.getStatus()) |
|
|
|
|
.orderByDesc(WorkTicketFlowEntity::getCreateTime) |
|
|
|
|
.last("limit 1;") |
|
|
|
|
); |
|
|
|
|
workTicketFlowService.update(Wrappers.<WorkTicketFlowEntity>lambdaUpdate() |
|
|
|
|
.set(WorkTicketFlowEntity::getExecutor,AuthUtil.getUserId().toString()) |
|
|
|
|
.set(WorkTicketFlowEntity::getExecuteTime,LocalDateTime.now()) |
|
|
|
|
.eq(WorkTicketFlowEntity::getId,workTicketFlowEntity.getId()) |
|
|
|
|
.set(WorkTicketFlowEntity::getExecutor, AuthUtil.getUserId().toString()) |
|
|
|
|
.set(WorkTicketFlowEntity::getExecuteTime, LocalDateTime.now()) |
|
|
|
|
.eq(WorkTicketFlowEntity::getId, workTicketFlowEntity.getId()) |
|
|
|
|
); |
|
|
|
|
//更新工作票状态
|
|
|
|
|
this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus,status) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId,ticketId) |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus, status) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId, ticketId) |
|
|
|
|
); |
|
|
|
|
//创建延期流程
|
|
|
|
|
WorkTicketInfoEntity infoEntity = this.getById(ticketId); |
|
|
|
@ -170,7 +179,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
workTicketFlowService.save(workTicketFlowEntity); |
|
|
|
|
//进入工作流下一步
|
|
|
|
|
R result = flowClient.completeTask(completeTask); |
|
|
|
|
if(!result.isSuccess()){ |
|
|
|
|
if (!result.isSuccess()) { |
|
|
|
|
throw new ServiceException("执行工作流失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -178,10 +187,9 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
@Override |
|
|
|
|
public R<WorkTicketInfoVO> detail(Long id) { |
|
|
|
|
WorkTicketInfoEntity workTicketInfoEntity = this.getById(id); |
|
|
|
|
if(ObjectUtil.isEmpty(workTicketInfoEntity)){ |
|
|
|
|
if (ObjectUtil.isEmpty(workTicketInfoEntity)) { |
|
|
|
|
return R.fail("未查询到该ID对应的记录"); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
} else { |
|
|
|
|
WorkTicketInfoVO workTicketInfoVO = WorkTicketInfoWrapper.build().entityVO(workTicketInfoEntity); |
|
|
|
|
|
|
|
|
|
/**获取工作票安全措施列表**/ |
|
|
|
@ -217,11 +225,11 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
/**获取工作票延期列表**/ |
|
|
|
|
WorkTicketDelayDto workTicketDelayDto = new WorkTicketDelayDto(); |
|
|
|
|
workTicketDelayDto.setTicketId(id); |
|
|
|
|
List<WorkTicketDelayEntity> workTicketDelayList = workDelayNoScopeMapper.selectList(new LambdaQueryWrapper<WorkTicketDelayEntity>(){{ |
|
|
|
|
eq(WorkTicketDelayEntity::getTicketId,id); |
|
|
|
|
eq(WorkTicketDelayEntity::getIsDeleted,0L); |
|
|
|
|
List<WorkTicketDelayEntity> workTicketDelayList = workDelayNoScopeMapper.selectList(new LambdaQueryWrapper<WorkTicketDelayEntity>() {{ |
|
|
|
|
eq(WorkTicketDelayEntity::getTicketId, id); |
|
|
|
|
eq(WorkTicketDelayEntity::getIsDeleted, 0L); |
|
|
|
|
}}); |
|
|
|
|
if(CollectionUtil.isNotEmpty(workTicketDelayList)){ |
|
|
|
|
if (CollectionUtil.isNotEmpty(workTicketDelayList)) { |
|
|
|
|
workTicketInfoVO.setWorkTicketDelayVOList(WorkTicketDelayWrapper.build().listVO(workTicketDelayList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -233,7 +241,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
public R<IPage<WorkTicketInfoVO>> queryList(WorkTicketInfoDto req, Query query) { |
|
|
|
|
LambdaQueryWrapper<WorkTicketInfoEntity> lqw = this.getQueryWrapper(req); |
|
|
|
|
lqw.orderByDesc(WorkTicketInfoEntity::getCreateTime).orderByDesc(WorkTicketInfoEntity::getUpdateTime); |
|
|
|
|
IPage pages = super.page(Condition.getPage(query),lqw); |
|
|
|
|
IPage pages = super.page(Condition.getPage(query), lqw); |
|
|
|
|
pages.setRecords(WorkTicketInfoWrapper.build().listVO(pages.getRecords())); |
|
|
|
|
return R.data(pages); |
|
|
|
|
} |
|
|
|
@ -247,89 +255,85 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public R remove(Long id,String comment) { |
|
|
|
|
public R remove(Long id, String comment) { |
|
|
|
|
WorkTicketInfoEntity entity = this.getById(id); |
|
|
|
|
if(ObjectUtil.isEmpty(entity)){ |
|
|
|
|
return R.fail(400,"删除失败!未查询到相关记录"); |
|
|
|
|
if (ObjectUtil.isEmpty(entity)) { |
|
|
|
|
return R.fail(400, "删除失败!未查询到相关记录"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boolean flag = this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus,TicketConstants.FirstWorkTicketFlowStatusEnum.TERMINATION.getStatus()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId,id)); |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.TERMINATION.getStatus()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId, id)); |
|
|
|
|
|
|
|
|
|
/**线下单独删除**/ |
|
|
|
|
if(TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(entity.getStatus())){ |
|
|
|
|
if (TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(entity.getStatus())) { |
|
|
|
|
return R.status(flag); |
|
|
|
|
} |
|
|
|
|
/**终止工作流**/ |
|
|
|
|
R<Boolean> r = flowClient.delProcessInstanceById(entity.getProcessInstanceId(),comment); |
|
|
|
|
if(!r.isSuccess()){ |
|
|
|
|
R<Boolean> r = flowClient.delProcessInstanceById(entity.getProcessInstanceId(), comment); |
|
|
|
|
if (!r.isSuccess()) { |
|
|
|
|
throw new ServiceException("终止工作流失败!"); |
|
|
|
|
} |
|
|
|
|
return R.success("删除成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void exportWorkTicketTemplate(Long id, HttpServletResponse response){ |
|
|
|
|
exportWorkTicketInfoPdf(id,response); |
|
|
|
|
public void exportWorkTicketTemplate(Long id, HttpServletResponse response) { |
|
|
|
|
exportWorkTicketInfoPdf(id, response); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
public void exportWorkTicketInfoPdf(Long id, HttpServletResponse response) { |
|
|
|
|
R<WorkTicketInfoVO> workTicketInfoVOR = this.detail(id); |
|
|
|
|
if(!workTicketInfoVOR.isSuccess()){ |
|
|
|
|
if (!workTicketInfoVOR.isSuccess()) { |
|
|
|
|
log.error("未查询到相关工作票记录!"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
WorkTicketInfoVO workTicketInfoVO = workTicketInfoVOR.getData(); |
|
|
|
|
//将workTicketInfoVO封装进Map,以便pdf导出
|
|
|
|
|
Map<String,Object> workTicketInfoMap = new HashMap<>(); |
|
|
|
|
Map<String, Object> workTicketInfoMap = new HashMap<>(); |
|
|
|
|
try { |
|
|
|
|
workTicketInfoMap = PdfUtils.objectToMap(workTicketInfoVO); |
|
|
|
|
} |
|
|
|
|
catch (Exception e) { |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.info("转换对象失败!"); |
|
|
|
|
} |
|
|
|
|
//安全措施
|
|
|
|
|
if(CollectionUtil.isNotEmpty(workTicketInfoVO.getWorkTicketSafetyMeasureVOList())){ |
|
|
|
|
Map<String,List<WorkTicketSafetyMeasureVO>> measureMap = workTicketInfoVO.getWorkTicketSafetyMeasureVOList().stream() |
|
|
|
|
if (CollectionUtil.isNotEmpty(workTicketInfoVO.getWorkTicketSafetyMeasureVOList())) { |
|
|
|
|
Map<String, List<WorkTicketSafetyMeasureVO>> measureMap = workTicketInfoVO.getWorkTicketSafetyMeasureVOList().stream() |
|
|
|
|
.collect(Collectors.groupingBy(WorkTicketSafetyMeasureVO::getType)); |
|
|
|
|
if(ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_ONE))){ |
|
|
|
|
workTicketInfoMap.put("matterLibraryListOne",measureMap.get(TicketConstants.MEASURE_TYPE_ONE).stream().map(measure-> { |
|
|
|
|
Map<String,Object> map = PdfUtils.objectToMap(measure); |
|
|
|
|
map.put("safetyMeasure",ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); |
|
|
|
|
if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_ONE))) { |
|
|
|
|
workTicketInfoMap.put("matterLibraryListOne", measureMap.get(TicketConstants.MEASURE_TYPE_ONE).stream().map(measure -> { |
|
|
|
|
Map<String, Object> map = PdfUtils.objectToMap(measure); |
|
|
|
|
map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); |
|
|
|
|
String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; |
|
|
|
|
map.put("status",status); |
|
|
|
|
map.put("status", status); |
|
|
|
|
return map; |
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("matterLibraryListOne", new ArrayList<Map<String, String>>(1)); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
workTicketInfoMap.put("matterLibraryListOne", new ArrayList<Map<String,String>>(1)); |
|
|
|
|
} |
|
|
|
|
if(ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_TWO))){ |
|
|
|
|
workTicketInfoMap.put("matterLibraryListTwo",measureMap.get(TicketConstants.MEASURE_TYPE_TWO).stream().map(measure-> { |
|
|
|
|
Map<String,Object> map = PdfUtils.objectToMap(measure); |
|
|
|
|
map.put("safetyMeasure",ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); |
|
|
|
|
if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_TWO))) { |
|
|
|
|
workTicketInfoMap.put("matterLibraryListTwo", measureMap.get(TicketConstants.MEASURE_TYPE_TWO).stream().map(measure -> { |
|
|
|
|
Map<String, Object> map = PdfUtils.objectToMap(measure); |
|
|
|
|
map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); |
|
|
|
|
String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; |
|
|
|
|
map.put("status",status); |
|
|
|
|
map.put("status", status); |
|
|
|
|
return map; |
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("matterLibraryListTwo", new ArrayList<Map<String, String>>(1)); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
workTicketInfoMap.put("matterLibraryListTwo", new ArrayList<Map<String,String>>(1)); |
|
|
|
|
} |
|
|
|
|
if(ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_THREE))){ |
|
|
|
|
workTicketInfoMap.put("matterLibraryListThree",measureMap.get(TicketConstants.MEASURE_TYPE_THREE).stream().map(measure-> { |
|
|
|
|
Map<String,Object> map = PdfUtils.objectToMap(measure); |
|
|
|
|
map.put("safetyMeasure",ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); |
|
|
|
|
if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_THREE))) { |
|
|
|
|
workTicketInfoMap.put("matterLibraryListThree", measureMap.get(TicketConstants.MEASURE_TYPE_THREE).stream().map(measure -> { |
|
|
|
|
Map<String, Object> map = PdfUtils.objectToMap(measure); |
|
|
|
|
map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); |
|
|
|
|
String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; |
|
|
|
|
map.put("status",status); |
|
|
|
|
map.put("status", status); |
|
|
|
|
return map; |
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
workTicketInfoMap.put("matterLibraryListThree", new ArrayList<Map<String,String>>(1)); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("matterLibraryListThree", new ArrayList<Map<String, String>>(1)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//线下开票确认人为空
|
|
|
|
@ -338,73 +342,67 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
List<WorkTicketFlowVO> workTicketFlowVOList = workTicketInfoVO.getWorkTicketFlowVOList(); |
|
|
|
|
//签发
|
|
|
|
|
List<WorkTicketFlowVO> signFlow = workTicketFlowVOList.stream() |
|
|
|
|
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isNotEmpty(signFlow)){ |
|
|
|
|
workTicketInfoMap.put("signer",signFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("signTime", DateUtil.format(signFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
.filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(signFlow)) { |
|
|
|
|
workTicketInfoMap.put("signer", signFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("signTime", DateUtil.format(signFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("signer", ""); |
|
|
|
|
workTicketInfoMap.put("signTime", ""); |
|
|
|
|
} |
|
|
|
|
//许可人许可
|
|
|
|
|
if(Func.isNotEmpty(workTicketInfoVO.getLicenseTime())){ |
|
|
|
|
workTicketInfoMap.put("licensorConfirm",workTicketInfoVO.getLicensorName()); |
|
|
|
|
workTicketInfoMap.put("licenseTime", DateUtil.format(workTicketInfoVO.getLicenseTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
if (Func.isNotEmpty(workTicketInfoVO.getLicenseTime())) { |
|
|
|
|
workTicketInfoMap.put("licensorConfirm", workTicketInfoVO.getLicensorName()); |
|
|
|
|
workTicketInfoMap.put("licenseTime", DateUtil.format(workTicketInfoVO.getLicenseTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("licensorConfirm", ""); |
|
|
|
|
workTicketInfoMap.put("licenseTime", ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**负责人收到工作票**/ |
|
|
|
|
List<WorkTicketFlowVO> receiveFlow = workTicketFlowVOList.stream() |
|
|
|
|
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isNotEmpty(receiveFlow)){ |
|
|
|
|
workTicketInfoMap.put("receivePrincipal",receiveFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("receiveTime", DateUtil.format(receiveFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("principalConfirm",workTicketInfoVO.getPrincipalName()); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
workTicketInfoMap.put("receivePrincipal",""); |
|
|
|
|
.filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(receiveFlow)) { |
|
|
|
|
workTicketInfoMap.put("receivePrincipal", receiveFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("receiveTime", DateUtil.format(receiveFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("principalConfirm", workTicketInfoVO.getPrincipalName()); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("receivePrincipal", ""); |
|
|
|
|
workTicketInfoMap.put("receiveTime", ""); |
|
|
|
|
workTicketInfoMap.put("principalConfirm",""); |
|
|
|
|
workTicketInfoMap.put("principalConfirm", ""); |
|
|
|
|
} |
|
|
|
|
/**负责人确认安全事项**/ |
|
|
|
|
List<WorkTicketFlowVO> confirmFlow = workTicketFlowVOList.stream() |
|
|
|
|
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_MEMBERS.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isNotEmpty(confirmFlow)){ |
|
|
|
|
workTicketInfoMap.put("confirmPrincipal",confirmFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("confirmTime", DateUtil.format(confirmFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
workTicketInfoMap.put("confirmPrincipal",""); |
|
|
|
|
.filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_MEMBERS.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(confirmFlow)) { |
|
|
|
|
workTicketInfoMap.put("confirmPrincipal", confirmFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("confirmTime", DateUtil.format(confirmFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("confirmPrincipal", ""); |
|
|
|
|
workTicketInfoMap.put("confirmTime", ""); |
|
|
|
|
} |
|
|
|
|
/**工作结束**/ |
|
|
|
|
List<WorkTicketFlowVO> finishFlow = workTicketFlowVOList.stream() |
|
|
|
|
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.END.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isNotEmpty(finishFlow)){ |
|
|
|
|
workTicketInfoMap.put("finisher",finishFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("finishTime", DateUtil.format(finishFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("principalFinish",workTicketInfoVO.getPrincipalName()); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
workTicketInfoMap.put("finisher",""); |
|
|
|
|
.filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.END.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(finishFlow)) { |
|
|
|
|
workTicketInfoMap.put("finisher", finishFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("finishTime", DateUtil.format(finishFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("principalFinish", workTicketInfoVO.getPrincipalName()); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("finisher", ""); |
|
|
|
|
workTicketInfoMap.put("finishTime", ""); |
|
|
|
|
workTicketInfoMap.put("principalFinish",""); |
|
|
|
|
workTicketInfoMap.put("principalFinish", ""); |
|
|
|
|
} |
|
|
|
|
/**工作终结**/ |
|
|
|
|
List<WorkTicketFlowVO> endFlow = workTicketFlowVOList.stream() |
|
|
|
|
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().intValue() == Integer.parseInt(f.getFlowCode())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isNotEmpty(endFlow)){ |
|
|
|
|
workTicketInfoMap.put("endLicensor",endFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("endTime", DateUtil.format(endFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("groundSwitchCount",ObjectUtil.isNotEmpty(endFlow.get(0).getGroundSwitchCount()) ? endFlow.get(0).getGroundSwitchCount() : ""); |
|
|
|
|
workTicketInfoMap.put("groundWireCode",ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCode()) ? endFlow.get(0).getGroundWireCode() : ""); |
|
|
|
|
workTicketInfoMap.put("groundWireCount",ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCount()) ? endFlow.get(0).getGroundWireCount() : ""); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
.filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().intValue() == Integer.parseInt(f.getFlowCode())).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(endFlow)) { |
|
|
|
|
workTicketInfoMap.put("endLicensor", endFlow.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("endTime", DateUtil.format(endFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("groundSwitchCount", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundSwitchCount()) ? endFlow.get(0).getGroundSwitchCount() : ""); |
|
|
|
|
workTicketInfoMap.put("groundWireCode", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCode()) ? endFlow.get(0).getGroundWireCode() : ""); |
|
|
|
|
workTicketInfoMap.put("groundWireCount", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCount()) ? endFlow.get(0).getGroundWireCount() : ""); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("endLicensor", ""); |
|
|
|
|
workTicketInfoMap.put("endTime", ""); |
|
|
|
|
workTicketInfoMap.put("groundSwitchCount", ""); |
|
|
|
@ -413,13 +411,12 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
} |
|
|
|
|
/**负责人变更**/ |
|
|
|
|
List<WorkTicketPrincipalChangeVO> workTicketPrincipalChangeVOList = workTicketInfoVO.getWorkTicketPrincipalChangeVOList(); |
|
|
|
|
if(CollectionUtil.isNotEmpty(workTicketPrincipalChangeVOList)){ |
|
|
|
|
workTicketInfoMap.put("initPrincipal",workTicketPrincipalChangeVOList.get(0).getInitialPrincipalName()); |
|
|
|
|
workTicketInfoMap.put("changePrincipal",workTicketPrincipalChangeVOList.get(0).getChangePrincipalName()); |
|
|
|
|
workTicketInfoMap.put("principalChangeSigner",workTicketPrincipalChangeVOList.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("principalChangeTime", DateUtil.format(workTicketPrincipalChangeVOList.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
if (CollectionUtil.isNotEmpty(workTicketPrincipalChangeVOList)) { |
|
|
|
|
workTicketInfoMap.put("initPrincipal", workTicketPrincipalChangeVOList.get(0).getInitialPrincipalName()); |
|
|
|
|
workTicketInfoMap.put("changePrincipal", workTicketPrincipalChangeVOList.get(0).getChangePrincipalName()); |
|
|
|
|
workTicketInfoMap.put("principalChangeSigner", workTicketPrincipalChangeVOList.get(0).getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("principalChangeTime", DateUtil.format(workTicketPrincipalChangeVOList.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("initPrincipal", ""); |
|
|
|
|
workTicketInfoMap.put("changePrincipal", ""); |
|
|
|
|
workTicketInfoMap.put("principalChangeSigner", ""); |
|
|
|
@ -427,28 +424,26 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
} |
|
|
|
|
/**工作成员变更**/ |
|
|
|
|
List<WorkTicketMembersChangeVO> membersChangeList = workTicketInfoVO.getWorkTicketMembersChangeVOList(); |
|
|
|
|
if(CollectionUtil.isNotEmpty(membersChangeList)){ |
|
|
|
|
if (CollectionUtil.isNotEmpty(membersChangeList)) { |
|
|
|
|
/**工作成员变更详情**/ |
|
|
|
|
String membersChangeSituation = membersChangeList.stream().map(mc -> |
|
|
|
|
DateUtil.format(mc.getCreateTime(),TicketConstants.TICKET_DATE_PATTERN).concat(":").concat(mc.getChangeMembersName())).collect(Collectors.joining(";")); |
|
|
|
|
workTicketInfoMap.put("membersChangeSituation",membersChangeSituation); |
|
|
|
|
workTicketInfoMap.put("memberChangePrincipal",membersChangeList.get(0).getCreateUserName()); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
DateUtil.format(mc.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN).concat(":").concat(mc.getChangeMembersName())).collect(Collectors.joining(";")); |
|
|
|
|
workTicketInfoMap.put("membersChangeSituation", membersChangeSituation); |
|
|
|
|
workTicketInfoMap.put("memberChangePrincipal", membersChangeList.get(0).getCreateUserName()); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("membersChangeSituation", ""); |
|
|
|
|
workTicketInfoMap.put("memberChangePrincipal", ""); |
|
|
|
|
} |
|
|
|
|
/**工作票延期**/ |
|
|
|
|
List<WorkTicketDelayVO> workTicketDelayVOList = workTicketInfoVO.getWorkTicketDelayVOList(); |
|
|
|
|
if(CollectionUtil.isNotEmpty(workTicketDelayVOList)){ |
|
|
|
|
if (CollectionUtil.isNotEmpty(workTicketDelayVOList)) { |
|
|
|
|
WorkTicketDelayVO workTicketDelayVO = workTicketDelayVOList.get(0); |
|
|
|
|
workTicketInfoMap.put("delayTime",DateUtil.format(workTicketDelayVO.getChangeTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("delayPrincipal",workTicketDelayVO.getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("delayPrincipalTime",DateUtil.format(workTicketDelayVO.getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("delayLicensor",workTicketDelayVO.getLicensorName()); |
|
|
|
|
workTicketInfoMap.put("delayLicenseTime",DateUtil.format(workTicketDelayVO.getLicenseTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
workTicketInfoMap.put("delayTime", DateUtil.format(workTicketDelayVO.getChangeTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("delayPrincipal", workTicketDelayVO.getCreateUserName()); |
|
|
|
|
workTicketInfoMap.put("delayPrincipalTime", DateUtil.format(workTicketDelayVO.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
workTicketInfoMap.put("delayLicensor", workTicketDelayVO.getLicensorName()); |
|
|
|
|
workTicketInfoMap.put("delayLicenseTime", DateUtil.format(workTicketDelayVO.getLicenseTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
} else { |
|
|
|
|
workTicketInfoMap.put("delayTime", ""); |
|
|
|
|
workTicketInfoMap.put("delayPrincipal", ""); |
|
|
|
|
workTicketInfoMap.put("delayPrincipalTime", ""); |
|
|
|
@ -458,53 +453,52 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
|
|
|
|
|
/**跨日工作时间**/ |
|
|
|
|
List<WorkTicketOperateTimeVO> operateList = workTicketInfoVO.getWorkTicketOperateTimeVOList(); |
|
|
|
|
if(CollectionUtil.isNotEmpty(operateList)){ |
|
|
|
|
List<Map<String,String>> operateMapList = operateList.stream().map(operate->{ |
|
|
|
|
Map<String,String> map = new HashMap<>(4); |
|
|
|
|
map.put("startTime",DateUtil.format(operate.getStartTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
map.put("endTime",DateUtil.format(operate.getEndTime(),TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
map.put("principal",operate.getPrincipalName()); |
|
|
|
|
map.put("licensor",operate.getLicensorName()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(operateList)) { |
|
|
|
|
List<Map<String, String>> operateMapList = operateList.stream().map(operate -> { |
|
|
|
|
Map<String, String> map = new HashMap<>(4); |
|
|
|
|
map.put("startTime", DateUtil.format(operate.getStartTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
map.put("endTime", DateUtil.format(operate.getEndTime(), TicketConstants.TICKET_DATE_PATTERN)); |
|
|
|
|
map.put("principal", operate.getPrincipalName()); |
|
|
|
|
map.put("licensor", operate.getLicensorName()); |
|
|
|
|
return map; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
workTicketInfoMap.put("operateMapList",operateMapList); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
List<Map<String,String>> operateMapList = new ArrayList<>(); |
|
|
|
|
Map<String,String> map = new HashMap<>(4); |
|
|
|
|
map.put("startTime",""); |
|
|
|
|
map.put("endTime",""); |
|
|
|
|
map.put("principal",""); |
|
|
|
|
map.put("licensor",""); |
|
|
|
|
workTicketInfoMap.put("operateMapList", operateMapList); |
|
|
|
|
} else { |
|
|
|
|
List<Map<String, String>> operateMapList = new ArrayList<>(); |
|
|
|
|
Map<String, String> map = new HashMap<>(4); |
|
|
|
|
map.put("startTime", ""); |
|
|
|
|
map.put("endTime", ""); |
|
|
|
|
map.put("principal", ""); |
|
|
|
|
map.put("licensor", ""); |
|
|
|
|
operateMapList.add(map); |
|
|
|
|
workTicketInfoMap.put("operateMapList", operateMapList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**运行值班人员暂为空**/ |
|
|
|
|
workTicketInfoMap.put("dutyPersonName","/"); |
|
|
|
|
workTicketInfoMap.put("dutyPersonName", "/"); |
|
|
|
|
|
|
|
|
|
String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(workTicketInfoVO.getType()) + PdfUtils.XLSX_SUFFIX; |
|
|
|
|
log.info("工作票模板为:{}",fileName); |
|
|
|
|
log.info("工作票模板为:{}", fileName); |
|
|
|
|
TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true); |
|
|
|
|
Workbook workbook = null; |
|
|
|
|
try { |
|
|
|
|
workbook = ExcelUtil.getWorkbook(templateExportParams,workTicketInfoMap); |
|
|
|
|
workbook = ExcelUtil.getWorkbook(templateExportParams, workTicketInfoMap); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
//上传xlsx至服务器
|
|
|
|
|
try { |
|
|
|
|
ExcelUtil.upload(workbook,xlsSavePath,workTicketInfoVO.getWorkContent()+PdfUtils.XLSX_SUFFIX); |
|
|
|
|
ExcelUtil.upload(workbook, xlsSavePath, workTicketInfoVO.getWorkContent() + PdfUtils.XLSX_SUFFIX); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
//将xlsx文件转换为pdf并保存
|
|
|
|
|
String pdfFileName = workTicketInfoVO.getWorkContent() + PdfUtils.PDF_SUFFIX; |
|
|
|
|
String xlsFileName = workTicketInfoVO.getWorkContent()+PdfUtils.XLSX_SUFFIX; |
|
|
|
|
String xlsFileName = workTicketInfoVO.getWorkContent() + PdfUtils.XLSX_SUFFIX; |
|
|
|
|
PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName); |
|
|
|
|
String savePath = pdfSavePath + pdfFileName; |
|
|
|
|
// 设置response参数,可以打开下载页面
|
|
|
|
|
PdfUtils.readPdf(response,savePath); |
|
|
|
|
PdfUtils.readPdf(response, savePath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -519,36 +513,34 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
task.setVariables(flow.getVariables()); |
|
|
|
|
|
|
|
|
|
//待许可时获取许可人角色下用户开启工作流
|
|
|
|
|
if(TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())){ |
|
|
|
|
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(),req.getCreateDept(),TicketConstants.LICENSOR_ROLE); |
|
|
|
|
if(!userListR.isSuccess()){ |
|
|
|
|
if (TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())) { |
|
|
|
|
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), req.getCreateDept(), TicketConstants.LICENSOR_ROLE); |
|
|
|
|
if (!userListR.isSuccess()) { |
|
|
|
|
throw new ServiceException(userListR.getMsg()); |
|
|
|
|
} |
|
|
|
|
Map<String, Object> variables = CollectionUtil.isEmpty(flow.getVariables()) ? new HashMap<>() : flow.getVariables(); |
|
|
|
|
String taskUser = userListR.getData().stream().map(u->"taskUser_".concat(u.getId().toString())).collect(Collectors.joining(",")); |
|
|
|
|
variables.put("licenseUserIds",taskUser); |
|
|
|
|
String taskUser = userListR.getData().stream().map(u -> "taskUser_".concat(u.getId().toString())).collect(Collectors.joining(",")); |
|
|
|
|
variables.put("licenseUserIds", taskUser); |
|
|
|
|
task.setVariables(variables); |
|
|
|
|
} |
|
|
|
|
log.info("工作流对象为:{}",JSONObject.toJSONString(flow)); |
|
|
|
|
log.info("工作流对象为:{}", JSONObject.toJSONString(flow)); |
|
|
|
|
|
|
|
|
|
if(TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())){ |
|
|
|
|
if (TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())) { |
|
|
|
|
req.setSigner(AuthUtil.getUserId()); |
|
|
|
|
} |
|
|
|
|
else if(TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())){ |
|
|
|
|
} else if (TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())) { |
|
|
|
|
req.setLicensor(AuthUtil.getUserId()); |
|
|
|
|
} |
|
|
|
|
else if(TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(req.getStatus())){ |
|
|
|
|
} else if (TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(req.getStatus())) { |
|
|
|
|
this.invalidTicket(req); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//更新状态
|
|
|
|
|
boolean flag = this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus,req.getStatus()) |
|
|
|
|
.set(WorkTicketInfoEntity::getPrincipal,req.getPrincipal()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicensor,req.getLicensor()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicenseTime,req.getLicenseTime()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicenseEndTime,req.getLicenseEndTime()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId,req.getId())); |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus, req.getStatus()) |
|
|
|
|
.set(WorkTicketInfoEntity::getPrincipal, req.getPrincipal()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicensor, req.getLicensor()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicenseTime, req.getLicenseTime()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId, req.getId())); |
|
|
|
|
|
|
|
|
|
//新增流程信息
|
|
|
|
|
WorkTicketFlowEntity workTicketFlowEntity = new WorkTicketFlowEntity(); |
|
|
|
@ -556,10 +548,10 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
workTicketFlowEntity.setFlowCode(req.getStatus().toString()); |
|
|
|
|
workTicketFlowEntity.setExecutor(AuthUtil.getUserId().toString()); |
|
|
|
|
workTicketFlowEntity.setExecuteTime(LocalDateTime.now()); |
|
|
|
|
workTicketFlowEntity.setRemark(Optional.ofNullable(flow.getVariables()).map(v->v.get("remark")).map(s->s.toString()).orElse("")); |
|
|
|
|
workTicketFlowEntity.setSignImgPath(Optional.ofNullable(flow.getVariables()).map(v->v.get("signImgPath")).map(s->s.toString()).orElse("")); |
|
|
|
|
workTicketFlowEntity.setGroundWireCount(Optional.ofNullable(flow.getVariables()).map(v->v.get("groundWireCount")).map(s->Integer.parseInt(s.toString())).orElse(null)); |
|
|
|
|
workTicketFlowEntity.setGroundSwitchCount(Optional.ofNullable(flow.getVariables()).map(v->v.get("groundSwitchCount")).map(s->Integer.parseInt(s.toString())).orElse(null)); |
|
|
|
|
workTicketFlowEntity.setRemark(Optional.ofNullable(flow.getVariables()).map(v -> v.get("remark")).map(s -> s.toString()).orElse("")); |
|
|
|
|
workTicketFlowEntity.setSignImgPath(Optional.ofNullable(flow.getVariables()).map(v -> v.get("signImgPath")).map(s -> s.toString()).orElse("")); |
|
|
|
|
workTicketFlowEntity.setGroundWireCount(Optional.ofNullable(flow.getVariables()).map(v -> v.get("groundWireCount")).map(s -> Integer.parseInt(s.toString())).orElse(null)); |
|
|
|
|
workTicketFlowEntity.setGroundSwitchCount(Optional.ofNullable(flow.getVariables()).map(v -> v.get("groundSwitchCount")).map(s -> Integer.parseInt(s.toString())).orElse(null)); |
|
|
|
|
workTicketFlowEntity.setStatus(req.getStatus()); |
|
|
|
|
workTicketFlowService.save(workTicketFlowEntity); |
|
|
|
|
//执行流程
|
|
|
|
@ -567,7 +559,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
//更新任务状态
|
|
|
|
|
updateAccessStatus(req); |
|
|
|
|
|
|
|
|
|
if(!flowResult.isSuccess()){ |
|
|
|
|
if (!flowResult.isSuccess()) { |
|
|
|
|
throw new ServiceException("执行工作流失败!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -575,11 +567,11 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void updateAccessStatus(WorkTicketInfoDto req){ |
|
|
|
|
if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())){ |
|
|
|
|
log.info("许可通过:{}",JSONObject.toJSONString(req)); |
|
|
|
|
public void updateAccessStatus(WorkTicketInfoDto req) { |
|
|
|
|
if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())) { |
|
|
|
|
log.info("许可通过:{}", JSONObject.toJSONString(req)); |
|
|
|
|
//许可人通过将检修任务状态设为执行中
|
|
|
|
|
if(TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())){ |
|
|
|
|
if (TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())) { |
|
|
|
|
OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); |
|
|
|
|
taskEntity.setId(req.getTaskId()); |
|
|
|
|
taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_1); |
|
|
|
@ -594,15 +586,15 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
* 票据作废时 对应任务ID应该置空 |
|
|
|
|
* @param req |
|
|
|
|
*/ |
|
|
|
|
public void invalidTicket(WorkTicketInfoDto req){ |
|
|
|
|
if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())){ |
|
|
|
|
public void invalidTicket(WorkTicketInfoDto req) { |
|
|
|
|
if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())) { |
|
|
|
|
OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); |
|
|
|
|
taskEntity.setId(req.getTaskId()); |
|
|
|
|
taskEntity.setInvalid(true); |
|
|
|
|
taskEntity.setTicketId(null); |
|
|
|
|
operAccessTaskClient.updateById(taskEntity); |
|
|
|
|
} |
|
|
|
|
if(TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())){ |
|
|
|
|
if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())) { |
|
|
|
|
OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); |
|
|
|
|
dto.setId(req.getTaskId()); |
|
|
|
|
dto.setInvalid(true); |
|
|
|
@ -616,14 +608,14 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
* @param req |
|
|
|
|
*/ |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void returnTicket(WorkTicketInfoDto req){ |
|
|
|
|
if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType())){ |
|
|
|
|
public void returnTicket(WorkTicketInfoDto req) { |
|
|
|
|
if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType())) { |
|
|
|
|
OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); |
|
|
|
|
taskEntity.setId(req.getTaskId()); |
|
|
|
|
taskEntity.setTicketId(req.getId()); |
|
|
|
|
operAccessTaskClient.updateById(taskEntity); |
|
|
|
|
} |
|
|
|
|
if(TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())){ |
|
|
|
|
if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())) { |
|
|
|
|
OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); |
|
|
|
|
dto.setId(req.getTaskId()); |
|
|
|
|
dto.setTicketId(req.getId()); |
|
|
|
@ -633,58 +625,59 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取queryWrapper |
|
|
|
|
* |
|
|
|
|
* @param req |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private LambdaQueryWrapper<WorkTicketInfoEntity> getQueryWrapper(WorkTicketInfoDto req){ |
|
|
|
|
private LambdaQueryWrapper<WorkTicketInfoEntity> getQueryWrapper(WorkTicketInfoDto req) { |
|
|
|
|
LambdaQueryWrapper<WorkTicketInfoEntity> lqw = new LambdaQueryWrapper(); |
|
|
|
|
if(Func.isNotBlank(req.getProcessInstanceId())){ |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getProcessInstanceId,req.getProcessInstanceId()); |
|
|
|
|
if (Func.isNotBlank(req.getProcessInstanceId())) { |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getProcessInstanceId, req.getProcessInstanceId()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getType())){ |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getType,req.getType()); |
|
|
|
|
if (Func.isNotEmpty(req.getType())) { |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getType, req.getType()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getTaskType())){ |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getTaskType,req.getTaskType()); |
|
|
|
|
if (Func.isNotEmpty(req.getTaskType())) { |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getTaskType, req.getTaskType()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getCode())){ |
|
|
|
|
lqw.like(WorkTicketInfoEntity::getCode,req.getCode()); |
|
|
|
|
if (Func.isNotEmpty(req.getCode())) { |
|
|
|
|
lqw.like(WorkTicketInfoEntity::getCode, req.getCode()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getStatus())){ |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getStatus,req.getStatus()); |
|
|
|
|
if (Func.isNotEmpty(req.getStatus())) { |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getStatus, req.getStatus()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getCompany())){ |
|
|
|
|
lqw.like(WorkTicketInfoEntity::getType,"%".concat(req.getCompany()).concat("%")); |
|
|
|
|
if (Func.isNotEmpty(req.getCompany())) { |
|
|
|
|
lqw.like(WorkTicketInfoEntity::getType, "%".concat(req.getCompany()).concat("%")); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getClassGroup())){ |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getClassGroup,req.getClassGroup()); |
|
|
|
|
if (Func.isNotEmpty(req.getClassGroup())) { |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getClassGroup, req.getClassGroup()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getTaskId())){ |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getTaskId,req.getTaskId()); |
|
|
|
|
if (Func.isNotEmpty(req.getTaskId())) { |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getTaskId, req.getTaskId()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getClassGroup())){ |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getClassGroup,req.getClassGroup()); |
|
|
|
|
if (Func.isNotEmpty(req.getClassGroup())) { |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getClassGroup, req.getClassGroup()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getClassGroupMembers())){ |
|
|
|
|
lqw.like(WorkTicketInfoEntity::getClassGroupMembers,"%".concat(req.getClassGroupMembers()).concat("%")); |
|
|
|
|
if (Func.isNotEmpty(req.getClassGroupMembers())) { |
|
|
|
|
lqw.like(WorkTicketInfoEntity::getClassGroupMembers, "%".concat(req.getClassGroupMembers()).concat("%")); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getWorkContent())){ |
|
|
|
|
lqw.like(WorkTicketInfoEntity::getWorkContent,"%".concat(req.getWorkContent()).concat("%")); |
|
|
|
|
if (Func.isNotEmpty(req.getWorkContent())) { |
|
|
|
|
lqw.like(WorkTicketInfoEntity::getWorkContent, "%".concat(req.getWorkContent()).concat("%")); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getSigner())){ |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getSigner,req.getSigner()); |
|
|
|
|
if (Func.isNotEmpty(req.getSigner())) { |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getSigner, req.getSigner()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getLicensor())){ |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getLicensor,req.getLicensor()); |
|
|
|
|
if (Func.isNotEmpty(req.getLicensor())) { |
|
|
|
|
lqw.eq(WorkTicketInfoEntity::getLicensor, req.getLicensor()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getStartTime())){ |
|
|
|
|
lqw.ge(WorkTicketInfoEntity::getCreateTime,req.getStartTime()); |
|
|
|
|
if (Func.isNotEmpty(req.getStartTime())) { |
|
|
|
|
lqw.ge(WorkTicketInfoEntity::getCreateTime, req.getStartTime()); |
|
|
|
|
} |
|
|
|
|
if(Func.isNotEmpty(req.getEndTime())){ |
|
|
|
|
lqw.le(WorkTicketInfoEntity::getCreateTime,req.getEndTime()); |
|
|
|
|
if (Func.isNotEmpty(req.getEndTime())) { |
|
|
|
|
lqw.le(WorkTicketInfoEntity::getCreateTime, req.getEndTime()); |
|
|
|
|
} |
|
|
|
|
if(!CollectionUtil.isEmpty(req.getDeptIds())){ |
|
|
|
|
lqw.in(WorkTicketInfoEntity::getCreateDept,req.getDeptIds()); |
|
|
|
|
if (!CollectionUtil.isEmpty(req.getDeptIds())) { |
|
|
|
|
lqw.in(WorkTicketInfoEntity::getCreateDept, req.getDeptIds()); |
|
|
|
|
} |
|
|
|
|
return lqw; |
|
|
|
|
} |
|
|
|
@ -697,19 +690,19 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
@Override |
|
|
|
|
public BladeFlow startProcessInstance(String processDefinitionKey, WorkTicketInfoEntity workTicketInfoEntity) { |
|
|
|
|
/**获取签发人角色下的人员**/ |
|
|
|
|
R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId,Long.parseLong(AuthUtil.getUser().getDeptId()),TicketConstants.SIGNER_ROLE); |
|
|
|
|
if(!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())){ |
|
|
|
|
R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId, Long.parseLong(AuthUtil.getUser().getDeptId()), TicketConstants.SIGNER_ROLE); |
|
|
|
|
if (!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())) { |
|
|
|
|
throw new ServiceException("工作票签发人角色下未查询到相关人员"); |
|
|
|
|
} |
|
|
|
|
String signUserIds = listR.getData().stream().map(user -> "taskUser_".concat(user.getId().toString())).collect(Collectors.joining(",")); |
|
|
|
|
|
|
|
|
|
Map<String,Object> params = new HashMap<String, Object>(2) {{ |
|
|
|
|
Map<String, Object> params = new HashMap<String, Object>(2) {{ |
|
|
|
|
put("taskId", workTicketInfoEntity.getId()); |
|
|
|
|
put("signUserIds", signUserIds); |
|
|
|
|
}}; |
|
|
|
|
|
|
|
|
|
R<BladeFlow> r = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey,"workTicket:task:" + workTicketInfoEntity.getId(),workTicketInfoEntity.getWorkContent(), params); |
|
|
|
|
if(!r.isSuccess()){ |
|
|
|
|
R<BladeFlow> r = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, "workTicket:task:" + workTicketInfoEntity.getId(), workTicketInfoEntity.getWorkContent(), params); |
|
|
|
|
if (!r.isSuccess()) { |
|
|
|
|
throw new ServiceException(r.getMsg()); |
|
|
|
|
} |
|
|
|
|
return r.getData(); |
|
|
|
@ -717,6 +710,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 许可人通过线下工作票 |
|
|
|
|
* |
|
|
|
|
* @param req |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
@ -725,26 +719,27 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
Long ticketId = req.getId(); |
|
|
|
|
WorkTicketInfoEntity infoEntity = getById(ticketId); |
|
|
|
|
//获取许可人角色下的人员
|
|
|
|
|
R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId,infoEntity.getCreateDept(),TicketConstants.LICENSOR_ROLE); |
|
|
|
|
if(!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())){ |
|
|
|
|
R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId, infoEntity.getCreateDept(), TicketConstants.LICENSOR_ROLE); |
|
|
|
|
if (!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())) { |
|
|
|
|
throw new ServiceException("工作票许可人角色下未查询到相关人员"); |
|
|
|
|
} |
|
|
|
|
List<Long> userId = listR.getData().stream().map(User::getId).distinct().collect(Collectors.toList()); |
|
|
|
|
if(!userId.contains(AuthUtil.getUserId())){ |
|
|
|
|
if (!userId.contains(AuthUtil.getUserId())) { |
|
|
|
|
throw new ServiceException("当前操作人没有许可人角色,无法执行该操作"); |
|
|
|
|
} |
|
|
|
|
update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus,TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_LICENSE.getStatus()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicensor,AuthUtil.getUserId()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicenseTime,LocalDateTime.now()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicenseEndTime,req.getLicenseEndTime()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId,ticketId) |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_LICENSE.getStatus()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicensor, AuthUtil.getUserId()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicenseTime, LocalDateTime.now()) |
|
|
|
|
.set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId, ticketId) |
|
|
|
|
); |
|
|
|
|
return R.success("操作成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 完成线下工作票 |
|
|
|
|
* |
|
|
|
|
* @param ticketAccessTaskDto |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
@ -753,13 +748,13 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
//更新工作票
|
|
|
|
|
WorkTicketInfoDto infoDto = ticketAccessTaskDto.getWorkTicketInfoDto(); |
|
|
|
|
update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus,TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_END.getStatus()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId,infoDto.getId()) |
|
|
|
|
.set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_END.getStatus()) |
|
|
|
|
.eq(WorkTicketInfoEntity::getId, infoDto.getId()) |
|
|
|
|
); |
|
|
|
|
//获取工作票实体类
|
|
|
|
|
WorkTicketInfoEntity infoEntity = getById(infoDto.getId()); |
|
|
|
|
//根据任务类型执行任务
|
|
|
|
|
if(ObjectUtil.isEmpty(infoEntity.getTaskType())){ |
|
|
|
|
if (ObjectUtil.isEmpty(infoEntity.getTaskType())) { |
|
|
|
|
return R.success("操作成功"); |
|
|
|
|
} |
|
|
|
|
//FIXME 日常维护、检修任务暂时不形成闭环(因许可人无需填入任务结束完成所需参数,故选择由执行人手动闭环) ~2022--05-06
|
|
|
|
@ -797,10 +792,10 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public String getWorkTicketCode(){ |
|
|
|
|
public String getWorkTicketCode() { |
|
|
|
|
String code = ""; |
|
|
|
|
lock.lock(); |
|
|
|
|
try{ |
|
|
|
|
try { |
|
|
|
|
/**获取当前时间**/ |
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM"); |
|
|
|
|
YearMonth yearMonth = YearMonth.now(); |
|
|
|
@ -808,23 +803,20 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
LocalDateTime date = LocalDateTime.now(); |
|
|
|
|
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); |
|
|
|
|
LocalDateTime lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59); |
|
|
|
|
log.info("当月第一天:{};当月最后一天{}",firstDay,lastDay); |
|
|
|
|
log.info("当月第一天:{};当月最后一天{}", firstDay, lastDay); |
|
|
|
|
/**获取当月工作票总条数**/ |
|
|
|
|
List<WorkTicketInfoEntity> infoEntityList = this.list(new LambdaQueryWrapper<WorkTicketInfoEntity>(){{ |
|
|
|
|
ge(WorkTicketInfoEntity::getCreateTime,firstDay); |
|
|
|
|
le(WorkTicketInfoEntity::getCreateTime,lastDay); |
|
|
|
|
List<WorkTicketInfoEntity> infoEntityList = this.list(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{ |
|
|
|
|
ge(WorkTicketInfoEntity::getCreateTime, firstDay); |
|
|
|
|
le(WorkTicketInfoEntity::getCreateTime, lastDay); |
|
|
|
|
}}); |
|
|
|
|
if(CollectionUtil.isEmpty(infoEntityList)){ |
|
|
|
|
if (CollectionUtil.isEmpty(infoEntityList)) { |
|
|
|
|
code = TicketConstants.TicketCodePreEnum.DQ_WORK.getPrefix().concat("-").concat(tym).concat("-001"); |
|
|
|
|
} else { |
|
|
|
|
code = TicketConstants.TicketCodePreEnum.DQ_WORK.getPrefix().concat("-").concat(tym).concat("-").concat(String.format("%03d", infoEntityList.size() + 1)); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
code = TicketConstants.TicketCodePreEnum.DQ_WORK.getPrefix().concat("-").concat(tym).concat("-").concat(String.format("%03d", infoEntityList.size()+1)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch(Exception e){ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
finally{ |
|
|
|
|
} finally { |
|
|
|
|
lock.unlock(); |
|
|
|
|
} |
|
|
|
|
return code; |
|
|
|
@ -832,6 +824,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取安全检查工作票项统计 |
|
|
|
|
* |
|
|
|
|
* @param startDate 开始时间 |
|
|
|
|
* @param endDate 结束时间 |
|
|
|
|
* @param dept 机构ID |
|
|
|
@ -839,33 +832,90 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
|
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public SafeCheckStatisticVO getWorkTicketStatistic(String startDate, String endDate, Long dept) { |
|
|
|
|
return this.baseMapper.getWorkTicketStatistic(startDate,endDate,dept); |
|
|
|
|
return this.baseMapper.getWorkTicketStatistic(startDate, endDate, dept); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 验证角色是否能查询到相关人员 |
|
|
|
|
* |
|
|
|
|
* @param deptId 机构ID |
|
|
|
|
* @param roleAliasArray 角色 按逗号分隔 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R<Map<String,Object>> verificationRole(Long deptId, String roleAliasArray){ |
|
|
|
|
Map<String,Object> result = new HashedMap(2); |
|
|
|
|
public R<Map<String, Object>> verificationRole(Long deptId, String roleAliasArray) { |
|
|
|
|
Map<String, Object> result = new HashedMap(2); |
|
|
|
|
List<String> failRoleAliasList = Lists.newArrayList(); |
|
|
|
|
AtomicBoolean flag = new AtomicBoolean(true); |
|
|
|
|
Arrays.stream(roleAliasArray.split(",")).forEach(roleAlias->{ |
|
|
|
|
Arrays.stream(roleAliasArray.split(",")).forEach(roleAlias -> { |
|
|
|
|
//查询机构下角色是否有对应人员列表
|
|
|
|
|
R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId,deptId,roleAlias); |
|
|
|
|
if(!listR.isSuccess() || ObjectUtil.isEmpty(listR.getData())) { |
|
|
|
|
R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId, deptId, roleAlias); |
|
|
|
|
if (!listR.isSuccess() || ObjectUtil.isEmpty(listR.getData())) { |
|
|
|
|
failRoleAliasList.add(roleAlias); |
|
|
|
|
flag.set(false); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
result.put("flag",flag.get()); |
|
|
|
|
if(CollectionUtil.isNotEmpty(failRoleAliasList)){ |
|
|
|
|
result.put("message","验证失败,获取"+JSON.toJSONString(failRoleAliasList)+"角色下的人员失败"); |
|
|
|
|
result.put("flag", flag.get()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(failRoleAliasList)) { |
|
|
|
|
result.put("message", "验证失败,获取" + JSON.toJSONString(failRoleAliasList) + "角色下的人员失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return R.data(result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据月份和区域查询工作票列表详情 |
|
|
|
|
* |
|
|
|
|
* @param pageEntity |
|
|
|
|
* @param areaVo |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public BladePage<StandardWorkVo> workTicketListByMonthAndArea(Page<WorkTicketInfoEntity> pageEntity, |
|
|
|
|
StandardTicketWithAreaVo areaVo) { |
|
|
|
|
//1.查询
|
|
|
|
|
QueryWrapper<WorkTicketInfoEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
|
|
//开票来源
|
|
|
|
|
queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getTaskType()), WorkTicketInfoEntity::getTaskType, |
|
|
|
|
areaVo.getTaskType()); |
|
|
|
|
//编号
|
|
|
|
|
queryWrapper.lambda().like(Func.isNotEmpty(areaVo.getCode()), WorkTicketInfoEntity::getCode, areaVo.getCode()); |
|
|
|
|
|
|
|
|
|
//状态
|
|
|
|
|
queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getStatus()), WorkTicketInfoEntity::getStatus, |
|
|
|
|
areaVo.getStatus()); |
|
|
|
|
|
|
|
|
|
//开始时间
|
|
|
|
|
queryWrapper.lambda().lt(Func.isNotEmpty(areaVo.getStartTime()), WorkTicketInfoEntity::getCreateTime, |
|
|
|
|
areaVo.getStartTime()); |
|
|
|
|
|
|
|
|
|
//结束时间
|
|
|
|
|
queryWrapper.lambda().le(Func.isNotEmpty(areaVo.getEndTime()), WorkTicketInfoEntity::getCreateTime, |
|
|
|
|
areaVo.getEndTime()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryWrapper.eq("create_dept", areaVo.getAreaId()); |
|
|
|
|
queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(create_time,'%Y-%m')", |
|
|
|
|
areaVo.getYearMonth()); |
|
|
|
|
Page<WorkTicketInfoEntity> workTicketInfoEntityPage = baseMapper.selectPage(pageEntity, queryWrapper); |
|
|
|
|
//数据转换
|
|
|
|
|
List<StandardWorkVo> standardWorkList = new ArrayList<>(); |
|
|
|
|
if (CollectionUtil.isNotEmpty(workTicketInfoEntityPage.getRecords())) { |
|
|
|
|
standardWorkList = workTicketInfoEntityPage.getRecords() |
|
|
|
|
.stream().map(workTicketInfoEntity -> { |
|
|
|
|
StandardWorkVo standardWorkVo = new StandardWorkVo(); |
|
|
|
|
BeanUtils.copyProperties(workTicketInfoEntity, standardWorkVo); |
|
|
|
|
return standardWorkVo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IPage<StandardWorkVo> page = new Page<>(); |
|
|
|
|
page.setRecords(standardWorkList); |
|
|
|
|
page.setTotal(workTicketInfoEntityPage.getTotal()); |
|
|
|
|
page.setCurrent(workTicketInfoEntityPage.getCurrent()); |
|
|
|
|
page.setSize(workTicketInfoEntityPage.getSize()); |
|
|
|
|
BladePage<StandardWorkVo> bladePage = BladePage.of(page); |
|
|
|
|
return bladePage; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|