فهرست منبع

Merge branch 'master' into masterback

zhangcl 18 ساعت پیش
والد
کامیت
5422c504c1

+ 9 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/vo/IotRyDailyReportPageReqVO.java

@@ -89,9 +89,18 @@ public class IotRyDailyReportPageReqVO extends PageParam {
     @Schema(description = "施工状态(动迁 准备 施工 完工)", example = "1")
     private String rigStatus;
 
+    @Schema(description = "瑞鹰 修井 施工状态(动迁 准备 施工 完工)", example = "1")
+    private String repairStatus;
+
     @Schema(description = "人员情况")
     private String personnel;
 
+    @Schema(description = "全员数量")
+    private BigDecimal totalStaffNum;
+
+    @Schema(description = "休假人员数量")
+    private BigDecimal leaveStaffNum;
+
     @Schema(description = "泥浆性能-密度(g/cm³)")
     private BigDecimal mudDensity;
 

+ 14 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/vo/IotRyDailyReportRespVO.java

@@ -142,10 +142,22 @@ public class IotRyDailyReportRespVO {
     @ExcelProperty("施工状态(动迁 准备 施工 完工)")
     private String rigStatus;
 
+    @Schema(description = "瑞鹰修井 施工状态(动迁 准备 施工 完工)", example = "1")
+    @ExcelProperty("瑞鹰修井 施工状态(动迁 准备 施工 完工)")
+    private String repairStatus;
+
     @Schema(description = "人员情况")
     @ExcelProperty("人员情况")
     private String personnel;
 
+    @Schema(description = "全员数量")
+    @ExcelProperty("全员数量")
+    private BigDecimal totalStaffNum;
+
+    @Schema(description = "休假人员数量")
+    @ExcelProperty("休假人员数量")
+    private BigDecimal leaveStaffNum;
+
     @Schema(description = "泥浆性能-密度(g/cm³)")
     @ExcelProperty("泥浆性能-密度(g/cm³)")
     private BigDecimal mudDensity;
@@ -239,4 +251,6 @@ public class IotRyDailyReportRespVO {
     @Schema(description = "井别", example = "气井")
     private String wellCategory;
 
+    @Schema(description = "在岗人数 = 全员数量-休假人员数量", example = "80")
+    private BigDecimal onDutyStaffNum;
 }

+ 9 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/vo/IotRyDailyReportSaveReqVO.java

@@ -105,9 +105,18 @@ public class IotRyDailyReportSaveReqVO {
     @Schema(description = "施工状态(动迁 准备 施工 完工)", example = "1")
     private String rigStatus;
 
+    @Schema(description = "瑞鹰 修井 施工状态(动迁 准备 施工 完工)", example = "1")
+    private String repairStatus;
+
     @Schema(description = "人员情况")
     private String personnel;
 
+    @Schema(description = "全员数量")
+    private BigDecimal totalStaffNum;
+
+    @Schema(description = "休假人员数量")
+    private BigDecimal leaveStaffNum;
+
     @Schema(description = "泥浆性能-密度(g/cm³)")
     private BigDecimal mudDensity;
 

+ 12 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotrydailyreport/IotRyDailyReportDO.java

@@ -163,10 +163,22 @@ public class IotRyDailyReportDO extends BaseDO {
      * 施工状态(动迁 准备 施工 完工)
      */
     private String rigStatus;
+    /**
+     * 瑞鹰修井 施工状态(动迁 准备 施工 完工)
+     */
+    private String repairStatus;
     /**
      * 人员情况
      */
     private String personnel;
+    /**
+     * 全员数量
+     */
+    private BigDecimal totalStaffNum;
+    /**
+     * 休假人员数量
+     */
+    private BigDecimal leaveStaffNum;
     /**
      * 泥浆性能-密度(g/cm³)
      */

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotopeationfill/IotOpeationFillMapper.java

@@ -234,6 +234,9 @@ public interface IotOpeationFillMapper extends BaseMapperX<IotOpeationFillDO> {
     @TenantIgnore
     IotOpeationFillDO orderDO(IotOpeationFillDO fillDO);
 
+    @TenantIgnore
+    IotOpeationFillDO orderDO1(IotOpeationFillDO fillDO);
+
     @TenantIgnore
     List<IotOpeationFillDO> reportList(IotOpeationFillDO fillDO);
 

+ 27 - 43
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotopeationfill/IotOpeationFillServiceImpl.java

@@ -26,6 +26,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 
 
+import java.security.SecureRandom;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
@@ -352,7 +353,19 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
 
                 List<IotOpeationFillOrderDO> childList = iotOpeationFillMapper.childList(orderDO);
 
-                int randomNum = generateUniqueNumber();
+                int randomNum;
+                IotOpeationFillDO exitDev;
+                IotOpeationFillDO fillDO = new IotOpeationFillDO();
+
+                do {
+                    // 生成8位随机整数
+                    randomNum = generate8DigitInteger();
+                    // 设置设备ID
+                    fillDO.setDeviceId((long) randomNum);
+                    // 检查数据库中是否已存在
+                    exitDev = iotOpeationFillMapper.orderDO1(fillDO);
+                } while (exitDev != null); // 如果存在则继续循环生成新的随机数
+
 
                 //如果是根节点,则证明该部门为小队并且属于瑞恒,创建对应日报虚拟设备
                 if(childList.size()==0){
@@ -384,54 +397,25 @@ public class IotOpeationFillServiceImpl implements IotOpeationFillService {
         return devList;
     }
 
-    // 用于记录每天的序列号,确保当天内不重复
-    private static final ConcurrentHashMap<String, Integer> dailySequence = new ConcurrentHashMap<>();
-    // 日期格式化器,用于生成每天的唯一标识
-    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
 
-    /**
-     * 生成每天唯一的6位数字序列号
-     * 格式:两位日期码 + 四位序列号
-     *
-     * @return 唯一的6位数字
-     * @throws RuntimeException 当超过每日最大生成量时抛出
-     */
-    public static int generateUniqueNumber() {
-        // 获取当前日期字符串,如20231005
-        String today = LocalDate.now().format(DATE_FORMATTER);
-
-        // 提取年份后两位和月份日期的哈希值作为日期标识(2位)
-        int dateCode = (Integer.parseInt(today.substring(2, 4)) +
-                Integer.parseInt(today.substring(4, 6)) +
-                Integer.parseInt(today.substring(6, 8))) % 99 + 1;
-
-        // 使用循环确保获取到正确的序列号,处理并发情况
-        while (true) {
-            // 获取当前序列号,不存在则为0
-            Integer current = dailySequence.get(today);
-            int nextSeq = (current == null) ? 1 : current + 1;
-
-            // 检查是否超过每天的最大生成量
-            if (nextSeq > 9999) {
-                throw new RuntimeException("今日已超过最大生成数量(9999个)");
-            }
+    // 使用SecureRandom确保随机数的安全性
+    private static final SecureRandom random = new SecureRandom();
 
-            // 使用putIfAbsent确保原子性操作,如果不存在则设置为1
-            if (current == null) {
-                if (dailySequence.putIfAbsent(today, 1) == null) {
-                    return dateCode * 10000 + 1;
-                }
-            }
-            // 使用replace确保只有当前值匹配时才更新,避免覆盖其他线程的更新
-            else if (dailySequence.replace(today, current, nextSeq)) {
-                return dateCode * 10000 + nextSeq;
-            }
+    // 8位数字的最小值和最大值
+    private static final int MIN_8_DIGIT = 10000000;  // 最小的8位整数
+    private static final int MAX_8_DIGIT = 99999999;  // 最大的8位整数
 
-            // 如果上述操作失败,循环重试
-        }
+    /**
+     * 生成8位整型随机数
+     * @return 8位整数(范围:10000000 - 99999999)
+     */
+    public static int generate8DigitInteger() {
+        // 生成范围内的随机整数:[min, max]
+        return MIN_8_DIGIT + random.nextInt(MAX_8_DIGIT - MIN_8_DIGIT + 1);
     }
 
 
+
     @Override
     public IotOpeationFillDO isReport(IotOpeationFillDO fillDO) {
         return iotOpeationFillMapper.isReport(fillDO);

+ 13 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/resources/mapper/static/IotOpeationFillMapper.xml

@@ -1079,6 +1079,19 @@
             DATE(create_time) = #{createTime}
     </select>
 
+
+    <select id="orderDO1" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO"
+            resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
+        select
+            order_id
+        from
+            rq_iot_opeation_fill
+        where
+            device_id = #{deviceId}
+          and
+            DATE(create_time) = CURDATE()
+    </select>
+
     <select id="reportList" parameterType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO"
             resultType="cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO">
         SELECT DISTINCT