15928045575 il y a 2 ans
Parent
commit
0c7b6a41fc

+ 10 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsCompany.java

@@ -22,6 +22,16 @@ public class KwsCompany implements Serializable {
      */
     private Long id;
 
+    /**
+     * 系统生成:省级平台AABBCCDDEEEE
+     */
+    private String companyAllCode;
+
+    /**
+     * 系统生成:省级平台EEEE
+     */
+    private String companyCode;
+
     /**
      * 公司
      */

+ 12 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/CompanyService.java

@@ -103,6 +103,18 @@ public class CompanyService {
         company.setCompanyId(headerData.getCompanyId());
         company.setUpdateBy(Long.parseLong(headerData.getUpdateBy()));
         company.setUpdateTime(now);
+        int code = 0;
+        while(true){
+            code = 1000 + new Random().nextInt(9000);
+            KwsCompany codeHas = companyMapper.selectOne(new LambdaQueryWrapper<KwsCompany>()
+                    .eq(KwsCompany::getCompanyCode, code)
+            );
+            if(Objects.isNull(codeHas)){
+                break;
+            }
+        }
+        company.setCompanyCode(String.valueOf(code));
+        company.setCompanyAllCode(company.getCode()+company.getType().toString()+String.valueOf(code));
         companyMapper.insert(company);
 
         Map<String, Object> logMap = new HashMap<>(NumberConstant.SIXTEEN);

+ 3 - 2
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsCompanyMapper.xml

@@ -46,13 +46,14 @@
       fence, person, person_mobile, 
       platform_name, platform_address, `status`, 
       create_by, create_time, update_by,
-      update_time,company_id,code_area,area)
+      update_time,company_id,code_area,area,company_code,company_all_code)
     values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
       #{code,jdbcType=VARCHAR}, #{codeAll,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
       #{fence,jdbcType=VARCHAR}, #{person,jdbcType=VARCHAR}, #{personMobile,jdbcType=VARCHAR}, 
       #{platformName,jdbcType=VARCHAR}, #{platformAddress,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
       #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, 
-      #{updateTime,jdbcType=TIMESTAMP},#{companyId,jdbcType=BIGINT},#{codeArea,jdbcType=VARCHAR},#{area,jdbcType=VARCHAR})
+      #{updateTime,jdbcType=TIMESTAMP},#{companyId,jdbcType=BIGINT},#{codeArea,jdbcType=VARCHAR},#{area,jdbcType=VARCHAR}
+      ,#{companyCode,jdbcType=VARCHAR},#{companyAllCode,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsCompany">
     <!--@mbg.generated-->