'提交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.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<String,Object> map = new HashMap<>();
map.put("agentId", userInfoModel.getHighAgent().getId());
map.put("agentId", agentId);
PageHelper.startPage(pageNum,pageSize);
PageInfo<HighCouponAgentRel> pageInfo = new PageInfo<>(highCouponAgentService.getCouponAgentList(map));
@ -225,11 +219,15 @@ public class HighCouponAgentController {
PageHelper.startPage(pageNum,pageSize);
PageInfo<HighCouponAgentCode> 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()));
}
}

Loading…
Cancel
Save