|
@@ -126,14 +126,7 @@ public class TaHouseController extends BaseController {
|
126
|
126
|
}
|
127
|
127
|
|
128
|
128
|
if (!StringUtils.isEmpty(taHouse.getShopId())) {
|
129
|
|
- boolean found = false;
|
130
|
|
- for (TaShopKeeper keeper: shopKeeperList) {
|
131
|
|
- if (taHouse.getShopId().equals(keeper.getShopId())) {
|
132
|
|
- found = true;
|
133
|
|
- }
|
134
|
|
- }
|
135
|
|
-
|
136
|
|
- if (!found) {
|
|
129
|
+ if (!isContaints(shopKeeperList, taHouse.getShopId())) {
|
137
|
130
|
return ResponseBean.error("您无权新增房源, 或房源所属民宿出错", ResponseBean.ERROR_UNAVAILABLE);
|
138
|
131
|
}
|
139
|
132
|
} else {
|
|
@@ -182,8 +175,7 @@ public class TaHouseController extends BaseController {
|
182
|
175
|
return ResponseBean.error("店主数据异常", ResponseBean.ERROR_UNAVAILABLE);
|
183
|
176
|
}
|
184
|
177
|
|
185
|
|
- TaShopKeeper taShopKeeper = shopKeeperList.get(0);
|
186
|
|
- if (!taShopKeeper.getShopId().equals(taHouse.getShopId())) {
|
|
178
|
+ if (!isContaints(shopKeeperList, taHouse.getShopId())) {
|
187
|
179
|
return ResponseBean.error("您无权进行当前操作", ResponseBean.ERROR_UNAVAILABLE);
|
188
|
180
|
}
|
189
|
181
|
|
|
@@ -275,4 +267,16 @@ public class TaHouseController extends BaseController {
|
275
|
267
|
return city;
|
276
|
268
|
}
|
277
|
269
|
|
|
270
|
+ private boolean isContaints(List<TaShopKeeper> shopKeepers, String shopId) {
|
|
271
|
+ if (null == shopKeepers) return false;
|
|
272
|
+
|
|
273
|
+ for (TaShopKeeper shopKeeper : shopKeepers) {
|
|
274
|
+ if (shopKeeper.getShopId().equals(shopId)) {
|
|
275
|
+ return true;
|
|
276
|
+ }
|
|
277
|
+ }
|
|
278
|
+
|
|
279
|
+ return false;
|
|
280
|
+ }
|
|
281
|
+
|
278
|
282
|
}
|