09-23-工单纪录
This commit is contained in:
@ -6,6 +6,8 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.dromara.inspection.domain.vo.OrderRecordVo;
|
||||||
|
import org.dromara.inspection.service.impl.OpsInspectionOrderServiceImpl;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
@ -35,7 +37,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
@RequestMapping("/order")
|
@RequestMapping("/order")
|
||||||
public class OpsInspectionOrderController extends BaseController {
|
public class OpsInspectionOrderController extends BaseController {
|
||||||
|
|
||||||
private final IOpsInspectionOrderService opsInspectionOrderService;
|
private final OpsInspectionOrderServiceImpl opsInspectionOrderService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询运维-巡检-工单列表
|
* 查询运维-巡检-工单列表
|
||||||
@ -103,4 +105,13 @@ public class OpsInspectionOrderController extends BaseController {
|
|||||||
@PathVariable("ids") Long[] ids) {
|
@PathVariable("ids") Long[] ids) {
|
||||||
return toAjax(opsInspectionOrderService.deleteWithValidByIds(List.of(ids), true));
|
return toAjax(opsInspectionOrderService.deleteWithValidByIds(List.of(ids), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取纪录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("inspection:order:record")
|
||||||
|
@GetMapping("/record")
|
||||||
|
public R<OrderRecordVo> record(Long projectId) {
|
||||||
|
return opsInspectionOrderService.record(projectId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public class OpsInspectionOrder extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 文件ID
|
* 文件ID
|
||||||
*/
|
*/
|
||||||
private Long fileId;
|
private String fileId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件路径
|
* 文件路径
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class OpsInspectionOrderBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 文件ID
|
* 文件ID
|
||||||
*/
|
*/
|
||||||
private Long fileId;
|
private String fileId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件路径
|
* 文件路径
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import cn.idev.excel.annotation.ExcelProperty;
|
|||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||||
|
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -87,7 +88,7 @@ public class OpsInspectionOrderVo implements Serializable {
|
|||||||
* 文件ID
|
* 文件ID
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "文件ID")
|
@ExcelProperty(value = "文件ID")
|
||||||
private Long fileId;
|
private String fileId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件路径
|
* 文件路径
|
||||||
@ -149,7 +150,7 @@ public class OpsInspectionOrderVo implements Serializable {
|
|||||||
|
|
||||||
private Long getOrderPerson;
|
private Long getOrderPerson;
|
||||||
|
|
||||||
private OpsUserVo getOrderPersonVo;
|
private RemoteUserVo getOrderPersonVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成时间
|
* 完成时间
|
||||||
@ -169,8 +170,10 @@ public class OpsInspectionOrderVo implements Serializable {
|
|||||||
@ExcelProperty(value = "是否重点跟踪1是2否")
|
@ExcelProperty(value = "是否重点跟踪1是2否")
|
||||||
private String point;
|
private String point;
|
||||||
|
|
||||||
private Long create_by;
|
private Date createTime;
|
||||||
|
|
||||||
private OpsUserVo sendOrderPersonVo;
|
private Long createBy;
|
||||||
|
|
||||||
|
private RemoteUserVo sendOrderPersonVo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
package org.dromara.inspection.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OrderRecordVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本月派单数
|
||||||
|
*/
|
||||||
|
private String bypds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拍单数增长率
|
||||||
|
*/
|
||||||
|
private String pdzzl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平均响应时间
|
||||||
|
*/
|
||||||
|
private String pjxysj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应时间增长率
|
||||||
|
*/
|
||||||
|
private String xysjzzl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待接收工单
|
||||||
|
*/
|
||||||
|
private String djsgd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按时完成率
|
||||||
|
*/
|
||||||
|
private String aswcl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成增长率
|
||||||
|
*/
|
||||||
|
private String wczzl;
|
||||||
|
|
||||||
|
}
|
||||||
@ -103,6 +103,7 @@ public class OpsInspectionNodeServiceImpl implements IOpsInspectionNodeService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// log.info("{}", StringUtils.join(ids, ","));
|
||||||
return R.ok(StringUtils.join(ids, ","));
|
return R.ok(StringUtils.join(ids, ","));
|
||||||
}else{
|
}else{
|
||||||
return R.fail();
|
return R.fail();
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package org.dromara.inspection.service.impl;
|
package org.dromara.inspection.service.impl;
|
||||||
|
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
@ -11,24 +13,27 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.inspection.domain.OpsInspectionNode;
|
import org.dromara.inspection.domain.OpsInspectionNode;
|
||||||
import org.dromara.inspection.domain.vo.OpsInspectionNodeVo;
|
import org.dromara.inspection.domain.bo.OpsInspectionRepairBo;
|
||||||
|
import org.dromara.inspection.domain.vo.*;
|
||||||
import org.dromara.inspection.mapper.OpsInspectionNodeMapper;
|
import org.dromara.inspection.mapper.OpsInspectionNodeMapper;
|
||||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||||
import org.dromara.personnel.mapper.OpsUserMapper;
|
import org.dromara.personnel.mapper.OpsUserMapper;
|
||||||
|
import org.dromara.resource.api.RemoteFileService;
|
||||||
|
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.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.dromara.inspection.domain.bo.OpsInspectionOrderBo;
|
import org.dromara.inspection.domain.bo.OpsInspectionOrderBo;
|
||||||
import org.dromara.inspection.domain.vo.OpsInspectionOrderVo;
|
|
||||||
import org.dromara.inspection.domain.OpsInspectionOrder;
|
import org.dromara.inspection.domain.OpsInspectionOrder;
|
||||||
import org.dromara.inspection.mapper.OpsInspectionOrderMapper;
|
import org.dromara.inspection.mapper.OpsInspectionOrderMapper;
|
||||||
import org.dromara.inspection.service.IOpsInspectionOrderService;
|
import org.dromara.inspection.service.IOpsInspectionOrderService;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.time.ZoneId;
|
||||||
import java.util.Map;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运维-巡检-工单Service业务层处理
|
* 运维-巡检-工单Service业务层处理
|
||||||
@ -46,7 +51,10 @@ public class OpsInspectionOrderServiceImpl implements IOpsInspectionOrderService
|
|||||||
|
|
||||||
private final OpsInspectionNodeMapper nodeMapper;
|
private final OpsInspectionNodeMapper nodeMapper;
|
||||||
|
|
||||||
private final OpsUserMapper userMapper;
|
@DubboReference
|
||||||
|
private RemoteFileService remoteFileService;
|
||||||
|
@DubboReference
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询运维-巡检-工单
|
* 查询运维-巡检-工单
|
||||||
@ -111,6 +119,21 @@ public class OpsInspectionOrderServiceImpl implements IOpsInspectionOrderService
|
|||||||
public Boolean insertByBo(OpsInspectionOrderBo bo) {
|
public Boolean insertByBo(OpsInspectionOrderBo bo) {
|
||||||
OpsInspectionOrder add = MapstructUtils.convert(bo, OpsInspectionOrder.class);
|
OpsInspectionOrder add = MapstructUtils.convert(bo, OpsInspectionOrder.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
|
|
||||||
|
if (add.getFileId() != null){
|
||||||
|
String[] split = add.getFileId().split(",");
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
for (String s : split) {
|
||||||
|
String ossUrl = remoteFileService.selectUrlByIds(s);
|
||||||
|
if (ossUrl != null){
|
||||||
|
urls.add(ossUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String join = String.join(",", urls);
|
||||||
|
add.setFileUrl(join);
|
||||||
|
bo.setFileUrl(join);
|
||||||
|
}
|
||||||
|
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
@ -177,16 +200,16 @@ public class OpsInspectionOrderServiceImpl implements IOpsInspectionOrderService
|
|||||||
}
|
}
|
||||||
|
|
||||||
//处理派单人
|
//处理派单人
|
||||||
OpsUserVo opsUserVo = userMapper.selectVoById(vo.getCreate_by());
|
List<RemoteUserVo> remoteUserVos = remoteUserService.selectListByIds(List.of(vo.getCreateBy()));
|
||||||
if (opsUserVo != null){
|
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
|
||||||
vo.setSendOrderPersonVo(opsUserVo);
|
vo.setSendOrderPersonVo(remoteUserVos.getFirst());
|
||||||
}
|
}
|
||||||
|
|
||||||
//处理接单人
|
//处理接单人
|
||||||
if (vo.getGetOrderPerson() != null){
|
if (vo.getGetOrderPerson() != null){
|
||||||
opsUserVo = userMapper.selectVoById(vo.getGetOrderPerson());
|
remoteUserVos = remoteUserService.selectListByIds(Collections.singletonList(vo.getGetOrderPerson()));
|
||||||
if (opsUserVo != null){
|
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
|
||||||
vo.setGetOrderPersonVo(opsUserVo);
|
vo.setGetOrderPersonVo(remoteUserVos.getFirst());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,4 +229,66 @@ public class OpsInspectionOrderServiceImpl implements IOpsInspectionOrderService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取纪录
|
||||||
|
*/
|
||||||
|
public R<OrderRecordVo> record(Long projectId){
|
||||||
|
//变量初始化
|
||||||
|
OrderRecordVo recordVo = new OrderRecordVo();
|
||||||
|
|
||||||
|
OpsInspectionOrderBo bo = new OpsInspectionOrderBo();
|
||||||
|
bo.setProjectId(projectId);
|
||||||
|
//日期初始化
|
||||||
|
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()
|
||||||
|
.filter(vo -> vo.getCreateTime().after(startDate))
|
||||||
|
.filter(vo -> vo.getCreateTime().before(endDate))
|
||||||
|
.toList();
|
||||||
|
//本月派单总数
|
||||||
|
BigDecimal bypdzs = BigDecimal.valueOf(thisMonth.size());
|
||||||
|
//统计平均响应时间
|
||||||
|
Long zgxysj = 0L;//总共响应时间
|
||||||
|
for (OpsInspectionOrderVo orderVo : thisMonth) {
|
||||||
|
if (orderVo.getGetOrderTime() != null) {
|
||||||
|
zgxysj += orderVo.getGetOrderTime().getTime() - orderVo.getCreateTime().getTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//平均响应时间
|
||||||
|
BigDecimal avg = BigDecimal.valueOf(TimeUnit.MILLISECONDS.toMinutes(zgxysj));
|
||||||
|
//统计待接收工单
|
||||||
|
int waiting = thisMonth.stream().filter(vo -> vo.getStatus().equals("2")).toList().size();
|
||||||
|
//待接单数
|
||||||
|
BigDecimal djds = BigDecimal.valueOf(waiting);
|
||||||
|
//按时完成率 找到完成的工单 获取工单完成时间
|
||||||
|
|
||||||
|
//获取所有完成数
|
||||||
|
int sywcs = thisMonth.stream()
|
||||||
|
.filter(vo -> vo.getStatus().equals("4"))
|
||||||
|
.toList().size();
|
||||||
|
|
||||||
|
//获取按时完成数
|
||||||
|
int aswcs = thisMonth.stream()
|
||||||
|
.filter(vo -> vo.getStatus().equals("4"))
|
||||||
|
.filter(vo -> vo.getFinishiOrderTime().before(endDate))
|
||||||
|
.toList().size();
|
||||||
|
//按时完成率
|
||||||
|
BigDecimal aswcl;
|
||||||
|
if (sywcs > 0) {
|
||||||
|
aswcl = BigDecimal.valueOf(aswcs).divide(BigDecimal.valueOf(sywcs), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
||||||
|
}else {
|
||||||
|
aswcl = BigDecimal.valueOf(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
recordVo.setBypds(String.valueOf(bypdzs));
|
||||||
|
recordVo.setPjxysj(String.valueOf(avg));
|
||||||
|
recordVo.setDjsgd(String.valueOf(djds));
|
||||||
|
recordVo.setAswcl(String.valueOf(aswcl));
|
||||||
|
|
||||||
|
return R.ok(recordVo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user