张延森 3 년 전
부모
커밋
91542d4b30

+ 22
- 1
src/main/java/com/yunzhi/nanyang/controller/TaMachineryController.java 파일 보기

121
 
121
 
122
         IPage<MachineSummary> pg = new Page<>(pageNum, pageSize);
122
         IPage<MachineSummary> pg = new Page<>(pageNum, pageSize);
123
 
123
 
124
-        IPage<MachineSummary> result = iTaMachineryService.getSummaryList(pg, location, typeId, orgId, q);
124
+        IPage<MachineSummary> result = iTaMachineryService.getSummaryList(pg, location, typeId, orgId, q, clientId);
125
         return ResponseBean.success(result);
125
         return ResponseBean.success(result);
126
     }
126
     }
127
 
127
 
239
         return ResponseBean.success(taOrderList);
239
         return ResponseBean.success(taOrderList);
240
     }
240
     }
241
 
241
 
242
+
243
+    /**
244
+     * 根据id查询对象
245
+     * @param id  实体ID
246
+     */
247
+    @RequestMapping(value="/admin/machinery/{id}/status/{status}",method= RequestMethod.PUT)
248
+    @ApiOperation(value="更新车辆状态", notes = "更新车辆状态", httpMethod = "PUT", response = ResponseBean.class)
249
+    public ResponseBean getMachineryDuty(@ApiParam("对象ID") @PathVariable String id,
250
+                                         @ApiParam("车辆状态") @PathVariable Integer status) throws Exception{
251
+
252
+        TaMachinery taMachinery = iTaMachineryService.getById(id);
253
+        if (taMachinery == null) {
254
+            return ResponseBean.error("未找到车辆信息");
255
+        }
256
+
257
+        taMachinery.setStatus(status);
258
+        iTaMachineryService.updateById(taMachinery);
259
+
260
+        return ResponseBean.success(taMachinery);
261
+    }
262
+
242
     /**
263
     /**
243
      * 车辆实时预览
264
      * 车辆实时预览
244
      * @param id  实体ID
265
      * @param id  实体ID

+ 9
- 0
src/main/java/com/yunzhi/nanyang/controller/TaOrgController.java 파일 보기

9
 import com.yunzhi.nanyang.entity.SysUser;
9
 import com.yunzhi.nanyang.entity.SysUser;
10
 import com.yunzhi.nanyang.service.ISysUserDataScopeService;
10
 import com.yunzhi.nanyang.service.ISysUserDataScopeService;
11
 import com.yunzhi.nanyang.service.ISysUserService;
11
 import com.yunzhi.nanyang.service.ISysUserService;
12
+import com.yunzhi.nanyang.service.ITaMachineryService;
12
 import io.swagger.annotations.Api;
13
 import io.swagger.annotations.Api;
13
 import io.swagger.annotations.ApiOperation;
14
 import io.swagger.annotations.ApiOperation;
14
 import io.swagger.annotations.ApiParam;
15
 import io.swagger.annotations.ApiParam;
51
     @Autowired
52
     @Autowired
52
     public ISysUserService iSysUserService;
53
     public ISysUserService iSysUserService;
53
 
54
 
55
+    @Autowired
56
+    public ITaMachineryService iTaMachineryService;
57
+
54
     @Autowired
58
     @Autowired
55
     public ISysUserDataScopeService iSysUserDataScopeService;
59
     public ISysUserDataScopeService iSysUserDataScopeService;
56
 
60
 
111
             return ResponseBean.error("请先清空机构人员信息");
115
             return ResponseBean.error("请先清空机构人员信息");
112
         }
116
         }
113
 
117
 
118
+        cnt = iTaMachineryService.countBy("org_id", id, true);
119
+        if (cnt > 0) {
120
+            return ResponseBean.error("请先清空机构机构信息");
121
+        }
122
+
114
         if(iTaOrgService.remvoeWithDataScope(id, currentUser().getUserId())){
123
         if(iTaOrgService.remvoeWithDataScope(id, currentUser().getUserId())){
115
             Map<String, Object> filter = new HashMap<>();
124
             Map<String, Object> filter = new HashMap<>();
116
             filter.put("org_id", id);
125
             filter.put("org_id", id);

+ 1
- 1
src/main/java/com/yunzhi/nanyang/service/ITaMachineryService.java 파일 보기

25
 
25
 
26
     boolean updateRegionName(String regionId, String regionName);
26
     boolean updateRegionName(String regionId, String regionName);
27
 
27
 
28
-    IPage<MachineSummary> getSummaryList(IPage<MachineSummary> pg, String location, String typeId, String orgId, String q);
28
+    IPage<MachineSummary> getSummaryList(IPage<MachineSummary> pg, String location, String typeId, String orgId, String q, String clientId);
29
 
29
 
30
     MachineSummary getSummaryDetail(String machineryId, String location, Boolean attached);
30
     MachineSummary getSummaryDetail(String machineryId, String location, Boolean attached);
31
 
31
 

+ 2
- 3
src/main/java/com/yunzhi/nanyang/service/impl/TaMachineryServiceImpl.java 파일 보기

98
     }
98
     }
99
 
99
 
100
     @Override
100
     @Override
101
-    public IPage<MachineSummary> getSummaryList(IPage<MachineSummary> pg, String location, String typeId, String orgId, String q) {
101
+    public IPage<MachineSummary> getSummaryList(IPage<MachineSummary> pg, String location, String typeId, String orgId, String q, String clientId) {
102
 
102
 
103
-        // 有没有 orgId 实际上用来区分是否农机手端
104
-        if (StringUtils.isEmpty(orgId)) {
103
+        if (Constants.CLIENT_FARMER.equals(clientId)) {
105
             // 农户端, 实际上过滤的是所有组织下的所有分类的其中一个机器
104
             // 农户端, 实际上过滤的是所有组织下的所有分类的其中一个机器
106
             return baseMapper.getOneOfTypes(pg, location, typeId, q);
105
             return baseMapper.getOneOfTypes(pg, location, typeId, q);
107
         } else {
106
         } else {

+ 4
- 3
src/main/resources/mapper/TaMachineryMapper.xml 파일 보기

59
         </if>
59
         </if>
60
          GROUP BY
60
          GROUP BY
61
             t.org_id,
61
             t.org_id,
62
-            t.machinery_id
63
-        HAVING
64
-            num &lt;= 1
62
+            t.type_id
63
+--             t.machinery_id
64
+--         HAVING
65
+--             num &lt;= 1
65
         ORDER BY
66
         ORDER BY
66
             distance ASC
67
             distance ASC
67
     </select>
68
     </select>