fanxw 5 년 전
부모
커밋
cfa6221949
18개의 변경된 파일1916개의 추가작업 그리고 104개의 파일을 삭제
  1. 4 51
      src/main/java/com/chinaitop/depot/basic/controller/BasicStorehouseController.java
  2. 7 43
      src/main/java/com/chinaitop/depot/basic/controller/BasicTankController.java
  3. 9 0
      src/main/java/com/chinaitop/depot/basic/mapper/BasicStorehouseMapper.java
  4. 24 0
      src/main/java/com/chinaitop/depot/basic/mapper/BasicStorehouseMapper.xml
  5. 30 0
      src/main/java/com/chinaitop/depot/basic/mapper/BasicTankHwMapper.java
  6. 320 0
      src/main/java/com/chinaitop/depot/basic/mapper/BasicTankHwMapper.xml
  7. 22 7
      src/main/java/com/chinaitop/depot/basic/mapper/BasicTankMapper.xml
  8. 11 0
      src/main/java/com/chinaitop/depot/basic/model/BasicTank.java
  9. 5 0
      src/main/java/com/chinaitop/depot/basic/model/BasicTankExample.java
  10. 222 0
      src/main/java/com/chinaitop/depot/basic/model/BasicTankHw.java
  11. 1010 0
      src/main/java/com/chinaitop/depot/basic/model/BasicTankHwExample.java
  12. 19 0
      src/main/java/com/chinaitop/depot/basic/service/BasicStorehouseService.java
  13. 14 1
      src/main/java/com/chinaitop/depot/basic/service/BasicTankService.java
  14. 9 0
      src/main/java/com/chinaitop/depot/basic/service/BasicWarehouseService.java
  15. 97 0
      src/main/java/com/chinaitop/depot/basic/service/impl/BasicStorehouseServiceImpl.java
  16. 89 1
      src/main/java/com/chinaitop/depot/basic/service/impl/BasicTankServiceImpl.java
  17. 23 0
      src/main/java/com/chinaitop/depot/basic/service/impl/BasicWarehouseServiceImpl.java
  18. 1 1
      src/main/java/com/chinaitop/depot/utils/GeneratorSqlmap.java

+ 4 - 51
src/main/java/com/chinaitop/depot/basic/controller/BasicStorehouseController.java

@@ -1,11 +1,9 @@
1 1
 package com.chinaitop.depot.basic.controller;
2 2
 
3 3
 import java.util.ArrayList;
4
-import java.util.Date;
5 4
 import java.util.HashMap;
6 5
 import java.util.List;
7 6
 import java.util.Map;
8
-import java.util.UUID;
9 7
 
10 8
 import javax.annotation.Resource;
11 9
 import javax.servlet.http.HttpServletRequest;
@@ -33,7 +31,6 @@ import com.chinaitop.depot.basic.service.BasicStorehouseService;
33 31
 import com.chinaitop.depot.basic.service.BasicWarehouseService;
34 32
 import com.chinaitop.depot.common.service.ImportServiceImpl;
35 33
 import com.chinaitop.utils.ParameterUtil;
36
-import com.fasterxml.jackson.databind.ObjectMapper;
37 34
 import com.github.pagehelper.PageHelper;
38 35
 import com.github.pagehelper.PageInfo;
39 36
 
@@ -196,55 +193,17 @@ public class BasicStorehouseController {
196 193
 		return map;
197 194
 	}
198 195
 
199
-	/**
200
-	 * 更新仓房信息
201
-	 *
202
-	 * @param storehouseJson JSON数据对象
203
-	 * @return
204
-	 */
205 196
 	@RequestMapping(value = "/edit", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
206 197
 	@ApiOperation(value="更新仓房信息", notes = "更新仓房信息")
207 198
 	@ApiImplicitParams({
208 199
 			@ApiImplicitParam(name = "storehouseJson", value = "JSON数据对象", paramType = "form"),
200
+			@ApiImplicitParam(name = "warehouseJson", value = "货位数据", paramType = "form"),
209 201
 			@ApiImplicitParam(name = "userInfo", value = "JSON登录对象", paramType = "form")
210 202
 	})
211
-	public Map<String, Object> edit(String storehouseJson, String userInfo) {
212
-		Map<String, Object> modelMap = new HashMap<String, Object>();
213
-		JSONObject user = null;
214
-		Integer orgId = null;
215
-		String userName = "";
216
-		if (null != userInfo && !"".equals(userInfo)) {
217
-			user = JSONObject.parseObject(userInfo);
218
-			orgId = Integer.parseInt(user.get("orgId") == null?"":user.get("orgId").toString());
219
-			userName = user.get("username") == null?"":user.get("username").toString();
220
-		}
221
-		Date date = new Date();
203
+	public Map<String, Object> edit(String storehouseJson, String warehouseJson, String userInfo) {
204
+		Map<String, Object> modelMap = null;
222 205
 		try {
223
-			// JSON字符串转对象
224
-			ObjectMapper mapper = new ObjectMapper();
225
-			BasicStorehouse basicStorehouse = (BasicStorehouse) mapper.readValue(storehouseJson, BasicStorehouse.class);
226
-			basicStorehouse.setDelFlag(1);
227
-			if (basicStorehouse.getStorehouseId() == null) {
228
-				String uuid = UUID.randomUUID().toString();
229
-				//String uuid = UUID.randomUUID().toString().replaceAll("-", "");
230
-				basicStorehouse.setUuid(uuid);
231
-
232
-				if(!ParameterUtil.isequal(basicStorehouse.getLibraryType(),"1")){
233
-					basicStorehouse.setDepotId(orgId);
234
-				}
235
-				basicStorehouse.setOrgId(orgId);
236
-				basicStorehouse.setCreatename(userName);
237
-				basicStorehouse.setCreatedate(date);
238
-				basicStorehouseService.addBasicStorehouse(basicStorehouse);
239
-			} else {
240
-				if(!ParameterUtil.isequal(basicStorehouse.getLibraryType(),"1")){
241
-					basicStorehouse.setDutystoreman(null);
242
-				}
243
-				basicStorehouse.setUpdatename(userName);
244
-				basicStorehouse.setUpdatedate(date);
245
-				basicStorehouseService.updateBasicStorehouse(basicStorehouse);
246
-			}
247
-			modelMap.put("status", "success");
206
+			modelMap = basicStorehouseService.saveOrUpdate(storehouseJson, warehouseJson, userInfo);
248 207
 		} catch (Exception e) {
249 208
 			e.printStackTrace();
250 209
 			modelMap.put("status", "error");
@@ -253,12 +212,6 @@ public class BasicStorehouseController {
253 212
 		return modelMap;
254 213
 	}
255 214
 
256
-	/**
257
-	 * 按仓房ID逻辑删除仓房信息
258
-	 *
259
-	 * @param id 数据ID
260
-	 * @return
261
-	 */
262 215
 	@RequestMapping(value = "/remove", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
263 216
 	@ApiOperation(value="按仓房ID逻辑删除仓房信息", notes = "按仓房ID逻辑删除仓房信息")
264 217
 	@ApiImplicitParams({

+ 7 - 43
src/main/java/com/chinaitop/depot/basic/controller/BasicTankController.java

@@ -38,6 +38,7 @@ import io.swagger.annotations.ApiOperation;
38 38
  */
39 39
 @RestController
40 40
 @RequestMapping(value = "/Tank")
41
+@SuppressWarnings("all")
41 42
 @Api(value= "BasicTankController", description = "油罐管理控制类")
42 43
 public class BasicTankController {
43 44
 
@@ -87,60 +88,23 @@ public class BasicTankController {
87 88
         return pageInfo;
88 89
     }
89 90
 
90
-    /**
91
-     * 更新油罐信息
92
-     *
93
-     * @param tankJson JSON数据对象
94
-     * @return
95
-     */
96
-    @RequestMapping(value = "/edit", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
91
+	@RequestMapping(value = "/edit", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
97 92
     @ApiOperation(value="更新油罐信息", notes = "更新油罐信息")
98 93
     @ApiImplicitParams({
99 94
             @ApiImplicitParam(name = "tankJson", value = "JSON数据对象", paramType = "form"),
100 95
             @ApiImplicitParam(name = "orgId", value = "组织id", paramType = "form")
101 96
     })
102
-    public Map<String, Object> edit(String tankJson, Integer orgId) {
97
+    public Map<String, Object> edit(HttpServletRequest request, String tankJson, Integer orgId) {
103 98
         Map<String, Object> modelMap = new HashMap<String, Object>();
104 99
         try {
105
-            // JSON字符串转对象
106
-            ObjectMapper mapper = new ObjectMapper();
107
-            BasicTank basicTank = mapper.readValue(tankJson, BasicTank.class);
108
-            
109
-            // 校验编码是否重复
110
-            BasicTankExample example = new BasicTankExample();
111
-            BasicTankExample.Criteria criteria = example.createCriteria();
112
-            criteria.andOrgIdEqualTo(orgId);
113
-            criteria.andStoragetankCodeEqualTo(basicTank.getStoragetankCode());
114
-            List<BasicTank> list = null;
115
-            if (null != basicTank.getId() && !"".equals(basicTank.getId())) {//修改
116
-            	criteria.andIdNotEqualTo(basicTank.getId());
117
-            	
118
-            	// 查询除当前数据外还要别的油罐编码跟当前录入的编码一样,一样就是有重复的,没有就可以录入
119
-            	list = basicTankService.findBasicTank(example);
120
-            	if (null != list && list.size() > 0) {
121
-            		// 获取自己数据的ID
122
-            		modelMap.put("status", "error");
123
-            		modelMap.put("msg", "油罐编码已存在,不可与其它油罐编码重复!");
124
-            		return modelMap;
125
-            	}
126
-            } else {//新增
127
-            	list = basicTankService.findBasicTank(example);
128
-            	if (null != list && list.size() > 0) {
129
-            		modelMap.put("status", "error");
130
-            		modelMap.put("msg", "油罐编码已存在,不可与其它油罐编码重复!");
131
-            		return modelMap;
132
-            	}
133
-            }
134
-
135
-            basicTankService.saveOrEdit(basicTank,orgId);
136
-            modelMap.put("status", "success");
137
-            modelMap.put("msg", "保存成功!");
100
+            modelMap = basicTankService.updateOrSave(request, tankJson, orgId);
138 101
         } catch (Exception e) {
139 102
             e.printStackTrace();
140 103
             modelMap.put("status", "error");
141 104
             modelMap.put("msg", "保存失败!");
142
-        }
143
-        return modelMap;
105
+        } finally {
106
+        	return modelMap;
107
+		}
144 108
     }
145 109
 
146 110
     /**

+ 9 - 0
src/main/java/com/chinaitop/depot/basic/mapper/BasicStorehouseMapper.java

@@ -40,4 +40,13 @@ public interface BasicStorehouseMapper {
40 40
 	List<BasicStorehouse> getThreeTempCheckList(Map<String, Object> map);
41 41
 
42 42
     Map<String, Object> getAgentDepotId(Map<String, Object> map);
43
+
44
+    /**
45
+     * 更新单位表仓房数和油罐数
46
+     * 
47
+     * @param map
48
+     */
49
+    void editOrgCfAndHwNum(Map<String, Object> map);
50
+
51
+    Map<String, Object> queryCrAndgw(Integer orgId);
43 52
 }

+ 24 - 0
src/main/java/com/chinaitop/depot/basic/mapper/BasicStorehouseMapper.xml

@@ -1223,4 +1223,28 @@
1223 1223
     </if>
1224 1224
     order by house.storehouse_id asc
1225 1225
   </select>
1226
+  <!-- 更新单位表的仓房数和货位数 -->
1227
+  <update id="editOrgCfAndHwNum" parameterType="java.util.Map" >
1228
+  	UPDATE org_info SET org_id=${orgId}
1229
+  	<if test="cf_count != null">
1230
+  	,house_number=${cf_count}
1231
+  	</if>
1232
+  	<if test="yg_count != null">
1233
+  	,tank_number=${yg_count}
1234
+  	</if>
1235
+  	<if test="cr_count != null">
1236
+  	,effective_capacity=${cr_count}
1237
+  	</if>
1238
+  	<if test="gr_count != null">
1239
+  	,yxgr=${gr_count}
1240
+  	</if>
1241
+  	WHERE org_id=${orgId}
1242
+  </update>
1243
+  <!-- 查询当前仓房和油罐的有效容量之和 -->
1244
+  <select id="queryCrAndgw" parameterType="java.lang.Integer" resultType="java.util.Map">
1245
+  	SELECT 
1246
+	IFNULL((SELECT SUM(a.actual_capacity) FROM basic_storehouse a WHERE a.org_id=#{orgId,jdbcType=INTEGER}),0) as cr_count,
1247
+	IFNULL((SELECT SUM(a.tank_capacity) FROM basic_tank a WHERE a.org_id=#{orgId,jdbcType=INTEGER}),0) as gr_count
1248
+	FROM DUAL
1249
+  </select>
1226 1250
 </mapper>

+ 30 - 0
src/main/java/com/chinaitop/depot/basic/mapper/BasicTankHwMapper.java

@@ -0,0 +1,30 @@
1
+package com.chinaitop.depot.basic.mapper;
2
+
3
+import com.chinaitop.depot.basic.model.BasicTankHw;
4
+import com.chinaitop.depot.basic.model.BasicTankHwExample;
5
+import java.util.List;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+public interface BasicTankHwMapper {
9
+    int countByExample(BasicTankHwExample example);
10
+
11
+    int deleteByExample(BasicTankHwExample example);
12
+
13
+    int deleteByPrimaryKey(Integer id);
14
+
15
+    int insert(BasicTankHw record);
16
+
17
+    int insertSelective(BasicTankHw record);
18
+
19
+    List<BasicTankHw> selectByExample(BasicTankHwExample example);
20
+
21
+    BasicTankHw selectByPrimaryKey(Integer id);
22
+
23
+    int updateByExampleSelective(@Param("record") BasicTankHw record, @Param("example") BasicTankHwExample example);
24
+
25
+    int updateByExample(@Param("record") BasicTankHw record, @Param("example") BasicTankHwExample example);
26
+
27
+    int updateByPrimaryKeySelective(BasicTankHw record);
28
+
29
+    int updateByPrimaryKey(BasicTankHw record);
30
+}

+ 320 - 0
src/main/java/com/chinaitop/depot/basic/mapper/BasicTankHwMapper.xml

@@ -0,0 +1,320 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.chinaitop.depot.basic.mapper.BasicTankHwMapper" >
4
+  <resultMap id="BaseResultMap" type="com.chinaitop.depot.basic.model.BasicTankHw" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="org_id" property="orgId" jdbcType="INTEGER" />
7
+    <result column="hwbm" property="hwbm" jdbcType="VARCHAR" />
8
+    <result column="hwmc" property="hwmc" jdbcType="VARCHAR" />
9
+    <result column="ajdm" property="ajdm" jdbcType="VARCHAR" />
10
+    <result column="hwqyrq" property="hwqyrq" jdbcType="TIMESTAMP" />
11
+    <result column="hwrl" property="hwrl" jdbcType="DECIMAL" />
12
+    <result column="bgdw" property="bgdw" jdbcType="VARCHAR" />
13
+    <result column="bgy" property="bgy" jdbcType="VARCHAR" />
14
+    <result column="czbz" property="czbz" jdbcType="VARCHAR" />
15
+    <result column="zhgxsj" property="zhgxsj" jdbcType="TIMESTAMP" />
16
+    <result column="crk_status" property="crkStatus" jdbcType="VARCHAR" />
17
+  </resultMap>
18
+  <sql id="Example_Where_Clause" >
19
+    <where >
20
+      <foreach collection="oredCriteria" item="criteria" separator="or" >
21
+        <if test="criteria.valid" >
22
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
23
+            <foreach collection="criteria.criteria" item="criterion" >
24
+              <choose >
25
+                <when test="criterion.noValue" >
26
+                  and ${criterion.condition}
27
+                </when>
28
+                <when test="criterion.singleValue" >
29
+                  and ${criterion.condition} #{criterion.value}
30
+                </when>
31
+                <when test="criterion.betweenValue" >
32
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
33
+                </when>
34
+                <when test="criterion.listValue" >
35
+                  and ${criterion.condition}
36
+                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
37
+                    #{listItem}
38
+                  </foreach>
39
+                </when>
40
+              </choose>
41
+            </foreach>
42
+          </trim>
43
+        </if>
44
+      </foreach>
45
+    </where>
46
+  </sql>
47
+  <sql id="Update_By_Example_Where_Clause" >
48
+    <where >
49
+      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
50
+        <if test="criteria.valid" >
51
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
52
+            <foreach collection="criteria.criteria" item="criterion" >
53
+              <choose >
54
+                <when test="criterion.noValue" >
55
+                  and ${criterion.condition}
56
+                </when>
57
+                <when test="criterion.singleValue" >
58
+                  and ${criterion.condition} #{criterion.value}
59
+                </when>
60
+                <when test="criterion.betweenValue" >
61
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
62
+                </when>
63
+                <when test="criterion.listValue" >
64
+                  and ${criterion.condition}
65
+                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
66
+                    #{listItem}
67
+                  </foreach>
68
+                </when>
69
+              </choose>
70
+            </foreach>
71
+          </trim>
72
+        </if>
73
+      </foreach>
74
+    </where>
75
+  </sql>
76
+  <sql id="Base_Column_List" >
77
+    id, org_id, hwbm, hwmc, ajdm, hwqyrq, hwrl, bgdw, bgy, czbz, zhgxsj, crk_status
78
+  </sql>
79
+  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.basic.model.BasicTankHwExample" >
80
+    select
81
+    <if test="distinct" >
82
+      distinct
83
+    </if>
84
+    <include refid="Base_Column_List" />
85
+    from basic_tank_hw
86
+    <if test="_parameter != null" >
87
+      <include refid="Example_Where_Clause" />
88
+    </if>
89
+    <if test="orderByClause != null" >
90
+      order by ${orderByClause}
91
+    </if>
92
+  </select>
93
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
94
+    select 
95
+    <include refid="Base_Column_List" />
96
+    from basic_tank_hw
97
+    where id = #{id,jdbcType=INTEGER}
98
+  </select>
99
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
100
+    delete from basic_tank_hw
101
+    where id = #{id,jdbcType=INTEGER}
102
+  </delete>
103
+  <delete id="deleteByExample" parameterType="com.chinaitop.depot.basic.model.BasicTankHwExample" >
104
+    delete from basic_tank_hw
105
+    <if test="_parameter != null" >
106
+      <include refid="Example_Where_Clause" />
107
+    </if>
108
+  </delete>
109
+  <insert id="insert" parameterType="com.chinaitop.depot.basic.model.BasicTankHw" >
110
+    insert into basic_tank_hw (id, org_id, hwbm, 
111
+      hwmc, ajdm, hwqyrq, 
112
+      hwrl, bgdw, bgy, czbz, 
113
+      zhgxsj, crk_status)
114
+    values (#{id,jdbcType=INTEGER}, #{orgId,jdbcType=INTEGER}, #{hwbm,jdbcType=VARCHAR}, 
115
+      #{hwmc,jdbcType=VARCHAR}, #{ajdm,jdbcType=VARCHAR}, #{hwqyrq,jdbcType=TIMESTAMP}, 
116
+      #{hwrl,jdbcType=DECIMAL}, #{bgdw,jdbcType=VARCHAR}, #{bgy,jdbcType=VARCHAR}, #{czbz,jdbcType=VARCHAR}, 
117
+      #{zhgxsj,jdbcType=TIMESTAMP}, #{crkStatus,jdbcType=VARCHAR})
118
+  </insert>
119
+  <insert id="insertSelective" parameterType="com.chinaitop.depot.basic.model.BasicTankHw" >
120
+    insert into basic_tank_hw
121
+    <trim prefix="(" suffix=")" suffixOverrides="," >
122
+      <if test="id != null" >
123
+        id,
124
+      </if>
125
+      <if test="orgId != null" >
126
+        org_id,
127
+      </if>
128
+      <if test="hwbm != null" >
129
+        hwbm,
130
+      </if>
131
+      <if test="hwmc != null" >
132
+        hwmc,
133
+      </if>
134
+      <if test="ajdm != null" >
135
+        ajdm,
136
+      </if>
137
+      <if test="hwqyrq != null" >
138
+        hwqyrq,
139
+      </if>
140
+      <if test="hwrl != null" >
141
+        hwrl,
142
+      </if>
143
+      <if test="bgdw != null" >
144
+        bgdw,
145
+      </if>
146
+      <if test="bgy != null" >
147
+        bgy,
148
+      </if>
149
+      <if test="czbz != null" >
150
+        czbz,
151
+      </if>
152
+      <if test="zhgxsj != null" >
153
+        zhgxsj,
154
+      </if>
155
+      <if test="crkStatus != null" >
156
+        crk_status,
157
+      </if>
158
+    </trim>
159
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
160
+      <if test="id != null" >
161
+        #{id,jdbcType=INTEGER},
162
+      </if>
163
+      <if test="orgId != null" >
164
+        #{orgId,jdbcType=INTEGER},
165
+      </if>
166
+      <if test="hwbm != null" >
167
+        #{hwbm,jdbcType=VARCHAR},
168
+      </if>
169
+      <if test="hwmc != null" >
170
+        #{hwmc,jdbcType=VARCHAR},
171
+      </if>
172
+      <if test="ajdm != null" >
173
+        #{ajdm,jdbcType=VARCHAR},
174
+      </if>
175
+      <if test="hwqyrq != null" >
176
+        #{hwqyrq,jdbcType=TIMESTAMP},
177
+      </if>
178
+      <if test="hwrl != null" >
179
+        #{hwrl,jdbcType=DECIMAL},
180
+      </if>
181
+      <if test="bgdw != null" >
182
+        #{bgdw,jdbcType=VARCHAR},
183
+      </if>
184
+      <if test="bgy != null" >
185
+        #{bgy,jdbcType=VARCHAR},
186
+      </if>
187
+      <if test="czbz != null" >
188
+        #{czbz,jdbcType=VARCHAR},
189
+      </if>
190
+      <if test="zhgxsj != null" >
191
+        #{zhgxsj,jdbcType=TIMESTAMP},
192
+      </if>
193
+      <if test="crkStatus != null" >
194
+        #{crkStatus,jdbcType=VARCHAR},
195
+      </if>
196
+    </trim>
197
+  </insert>
198
+  <select id="countByExample" parameterType="com.chinaitop.depot.basic.model.BasicTankHwExample" resultType="java.lang.Integer" >
199
+    select count(*) from basic_tank_hw
200
+    <if test="_parameter != null" >
201
+      <include refid="Example_Where_Clause" />
202
+    </if>
203
+  </select>
204
+  <update id="updateByExampleSelective" parameterType="map" >
205
+    update basic_tank_hw
206
+    <set >
207
+      <if test="record.id != null" >
208
+        id = #{record.id,jdbcType=INTEGER},
209
+      </if>
210
+      <if test="record.orgId != null" >
211
+        org_id = #{record.orgId,jdbcType=INTEGER},
212
+      </if>
213
+      <if test="record.hwbm != null" >
214
+        hwbm = #{record.hwbm,jdbcType=VARCHAR},
215
+      </if>
216
+      <if test="record.hwmc != null" >
217
+        hwmc = #{record.hwmc,jdbcType=VARCHAR},
218
+      </if>
219
+      <if test="record.ajdm != null" >
220
+        ajdm = #{record.ajdm,jdbcType=VARCHAR},
221
+      </if>
222
+      <if test="record.hwqyrq != null" >
223
+        hwqyrq = #{record.hwqyrq,jdbcType=TIMESTAMP},
224
+      </if>
225
+      <if test="record.hwrl != null" >
226
+        hwrl = #{record.hwrl,jdbcType=DECIMAL},
227
+      </if>
228
+      <if test="record.bgdw != null" >
229
+        bgdw = #{record.bgdw,jdbcType=VARCHAR},
230
+      </if>
231
+      <if test="record.bgy != null" >
232
+        bgy = #{record.bgy,jdbcType=VARCHAR},
233
+      </if>
234
+      <if test="record.czbz != null" >
235
+        czbz = #{record.czbz,jdbcType=VARCHAR},
236
+      </if>
237
+      <if test="record.zhgxsj != null" >
238
+        zhgxsj = #{record.zhgxsj,jdbcType=TIMESTAMP},
239
+      </if>
240
+      <if test="record.crkStatus != null" >
241
+        crk_status = #{record.crkStatus,jdbcType=VARCHAR},
242
+      </if>
243
+    </set>
244
+    <if test="_parameter != null" >
245
+      <include refid="Update_By_Example_Where_Clause" />
246
+    </if>
247
+  </update>
248
+  <update id="updateByExample" parameterType="map" >
249
+    update basic_tank_hw
250
+    set id = #{record.id,jdbcType=INTEGER},
251
+      org_id = #{record.orgId,jdbcType=INTEGER},
252
+      hwbm = #{record.hwbm,jdbcType=VARCHAR},
253
+      hwmc = #{record.hwmc,jdbcType=VARCHAR},
254
+      ajdm = #{record.ajdm,jdbcType=VARCHAR},
255
+      hwqyrq = #{record.hwqyrq,jdbcType=TIMESTAMP},
256
+      hwrl = #{record.hwrl,jdbcType=DECIMAL},
257
+      bgdw = #{record.bgdw,jdbcType=VARCHAR},
258
+      bgy = #{record.bgy,jdbcType=VARCHAR},
259
+      czbz = #{record.czbz,jdbcType=VARCHAR},
260
+      zhgxsj = #{record.zhgxsj,jdbcType=TIMESTAMP},
261
+      crk_status = #{record.crkStatus,jdbcType=VARCHAR}
262
+    <if test="_parameter != null" >
263
+      <include refid="Update_By_Example_Where_Clause" />
264
+    </if>
265
+  </update>
266
+  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.basic.model.BasicTankHw" >
267
+    update basic_tank_hw
268
+    <set >
269
+      <if test="orgId != null" >
270
+        org_id = #{orgId,jdbcType=INTEGER},
271
+      </if>
272
+      <if test="hwbm != null" >
273
+        hwbm = #{hwbm,jdbcType=VARCHAR},
274
+      </if>
275
+      <if test="hwmc != null" >
276
+        hwmc = #{hwmc,jdbcType=VARCHAR},
277
+      </if>
278
+      <if test="ajdm != null" >
279
+        ajdm = #{ajdm,jdbcType=VARCHAR},
280
+      </if>
281
+      <if test="hwqyrq != null" >
282
+        hwqyrq = #{hwqyrq,jdbcType=TIMESTAMP},
283
+      </if>
284
+      <if test="hwrl != null" >
285
+        hwrl = #{hwrl,jdbcType=DECIMAL},
286
+      </if>
287
+      <if test="bgdw != null" >
288
+        bgdw = #{bgdw,jdbcType=VARCHAR},
289
+      </if>
290
+      <if test="bgy != null" >
291
+        bgy = #{bgy,jdbcType=VARCHAR},
292
+      </if>
293
+      <if test="czbz != null" >
294
+        czbz = #{czbz,jdbcType=VARCHAR},
295
+      </if>
296
+      <if test="zhgxsj != null" >
297
+        zhgxsj = #{zhgxsj,jdbcType=TIMESTAMP},
298
+      </if>
299
+      <if test="crkStatus != null" >
300
+        crk_status = #{crkStatus,jdbcType=VARCHAR},
301
+      </if>
302
+    </set>
303
+    where id = #{id,jdbcType=INTEGER}
304
+  </update>
305
+  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.basic.model.BasicTankHw" >
306
+    update basic_tank_hw
307
+    set org_id = #{orgId,jdbcType=INTEGER},
308
+      hwbm = #{hwbm,jdbcType=VARCHAR},
309
+      hwmc = #{hwmc,jdbcType=VARCHAR},
310
+      ajdm = #{ajdm,jdbcType=VARCHAR},
311
+      hwqyrq = #{hwqyrq,jdbcType=TIMESTAMP},
312
+      hwrl = #{hwrl,jdbcType=DECIMAL},
313
+      bgdw = #{bgdw,jdbcType=VARCHAR},
314
+      bgy = #{bgy,jdbcType=VARCHAR},
315
+      czbz = #{czbz,jdbcType=VARCHAR},
316
+      zhgxsj = #{zhgxsj,jdbcType=TIMESTAMP},
317
+      crk_status = #{crkStatus,jdbcType=VARCHAR}
318
+    where id = #{id,jdbcType=INTEGER}
319
+  </update>
320
+</mapper>

+ 22 - 7
src/main/java/com/chinaitop/depot/basic/mapper/BasicTankMapper.xml

@@ -20,7 +20,8 @@
20 20
     <result column="tank_status" jdbcType="INTEGER" property="tankStatus" />
21 21
     <result column="org_id" jdbcType="INTEGER" property="orgId" />
22 22
     <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
23
-    <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
23
+    <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
24
+    <result column="crk_status" jdbcType="VARCHAR" property="crkStatus" />
24 25
   </resultMap>
25 26
   <sql id="Example_Where_Clause">
26 27
     <where>
@@ -83,7 +84,7 @@
83 84
   <sql id="Base_Column_List">
84 85
     id, storageTank_code, storageTank_name, org_code, tank_capacity, createDate, facilities_type, 
85 86
     heating_type, tank_type, diameter, height, buildDate, check_way, weld_way, tank_apply, tank_status, 
86
-    org_id, del_flag, updatetime
87
+    org_id, del_flag, updatetime, crk_status
87 88
   </sql>
88 89
   <select id="selectByExample" parameterType="com.chinaitop.depot.basic.model.BasicTankExample" resultMap="BaseResultMap">
89 90
     select
@@ -121,17 +122,17 @@
121 122
       facilities_type, heating_type, tank_type, 
122 123
       diameter, height, buildDate, check_way, 
123 124
       weld_way, tank_apply, tank_status, 
124
-      org_id, del_flag, updatetime
125
+      org_id, del_flag, updatetime, crk_status
125 126
       )
126 127
     values (#{id,jdbcType=INTEGER}, #{storagetankCode,jdbcType=VARCHAR}, #{storagetankName,jdbcType=VARCHAR}, 
127 128
       #{orgCode,jdbcType=VARCHAR}, #{tankCapacity,jdbcType=DECIMAL}, #{createdate,jdbcType=TIMESTAMP}, 
128 129
       #{facilitiesType,jdbcType=INTEGER}, #{heatingType,jdbcType=INTEGER}, #{tankType,jdbcType=INTEGER}, 
129 130
       #{diameter,jdbcType=DECIMAL}, #{height,jdbcType=DECIMAL}, #{builddate,jdbcType=TIMESTAMP}, #{checkWay,jdbcType=INTEGER}, 
130 131
       #{weldWay,jdbcType=INTEGER}, #{tankApply,jdbcType=INTEGER}, #{tankStatus,jdbcType=INTEGER}, 
131
-      #{orgId,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER}, #{updatetime,jdbcType=TIMESTAMP}
132
+      #{orgId,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER}, #{updatetime,jdbcType=TIMESTAMP}, #{crkStatus,jdbcType=VARCHAR}
132 133
       )
133 134
   </insert>
134
-  <insert id="insertSelective" parameterType="com.chinaitop.depot.basic.model.BasicTank">
135
+  <insert id="insertSelective" parameterType="com.chinaitop.depot.basic.model.BasicTank"  keyProperty="id" useGeneratedKeys="true">
135 136
     insert into basic_tank
136 137
     <trim prefix="(" suffix=")" suffixOverrides=",">
137 138
       <if test="id != null">
@@ -190,6 +191,9 @@
190 191
       </if>
191 192
       <if test="updatetime != null">
192 193
         updatetime,
194
+      </if>
195
+      <if test="crkStatus != null">
196
+        crk_status,
193 197
       </if>
194 198
     </trim>
195 199
     <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -249,6 +253,9 @@
249 253
       </if>
250 254
       <if test="updatetime != null">
251 255
         #{updatetime,jdbcType=TIMESTAMP},
256
+      </if>
257
+      <if test="crkStatus != null">
258
+        #{crkStatus,jdbcType=VARCHAR},
252 259
       </if>
253 260
     </trim>
254 261
   </insert>
@@ -317,6 +324,9 @@
317 324
       </if>
318 325
       <if test="record.updatetime != null">
319 326
         updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
327
+      </if>
328
+      <if test="record.crkStatus != null">
329
+        crk_status = #{record.crkStatus,jdbcType=VARCHAR},
320 330
       </if>
321 331
     </set>
322 332
     <if test="_parameter != null">
@@ -343,7 +353,8 @@
343 353
       tank_status = #{record.tankStatus,jdbcType=INTEGER},
344 354
       org_id = #{record.orgId,jdbcType=INTEGER},
345 355
       del_flag = #{record.delFlag,jdbcType=INTEGER},
346
-      updatetime = #{record.updatetime,jdbcType=TIMESTAMP}
356
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
357
+      crk_status = #{record.crkStatus,jdbcType=VARCHAR}
347 358
     <if test="_parameter != null">
348 359
       <include refid="Update_By_Example_Where_Clause" />
349 360
     </if>
@@ -404,6 +415,9 @@
404 415
       </if>
405 416
       <if test="updatetime != null">
406 417
         updatetime = #{updatetime,jdbcType=TIMESTAMP},
418
+      </if>
419
+      <if test="crkStatus != null">
420
+        crk_status = #{crkStatus,jdbcType=VARCHAR},
407 421
       </if>
408 422
     </set>
409 423
     where id = #{id,jdbcType=INTEGER}
@@ -427,7 +441,8 @@
427 441
       tank_status = #{tankStatus,jdbcType=INTEGER},
428 442
       org_id = #{orgId,jdbcType=INTEGER},
429 443
       del_flag = #{delFlag,jdbcType=INTEGER},
430
-      updatetime = #{updatetime,jdbcType=TIMESTAMP}
444
+      updatetime = #{updatetime,jdbcType=TIMESTAMP},
445
+      crk_status = #{crkStatus,jdbcType=VARCHAR}
431 446
     where id = #{id,jdbcType=INTEGER}
432 447
   </update>
433 448
 </mapper>

+ 11 - 0
src/main/java/com/chinaitop/depot/basic/model/BasicTank.java

@@ -41,6 +41,8 @@ public class BasicTank {
41 41
     private Integer delFlag;
42 42
 
43 43
     private Date updatetime;
44
+    
45
+    private String crkStatus;
44 46
 
45 47
     /**
46 48
      * 油罐id
@@ -337,4 +339,13 @@ public class BasicTank {
337 339
     public void setUpdatetime(Date updatetime) {
338 340
         this.updatetime = updatetime;
339 341
     }
342
+
343
+	public String getCrkStatus() {
344
+		return crkStatus;
345
+	}
346
+
347
+	public void setCrkStatus(String crkStatus) {
348
+		this.crkStatus = crkStatus;
349
+	}
350
+
340 351
 }

+ 5 - 0
src/main/java/com/chinaitop/depot/basic/model/BasicTankExample.java

@@ -1227,6 +1227,11 @@ public class BasicTankExample {
1227 1227
             addCriterion("updatetime not between", value1, value2, "updatetime");
1228 1228
             return (Criteria) this;
1229 1229
         }
1230
+
1231
+        public Criteria andCrkStatusEqualTo(String value) {
1232
+            addCriterion("crk_status =", value, "crkStatus");
1233
+            return (Criteria) this;
1234
+        }
1230 1235
     }
1231 1236
 
1232 1237
     /**

+ 222 - 0
src/main/java/com/chinaitop/depot/basic/model/BasicTankHw.java

@@ -0,0 +1,222 @@
1
+package com.chinaitop.depot.basic.model;
2
+
3
+import java.math.BigDecimal;
4
+import java.util.Date;
5
+
6
+public class BasicTankHw {
7
+    private Integer id;
8
+
9
+    private Integer orgId;
10
+
11
+    private String hwbm;
12
+
13
+    private String hwmc;
14
+
15
+    private String ajdm;
16
+
17
+    private Date hwqyrq;
18
+
19
+    private BigDecimal hwrl;
20
+
21
+    private String bgdw;
22
+
23
+    private String bgy;
24
+
25
+    private String czbz;
26
+
27
+    private Date zhgxsj;
28
+
29
+    private String crkStatus;
30
+
31
+    /**
32
+     * 油罐货位主键ID
33
+     * @return id 油罐货位主键ID
34
+     */
35
+    public Integer getId() {
36
+        return id;
37
+    }
38
+
39
+    /**
40
+     * 油罐货位主键ID
41
+     * @param id 油罐货位主键ID
42
+     */
43
+    public void setId(Integer id) {
44
+        this.id = id;
45
+    }
46
+
47
+    /**
48
+     * 单位ID
49
+     * @return org_id 单位ID
50
+     */
51
+    public Integer getOrgId() {
52
+        return orgId;
53
+    }
54
+
55
+    /**
56
+     * 单位ID
57
+     * @param orgId 单位ID
58
+     */
59
+    public void setOrgId(Integer orgId) {
60
+        this.orgId = orgId;
61
+    }
62
+
63
+    /**
64
+     * 货位编码
65
+     * @return hwbm 货位编码
66
+     */
67
+    public String getHwbm() {
68
+        return hwbm;
69
+    }
70
+
71
+    /**
72
+     * 货位编码
73
+     * @param hwbm 货位编码
74
+     */
75
+    public void setHwbm(String hwbm) {
76
+        this.hwbm = hwbm == null ? null : hwbm.trim();
77
+    }
78
+
79
+    /**
80
+     * 货位名称
81
+     * @return hwmc 货位名称
82
+     */
83
+    public String getHwmc() {
84
+        return hwmc;
85
+    }
86
+
87
+    /**
88
+     * 货位名称
89
+     * @param hwmc 货位名称
90
+     */
91
+    public void setHwmc(String hwmc) {
92
+        this.hwmc = hwmc == null ? null : hwmc.trim();
93
+    }
94
+
95
+    /**
96
+     * 廒间代码
97
+     * @return ajdm 廒间代码
98
+     */
99
+    public String getAjdm() {
100
+        return ajdm;
101
+    }
102
+
103
+    /**
104
+     * 廒间代码
105
+     * @param ajdm 廒间代码
106
+     */
107
+    public void setAjdm(String ajdm) {
108
+        this.ajdm = ajdm == null ? null : ajdm.trim();
109
+    }
110
+
111
+    /**
112
+     * 货位启用日期
113
+     * @return hwqyrq 货位启用日期
114
+     */
115
+    public Date getHwqyrq() {
116
+        return hwqyrq;
117
+    }
118
+
119
+    /**
120
+     * 货位启用日期
121
+     * @param hwqyrq 货位启用日期
122
+     */
123
+    public void setHwqyrq(Date hwqyrq) {
124
+        this.hwqyrq = hwqyrq;
125
+    }
126
+
127
+    /**
128
+     * 货位容量(吨)
129
+     * @return hwrl 货位容量(吨)
130
+     */
131
+    public BigDecimal getHwrl() {
132
+        return hwrl;
133
+    }
134
+
135
+    /**
136
+     * 货位容量(吨)
137
+     * @param hwrl 货位容量(吨)
138
+     */
139
+    public void setHwrl(BigDecimal hwrl) {
140
+        this.hwrl = hwrl;
141
+    }
142
+
143
+    /**
144
+     * 保管单位
145
+     * @return bgdw 保管单位
146
+     */
147
+    public String getBgdw() {
148
+        return bgdw;
149
+    }
150
+
151
+    /**
152
+     * 保管单位
153
+     * @param bgdw 保管单位
154
+     */
155
+    public void setBgdw(String bgdw) {
156
+        this.bgdw = bgdw == null ? null : bgdw.trim();
157
+    }
158
+
159
+    /**
160
+     * 保管员
161
+     * @return bgy 保管员
162
+     */
163
+    public String getBgy() {
164
+        return bgy;
165
+    }
166
+
167
+    /**
168
+     * 保管员
169
+     * @param bgy 保管员
170
+     */
171
+    public void setBgy(String bgy) {
172
+        this.bgy = bgy == null ? null : bgy.trim();
173
+    }
174
+
175
+    /**
176
+     * 操作标志(i:新增,u:更新,d:删除)
177
+     * @return czbz 操作标志(i:新增,u:更新,d:删除)
178
+     */
179
+    public String getCzbz() {
180
+        return czbz;
181
+    }
182
+
183
+    /**
184
+     * 操作标志(i:新增,u:更新,d:删除)
185
+     * @param czbz 操作标志(i:新增,u:更新,d:删除)
186
+     */
187
+    public void setCzbz(String czbz) {
188
+        this.czbz = czbz == null ? null : czbz.trim();
189
+    }
190
+
191
+    /**
192
+     * 最后更新时间
193
+     * @return zhgxsj 最后更新时间
194
+     */
195
+    public Date getZhgxsj() {
196
+        return zhgxsj;
197
+    }
198
+
199
+    /**
200
+     * 最后更新时间
201
+     * @param zhgxsj 最后更新时间
202
+     */
203
+    public void setZhgxsj(Date zhgxsj) {
204
+        this.zhgxsj = zhgxsj;
205
+    }
206
+
207
+    /**
208
+     * 出入库状态(1空仓,2入库中,3封仓,4出库中)
209
+     * @return crk_status 出入库状态(1空仓,2入库中,3封仓,4出库中)
210
+     */
211
+    public String getCrkStatus() {
212
+        return crkStatus;
213
+    }
214
+
215
+    /**
216
+     * 出入库状态(1空仓,2入库中,3封仓,4出库中)
217
+     * @param crkStatus 出入库状态(1空仓,2入库中,3封仓,4出库中)
218
+     */
219
+    public void setCrkStatus(String crkStatus) {
220
+        this.crkStatus = crkStatus == null ? null : crkStatus.trim();
221
+    }
222
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1010 - 0
src/main/java/com/chinaitop/depot/basic/model/BasicTankHwExample.java


+ 19 - 0
src/main/java/com/chinaitop/depot/basic/service/BasicStorehouseService.java

@@ -103,4 +103,23 @@ public interface BasicStorehouseService {
103 103
 	 */
104 104
 	public Map<String, Object> getThreeTempCheckList(Integer orgId);
105 105
 
106
+	/**
107
+	 * 更新仓房和货位信息
108
+	 * 
109
+	 * @param storehouseJson 仓房数据对象
110
+	 * @param warehouseJson 货位数据对象
111
+	 * @param userInfo 登录对象
112
+	 * @return
113
+	 * @throws Exception
114
+	 */
115
+	public Map<String, Object> saveOrUpdate(String storehouseJson, String warehouseJson, String userInfo) throws Exception;
116
+
117
+	/**
118
+	 * 更新单位表中仓房数
119
+	 * 
120
+	 * @param orgId
121
+	 * @throws Exception
122
+	 */
123
+	public void editOrgChNum(Integer orgId) throws Exception;
124
+
106 125
 }

+ 14 - 1
src/main/java/com/chinaitop/depot/basic/service/BasicTankService.java

@@ -5,13 +5,16 @@ import com.chinaitop.depot.basic.model.BasicTank;
5 5
 import com.chinaitop.depot.basic.model.BasicTankExample;
6 6
 
7 7
 import java.util.List;
8
+import java.util.Map;
9
+
10
+import javax.servlet.http.HttpServletRequest;
8 11
 
9 12
 public interface BasicTankService {
10 13
 
11 14
 
12 15
     List<BasicTank> findBasicTank(BasicTankExample example);
13 16
 
14
-    void saveOrEdit(BasicTank basicTank,Integer orgId);
17
+    void saveOrEdit(HttpServletRequest request, BasicTank basicTank,Integer orgId);
15 18
 
16 19
     BasicTank findByPrimary(Integer id);
17 20
 
@@ -20,4 +23,14 @@ public interface BasicTankService {
20 23
     Boolean findStorageTankCodeList(BasicTankExample basicTankExample, Integer id);
21 24
 
22 25
     String importData(List<List<String>> list, JSONObject user,String orgCode);
26
+
27
+    /**
28
+     * 更新油罐信息
29
+     * 
30
+     * @param request
31
+     * @param tankJson 油罐数据对象
32
+     * @param orgId 单位ID
33
+     * @return
34
+     */
35
+	Map<String, Object> updateOrSave(HttpServletRequest request, String tankJson, Integer orgId) throws Exception;
23 36
 }

+ 9 - 0
src/main/java/com/chinaitop/depot/basic/service/BasicWarehouseService.java

@@ -3,6 +3,7 @@ package com.chinaitop.depot.basic.service;
3 3
 import java.util.List;
4 4
 import java.util.Map;
5 5
 
6
+import com.chinaitop.depot.basic.model.BasicStorehouse;
6 7
 import com.chinaitop.depot.basic.model.BasicWarehouse;
7 8
 import com.chinaitop.depot.basic.model.BasicWarehouseExample;
8 9
 
@@ -66,4 +67,12 @@ public interface BasicWarehouseService {
66 67
 	 */
67 68
 	Integer getCountWhs(Integer orgId, Integer delFlag) throws Exception;
68 69
 
70
+	/**
71
+	 * 更新货位数据
72
+	 * 
73
+	 * @param basicStorehouse
74
+	 * @param warehouseJson
75
+	 */
76
+	void saveOrUpdate(BasicStorehouse basicStorehouse, String warehouseJson) throws Exception;
77
+
69 78
 }

+ 97 - 0
src/main/java/com/chinaitop/depot/basic/service/impl/BasicStorehouseServiceImpl.java

@@ -13,15 +13,19 @@ import javax.annotation.Resource;
13 13
 import com.chinaitop.depot.basic.mapper.BasicEnumMapper;
14 14
 import com.chinaitop.depot.basic.model.*;
15 15
 import com.chinaitop.utils.ParameterUtil;
16
+import com.fasterxml.jackson.databind.ObjectMapper;
17
+
16 18
 import org.springframework.stereotype.Service;
17 19
 
18 20
 import com.alibaba.fastjson.JSONObject;
19 21
 import com.chinaitop.depot.basic.mapper.BasicStorehouseMapper;
22
+import com.chinaitop.depot.basic.mapper.BasicTankMapper;
20 23
 import com.chinaitop.depot.basic.mapper.BasicWarehouseMapper;
21 24
 import com.chinaitop.depot.basic.model.BasicStorehouseExample.Criteria;
22 25
 import com.chinaitop.depot.basic.service.BasicKeeperHouseService;
23 26
 import com.chinaitop.depot.basic.service.BasicKeeperService;
24 27
 import com.chinaitop.depot.basic.service.BasicStorehouseService;
28
+import com.chinaitop.depot.basic.service.BasicWarehouseService;
25 29
 
26 30
 @Service
27 31
 @SuppressWarnings("all")
@@ -34,6 +38,9 @@ public class BasicStorehouseServiceImpl implements BasicStorehouseService {
34 38
 	private BasicWarehouseMapper wareMapper;
35 39
 
36 40
 	@Resource
41
+	private BasicWarehouseService warehouseService;
42
+
43
+	@Resource
37 44
 	private BasicEnumMapper enumMapper;
38 45
 
39 46
 	@Resource
@@ -41,6 +48,9 @@ public class BasicStorehouseServiceImpl implements BasicStorehouseService {
41 48
 
42 49
 	@Resource
43 50
 	private BasicKeeperService keeperService;
51
+	
52
+	@Resource
53
+	private BasicTankMapper basicTankMapper;
44 54
 
45 55
 	@Override
46 56
 	public void addBasicStorehouse(BasicStorehouse basicStorehouse) throws Exception {
@@ -517,4 +527,91 @@ public class BasicStorehouseServiceImpl implements BasicStorehouseService {
517 527
 		return modelMap;
518 528
 	}
519 529
 
530
+	@Override
531
+	public Map<String, Object> saveOrUpdate(String storehouseJson, String warehouseJson, String userInfo) throws Exception {
532
+		Map<String, Object> modelMap = new HashMap<String, Object>();
533
+		JSONObject user = null;
534
+		Integer orgId = null;
535
+		String userName = "";
536
+		if (null != userInfo && !"".equals(userInfo)) {
537
+			user = JSONObject.parseObject(userInfo);
538
+			orgId = Integer.parseInt(user.get("orgId") == null?"":user.get("orgId").toString());
539
+			userName = user.get("username") == null?"":user.get("username").toString();
540
+		}
541
+		Date date = new Date();
542
+
543
+		// JSON字符串转对象
544
+		ObjectMapper mapper = new ObjectMapper();
545
+		BasicStorehouse basicStorehouse = (BasicStorehouse) mapper.readValue(storehouseJson, BasicStorehouse.class);
546
+		basicStorehouse.setDelFlag(1);
547
+		if (basicStorehouse.getStorehouseId() == null) {
548
+			String uuid = UUID.randomUUID().toString();
549
+			//String uuid = UUID.randomUUID().toString().replaceAll("-", "");
550
+			basicStorehouse.setUuid(uuid);
551
+			
552
+			if(!ParameterUtil.isequal(basicStorehouse.getLibraryType(),"1")){
553
+				basicStorehouse.setDepotId(orgId);
554
+			}
555
+			basicStorehouse.setOrgId(orgId);
556
+			basicStorehouse.setCreatename(userName);
557
+			basicStorehouse.setCreatedate(date);
558
+			basic.insertSelective(basicStorehouse);
559
+
560
+		} else {
561
+			if(!ParameterUtil.isequal(basicStorehouse.getLibraryType(),"1")){
562
+				basicStorehouse.setDutystoreman(null);
563
+			}
564
+			basicStorehouse.setUpdatename(userName);
565
+			basicStorehouse.setUpdatedate(date);
566
+			basic.updateByPrimaryKey(basicStorehouse);
567
+		}
568
+
569
+		//更新货位数据
570
+		warehouseService.saveOrUpdate(basicStorehouse, warehouseJson);
571
+
572
+		//更新单位表中仓房数和货位数
573
+		editOrgChNum(orgId);
574
+
575
+		modelMap.put("status", "success");
576
+
577
+		return modelMap;
578
+	}
579
+
580
+	/**
581
+	 * 更新单位表中仓房数、油罐数、有效仓容、有效罐容
582
+	 * @param orgId
583
+	 */
584
+	@Override
585
+	public void editOrgChNum(Integer orgId) throws Exception {
586
+		//查询当前单位仓房数
587
+		BasicStorehouseExample cf_example = new BasicStorehouseExample();
588
+		BasicStorehouseExample.Criteria cf_criteria = cf_example.createCriteria();
589
+		cf_criteria.andOrgIdEqualTo(orgId);
590
+		cf_criteria.andLibraryTypeEqualTo("0");
591
+		cf_criteria.andDelFlagEqualTo(1);
592
+		int ch_count = basic.countByExample(cf_example);
593
+		
594
+		//查询当前单位的油罐数
595
+		BasicTankExample yg_example = new BasicTankExample();
596
+		BasicTankExample.Criteria yg_criteria = yg_example.createCriteria();
597
+		yg_criteria.andOrgIdEqualTo(orgId);
598
+		//yg_criteria.andLibraryTypeEqualTo("0");
599
+		yg_criteria.andDelFlagEqualTo(1);
600
+		int yg_count = basicTankMapper.countByExample(yg_example);
601
+
602
+		//查询当前单位仓房总实际容量和油罐总实际容量
603
+		Map<String, Object> rl_map = basic.queryCrAndgw(orgId);
604
+		
605
+
606
+		//更新当前单位下仓房数、货位数、有效仓房、有效罐容
607
+		Map<String, Object> map = new HashMap<String, Object>();
608
+		map.put("orgId", orgId);
609
+		map.put("cf_count", ch_count);
610
+		map.put("yg_count", yg_count);
611
+		map.put("cr_count", rl_map.get("cr_count"));
612
+		map.put("gr_count", rl_map.get("gr_count"));
613
+
614
+		basic.editOrgCfAndHwNum(map);
615
+	}
616
+
520 617
 }

+ 89 - 1
src/main/java/com/chinaitop/depot/basic/service/impl/BasicTankServiceImpl.java

@@ -6,18 +6,24 @@ import java.util.List;
6 6
 import java.util.Map;
7 7
 
8 8
 import javax.annotation.Resource;
9
+import javax.servlet.http.HttpServletRequest;
9 10
 
11
+import org.apache.commons.lang.ObjectUtils;
10 12
 import org.springframework.stereotype.Service;
11 13
 
12 14
 import com.alibaba.fastjson.JSONObject;
13 15
 import com.chinaitop.depot.basic.mapper.BasicEnumMapper;
16
+import com.chinaitop.depot.basic.mapper.BasicTankHwMapper;
14 17
 import com.chinaitop.depot.basic.mapper.BasicTankMapper;
15 18
 import com.chinaitop.depot.basic.model.BasicEnum;
16 19
 import com.chinaitop.depot.basic.model.BasicEnumExample;
17 20
 import com.chinaitop.depot.basic.model.BasicTank;
18 21
 import com.chinaitop.depot.basic.model.BasicTankExample;
22
+import com.chinaitop.depot.basic.model.BasicTankHw;
23
+import com.chinaitop.depot.basic.service.BasicStorehouseService;
19 24
 import com.chinaitop.depot.basic.service.BasicTankService;
20 25
 import com.chinaitop.utils.ParameterUtil;
26
+import com.fasterxml.jackson.databind.ObjectMapper;
21 27
 
22 28
 @Service
23 29
 public class BasicTankServiceImpl implements BasicTankService {
@@ -26,8 +32,14 @@ public class BasicTankServiceImpl implements BasicTankService {
26 32
 	private BasicTankMapper basicTankMapper;
27 33
 
28 34
 	@Resource
35
+	private BasicStorehouseService basicStorehouseService;
36
+
37
+	@Resource
29 38
 	private BasicEnumMapper enumMapper;
30 39
 
40
+	@Resource
41
+	private BasicTankHwMapper basicTankHwMapper;
42
+
31 43
 
32 44
 	@Override
33 45
 	public List<BasicTank> findBasicTank(BasicTankExample example) {
@@ -38,14 +50,44 @@ public class BasicTankServiceImpl implements BasicTankService {
38 50
 	}
39 51
 
40 52
 	@Override
41
-    public void saveOrEdit(BasicTank basicTank,Integer orgId) {
53
+    public void saveOrEdit(HttpServletRequest request, BasicTank basicTank,Integer orgId) {
42 54
 		basicTank.setDelFlag(1);
43 55
 		basicTank.setOrgId(orgId);
56
+
57
+		//组装油罐货位
58
+		String org_obj = ObjectUtils.toString(request.getSession().getAttribute("orgInfo"),"");
59
+		String bgdw = null;
60
+		if(!org_obj.isEmpty()) {
61
+			JSONObject obj = JSONObject.parseObject(org_obj);
62
+			bgdw = ObjectUtils.toString(obj.get("orgName"), "");//保管单位默认为当前用户所在的单位
63
+		}
64
+		BasicTankHw tankhw = new BasicTankHw();
65
+		tankhw.setOrgId(orgId);
66
+		tankhw.setHwbm("01");
67
+		tankhw.setHwmc(basicTank.getStoragetankName());
68
+		tankhw.setHwqyrq(basicTank.getBuilddate());
69
+		tankhw.setHwrl(basicTank.getTankCapacity());
70
+		tankhw.setBgdw(bgdw);
71
+		tankhw.setCzbz("i");
72
+		tankhw.setZhgxsj(basicTank.getCreatedate());
73
+		tankhw.setCrkStatus(basicTank.getCrkStatus());
44 74
         if(basicTank.getId()==null){
45 75
 			basicTankMapper.insertSelective(basicTank);
76
+
77
+			tankhw.setId(basicTank.getId());
78
+			basicTankHwMapper.insertSelective(tankhw);
46 79
 		}else{
47 80
 			basicTankMapper.updateByPrimaryKeySelective(basicTank);
81
+			basicTankHwMapper.updateByPrimaryKeySelective(tankhw);
48 82
 		}
83
+
84
+
85
+//        BasicTank basicTank_n = basicTankMapper.selectByPrimaryKey(basicTank.getId());
86
+//        if (null != basicTank_n) {
87
+//        	basicTankHwMapper.updateByPrimaryKeySelective(tankhw);
88
+//        } else {
89
+//        	basicTankHwMapper.insertSelective(tankhw);
90
+//        }
49 91
     }
50 92
 
51 93
     @Override
@@ -362,4 +404,50 @@ public class BasicTankServiceImpl implements BasicTankService {
362 404
 		}
363 405
 		return msg;
364 406
     }
407
+
408
+	@Override
409
+	public Map<String, Object> updateOrSave(HttpServletRequest request, String tankJson, Integer orgId) throws Exception {
410
+		Map<String, Object> modelMap = new HashMap<String, Object>();
411
+
412
+		// JSON字符串转对象
413
+		ObjectMapper mapper = new ObjectMapper();
414
+		BasicTank basicTank = mapper.readValue(tankJson, BasicTank.class);
415
+
416
+		// 校验编码是否重复
417
+		BasicTankExample example = new BasicTankExample();
418
+		BasicTankExample.Criteria criteria = example.createCriteria();
419
+		criteria.andOrgIdEqualTo(orgId);
420
+		criteria.andStoragetankCodeEqualTo(basicTank.getStoragetankCode());
421
+		List<BasicTank> list = null;
422
+		if (null != basicTank.getId() && !"".equals(basicTank.getId())) {//修改
423
+			criteria.andIdNotEqualTo(basicTank.getId());
424
+
425
+			// 查询除当前数据外还要别的油罐编码跟当前录入的编码一样,一样就是有重复的,没有就可以录入
426
+			list = basicTankMapper.selectByExample(example);
427
+			if (null != list && list.size() > 0) {
428
+				// 获取自己数据的ID
429
+				modelMap.put("status", "error");
430
+				modelMap.put("msg", "油罐编码已存在,不可与其它油罐编码重复!");
431
+				return modelMap;
432
+			}
433
+		} else {//新增
434
+			list = basicTankMapper.selectByExample(example);
435
+			if (null != list && list.size() > 0) {
436
+				modelMap.put("status", "error");
437
+				modelMap.put("msg", "油罐编码已存在,不可与其它油罐编码重复!");
438
+				return modelMap;
439
+			}
440
+		}
441
+
442
+		//更新油罐信息
443
+		this.saveOrEdit(request, basicTank, orgId);
444
+		
445
+		//更新单位表中仓房数、油罐数、有效仓容、有效罐容
446
+		basicStorehouseService.editOrgChNum(orgId);
447
+
448
+		modelMap.put("status", "success");
449
+		modelMap.put("msg", "保存成功!");
450
+
451
+        return modelMap;
452
+	}
365 453
 }

+ 23 - 0
src/main/java/com/chinaitop/depot/basic/service/impl/BasicWarehouseServiceImpl.java

@@ -10,10 +10,13 @@ import javax.annotation.Resource;
10 10
 import org.springframework.stereotype.Service;
11 11
 
12 12
 import com.chinaitop.depot.basic.mapper.BasicWarehouseMapper;
13
+import com.chinaitop.depot.basic.model.BasicStorehouse;
13 14
 import com.chinaitop.depot.basic.model.BasicWarehouse;
14 15
 import com.chinaitop.depot.basic.model.BasicWarehouseExample;
15 16
 import com.chinaitop.depot.basic.model.BasicWarehouseExample.Criteria;
16 17
 import com.chinaitop.depot.basic.service.BasicWarehouseService;
18
+import com.fasterxml.jackson.core.type.TypeReference;
19
+import com.fasterxml.jackson.databind.ObjectMapper;
17 20
 
18 21
 @Service
19 22
 public class BasicWarehouseServiceImpl implements BasicWarehouseService {
@@ -108,4 +111,24 @@ public class BasicWarehouseServiceImpl implements BasicWarehouseService {
108 111
 		return hws;
109 112
 	}
110 113
 
114
+	@Override
115
+	public void saveOrUpdate(BasicStorehouse storehouse, String warehouseJson) throws Exception {
116
+		ObjectMapper mappers = new ObjectMapper();
117
+		List<BasicWarehouse> list = mappers.readValue(warehouseJson, new TypeReference<List<BasicWarehouse>>(){});
118
+
119
+		for (BasicWarehouse warehouse : list) {
120
+			if (null == warehouse.getWarehouseId()) {//没有货位ID那就是新增
121
+				warehouse.setStorehouseId(storehouse.getStorehouseId());
122
+				warehouse.setCreatename(storehouse.getCreatename());
123
+				warehouse.setCreatedate(storehouse.getCreatedate());
124
+				warehouse.setOrgId(storehouse.getOrgId());
125
+				mapper.insertSelective(warehouse);
126
+			} else {
127
+				warehouse.setUpdatename(storehouse.getUpdatename());
128
+				warehouse.setUpdatedate(storehouse.getUpdatedate());
129
+				mapper.updateByPrimaryKeySelective(warehouse);
130
+			}
131
+		}
132
+	}
133
+
111 134
 }

+ 1 - 1
src/main/java/com/chinaitop/depot/utils/GeneratorSqlmap.java

@@ -16,7 +16,7 @@ public class GeneratorSqlmap {
16 16
 		List<String> warnings = new ArrayList<String>();
17 17
 		boolean overwrite = true;
18 18
 		//指定 逆向工程配置文件(写自己电脑的路径)F:\LsProject\depot-basic\src\main\resources
19
-		File configFile = new File("D:\\git_10.10.1.25\\depot-basic-yunnan\\src\\main\\resources\\generatorConfig.xml");
19
+		File configFile = new File("D:\\git_ziguangyun_gogs\\yunnan\\depot-basic-yunnan\\src\\main\\resources\\generatorConfig.xml");
20 20
 		ConfigurationParser cp = new ConfigurationParser(warnings);
21 21
 		Configuration config = cp.parseConfiguration(configFile);
22 22
 		DefaultShellCallback callback = new DefaultShellCallback(overwrite);