09-23-完成工单纪录

This commit is contained in:
2025-09-24 14:47:54 +08:00
parent 56f6c9a446
commit 4a810f3aef
2 changed files with 87 additions and 2 deletions

View File

@ -8,6 +8,8 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import java.util.Date;
/**
@ -122,6 +124,16 @@ public class OpsInspectionOrderBo extends BaseEntity {
*/
private Date getOrderTime;
/**
* 接单人
*/
private Long getOrderPerson;
/**
* 接单人信息
*/
private RemoteUserVo getOrderPersonVo;
/**
* 完成时间
*/

View File

@ -185,9 +185,13 @@ public class OpsInspectionOrderServiceImpl implements IOpsInspectionOrderService
for (OpsInspectionOrderVo vo : list) {
List<String> split = Arrays.stream(vo.getNodeIds().split(",")).toList();
nodeWrapper.clear();
nodeWrapper.eq(OpsInspectionNode::getOrderId, vo.getId());
nodeWrapper.in(OpsInspectionNode::getId, split);
List<OpsInspectionNodeVo> nodeVoList = nodeMapper.selectVoList(nodeWrapper);
//处理进度百分比 完成节点 / 总节点 * 100
if (nodeVoList != null && !nodeVoList.isEmpty()){
//统计完成节点
@ -241,7 +245,7 @@ public class OpsInspectionOrderServiceImpl implements IOpsInspectionOrderService
//日期初始化
Date startDate = Date.from(LocalDate.now().withDayOfMonth(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
Date endDate = Date.from(LocalDate.now().withDayOfMonth(1).plusMonths(1).minusDays(1).atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
//查询当前项目的本月数据
//查询当前项目的数据
List<OpsInspectionOrderVo> vos = queryList(bo);
//过滤本月数据
List<OpsInspectionOrderVo> thisMonth = vos.stream()
@ -288,6 +292,75 @@ public class OpsInspectionOrderServiceImpl implements IOpsInspectionOrderService
recordVo.setDjsgd(String.valueOf(djds));
recordVo.setAswcl(String.valueOf(aswcl));
//获取上月数据列表
Date finalStartDate = Date.from(LocalDate.now().minusMonths(1).withDayOfMonth(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
Date finalEndDate = Date.from(LocalDate.now().minusMonths(1).withDayOfMonth(1).plusMonths(1).minusDays(1).atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
thisMonth = vos.stream()
.filter(vo -> vo.getCreateTime().after(finalStartDate))
.filter(vo -> vo.getCreateTime().before(finalEndDate))
.toList();
//上月派单总数
BigDecimal sypdzs = BigDecimal.valueOf(thisMonth.size());
//统计上月平均响应时间
zgxysj = 0L;//总共响应时间
for (OpsInspectionOrderVo orderVo : thisMonth) {
if (orderVo.getGetOrderTime() != null) {
zgxysj += orderVo.getGetOrderTime().getTime() - orderVo.getCreateTime().getTime();
}
}
//上月平均响应时间
BigDecimal syavg = BigDecimal.valueOf(TimeUnit.MILLISECONDS.toMinutes(zgxysj));
//获取上月所有完成数
int sysywcs = thisMonth.stream()
.filter(vo -> vo.getStatus().equals("4"))
.toList().size();
//获取上月按时完成数
int syaswcs = thisMonth.stream()
.filter(vo -> vo.getStatus().equals("4"))
.filter(vo -> vo.getFinishiOrderTime().before(finalEndDate))
.toList().size();
//上月按时完成率
BigDecimal syaswcl;
if (sywcs > 0) {
syaswcl = BigDecimal.valueOf(syaswcs).divide(BigDecimal.valueOf(sysywcs), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
}else {
syaswcl = BigDecimal.valueOf(0);
}
//本月完成 / 上月完成 * 100 = 增长率
BigDecimal wczzl;
if (syaswcl.compareTo(BigDecimal.ZERO) > 0) {
wczzl = BigDecimal.valueOf(Double.parseDouble(recordVo.getAswcl())).divide(syaswcl, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
}else {
wczzl = BigDecimal.valueOf(0);
}
//上月完成率增长率
recordVo.setWczzl(wczzl.toString());
//派单增长率
BigDecimal pdzzl;
if (sypdzs.compareTo(BigDecimal.ZERO) > 0) {
pdzzl = BigDecimal.valueOf(Double.parseDouble(recordVo.getBypds())).divide(sypdzs, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
}else {
pdzzl = BigDecimal.valueOf(0);
}
recordVo.setPdzzl(pdzzl.toString());
//响应时间增长率
BigDecimal xysjzzl;
if (BigDecimal.valueOf(Double.parseDouble(recordVo.getPjxysj())).compareTo(BigDecimal.ZERO) > 0){
xysjzzl = syavg.divide(BigDecimal.valueOf(Double.parseDouble(recordVo.getPjxysj())), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
}else {
xysjzzl = BigDecimal.ZERO;
}
recordVo.setXysjzzl(xysjzzl.toString());
return R.ok(recordVo);
}