|
|
|
@ -165,6 +165,8 @@ public class HighDiscountPackageController { |
|
|
|
|
highDiscountPackage.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
|
highDiscountPackage.setUpdatedTime(new Date()); |
|
|
|
|
highDiscountPackage.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); |
|
|
|
|
highDiscountPackage.setTotalStock(0); |
|
|
|
|
highDiscountPackage.setSurplusStock(0); |
|
|
|
|
|
|
|
|
|
highDiscountPackageService.insertDiscountPackage(highDiscountPackage); |
|
|
|
|
|
|
|
|
@ -376,7 +378,7 @@ public class HighDiscountPackageController { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(object.getInteger("discountId")); |
|
|
|
|
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(object.getInteger("discountPackageId")); |
|
|
|
|
|
|
|
|
|
if (highDiscountPackage == null || highDiscountPackage.getStatus() == 1) { |
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","状态错误"); |
|
|
|
@ -412,7 +414,7 @@ public class HighDiscountPackageController { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(object.getInteger("discountId")); |
|
|
|
|
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(object.getInteger("discountPackageId")); |
|
|
|
|
|
|
|
|
|
if (highDiscountPackage == null || highDiscountPackage.getStatus() == 1 ) { |
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","状态错误"); |
|
|
|
@ -448,7 +450,7 @@ public class HighDiscountPackageController { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(object.getInteger("discountId")); |
|
|
|
|
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(object.getInteger("discountPackageId")); |
|
|
|
|
|
|
|
|
|
if (highDiscountPackage == null) { |
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","状态错误"); |
|
|
|
@ -501,4 +503,40 @@ public class HighDiscountPackageController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/addDiscountPackageStock",method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "增加优惠券包库存") |
|
|
|
|
public ResponseData addDiscountPackageStock(@RequestBody JSONObject object, HttpServletRequest request) { |
|
|
|
|
try { |
|
|
|
|
//发布人员
|
|
|
|
|
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, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(object.getInteger("discountPackageId")); |
|
|
|
|
|
|
|
|
|
if (highDiscountPackage == null) { |
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","当前优惠券包不存在"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (object.getInteger("num") == null) { |
|
|
|
|
log.error("highCouponPackage -> highCouponPackageInfo() error!","请传入库存数量"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
highDiscountPackageService.addDiscountPackageStock(highDiscountPackage , userInfoModel , object.getInteger("num")); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("增加库存成功"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighDiscountController -> getDiscountById() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|