فهرست منبع

Merge branch 'dev' of http://219.151.181.73:3000/zhuwei/bladex into dev

lvy 3 روز پیش
والد
کامیت
4faad9e49f

+ 27 - 1
blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java

@@ -976,15 +976,41 @@ public class CommonUtil {
      * @param keepAspectRatio 是否保持原比例
      */
     public static void rotateAndScaleImageByThumbnails(InputStream is, OutputStream os, double rotate, String format, double quality, int width, int height, boolean keepAspectRatio) throws IOException {
+        // 标准化输出格式
+        String outputFormat = normalizeFormat(format);
+
         Thumbnails.of(is)
                 .size(width, height)
                 .keepAspectRatio(keepAspectRatio)
                 .rotate(rotate)
-                .outputFormat(format)
+                .outputFormat(outputFormat)
                 .outputQuality(quality)
                 .toOutputStream(os);
     }
 
+    /**
+     * 标准化图像格式名称
+     */
+    private static String normalizeFormat(String format) {
+        if (format == null) {
+            return "JPEG"; // 默认格式
+        }
+
+        switch (format.toUpperCase()) {
+            case "JFIF":
+            case "JPEG":
+            case "JPG":
+                return "JPEG";
+            case "PNG":
+            case "GIF":
+            case "BMP":
+                return format.toUpperCase();
+            default:
+                // 对于不支持的格式,返回默认的JPEG格式
+                return "JPEG";
+        }
+    }
+
     /**
      * 根据起止日期获取工作日
      *

+ 2 - 2
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/profiler/ProfilerDataPush.java

@@ -33,11 +33,11 @@ public class ProfilerDataPush {
     /**
      * 超挖值(米)
      */
-    private String overbreak_value;
+    private String overbreak_value = "0";
     /**
      * 欠挖值(米)
      */
-    private String underbreak_value;
+    private String underbreak_value = "0";
     public static List<ProfilerDataPush> parameterMapping(List<ProfilerData> data) {
         return data.stream().map(f -> {
             ProfilerDataPush sectionPush = new ProfilerDataPush();

+ 5 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/profiler/ProfilerOffsetPush.java

@@ -41,6 +41,10 @@ public class ProfilerOffsetPush {
      * 仪器高度(米)
      */
     private String instrument_height;
+    /**
+     * 检查类别(米)
+     */
+    private String check_category;
     /**
      * 测量断面
      */
@@ -61,6 +65,7 @@ public class ProfilerOffsetPush {
         profilerOffsetPush.setX_offset(push.getX0());
         profilerOffsetPush.setY_offset(push.getZ0());
         profilerOffsetPush.setInstrument_height(push.getDeviceHeight());
+        profilerOffsetPush.setCheck_category(push.getBackBreak());
         return profilerOffsetPush;
     }
 }

+ 39 - 17
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -4874,7 +4874,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		for (ArchivesAutoVO4 v : value) {
 			ArchivesAuto auto = new ArchivesAuto();
 			if (config.getIndexType() == null || config.getIndexType() == 0) {
-				v.setFileNumber(v.getFileNumberPrefix() + "" + i);
+				v.setFileNumber(v.getFileNumberPrefix() + "-" + i);
 
 			} else {
 				String prefix = v.getFileNumberPrefix();
@@ -4888,7 +4888,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 				// 使用 %0xd 格式化数字,x 表示总长度
 				String formattedIndex = String.format("%0" + numLength + "d", index);
 				// 设置最终档号
-				v.setFileNumber(prefix + "" + formattedIndex);
+				v.setFileNumber(prefix + "-" + formattedIndex);
 			}
 			auto.setId(v.getId());
 			auto.setFileNumber(v.getFileNumber());
@@ -5396,7 +5396,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			if(fileUrl==null){
 				continue;
 			}
-			String filePath=url+auto.getName()+".pdf";
+			String filePath=url+SnowFlakeUtil.getId()+".pdf";
 			System.out.println("开始保存:"+fileUrl);
 			Boolean b = FileUtils.saveInputStreamByUrl(fileUrl, filePath);
 			System.out.println("保存完成:"+b);
@@ -5412,27 +5412,26 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 							if(result.contains("档号")){
 								String fileNum=result.replace("档号","").replace(":","").replace(":","");
 								auto.setFileNumber(fileNum);
-							}else if(result.contains("立卷单位")){
-								String unit=result.replace("立卷单位","").replace(":","").replace(":","").replaceAll("_","").replace("密级","").replace("级密","");
+							}else if(result.contains("立卷单位")||result.contains("立港单位")){
+								String unit=result.replace("立卷单位","").replace("立港单位","").replace(":","").replace(":","").replaceAll("_","").replace("密级","").replace("级密","");
 								if(unit.startsWith(",")||unit.startsWith(".")||unit.startsWith("。")||unit.startsWith("——")||unit.startsWith("-")||unit.startsWith(",")){
 									unit=unit.substring(1);
+									if(unit.contains("高迷")){
+										unit=unit.replaceAll("高迷", "高速");
+									}
+									if(unit.contains("公资")){
+										unit=unit.replaceAll("公资", "公路");
+									}
 								}
 								auto.setUnit(unit);
 							}else if (result.contains("起止日期")) {
 								String time=result.replace("起止日期","").replace(":","").replace(":","").replaceAll("_","");
-								if(result.contains("~")){
-									String[] localDateTimes = time.split("~");
-									auto.setStartDate(localDateTimes[0]);
-									auto.setEndDate(localDateTimes[1]);
-								} else if (result.contains("-")) {
-									String[] localDateTimes = time.split("-");
-									auto.setStartDate(localDateTimes[0]);
-									auto.setEndDate(localDateTimes[1]);
-								} else if (result.contains("~")) {
-									String[] localDateTimes = time.split("~");
-									auto.setStartDate(localDateTimes[0]);
-									auto.setEndDate(localDateTimes[1]);
+								String[] strings = extractTimeNumbers(time);
+								if (strings[0].startsWith("7")) {
+									strings[0] = "2" + strings[0].substring(1);
 								}
+								auto.setStartDate(strings[0]);
+								auto.setEndDate(strings[1]);
 							} else if (result.contains("保管期限")||result.contains("保管限期")) {
 								String storageTime=result.replace("保管期限","").replace("保管限期","").replace(":","").replace(":","").replaceAll("_","");
 								if(StringUtils.isNotEmpty(storageTime)){
@@ -5471,6 +5470,29 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		this.updateBatchById(archivesAutoList);
 		return true;
 	}
+
+	public String[] extractTimeNumbers(String time) {
+		if (StringUtils.isEmpty(time)) {
+			return new String[]{"", ""};
+		}
+
+		// 使用正则表达式分割,匹配一个或多个非数字字符作为分隔符
+		String[] parts = time.split("[^0-9]+");
+
+		// 过滤掉空字符串,只保留数字部分
+		List<String> numbers = Arrays.stream(parts)
+				.filter(part -> !part.isEmpty())
+				.collect(Collectors.toList());
+
+		// 确保返回数组始终包含两个元素
+		if (numbers.size() >= 2) {
+			return new String[]{numbers.get(0), numbers.get(1)};
+		} else if (numbers.size() == 1) {
+			return new String[]{numbers.get(0), ""};
+		} else {
+			return new String[]{"", ""};
+		}
+	}
 	public List<String> extractTextFromPDF(String pdfFilePath) throws IOException, InterruptedException {
 		//String PYTHON_SCRIPT_PATH = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\Python\\pdfTextExtractorWindows.py";
 		//String PYTHON_INTERPRETER = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\python.exe";

+ 8 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -63,6 +63,7 @@ public class TrialDetectionController extends BladeController {
     private final ITrialDetectionDataService iTrialDetectionDataService;
     private final ITrialSampleInfoService iTrialSampleInfoService;
     private final ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
+    private final IEntrustInfoService entrustInfoService;
     private final WbsTreePrivateClient wbsTreePrivateClient;
     private final JdbcTemplate jdbcTemplate;
     private final NewIOSSClient newIOSSClient;
@@ -171,6 +172,13 @@ public class TrialDetectionController extends BladeController {
         if (recordList.size() > 0) {
             return R.fail("只能删除未上报或已废除的试验记录信息,操作失败");
         }
+        List<TrialSelfInspectionRecord> trialSelfInspectionRecords = iTrialSelfInspectionRecordService.getBaseMapper().selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
+                .isNotNull(TrialSelfInspectionRecord::getEntrustId)
+                .in(TrialSelfInspectionRecord::getId, Func.toLongList(ids)));
+        trialSelfInspectionRecords.forEach(f->{
+            entrustInfoService.update(Wrappers.<EntrustInfo>lambdaUpdate().eq(EntrustInfo::getId, f.getEntrustId()).set(EntrustInfo::getExpCount, 0));
+        });
+
         String sql1 = "delete from u_trial_self_data_record where record_id in(" + ids + ")";
         jdbcTemplate.execute(sql1);
         String sql2 = "delete from u_trial_self_sample where self_id in(" + ids + ")";

+ 18 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -1158,7 +1158,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
 
         //获取之前关联的委托单id
         TrialSelfInspectionRecord oldData = baseMapper.selectById(dto.getId());
-        
+
         this.saveOrUpdate(dto);
         dto.setTableIds(tableIds);
         if (ObjectUtil.isNotEmpty(dto.getId())) {
@@ -1191,6 +1191,23 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='" + dto.getEntrustId() + "'");
         }
         if(oldData != null && oldData.getEntrustId() != null && dto.getEntrustId() == null){
+            //修改对应 BaseInfo 中的数据
+            String baseInfo = oldData.getBaseInfo();
+            if (StringUtils.isNotBlank(baseInfo)) {
+                //删除关联
+                baseMapper.delSelfSample(dto.getId());
+                //设置空值
+                TrialSeleInspectionRecordBaseInfoDTO trialSeleInspectionRecordBaseInfoDTO = JSONObject.parseObject(baseInfo, TrialSeleInspectionRecordBaseInfoDTO.class);
+                if (trialSeleInspectionRecordBaseInfoDTO != null) {
+                    trialSeleInspectionRecordBaseInfoDTO.setEntrustId(null);
+                    trialSeleInspectionRecordBaseInfoDTO.setEntrustNo(null);
+                    trialSeleInspectionRecordBaseInfoDTO.setTrialSampleInfo(null);
+                    oldData.setBaseInfo(JSON.toJSONString(trialSeleInspectionRecordBaseInfoDTO));
+                    int update = baseMapper.update(null, Wrappers.<TrialSelfInspectionRecord>update().lambda()
+                            .set(TrialSelfInspectionRecord::getBaseInfo, JSON.toJSONString(trialSeleInspectionRecordBaseInfoDTO))
+                            .eq(TrialSelfInspectionRecord::getId, dto.getId()));
+                }
+            }
             entrustInfoService.update(Wrappers.<EntrustInfo>lambdaUpdate().eq(EntrustInfo::getId, oldData.getEntrustId()).set(EntrustInfo::getExpCount, 0));
         }
         String[] strings = dto.getTableType().split(",");

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ProfilerOffsetServiceImpl.java

@@ -358,7 +358,7 @@ public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper,
             catLogHeaders.put("Sec-Nonce", secNonce);
             //签名
             catLogHeaders.put("Sec-Signature", new HmacUtils(HmacAlgorithms.HMAC_SHA_256, f.getChannelName().contains("左洞") ? secretLeft : secretRight).hmacHex(sign));
-
+            log.info("推送参数:{}",catLogHeaders);
             try {
                 String catLogBody = post.addHeaders(catLogHeaders).body(catLog).contentType("application/json").execute().body();
                 //响应结果