'提交diam'

dev-discount
199901012 4 years ago
parent 378f2579de
commit 230e0fc005
  1. 34
      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.common.utils.ResponseMsgUtil;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.model.HighAgentModel; import com.hai.model.HighAgentModel;
import com.hai.model.HighMerchantModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.HighAgentService; import com.hai.service.*;
import com.hai.service.HighCouponAgentService;
import com.hai.service.HighCouponCodeService;
import com.hai.service.HighCouponService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -54,6 +52,9 @@ public class HighCouponAgentController {
@Resource @Resource
private HighCouponCodeService highCouponCodeService; private HighCouponCodeService highCouponCodeService;
@Resource
private HighMerchantService highMerchantService;
@Autowired @Autowired
private UserCenter userCenter; private UserCenter userCenter;
@ -142,20 +143,13 @@ public class HighCouponAgentController {
@RequestMapping(value = "/getCouponByAgent", method = RequestMethod.GET) @RequestMapping(value = "/getCouponByAgent", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "根据代理商 查询卡券") @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, @RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) { HttpServletRequest request) {
try { 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<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("agentId", userInfoModel.getHighAgent().getId()); map.put("agentId", agentId);
PageHelper.startPage(pageNum,pageSize); PageHelper.startPage(pageNum,pageSize);
PageInfo<HighCouponAgentRel> pageInfo = new PageInfo<>(highCouponAgentService.getCouponAgentList(map)); PageInfo<HighCouponAgentRel> pageInfo = new PageInfo<>(highCouponAgentService.getCouponAgentList(map));
@ -225,11 +219,15 @@ public class HighCouponAgentController {
PageHelper.startPage(pageNum,pageSize); PageHelper.startPage(pageNum,pageSize);
PageInfo<HighCouponAgentCode> pageInfo = new PageInfo<>(highCouponAgentService.getCouponCodeList(map)); PageInfo<HighCouponAgentCode> pageInfo = new PageInfo<>(highCouponAgentService.getCouponCodeList(map));
if (pageInfo.getList().size() > 0) { 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()) { for (HighCouponAgentCode code : pageInfo.getList()) {
code.setMerchantLogo(code.getMerchantLogo()); code.setMerchantLogo(merchant.getMerchantLogo());
code.setMerchantName(coupon.getMerchantName()); code.setMerchantName(merchant.getMerchantName());
code.setHighCoupon(coupon); code.setHighCoupon(highCoupon);
code.setHighCouponCode(highCouponCodeService.getCouponCodeById(code.getCouponCodeId())); code.setHighCouponCode(highCouponCodeService.getCouponCodeById(code.getCouponCodeId()));
} }
} }

Loading…
Cancel
Save