Yansen 2 лет назад
Родитель
Сommit
319dbbfbbd

+ 7
- 3
src/main/java/com/yunzhi/nanyang/controller/TaDeviceJobController.java Просмотреть файл

@@ -87,6 +87,8 @@ public class TaDeviceJobController extends BaseController {
87 87
                                @ApiParam("合作社名称") @RequestParam(value = "orgName", required = false) String orgName,
88 88
                                @ApiParam("农机名称") @RequestParam(value = "machineryName", required = false) String machineryName,
89 89
                                @ApiParam("人员名称") @RequestParam(value = "userName", required = false) String userName,
90
+                               @ApiParam("农机ID") @RequestParam(value = "machineryId", required = false) String machineryId,
91
+                               @ApiParam("人员ID") @RequestParam(value = "userId", required = false) String userId,
90 92
                                @ApiParam("人员手机") @RequestParam(value = "phone", required = false) String phone,
91 93
                                @ApiParam("设备分类") @RequestParam(value = "deviceKind", required = false) String deviceKind,
92 94
                                @ApiParam("设备编号") @RequestParam(value = "deviceNo", required = false) String deviceNo,
@@ -94,8 +96,8 @@ public class TaDeviceJobController extends BaseController {
94 96
                                @ApiParam(value = "结束时间", example = "2022-10-31") @RequestParam(value = "endDate") String endDate) throws Exception {
95 97
 
96 98
         IPage<TaDeviceJob> pg = new Page<>(pageNum, pageSize);
97
-        IPage<TaDeviceJob> list = taDeviceJobService.statisOrgBy(pg, orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone);
98
-        Double totalArea = taDeviceJobService.statisTotalArea(orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone);
99
+        IPage<TaDeviceJob> list = taDeviceJobService.statisOrgBy(pg, orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone, machineryId, userId);
100
+        Double totalArea = taDeviceJobService.statisTotalArea(orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone, machineryId, userId);
99 101
 
100 102
         return ResponseBean.success(new HashMap<String, Object>(){{
101 103
             put("list", list);
@@ -119,6 +121,8 @@ public class TaDeviceJobController extends BaseController {
119 121
     public ResponseBean export(@ApiParam("合作社名称") @RequestParam(value = "orgName", required = false) String orgName,
120 122
                                @ApiParam("农机名称") @RequestParam(value = "machineryName", required = false) String machineryName,
121 123
                                @ApiParam("人员名称") @RequestParam(value = "userName", required = false) String userName,
124
+                               @ApiParam("农机ID") @RequestParam(value = "machineryId", required = false) String machineryId,
125
+                               @ApiParam("人员ID") @RequestParam(value = "userId", required = false) String userId,
122 126
                                @ApiParam("人员手机") @RequestParam(value = "phone", required = false) String phone,
123 127
                                @ApiParam("设备分类") @RequestParam(value = "deviceKind", required = false) String deviceKind,
124 128
                                @ApiParam("设备编号") @RequestParam(value = "deviceNo", required = false) String deviceNo,
@@ -126,7 +130,7 @@ public class TaDeviceJobController extends BaseController {
126 130
                                @ApiParam(value = "结束时间", example = "2022-10-31") @RequestParam(value = "endDate") String endDate,
127 131
                                HttpServletResponse response) throws Exception {
128 132
 
129
-        List<TaDeviceJob> list = taDeviceJobService.listOrgBy(orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone);
133
+        List<TaDeviceJob> list = taDeviceJobService.listOrgBy(orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone, machineryId, userId);
130 134
 
131 135
         Double total = 0.0;
132 136
         if (list != null || list.size() > 0) {

+ 18
- 0
src/main/java/com/yunzhi/nanyang/controller/TdRawDeviceController.java Просмотреть файл

@@ -107,6 +107,24 @@ public class TdRawDeviceController extends BaseController {
107 107
             return ResponseBean.error("当前设备号已存在");
108 108
         }
109 109
 
110
+
111
+        String url = String.format("%s/%s/tdRawDevice/%s", deviceServer, tdRawDevice.getDeviceKind(), tdRawDevice.getDeviceNo());
112
+        String s = httpUtils.get(url);
113
+        if (StringUtils.isEmpty(s)) {
114
+            return ResponseBean.error("验证平台服务出错, 请联系技术人员");
115
+        } else {
116
+            JSONObject resp = JSONObject.parseObject(s);
117
+            if (!"1000".equals(resp.getString("code"))) {
118
+                String msg = resp.getString("message");
119
+                if (!StringUtils.isEmpty(msg)) {
120
+                    return ResponseBean.error(msg);
121
+                } else {
122
+                    return ResponseBean.error("验证平台服务出错, 未找到当前设备");
123
+                }
124
+            }
125
+        }
126
+
127
+
110 128
         tdRawDevice.setDeviceStatus(0); // 默认离线
111 129
         tdRawDevice.setCreateDate(LocalDateTime.now());
112 130
         tdRawDeviceService.save(tdRawDevice);

+ 9
- 3
src/main/java/com/yunzhi/nanyang/mapper/TaDeviceJobMapper.java Просмотреть файл

@@ -25,7 +25,9 @@ public interface TaDeviceJobMapper  extends BaseMapper<TaDeviceJob>{
25 25
                                     @Param("endDate") String endDate,
26 26
                                     @Param("machineryName") String machineryName,
27 27
                                     @Param("userName") String userName,
28
-                                    @Param("phone") String phone);
28
+                                    @Param("phone") String phone,
29
+                                    @Param("machineryId") String machineryId,
30
+                                    @Param("userId") String userId);
29 31
 
30 32
      Double statisTotalArea(@Param("orgName") String orgName,
31 33
                             @Param("deviceKind") String deviceKind,
@@ -34,7 +36,9 @@ public interface TaDeviceJobMapper  extends BaseMapper<TaDeviceJob>{
34 36
                             @Param("endDate") String endDate,
35 37
                             @Param("machineryName") String machineryName,
36 38
                             @Param("userName") String userName,
37
-                            @Param("phone") String phone);
39
+                            @Param("phone") String phone,
40
+                            @Param("machineryId") String machineryId,
41
+                            @Param("userId") String userId);
38 42
 
39 43
      List<TaDeviceJob> listOrgBy(@Param("orgName") String orgName,
40 44
                                  @Param("deviceKind") String deviceKind,
@@ -43,7 +47,9 @@ public interface TaDeviceJobMapper  extends BaseMapper<TaDeviceJob>{
43 47
                                  @Param("endDate") String endDate,
44 48
                                  @Param("machineryName") String machineryName,
45 49
                                  @Param("userName") String userName,
46
-                                 @Param("phone") String phone);
50
+                                 @Param("phone") String phone,
51
+                                 @Param("machineryId") String machineryId,
52
+                                 @Param("userId") String userId);
47 53
 
48 54
     IPage<TaDeviceJob> getPageBy(IPage<TaDeviceJob> pg,
49 55
                                  @Param("deviceKind") String deviceKind,

+ 3
- 3
src/main/java/com/yunzhi/nanyang/service/TaDeviceJobService.java Просмотреть файл

@@ -14,11 +14,11 @@ import java.util.List;
14 14
  */
15 15
 public interface TaDeviceJobService extends IBaseService<TaDeviceJob> {
16 16
 
17
-    IPage<TaDeviceJob> statisOrgBy(IPage<TaDeviceJob> pg, String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone);
17
+    IPage<TaDeviceJob> statisOrgBy(IPage<TaDeviceJob> pg, String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone, String machineryId, String userId);
18 18
 
19
-    Double statisTotalArea(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone);
19
+    Double statisTotalArea(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone, String machineryId, String userId);
20 20
 
21
-    List<TaDeviceJob> listOrgBy(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone);
21
+    List<TaDeviceJob> listOrgBy(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone, String machineryId, String userId);
22 22
 
23 23
     IPage<TaDeviceJob> getPageBy(IPage<TaDeviceJob> pg, String deviceKind, String deviceNo, String startDate, String endDate);
24 24
 

+ 6
- 6
src/main/java/com/yunzhi/nanyang/service/impl/TaDeviceJobServiceImpl.java Просмотреть файл

@@ -19,18 +19,18 @@ import java.util.List;
19 19
 public class TaDeviceJobServiceImpl extends BaseServiceImpl<TaDeviceJobMapper, TaDeviceJob> implements TaDeviceJobService {
20 20
 
21 21
     @Override
22
-    public IPage<TaDeviceJob> statisOrgBy(IPage<TaDeviceJob> pg, String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone) {
23
-        return baseMapper.statisOrgBy(pg, orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone);
22
+    public IPage<TaDeviceJob> statisOrgBy(IPage<TaDeviceJob> pg, String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone, String machineryId, String userId) {
23
+        return baseMapper.statisOrgBy(pg, orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone, machineryId, userId);
24 24
     }
25 25
 
26 26
     @Override
27
-    public Double statisTotalArea(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone) {
28
-        return baseMapper.statisTotalArea(orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone);
27
+    public Double statisTotalArea(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone, String machineryId, String userId) {
28
+        return baseMapper.statisTotalArea(orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone, machineryId, userId);
29 29
     }
30 30
 
31 31
     @Override
32
-    public List<TaDeviceJob> listOrgBy(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone) {
33
-        return baseMapper.listOrgBy(orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone);
32
+    public List<TaDeviceJob> listOrgBy(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone, String machineryId, String userId) {
33
+        return baseMapper.listOrgBy(orgName, deviceKind, deviceNo, startDate, endDate, machineryName, userName, phone, machineryId, userId);
34 34
     }
35 35
 
36 36
     @Override

+ 7
- 1
src/main/resources/mapper/TaDeviceJobMapper.xml Просмотреть файл

@@ -20,6 +20,12 @@
20 20
         <if test="orgName != null and orgName != ''">
21 21
             AND m.`name` LIKE CONCAT( '%', #{orgName}, '%' )
22 22
         </if>
23
+        <if test="machineryId != null and machineryId != ''">
24
+            AND s.machinery_id = #{machineryId}
25
+        </if>
26
+        <if test="userId != null and userId != ''">
27
+            AND t.user_id = #{userId}
28
+        </if>
23 29
         <if test="machineryName != null and machineryName != ''">
24 30
             AND s.`name` LIKE CONCAT( '%', #{machineryName}, '%' )
25 31
         </if>
@@ -87,7 +93,7 @@
87 93
         FROM
88 94
             ta_machinery t
89 95
         WHERE
90
-                t.machinery_id IN ( SELECT a.machinery_id FROM ta_device_job a WHERE a.user_id = #{userId} )
96
+              t.owner_id = #{userId}
91 97
           AND t.`status` &gt; - 1
92 98
         ORDER BY
93 99
             t.create_date DESC