
4 changed files with 118 additions and 10 deletions
@ -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.operational.duty.feign.IDutyRecClient; |
||||||
|
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.DUTY_REC; |
||||||
|
|
||||||
|
/** |
||||||
|
* 日常排班 |
||||||
|
* |
||||||
|
* @Author WL |
||||||
|
* @Version v1.0 |
||||||
|
* @Serial 1.0 |
||||||
|
* @Date 2023/7/26 9:04 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class DealDutyRecFlowServiceImpl extends ProcessAbstractService { |
||||||
|
|
||||||
|
|
||||||
|
private final ProcessDictService processDictService; |
||||||
|
|
||||||
|
|
||||||
|
private final IDutyRecClient iDutyRecClient; |
||||||
|
|
||||||
|
/** |
||||||
|
* 设置执行那种实现类 |
||||||
|
* |
||||||
|
* @param flowQueue |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { |
||||||
|
String dictValue = processDictService.selectDictValueByKey(DUTY_REC); |
||||||
|
if (dictValue.equals(flowQueue.getProcessDefinitionKey())) { |
||||||
|
log.info("已执行值班计划程环节操作~~~~"); |
||||||
|
return true; |
||||||
|
} |
||||||
|
log.error("未执行值班计划工作流流程环节操作,请联系管理员~~~~"); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 日常维护业务方法 |
||||||
|
* |
||||||
|
* @param response |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public void calculate(ProcessWorkFlowResponse response) { |
||||||
|
R dealtDutyRecFlow = iDutyRecClient.dealDutyRecFlow(response); |
||||||
|
if (!dealtDutyRecFlow.isSuccess()){ |
||||||
|
throw new ServiceException("执行值班计划失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package com.hnac.hzims.ticket.utils; |
||||||
|
|
||||||
|
import java.math.BigDecimal; |
||||||
|
import java.text.NumberFormat; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author WL |
||||||
|
* @Version v1.0 |
||||||
|
* @Serial 1.0 |
||||||
|
* @Date 2023/7/26 8:01 |
||||||
|
*/ |
||||||
|
public class PercentCountUtils { |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算百分比 |
||||||
|
* @param x |
||||||
|
* @param y |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String getPercent(int x, int y) { |
||||||
|
double d1 = x * 1.0; |
||||||
|
double d2 = y * 1.0; |
||||||
|
NumberFormat percentInstance = NumberFormat.getPercentInstance(); |
||||||
|
// 设置保留几位小数,这里设置的是保留两位小数
|
||||||
|
percentInstance.setMinimumFractionDigits(2); |
||||||
|
return percentInstance.format(d1 / d2); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue