|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.bweb.controller; |
|
|
|
package com.bweb.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
@ -11,8 +12,10 @@ import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.UserInfoModel; |
|
|
|
import com.hai.model.UserInfoModel; |
|
|
|
import com.hai.service.HighCouponPackageService; |
|
|
|
|
|
|
|
import com.hai.service.HighCouponService; |
|
|
|
import com.hai.service.HighCouponService; |
|
|
|
|
|
|
|
import com.hai.service.HighDiscountPackageDetailsService; |
|
|
|
|
|
|
|
import com.hai.service.HighDiscountPackageService; |
|
|
|
|
|
|
|
import com.hai.service.HighDiscountService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.models.auth.In; |
|
|
|
import io.swagger.models.auth.In; |
|
|
@ -47,15 +50,18 @@ public class HighCouponPackageController { |
|
|
|
private UserCenter userCenter; |
|
|
|
private UserCenter userCenter; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighCouponPackageService highCouponPackageService; |
|
|
|
private HighDiscountPackageService highDiscountPackageService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighDiscount highDiscount; |
|
|
|
private HighDiscountPackageDetailsService highDiscountPackageDetailsService; |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getCouponPackageList", method = RequestMethod.GET) |
|
|
|
@Resource |
|
|
|
|
|
|
|
private HighDiscountService highDiscountService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getDiscountPackageList", method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "获取优惠券包列表") |
|
|
|
@ApiOperation(value = "获取优惠券包列表") |
|
|
|
public ResponseData getCouponPackageList(@RequestParam(name = "usingAttribution", required = false) Integer usingAttribution, |
|
|
|
public ResponseData getDiscountPackageList(@RequestParam(name = "usingAttribution", required = false) Integer usingAttribution, |
|
|
|
@RequestParam(name = "title", required = false) String title, |
|
|
|
@RequestParam(name = "title", required = false) String title, |
|
|
|
@RequestParam(name = "salesType", required = false) Integer salesType, |
|
|
|
@RequestParam(name = "salesType", required = false) Integer salesType, |
|
|
|
@RequestParam(name = "status", required = false) Integer status, |
|
|
|
@RequestParam(name = "status", required = false) Integer status, |
|
|
@ -75,7 +81,7 @@ public class HighCouponPackageController { |
|
|
|
map.put("salesType" , salesType); |
|
|
|
map.put("salesType" , salesType); |
|
|
|
map.put("status" , status); |
|
|
|
map.put("status" , status); |
|
|
|
PageHelper.startPage(pageNum,pageSize); |
|
|
|
PageHelper.startPage(pageNum,pageSize); |
|
|
|
return ResponseMsgUtil.success(new PageInfo<>(highCouponPackageService.getCouponPackageList(map))); |
|
|
|
return ResponseMsgUtil.success(new PageInfo<>(highDiscountPackageService.getDiscountPackageList(map))); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("HighOrderController --> getUserOrderList() error!", e); |
|
|
|
log.error("HighOrderController --> getUserOrderList() error!", e); |
|
|
@ -84,25 +90,72 @@ public class HighCouponPackageController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/highCouponPackageInfo", method = RequestMethod.POST) |
|
|
|
@RequestMapping(value = "/insertCouponPackageInfo", method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "新增优惠券包基本信息") |
|
|
|
@ApiOperation(value = "新增优惠券包基本信息") |
|
|
|
public ResponseData highCouponPackageInfo(@RequestBody HighCouponPackage highCouponPackage, HttpServletRequest request) { |
|
|
|
public ResponseData insertCouponPackageInfo(@RequestBody HighDiscountPackage highDiscountPackage, HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//发布人员
|
|
|
|
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(highDiscountPackage.getTitle()) |
|
|
|
|
|
|
|
|| highDiscountPackage.getUsingAttribution() == null |
|
|
|
|
|
|
|
|| highDiscountPackage.getSalesType() == null |
|
|
|
|
|
|
|
|| highDiscountPackage.getEffectiveTiem() == null |
|
|
|
|
|
|
|
|| highDiscountPackage.getPurchaseNum() == null |
|
|
|
|
|
|
|
|| highDiscountPackage.getPrice() == null |
|
|
|
|
|
|
|
|| StringUtils.isBlank(highDiscountPackage.getBannerImg()) |
|
|
|
|
|
|
|
|| StringUtils.isBlank(highDiscountPackage.getListImg()) |
|
|
|
|
|
|
|
|| StringUtils.isBlank(highDiscountPackage.getDetailsImg()) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
log.error("HighAgentController -> insertAgent() error!","参数错误"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userInfoModel.getBsCompany() == null) { |
|
|
|
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","该主角色没有权限"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highDiscountPackage.setCompanyId(userInfoModel.getBsCompany().getId().intValue()); |
|
|
|
|
|
|
|
highDiscountPackage.setStatus(3); |
|
|
|
|
|
|
|
highDiscountPackage.setCreatedTime(new Date()); |
|
|
|
|
|
|
|
highDiscountPackage.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
|
|
|
|
highDiscountPackage.setUpdatedTime(new Date()); |
|
|
|
|
|
|
|
highDiscountPackage.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highDiscountPackageService.insertDiscountPackage(highDiscountPackage); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(highDiscountPackage); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighAgentController --> insertAgent() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/updateCouponPackageInfo", method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "修改优惠券包基本信息") |
|
|
|
|
|
|
|
public ResponseData updateCouponPackageInfo(@RequestBody HighDiscountPackage highDiscountPackage, HttpServletRequest request) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
//发布人员
|
|
|
|
//发布人员
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(highCouponPackage.getTitle()) |
|
|
|
if (StringUtils.isBlank(highDiscountPackage.getTitle()) |
|
|
|
|| highCouponPackage.getUsingAttribution() == null |
|
|
|
|| highDiscountPackage.getUsingAttribution() == null |
|
|
|
|| highCouponPackage.getSalesType() == null |
|
|
|
|| highDiscountPackage.getSalesType() == null |
|
|
|
|| highCouponPackage.getEffectiveTiem() == null |
|
|
|
|| highDiscountPackage.getId() == null |
|
|
|
|| highCouponPackage.getPurchaseNum() == null |
|
|
|
|| highDiscountPackage.getEffectiveTiem() == null |
|
|
|
|| highCouponPackage.getPrice() == null |
|
|
|
|| highDiscountPackage.getPurchaseNum() == null |
|
|
|
|| StringUtils.isBlank(highCouponPackage.getBannerImg()) |
|
|
|
|| highDiscountPackage.getPrice() == null |
|
|
|
|| StringUtils.isBlank(highCouponPackage.getListImg()) |
|
|
|
|| StringUtils.isBlank(highDiscountPackage.getBannerImg()) |
|
|
|
|| StringUtils.isBlank(highCouponPackage.getDetailsImg()) |
|
|
|
|| StringUtils.isBlank(highDiscountPackage.getListImg()) |
|
|
|
|
|
|
|
|| StringUtils.isBlank(highDiscountPackage.getDetailsImg()) |
|
|
|
) { |
|
|
|
) { |
|
|
|
log.error("HighAgentController -> insertAgent() error!","参数错误"); |
|
|
|
log.error("HighAgentController -> insertAgent() error!","参数错误"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
@ -113,16 +166,20 @@ public class HighCouponPackageController { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
highCouponPackage.setCompanyId(userInfoModel.getBsCompany().getId().intValue()); |
|
|
|
HighDiscountPackage highDiscountPackages = highDiscountPackageService.findDiscountPackageById(highDiscountPackage.getId()); |
|
|
|
highCouponPackage.setStatus(3); |
|
|
|
|
|
|
|
highCouponPackage.setCreatedTime(new Date()); |
|
|
|
|
|
|
|
highCouponPackage.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
|
|
|
|
highCouponPackage.setUpdatedTime(new Date()); |
|
|
|
|
|
|
|
highCouponPackage.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highCouponPackageService.insertCouponPackage(highCouponPackage); |
|
|
|
if (highDiscountPackages == null || highDiscountPackage.getStatus() == 1) { |
|
|
|
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","状态错误"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(highCouponPackage); |
|
|
|
highDiscountPackages.setStatus(3); |
|
|
|
|
|
|
|
highDiscountPackages.setUpdatedTime(new Date()); |
|
|
|
|
|
|
|
highDiscountPackages.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highDiscountPackageService.insertDiscountPackage(highDiscountPackage); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(highDiscountPackage); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("HighAgentController --> insertAgent() error!", e); |
|
|
|
log.error("HighAgentController --> insertAgent() error!", e); |
|
|
@ -133,15 +190,15 @@ public class HighCouponPackageController { |
|
|
|
@RequestMapping(value = "/highCouponPackageRule", method = RequestMethod.POST) |
|
|
|
@RequestMapping(value = "/highCouponPackageRule", method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "新增优惠券包规则信息") |
|
|
|
@ApiOperation(value = "新增优惠券包规则信息") |
|
|
|
public ResponseData highCouponPackageRule(@RequestBody HighCouponPackageDetails highCouponPackageDetails, HttpServletRequest request) { |
|
|
|
public ResponseData highCouponPackageRule(@RequestBody HighDiscountPackageDetails highDiscountPackageDetails, HttpServletRequest request) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
//发布人员
|
|
|
|
//发布人员
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
|
|
|
|
|
|
|
|
if ( highCouponPackageDetails.getCouponPackageId() == null |
|
|
|
if ( highDiscountPackageDetails.getDiscountPackageId() == null |
|
|
|
|| highCouponPackageDetails.getCouponId() == null |
|
|
|
|| highDiscountPackageDetails.getDiscountId() == null |
|
|
|
|| highCouponPackageDetails.getNum() == null |
|
|
|
|| highDiscountPackageDetails.getNum() == null |
|
|
|
) { |
|
|
|
) { |
|
|
|
log.error("HighAgentController -> insertAgent() error!","参数错误"); |
|
|
|
log.error("HighAgentController -> insertAgent() error!","参数错误"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
@ -152,20 +209,23 @@ public class HighCouponPackageController { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (highCouponService.getCouponById(highCouponPackageDetails.getCouponId().longValue()) == null) { |
|
|
|
HighDiscount discount = highDiscountService.getDiscountById(highDiscountPackageDetails.getDiscountId().longValue()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (discount == null || highDiscountPackageService.findDiscountPackageById(highDiscountPackageDetails.getDiscountPackageId()) == null) { |
|
|
|
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","优惠券 或者 优惠券包不存在"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "优惠券 或者 优惠券包不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
highCouponPackage.setCompanyId(userInfoModel.getBsCompany().getId().intValue()); |
|
|
|
highDiscountPackageDetails.setStatus(1); |
|
|
|
highCouponPackage.setStatus(3); |
|
|
|
highDiscountPackageDetails.setDiscountName(discount.getDiscountName()); |
|
|
|
highCouponPackage.setCreatedTime(new Date()); |
|
|
|
highDiscountPackageDetails.setCreatedTime(new Date()); |
|
|
|
highCouponPackage.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
highDiscountPackageDetails.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
highCouponPackage.setUpdatedTime(new Date()); |
|
|
|
highDiscountPackageDetails.setUpdatedTime(new Date()); |
|
|
|
highCouponPackage.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
highDiscountPackageDetails.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
|
|
|
|
|
|
|
|
highCouponPackageService.insertCouponPackage(highCouponPackage); |
|
|
|
highDiscountPackageDetailsService.insertDiscountPackageDetails(highDiscountPackageDetails); |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(highCouponPackage); |
|
|
|
return ResponseMsgUtil.success(null); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("HighAgentController --> insertAgent() error!", e); |
|
|
|
log.error("HighAgentController --> insertAgent() error!", e); |
|
|
@ -173,4 +233,59 @@ public class HighCouponPackageController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getDiscountPackageRuleList", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "获取优惠券包规则列表") |
|
|
|
|
|
|
|
public ResponseData getDiscountPackageRuleList(@RequestParam(name = "discountPackageId", required = true) Integer discountPackageId, |
|
|
|
|
|
|
|
HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//发布人员
|
|
|
|
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userInfoModel.getBsCompany() == null) { |
|
|
|
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","该主角色没有权限"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("discountPackageId", discountPackageId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(highDiscountPackageDetailsService.getDiscountPackageDetailsList(map)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighOrderController --> getUserOrderList() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/deleteDiscountPackageRule", method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "删除优惠券包规则") |
|
|
|
|
|
|
|
public ResponseData deleteDiscountPackageRule(@RequestBody JSONObject object, HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//发布人员
|
|
|
|
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
|
|
|
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userInfoModel.getBsCompany() == null) { |
|
|
|
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","该主角色没有权限"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HighDiscountPackageDetails highDiscountPackageDetails = highDiscountPackageDetailsService.findDetailsById(object.getInteger("discountPackageId")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(highDiscountPackageDetailsService.getDiscountPackageDetailsList(map)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighOrderController --> getUserOrderList() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|