fanxw 5 jaren geleden
bovenliggende
commit
da9ce13280

+ 11 - 1
src/main/java/com/chinaitop/depot/system/controller/OrgInfoController.java

@@ -15,6 +15,7 @@ import com.chinaitop.depot.system.service.OrgInfoService;
15 15
 import com.chinaitop.depot.system.service.RoleButtonService;
16 16
 import com.chinaitop.depot.system.service.RoleFuncService;
17 17
 import com.chinaitop.depot.system.service.RoleInfoService;
18
+import com.chinaitop.depot.utils.BusinessUtils;
18 19
 import com.chinaitop.depot.utils.DataSynchronization;
19 20
 import com.chinaitop.depot.utils.FileUtil;
20 21
 import com.fasterxml.jackson.core.JsonParseException;
@@ -156,8 +157,17 @@ public class OrgInfoController {
156 157
         		String hexString = FileUtil.toHexString(file2byte);
157 158
         		orgInfo.setWjl(hexString);
158 159
         	}
160
+        	/* 保存数据  */
159 161
 			orgInfoService.add(orgInfo);
160
-			
162
+
163
+			/* 生成库区标准编码 */
164
+			String zzdm = orgInfo.getCreditCode();
165
+			if ("".equals(zzdm)) {
166
+				zzdm = orgInfo.getCompanyOrgCode();
167
+			}
168
+			orgInfo.setKqbm(BusinessUtils.setBZkqbm(zzdm, orgInfo.getOrgId()));
169
+			orgInfoService.updateSelective(orgInfo);
170
+
161 171
 			/*新增机构时,重新配置级别*/
162 172
 			orgInfoService.clearOrgLevel(new HashMap<String,Object>());//清空所有级别
163 173
 			OrgInfoExample example = new OrgInfoExample();

+ 21 - 5
src/main/java/com/chinaitop/depot/system/mapper/OrgInfoMapper.xml

@@ -60,6 +60,7 @@
60 60
     <result column="updatetime" property="updateTime" jdbcType="VARCHAR" />
61 61
     <result column="frlxfs" property="frlxfs" jdbcType="VARCHAR" />
62 62
     <result column="yxgr" property="yxgr" jdbcType="DECIMAL" />
63
+    <result column="kqbm" property="kqbm" jdbcType="VARCHAR" />
63 64
   </resultMap>
64 65
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chinaitop.depot.system.model.OrgInfo">
65 66
     <result column="wjl" jdbcType="LONGVARCHAR" property="wjl" />
@@ -130,7 +131,8 @@
130 131
     independent_corporation, legal_person, whether_rent, info_regist, regist_date, remark, 
131 132
     parent_id, status, del_flag, birds_eye, birds_Remote, brief_introduction, invoice_title, 
132 133
     regist_number, bank_name, account_name, account_number,level_code,total_assets,corporate_capacity,
133
-    office_phone,registered_address,mail_box,official_website,house_number,tank_number,depot_property,updatetime,frlxfs,yxgr
134
+    office_phone,registered_address,mail_box,official_website,house_number,tank_number,depot_property,
135
+    updatetime,frlxfs,yxgr,kqbm
134 136
   </sql>
135 137
   <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.system.model.OrgInfoExample" >
136 138
     select
@@ -180,7 +182,7 @@
180 182
       regist_number, bank_name, account_name, 
181 183
       account_number,total_assets,corporate_capacity,
182 184
       office_phone,registered_address,mail_box,official_website,
183
-      house_number,tank_number,depot_property,level_code,wjl,frlxfs,yxgr)
185
+      house_number,tank_number,depot_property,level_code,wjl,frlxfs,yxgr,kqbm)
184 186
     values (#{orgId,jdbcType=INTEGER}, #{orgName,jdbcType=VARCHAR}, #{shortName,jdbcType=VARCHAR}, 
185 187
       #{orgCode,jdbcType=VARCHAR}, #{orgClassId,jdbcType=INTEGER}, #{companyNature,jdbcType=INTEGER}, 
186 188
       #{busiType,jdbcType=INTEGER}, #{address,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR}, 
@@ -200,7 +202,7 @@
200 202
       #{officePhone,jdbcType=VARCHAR}, #{registeredAddress,jdbcType=VARCHAR}, #{mailBox,jdbcType=VARCHAR}, 
201 203
       #{officialWebsite,jdbcType=VARCHAR}, #{houseNumber,jdbcType=INTEGER}, #{tankNumber,jdbcType=INTEGER}, 
202 204
       #{depotProperty,jdbcType=VARCHAR}, #{levelCode,jdbcType=VARCHAR}, #{wjl,jdbcType=LONGVARCHAR},
203
-      #{frlxfs,jdbcType=VARCHAR}, #{yxgr,jdbcType=DECIMAL})
205
+      #{frlxfs,jdbcType=VARCHAR}, #{yxgr,jdbcType=DECIMAL}, #{kqbm,jdbcType=VARCHAR})
204 206
   </insert>
205 207
   <insert id="insertSelective" parameterType="com.chinaitop.depot.system.model.OrgInfo" useGeneratedKeys="true" keyProperty="orgId">
206 208
     insert into org_info
@@ -349,6 +351,9 @@
349 351
       <if test="yxgr != null">
350 352
       	yxgr,
351 353
       </if>
354
+      <if test="kqbm != null">
355
+      	kqbm,
356
+      </if>
352 357
     </trim>
353 358
     <trim prefix="values (" suffix=")" suffixOverrides="," >
354 359
       <if test="orgId != null" >
@@ -495,6 +500,9 @@
495 500
       <if test="yxgr != null" >
496 501
         #{yxgr,jdbcType=DECIMAL},
497 502
       </if>
503
+      <if test="kqbm != null">
504
+      	#{kqbm,jdbcType=VARCHAR},
505
+      </if>
498 506
     </trim>
499 507
   </insert>
500 508
   <select id="countByExample" parameterType="com.chinaitop.depot.system.model.OrgInfoExample" resultType="java.lang.Integer" >
@@ -653,6 +661,9 @@
653 661
       <if test="record.yxgr != null" >
654 662
         yxgr = #{record.yxgr,jdbcType=DECIMAL},
655 663
       </if>
664
+      <if test="record.kqbm != null">
665
+      	kqbm = #{record.kqbm,jdbcType=VARCHAR},
666
+      </if>
656 667
     </set>
657 668
     <if test="_parameter != null" >
658 669
       <include refid="Update_By_Example_Where_Clause" />
@@ -707,7 +718,8 @@
707 718
       account_number = #{record.accountNumber,jdbcType=VARCHAR},
708 719
       wjl = #{record.wjl,jdbcType=LONGVARCHAR},
709 720
       frlxfs = #{record.frlxfs,jdbcType=VARCHAR},
710
-      yxgr = #{record.yxgr,jdbcType=DECIMAL}
721
+      yxgr = #{record.yxgr,jdbcType=DECIMAL},
722
+      kqbm = #{record.kqbm,jdbcType=VARCHAR}
711 723
     <if test="_parameter != null" >
712 724
       <include refid="Update_By_Example_Where_Clause" />
713 725
     </if>
@@ -886,6 +898,9 @@
886 898
       <if test="yxgr != null" >
887 899
         yxgr = #{yxgr,jdbcType=DECIMAL},
888 900
       </if>
901
+      <if test="kqbm != null">
902
+      	kqbm = #{kqbm,jdbcType=VARCHAR},
903
+      </if>
889 904
     </set>
890 905
     where org_id = #{orgId,jdbcType=INTEGER}
891 906
   </update>
@@ -947,7 +962,8 @@
947 962
       level_code = #{levelCode,jdbcType=VARCHAR},
948 963
       wjl = #{wjl,jdbcType=LONGVARCHAR},
949 964
       frlxfs = #{frlxfs,jdbcType=VARCHAR},
950
-      yxgr = #{yxgr,jdbcType=DECIMAL}
965
+      yxgr = #{yxgr,jdbcType=DECIMAL},
966
+      kqbm = #{kqbm,jdbcType=VARCHAR}
951 967
     where org_id = #{orgId,jdbcType=INTEGER}
952 968
   </update>
953 969
   <update id="updateOrgLevel" parameterType="map" statementType="CALLABLE" >

+ 10 - 0
src/main/java/com/chinaitop/depot/system/model/OrgInfo.java

@@ -128,6 +128,8 @@ public class OrgInfo implements Serializable {
128 128
     private String frlxfs;
129 129
     
130 130
     private double yxgr;
131
+    
132
+    private String kqbm;
131 133
 
132 134
     public Integer getOrgId() {
133 135
         return orgId;
@@ -608,4 +610,12 @@ public class OrgInfo implements Serializable {
608 610
 	public void setYxgr(double yxgr) {
609 611
 		this.yxgr = yxgr;
610 612
 	}
613
+
614
+	public String getKqbm() {
615
+		return kqbm;
616
+	}
617
+
618
+	public void setKqbm(String kqbm) {
619
+		this.kqbm = kqbm == null ? null : kqbm.trim();
620
+	}
611 621
 }

+ 113 - 0
src/main/java/com/chinaitop/depot/utils/BusinessUtils.java

@@ -0,0 +1,113 @@
1
+package com.chinaitop.depot.utils;
2
+
3
+public class BusinessUtils {
4
+
5
+	//简易仓、简易囤、罩棚的枚举ID(天津目前只有简易囤)3位编码是999
6
+	private final static String JY_NUME_ID = "5214";
7
+
8
+	//正常廒间的3位编码
9
+	private final static String AJ_CODE = "001";
10
+
11
+	//简易简易仓、简易囤、罩棚的3位廒间编码
12
+	private final static String JY_CODE = "999";
13
+
14
+	//油罐廒间编码
15
+	private final static String YG_CODE = "000";
16
+
17
+	//油罐
18
+	private final static String IS_TANK = "1";
19
+
20
+	/**
21
+	 * 组合库区标准编码
22
+	 * 
23
+	 * @param zzdm 组织编码或18位统一性用社代码
24
+	 * @param orgId 单位ID
25
+	 * @return
26
+	 */
27
+	public static String setBZkqbm(String zzdm, Integer orgId) {
28
+		String kqbm = "";
29
+		StringBuffer sbf = new StringBuffer();
30
+		sbf.append(zzdm);
31
+		if (orgId.toString().length()==1) {
32
+			sbf.append("00").append(orgId);
33
+		} else if (orgId.toString().length()==2) {
34
+			sbf.append("0").append(orgId);
35
+		} else if (orgId.toString().length()==3) {
36
+			sbf.append(orgId);
37
+		}
38
+		kqbm = sbf.toString().trim();
39
+		return kqbm;
40
+	}
41
+
42
+	/**
43
+	 * 组合仓房/油罐标准编码
44
+	 * 规则:仓房/油罐标准编码=所属单位18位统一信用代码+001+仓房/油罐3位编码
45
+	 * @param dwbm 单位编码
46
+	 * @param code 仓房或油罐编码
47
+	 * @param typeCode 类型标识:0仓房,1油罐
48
+	 * @param orgId 单位ID
49
+	 * @return
50
+	 */
51
+	public static String setBZcfandygbm(String dwbm, String code, String typeCode, String orgId) {
52
+		String cfdm = "";
53
+		StringBuffer sbf = new StringBuffer();
54
+		//sbf.append(dwbm).append("001").append(typeCode).append(code);
55
+		if (orgId.length()==1) {
56
+			sbf.append(dwbm).append("00").append(orgId);
57
+		} else if (orgId.length()==2) {
58
+			sbf.append(dwbm).append("0").append(orgId);
59
+		} else if (orgId.length()==3) {
60
+			sbf.append(dwbm).append(orgId);
61
+		}
62
+		sbf.append(typeCode).append(code);
63
+		cfdm = sbf.toString().trim();
64
+		return cfdm;
65
+	}
66
+
67
+	/**
68
+	 * 组合廒间标准编码
69
+	 * 规则:廒间标准编码=仓房/油罐标准编码+3位廒间编码
70
+	 * @param cfbm 仓房/油罐标准编码
71
+	 * @param cfType 仓房类型
72
+	 * @param typeCode 类型标识:0仓房,1油罐
73
+	 * @return
74
+	 */
75
+	public static String setBZajbm(String cfbm, String cfType, String typeCode) {
76
+
77
+		String ajbm = "";
78
+
79
+		StringBuffer sbf = new StringBuffer();
80
+		sbf.append(cfbm);
81
+
82
+		if (IS_TANK.equals(typeCode)) {
83
+			sbf.append(YG_CODE);
84
+		} else {
85
+			if (JY_NUME_ID.equals(cfType)) {
86
+				sbf.append(JY_CODE);
87
+			} else {
88
+				sbf.append(AJ_CODE);
89
+			}
90
+		}
91
+
92
+		ajbm = sbf.toString().trim();
93
+
94
+		return ajbm;
95
+	}
96
+
97
+	/**
98
+	 * 组合货位标准编码
99
+	 * 规则:货位标准编码=所属仓房编码+所属廒间编码+货位编码
100
+	 * 也就是说廒间标准编码+货位编码就是货位的标准编码
101
+	 * @param ajbm
102
+	 * @param hwbm
103
+	 * @return
104
+	 */
105
+	public static String setBZhwbm(String ajbm, String hwbm) {
106
+		String hwdm = "";
107
+		StringBuffer sbf = new StringBuffer();
108
+		sbf.append(ajbm).append(hwbm);
109
+		hwdm = sbf.toString().trim();
110
+		return hwdm;
111
+	}
112
+
113
+}