|
|
@ -9,14 +9,13 @@ import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.security.SessionObject; |
|
|
|
import com.hai.common.security.SessionObject; |
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.entity.HighAgent; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.entity.HighCoupon; |
|
|
|
|
|
|
|
import com.hai.entity.HighCouponAgentRel; |
|
|
|
|
|
|
|
import com.hai.model.HighAgentModel; |
|
|
|
import com.hai.model.HighAgentModel; |
|
|
|
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.HighAgentService; |
|
|
|
import com.hai.service.HighCouponAgentService; |
|
|
|
import com.hai.service.HighCouponAgentService; |
|
|
|
|
|
|
|
import com.hai.service.HighCouponCodeService; |
|
|
|
import com.hai.service.HighCouponService; |
|
|
|
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; |
|
|
@ -52,6 +51,9 @@ public class HighCouponAgentController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighAgentService highAgentService; |
|
|
|
private HighAgentService highAgentService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private HighCouponCodeService highCouponCodeService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private UserCenter userCenter; |
|
|
|
private UserCenter userCenter; |
|
|
|
|
|
|
|
|
|
|
@ -146,21 +148,26 @@ public class HighCouponAgentController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getAgentByCoupon", method = RequestMethod.GET) |
|
|
|
@RequestMapping(value = "/getAgentByCoupon", method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "根据卡券 查询代理商") |
|
|
|
@ApiOperation(value = "根据卡券 查询代理商") |
|
|
|
public ResponseData getAgentByCoupon(@RequestParam(name = "couponId", required = true) Long couponId, |
|
|
|
public ResponseData getAgentByCoupon(@RequestParam(name = "couponId", required = true) Long couponId, |
|
|
|
|
|
|
|
@RequestParam(name = "status", required = false) Integer status, |
|
|
|
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
|
|
|
@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 { |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
map.put("couponId", couponId); |
|
|
|
map.put("couponId", couponId); |
|
|
|
|
|
|
|
map.put("status", status); |
|
|
|
|
|
|
|
|
|
|
|
PageHelper.startPage(pageNum,pageSize); |
|
|
|
PageHelper.startPage(pageNum,pageSize); |
|
|
|
PageInfo<HighCouponAgentRel> pageInfo = new PageInfo<>(highCouponAgentService.getCouponAgentList(map)); |
|
|
|
PageInfo<HighCouponAgentRel> pageInfo = new PageInfo<>(highCouponAgentService.getCouponAgentList(map)); |
|
|
|
for (HighCouponAgentRel rel : pageInfo.getList()) { |
|
|
|
if (pageInfo.getList().size() > 0) { |
|
|
|
rel.setHighAgent(highAgentService.findByAgentMsgId(rel.getAgentId())); |
|
|
|
for (HighCouponAgentRel code : pageInfo.getList()) { |
|
|
|
|
|
|
|
code.setHighAgent(highAgentService.findByAgentMsgId(code.getAgentId())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return ResponseMsgUtil.success(pageInfo); |
|
|
|
return ResponseMsgUtil.success(pageInfo); |
|
|
|
|
|
|
|
|
|
|
@ -171,4 +178,90 @@ public class HighCouponAgentController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getCodeListByAgentCoupon", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "根据代理商和卡券 查询分配的销售码") |
|
|
|
|
|
|
|
public ResponseData getCodeListByAgentCoupon(@RequestParam(name = "couponId", required = true) Long couponId, |
|
|
|
|
|
|
|
@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("couponId", couponId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PageHelper.startPage(pageNum,pageSize); |
|
|
|
|
|
|
|
PageInfo<HighCouponAgentCode> pageInfo = new PageInfo<>(highCouponAgentService.getCouponCodeList(map)); |
|
|
|
|
|
|
|
if (pageInfo.getList().size() > 0) { |
|
|
|
|
|
|
|
HighCoupon coupon = highCouponService.getCouponDetail(couponId); |
|
|
|
|
|
|
|
for (HighCouponAgentCode code : pageInfo.getList()) { |
|
|
|
|
|
|
|
code.setMerchantName(coupon.getMerchantName()); |
|
|
|
|
|
|
|
code.setHighCoupon(coupon); |
|
|
|
|
|
|
|
code.setHighCouponCode(highCouponCodeService.getCouponCodeById(code.getCouponCodeId())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(pageInfo); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighCouponAgentController --> getCouponByAgent() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/generateCode", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "生成二维码") |
|
|
|
|
|
|
|
public ResponseData generateCode(@RequestParam(name = "couponAgentCodeId", required = true) Long couponAgentCodeId, |
|
|
|
|
|
|
|
HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
//发布人员
|
|
|
|
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userInfoModel.getHighAgent() == null) { |
|
|
|
|
|
|
|
log.error("HighCouponAgentController -> generateCode() error!","该角色没有权限"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "该角色没有权限"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(highCouponAgentService.generateCode(couponAgentCodeId)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighCouponAgentController --> generateCode() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getCodeById", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "根据销售码查询详情") |
|
|
|
|
|
|
|
public ResponseData getCodeById(@RequestParam(name = "couponAgentCodeId", required = true) Long couponAgentCodeId, |
|
|
|
|
|
|
|
HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
// 查询卡券销售码
|
|
|
|
|
|
|
|
HighCouponAgentCode couponAgentCode = highCouponAgentService.getCodeById(couponAgentCodeId); |
|
|
|
|
|
|
|
if (couponAgentCode == null) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到销售码"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
map.put("couponInfo", highCouponService.getCouponById(couponAgentCode.getCouponId())); |
|
|
|
|
|
|
|
map.put("couponCode", highCouponCodeService.getCouponCodeById(couponAgentCode.getCouponCodeId())); |
|
|
|
|
|
|
|
map.put("couponAgentCode", couponAgentCode); |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighCouponAgentController --> getCodeById() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|