张庆宇 8 months ago
parent
commit
0b52279e9b

+ 15
- 2
src/main/java/com/th/demo/controller/maint/CargoController.java View File

4
 import com.th.demo.model.system.Type;
4
 import com.th.demo.model.system.Type;
5
 import com.th.demo.service.maint.AreaService;
5
 import com.th.demo.service.maint.AreaService;
6
 import com.th.demo.service.maint.CargoService;
6
 import com.th.demo.service.maint.CargoService;
7
+import com.th.demo.tools.DateTools;
7
 import com.th.demo.tools.JSONTools;
8
 import com.th.demo.tools.JSONTools;
8
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.web.bind.annotation.RequestMapping;
10
 import org.springframework.web.bind.annotation.RequestMapping;
10
 import org.springframework.web.bind.annotation.RestController;
11
 import org.springframework.web.bind.annotation.RestController;
11
 
12
 
12
 import javax.servlet.http.HttpServletRequest;
13
 import javax.servlet.http.HttpServletRequest;
14
+import java.util.Date;
13
 
15
 
14
 @RestController
16
 @RestController
15
 @RequestMapping(value = "/MaintCargo")
17
 @RequestMapping(value = "/MaintCargo")
63
     }
65
     }
64
 
66
 
65
     @RequestMapping(value = "/queryRecord.do")
67
     @RequestMapping(value = "/queryRecord.do")
66
-    public String queryRecord(int page, int rows,String uperCustomer, String Customer ,HttpServletRequest request) {
68
+    public String queryRecord(int page, int rows,String uperCustomer, String Customer,
69
+            String RecordDateBegin,String RecordDateEnd,String subStr,String changeFrom,
70
+                              HttpServletRequest request) {
67
 
71
 
68
         try {
72
         try {
73
+            Date fromDate2 = new Date();
74
+            Date toDate2 = new Date();
75
+            if (RecordDateBegin != null && RecordDateBegin!= ""){
76
+                fromDate2 = DateTools.StrToDate(RecordDateBegin, "yyyy-MM-dd HH:mm:ss");
77
+            }
78
+            if (RecordDateEnd != null && RecordDateEnd != ""){
79
+                toDate2 = DateTools.StrToDate(RecordDateEnd, "yyyy-MM-dd HH:mm:ss");
80
+            }
81
+
69
             String userId = (String) request.getAttribute("userId");
82
             String userId = (String) request.getAttribute("userId");
70
             String belongId = (String) request.getAttribute("belongId");
83
             String belongId = (String) request.getAttribute("belongId");
71
-            result = cargoService.queryRecord(page,rows,uperCustomer,Customer,userId,belongId);
84
+            result = cargoService.queryRecord(page,rows,uperCustomer,Customer,fromDate2,toDate2,subStr,changeFrom,userId,belongId);
72
         } catch (Exception ex) {
85
         } catch (Exception ex) {
73
             ex.printStackTrace();
86
             ex.printStackTrace();
74
             result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
87
             result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());

+ 17
- 0
src/main/java/com/th/demo/controller/ware/InRecordController.java View File

117
             return result;
117
             return result;
118
         }
118
         }
119
     }
119
     }
120
+    @RequestMapping(value = "/changeRecordInDtm.do")
121
+    public String changeRecordInDtm(String json, String ChangeInDtm,
122
+                               HttpServletRequest request) {
123
+
124
+        try {
125
+            String userId = (String) request.getAttribute("userId");
126
+            String belongId = (String) request.getAttribute("belongId");
127
+            Date fromDate2 = DateTools.StrToDate(ChangeInDtm, "yyyy-MM-dd HH:mm:ss");
128
+
129
+            result = inRecordService.changeRecordInDtm(json ,fromDate2, userId, belongId);
130
+        } catch (Exception ex) {
131
+            ex.printStackTrace();
132
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
133
+        } finally {
134
+            return result;
135
+        }
136
+    }
120
 
137
 
121
 }
138
 }

+ 2
- 1
src/main/java/com/th/demo/mapping/ware/CargoChangeRecordMapper.java View File

15
 
15
 
16
     CargoChangeRecord selectByCustomer(String uperCustomer, String Customer);
16
     CargoChangeRecord selectByCustomer(String uperCustomer, String Customer);
17
 
17
 
18
-    List<CargoChangeRecord> selectRecord(String uperCustomer, String Customer);
18
+    List<CargoChangeRecord> selectRecord(String uperCustomer, String Customer,
19
+                                         Date RecordDateBegin,Date RecordDateEnd,String subStr,String changeFrom);
19
 
20
 
20
 
21
 
21
 
22
 

+ 3
- 0
src/main/java/com/th/demo/mapping/ware/InRecordMapper.java View File

35
                                   String plateNo, Date fromDate, Date toDate, String userId, String belongId, String ordNo,
35
                                   String plateNo, Date fromDate, Date toDate, String userId, String belongId, String ordNo,
36
                                   String carNo, String tallyPeople, String fkComponyName,
36
                                   String carNo, String tallyPeople, String fkComponyName,
37
                                     List<String> plateNos,List<String> ordNos,String remark1);
37
                                     List<String> plateNos,List<String> ordNos,String remark1);
38
+
39
+
40
+    int updateInDtmByInId(String id,Date ChangeInDtm);
38
 }
41
 }

+ 3
- 0
src/main/java/com/th/demo/mapping/ware/StoreMapper.java View File

7
 
7
 
8
 import java.util.List;
8
 import java.util.List;
9
 import java.util.Map;
9
 import java.util.Map;
10
+import java.util.Date;
10
 
11
 
11
 public interface StoreMapper {
12
 public interface StoreMapper {
12
     int deleteByPrimaryKey(String id);
13
     int deleteByPrimaryKey(String id);
58
 
59
 
59
     int selectByInId(String id);
60
     int selectByInId(String id);
60
     int selectByOutIdNum(String id);
61
     int selectByOutIdNum(String id);
62
+
63
+    int updateInDtmByInId(String id,Date ChangeInDtm);
61
 }
64
 }

+ 4
- 2
src/main/java/com/th/demo/service/impl/maint/CargoServiceImpl.java View File

124
     }
124
     }
125
 
125
 
126
     @Override
126
     @Override
127
-    public String queryRecord(int page, int rows, String uperCustomer, String Customer ,String userId, String belongId) {
127
+    public String queryRecord(int page, int rows, String uperCustomer, String Customer ,
128
+                              Date RecordDateBegin,Date RecordDateEnd,String subStr,String changeFrom,
129
+                              String userId, String belongId) {
128
         PageHelper.startPage(page, rows);
130
         PageHelper.startPage(page, rows);
129
-        List<CargoChangeRecord> list   = cargoChangeRecordMapper.selectRecord(uperCustomer, Customer);
131
+        List<CargoChangeRecord> list   = cargoChangeRecordMapper.selectRecord(uperCustomer, Customer,RecordDateBegin,RecordDateEnd,subStr,changeFrom);
130
         PageInfo<CargoChangeRecord> pageInfo = new PageInfo<>(list);
132
         PageInfo<CargoChangeRecord> pageInfo = new PageInfo<>(list);
131
         result = JSONTools.toStringyyyyMMddHHmmss(pageInfo);
133
         result = JSONTools.toStringyyyyMMddHHmmss(pageInfo);
132
         return result;
134
         return result;

+ 7
- 7
src/main/java/com/th/demo/service/impl/ware/ChangeServiceImpl.java View File

71
             sum_weight=0;
71
             sum_weight=0;
72
         }else{
72
         }else{
73
             if(cargo.getSumWeight() == 0){
73
             if(cargo.getSumWeight() == 0){
74
-                num =10;
74
+                num = 10;
75
                 return JSONTools.toString(1,"货权信息已维护,但可是用量为0");
75
                 return JSONTools.toString(1,"货权信息已维护,但可是用量为0");
76
+            }else {
77
+                sum_weight = cargo.getSumWeight();
76
             }
78
             }
77
-            sum_weight = cargo.getSumWeight();
78
         }
79
         }
79
 
80
 
80
         for (int i = 0; i < list.size(); i++) {
81
         for (int i = 0; i < list.size(); i++) {
100
             num += storeMapper.updateFkById(list.get(i));
101
             num += storeMapper.updateFkById(list.get(i));
101
             use_weight = use_weight + list.get(i).getWeight();
102
             use_weight = use_weight + list.get(i).getWeight();
102
         }
103
         }
103
-        if (sum_weight != 0){
104
+        if (cargo != null){
104
             cargo.setSumWeight(cargo.getSumWeight() - use_weight);
105
             cargo.setSumWeight(cargo.getSumWeight() - use_weight);
105
             cargo.setUseWeight(cargo.getUseWeight() + use_weight);
106
             cargo.setUseWeight(cargo.getUseWeight() + use_weight);
106
             num = cargoMapper.updateByPrimaryKey(cargo);
107
             num = cargoMapper.updateByPrimaryKey(cargo);
107
-            result = Tools.moreThanZeroResultJSON(num);
108
 
108
 
109
             CargoChangeRecord cargoChangeRecord = new CargoChangeRecord();
109
             CargoChangeRecord cargoChangeRecord = new CargoChangeRecord();
110
             cargoChangeRecord.setUperCustomer(cargo.getUperCustomer());
110
             cargoChangeRecord.setUperCustomer(cargo.getUperCustomer());
116
             cargoChangeRecord.setModifyTime(new Date());
116
             cargoChangeRecord.setModifyTime(new Date());
117
             cargoChangeRecord.setModifyUser(new SysUser(userId));
117
             cargoChangeRecord.setModifyUser(new SysUser(userId));
118
             num = cargoChangeRecordMapper.insert(cargoChangeRecord);
118
             num = cargoChangeRecordMapper.insert(cargoChangeRecord);
119
-            result = Tools.moreThanZeroResultJSON(num);
120
-        }
121
 
119
 
122
-        return Tools.moreThanZeroResultJSON(num);
120
+        }
121
+        result = Tools.moreThanZeroResultJSON(num);
122
+        return result;
123
     }
123
     }
124
 
124
 
125
     private ChangeRecord getChangeRecord(String recordType, Store store, Customer customer, String receiveAddress, String userId, String belongId) {
125
     private ChangeRecord getChangeRecord(String recordType, Store store, Customer customer, String receiveAddress, String userId, String belongId) {

+ 13
- 0
src/main/java/com/th/demo/service/impl/ware/InRecordServiceImpl.java View File

108
 
108
 
109
         return result;
109
         return result;
110
     }
110
     }
111
+
112
+    @Override
113
+    public String changeRecordInDtm(String json,Date ChangeInDtm, String userId, String belongId){
114
+        List<InRecord> inRecord = JSON.parseObject(json, new TypeReference<List<InRecord>>() {
115
+        });
116
+        for (int i = 0; i < inRecord.size(); i++) {
117
+            int num =storeMapper.updateInDtmByInId(inRecord.get(i).getId(),ChangeInDtm);
118
+            num =inRecordMapper.updateInDtmByInId(inRecord.get(i).getId(),ChangeInDtm);
119
+            result = JSONTools.toString(num);
120
+        }
121
+
122
+        return result;
123
+    }
111
 }
124
 }

+ 4
- 1
src/main/java/com/th/demo/service/maint/CargoService.java View File

1
 package com.th.demo.service.maint;
1
 package com.th.demo.service.maint;
2
 
2
 
3
+import java.util.Date;
3
 public interface CargoService {
4
 public interface CargoService {
4
     String query(int page, int rows, String uperCustomer, String Customer ,String userId, String belongId);
5
     String query(int page, int rows, String uperCustomer, String Customer ,String userId, String belongId);
5
 
6
 
7
 
8
 
8
     String remove(String id, String userId, String belongId);
9
     String remove(String id, String userId, String belongId);
9
 
10
 
10
-    String queryRecord(int page, int rows, String uperCustomer, String Customer ,String userId, String belongId);
11
+    String queryRecord(int page, int rows, String uperCustomer, String Customer ,
12
+                       Date RecordDateBegin,Date RecordDateEnd,String subStr,String changeFrom,
13
+                       String userId, String belongId);
11
 }
14
 }

+ 1
- 0
src/main/java/com/th/demo/service/ware/InRecordService.java View File

14
                       String tallyPeople, String fkComponyName, String remark1);
14
                       String tallyPeople, String fkComponyName, String remark1);
15
 
15
 
16
     String deleterecord(String json, String userId, String belongId);
16
     String deleterecord(String json, String userId, String belongId);
17
+    String changeRecordInDtm(String json,  Date ChangeInDtm,String userId, String belongId);
17
 }
18
 }

+ 7
- 7
src/main/resource/localhost/db.properties View File

4
 #jdbc.password=root
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
 jdbc.driverClass=com.mysql.jdbc.Driver
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
 jdbc.user=root
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

+ 7
- 0
src/main/resource/mapper/ware/CargoChangeRecordMapper.xml View File

61
     from t_ware_cargochange_record
61
     from t_ware_cargochange_record
62
     where uper_customer_id = #{param1,jdbcType=VARCHAR}
62
     where uper_customer_id = #{param1,jdbcType=VARCHAR}
63
     and customer_id = #{param2,jdbcType=VARCHAR}
63
     and customer_id = #{param2,jdbcType=VARCHAR}
64
+    and modify_time between #{param3,jdbcType=TIMESTAMP} and #{param4,jdbcType=TIMESTAMP}
65
+    <if test="param5 != null and param5 != ''" >
66
+      and sub_str like concat('%',#{param5,jdbcType=VARCHAR},'%')
67
+    </if>
68
+    <if test="param6 != null and param6 != ''" >
69
+      and change_from like concat('%',#{param6,jdbcType=VARCHAR},'%')
70
+    </if>
64
     order by modify_time desc
71
     order by modify_time desc
65
   </select>
72
   </select>
66
 
73
 

+ 6
- 0
src/main/resource/mapper/ware/InRecordMapper.xml View File

396
     order by t.add_time desc
396
     order by t.add_time desc
397
   </select>
397
   </select>
398
 
398
 
399
+  <update id="updateInDtmByInId" >
400
+    update t_ware_in_record
401
+    set add_time = #{param2,jdbcType=TIMESTAMP}
402
+    where id = #{param1,jdbcType=VARCHAR}
403
+  </update>
404
+
399
 </mapper>
405
 </mapper>

+ 6
- 0
src/main/resource/mapper/ware/StoreMapper.xml View File

575
       and t.out_id = #{param1,jdbcType=VARCHAR};
575
       and t.out_id = #{param1,jdbcType=VARCHAR};
576
 
576
 
577
   </select>
577
   </select>
578
+
579
+  <update id="updateInDtmByInId" >
580
+    update t_ware_store
581
+    set add_time = #{param2,jdbcType=TIMESTAMP}
582
+    where in_id = #{param1,jdbcType=VARCHAR}
583
+  </update>
578
 </mapper>
584
 </mapper>

Loading…
Cancel
Save