|
@@ -8,6 +8,8 @@
|
|
|
|
|
|
package com.zskk.shop.controller.admin;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -18,9 +20,12 @@ import com.zskk.shop.controller.AbstractController;
|
|
|
import com.zskk.shop.controller.bean.ControllerResult;
|
|
|
import com.zskk.shop.controller.bean.UserInfoBean;
|
|
|
import com.zskk.shop.dao.entry.ExchangeCode;
|
|
|
+import com.zskk.shop.dao.entry.ExchangeCodeItem;
|
|
|
+import com.zskk.shop.dao.entry.GoodBase;
|
|
|
import com.zskk.shop.exception.ErrorConstant;
|
|
|
import com.zskk.shop.exception.ZSKKException;
|
|
|
import com.zskk.shop.service.ExchangeCodeService;
|
|
|
+import com.zskk.shop.service.GoodService;
|
|
|
import com.zskk.shop.utils.ToolsUtil;
|
|
|
|
|
|
@Controller
|
|
@@ -30,6 +35,9 @@ public class ExchangeCodeController extends AbstractController {
|
|
|
@Autowired
|
|
|
public ExchangeCodeService exchangeCodeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ public GoodService goodService;
|
|
|
+
|
|
|
@RequestMapping("list")
|
|
|
@ResponseBody
|
|
|
public ControllerResult list(@RequestParam(name="gid", required=false) Integer gid,
|
|
@@ -37,7 +45,18 @@ public class ExchangeCodeController extends AbstractController {
|
|
|
if (search != null && search.isEmpty()){
|
|
|
search = null;
|
|
|
}
|
|
|
- return new ControllerResult(exchangeCodeService.queryAllExchangeCode(search, status, gid));
|
|
|
+
|
|
|
+ GoodBase good = goodService.queryOneGoodBase(gid);
|
|
|
+ if (good == null){
|
|
|
+ throw new ZSKKException(ErrorConstant.PARAM_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ExchangeCode> list = exchangeCodeService.queryAllExchangeCode(search, status, gid);
|
|
|
+ for (ExchangeCode it: list){
|
|
|
+ it.setGname(good.getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ return new ControllerResult(list);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("create")
|
|
@@ -72,6 +91,10 @@ public class ExchangeCodeController extends AbstractController {
|
|
|
@RequestMapping("getitems")
|
|
|
@ResponseBody
|
|
|
public ControllerResult getItems(@RequestParam("eid") Integer eid, @RequestParam(name="status", required=false) Integer status){
|
|
|
- return new ControllerResult(exchangeCodeService.getItems(eid, status));
|
|
|
+ List<ExchangeCodeItem> list = exchangeCodeService.getItems(eid, status);
|
|
|
+ for (ExchangeCodeItem it: list){
|
|
|
+ it.setEipwd(it.getEipwd().replaceAll(".", "*"));
|
|
|
+ }
|
|
|
+ return new ControllerResult(list);
|
|
|
}
|
|
|
}
|