Просмотр исходного кода

1.主表先不生成编制时间,取后来提交时的时间
2.室内质控月分析子表ID按照顺序生成

huangws 7 месяцев назад
Родитель
Сommit
3261d65e63

+ 9 - 4
GetDataByView/src/main/java/com/jyxt/getdatabyview/HandleData.java

@@ -172,7 +172,7 @@ public class HandleData {
                 insertReportMap.put("create_time_", Timestamp.valueOf(String.valueOf(formattedDateTime)));
                 insertReportMap.put("create_time_", Timestamp.valueOf(String.valueOf(formattedDateTime)));
                 String editUser = entityMap.get("CREATEBY").toString();
                 String editUser = entityMap.get("CREATEBY").toString();
                 String editUserInfo = ibpsRepository.getUserInfoByName(editUser);
                 String editUserInfo = ibpsRepository.getUserInfoByName(editUser);
-                insertReportMap.put("bian_zhi_shi_jian", String.valueOf(formattedDateTime));
+                //insertReportMap.put("bian_zhi_shi_jian", String.valueOf(formattedDateTime));
                 String posID = ibpsRepository.getPosiByCode(entityMap.get("GROUPCODE").toString());
                 String posID = ibpsRepository.getPosiByCode(entityMap.get("GROUPCODE").toString());
                 if ((posID != "-1")&&(!editUserInfo.split("\\^")[0].equals("-1"))) {
                 if ((posID != "-1")&&(!editUserInfo.split("\\^")[0].equals("-1"))) {
                     insertReportMap.put("di_dian_", posID);
                     insertReportMap.put("di_dian_", posID);
@@ -202,7 +202,7 @@ public class HandleData {
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         String formattedDateTime = currentDateTime.format(formatter);
         String formattedDateTime = currentDateTime.format(formatter);
         Timestamp currentTimestamp = Timestamp.valueOf(currentDateTime);
         Timestamp currentTimestamp = Timestamp.valueOf(currentDateTime);
-
+        long sequenceCounter = 0;
         for (Map<String, Object> reportMap : reportList) {
         for (Map<String, Object> reportMap : reportList) {
             String reportID = getStringValue(reportMap, "id_");
             String reportID = getStringValue(reportMap, "id_");
             if (reportID == null || reportID.isEmpty()) {
             if (reportID == null || reportID.isEmpty()) {
@@ -215,10 +215,15 @@ public class HandleData {
             }
             }
 
 
             List<Map<String, Object>> insertList = new ArrayList<>();
             List<Map<String, Object>> insertList = new ArrayList<>();
-
+            // 在循环外部定义序列号计数器
             for (Map<String, Object> entityMap : retList) {
             for (Map<String, Object> entityMap : retList) {
                 Map<String, Object> insertMap = new HashMap<>();
                 Map<String, Object> insertMap = new HashMap<>();
-                insertMap.put("id_", UUID.randomUUID().toString());
+                // 生成有序ID:时间戳+自增序列号
+                String orderedId = String.format("%d-%06d",
+                        currentTimestamp.getTime(),  // 使用时间戳
+                        sequenceCounter++            // 自增序列号
+                );
+                insertMap.put("id_", orderedId);
                 insertMap.put("parent_id_", getStringValue(entityMap, "REPORTID"));
                 insertMap.put("parent_id_", getStringValue(entityMap, "REPORTID"));
                 insertMap.put("create_time_", currentTimestamp); // 直接使用Timestamp,避免字符串转换
                 insertMap.put("create_time_", currentTimestamp); // 直接使用Timestamp,避免字符串转换
 
 

+ 1 - 1
GetDataByView/src/main/java/com/jyxt/getdatabyview/view/repository/LISViewRepository.java

@@ -71,7 +71,7 @@ public class LISViewRepository {
 
 
     public List<Map<String, Object>> getQCTestCodeList(String reportID) {
     public List<Map<String, Object>> getQCTestCodeList(String reportID) {
         List<Map<String, Object>> retList = new ArrayList<>();
         List<Map<String, Object>> retList = new ArrayList<>();
-        String sqlQry = "select * from V_JT_QCTestCodeReport where reportID='"+reportID+"'";
+        String sqlQry = "select * from V_JT_QCTestCodeReport where reportID='"+reportID+"' order by TESTCODENAME,LOTNUMBER";
         log.info("excute sql:"+sqlQry);
         log.info("excute sql:"+sqlQry);
         try {
         try {
             retList = jdbcTemplate.queryForList(sqlQry);
             retList = jdbcTemplate.queryForList(sqlQry);