|
|
@@ -495,6 +495,14 @@ public class ZsReportArchieveService {
|
|
|
*/
|
|
|
public ZsReportArchieve findByReportNo(String reportNo) {
|
|
|
if (StringUtils.isNotBlank(reportNo)){
|
|
|
+
|
|
|
+ // ========== 新增:截取reportNo到第一个)或]为止 ==========
|
|
|
+ String prefixReportNo = cutReportNoToSymbol(reportNo);
|
|
|
+ // 后续逻辑可以使用newReportNo,比如替换原有reportNo参与处理
|
|
|
+ // 如果你想让原有逻辑使用截取后的字符串,把下面的reportNo换成newReportNo即可
|
|
|
+ // ======================================================
|
|
|
+
|
|
|
+
|
|
|
String type = "";
|
|
|
if(reportNo.contains("字")){
|
|
|
type = reportNo.substring(reportNo.indexOf("环")+1, reportNo.indexOf("字")+1);
|
|
|
@@ -503,7 +511,38 @@ public class ZsReportArchieveService {
|
|
|
}
|
|
|
String noType = SpringUtil.getBean(IDictApi.class).getDictValue(type, "report_no_type", "");
|
|
|
if (StringUtils.isNotBlank(noType)){
|
|
|
- ZsReportArchieve reportArchieve = reportArchieveMapper.findByReportNoType(noType);
|
|
|
+ ZsReportArchieve reportArchieve = reportArchieveMapper.findByReportNoTypeAndPrefixYear(noType, prefixReportNo);
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(reportArchieve.getStoragePlace())){
|
|
|
+ if (reportArchieve.getStoragePlace().contains(",")){
|
|
|
+ String[] split = reportArchieve.getStoragePlace().split(",");
|
|
|
+ StringBuilder vaBuilder = new StringBuilder();
|
|
|
+ for (String s : split) {
|
|
|
+ String placeValue = SpringUtil.getBean(IDictApi.class).getDictLabel(s, "storage_place", "");
|
|
|
+ if (StringUtils.isNotBlank(placeValue)) {
|
|
|
+ if (vaBuilder.length() > 0) {
|
|
|
+ vaBuilder.append(","); // 用逗号分隔每个拼接的值
|
|
|
+ }
|
|
|
+ vaBuilder.append(placeValue); // 拼接 label
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reportArchieve.setStoragePlace(vaBuilder.toString());
|
|
|
+ }else {
|
|
|
+ String placeValue = SpringUtil.getBean(IDictApi.class).getDictLabel(reportArchieve.getStoragePlace(), "storage_place", "");
|
|
|
+ reportArchieve.setStoragePlace(placeValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(com.jeeplus.utils.StringUtils.isNotBlank(reportArchieve.getStoragePlace())){
|
|
|
+ String replace = reportArchieve.getStoragePlace().replace(",", "区");
|
|
|
+ String place = "江苏分所 "+replace+"区";
|
|
|
+ reportArchieve.setStoragePlace(place);
|
|
|
+ }
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(reportArchieve.getSpecialPlace())){
|
|
|
+ reportArchieve.setStoragePlace(reportArchieve.getSpecialPlace());
|
|
|
+ }
|
|
|
+
|
|
|
return reportArchieve;
|
|
|
}
|
|
|
}
|
|
|
@@ -511,6 +550,42 @@ public class ZsReportArchieveService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 辅助方法:截取字符串从开头到第一个)或]为止(包含符号)
|
|
|
+ * 如果没有)和],返回原字符串
|
|
|
+ * @param reportNo 原始报告编号
|
|
|
+ * @return 截取后的字符串
|
|
|
+ */
|
|
|
+ private String cutReportNoToSymbol(String reportNo) {
|
|
|
+ if (StringUtils.isBlank(reportNo)) {
|
|
|
+ return reportNo;
|
|
|
+ }
|
|
|
+ // 找到第一个)的位置
|
|
|
+ int indexBracket = reportNo.indexOf(")");
|
|
|
+ // 找到第一个]的位置
|
|
|
+ int indexSquare = reportNo.indexOf("]");
|
|
|
+
|
|
|
+ // 确定要截取的结束位置(取两个符号中靠前的那个)
|
|
|
+ int cutIndex = -1;
|
|
|
+ if (indexBracket != -1 && indexSquare != -1) {
|
|
|
+ // 两个符号都存在,取位置更小的
|
|
|
+ cutIndex = Math.min(indexBracket, indexSquare);
|
|
|
+ } else if (indexBracket != -1) {
|
|
|
+ // 只有)存在
|
|
|
+ cutIndex = indexBracket;
|
|
|
+ } else if (indexSquare != -1) {
|
|
|
+ // 只有]存在
|
|
|
+ cutIndex = indexSquare;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果找到符号,截取到符号位置(包含符号);否则返回原字符串
|
|
|
+ if (cutIndex != -1) {
|
|
|
+ return reportNo.substring(0, cutIndex + 1);
|
|
|
+ } else {
|
|
|
+ return reportNo;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 校验报告文号类型与报告文号是否一致
|
|
|
* @param reportNoType
|
|
|
* @param reportNo
|