张延森 4 vuotta sitten
vanhempi
commit
e5b1a58257
1 muutettua tiedostoa jossa 13 lisäystä ja 1 poistoa
  1. 13
    1
      src/main/java/com/shigongli/controller/TaHouseController.java

+ 13
- 1
src/main/java/com/shigongli/controller/TaHouseController.java Näytä tiedosto

@@ -151,12 +151,24 @@ public class TaHouseController extends BaseController {
151 151
      */
152 152
     @RequestMapping(value="/ma/taHouse/{id}", method= RequestMethod.DELETE)
153 153
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
154
-    public ResponseBean taHouseDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
154
+    public ResponseBean taHouseDelete(@ApiParam("对象ID") @PathVariable String id,
155
+                                      HttpServletRequest request) throws Exception{
155 156
         TaHouse taHouse = iTaHouseService.getById(id);
156 157
         if (null == taHouse || taHouse.getStatus().equals(StatusConstant.DELETE)) {
157 158
             return ResponseBean.success("ok");
158 159
         }
159 160
 
161
+        TaPerson person = getPerson(request);
162
+        List<TaShopKeeper> shopKeeperList = iTaShopKeeperService.getByPerson(person.getPersonId());
163
+        if (null == shopKeeperList || shopKeeperList.size() < 1) {
164
+            return ResponseBean.error("店主数据异常", ResponseBean.ERROR_UNAVAILABLE);
165
+        }
166
+
167
+        TaShopKeeper taShopKeeper = shopKeeperList.get(0);
168
+        if (!taShopKeeper.getShopId().equals(taHouse.getShopId())) {
169
+            return ResponseBean.error("您无权进行当前操作", ResponseBean.ERROR_UNAVAILABLE);
170
+        }
171
+
160 172
         taHouse.setStatus(StatusConstant.DELETE);
161 173
 
162 174
         return taHouseUpdate(id, taHouse);