|
|
@ -1,10 +1,12 @@ |
|
|
|
package com.hnac.hzims.ticket.twoTicket.service.impl; |
|
|
|
package com.hnac.hzims.ticket.twoTicket.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil; |
|
|
|
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
|
|
|
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
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.toolkit.CollectionUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.hnac.hzims.common.logs.utils.StringUtils; |
|
|
|
import com.hnac.hzims.common.logs.utils.StringUtils; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; |
|
|
@ -19,7 +21,6 @@ import com.hnac.hzims.ticket.constants.WorkTicketConstants; |
|
|
|
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker; |
|
|
|
import com.hnac.hzims.ticket.processflow.strategy.core.ProcessIdWorker; |
|
|
|
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse; |
|
|
|
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService; |
|
|
@ -31,14 +32,14 @@ import com.hnac.hzims.ticket.workTicket.entity.*; |
|
|
|
import com.hnac.hzims.ticket.workTicket.service.*; |
|
|
|
import com.hnac.hzims.ticket.workTicket.service.*; |
|
|
|
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl; |
|
|
|
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl; |
|
|
|
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl; |
|
|
|
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl; |
|
|
|
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketSafetyMeasureVO; |
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
|
|
import lombok.SneakyThrows; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.math.NumberUtils; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
@ -54,9 +55,10 @@ import org.springframework.web.context.request.RequestContextHolder; |
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.time.Instant; |
|
|
|
import java.io.FileNotFoundException; |
|
|
|
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.ZoneId; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
@ -69,9 +71,9 @@ import java.util.stream.Collectors; |
|
|
|
* @Serial 1.0 |
|
|
|
* @Serial 1.0 |
|
|
|
* @Date 2023/4/8 11:11 |
|
|
|
* @Date 2023/4/8 11:11 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
|
|
|
|
@Service |
|
|
|
public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -120,10 +122,6 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
|
|
|
|
|
|
|
|
private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService; |
|
|
|
private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final List<TicketProcessService> processService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IWorkTicketOperateTimeService workTicketOperateTimeService; |
|
|
|
private final IWorkTicketOperateTimeService workTicketOperateTimeService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -141,13 +139,14 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
* |
|
|
|
* |
|
|
|
* @param workTicketVo |
|
|
|
* @param workTicketVo |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@SneakyThrows |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
public void startUp(WorkTicketVo workTicketVo) { |
|
|
|
public void startUp(WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
log.info("执行 com.hnac.hzims.ticket.twoTicket.service.impl【startUp】 。。。方法"); |
|
|
|
if (workTicketVo.getWorkTicket().getSignage() == null) { |
|
|
|
if (workTicketVo.getWorkTicket().getSignage() == null) { |
|
|
|
throw new ServiceException("站点标识-两票编码不能为空"); |
|
|
|
throw new ServiceException("站点标识-两票编码不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
//1. 获取站点站点标识-两票编码
|
|
|
|
|
|
|
|
StationEntity stationEntity = new StationEntity(); |
|
|
|
StationEntity stationEntity = new StationEntity(); |
|
|
|
stationEntity.setCode(workTicketVo.getWorkTicket().getSignageCode()); |
|
|
|
stationEntity.setCode(workTicketVo.getWorkTicket().getSignageCode()); |
|
|
|
R<StationEntity> stationClientOne = stationClient.getOne(stationEntity); |
|
|
|
R<StationEntity> stationClientOne = stationClient.getOne(stationEntity); |
|
|
@ -158,7 +157,6 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
if (station == null) { |
|
|
|
if (station == null) { |
|
|
|
throw new ServiceException("根据条件获取唯一站点暂无数据"); |
|
|
|
throw new ServiceException("根据条件获取唯一站点暂无数据"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
log.info("前端查的站点编号 :{}", workTicketVo.getWorkTicket().getSignage()); |
|
|
|
log.info("前端查的站点编号 :{}", workTicketVo.getWorkTicket().getSignage()); |
|
|
|
log.info("后端查寻的站点编码 :{}", station.getSignage()); |
|
|
|
log.info("后端查寻的站点编码 :{}", station.getSignage()); |
|
|
|
if (!workTicketVo.getWorkTicket().getSignage().equals(station.getSignage())) { |
|
|
|
if (!workTicketVo.getWorkTicket().getSignage().equals(station.getSignage())) { |
|
|
@ -170,24 +168,24 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
if (StringUtils.isBlank(signage) || signage.length() < 2) { |
|
|
|
if (StringUtils.isBlank(signage) || signage.length() < 2) { |
|
|
|
throw new ServiceException("站点标识-两票编码不能为空"); |
|
|
|
throw new ServiceException("站点标识-两票编码不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
signage = signage.length() == 2 ? station.getSignage() : station.getSignage().substring(0, 2); |
|
|
|
signage = signage.length() == 2 ? station.getSignage() : station.getSignage().substring(0, 2); |
|
|
|
|
|
|
|
|
|
|
|
workTicketVo.getWorkTicket().setSignage(signage); |
|
|
|
workTicketVo.getWorkTicket().setSignage(signage); |
|
|
|
workTicketVo.getWorkTicket().setSignageCode(station.getCode()); |
|
|
|
workTicketVo.getWorkTicket().setSignageCode(station.getCode()); |
|
|
|
//2. 获取编码
|
|
|
|
//2. 获取编码
|
|
|
|
String code = processIdWorker.getTicketByCode(workTicketVo.getWorkTicket().getSignage(), |
|
|
|
String code = processIdWorker.getTicketByCode(workTicketVo.getWorkTicket().getSignage(), workTicketVo.getWorkTicket().getType(), LocalDateTime.now()); |
|
|
|
workTicketVo.getWorkTicket().getType(), LocalDateTime.now()); |
|
|
|
|
|
|
|
workTicketVo.getWorkTicket().setCode(code); |
|
|
|
workTicketVo.getWorkTicket().setCode(code); |
|
|
|
//2 .保存工作对象
|
|
|
|
//3 .保存工作对象
|
|
|
|
this.saveWorkTicketInfo(workTicketVo.getWorkTicket()); |
|
|
|
this.saveWorkTicketInfo(workTicketVo.getWorkTicket()); |
|
|
|
//3. 保存安全措施
|
|
|
|
//4. 保存安全措施
|
|
|
|
log.info("获取报存安全措施:{}", workTicketVo.getSafetyMeasuresList()); |
|
|
|
|
|
|
|
this.saveSafetyMeasures(workTicketVo.getSafetyMeasuresList(), workTicketVo.getWorkTicket()); |
|
|
|
this.saveSafetyMeasures(workTicketVo.getSafetyMeasuresList(), workTicketVo.getWorkTicket()); |
|
|
|
//4. 保存工作任务
|
|
|
|
//5. 保存工作任务
|
|
|
|
this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket()); |
|
|
|
this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket()); |
|
|
|
//5. 开启动作流
|
|
|
|
//6. 开启动作流
|
|
|
|
this.dealProcess(newFirstWorkTicketFlowKey, workTicketVo); |
|
|
|
this.dealProcess(newFirstWorkTicketFlowKey, workTicketVo); |
|
|
|
|
|
|
|
//7. 处理任务
|
|
|
|
|
|
|
|
this.returnTicket(workTicketVo); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -196,15 +194,13 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
* @param response |
|
|
|
* @param response |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void findPending(ProcessWorkFlowResponse response) { |
|
|
|
public void findPending(ProcessWorkFlowResponse response) { |
|
|
|
log.info("获取待处理的数据 {}", response); |
|
|
|
log.info("获取待处理的数据 {}", response); |
|
|
|
log.info("获取businessKey: {}", response.getBusinessKey()); |
|
|
|
log.info("获取businessKey: {}", response.getBusinessKey()); |
|
|
|
log.info("获取taskId: {}", response.getTaskId()); |
|
|
|
log.info("获取taskId: {}", response.getTaskId()); |
|
|
|
log.info("获取下一个审批人是: {}", response.getNextStepOperator()); |
|
|
|
log.info("获取下一个审批人是: {}", response.getNextStepOperator()); |
|
|
|
if (StringUtils.isNull(response.getTaskId())) { |
|
|
|
log.info("获取当前任务名称是: {}", response.getTaskName()); |
|
|
|
log.info("工作流结束~~~"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//json转换表单
|
|
|
|
//json转换表单
|
|
|
|
String formData = JSON.toJSONString(response.getVariables()); |
|
|
|
String formData = JSON.toJSONString(response.getVariables()); |
|
|
|
log.info("获取表单的数据:{}", formData); |
|
|
|
log.info("获取表单的数据:{}", formData); |
|
|
@ -212,12 +208,8 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
try { |
|
|
|
try { |
|
|
|
fristWorkFlowResponse = JSONObject.parseObject(formData, FristWorkTicketVo.class); |
|
|
|
fristWorkFlowResponse = JSONObject.parseObject(formData, FristWorkTicketVo.class); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("获取表单出现异常了~~~~"); |
|
|
|
} |
|
|
|
throw new IllegalArgumentException(e.getMessage()); |
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(fristWorkFlowResponse)) { |
|
|
|
|
|
|
|
log.error("获取表单的数据解析的数据为null"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//获取表单数据
|
|
|
|
//获取表单数据
|
|
|
|
WorkTicketVo workTicketVo = fristWorkFlowResponse.getWorkTicketVo(); |
|
|
|
WorkTicketVo workTicketVo = fristWorkFlowResponse.getWorkTicketVo(); |
|
|
@ -225,20 +217,16 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
//2.流程处理
|
|
|
|
//2.流程处理
|
|
|
|
String businessKey = response.getBusinessKey(); |
|
|
|
String businessKey = response.getBusinessKey(); |
|
|
|
WorkTicketInfoEntity workTicketInfo = firstWorkTicketService.getById(businessKey); |
|
|
|
WorkTicketInfoEntity workTicketInfo = firstWorkTicketService.getById(businessKey); |
|
|
|
if (ObjectUtils.isEmpty(workTicketInfo) || ObjectUtils.isEmpty(workTicket.getId())) { |
|
|
|
if (ObjectUtils.isEmpty(workTicketInfo)) { |
|
|
|
log.error("获取工作票的数据为不存在"); |
|
|
|
log.error("获取工作票的数据为不存在"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
//更新工作票
|
|
|
|
//更新工作票
|
|
|
|
if (workTicket.getId() == null) { |
|
|
|
workTicket.setId(workTicketInfo.getId()); |
|
|
|
workTicket.setId(workTicketInfo.getId()); |
|
|
|
//保存流程描述
|
|
|
|
} |
|
|
|
saveWorkTicket(workTicket, response); |
|
|
|
|
|
|
|
|
|
|
|
//工作流ID
|
|
|
|
//工作流ID
|
|
|
|
if (StringUtils.isEmpty(workTicketInfo.getProcessInstanceId())) { |
|
|
|
workTicket.setProcessInstanceId(response.getProcessInstanceId()); |
|
|
|
workTicket.setProcessInstanceId(response.getProcessInstanceId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
//更新安全措施
|
|
|
|
//更新安全措施
|
|
|
|
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); |
|
|
|
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); |
|
|
@ -255,367 +243,194 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
//工作票工作任务组
|
|
|
|
//工作票工作任务组
|
|
|
|
List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); |
|
|
|
// List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList();
|
|
|
|
if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) { |
|
|
|
// if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) {
|
|
|
|
log.info("获取工作票工作任务组:{}", workTicketContentDtoList); |
|
|
|
// log.info("获取工作票工作任务组:{}", workTicketContentDtoList);
|
|
|
|
workTicketContentDtoList.forEach(item -> { |
|
|
|
// workTicketContentDtoList.forEach(item -> {
|
|
|
|
if (ObjectUtils.isEmpty(item.getId())) { |
|
|
|
// if (ObjectUtils.isEmpty(item.getId())) {
|
|
|
|
LambdaQueryWrapper<WorkTicketContentEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
// LambdaQueryWrapper<WorkTicketContentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
queryWrapper.eq(WorkTicketContentEntity::getTicketId, workTicketInfo.getId()); |
|
|
|
// queryWrapper.eq(WorkTicketContentEntity::getTicketId, workTicketInfo.getId());
|
|
|
|
contentService.update(item, queryWrapper); |
|
|
|
// contentService.update(item, queryWrapper);
|
|
|
|
} else { |
|
|
|
// } else {
|
|
|
|
contentService.updateById(item); |
|
|
|
// contentService.updateById(item);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
} |
|
|
|
// }
|
|
|
|
// 工作票延期
|
|
|
|
// 工作票延期
|
|
|
|
WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); |
|
|
|
WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketDelay) && ObjectUtils.isNotEmpty(workTicketDelay.getCreateUser())) { |
|
|
|
try { |
|
|
|
log.info("获取工作票延期:{}", workTicketDelay); |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketDelay) && "延期".equals(workTicket.getInput())) { |
|
|
|
try { |
|
|
|
|
|
|
|
workTicketDelay.setCreateDept(workTicket.getCreateDept()); |
|
|
|
WorkTicketDelayEntity workTicketDelayEntity = workTicketDelayService.selectByTicketId(workTicketInfo.getId()); |
|
|
|
|
|
|
|
log.info("获取工作票延期:{}", workTicketDelay); |
|
|
|
|
|
|
|
workTicketDelay.setCreateDept(workTicketInfo.getCreateDept()); |
|
|
|
workTicketDelay.setTicketId(workTicketInfo.getId()); |
|
|
|
workTicketDelay.setTicketId(workTicketInfo.getId()); |
|
|
|
workTicketDelay.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
workTicketDelay.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
if (ObjectUtils.isEmpty(workTicketDelay.getId())) { |
|
|
|
if (ObjectUtils.isEmpty(workTicketDelay.getId()) || ObjectUtils.isEmpty(workTicketDelayEntity)) { |
|
|
|
workTicketDelayService.save(workTicketDelay); |
|
|
|
workTicketDelayService.save(workTicketDelay); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
workTicketDelayService.updateById(workTicketDelay); |
|
|
|
workTicketDelayService.updateByTicketId(workTicketDelay); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//工作结束
|
|
|
|
//工作结束
|
|
|
|
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); |
|
|
|
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketFinish) && ObjectUtils.isNotEmpty(workTicketFinish.getPrincipal())) { |
|
|
|
try { |
|
|
|
log.info("获取工作结束:{}", workTicketFinish); |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketFinish) && 99 == workTicket.getFlowStatus().intValue()) { |
|
|
|
if (ObjectUtils.isEmpty(workTicketFinish.getId())) { |
|
|
|
WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId()); |
|
|
|
workTicketDelay.setTicketId(workTicketInfo.getId()); |
|
|
|
log.info("获取工作结束:{}", workTicketFinish); |
|
|
|
//workTicketDelay.setInitialTime(LocalDateTime.now());
|
|
|
|
if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) { |
|
|
|
workTicketFinishService.save(workTicketFinish); |
|
|
|
workTicketFinish.setTicketId(workTicketInfo.getId()); |
|
|
|
} else { |
|
|
|
workTicketFinishService.save(workTicketFinish); |
|
|
|
workTicketDelay.setInitialTime(LocalDateTime.now()); |
|
|
|
} else { |
|
|
|
workTicketFinishService.updateById(workTicketFinish); |
|
|
|
workTicketDelay.setInitialTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
workTicketFinishService.updateByTicketId(workTicketFinish); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//工作开始时间和结束时间
|
|
|
|
//工作开始时间和结束时间
|
|
|
|
List<WorkTicketOperateTimeEntity> workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities(); |
|
|
|
// List<WorkTicketOperateTimeEntity> workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities();
|
|
|
|
if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) { |
|
|
|
// if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) {
|
|
|
|
log.info("工作开始时间和结束时间:{}", workTicketFinish); |
|
|
|
// log.info("工作开始时间和结束时间:{}", workTicketFinish);
|
|
|
|
workTicketOperateTimeService.saveBatch(workTicketOperateTimeEntities); |
|
|
|
// workTicketOperateTimeService.saveBatch(workTicketOperateTimeEntities);
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//工作票负责人变更
|
|
|
|
|
|
|
|
WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange(); |
|
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(workTicketPrincipalChange) && workTicketPrincipalChange.getInitialPrincipal() != null) { |
|
|
|
|
|
|
|
log.info("工作票负责人变更: {}", workTicketPrincipalChange); |
|
|
|
|
|
|
|
//原来的负责人
|
|
|
|
|
|
|
|
User user = UserCache.getUser(workTicketPrincipalChange.getInitialPrincipal()); |
|
|
|
|
|
|
|
//新的负责人
|
|
|
|
|
|
|
|
User newUser = UserCache.getUser(workTicketPrincipalChange.getChangePrincipal()); |
|
|
|
|
|
|
|
workTicketPrincipalChange.setCreateDept(workTicket.getCreateDept()); |
|
|
|
|
|
|
|
workTicketPrincipalChange.setTicketId(workTicketInfo.getId()); |
|
|
|
|
|
|
|
workTicketPrincipalChange.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
|
|
|
|
if (workTicketPrincipalChange.getId() == null) { |
|
|
|
|
|
|
|
workTicketPrincipalChangeService.save(workTicketPrincipalChange); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
workTicketPrincipalChangeService.updateById(workTicketPrincipalChange); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
log.info("工作负责人变更 原来的负责人 {},变更为 {}", user.getName(), newUser.getName()); |
|
|
|
|
|
|
|
workTicket.setPrincipal(workTicketPrincipalChange.getChangePrincipal()); |
|
|
|
|
|
|
|
workTicket.setPrincipalName(newUser.getName()); |
|
|
|
|
|
|
|
//更新工作票
|
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// WorkTicketInfoEntity workTicketInfo = firstWorkTicketService.getById(workTicket.getId());
|
|
|
|
|
|
|
|
// Integer flowStatus = workTicketInfo.getFlowStatus();
|
|
|
|
|
|
|
|
// FlowWorkTicketConstants enumByStatus = FlowWorkTicketConstants.getEnumByStatus(flowStatus);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessService dbProcessService = processService.stream().filter(item -> item.isStatus(response.getProcessDefinitionKey(),
|
|
|
|
|
|
|
|
// enumByStatus)).findFirst().orElse(null);
|
|
|
|
|
|
|
|
// dbProcessService.execute(response,workTicketVo);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// switch (enumByStatus) {
|
|
|
|
|
|
|
|
// case START:
|
|
|
|
|
|
|
|
// //开票
|
|
|
|
|
|
|
|
// make(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case SIGN:
|
|
|
|
|
|
|
|
// //签发人签发
|
|
|
|
|
|
|
|
// //工作票签发人默认执行
|
|
|
|
|
|
|
|
// sign(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case RECEIVE:
|
|
|
|
|
|
|
|
// //运功人接收
|
|
|
|
|
|
|
|
// reception(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case FIX_UP:
|
|
|
|
|
|
|
|
// // 运行人员布置安全措施
|
|
|
|
|
|
|
|
// safety(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case PRINCIPAL_CONFIRM_MEASURE:
|
|
|
|
|
|
|
|
// //工作负责人确认安全措施
|
|
|
|
|
|
|
|
// principal(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case LICENCE:
|
|
|
|
|
|
|
|
// //许可人许可
|
|
|
|
|
|
|
|
// license(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case PRINCIPAL_CONFIRM_CONTENT:
|
|
|
|
|
|
|
|
// //工作负责人确认工作内容执行
|
|
|
|
|
|
|
|
// principalConfirmContent(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case PRINCIPAL_CONFIRM_END:
|
|
|
|
|
|
|
|
// //工作负责人确认工作票结束
|
|
|
|
|
|
|
|
// principalConfirmEnd(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case LICENSE_CONFIRM_END:
|
|
|
|
|
|
|
|
// //许可人确认工作票结束
|
|
|
|
|
|
|
|
// licenseConfirmEnd(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case PROCESS_POSTPONE:
|
|
|
|
|
|
|
|
// //工作票延期
|
|
|
|
|
|
|
|
// processPostpone(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case PROCESS_COURSE:
|
|
|
|
|
|
|
|
// //工作票转移
|
|
|
|
|
|
|
|
// processCourse(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case SIGN_CONFIRM_DELAY:
|
|
|
|
|
|
|
|
// //签发人审核
|
|
|
|
|
|
|
|
// signConfirmDelay(response, workTicketVo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 签发人审核 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
* @param workTicketVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void signConfirmDelay(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.LICENCE.getStatus()); |
|
|
|
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.LICENCE.getDescription()); |
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 工作票转移 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
* @param workTicketVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void processCourse(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
//工作票负责人变更
|
|
|
|
//工作票负责人变更
|
|
|
|
WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange(); |
|
|
|
WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange(); |
|
|
|
workTicketPrincipalChangeService.save(workTicketPrincipalChange); |
|
|
|
try { |
|
|
|
//更新工作票信息
|
|
|
|
if (ObjectUtils.isNotEmpty(workTicketPrincipalChange) && "转移".equals(workTicket.getInput())) { |
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
log.info("工作票负责人变更: {}", workTicketPrincipalChange); |
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.SIGN_CONFIRM_DELAY.getStatus()); |
|
|
|
//原来的负责人
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.SIGN_CONFIRM_DELAY.getDescription()); |
|
|
|
User user = UserCache.getUser(workTicketPrincipalChange.getInitialPrincipal()); |
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
//新的负责人
|
|
|
|
|
|
|
|
User newUser = UserCache.getUser(workTicketPrincipalChange.getChangePrincipal()); |
|
|
|
|
|
|
|
workTicketPrincipalChange.setCreateDept(workTicketInfo.getCreateDept()); |
|
|
|
} |
|
|
|
workTicketPrincipalChange.setTicketId(workTicketInfo.getId()); |
|
|
|
|
|
|
|
workTicketPrincipalChange.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
|
|
|
|
if (workTicketPrincipalChange.getFlowCode() == null) { |
|
|
|
/** |
|
|
|
workTicketPrincipalChange.setFlowCode(IdWorker.getIdStr()); |
|
|
|
* 工作票延期 |
|
|
|
} |
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
* @param workTicketVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void processPostpone(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
//保存工作票延期
|
|
|
|
|
|
|
|
WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); |
|
|
|
|
|
|
|
workTicketDelayService.save(workTicketDelay); |
|
|
|
|
|
|
|
//更新工作票信息
|
|
|
|
|
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.LICENCE.getStatus()); |
|
|
|
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.LICENCE.getDescription()); |
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 许可人确认工作票结束 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
* @param workTicketVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void licenseConfirmEnd(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
//工作结束
|
|
|
|
|
|
|
|
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); |
|
|
|
|
|
|
|
workTicketFinishService.updateById(workTicketFinish); |
|
|
|
|
|
|
|
//更新工作票信息
|
|
|
|
|
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.END.getStatus()); |
|
|
|
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.END.getDescription()); |
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 工作负责人确认工作票结束 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
* @param workTicketVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void principalConfirmEnd(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
//工作结束
|
|
|
|
|
|
|
|
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); |
|
|
|
|
|
|
|
workTicketFinishService.save(workTicketFinish); |
|
|
|
|
|
|
|
//更新工作票信息
|
|
|
|
|
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.LICENSE_CONFIRM_END.getStatus()); |
|
|
|
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.LICENSE_CONFIRM_END.getDescription()); |
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 工作负责人确认工作内容执行 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
* @param workTicketVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void principalConfirmContent(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
List<WorkTicketOperateTimeEntity> workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities(); |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(workTicketOperateTimeEntities)) { |
|
|
|
|
|
|
|
log.info("暂时没有每日开工每日收的数据"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
workTicketOperateTimeServiceImpl.saveBatch(workTicketOperateTimeEntities); |
|
|
|
|
|
|
|
//更新工作票信息
|
|
|
|
|
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_END.getStatus()); |
|
|
|
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_END.getDescription()); |
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
WorkTicketPrincipalChangeEntity workTicketPrincipalChangeEntity = workTicketPrincipalChangeService.selectByTicketId(workTicket.getId()); |
|
|
|
* 许可人许可 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
* @param workTicketVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void license(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(safetyMeasuresList)) { |
|
|
|
|
|
|
|
log.error("没有安全措施数据"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新安全措施的状态
|
|
|
|
if (workTicketPrincipalChange.getId() == null || ObjectUtils.isEmpty(workTicketPrincipalChangeEntity)) { |
|
|
|
List<WorkTicketSafetyMeasureEntity> workTicketSafetyMeasureEntities = new ArrayList<>(); |
|
|
|
workTicketPrincipalChangeService.save(workTicketPrincipalChange); |
|
|
|
for (WorkTicketSafetyMeasureEntity workTicketSafetyMeasureDto : safetyMeasuresList) { |
|
|
|
} else { |
|
|
|
WorkTicketSafetyMeasureEntity workTicketSafetyMeasureEntity = BeanUtil.copyProperties(workTicketSafetyMeasureDto, WorkTicketSafetyMeasureEntity.class); |
|
|
|
workTicketPrincipalChangeService.updateByTicketId(workTicketPrincipalChange); |
|
|
|
workTicketSafetyMeasureEntities.add(workTicketSafetyMeasureEntity); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("工作负责人变更 原来的负责人 {},变更为 {}", user.getName(), newUser.getName()); |
|
|
|
|
|
|
|
workTicket.setPrincipal(workTicketPrincipalChange.getChangePrincipal()); |
|
|
|
|
|
|
|
workTicket.setPrincipalName(newUser.getName()); |
|
|
|
|
|
|
|
//更新工作票
|
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
workTicketSafetyMeasureService.saveBatch(workTicketSafetyMeasureEntities); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新工作票
|
|
|
|
|
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_CONTENT.getStatus()); |
|
|
|
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_CONTENT.getDescription()); |
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 工作负责人确认安全措施 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
* @param workTicketVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void principal(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
//负责人确认时间
|
|
|
|
|
|
|
|
//workTicket.setConfirmDateTime(workTicketVo.getWorkTicket().getConfirmDateTime());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.LICENCE.getStatus()); |
|
|
|
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.LICENCE.getDescription()); |
|
|
|
|
|
|
|
//更新状态值
|
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 运行人员布置安全措施 |
|
|
|
* 保存流程描述 |
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* @param workTicket |
|
|
|
* @param response |
|
|
|
* @param response |
|
|
|
* @param workTicketVo |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void safety(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
private void saveWorkTicket(WorkTicketInfoEntity workTicket, ProcessWorkFlowResponse response) { |
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
String taskId = response.getTaskId(); |
|
|
|
//值班负责人
|
|
|
|
String nextStepOperator = response.getNextStepOperator(); |
|
|
|
workTicket.setWatchPrincipal(workTicketVo.getWorkTicket().getPrincipal()); |
|
|
|
//1.获取状态
|
|
|
|
workTicket.setWatchPrincipalEndTime(workTicketVo.getWorkTicket().getWatchPrincipalEndTime()); |
|
|
|
Integer flowStatus = workTicket.getFlowStatus(); |
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getStatus()); |
|
|
|
//2.根据流程获取描述信息
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.PRINCIPAL_CONFIRM_MEASURE.getDescription()); |
|
|
|
String description = getWorkTicketDescription(flowStatus); |
|
|
|
//更新状态值
|
|
|
|
String flowDescription = ""; |
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
//当前审批人
|
|
|
|
|
|
|
|
User user = UserCache.getUser(workTicket.getStepOperator()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(nextStepOperator)) { |
|
|
|
|
|
|
|
Long taskUser = NumberUtils.createLong(nextStepOperator.startsWith("taskUser_") ? |
|
|
|
|
|
|
|
nextStepOperator.substring(9) : null); |
|
|
|
|
|
|
|
//下一个审批人
|
|
|
|
|
|
|
|
User stepUser = UserCache.getUser(taskUser); |
|
|
|
|
|
|
|
flowDescription = "审批中,当前环节是".concat(description) |
|
|
|
|
|
|
|
.concat(",当前审批人是").concat(user.getName()) |
|
|
|
|
|
|
|
.concat(",下一个审批人是").concat(stepUser.getName()).concat("待审批"); |
|
|
|
|
|
|
|
workTicket.setNextStepOperator(taskUser); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
flowDescription = "审批中,当前环节是".concat(description) |
|
|
|
|
|
|
|
.concat(",审批人是").concat(user.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//如果taskId为空 或 flowStatus = 99
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(taskId) || 99 == flowStatus) { |
|
|
|
|
|
|
|
flowDescription = "结束"; |
|
|
|
|
|
|
|
workTicket.setFlowDescription(flowDescription); |
|
|
|
|
|
|
|
workTicket.setFlowTaskId(""); |
|
|
|
|
|
|
|
workTicket.setFlowTaskName("结束"); |
|
|
|
|
|
|
|
workTicket.setNextStepOperator(-1L); |
|
|
|
|
|
|
|
workTicket.setStepOperator(-1L); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
workTicket.setFlowDescription(flowDescription); |
|
|
|
|
|
|
|
workTicket.setFlowTaskId(taskId); |
|
|
|
|
|
|
|
workTicket.setFlowTaskName(response.getTaskName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//如果下一个审批人【nextStepOperator】是null设为-1
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(nextStepOperator)) { |
|
|
|
|
|
|
|
workTicket.setNextStepOperator(-1L); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 运功人接收 |
|
|
|
* 获取描述信息 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param response |
|
|
|
* @param flowStatus 状态 |
|
|
|
* @param workTicketVo |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
|
|
|
|
private void reception(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.FIX_UP.getStatus()); |
|
|
|
|
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.FIX_UP.getDescription()); |
|
|
|
|
|
|
|
//更新状态值
|
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 第一种工作票签发 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
//@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
|
|
|
public void sign(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
|
|
|
|
WorkTicketInfoEntity workTicketInfoEntity = workTicketVo.getWorkTicket(); |
|
|
|
|
|
|
|
//更新状态值
|
|
|
|
|
|
|
|
workTicketInfoEntity.setStatus(FlowWorkTicketConstants.RECEIVE.getStatus()); |
|
|
|
|
|
|
|
workTicketInfoEntity.setFlowStatus(FlowWorkTicketConstants.RECEIVE.getStatus()); |
|
|
|
|
|
|
|
workTicketInfoEntity.setFlowDescription(FlowWorkTicketConstants.RECEIVE.getDescription()); |
|
|
|
|
|
|
|
workTicketInfoEntity.setSignerDateTime(workTicketVo.getWorkTicket().getSignerDateTime()); |
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicketInfoEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 开票 |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void make(ProcessWorkFlowResponse response, WorkTicketVo workTicketVo) { |
|
|
|
private String getWorkTicketDescription(Integer flowStatus) { |
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
String value = null; |
|
|
|
workTicket.setProcessInstanceId(response.getProcessInstanceId()); |
|
|
|
switch (flowStatus) { |
|
|
|
workTicket.setStatus(FlowWorkTicketConstants.SIGN.getStatus()); |
|
|
|
case 1: |
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.SIGN.getStatus()); |
|
|
|
value = "签发人签发"; |
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.SIGN.getDescription()); |
|
|
|
break; |
|
|
|
//保存工作流实例ID
|
|
|
|
case 2: |
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
value = "运行人接收"; |
|
|
|
//处理来源任务
|
|
|
|
break; |
|
|
|
this.returnTicket(workTicketVo); |
|
|
|
case 3: |
|
|
|
|
|
|
|
value = "布置安全措施"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 4: |
|
|
|
|
|
|
|
value = "确认安全措施"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 5: |
|
|
|
|
|
|
|
value = "许可人许可"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 6: |
|
|
|
|
|
|
|
value = "确认工作内容执行"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 7: |
|
|
|
|
|
|
|
value = "工作负责人确认结束"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 8: |
|
|
|
|
|
|
|
value = "许可人确认结束"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 9: |
|
|
|
|
|
|
|
value = "签发人审核"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 99: |
|
|
|
|
|
|
|
value = "结束"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
log.error("getWorkTicketDescription【flowStatus】 输入的有误,请重洗输入。。。。"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 处理来源任务 |
|
|
|
* 处理来源任务 |
|
|
|
* |
|
|
|
* |
|
|
@ -738,8 +553,8 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
//班组负责人
|
|
|
|
//班组负责人
|
|
|
|
String principalName = getByPrincipal(workTicket); |
|
|
|
String principalName = getByPrincipal(workTicket); |
|
|
|
workTicket.setPrincipalName(principalName); |
|
|
|
workTicket.setPrincipalName(principalName); |
|
|
|
workTicket.setFlowStatus(FlowWorkTicketConstants.START.getStatus()); |
|
|
|
workTicket.setFlowStatus(1); |
|
|
|
workTicket.setFlowDescription(FlowWorkTicketConstants.START.getDescription()); |
|
|
|
workTicket.setStepOperator(AuthUtil.getUserId()); |
|
|
|
//唯一
|
|
|
|
//唯一
|
|
|
|
workTicket.setCreateUser(AuthUtil.getUserId()); |
|
|
|
workTicket.setCreateUser(AuthUtil.getUserId()); |
|
|
|
boolean isSave = firstWorkTicketService.save(workTicket); |
|
|
|
boolean isSave = firstWorkTicketService.save(workTicket); |
|
|
@ -805,10 +620,12 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
|
|
|
|
|
|
|
|
String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(ticketType) + PdfUtils.XLSX_SUFFIX; |
|
|
|
String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(ticketType) + PdfUtils.XLSX_SUFFIX; |
|
|
|
log.info("工作票模板为:{}", fileName); |
|
|
|
log.info("工作票模板为:{}", fileName); |
|
|
|
TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true); |
|
|
|
TemplateExportParams templateExportParams = new TemplateExportParams("template/新电气第一种工作票模板.xlsx", true); |
|
|
|
Workbook workbook = null; |
|
|
|
Workbook workbook = null; |
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
map.put("name", "你好"); |
|
|
|
try { |
|
|
|
try { |
|
|
|
workbook = ExcelUtil.getWorkbook(templateExportParams, workTicketInfoMap); |
|
|
|
workbook = ExcelExportUtil.exportExcel(templateExportParams, map); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
@ -836,12 +653,11 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket(); |
|
|
|
//1. 工作对象
|
|
|
|
//1. 工作对象
|
|
|
|
Map<String, Object> workTicketInfoMap = PdfUtils.objectToMap(workTicket); |
|
|
|
Map<String, Object> workTicketInfoMap = PdfUtils.objectToMap(workTicket); |
|
|
|
result.putAll(workTicketInfoMap); |
|
|
|
|
|
|
|
//2. 安全措施
|
|
|
|
//2. 安全措施
|
|
|
|
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); |
|
|
|
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); |
|
|
|
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { |
|
|
|
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { |
|
|
|
Map<String, List<WorkTicketSafetyMeasureEntity>> measureMap = safetyMeasuresList.stream() |
|
|
|
Map<String, List<WorkTicketSafetyMeasureEntity>> measureMap = safetyMeasuresList.stream().collect(Collectors.groupingBy(WorkTicketSafetyMeasureEntity::getType)); |
|
|
|
.collect(Collectors.groupingBy(WorkTicketSafetyMeasureEntity::getType)); |
|
|
|
|
|
|
|
Arrays.stream(WorkTicketConstants.WorkTicketMeasureTypeEnum.class.getEnumConstants()).forEach(measureEnum -> { |
|
|
|
Arrays.stream(WorkTicketConstants.WorkTicketMeasureTypeEnum.class.getEnumConstants()).forEach(measureEnum -> { |
|
|
|
if (CollectionUtil.isNotEmpty(measureMap.get(measureEnum.getType()))) { |
|
|
|
if (CollectionUtil.isNotEmpty(measureMap.get(measureEnum.getType()))) { |
|
|
|
List<Map<String, Object>> mapList = measureMap.get(measureEnum.getType()).stream().map(measureVO -> { |
|
|
|
List<Map<String, Object>> mapList = measureMap.get(measureEnum.getType()).stream().map(measureVO -> { |
|
|
@ -857,6 +673,7 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
result.putAll(workTicketInfoMap); |
|
|
|
//3. 工作票工作任务组
|
|
|
|
//3. 工作票工作任务组
|
|
|
|
List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); |
|
|
|
List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); |
|
|
|
if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) { |
|
|
|
if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) { |
|
|
@ -891,8 +708,47 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
private static <T> Map<String, Object> parseObjectMap(T target, Class clas) { |
|
|
|
private static <T> Map<String, Object> parseObjectMap(T target, Class clas) { |
|
|
|
return JSONObject.parseObject(JSONObject.toJSONString(target), Map.class); |
|
|
|
return JSONObject.parseObject(JSONObject.toJSONString(target), Map.class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException { |
|
|
|
|
|
|
|
//System.out.println(DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss").format(LocalDateTime.now()));
|
|
|
|
|
|
|
|
TemplateExportParams params = new TemplateExportParams( |
|
|
|
|
|
|
|
"template/新电气第一种工作票模板.xlsx"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
map.put("name", "你好"); |
|
|
|
|
|
|
|
// map.put("money", 2000000.00);
|
|
|
|
|
|
|
|
// map.put("upperMoney", "贰佰万");
|
|
|
|
|
|
|
|
// map.put("company", "执笔潜行科技有限公司");
|
|
|
|
|
|
|
|
// map.put("bureau", "财政局");
|
|
|
|
|
|
|
|
// map.put("person", "JueYue");
|
|
|
|
|
|
|
|
// map.put("phone", "1879740****");
|
|
|
|
|
|
|
|
// List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
|
|
|
|
|
|
|
|
// for (int i = 0; i < 4; i++) {
|
|
|
|
|
|
|
|
// Map<String, String> lm = new HashMap<String, String>();
|
|
|
|
|
|
|
|
// lm.put("id", i + 1 + "");
|
|
|
|
|
|
|
|
// lm.put("zijin", i * 10000 + "");
|
|
|
|
|
|
|
|
// lm.put("bianma", "A001");
|
|
|
|
|
|
|
|
// lm.put("mingcheng", "设计");
|
|
|
|
|
|
|
|
// lm.put("xiangmumingcheng", "EasyPoi " + i + "期");
|
|
|
|
|
|
|
|
// lm.put("quancheng", "开源项目");
|
|
|
|
|
|
|
|
// lm.put("sqje", i * 10000 + "");
|
|
|
|
|
|
|
|
// lm.put("hdje", i * 10000 + "");
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// listMap.add(lm);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// map.put("maplist", listMap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
|
|
|
|
|
|
|
FileOutputStream fos = new FileOutputStream("F:\\idea项目\\flowable\\demo\\src\\main\\resources\\新电气第一种工作票模板2" + |
|
|
|
|
|
|
|
".xlsx"); |
|
|
|
|
|
|
|
workbook.write(fos); |
|
|
|
|
|
|
|
fos.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|