Authored by wangshusheng

修改

@@ -38,11 +38,11 @@ public class CutDownProductPriceRest { @@ -38,11 +38,11 @@ public class CutDownProductPriceRest {
38 */ 38 */
39 @RequestMapping("/addCutPriceRecord") 39 @RequestMapping("/addCutPriceRecord")
40 @ResponseBody 40 @ResponseBody
41 - public ApiResponse addCutPriceRecord(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) { 41 + public Integer addCutPriceRecord(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
42 logger.info("CutDownProductPriceRest addCutPriceRecord params is{}", cutPriceHelpUserRequestBO); 42 logger.info("CutDownProductPriceRest addCutPriceRecord params is{}", cutPriceHelpUserRequestBO);
43 int num = cutDownPriceService.addCutPriceRecord(cutPriceHelpUserRequestBO); 43 int num = cutDownPriceService.addCutPriceRecord(cutPriceHelpUserRequestBO);
44 logger.info("CutDownProductPriceRest addCutPriceRecord success"); 44 logger.info("CutDownProductPriceRest addCutPriceRecord success");
45 - return new ApiResponse.ApiResponseBuilder().code(200).data(num).message("用户发起砍价商品成功").build(); 45 + return num;
46 } 46 }
47 47
48 /** 48 /**
@@ -50,11 +50,11 @@ public class CutDownProductPriceRest { @@ -50,11 +50,11 @@ public class CutDownProductPriceRest {
50 */ 50 */
51 @RequestMapping("/queryMyCutPriceList") 51 @RequestMapping("/queryMyCutPriceList")
52 @ResponseBody 52 @ResponseBody
53 - public ApiResponse queryMyCutPriceListByPage(@RequestBody CutDownProductQueryRequest request) { 53 + public PageResponseBo<CutDownPriceActivityProductBo> queryMyCutPriceListByPage(@RequestBody CutDownProductQueryRequest request) {
54 logger.info("CutDownProductPriceRest queryMyCutPriceList params is{}", request); 54 logger.info("CutDownProductPriceRest queryMyCutPriceList params is{}", request);
55 PageResponseBo<CutDownPriceActivityProductBo> responseBo = cutDownPriceService.queryMyCutPriceListByPage(request); 55 PageResponseBo<CutDownPriceActivityProductBo> responseBo = cutDownPriceService.queryMyCutPriceListByPage(request);
56 logger.info("CutDownProductPriceRest queryMyCutPriceList success"); 56 logger.info("CutDownProductPriceRest queryMyCutPriceList success");
57 - return new ApiResponse.ApiResponseBuilder().code(200).data(responseBo).message("我的砍价商品列表").build(); 57 + return responseBo;
58 } 58 }
59 59
60 /** 60 /**
@@ -62,11 +62,11 @@ public class CutDownProductPriceRest { @@ -62,11 +62,11 @@ public class CutDownProductPriceRest {
62 */ 62 */
63 @RequestMapping("/queryCutPriceProductDetail") 63 @RequestMapping("/queryCutPriceProductDetail")
64 @ResponseBody 64 @ResponseBody
65 - public ApiResponse queryCutPriceProductDetail(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) { 65 + public CutDownPriceActivityProductBo queryCutPriceProductDetail(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
66 logger.info("CutDownProductPriceRest queryCutPriceProductDetail params is{}", cutPriceHelpUserRequestBO); 66 logger.info("CutDownProductPriceRest queryCutPriceProductDetail params is{}", cutPriceHelpUserRequestBO);
67 CutDownPriceActivityProductBo productInfo = cutDownPriceService.queryCutProductInfo(cutPriceHelpUserRequestBO); 67 CutDownPriceActivityProductBo productInfo = cutDownPriceService.queryCutProductInfo(cutPriceHelpUserRequestBO);
68 logger.info("CutDownProductPriceRest queryCutPriceProductDetail success"); 68 logger.info("CutDownProductPriceRest queryCutPriceProductDetail success");
69 - return new ApiResponse.ApiResponseBuilder().code(200).data(productInfo).message("砍价商品详情").build(); 69 + return productInfo;
70 } 70 }
71 71
72 /** 72 /**
@@ -74,11 +74,11 @@ public class CutDownProductPriceRest { @@ -74,11 +74,11 @@ public class CutDownProductPriceRest {
74 */ 74 */
75 @RequestMapping("/addCutPriceHelpUserInfo") 75 @RequestMapping("/addCutPriceHelpUserInfo")
76 @ResponseBody 76 @ResponseBody
77 - public ApiResponse addCutPriceHelpUserInfo(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) { 77 + public BigDecimal addCutPriceHelpUserInfo(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
78 logger.info("CutDownProductPriceRest addCutPriceHelpUserInfo params is{}", cutPriceHelpUserRequestBO); 78 logger.info("CutDownProductPriceRest addCutPriceHelpUserInfo params is{}", cutPriceHelpUserRequestBO);
79 BigDecimal cutPrice = cutDownPriceService.addHelpUserInfo(cutPriceHelpUserRequestBO); 79 BigDecimal cutPrice = cutDownPriceService.addHelpUserInfo(cutPriceHelpUserRequestBO);
80 logger.info("CutDownProductPriceRest addCutPriceHelpUserInfo success"); 80 logger.info("CutDownProductPriceRest addCutPriceHelpUserInfo success");
81 - return new ApiResponse.ApiResponseBuilder().code(200).data(cutPrice).message("用户砍价成功").build(); 81 + return cutPrice;
82 } 82 }
83 83
84 /** 84 /**
@@ -86,15 +86,23 @@ public class CutDownProductPriceRest { @@ -86,15 +86,23 @@ public class CutDownProductPriceRest {
86 */ 86 */
87 @RequestMapping("/queryCutPriceHelpUserInfos") 87 @RequestMapping("/queryCutPriceHelpUserInfos")
88 @ResponseBody 88 @ResponseBody
89 - public ApiResponse queryCutPriceHelpUserInfos(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) { 89 + public List<CutDownPriceProductHelpUserBo> queryCutPriceHelpUserInfos(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
90 logger.info("CutDownProductPriceRest queryCutPriceHelpUserInfos params is{}", cutPriceHelpUserRequestBO); 90 logger.info("CutDownProductPriceRest queryCutPriceHelpUserInfos params is{}", cutPriceHelpUserRequestBO);
91 List<CutDownPriceProductHelpUserBo> helpUsers = cutDownPriceService.queryHelpInfo(cutPriceHelpUserRequestBO); 91 List<CutDownPriceProductHelpUserBo> helpUsers = cutDownPriceService.queryHelpInfo(cutPriceHelpUserRequestBO);
92 logger.info("CutDownProductPriceRest queryCutPriceHelpUserInfos success"); 92 logger.info("CutDownProductPriceRest queryCutPriceHelpUserInfos success");
93 - return new ApiResponse.ApiResponseBuilder().code(200).data(helpUsers).message("帮砍记录列表").build(); 93 + return helpUsers;
94 } 94 }
95 95
96 /** 96 /**
97 * 给订单提供接口:查询砍价信息 97 * 给订单提供接口:查询砍价信息
  98 + * 直接调
98 */ 99 */
99 - 100 + @RequestMapping("/queryCutPriceProductForOrder")
  101 + @ResponseBody
  102 + public CutDownPriceActivityProductBo queryCutPriceProductForOrder(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
  103 + logger.info("CutDownProductPriceRest queryCutPriceProductDetail params is{}", cutPriceHelpUserRequestBO);
  104 + CutDownPriceActivityProductBo productInfo = cutDownPriceService.queryCutProductInfo(cutPriceHelpUserRequestBO);
  105 + logger.info("CutDownProductPriceRest queryCutPriceProductDetail success");
  106 + return productInfo;
  107 + }
100 } 108 }
@@ -64,6 +64,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { @@ -64,6 +64,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
64 Integer activityId = cutPriceHelpUserRequestBO.getActivityId(); 64 Integer activityId = cutPriceHelpUserRequestBO.getActivityId();
65 Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn(); 65 Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn();
66 Integer userId = cutPriceHelpUserRequestBO.getUserId(); 66 Integer userId = cutPriceHelpUserRequestBO.getUserId();
  67 + if(userId==null){
  68 + return Lists.newArrayList();
  69 + }
67 // 取缓存 70 // 取缓存
68 String redisKeySuffix = userId + ":" + activityId + ":" + productSkn; 71 String redisKeySuffix = userId + ":" + activityId + ":" + productSkn;
69 CutDownPriceProductHelpUserWrapper helpUserWrapper = redisValueCache.get(CacheKeyEnum.CUTDOWN_PRICE_HELP_USERLIST_INFO, redisKeySuffix, CutDownPriceProductHelpUserWrapper.class); 72 CutDownPriceProductHelpUserWrapper helpUserWrapper = redisValueCache.get(CacheKeyEnum.CUTDOWN_PRICE_HELP_USERLIST_INFO, redisKeySuffix, CutDownPriceProductHelpUserWrapper.class);
@@ -102,8 +105,13 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { @@ -102,8 +105,13 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
102 Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn(); 105 Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn();
103 // 查询活动信息 106 // 查询活动信息
104 CutDownPriceActivityBo activityBo = cutDownActivityService.queryActivityInfo(activityId); 107 CutDownPriceActivityBo activityBo = cutDownActivityService.queryActivityInfo(activityId);
  108 + checkValidActivity(activityBo, activityId);
105 // 查询商品配置信息 109 // 查询商品配置信息
106 CutDownPriceProductBo cutDownPriceProductBo = cutDownPriceProductService.queryCutDownPriceProductBo(activityId, productSkn); 110 CutDownPriceProductBo cutDownPriceProductBo = cutDownPriceProductService.queryCutDownPriceProductBo(activityId, productSkn);
  111 + if(cutDownPriceProductBo==null){
  112 + logger.warn(" the cutdown product not exist, activityId is {}, productSkn is {}", activityId, productSkn);
  113 + throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_PRODUCT_NOTEXIST_ERROR);
  114 + }
107 // 查询已砍价记录 115 // 查询已砍价记录
108 List<CutDownPriceProductHelpUserBo> helpUserBos = this.queryHelpInfo(cutPriceHelpUserRequestBO); 116 List<CutDownPriceProductHelpUserBo> helpUserBos = this.queryHelpInfo(cutPriceHelpUserRequestBO);
109 // 调product接口查询商品信息 117 // 调product接口查询商品信息
@@ -331,6 +339,7 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { @@ -331,6 +339,7 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
331 activityProductBo.setUserImgUrl(helpUserBo.getUserImgUrl());// 赋值一次就可以了 339 activityProductBo.setUserImgUrl(helpUserBo.getUserImgUrl());// 赋值一次就可以了
332 } 340 }
333 activityProductBo.setHasCutPrice(hasCutPrice); 341 activityProductBo.setHasCutPrice(hasCutPrice);
  342 + activityProductBo.setHasJoinNum(helpUserBos.size());
334 return activityProductBo; 343 return activityProductBo;
335 } 344 }
336 345