Merge branch 'dev-limitqueue-6.7' into test6.7
Showing
6 changed files
with
76 additions
and
16 deletions
@@ -17,4 +17,6 @@ public interface ProductLimitUserHelpMapper { | @@ -17,4 +17,6 @@ public interface ProductLimitUserHelpMapper { | ||
17 | List<LimitProductHelpUserRespBO> selectHelpInfoByUidAndCode(@Param("list") List<Integer> uidList, @Param("limitProductCode") String limitProductCode); | 17 | List<LimitProductHelpUserRespBO> selectHelpInfoByUidAndCode(@Param("list") List<Integer> uidList, @Param("limitProductCode") String limitProductCode); |
18 | 18 | ||
19 | Integer selectExistHelpInfo(@Param("helpUserId") String helpUserId, @Param("limitProductCode") String limitProductCode); | 19 | Integer selectExistHelpInfo(@Param("helpUserId") String helpUserId, @Param("limitProductCode") String limitProductCode); |
20 | + | ||
21 | + void addShareInfo(LimitProductHelpUser limitProductHelpUser); | ||
20 | } | 22 | } |
@@ -11,6 +11,15 @@ public class LimitProductHelpUser { | @@ -11,6 +11,15 @@ public class LimitProductHelpUser { | ||
11 | private String helpUserImgUrl; | 11 | private String helpUserImgUrl; |
12 | private String limitProductCode; | 12 | private String limitProductCode; |
13 | private Integer createTime; | 13 | private Integer createTime; |
14 | + private String isShare; | ||
15 | + | ||
16 | + public String getIsShare() { | ||
17 | + return isShare; | ||
18 | + } | ||
19 | + | ||
20 | + public void setIsShare(String isShare) { | ||
21 | + this.isShare = isShare; | ||
22 | + } | ||
14 | 23 | ||
15 | public Integer getId() { | 24 | public Integer getId() { |
16 | return id; | 25 | return id; |
@@ -8,10 +8,11 @@ | @@ -8,10 +8,11 @@ | ||
8 | <result column="help_user_name" property="helpUserName" jdbcType="VARCHAR" /> | 8 | <result column="help_user_name" property="helpUserName" jdbcType="VARCHAR" /> |
9 | <result column="help_user_img_url" property="helpUserImgUrl" jdbcType="VARCHAR" /> | 9 | <result column="help_user_img_url" property="helpUserImgUrl" jdbcType="VARCHAR" /> |
10 | <result column="limit_product_code" property="limitProductCode" jdbcType="VARCHAR" /> | 10 | <result column="limit_product_code" property="limitProductCode" jdbcType="VARCHAR" /> |
11 | + <result column="is_share" property="isShare" jdbcType="VARCHAR" /> | ||
11 | <result column="create_time" property="createTime" jdbcType="INTEGER" /> | 12 | <result column="create_time" property="createTime" jdbcType="INTEGER" /> |
12 | </resultMap> | 13 | </resultMap> |
13 | <sql id="Base_Column_List" > | 14 | <sql id="Base_Column_List" > |
14 | - id, user_id, help_user_id,help_user_name,help_user_img_url,limit_product_code,create_time | 15 | + id, user_id, help_user_id,help_user_name,help_user_img_url,limit_product_code,is_share,create_time |
15 | </sql> | 16 | </sql> |
16 | 17 | ||
17 | <select id="selectHelpInfo" resultMap="BaseResultMap"> | 18 | <select id="selectHelpInfo" resultMap="BaseResultMap"> |
@@ -29,6 +30,13 @@ | @@ -29,6 +30,13 @@ | ||
29 | ) | 30 | ) |
30 | </insert> | 31 | </insert> |
31 | 32 | ||
33 | + <insert id="addShareInfo" parameterType="com.yoho.activity.dal.model.LimitProductHelpUser"> | ||
34 | + insert into limit_product_help_user (user_id,limit_product_code,is_share,create_time) | ||
35 | + values (#{userId,jdbcType=INTEGER}, #{limitProductCode,jdbcType=VARCHAR}, #{isShare,jdbcType=VARCHAR}, | ||
36 | + #{createTime,jdbcType=INTEGER} | ||
37 | + ) | ||
38 | + </insert> | ||
39 | + | ||
32 | <select id="selectHelpInfoByUidAndCode" resultMap="BaseResultMap"> | 40 | <select id="selectHelpInfoByUidAndCode" resultMap="BaseResultMap"> |
33 | select | 41 | select |
34 | <include refid="Base_Column_List" /> | 42 | <include refid="Base_Column_List" /> |
@@ -3,6 +3,7 @@ package com.yoho.activity.queue.restapi; | @@ -3,6 +3,7 @@ package com.yoho.activity.queue.restapi; | ||
3 | import com.yoho.activity.queue.ApiResponse; | 3 | import com.yoho.activity.queue.ApiResponse; |
4 | import com.yoho.activity.queue.service.IProductLimitUserHelpService; | 4 | import com.yoho.activity.queue.service.IProductLimitUserHelpService; |
5 | import com.yoho.service.model.activity.drawline.request.LimitProductHelpUserRequestBO; | 5 | import com.yoho.service.model.activity.drawline.request.LimitProductHelpUserRequestBO; |
6 | +import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserListBO; | ||
6 | import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserRespBO; | 7 | import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserRespBO; |
7 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
8 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
@@ -35,7 +36,7 @@ public class ProductLimitUserHelpRest { | @@ -35,7 +36,7 @@ public class ProductLimitUserHelpRest { | ||
35 | if(null == limitProductHelpUserRequestBO.getUserId() || null == limitProductHelpUserRequestBO.getLimitProductCode()){ | 36 | if(null == limitProductHelpUserRequestBO.getUserId() || null == limitProductHelpUserRequestBO.getLimitProductCode()){ |
36 | return new ApiResponse.ApiResponseBuilder().code(400).message("用户Id或限定商品Code不可为空").build(); | 37 | return new ApiResponse.ApiResponseBuilder().code(400).message("用户Id或限定商品Code不可为空").build(); |
37 | } | 38 | } |
38 | - List<LimitProductHelpUserRespBO> limitProductHelpUserList = iProductLimitUserHelpService.queryHelpInfo(limitProductHelpUserRequestBO); | 39 | + LimitProductHelpUserListBO limitProductHelpUserList = iProductLimitUserHelpService.queryHelpInfo(limitProductHelpUserRequestBO); |
39 | 40 | ||
40 | return new ApiResponse.ApiResponseBuilder().code(200).data(limitProductHelpUserList).message("获取助力用户信息成功").build(); | 41 | return new ApiResponse.ApiResponseBuilder().code(200).data(limitProductHelpUserList).message("获取助力用户信息成功").build(); |
41 | } | 42 | } |
@@ -58,4 +59,22 @@ public class ProductLimitUserHelpRest { | @@ -58,4 +59,22 @@ public class ProductLimitUserHelpRest { | ||
58 | logger.info("ProductLimitUserHelpRest addHelpUserInfo success"); | 59 | logger.info("ProductLimitUserHelpRest addHelpUserInfo success"); |
59 | return new ApiResponse.ApiResponseBuilder().code(200).message("用户助力成功").build(); | 60 | return new ApiResponse.ApiResponseBuilder().code(200).message("用户助力成功").build(); |
60 | } | 61 | } |
62 | + | ||
63 | + @RequestMapping(params = "method=app.limitProduct.addShareInfo") | ||
64 | + @ResponseBody | ||
65 | + public ApiResponse addShareInfo(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO) { | ||
66 | + logger.info("ProductLimitUserHelpRest addShareInfo params is{}", limitProductHelpUserRequestBO); | ||
67 | + if (null == limitProductHelpUserRequestBO){ | ||
68 | + logger.info("ProductLimitUserHelpRest addShareInfo params can not null"); | ||
69 | + return new ApiResponse.ApiResponseBuilder().code(400).message("入参不可为空").build(); | ||
70 | + } | ||
71 | + if (null == limitProductHelpUserRequestBO.getUserId() || null == limitProductHelpUserRequestBO.getLimitProductCode() || null == limitProductHelpUserRequestBO.getIsShare()){ | ||
72 | + logger.info("ProductLimitUserHelpRest addShareInfo missing params "); | ||
73 | + return new ApiResponse.ApiResponseBuilder().code(400).message("入参不完整,缺少入参").build(); | ||
74 | + } | ||
75 | + | ||
76 | + iProductLimitUserHelpService.addShareInfo(limitProductHelpUserRequestBO); | ||
77 | + logger.info("ProductLimitUserHelpRest addShareInfo success"); | ||
78 | + return new ApiResponse.ApiResponseBuilder().code(200).message("用户增加是否分享信息成功").build(); | ||
79 | + } | ||
61 | } | 80 | } |
1 | package com.yoho.activity.queue.service; | 1 | package com.yoho.activity.queue.service; |
2 | 2 | ||
3 | import com.yoho.service.model.activity.drawline.request.LimitProductHelpUserRequestBO; | 3 | import com.yoho.service.model.activity.drawline.request.LimitProductHelpUserRequestBO; |
4 | +import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserListBO; | ||
4 | import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserRespBO; | 5 | import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserRespBO; |
5 | 6 | ||
6 | import java.util.List; | 7 | import java.util.List; |
@@ -9,9 +10,11 @@ import java.util.List; | @@ -9,9 +10,11 @@ import java.util.List; | ||
9 | * Created by qing.zhao on 2018/6/14. | 10 | * Created by qing.zhao on 2018/6/14. |
10 | */ | 11 | */ |
11 | public interface IProductLimitUserHelpService { | 12 | public interface IProductLimitUserHelpService { |
12 | - List<LimitProductHelpUserRespBO> queryHelpInfo(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO); | 13 | + LimitProductHelpUserListBO queryHelpInfo(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO); |
13 | 14 | ||
14 | void addHelpUserInfo(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO); | 15 | void addHelpUserInfo(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO); |
15 | 16 | ||
16 | Boolean judgeHelpUserExist(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO); | 17 | Boolean judgeHelpUserExist(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO); |
18 | + | ||
19 | + void addShareInfo(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO); | ||
17 | } | 20 | } |
@@ -35,38 +35,44 @@ public class ProductLimitUserHelpServiceImpl implements IProductLimitUserHelpSer | @@ -35,38 +35,44 @@ public class ProductLimitUserHelpServiceImpl implements IProductLimitUserHelpSer | ||
35 | @Autowired | 35 | @Autowired |
36 | private IDrawlineList2MapService drawlineList2MapService; | 36 | private IDrawlineList2MapService drawlineList2MapService; |
37 | @Override | 37 | @Override |
38 | - public List<LimitProductHelpUserRespBO> queryHelpInfo(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO) { | 38 | + public LimitProductHelpUserListBO queryHelpInfo(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO) { |
39 | //先走缓存,缓存没有再走库里捞 | 39 | //先走缓存,缓存没有再走库里捞 |
40 | String redisKeySuffix = limitProductHelpUserRequestBO.getUserId() + ":" + limitProductHelpUserRequestBO.getLimitProductCode(); | 40 | String redisKeySuffix = limitProductHelpUserRequestBO.getUserId() + ":" + limitProductHelpUserRequestBO.getLimitProductCode(); |
41 | LimitProductHelpUserListBO limitProductHelpUserListBO = redisValueCache.get(CacheKeyEnum.LIMIT_USER_HELP_INFO, redisKeySuffix, LimitProductHelpUserListBO.class); | 41 | LimitProductHelpUserListBO limitProductHelpUserListBO = redisValueCache.get(CacheKeyEnum.LIMIT_USER_HELP_INFO, redisKeySuffix, LimitProductHelpUserListBO.class); |
42 | if (null != limitProductHelpUserListBO){ | 42 | if (null != limitProductHelpUserListBO){ |
43 | logger.info("ProductLimitUserHelpServiceImpl :: queryHelpInfo getCache result is{}",limitProductHelpUserListBO); | 43 | logger.info("ProductLimitUserHelpServiceImpl :: queryHelpInfo getCache result is{}",limitProductHelpUserListBO); |
44 | - return limitProductHelpUserListBO.getList(); | 44 | + return limitProductHelpUserListBO; |
45 | } | 45 | } |
46 | List<LimitProductHelpUser> limitProductHelpUserList = productLimitUserHelpMapper.selectHelpInfo(limitProductHelpUserRequestBO.getUserId(),limitProductHelpUserRequestBO.getLimitProductCode()); | 46 | List<LimitProductHelpUser> limitProductHelpUserList = productLimitUserHelpMapper.selectHelpInfo(limitProductHelpUserRequestBO.getUserId(),limitProductHelpUserRequestBO.getLimitProductCode()); |
47 | if (CollectionUtils.isEmpty(limitProductHelpUserList)){ | 47 | if (CollectionUtils.isEmpty(limitProductHelpUserList)){ |
48 | logger.info("ProductLimitUserHelpServiceImpl :: queryHelpInfo result is null"); | 48 | logger.info("ProductLimitUserHelpServiceImpl :: queryHelpInfo result is null"); |
49 | return null; | 49 | return null; |
50 | } | 50 | } |
51 | - List<LimitProductHelpUserRespBO> limitProductHelpUserRespBOList = modelToBo(limitProductHelpUserList); | 51 | + limitProductHelpUserListBO = new LimitProductHelpUserListBO(); |
52 | + List<LimitProductHelpUserRespBO> limitProductHelpUserRespBOList = modelToBo(limitProductHelpUserList,limitProductHelpUserListBO); | ||
52 | //获取用户头像 | 53 | //获取用户头像 |
53 | getUserInfo(limitProductHelpUserRequestBO.getUserId(), limitProductHelpUserRespBOList); | 54 | getUserInfo(limitProductHelpUserRequestBO.getUserId(), limitProductHelpUserRespBOList); |
54 | - limitProductHelpUserListBO = new LimitProductHelpUserListBO(); | ||
55 | limitProductHelpUserListBO.setList(limitProductHelpUserRespBOList); | 55 | limitProductHelpUserListBO.setList(limitProductHelpUserRespBOList); |
56 | redisValueCache.set(CacheKeyEnum.LIMIT_USER_HELP_INFO, redisKeySuffix, limitProductHelpUserListBO, 300, TimeUnit.SECONDS); | 56 | redisValueCache.set(CacheKeyEnum.LIMIT_USER_HELP_INFO, redisKeySuffix, limitProductHelpUserListBO, 300, TimeUnit.SECONDS); |
57 | - return limitProductHelpUserListBO.getList(); | 57 | + return limitProductHelpUserListBO; |
58 | } | 58 | } |
59 | 59 | ||
60 | - private List<LimitProductHelpUserRespBO> modelToBo(List<LimitProductHelpUser> limitProductHelpUserList) { | 60 | + private List<LimitProductHelpUserRespBO> modelToBo(List<LimitProductHelpUser> limitProductHelpUserList,LimitProductHelpUserListBO limitProductHelpUserListBO) { |
61 | List<LimitProductHelpUserRespBO> list = new ArrayList<>(); | 61 | List<LimitProductHelpUserRespBO> list = new ArrayList<>(); |
62 | + limitProductHelpUserListBO.setIsShare("N"); | ||
62 | for (LimitProductHelpUser limitUser : limitProductHelpUserList){ | 63 | for (LimitProductHelpUser limitUser : limitProductHelpUserList){ |
63 | - LimitProductHelpUserRespBO bo = new LimitProductHelpUserRespBO(); | ||
64 | - bo.setUserId(limitUser.getUserId()); | ||
65 | - bo.setHelpUserId(limitUser.getHelpUserId()); | ||
66 | - bo.setHelpUserImgUrl(limitUser.getHelpUserImgUrl()); | ||
67 | - bo.setHelpUserName(limitUser.getHelpUserName()); | ||
68 | - bo.setLimitProductCode(limitUser.getLimitProductCode()); | ||
69 | - list.add(bo); | 64 | + if (null != limitUser && limitUser.getIsShare().equals("N")){ |
65 | + LimitProductHelpUserRespBO bo = new LimitProductHelpUserRespBO(); | ||
66 | + bo.setUserId(limitUser.getUserId()); | ||
67 | + bo.setHelpUserId(limitUser.getHelpUserId()); | ||
68 | + bo.setHelpUserImgUrl(limitUser.getHelpUserImgUrl()); | ||
69 | + bo.setHelpUserName(limitUser.getHelpUserName()); | ||
70 | + bo.setLimitProductCode(limitUser.getLimitProductCode()); | ||
71 | + list.add(bo); | ||
72 | + }else if (null != limitUser && limitUser.getIsShare().equals("Y")){ | ||
73 | + limitProductHelpUserListBO.setIsShare("Y"); | ||
74 | + } | ||
75 | + | ||
70 | } | 76 | } |
71 | return list; | 77 | return list; |
72 | } | 78 | } |
@@ -104,6 +110,19 @@ public class ProductLimitUserHelpServiceImpl implements IProductLimitUserHelpSer | @@ -104,6 +110,19 @@ public class ProductLimitUserHelpServiceImpl implements IProductLimitUserHelpSer | ||
104 | return false; | 110 | return false; |
105 | } | 111 | } |
106 | 112 | ||
113 | + @Override | ||
114 | + public void addShareInfo(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO) { | ||
115 | + LimitProductHelpUser limitProductHelpUser = new LimitProductHelpUser(); | ||
116 | + limitProductHelpUser.setUserId(limitProductHelpUserRequestBO.getUserId()); | ||
117 | + limitProductHelpUser.setLimitProductCode(limitProductHelpUserRequestBO.getLimitProductCode()); | ||
118 | + limitProductHelpUser.setIsShare(limitProductHelpUserRequestBO.getIsShare()); | ||
119 | + limitProductHelpUser.setCreateTime(DateUtils.getCurrentTimeSecond()); | ||
120 | + productLimitUserHelpMapper.addShareInfo(limitProductHelpUser); | ||
121 | + //清除缓存 | ||
122 | + String redisKeySuffix = limitProductHelpUserRequestBO.getUserId() + ":" + limitProductHelpUserRequestBO.getLimitProductCode(); | ||
123 | + redisValueCache.delete(CacheKeyEnum.LIMIT_USER_HELP_INFO, redisKeySuffix); | ||
124 | + } | ||
125 | + | ||
107 | private LimitProductHelpUser converToModel(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO) { | 126 | private LimitProductHelpUser converToModel(LimitProductHelpUserRequestBO limitProductHelpUserRequestBO) { |
108 | LimitProductHelpUser limitProductHelpUser = new LimitProductHelpUser(); | 127 | LimitProductHelpUser limitProductHelpUser = new LimitProductHelpUser(); |
109 | limitProductHelpUser.setUserId(limitProductHelpUserRequestBO.getUserId()); | 128 | limitProductHelpUser.setUserId(limitProductHelpUserRequestBO.getUserId()); |
-
Please register or login to post a comment