From 230e0fc0051d6a8fd77b1c2596c9c5e52dabadca Mon Sep 17 00:00:00 2001 From: 199901012 Date: Fri, 23 Apr 2021 00:55:44 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4diam'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighCouponAgentController.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java index 5623dfb8..a7d1081a 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java @@ -11,12 +11,10 @@ import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.*; import com.hai.model.HighAgentModel; +import com.hai.model.HighMerchantModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; -import com.hai.service.HighAgentService; -import com.hai.service.HighCouponAgentService; -import com.hai.service.HighCouponCodeService; -import com.hai.service.HighCouponService; +import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -54,6 +52,9 @@ public class HighCouponAgentController { @Resource private HighCouponCodeService highCouponCodeService; + @Resource + private HighMerchantService highMerchantService; + @Autowired private UserCenter userCenter; @@ -142,20 +143,13 @@ public class HighCouponAgentController { @RequestMapping(value = "/getCouponByAgent", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据代理商 查询卡券") - public ResponseData getCouponByAgent(@RequestParam(name = "pageNum", required = true) Integer pageNum, + public ResponseData getCouponByAgent(@RequestParam(name = "agentId", required = true) Long agentId, + @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { - //发布人员 - SessionObject sessionObject = userCenter.getSessionObject(request); - UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); - if (userInfoModel.getHighAgent() == null) { - log.error("HighCouponAgentController -> getCouponByAgent() error!","该角色没有权限"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "该角色没有权限"); - } - Map map = new HashMap<>(); - map.put("agentId", userInfoModel.getHighAgent().getId()); + map.put("agentId", agentId); PageHelper.startPage(pageNum,pageSize); PageInfo pageInfo = new PageInfo<>(highCouponAgentService.getCouponAgentList(map)); @@ -225,11 +219,15 @@ public class HighCouponAgentController { PageHelper.startPage(pageNum,pageSize); PageInfo pageInfo = new PageInfo<>(highCouponAgentService.getCouponCodeList(map)); if (pageInfo.getList().size() > 0) { - HighCoupon coupon = highCouponService.getCouponDetail(couponId); + HighMerchant merchant = new HighMerchant(); + HighCoupon highCoupon = highCouponService.getCouponById(couponId); + if (highCoupon != null) { + merchant = highMerchantService.getMerchantById(highCoupon.getMerchantId()); + } for (HighCouponAgentCode code : pageInfo.getList()) { - code.setMerchantLogo(code.getMerchantLogo()); - code.setMerchantName(coupon.getMerchantName()); - code.setHighCoupon(coupon); + code.setMerchantLogo(merchant.getMerchantLogo()); + code.setMerchantName(merchant.getMerchantName()); + code.setHighCoupon(highCoupon); code.setHighCouponCode(highCouponCodeService.getCouponCodeById(code.getCouponCodeId())); } }