Authored by wangshusheng

修改

... ... @@ -38,11 +38,11 @@ public class CutDownProductPriceRest {
*/
@RequestMapping("/addCutPriceRecord")
@ResponseBody
public ApiResponse addCutPriceRecord(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
public Integer addCutPriceRecord(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
logger.info("CutDownProductPriceRest addCutPriceRecord params is{}", cutPriceHelpUserRequestBO);
int num = cutDownPriceService.addCutPriceRecord(cutPriceHelpUserRequestBO);
logger.info("CutDownProductPriceRest addCutPriceRecord success");
return new ApiResponse.ApiResponseBuilder().code(200).data(num).message("用户发起砍价商品成功").build();
return num;
}
/**
... ... @@ -50,11 +50,11 @@ public class CutDownProductPriceRest {
*/
@RequestMapping("/queryMyCutPriceList")
@ResponseBody
public ApiResponse queryMyCutPriceListByPage(@RequestBody CutDownProductQueryRequest request) {
public PageResponseBo<CutDownPriceActivityProductBo> queryMyCutPriceListByPage(@RequestBody CutDownProductQueryRequest request) {
logger.info("CutDownProductPriceRest queryMyCutPriceList params is{}", request);
PageResponseBo<CutDownPriceActivityProductBo> responseBo = cutDownPriceService.queryMyCutPriceListByPage(request);
logger.info("CutDownProductPriceRest queryMyCutPriceList success");
return new ApiResponse.ApiResponseBuilder().code(200).data(responseBo).message("我的砍价商品列表").build();
return responseBo;
}
/**
... ... @@ -62,11 +62,11 @@ public class CutDownProductPriceRest {
*/
@RequestMapping("/queryCutPriceProductDetail")
@ResponseBody
public ApiResponse queryCutPriceProductDetail(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
public CutDownPriceActivityProductBo queryCutPriceProductDetail(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
logger.info("CutDownProductPriceRest queryCutPriceProductDetail params is{}", cutPriceHelpUserRequestBO);
CutDownPriceActivityProductBo productInfo = cutDownPriceService.queryCutProductInfo(cutPriceHelpUserRequestBO);
logger.info("CutDownProductPriceRest queryCutPriceProductDetail success");
return new ApiResponse.ApiResponseBuilder().code(200).data(productInfo).message("砍价商品详情").build();
return productInfo;
}
/**
... ... @@ -74,11 +74,11 @@ public class CutDownProductPriceRest {
*/
@RequestMapping("/addCutPriceHelpUserInfo")
@ResponseBody
public ApiResponse addCutPriceHelpUserInfo(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
public BigDecimal addCutPriceHelpUserInfo(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
logger.info("CutDownProductPriceRest addCutPriceHelpUserInfo params is{}", cutPriceHelpUserRequestBO);
BigDecimal cutPrice = cutDownPriceService.addHelpUserInfo(cutPriceHelpUserRequestBO);
logger.info("CutDownProductPriceRest addCutPriceHelpUserInfo success");
return new ApiResponse.ApiResponseBuilder().code(200).data(cutPrice).message("用户砍价成功").build();
return cutPrice;
}
/**
... ... @@ -86,15 +86,23 @@ public class CutDownProductPriceRest {
*/
@RequestMapping("/queryCutPriceHelpUserInfos")
@ResponseBody
public ApiResponse queryCutPriceHelpUserInfos(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
public List<CutDownPriceProductHelpUserBo> queryCutPriceHelpUserInfos(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
logger.info("CutDownProductPriceRest queryCutPriceHelpUserInfos params is{}", cutPriceHelpUserRequestBO);
List<CutDownPriceProductHelpUserBo> helpUsers = cutDownPriceService.queryHelpInfo(cutPriceHelpUserRequestBO);
logger.info("CutDownProductPriceRest queryCutPriceHelpUserInfos success");
return new ApiResponse.ApiResponseBuilder().code(200).data(helpUsers).message("帮砍记录列表").build();
return helpUsers;
}
/**
* 给订单提供接口:查询砍价信息
* 直接调
*/
@RequestMapping("/queryCutPriceProductForOrder")
@ResponseBody
public CutDownPriceActivityProductBo queryCutPriceProductForOrder(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
logger.info("CutDownProductPriceRest queryCutPriceProductDetail params is{}", cutPriceHelpUserRequestBO);
CutDownPriceActivityProductBo productInfo = cutDownPriceService.queryCutProductInfo(cutPriceHelpUserRequestBO);
logger.info("CutDownProductPriceRest queryCutPriceProductDetail success");
return productInfo;
}
}
... ...
... ... @@ -64,6 +64,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
Integer activityId = cutPriceHelpUserRequestBO.getActivityId();
Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn();
Integer userId = cutPriceHelpUserRequestBO.getUserId();
if(userId==null){
return Lists.newArrayList();
}
// 取缓存
String redisKeySuffix = userId + ":" + activityId + ":" + productSkn;
CutDownPriceProductHelpUserWrapper helpUserWrapper = redisValueCache.get(CacheKeyEnum.CUTDOWN_PRICE_HELP_USERLIST_INFO, redisKeySuffix, CutDownPriceProductHelpUserWrapper.class);
... ... @@ -102,8 +105,13 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn();
// 查询活动信息
CutDownPriceActivityBo activityBo = cutDownActivityService.queryActivityInfo(activityId);
checkValidActivity(activityBo, activityId);
// 查询商品配置信息
CutDownPriceProductBo cutDownPriceProductBo = cutDownPriceProductService.queryCutDownPriceProductBo(activityId, productSkn);
if(cutDownPriceProductBo==null){
logger.warn(" the cutdown product not exist, activityId is {}, productSkn is {}", activityId, productSkn);
throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_PRODUCT_NOTEXIST_ERROR);
}
// 查询已砍价记录
List<CutDownPriceProductHelpUserBo> helpUserBos = this.queryHelpInfo(cutPriceHelpUserRequestBO);
// 调product接口查询商品信息
... ... @@ -331,6 +339,7 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
activityProductBo.setUserImgUrl(helpUserBo.getUserImgUrl());// 赋值一次就可以了
}
activityProductBo.setHasCutPrice(hasCutPrice);
activityProductBo.setHasJoinNum(helpUserBos.size());
return activityProductBo;
}
... ...