|
@@ -1,7 +1,36 @@
|
|
|
package cn.iocoder.yudao.module.pms.service.iotopeationfill;
|
|
package cn.iocoder.yudao.module.pms.service.iotopeationfill;
|
|
|
|
|
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
|
+import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_OPEATION_FILL_NOT_EXISTS;
|
|
|
|
|
+
|
|
|
|
|
+import java.security.SecureRandom;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.Collection;
|
|
|
|
|
+import java.util.HashSet;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
+import java.util.Set;
|
|
|
|
|
+import java.util.StringJoiner;
|
|
|
|
|
+import java.util.function.Function;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
+
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmodeltemplateattrs.vo.IotModelTemplateAttrsRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmodeltemplateattrs.vo.IotModelTemplateAttrsRespVO;
|
|
|
-import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.*;
|
|
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillSaveReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOperationRecordPageVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotcountdata.IotCountDataDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotcountdata.IotCountDataDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecountdata.IotDeviceCountData;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicecountdata.IotDeviceCountData;
|
|
@@ -12,24 +41,6 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFil
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillOrderMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillOrderMapper;
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
|
|
-
|
|
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
-
|
|
|
|
|
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-import java.security.SecureRandom;
|
|
|
|
|
-import java.util.*;
|
|
|
|
|
-import java.util.function.Function;
|
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
-
|
|
|
|
|
-import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
|
-import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_OPEATION_FILL_NOT_EXISTS;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 运行记录填报 Service 实现类
|
|
* 运行记录填报 Service 实现类
|
|
@@ -113,7 +124,6 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
return iotOpeationFillMapper.selectPage(pageReqVO);
|
|
return iotOpeationFillMapper.selectPage(pageReqVO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<IotOpeationFillDO> getFillDevices(List<Long> deviceIds) {
|
|
public List<IotOpeationFillDO> getFillDevices(List<Long> deviceIds) {
|
|
|
return iotOpeationFillMapper.getFillDevices(deviceIds);
|
|
return iotOpeationFillMapper.getFillDevices(deviceIds);
|
|
@@ -122,9 +132,6 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<IotModelTemplateAttrsDO> getAttrsById(IotModelTemplateAttrsRespVO vo) {
|
|
public List<IotModelTemplateAttrsDO> getAttrsById(IotModelTemplateAttrsRespVO vo) {
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
return iotOpeationFillMapper.getAttrsById(vo);
|
|
return iotOpeationFillMapper.getAttrsById(vo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -153,19 +160,20 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
return iotOpeationFillMapper.selectRhFillReports(deptId, reportDateStr);
|
|
return iotOpeationFillMapper.selectRhFillReports(deptId, reportDateStr);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public PageResult<IotOpeationFillOrderDO> fillRecords(IotOpeationFillPageReqVO vo) {
|
|
public PageResult<IotOpeationFillOrderDO> fillRecords(IotOpeationFillPageReqVO vo) {
|
|
|
- IPage<IotOpeationFillOrderDO> fillOrderDOIPage = iotOpeationFillMapper.fillRecords(Page.of(vo.getPageNo(), vo.getPageSize()),vo.getDeviceId(),vo.getOrderName(),vo.getOrderStatus());
|
|
|
|
|
- return new PageResult<>(fillOrderDOIPage.getRecords(),fillOrderDOIPage.getTotal());
|
|
|
|
|
|
|
+ IPage<IotOpeationFillOrderDO> fillOrderDOIPage = iotOpeationFillMapper.fillRecords(
|
|
|
|
|
+ Page.of(vo.getPageNo(), vo.getPageSize()), vo.getDeviceId(), vo.getOrderName(), vo.getOrderStatus());
|
|
|
|
|
+ return new PageResult<>(fillOrderDOIPage.getRecords(), fillOrderDOIPage.getTotal());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public PageResult<IotOpeationFillDO> fillListPage(IotOpeationFillPageVO vo) {
|
|
public PageResult<IotOpeationFillDO> fillListPage(IotOpeationFillPageVO vo) {
|
|
|
|
|
|
|
|
- IPage<IotOpeationFillDO> fillPage = iotOpeationFillMapper.fillListPage(Page.of(vo.getPageNo(), vo.getPageSize()),vo.getOrderId());
|
|
|
|
|
|
|
+ IPage<IotOpeationFillDO> fillPage = iotOpeationFillMapper
|
|
|
|
|
+ .fillListPage(Page.of(vo.getPageNo(), vo.getPageSize()), vo.getOrderId());
|
|
|
|
|
|
|
|
- return new PageResult<>(fillPage.getRecords(),fillPage.getTotal());
|
|
|
|
|
|
|
+ return new PageResult<>(fillPage.getRecords(), fillPage.getTotal());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -175,8 +183,8 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
List<IotOpeationFillDO> fills = iotOpeationFillMapper.fills(deviceIds);
|
|
List<IotOpeationFillDO> fills = iotOpeationFillMapper.fills(deviceIds);
|
|
|
- if(fills.size()>0){
|
|
|
|
|
- iotOpeationFillMapper.upFill(deptId,deviceIds);
|
|
|
|
|
|
|
+ if (fills.size() > 0) {
|
|
|
|
|
+ iotOpeationFillMapper.upFill(deptId, deviceIds);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -217,12 +225,9 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
fillRespVO.setDeptId(vo.getDeptId());
|
|
fillRespVO.setDeptId(vo.getDeptId());
|
|
|
List<IotOpeationFillDO> fillList = iotOpeationFillMapper.getOrderIds(fillRespVO);
|
|
List<IotOpeationFillDO> fillList = iotOpeationFillMapper.getOrderIds(fillRespVO);
|
|
|
List<Long> orderIds = fillList.stream().map(IotOpeationFillDO::getOrderId).collect(Collectors.toList());
|
|
List<Long> orderIds = fillList.stream().map(IotOpeationFillDO::getOrderId).collect(Collectors.toList());
|
|
|
- return iotOpeationFillOrderMapper.selectPage1(vo,deptIds,orderIds);
|
|
|
|
|
|
|
+ return iotOpeationFillOrderMapper.selectPage1(vo, deptIds, orderIds);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public int insertLog(List<IotDeviceRunLogDO> logDO) {
|
|
public int insertLog(List<IotDeviceRunLogDO> logDO) {
|
|
|
return iotOpeationFillMapper.insertLog(logDO);
|
|
return iotOpeationFillMapper.insertLog(logDO);
|
|
@@ -313,27 +318,26 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
return iotOpeationFillMapper.delRepeatOrder(fillDO);
|
|
return iotOpeationFillMapper.delRepeatOrder(fillDO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public PageResult<IotDeviceRespVO> getFillDevices1(IotOpeationFillPageReqVO vo) {
|
|
public PageResult<IotDeviceRespVO> getFillDevices1(IotOpeationFillPageReqVO vo) {
|
|
|
|
|
|
|
|
Set<Long> idList = new HashSet<>();
|
|
Set<Long> idList = new HashSet<>();
|
|
|
- if(Objects.nonNull(vo.getDeptId())){
|
|
|
|
|
- idList = deptService.getChildDeptIdListFromCache(vo.getDeptId());
|
|
|
|
|
|
|
+ if (Objects.nonNull(vo.getDeptId())) {
|
|
|
|
|
+ idList = deptService.getChildDeptIdListFromCache(vo.getDeptId());
|
|
|
idList.add(vo.getDeptId());
|
|
idList.add(vo.getDeptId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- IPage<IotDeviceRespVO> fillOrderDOIPage = iotOpeationFillMapper.getFillDevices1(Page.of(vo.getPageNo(), vo.getPageSize()), idList);
|
|
|
|
|
- return new PageResult<>(fillOrderDOIPage.getRecords(),fillOrderDOIPage.getTotal());
|
|
|
|
|
|
|
+ IPage<IotDeviceRespVO> fillOrderDOIPage = iotOpeationFillMapper
|
|
|
|
|
+ .getFillDevices1(Page.of(vo.getPageNo(), vo.getPageSize()), idList);
|
|
|
|
|
+ return new PageResult<>(fillOrderDOIPage.getRecords(), fillOrderDOIPage.getTotal());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public PageResult<IotDeviceCountData> deviceCountList(IotOpeationFillPageReqVO vo) {
|
|
public PageResult<IotDeviceCountData> deviceCountList(IotOpeationFillPageReqVO vo) {
|
|
|
- IPage<IotDeviceCountData> countDataIPage = iotOpeationFillMapper.deviceCountList(Page.of(vo.getPageNo(),vo.getPageSize()),
|
|
|
|
|
- vo.getDeptId(),vo.getCreateTime(),vo.getIsFill(),vo.getOrderName());
|
|
|
|
|
- return new PageResult<>(countDataIPage.getRecords(),countDataIPage.getTotal());
|
|
|
|
|
|
|
+ IPage<IotDeviceCountData> countDataIPage = iotOpeationFillMapper.deviceCountList(
|
|
|
|
|
+ Page.of(vo.getPageNo(), vo.getPageSize()),
|
|
|
|
|
+ vo.getDeptId(), vo.getCreateTime(), vo.getIsFill(), vo.getOrderName());
|
|
|
|
|
+ return new PageResult<>(countDataIPage.getRecords(), countDataIPage.getTotal());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -350,23 +354,20 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
public List<IotOpeationFillDO> reportMethod(List<IotOpeationFillOrderDO> orderList) {
|
|
public List<IotOpeationFillDO> reportMethod(List<IotOpeationFillOrderDO> orderList) {
|
|
|
List<IotOpeationFillDO> devList = new ArrayList<>();
|
|
List<IotOpeationFillDO> devList = new ArrayList<>();
|
|
|
|
|
|
|
|
-
|
|
|
|
|
Set<Long> rhIdList = deptService.getChildDeptIdListFromCache(157L);
|
|
Set<Long> rhIdList = deptService.getChildDeptIdListFromCache(157L);
|
|
|
rhIdList.add(157L);
|
|
rhIdList.add(157L);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- Set<Long> ryIdList = deptService.getChildDeptIdListFromCache(158L);
|
|
|
|
|
|
|
+ Set<Long> ryIdList = deptService.getChildDeptIdListFromCache(158L);
|
|
|
ryIdList.add(158L);
|
|
ryIdList.add(158L);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- //判断工单主数据是否有值
|
|
|
|
|
- if(orderList.size()>0){
|
|
|
|
|
- //遍历工单主数据,根据dept_id查询是否为小队
|
|
|
|
|
- for (IotOpeationFillOrderDO orderDO:orderList) {
|
|
|
|
|
|
|
+ // 判断工单主数据是否有值
|
|
|
|
|
+ if (orderList.size() > 0) {
|
|
|
|
|
+ // 遍历工单主数据,根据dept_id查询是否为小队
|
|
|
|
|
+ for (IotOpeationFillOrderDO orderDO : orderList) {
|
|
|
|
|
|
|
|
IotDeviceRunLogDO runLogDO = new IotDeviceRunLogDO();
|
|
IotDeviceRunLogDO runLogDO = new IotDeviceRunLogDO();
|
|
|
runLogDO.setDeptId(orderDO.getDeptId());
|
|
runLogDO.setDeptId(orderDO.getDeptId());
|
|
|
- //获取队伍类型
|
|
|
|
|
|
|
+ // 获取队伍类型
|
|
|
IotDeviceRunLogDO teamType = iotOpeationFillMapper.getTeamType(runLogDO);
|
|
IotDeviceRunLogDO teamType = iotOpeationFillMapper.getTeamType(runLogDO);
|
|
|
|
|
|
|
|
List<IotOpeationFillOrderDO> childList = iotOpeationFillMapper.childList(orderDO);
|
|
List<IotOpeationFillOrderDO> childList = iotOpeationFillMapper.childList(orderDO);
|
|
@@ -384,20 +385,19 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
exitDev = iotOpeationFillMapper.orderDO1(fillDO);
|
|
exitDev = iotOpeationFillMapper.orderDO1(fillDO);
|
|
|
} while (exitDev != null); // 如果存在则继续循环生成新的随机数
|
|
} while (exitDev != null); // 如果存在则继续循环生成新的随机数
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- //如果是小队,则证明该部门为小队,创建对应日报虚拟设备
|
|
|
|
|
- if(childList.size()==0){
|
|
|
|
|
|
|
+ // 如果是小队,则证明该部门为小队,创建对应日报虚拟设备
|
|
|
|
|
+ if (childList.size() == 0) {
|
|
|
IotOpeationFillDO devOrder = new IotOpeationFillDO();
|
|
IotOpeationFillDO devOrder = new IotOpeationFillDO();
|
|
|
devOrder.setDeviceCode("");
|
|
devOrder.setDeviceCode("");
|
|
|
devOrder.setDeviceName("生产日报");
|
|
devOrder.setDeviceName("生产日报");
|
|
|
|
|
|
|
|
- if(rhIdList.contains(orderDO.getDeptId())){
|
|
|
|
|
|
|
+ if (rhIdList.contains(orderDO.getDeptId())) {
|
|
|
devOrder.setDeviceCategoryId(RH_CLASS_ID);
|
|
devOrder.setDeviceCategoryId(RH_CLASS_ID);
|
|
|
- }else if(ryIdList.contains(orderDO.getDeptId())&&teamType!=null){
|
|
|
|
|
- //队伍类型为zj则日报设备分类为钻井,否则为修井
|
|
|
|
|
- if(teamType.getPointCode().equals("zj")){
|
|
|
|
|
|
|
+ } else if (ryIdList.contains(orderDO.getDeptId()) && teamType != null) {
|
|
|
|
|
+ // 队伍类型为zj则日报设备分类为钻井,否则为修井
|
|
|
|
|
+ if (teamType.getPointCode().equals("zj")) {
|
|
|
devOrder.setDeviceCategoryId(RY_ZJ_CLASS_ID);
|
|
devOrder.setDeviceCategoryId(RY_ZJ_CLASS_ID);
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
devOrder.setDeviceCategoryId(RY_XJ_CLASS_ID);
|
|
devOrder.setDeviceCategoryId(RY_XJ_CLASS_ID);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -415,16 +415,16 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
return devList;
|
|
return devList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// 使用SecureRandom确保随机数的安全性
|
|
// 使用SecureRandom确保随机数的安全性
|
|
|
private static final SecureRandom random = new SecureRandom();
|
|
private static final SecureRandom random = new SecureRandom();
|
|
|
|
|
|
|
|
// 8位数字的最小值和最大值
|
|
// 8位数字的最小值和最大值
|
|
|
- private static final int MIN_8_DIGIT = 10000000; // 最小的8位整数
|
|
|
|
|
- private static final int MAX_8_DIGIT = 99999999; // 最大的8位整数
|
|
|
|
|
|
|
+ private static final int MIN_8_DIGIT = 10000000; // 最小的8位整数
|
|
|
|
|
+ private static final int MAX_8_DIGIT = 99999999; // 最大的8位整数
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 生成8位整型随机数
|
|
* 生成8位整型随机数
|
|
|
|
|
+ *
|
|
|
* @return 8位整数(范围:10000000 - 99999999)
|
|
* @return 8位整数(范围:10000000 - 99999999)
|
|
|
*/
|
|
*/
|
|
|
public static int generate8DigitInteger() {
|
|
public static int generate8DigitInteger() {
|
|
@@ -432,8 +432,6 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
return MIN_8_DIGIT + random.nextInt(MAX_8_DIGIT - MIN_8_DIGIT + 1);
|
|
return MIN_8_DIGIT + random.nextInt(MAX_8_DIGIT - MIN_8_DIGIT + 1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public IotOpeationFillDO isReport(IotOpeationFillDO fillDO) {
|
|
public IotOpeationFillDO isReport(IotOpeationFillDO fillDO) {
|
|
|
return iotOpeationFillMapper.isReport(fillDO);
|
|
return iotOpeationFillMapper.isReport(fillDO);
|
|
@@ -517,8 +515,7 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
// Value 映射:替换为你的实际字段 getter(如 getIsReport()、getStatus())
|
|
// Value 映射:替换为你的实际字段 getter(如 getIsReport()、getStatus())
|
|
|
IotOpeationFillDO::getIsReport,
|
|
IotOpeationFillDO::getIsReport,
|
|
|
// 冲突解决策略(可选):若 Key 重复,取第一个值(或自定义逻辑)
|
|
// 冲突解决策略(可选):若 Key 重复,取第一个值(或自定义逻辑)
|
|
|
- (v1, v2) -> v1
|
|
|
|
|
- ));
|
|
|
|
|
|
|
+ (v1, v2) -> v1));
|
|
|
return map;
|
|
return map;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -550,10 +547,11 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
// 第一个参数:Map 的 Key(取自 DO 的 Long 字段)
|
|
// 第一个参数:Map 的 Key(取自 DO 的 Long 字段)
|
|
|
// 第二个参数:Map 的 Value(DO 本身)
|
|
// 第二个参数:Map 的 Value(DO 本身)
|
|
|
.collect(Collectors.toMap(
|
|
.collect(Collectors.toMap(
|
|
|
- IotOpeationFillDO::getDeviceId, // 示例:用 id 作为 Key,替换为实际字段(如 getOrderId())
|
|
|
|
|
- Function.identity(), // Value:DO本身(简化写法)
|
|
|
|
|
- (oldValue, newValue) -> oldValue // 重复Key时保留旧值(核心修复点)
|
|
|
|
|
- // 可选:如需保留新值,改为 (oldValue, newValue) -> newValue // Value 直接是 DO 实例(可简化为 Function.identity())
|
|
|
|
|
|
|
+ IotOpeationFillDO::getDeviceId, // 示例:用 id 作为 Key,替换为实际字段(如 getOrderId())
|
|
|
|
|
+ Function.identity(), // Value:DO本身(简化写法)
|
|
|
|
|
+ (oldValue, newValue) -> oldValue // 重复Key时保留旧值(核心修复点)
|
|
|
|
|
+ // 可选:如需保留新值,改为 (oldValue, newValue) -> newValue // Value 直接是 DO 实例(可简化为
|
|
|
|
|
+ // Function.identity())
|
|
|
));
|
|
));
|
|
|
return fillDOMap;
|
|
return fillDOMap;
|
|
|
}
|
|
}
|
|
@@ -563,4 +561,58 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
|
|
|
return iotOpeationFillMapper.reportList2(fillDO);
|
|
return iotOpeationFillMapper.reportList2(fillDO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public PageResult<IotOpeationFillOrderDO> getOperationRecordPage(Set<Long> deptIds,
|
|
|
|
|
+ IotOperationRecordPageVO vo) {
|
|
|
|
|
+ if (deptIds.isEmpty()) {
|
|
|
|
|
+ return PageResult.empty();
|
|
|
|
|
+ }
|
|
|
|
|
+ PageResult<IotOpeationFillOrderDO> records = iotOpeationFillOrderMapper.selectPage(vo, deptIds);
|
|
|
|
|
+ if (records.getList().isEmpty()) {
|
|
|
|
|
+ return records;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<Long> recordIds = records.getList().stream()
|
|
|
|
|
+ .map(IotOpeationFillOrderDO::getId)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ List<IotOpeationFillDO> fills = iotOpeationFillMapper.selectListByOrderIds(recordIds);
|
|
|
|
|
+ Map<Long, List<IotOpeationFillDO>> fillsByOrderId = fills.stream()
|
|
|
|
|
+ .collect(Collectors.groupingBy(IotOpeationFillDO::getOrderId));
|
|
|
|
|
+
|
|
|
|
|
+ for (IotOpeationFillOrderDO record : records.getList()) {
|
|
|
|
|
+ if (record.getCreateTime() != null && record.getUpdateTime() != null
|
|
|
|
|
+ && record.getCreateTime().isEqual(record.getUpdateTime())) {
|
|
|
|
|
+ record.setUpdateTime(null);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<IotOpeationFillDO> orderFills = fillsByOrderId.get(record.getId());
|
|
|
|
|
+ if (orderFills == null || orderFills.isEmpty()) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ StringJoiner devices = new StringJoiner(", ");
|
|
|
|
|
+ int allDev = 0;
|
|
|
|
|
+ int fillDev = 0;
|
|
|
|
|
+ int unFillDev = 0;
|
|
|
|
|
+ for (IotOpeationFillDO fill : orderFills) {
|
|
|
|
|
+ devices.add(fill.getDeviceCode() + "/" + fill.getDeviceName());
|
|
|
|
|
+ // 与 page1 保持一致:日报虚拟设备不参与设备数量统计
|
|
|
|
|
+ if (fill.getDeviceName() != null && !"日报填报".equals(fill.getDeviceName())) {
|
|
|
|
|
+ allDev++;
|
|
|
|
|
+ if (fill.getIsFill() == 1) {
|
|
|
|
|
+ fillDev++;
|
|
|
|
|
+ } else if (fill.getIsFill() == 0) {
|
|
|
|
|
+ unFillDev++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ record.setFillList(devices.toString());
|
|
|
|
|
+ record.setAllDev(allDev);
|
|
|
|
|
+ record.setFillDev(fillDev);
|
|
|
|
|
+ record.setUnFillDev(unFillDev);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return records;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|