Browse Source

隐患代码迁移

zhongwei
ty 9 months ago
parent
commit
d69fe57d24
  1. 10
      hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java
  2. 31
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/feign/ISafeInnerDangerClient.java
  3. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/feign/ISafeInnerDangerClientFallback.java
  4. 52
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/HazardRiskServiceImpl.java
  5. 65
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/HiddenDangerFlowServiceImpl.java

10
hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java

@ -64,4 +64,14 @@ public class TicketProcessConstant {
* 线下工作票 * 线下工作票
*/ */
public static final String OFFLINE_WORK_TICKET = "offlineWorkTicket"; public static final String OFFLINE_WORK_TICKET = "offlineWorkTicket";
/**
* 隐患流程标识
*/
public static final String HIDDEN_DANGER_CHECK = "hiddenDangerCheck";
/**
* 风险排查标识
*/
public static final String HAZARD_RISK = "hazard_risk";
} }

31
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/feign/ISafeInnerDangerClient.java

@ -0,0 +1,31 @@
package com.hnac.hzims.safeproduct.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.safeproduct.Constants;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @author xiashandong
* @created 2021/6/10 15:21
**/
@FeignClient(
value = Constants.APP_NAME,
fallback = ISafeInnerDangerClientFallback.class
)
public interface ISafeInnerDangerClient {
String API_PREFIX = "/feign/hiddenDangerStart";
String SAVE_HIDDENDANGER = API_PREFIX + "/saveHiddenDanger";
@PostMapping(SAVE_HIDDENDANGER)
R saveDefect(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse);
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/feign/ISafeInnerDangerClientFallback.java

@ -0,0 +1,21 @@
package com.hnac.hzims.safeproduct.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Component;
/**
* @author ysj
*/
@Slf4j
@Component
public class ISafeInnerDangerClientFallback implements ISafeInnerDangerClient {
@Override
public R saveDefect(ProcessWorkFlowResponse processWorkFlowResponse) {
log.error("远程调用失败,接口:" + SAVE_HIDDENDANGER);
return null;
}
}

52
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/HazardRiskServiceImpl.java

@ -0,0 +1,52 @@
package com.hnac.hzims.middle.processflow.strategy.serviceimpl;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.service.ProcessDictService;
import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.safeproduct.risk.feign.IHazardRiskClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.HAZARD_RISK;
/**
* @author ysj
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class HazardRiskServiceImpl extends ProcessAbstractService {
private final IHazardRiskClient hazardRiskClient;
private final ProcessDictService processDictService;
/**
* 消息确认
* @param flowQueue
* @return
*/
@Override
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
String dictValue = processDictService.selectDictValueByKey(HAZARD_RISK);
return dictValue.equals(flowQueue.getProcessDefinitionKey());
}
/**
* 调用检修业务处理
* @param response
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
R defect = hazardRiskClient.listener(response);
if (!defect.isSuccess()) {
throw new ServiceException("检修任务业务执行异常!");
}
}
}

65
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/HiddenDangerFlowServiceImpl.java

@ -0,0 +1,65 @@
package com.hnac.hzims.middle.processflow.strategy.serviceimpl;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.service.ProcessDictService;
import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.safeproduct.feign.ISafeInnerDangerClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.HIDDEN_DANGER_CHECK;
/**
* 隐患排查
*
* @Author ty
* @Version v1.0
* @Serial 1.0
* @Date 2023/9/18 9:04
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class HiddenDangerFlowServiceImpl extends ProcessAbstractService {
private final ProcessDictService processDictService;
private final ISafeInnerDangerClient iSafeInnerDangerClient;
/**
* 设置执行那种实现类
*
* @param flowQueue
* @return
*/
@Override
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
String dictValue = processDictService.selectDictValueByKey(HIDDEN_DANGER_CHECK);
if (dictValue.equals(flowQueue.getProcessDefinitionKey())) {
log.info("已执行隐患排查工作流程环节操作~~~~");
return true;
}
log.error("未执行隐患排查流程环节操作,请联系管理员~~~~");
return false;
}
/**
* 隐患排查业务方法
*
* @param response
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
R dealtDutyRecFlow = iSafeInnerDangerClient.saveDefect(response);
if (!dealtDutyRecFlow.isSuccess()){
throw new ServiceException("隐患排查流程失败");
}
}
}
Loading…
Cancel
Save