فهرست منبع

pms 瑞恒 日报 列表 产能

zhangcl 2 هفته پیش
والد
کامیت
ad4f29578f

+ 7 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrhdailyreport/IotRhDailyReportController.java

@@ -36,6 +36,7 @@ import javax.validation.Valid;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 
 import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -167,6 +168,8 @@ public class IotRhDailyReportController {
         Map<Long, String> taskExtPropertyPair = new HashMap<>();
         // 搬迁安装天数
         Map<Long, BigDecimal> relocationDaysPair = new HashMap<>();
+        // key部门id  value产能
+        AtomicReference<Map<Long, BigDecimal>> capacityPair = new AtomicReference<>(new HashMap<>());
         DataPermissionUtils.executeIgnore(() -> {
             // 查询日报关联的项目信息
             IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
@@ -197,9 +200,10 @@ public class IotRhDailyReportController {
                     }
                 });
             }
+            // 查询当前日报所属施工队伍中包含 增压机 的产能
+            capacityPair.set(iotRhDailyReportService.queryCapacities(convertList(reports, IotRhDailyReportDO::getDeptId)));
             // 查询每个任务的搬迁安装天数
             List<IotRhDailyReportDO> relocationDays = iotRhDailyReportService.relocationDays(null);
-
             if (CollUtil.isNotEmpty(relocationDays)) {
                 relocationDays.forEach(day -> {
                     relocationDaysPair.put(day.getTaskId(), day.getRelocationDays());
@@ -218,6 +222,8 @@ public class IotRhDailyReportController {
             findAndThen(taskExtPropertyPair, reportVO.getTaskId(), designInjection -> reportVO.setDesignInjection(designInjection));
             // 2.5 搬迁安装天数
             findAndThen(relocationDaysPair, reportVO.getTaskId(), relocationDays -> reportVO.setRelocationDays(relocationDays));
+            // 2.6 产能
+            findAndThen(capacityPair.get(), reportVO.getDeptId(), capacity -> reportVO.setCapacity(capacity));
         });
     }
 

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/IotDeviceMapper.java

@@ -81,6 +81,7 @@ public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> {
                 .likeIfPresent(IotDeviceDO::getDeviceCode, reqVO.getDeviceCode())
                 .likeIfPresent(IotDeviceDO::getDeviceName, reqVO.getDeviceName())
                 .eqIfPresent(IotDeviceDO::getDeptId, reqVO.getDeptId())
+                .inIfPresent(IotDeviceDO::getDeptId, reqVO.getDeptIds())
                 .eqIfPresent(IotDeviceDO::getBrand, reqVO.getBrand())
                 .eqIfPresent(IotDeviceDO::getModel, reqVO.getModel())
                 .eqIfPresent(IotDeviceDO::getDeviceStatus, reqVO.getDeviceStatus())

+ 9 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrhdailyreport/IotRhDailyReportService.java

@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyRep
 import javax.validation.Valid;
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 瑞恒日报 Service 接口
@@ -78,6 +79,14 @@ public interface IotRhDailyReportService {
      */
     BigDecimal queryCapacity(Long deptId);
 
+    /**
+     * 查询指定队伍集合下包含的增压机的产能 集合
+     *
+     * @param deptIds
+     * @return 增压机 产能 集合
+     */
+    Map<Long, BigDecimal> queryCapacities(List<Long> deptIds);
+
     /**
      * 瑞恒日报汇总
      *

+ 35 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrhdailyreport/IotRhDailyReportServiceImpl.java

@@ -237,6 +237,41 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         return capacity.get();
     }
 
+    @Override
+    public Map<Long, BigDecimal> queryCapacities(List<Long> deptIds) {
+        Map<Long, BigDecimal> capacityPair = new HashMap<>();
+        // 找到当前小队下的 电驱增压机 分类下设备的产能 计算 运行时效
+        DictTypeDO dictType = dictTypeService.getDictType("rq_iot_charger_device_category");
+        AtomicReference<BigDecimal> capacity = new AtomicReference<>(BigDecimal.ZERO);
+        if (ObjUtil.isNotEmpty(dictType)) {
+            if (StrUtil.isNotBlank(dictType.getRemark())) {
+                IotDevicePageReqVO capacityReqVO = new IotDevicePageReqVO();
+                capacityReqVO.setDeptIds(deptIds);
+                capacityReqVO.setAssetClass(Long.valueOf(dictType.getRemark()));
+                List<IotDeviceDO> capacityDevices = iotDeviceMapper.selectList(capacityReqVO);
+                if (CollUtil.isNotEmpty(capacityDevices)) {
+                    // 解析每个设备的 扩展属性 找出 已经设置 了产能的设备并提取值
+                    capacityDevices.forEach(device -> {
+                        if (StrUtil.isNotBlank(device.getTemplateJson())) {
+                            Gson gson = new Gson();
+                            Type listType = new TypeToken<List<IotDeviceProperty>>(){}.getType();
+                            List<IotDeviceProperty> deviceProperties = gson.fromJson(device.getTemplateJson(), listType);
+                            if (CollUtil.isNotEmpty(deviceProperties)) {
+                                deviceProperties.forEach(property -> {
+                                    if ("产能".equals(property.getName()) && StrUtil.isNotBlank(property.getValue())) {
+                                        // 当前扩展属性已经维护了 产能 值
+                                        capacity.set(new BigDecimal(property.getValue()));
+                                    }
+                                    capacityPair.put(device.getDeptId(), capacity.get());
+                                });
+                            }
+                        }
+                    });
+                }
+            }
+        }
+        return capacityPair;
+    }
 
 
     @Override