Browse Source

日常维护工作流bug处理

zhongwei
ty 12 months ago
parent
commit
4da1e70480
  1. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DealDutyRecFlowServiceImpl.java
  2. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java
  3. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java
  4. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java
  5. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java
  6. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java
  7. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java
  8. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulTaskServiceImpl.java
  9. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/MaintenanceController.java
  10. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java
  11. 26
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DealDutyRecFlowServiceImpl.java

@ -57,9 +57,12 @@ public class DealDutyRecFlowServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("交接班v4消费流程执行中,param"+response);
R dealtDutyRecFlow = iDutyRecClient.dealDutyRecFlow(response); R dealtDutyRecFlow = iDutyRecClient.dealDutyRecFlow(response);
if (!dealtDutyRecFlow.isSuccess()){ if (!dealtDutyRecFlow.isSuccess()){
log.error("消费交接班失败"+response);
throw new ServiceException("执行交接班v4失败"); throw new ServiceException("执行交接班v4失败");
} }
log.info("交接班v4消费流程结束,param"+response);
} }
} }

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java

@ -58,10 +58,12 @@ public class DefectProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("消缺工作流程消费开始---param",response);
R defect = defectClient.saveDefect(response); R defect = defectClient.saveDefect(response);
if (!defect.isSuccess()) { if (!defect.isSuccess()) {
log.error("消缺工作流程消费调取对应业务报错---param",response);
throw new ServiceException("消缺工作流程出现异常呢"); throw new ServiceException("消缺工作流程出现异常呢");
} }
log.info("消缺工作消费流程结束---param",response);
} }
} }

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java

@ -61,10 +61,12 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("水力机械工作票消费流程开始---param",response);
Boolean pending = ticketProcessService.findPending(response); Boolean pending = ticketProcessService.findPending(response);
if (!pending) { if (!pending) {
log.error("水力机械工作票消费调用报错---param",response);
throw new ServiceException("水力机械工作票流程出现异常呢"); throw new ServiceException("水力机械工作票流程出现异常呢");
} }
log.info("水力机械工作票消费流程结束---param",response);
} }
} }

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java

@ -58,9 +58,12 @@ public class MaintenanceProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("日常维护消费开始---param",response);
Boolean pending = maintenanceFeignClient.findPending(response); Boolean pending = maintenanceFeignClient.findPending(response);
if (!pending) { if (!pending) {
log.error("日常维护消费报错---param",response);
throw new ServiceException("日常维护业务流程出错呢"); throw new ServiceException("日常维护业务流程出错呢");
} }
log.info("日常维护消费结束---param",response);
} }
} }

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java

@ -66,10 +66,12 @@ public class OneTicketProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("工作票消费调用开始---param",response);
Boolean pending = ticketProcessService.findPending(response); Boolean pending = ticketProcessService.findPending(response);
if (!pending) { if (!pending) {
log.error("工作票消费调用异常---param",response);
throw new ServiceException("工作票流程出现异常呢"); throw new ServiceException("工作票流程出现异常呢");
} }
log.info("工作票消费调用结束---param",response);
} }
} }

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java

@ -62,9 +62,12 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("操作票流程消费调用fein接口开始---param",response);
Boolean pending = operationTicketFeignClient.findPending(response); Boolean pending = operationTicketFeignClient.findPending(response);
if (!pending) { if (!pending) {
log.info("操作票流程调用fein接口异常---param",response);
throw new ServiceException("操作票流程出现异常呢"); throw new ServiceException("操作票流程出现异常呢");
} }
log.info("操作票流程消费调用fein接口结束---param",response);
} }
} }

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java

@ -46,9 +46,12 @@ public class OverhaulPlanServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("检修计划调用fein消费开始---param",response);
R defect = accessPlanV4Client.listener(response); R defect = accessPlanV4Client.listener(response);
if (!defect.isSuccess()) { if (!defect.isSuccess()) {
log.error("检修计划调用fein异常---param",response);
throw new ServiceException("检修计划业务执行异常!"); throw new ServiceException("检修计划业务执行异常!");
} }
log.info("检修计划调用fein结束---param",response);
} }
} }

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulTaskServiceImpl.java

@ -47,10 +47,12 @@ public class OverhaulTaskServiceImpl extends ProcessAbstractService {
*/ */
@Override @Override
public void calculate(ProcessWorkFlowResponse response) { public void calculate(ProcessWorkFlowResponse response) {
log.info("检修计划调用fein接口消费开始---param",response);
R defect = accessTaskV4Client.listener(response); R defect = accessTaskV4Client.listener(response);
if (!defect.isSuccess()) { if (!defect.isSuccess()) {
log.error("检修计划调用fein接口消费异常---param",response);
throw new ServiceException("检修任务业务执行异常!"); throw new ServiceException("检修任务业务执行异常!");
} }
log.info("检修计划调用fein接口消费结束---param",response);
} }
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/MaintenanceController.java

@ -55,11 +55,13 @@ public class MaintenanceController {
@PostMapping("/findPending") @PostMapping("/findPending")
@ApiOperation(value = "日常维护待处理") @ApiOperation(value = "日常维护待处理")
public Boolean findPending(@RequestBody ProcessWorkFlowResponse response){ public Boolean findPending(@RequestBody ProcessWorkFlowResponse response){
log.info("日常维护消费处理开始:findPending");
try { try {
maintenanceService.findPending(response); maintenanceService.findPending(response);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("param"+response+"报错信息"+e.toString());
throw new ServiceException("日常维护待处理:" + e.getMessage()); throw new ServiceException("日常维护待处理:" + e.getMessage());
} }
} }

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java

@ -30,6 +30,7 @@ import org.springblade.flow.core.feign.IFlowClient;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.TransactionStatus;
@ -81,7 +82,7 @@ public class MaintenanceTaskCreateTask {
final static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:remind:end:tasks"; final static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:remind:end:tasks";
@XxlJob(TASK_VALUE_MAINTENANCE_TASK_CREATE) @XxlJob(TASK_VALUE_MAINTENANCE_TASK_CREATE)
@Transactional // @Transactional
public ReturnT<String> execute(String param) throws Exception { public ReturnT<String> execute(String param) throws Exception {
log.info(TASK_VALUE_MAINTENANCE_TASK_CREATE + " start...................................................................................."); log.info(TASK_VALUE_MAINTENANCE_TASK_CREATE + " start....................................................................................");
Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE); Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE);
@ -107,6 +108,9 @@ public class MaintenanceTaskCreateTask {
planEntityLambdaUpdateWrapper.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date()); planEntityLambdaUpdateWrapper.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date());
planEntityLambdaUpdateWrapper.eq(OperMaintenancePlanEntity::getId, planEntities.get(i).getId()); planEntityLambdaUpdateWrapper.eq(OperMaintenancePlanEntity::getId, planEntities.get(i).getId());
maintenancePlanService.update(planEntityLambdaUpdateWrapper); maintenancePlanService.update(planEntityLambdaUpdateWrapper);
log.info("更新任务派发"+planEntities.get(i));
}else {
log.error("更新任务派发失败"+planEntities.get(i));
} }
} }
Thread.sleep(1000); Thread.sleep(1000);
@ -123,6 +127,7 @@ public class MaintenanceTaskCreateTask {
* @return * @return
*/ */
public Boolean generateTaskByPlan(OperMaintenancePlanEntity planEntity,Boolean flag) { public Boolean generateTaskByPlan(OperMaintenancePlanEntity planEntity,Boolean flag) {
log.info("日常维护计划生成任务开始:param"+planEntity);
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(planEntity,OperMaintenanceTaskEntity.class); OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(planEntity,OperMaintenanceTaskEntity.class);
//拆分设备 每个设备生成一条任务 //拆分设备 每个设备生成一条任务
List<Long> taskIds=new ArrayList<>(); List<Long> taskIds=new ArrayList<>();

26
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java

@ -143,24 +143,26 @@ public class MaintenanceServiceImpl implements MaintenanceService {
// standardTicketInfoVo = (OperMaintenanceTaskEntityVo) jsonObject.get("operMaintenanceTaskEntityVo"); // standardTicketInfoVo = (OperMaintenanceTaskEntityVo) jsonObject.get("operMaintenanceTaskEntityVo");
// standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, OperMaintenanceTaskEntityVo.class); // standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, OperMaintenanceTaskEntityVo.class);
} catch (Exception e) { } catch (Exception e) {
log.error("获取表单出现异常了~~~~"); log.error("获取表单出现异常了~~~~"+response);
throw new IllegalArgumentException(e.getMessage()); throw new IllegalArgumentException(e.getMessage());
} }
//1.查询日常维护信息
Long id = NumberUtils.toLong(response.getBusinessKey());
OperMaintenanceTaskEntity dbOperMaintenanceTaskEntity = taskService.getById(id);
if (ObjectUtils.isEmpty(dbOperMaintenanceTaskEntity)) {
log.error("获取日常维护数据不存在");
return;
}
OperMaintenanceTaskEntity entity = new OperMaintenanceTaskEntity(); OperMaintenanceTaskEntity entity = new OperMaintenanceTaskEntity();
BeanUtils.copyProperties(standardTicketInfoVo, entity); BeanUtils.copyProperties(standardTicketInfoVo, entity);
entity.setId(id); //1.查询日常维护信息
//有Id才进行生成操作
if (StringUtils.isNotBlank(response.getBusinessKey())) {
Long id = NumberUtils.toLong(response.getBusinessKey());
OperMaintenanceTaskEntity dbOperMaintenanceTaskEntity = taskService.getById(id);
if (ObjectUtils.isEmpty(dbOperMaintenanceTaskEntity)) {
log.error("获取日常维护数据不存在" + response);
return;
}
entity.setId(id);
//填充日常维护信息 //填充日常维护信息
saveOperMaintenanceTaskEntity(entity, response); saveOperMaintenanceTaskEntity(entity, response);
entity.setProcessInstanceId(response.getProcessInstanceId()); entity.setProcessInstanceId(response.getProcessInstanceId());
taskService.updateById(entity); taskService.updateById(entity);
//推送消息 //推送消息
if (response.getTaskId() != null) { if (response.getTaskId() != null) {
// MessagePushRecordDto message = new MessagePushRecordDto(); // MessagePushRecordDto message = new MessagePushRecordDto();
@ -225,8 +227,10 @@ public class MaintenanceServiceImpl implements MaintenanceService {
} }
log.info("推送成功~"); log.info("推送成功~");
} }
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("日常维护消费异常:param"+response+"报错信息"+e);
} }
} }
@ -310,7 +314,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* @param finalPlanEntity * @param finalPlanEntity
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public Long fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity, Boolean flag) { public Long fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity, Boolean flag) {
// DefaultTransactionDefinition = new DefaultTransactionDefinition(); // DefaultTransactionDefinition = new DefaultTransactionDefinition();
// defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);

Loading…
Cancel
Save