|
|
@ -9,10 +9,7 @@ import com.hfkj.common.exception.SysCode; |
|
|
|
import com.hfkj.common.security.SessionObject; |
|
|
|
import com.hfkj.common.security.SessionObject; |
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
import com.hfkj.entity.CouponDiscount; |
|
|
|
import com.hfkj.entity.*; |
|
|
|
import com.hfkj.entity.CouponDiscountGoodsRel; |
|
|
|
|
|
|
|
import com.hfkj.entity.GoodsMsg; |
|
|
|
|
|
|
|
import com.hfkj.entity.GoodsSpecs; |
|
|
|
|
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
@ -47,6 +44,8 @@ public class DiscountController { |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private CouponDiscountUserRelService discountUserRelService; |
|
|
|
private CouponDiscountUserRelService discountUserRelService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private CouponDiscountService couponDiscountService; |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getListUserDiscount", method = RequestMethod.GET) |
|
|
|
@RequestMapping(value = "/getListUserDiscount", method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
@ -70,6 +69,48 @@ public class DiscountController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getGoodsDiscount", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "获取商品可用优惠券") |
|
|
|
|
|
|
|
public ResponseData getGoodsDiscount(@RequestParam(value = "specsIds", required = true) String specsIds) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用户session
|
|
|
|
|
|
|
|
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> mapSpecs = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mapSpecs.put("specsIds", specsIds); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询规格可用优惠券
|
|
|
|
|
|
|
|
List<CouponDiscountGoodsRel> couponDiscountGoodsRel = couponDiscountService.getListGoodsRel(mapSpecs); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (couponDiscountGoodsRel == null) { |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<CouponDiscountUserRel> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(CouponDiscountGoodsRel rel : couponDiscountGoodsRel) { |
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("userId", userSession.getUser().getId()); |
|
|
|
|
|
|
|
map.put("status", 1); |
|
|
|
|
|
|
|
map.put("discountId", rel.getDiscountId()); |
|
|
|
|
|
|
|
CouponDiscountUserRel couponDiscountUserRel = discountUserRelService.getRel(map); |
|
|
|
|
|
|
|
list.add(couponDiscountUserRel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(list); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("GoodsDetailController --> getListUser() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|