张延森 2 anos atrás
pai
commit
91542d4b30

+ 22
- 1
src/main/java/com/yunzhi/nanyang/controller/TaMachineryController.java Ver arquivo

@@ -121,7 +121,7 @@ public class TaMachineryController extends BaseController {
121 121
 
122 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 125
         return ResponseBean.success(result);
126 126
     }
127 127
 
@@ -239,6 +239,27 @@ public class TaMachineryController extends BaseController {
239 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 265
      * @param id  实体ID

+ 9
- 0
src/main/java/com/yunzhi/nanyang/controller/TaOrgController.java Ver arquivo

@@ -9,6 +9,7 @@ import com.yunzhi.nanyang.common.ResponseBean;
9 9
 import com.yunzhi.nanyang.entity.SysUser;
10 10
 import com.yunzhi.nanyang.service.ISysUserDataScopeService;
11 11
 import com.yunzhi.nanyang.service.ISysUserService;
12
+import com.yunzhi.nanyang.service.ITaMachineryService;
12 13
 import io.swagger.annotations.Api;
13 14
 import io.swagger.annotations.ApiOperation;
14 15
 import io.swagger.annotations.ApiParam;
@@ -51,6 +52,9 @@ public class TaOrgController extends BaseController {
51 52
     @Autowired
52 53
     public ISysUserService iSysUserService;
53 54
 
55
+    @Autowired
56
+    public ITaMachineryService iTaMachineryService;
57
+
54 58
     @Autowired
55 59
     public ISysUserDataScopeService iSysUserDataScopeService;
56 60
 
@@ -111,6 +115,11 @@ public class TaOrgController extends BaseController {
111 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 123
         if(iTaOrgService.remvoeWithDataScope(id, currentUser().getUserId())){
115 124
             Map<String, Object> filter = new HashMap<>();
116 125
             filter.put("org_id", id);

+ 1
- 1
src/main/java/com/yunzhi/nanyang/service/ITaMachineryService.java Ver arquivo

@@ -25,7 +25,7 @@ public interface ITaMachineryService extends IBaseService<TaMachinery> {
25 25
 
26 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 30
     MachineSummary getSummaryDetail(String machineryId, String location, Boolean attached);
31 31
 

+ 2
- 3
src/main/java/com/yunzhi/nanyang/service/impl/TaMachineryServiceImpl.java Ver arquivo

@@ -98,10 +98,9 @@ public class TaMachineryServiceImpl extends BaseServiceImpl<TaMachineryMapper, T
98 98
     }
99 99
 
100 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 105
             return baseMapper.getOneOfTypes(pg, location, typeId, q);
107 106
         } else {

+ 4
- 3
src/main/resources/mapper/TaMachineryMapper.xml Ver arquivo

@@ -59,9 +59,10 @@
59 59
         </if>
60 60
          GROUP BY
61 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 66
         ORDER BY
66 67
             distance ASC
67 68
     </select>