|
@@ -1,10 +1,11 @@
|
|
package com.kmall.admin.controller;
|
|
package com.kmall.admin.controller;
|
|
|
|
|
|
|
|
+import com.google.common.collect.ImmutableBiMap;
|
|
import com.kmall.admin.entity.GoodsIssueEntity;
|
|
import com.kmall.admin.entity.GoodsIssueEntity;
|
|
import com.kmall.admin.service.GoodsIssueService;
|
|
import com.kmall.admin.service.GoodsIssueService;
|
|
-import com.kmall.common.utils.PageUtils;
|
|
|
|
-import com.kmall.common.utils.Query;
|
|
|
|
-import com.kmall.common.utils.R;
|
|
|
|
|
|
+import com.kmall.api.contants.Dict;
|
|
|
|
+import com.kmall.common.entity.SysUserEntity;
|
|
|
|
+import com.kmall.common.utils.*;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -31,9 +32,17 @@ public class GoodsIssueController {
|
|
@RequestMapping("/list")
|
|
@RequestMapping("/list")
|
|
@RequiresPermissions("goodsissue:list")
|
|
@RequiresPermissions("goodsissue:list")
|
|
public R list(@RequestParam Map<String, Object> params) {
|
|
public R list(@RequestParam Map<String, Object> params) {
|
|
|
|
+ SysUserEntity user = ShiroUtils.getUserEntity();
|
|
|
|
+ if (user != null) {
|
|
|
|
+ if (Dict.roleType.item_2.getItem().equals(user.getRoleType())) {
|
|
|
|
+ params.put("storeId", user.getStoreId());
|
|
|
|
+ params.put("merchSn", user.getMerchSn());
|
|
|
|
+ } else if (Dict.roleType.item_3.getItem().equals(user.getRoleType())) {
|
|
|
|
+ params.put("merchSn", user.getMerchSn());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//查询列表数据
|
|
//查询列表数据
|
|
Query query = new Query(params);
|
|
Query query = new Query(params);
|
|
-
|
|
|
|
List<GoodsIssueEntity> goodsIssueList = goodsIssueService.queryList(query);
|
|
List<GoodsIssueEntity> goodsIssueList = goodsIssueService.queryList(query);
|
|
int total = goodsIssueService.queryTotal(query);
|
|
int total = goodsIssueService.queryTotal(query);
|
|
|
|
|
|
@@ -59,6 +68,14 @@ public class GoodsIssueController {
|
|
@RequestMapping("/save")
|
|
@RequestMapping("/save")
|
|
@RequiresPermissions("goodsissue:save")
|
|
@RequiresPermissions("goodsissue:save")
|
|
public R save(@RequestBody GoodsIssueEntity goodsIssue) {
|
|
public R save(@RequestBody GoodsIssueEntity goodsIssue) {
|
|
|
|
+ Map<String, Object> valideDate = MapBeanUtil.fromObject(goodsIssue);
|
|
|
|
+ ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
|
+ builder.put("merchSn", "商户");
|
|
|
|
+ builder.put("storeId", "门店");
|
|
|
|
+ R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
|
|
+ if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
|
|
+ throw new RRException(r.get("msg").toString());
|
|
|
|
+ }
|
|
goodsIssueService.save(goodsIssue);
|
|
goodsIssueService.save(goodsIssue);
|
|
|
|
|
|
return R.ok();
|
|
return R.ok();
|
|
@@ -70,6 +87,14 @@ public class GoodsIssueController {
|
|
@RequestMapping("/update")
|
|
@RequestMapping("/update")
|
|
@RequiresPermissions("goodsissue:update")
|
|
@RequiresPermissions("goodsissue:update")
|
|
public R update(@RequestBody GoodsIssueEntity goodsIssue) {
|
|
public R update(@RequestBody GoodsIssueEntity goodsIssue) {
|
|
|
|
+ Map<String, Object> valideDate = MapBeanUtil.fromObject(goodsIssue);
|
|
|
|
+ ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
|
+ builder.put("merchSn", "商户");
|
|
|
|
+ builder.put("storeId", "门店");
|
|
|
|
+ R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
|
|
+ if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
|
|
+ throw new RRException(r.get("msg").toString());
|
|
|
|
+ }
|
|
goodsIssueService.update(goodsIssue);
|
|
goodsIssueService.update(goodsIssue);
|
|
|
|
|
|
return R.ok();
|
|
return R.ok();
|