Browse Source

优化资产资产信息处理epc逻辑

LinWuTai 1 year ago
parent
commit
b94f9431df

+ 2 - 19
ruoyi-admin/src/main/java/com/ruoyi/asset/domain/TbAssetInformation.java

@@ -50,9 +50,6 @@ public class TbAssetInformation extends BaseEntity
     /** epc补充长度 */
     private Integer epcReplenishLength;
 
-    /** ecp前置补充 */
-    private String epcPreSupplement;
-
     /** 图片路径 */
 //    @Excel(name = "图片路径")
     private String imageUrl;
@@ -269,17 +266,12 @@ public class TbAssetInformation extends BaseEntity
         // 将epc大写
         epc = epc.toUpperCase();
 
-        int epcLength = epc.length();
-        String epcPre = "";
-        // 判断epc长度是否超过24位
-        if (epcLength > 24) {
-            epcPre = epc.substring(0, epcLength - 24);
-            epc = epc.substring(epcLength - 24);
+        if (epc.length() > 24) {
+            throw new RuntimeException("编码转epc长度大于24位");
         }
 
         setEpc(epc);
         setEpcReplenishLength(epcReplenishLength);
-        setEpcPreSupplement(epcPre);
     }
 
     /**
@@ -321,7 +313,6 @@ public class TbAssetInformation extends BaseEntity
             assetEpcInfo.setNumber(number);
             assetEpcInfo.setEpc(epc);
             assetEpcInfo.setEpcReplenishLength(epcReplenishLength);
-            assetEpcInfo.setEpcPreSupplement(epcPreSupplement);
 
             assetEpcInfos.add(assetEpcInfo);
 
@@ -347,17 +338,9 @@ public class TbAssetInformation extends BaseEntity
 
             // 将epc大写
             epc = epc.toUpperCase();
-            int epcLength = epc.length();
-            String epcPre = "";
-            // 判断epc长度是否超过24位
-            if (epcLength > 24) {
-                epcPre = epc.substring(0, epcLength - 24);
-                epc = epc.substring(epcLength - 24);
-            }
 
             assetEpcInfo.setEpc(epc);
             assetEpcInfo.setEpcReplenishLength(epcReplenishLength);
-            assetEpcInfo.setEpcPreSupplement(epcPre);
 
             assetEpcInfos.add(assetEpcInfo);
         }

+ 0 - 2
ruoyi-admin/src/main/java/com/ruoyi/asset/domain/dto/AssetEpcInfo.java

@@ -10,6 +10,4 @@ public class AssetEpcInfo {
     private String epc;
 
     private Integer epcReplenishLength;
-
-    private String epcPreSupplement;
 }

+ 1 - 8
ruoyi-admin/src/main/resources/mapper/asset/TbAssetInformationMapper.xml

@@ -49,14 +49,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="paymentReceivingTime"    column="payment_receiving_time"    />
         <result property="epc"    column="epc"    />
         <result property="epcReplenishLength"    column="epc_replenish_length"    />
-        <result property="epcPreSupplement" column="epc_pre_supplement" />
         <result property="lifeExpectancy"    column="life_expectancy"    />
         <result property="lifeUnits"    column="life_units"    />
         <result property="startDate"    column="start_date"    />
     </resultMap>
 
     <sql id="selectTbAssetInformationVo">
-        select id, code, name, number, image_url, category_number, specifications_model, abc_category, manage_status, user_department, department, responsible_person, location_number, property, purchase_date, commissioning_date, original_value, durable_years, net_value, residual_value, accumulated_depreciation, last_depreciation_date, depreciation_method, contract_number, factory_number, manufacturer, supplier, purpose, maintenance_date, maintenance_tel, maintenance_user, corporation, record_status, remark, create_by, create_time, update_by, update_time, is_whitelist, quantity, units, payment_receiving_time, epc, epc_replenish_length, epc_pre_supplement, life_expectancy, life_units, start_date from tb_asset_information
+        select id, code, name, number, image_url, category_number, specifications_model, abc_category, manage_status, user_department, department, responsible_person, location_number, property, purchase_date, commissioning_date, original_value, durable_years, net_value, residual_value, accumulated_depreciation, last_depreciation_date, depreciation_method, contract_number, factory_number, manufacturer, supplier, purpose, maintenance_date, maintenance_tel, maintenance_user, corporation, record_status, remark, create_by, create_time, update_by, update_time, is_whitelist, quantity, units, payment_receiving_time, epc, epc_replenish_length, life_expectancy, life_units, start_date from tb_asset_information
     </sql>
 
     <sql id="selectTbAssetInformation">
@@ -102,7 +101,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             a.payment_receiving_time paymentReceivingTime,
             a.epc,
             a.epc_replenish_length epcReplenishLength,
-            a.epc_pre_supplement epcPreSupplement,
             a.life_expectancy lifeExpectancy,
             a.life_units lifeUnits,
             a.start_date startDate,
@@ -173,7 +171,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             a.payment_receiving_time paymentReceivingTime,
             a.epc,
             a.epc_replenish_length epcReplenishLength,
-            a.epc_pre_supplement epcPreSupplement,
             a.life_expectancy lifeExpectancy,
             a.life_units lifeUnits,
             a.start_date startDate,
@@ -294,7 +291,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="paymentReceivingTime != null"> and a.payment_receiving_time = #{paymentReceivingTime}</if>
             <if test="epc != null  and epc != ''"> and a.epc = #{epc}</if>
             <if test="epcReplenishLength != null"> and a.epc_replenish_length = #{epcReplenishLength}</if>
-            <if test="epcPreSupplement != null">and a.epc_pre_supplement = #{epcPreSupplement}</if>
             <if test="lifeExpectancy != null"> and a.life_expectancy = #{lifeExpectancy}</if>
             <if test="lifeUnits != null  and lifeUnits != ''"> and a.life_units = #{lifeUnits}</if>
             <if test="startDate != null"> and a.start_date = #{startDate}</if>
@@ -412,7 +408,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="paymentReceivingTime != null">payment_receiving_time,</if>
             <if test="epc != null">epc,</if>
             <if test="epcReplenishLength != null">epc_replenish_length,</if>
-            <if test="epcPreSupplement != null">epc_pre_supplement,</if>
             <if test="lifeExpectancy != null">life_expectancy,</if>
             <if test="lifeUnits != null">life_units,</if>
             <if test="startDate != null">start_date,</if>
@@ -461,7 +456,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="paymentReceivingTime != null">#{paymentReceivingTime},</if>
             <if test="epc != null">#{epc},</if>
             <if test="epcReplenishLength != null">#{epcReplenishLength},</if>
-            <if test="epcPreSupplement != null">#{epcPreSupplement},</if>
             <if test="lifeExpectancy != null">#{lifeExpectancy},</if>
             <if test="lifeUnits != null">#{lifeUnits},</if>
             <if test="startDate != null">#{startDate},</if>
@@ -514,7 +508,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="paymentReceivingTime != null">payment_receiving_time = #{paymentReceivingTime},</if>
             <if test="epc != null">epc= #{epc},</if>
             <if test="epcReplenishLength != null">epc_replenish_length = #{epcReplenishLength},</if>
-            <if test="epcPreSupplement != null">epc_pre_supplement = #{epcPreSupplement},</if>
             <if test="lifeExpectancy != null">life_expectancy = #{lifeExpectancy},</if>
             <if test="lifeUnits != null">life_units = #{lifeUnits},</if>
             <if test="startDate != null">start_date = #{startDate},</if>