ソースを参照

优化套餐名称超长逻辑

hurugang 3 年 前
コミット
bc6d9ade9d

+ 0 - 9
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzChargeDetail.java

@@ -1,7 +1,6 @@
 package cn.hnthyy.thmz.entity.his.mz;
 
 import lombok.Data;
-import org.apache.commons.lang3.StringUtils;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -229,14 +228,6 @@ public class MzChargeDetail implements Serializable,Comparable<MzChargeDetail> {
             this.origPriceStr = origPrice.toString();
         }
     }
-    //表里只能存32个字节
-    public void setTcName(String tcName) {
-        if(StringUtils.isNotBlank(tcName) && tcName.length()>16){
-            this.tcName = tcName.substring(0,16);
-        }else {
-            this.tcName = tcName;
-        }
-    }
 
     @Override
     public String toString() {

+ 13 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -2967,6 +2967,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         if (mzChargeDetails.size() == 0) {
             return;
         }
+        for(MzChargeDetail mzChargeDetail:mzChargeDetails){
+            if(StringUtils.isNotBlank(mzChargeDetail.getTcName()) && mzChargeDetail.getTcName().length()>14){
+                mzChargeDetail.setTcName(mzChargeDetail.getTcName().substring(0,14));
+            }else {
+                mzChargeDetail.setTcName(mzChargeDetail.getTcName());
+            }
+        }
         if (mzChargeDetails.size() <= 20) {
             mzChargeDetailMapper.batchInsertMzChargeDetail(mzChargeDetails);
         } else {
@@ -3720,7 +3727,12 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             newMzChargeDetail.setRealNo(0);
             newMzChargeDetail.setYbbxFlag(YesNoEnum.NO.code.toString());
             newMzChargeDetail.setTcNo(tcNoMap.get(jyZdItem.getCode()).getTcNo());
-            newMzChargeDetail.setTcName(tcNoMap.get(jyZdItem.getCode()).getTcName());
+            String tcName=tcNoMap.get(jyZdItem.getCode()).getTcName();
+            if(StringUtils.isNotBlank(tcName) && tcName.length()>14){
+                newMzChargeDetail.setTcName(tcName.substring(0,14));
+            }else {
+                newMzChargeDetail.setTcName(tcName);
+            }
             newMzChargeDetail.setDetailFlag(YesNoEnum.NO.code.toString());
             newMzChargeDetail.setOrderType(YesNoEnum.YES.code.toString());
             newMzChargeDetail.setSupplyNo("Y");
@@ -4035,7 +4047,6 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         } else {
             newMzChargeDetail.setTcName(mzYjReq.getGroupName());
         }
-
         newMzChargeDetail.setDetailFlag(YesNoEnum.NO.code.toString());
         newMzChargeDetail.setOrderType(YesNoEnum.YES.code.toString());
         newMzChargeDetail.setSupplyNo("Y");