YL2767 1 kuukausi sitten
vanhempi
commit
12690fede8

+ 23
- 2
src/main/java/com/th/demo/controller/ware/StoreController.java Näytä tiedosto

@@ -163,12 +163,15 @@ public class StoreController {
163 163
     }
164 164
 
165 165
     @RequestMapping(value = "/changeStack.do")
166
-    public String changeStack(String json,String newWare,String newStack,String newRemark1,HttpServletRequest request) {
166
+    public String changeStack(String json,String newWare,String newStack,
167
+                              String newRemark1,
168
+                              String newRemark,
169
+                              HttpServletRequest request) {
167 170
 
168 171
         try {
169 172
             String userId = (String) request.getAttribute("userId");
170 173
             String belongId = (String) request.getAttribute("belongId");
171
-            result=storeService.changeStack(json,newWare,newStack,newRemark1,userId,belongId);
174
+            result=storeService.changeStack(json,newWare,newStack,newRemark1,newRemark,userId,belongId);
172 175
 
173 176
         } catch (Exception ex) {
174 177
             ex.printStackTrace();
@@ -178,4 +181,22 @@ public class StoreController {
178 181
         }
179 182
     }
180 183
 
184
+    @RequestMapping(value = "/changeCustName.do")
185
+    public String changeCustName(String json,
186
+                              String newCustomername,
187
+                              String newFKCustomername,
188
+                              HttpServletRequest request) {
189
+
190
+        try {
191
+            String userId = (String) request.getAttribute("userId");
192
+            String belongId = (String) request.getAttribute("belongId");
193
+            result=storeService.changeCustName(json,newCustomername,newFKCustomername,userId,belongId);
194
+
195
+        } catch (Exception ex) {
196
+            ex.printStackTrace();
197
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
198
+        } finally {
199
+            return result;
200
+        }
201
+    }
181 202
 }

+ 5
- 1
src/main/java/com/th/demo/service/impl/ware/InServiceImpl.java Näytä tiedosto

@@ -395,7 +395,11 @@ public class InServiceImpl implements InService {
395 395
             }else {
396 396
                 store.setRemark1("");
397 397
             }
398
-
398
+            if (listJO.get(i).get("收货地址") == null || listJO.get(i).get("收货地址").toString().equals("")) {
399
+                store.setReceiveAddress("");
400
+            }else {
401
+                store.setReceiveAddress(listJO.get(i).get("收货地址").toString());
402
+            }
399 403
             /*if (listJO.get(i).get("目的地") == null || listJO.get(i).get("目的地").toString().equals("")) {
400 404
                 store.setReceiveAddress(customer.getAddress());
401 405
             } else {

+ 41
- 1
src/main/java/com/th/demo/service/impl/ware/StoreServiceImpl.java Näytä tiedosto

@@ -42,6 +42,8 @@ public class StoreServiceImpl implements StoreService {
42 42
     public StackMapper stackMapper;
43 43
     @Autowired//自动注入Mapper
44 44
     public MoveRecordMapper moveRecordMapper;
45
+    @Autowired//自动注入Mapper
46
+    public CustomerMapper customerMapper;
45 47
     String result = Type.FAIL;
46 48
     int num = 0;
47 49
 
@@ -249,7 +251,8 @@ public class StoreServiceImpl implements StoreService {
249 251
 //    }
250 252
 
251 253
     @Override
252
-    public String changeStack(String json,String newWare,String newStack,String newRemark1,String userId,String belongId) {
254
+    public String changeStack(String json,String newWare,String newStack,String newRemark1,
255
+                              String newRemark,String userId,String belongId) {
253 256
         List<Store> listStore = JSON.parseObject(json, new TypeReference<List<Store>>() {});
254 257
 
255 258
         int layerNew = 0;
@@ -293,11 +296,48 @@ public class StoreServiceImpl implements StoreService {
293 296
                     listStore.get(i).setRemark1(newRemark1);
294 297
                 }
295 298
             }
299
+            if (!newRemark.equals("") && newRemark!=null){
300
+                if (newRemark.equals("0")){
301
+                    listStore.get(i).setRemark("");
302
+                }else {
303
+                    listStore.get(i).setRemark(newRemark);
304
+                }
305
+            }
296 306
             num = storeMapper.updateByPrimaryKey(listStore.get(i));
297 307
         }
298 308
         return result;
299 309
     }
300 310
 
311
+    @Override
312
+    public String changeCustName(String json,String newCustomername,String newFKCustomername,
313
+                          String userId,String belongId) {
314
+        List<Store> listStore = JSON.parseObject(json, new TypeReference<List<Store>>() {});
315
+
316
+        int layerNew = 0;
317
+        int layerOld = 0;
318
+        int layer = 0;
319
+        Customer customer = new Customer();
320
+        Customer fkcustomer = new Customer();
321
+        if (!newCustomername.equals("") && newCustomername!=null){
322
+            customer = customerMapper.selectByName(newCustomername,belongId);
323
+        }
324
+        if (!newFKCustomername.equals("") && newFKCustomername!=null){
325
+            fkcustomer = customerMapper.selectByName(newFKCustomername,belongId);
326
+        }
327
+        for (int i = 0; i < listStore.size(); i++) {
328
+            if (!newCustomername.equals("") && newCustomername!=null){
329
+                listStore.get(i).setCustomer(customer);
330
+                num = storeMapper.updateByPrimaryKey(listStore.get(i));
331
+            }
332
+            if (!newFKCustomername.equals("") && newFKCustomername!=null){
333
+                listStore.get(i).setFkComponyId(fkcustomer.getId());
334
+                num = storeMapper.updateFkById(listStore.get(i));
335
+            }
336
+
337
+        }
338
+        return result;
339
+    }
340
+
301 341
     private MoveRecord getMoveRecord(Store store, Stack fromStack, Stack toStack, int layerNew, int layerOld, String userId) {
302 342
         MoveRecord moveRecord = new MoveRecord();
303 343
         moveRecord.setWareNameOld(fromStack.getWare().getName());

+ 5
- 1
src/main/java/com/th/demo/service/ware/StoreService.java Näytä tiedosto

@@ -18,5 +18,9 @@ public interface StoreService {
18 18
 
19 19
     String modifyCustomeradress(String id,String customerAddressOld,String customerAddressNew);
20 20
 
21
-    String changeStack(String json,String newWare,String newStack,String newRemark1,String userId,String belongId);
21
+    String changeStack(String json,String newWare,String newStack,String newRemark1,
22
+                       String newRemark, String userId,String belongId);
23
+
24
+    String changeCustName(String json,String newCustomername,String newFKCustomername,
25
+                          String userId,String belongId);
22 26
 }

+ 7
- 7
src/main/resource/localhost/db.properties Näytä tiedosto

@@ -4,12 +4,12 @@
4 4
 #jdbc.password=root
5 5
 
6 6
 #???????????????????????????????
7
-#jdbc.driverClass=com.mysql.jdbc.Driver
8
-#jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ware_mj?characterEncoding=utf8
9
-#jdbc.user=root
10
-#jdbc.password=root
11
-
12 7
 jdbc.driverClass=com.mysql.jdbc.Driver
13
-jdbc.jdbcUrl=jdbc:mysql://60.205.9.174:3309/ware_mj?useUnicode=true&characterEncoding=utf8
8
+jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ware_mj?characterEncoding=utf8
14 9
 jdbc.user=root
15
-jdbc.password=122403
10
+jdbc.password=root
11
+
12
+#jdbc.driverClass=com.mysql.jdbc.Driver
13
+#jdbc.jdbcUrl=jdbc:mysql://60.205.9.174:3309/ware_mj?useUnicode=true&characterEncoding=utf8
14
+#jdbc.user=root
15
+#jdbc.password=122403

Loading…
Peruuta
Tallenna