09-25-修复节点完成率
This commit is contained in:
@ -111,6 +111,8 @@ public class OpsInspectionPlanVo implements Serializable {
|
|||||||
@ExcelProperty(value = "巡检项ID")
|
@ExcelProperty(value = "巡检项ID")
|
||||||
private String inspectionItemId;
|
private String inspectionItemId;
|
||||||
|
|
||||||
|
private List<OpsInspectionItemVo> itemVoList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1启用2停用
|
* 1启用2停用
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -223,7 +223,7 @@ public class OpsInspectionOrderServiceImpl implements IOpsInspectionOrderService
|
|||||||
//处理进度百分比 完成节点 / 总节点 * 100
|
//处理进度百分比 完成节点 / 总节点 * 100
|
||||||
if (nodeVoList != null && !nodeVoList.isEmpty()){
|
if (nodeVoList != null && !nodeVoList.isEmpty()){
|
||||||
//统计完成节点
|
//统计完成节点
|
||||||
int finishCount = nodeVoList.stream().filter(nodeVo -> vo.getStatus().equals("1")).toList().size();
|
int finishCount = nodeVoList.stream().filter(nodeVo -> nodeVo.getStatus().equals("1")).toList().size();
|
||||||
if (finishCount == nodeVoList.size()){
|
if (finishCount == nodeVoList.size()){
|
||||||
vo.setProgress(new BigDecimal("100"));
|
vo.setProgress(new BigDecimal("100"));
|
||||||
}else {
|
}else {
|
||||||
|
|||||||
@ -10,10 +10,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.inspection.domain.vo.OpsInspectionItemVo;
|
||||||
|
import org.dromara.inspection.mapper.OpsInspectionItemMapper;
|
||||||
import org.dromara.personnel.domain.OpsUser;
|
import org.dromara.personnel.domain.OpsUser;
|
||||||
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
||||||
import org.dromara.system.api.RemoteUserService;
|
import org.dromara.system.api.RemoteUserService;
|
||||||
|
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.web.embedded.UndertowWebServerFactoryCustomizer;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.dromara.inspection.domain.bo.OpsInspectionPlanBo;
|
import org.dromara.inspection.domain.bo.OpsInspectionPlanBo;
|
||||||
import org.dromara.inspection.domain.vo.OpsInspectionPlanVo;
|
import org.dromara.inspection.domain.vo.OpsInspectionPlanVo;
|
||||||
@ -21,6 +25,7 @@ import org.dromara.inspection.domain.OpsInspectionPlan;
|
|||||||
import org.dromara.inspection.mapper.OpsInspectionPlanMapper;
|
import org.dromara.inspection.mapper.OpsInspectionPlanMapper;
|
||||||
import org.dromara.inspection.service.IOpsInspectionPlanService;
|
import org.dromara.inspection.service.IOpsInspectionPlanService;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -38,10 +43,9 @@ public class OpsInspectionPlanServiceImpl implements IOpsInspectionPlanService {
|
|||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private RemoteUserService remoteUserService;
|
private RemoteUserService remoteUserService;
|
||||||
@Autowired
|
|
||||||
private OpsUserServiceImpl opsUserService;
|
|
||||||
|
|
||||||
private final OpsInspectionPlanMapper baseMapper;
|
private final OpsInspectionPlanMapper baseMapper;
|
||||||
|
private final OpsInspectionItemMapper itemMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询运维-巡检-计划
|
* 查询运维-巡检-计划
|
||||||
@ -155,12 +159,25 @@ public class OpsInspectionPlanServiceImpl implements IOpsInspectionPlanService {
|
|||||||
*/
|
*/
|
||||||
private void setValue(List<OpsInspectionPlanVo> list){
|
private void setValue(List<OpsInspectionPlanVo> list){
|
||||||
list.forEach(record -> {
|
list.forEach(record -> {
|
||||||
OpsUser byId = opsUserService.getById(record.getPerson());
|
List<RemoteUserVo> remoteUserVos = remoteUserService.selectListByIds(List.of(record.getPerson()));
|
||||||
if (byId != null){
|
|
||||||
record.setNickName(byId.getUserName());
|
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
|
||||||
|
record.setNickName(remoteUserVos.getFirst().getUserName());
|
||||||
}else{
|
}else{
|
||||||
record.setNickName("未知用户");
|
record.setNickName("未知用户");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (record.getInspectionItemId()!=null){
|
||||||
|
String[] itemIds = record.getInspectionItemId().split(",");
|
||||||
|
List<OpsInspectionItemVo> itemVos = new ArrayList<>();
|
||||||
|
for (String itemId : itemIds) {
|
||||||
|
OpsInspectionItemVo itemVo = itemMapper.selectVoById(itemId);
|
||||||
|
if (itemVo != null){
|
||||||
|
itemVos.add(itemVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -212,7 +212,7 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
|
|||||||
//处理进度百分比 完成节点 / 总节点 * 100
|
//处理进度百分比 完成节点 / 总节点 * 100
|
||||||
if (nodeVoList != null && !nodeVoList.isEmpty()){
|
if (nodeVoList != null && !nodeVoList.isEmpty()){
|
||||||
//统计完成节点
|
//统计完成节点
|
||||||
int finishCount = nodeVoList.stream().filter(nodeVo -> vo.getStatus().equals("1")).toList().size();
|
int finishCount = nodeVoList.stream().filter(nodeVo -> nodeVo.getStatus().equals("1")).toList().size();
|
||||||
if (finishCount == nodeVoList.size()){
|
if (finishCount == nodeVoList.size()){
|
||||||
vo.setProgress(new BigDecimal("100"));
|
vo.setProgress(new BigDecimal("100"));
|
||||||
}else {
|
}else {
|
||||||
@ -281,7 +281,11 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
|
|||||||
|
|
||||||
record.setFinishCount(String.valueOf(finishCount));
|
record.setFinishCount(String.valueOf(finishCount));
|
||||||
record.setFailCount(String.valueOf(failCount));
|
record.setFailCount(String.valueOf(failCount));
|
||||||
record.setPassValue(String.valueOf(BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(list.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))));
|
if (!list.isEmpty()) {
|
||||||
|
record.setPassValue(String.valueOf(BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(list.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))));
|
||||||
|
}else {
|
||||||
|
record.setPassValue("0");
|
||||||
|
}
|
||||||
record.setAverageTestTime(BigDecimal.valueOf((double) TimeUnit.MILLISECONDS.toMinutes(totalTestTime) / finishCount).toString());
|
record.setAverageTestTime(BigDecimal.valueOf((double) TimeUnit.MILLISECONDS.toMinutes(totalTestTime) / finishCount).toString());
|
||||||
|
|
||||||
//统计上一月的数据
|
//统计上一月的数据
|
||||||
@ -307,7 +311,12 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
|
|||||||
}
|
}
|
||||||
|
|
||||||
//完成数增长率
|
//完成数增长率
|
||||||
BigDecimal wcszzl = BigDecimal.valueOf(Double.parseDouble(record.getFinishCount())).divide(BigDecimal.valueOf(finishCount), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
BigDecimal wcszzl;
|
||||||
|
if (BigDecimal.valueOf(finishCount).compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
wcszzl = BigDecimal.valueOf(Double.parseDouble(record.getFinishCount())).divide(BigDecimal.valueOf(finishCount), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
||||||
|
}else {
|
||||||
|
wcszzl = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
record.setFinishCountAdd(wcszzl.toString());
|
record.setFinishCountAdd(wcszzl.toString());
|
||||||
|
|
||||||
//上月通过率
|
//上月通过率
|
||||||
@ -315,13 +324,23 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
|
|||||||
passValue = BigDecimal.valueOf(Double.valueOf(finishCount)).divide(BigDecimal.valueOf(lastMonth.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
passValue = BigDecimal.valueOf(Double.valueOf(finishCount)).divide(BigDecimal.valueOf(lastMonth.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
||||||
}
|
}
|
||||||
//进行比较 得出通过增长率
|
//进行比较 得出通过增长率
|
||||||
BigDecimal tgzzl = BigDecimal.valueOf(Double.parseDouble(record.getPassValue())).divide(passValue, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
BigDecimal tgzzl;
|
||||||
|
if(passValue.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
tgzzl = BigDecimal.valueOf(Double.parseDouble(record.getPassValue())).divide(passValue, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
||||||
|
}else {
|
||||||
|
tgzzl = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
record.setPassValueAdd(tgzzl.toString());
|
record.setPassValueAdd(tgzzl.toString());
|
||||||
|
|
||||||
//上月平均实验时间
|
//上月平均实验时间
|
||||||
BigDecimal sypjsj = BigDecimal.valueOf((double) TimeUnit.MILLISECONDS.toMinutes(totalTestTime) / finishCount);
|
BigDecimal sypjsj = BigDecimal.valueOf((double) TimeUnit.MILLISECONDS.toMinutes(totalTestTime) / finishCount);
|
||||||
//平均时间增长率
|
//平均时间增长率
|
||||||
BigDecimal sysjzzl = sypjsj.divide(BigDecimal.valueOf(Double.parseDouble(record.getAverageTestTime())), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
BigDecimal sysjzzl;
|
||||||
|
if (BigDecimal.valueOf(Double.parseDouble(record.getAverageTestTime())).compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
sysjzzl=sypjsj.divide(BigDecimal.valueOf(Double.parseDouble(record.getAverageTestTime())), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
||||||
|
}else {
|
||||||
|
sysjzzl = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
record.setAverageTestTimeAdd(sysjzzl.toString());
|
record.setAverageTestTimeAdd(sysjzzl.toString());
|
||||||
|
|
||||||
return R.ok(record);
|
return R.ok(record);
|
||||||
|
|||||||
Reference in New Issue
Block a user