haungxing
9 months ago
5 changed files with 179 additions and 0 deletions
@ -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); |
||||
|
||||
|
||||
|
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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("检修任务业务执行异常!"); |
||||
|
||||
} |
||||
} |
||||
} |
@ -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…
Reference in new issue