Showing
18 changed files
with
223 additions
and
373 deletions
1 | -package com.yoho.ufo.user.dal.inbox.enums; | ||
2 | - | ||
3 | -/** | ||
4 | - * Created by shengguo.cai on 2018/9/12. | ||
5 | - */ | ||
6 | -public enum InboxBusinessTypeEnum { | ||
7 | - USER_WILL_DOWN_GRADE(Integer.valueOf(100), "userWillDownGrade", "您的会员级别即将降级", "您的{0}会员有效期即将到期!还需获得{1}成长值可继续保持!快来选购吧!", "http://img10.static.yhbimg.com/couponImg/2017/01/06/18/01bcf2f47b1f18d34293af4b2a71d9b953.png"), | ||
8 | - USER_DOWN_GRADE(Integer.valueOf(101), "userDownGrade", "您的会员级别降级", "您的{0}等级会员有效期已到期,现会员等级为{1},购物享受{2}折优惠,更多会员权益请点击了解!", "http://img10.static.yhbimg.com/couponImg/2017/01/06/18/01bcf2f47b1f18d34293af4b2a71d9b953.png"); | ||
9 | - private Integer businessType; | ||
10 | - private String beanName; | ||
11 | - private String title; | ||
12 | - private String content; | ||
13 | - private String imgUrl; | ||
14 | - | ||
15 | - | ||
16 | - InboxBusinessTypeEnum(Integer businessType, String beanName, String title, String content, String imgUrl) { | ||
17 | - this.businessType = businessType; | ||
18 | - this.beanName = beanName; | ||
19 | - this.title = title; | ||
20 | - this.content = content; | ||
21 | - this.imgUrl = imgUrl; | ||
22 | - } | ||
23 | - | ||
24 | - public Integer getBusinessType() { | ||
25 | - return businessType; | ||
26 | - } | ||
27 | - | ||
28 | - public void setBusinessType(Integer businessType) { | ||
29 | - this.businessType = businessType; | ||
30 | - } | ||
31 | - | ||
32 | - public String getBeanName() { | ||
33 | - return beanName; | ||
34 | - } | ||
35 | - | ||
36 | - public void setBeanName(String beanName) { | ||
37 | - this.beanName = beanName; | ||
38 | - } | ||
39 | - | ||
40 | - public String getTitle() { | ||
41 | - return title; | ||
42 | - } | ||
43 | - | ||
44 | - public void setTitle(String title) { | ||
45 | - this.title = title; | ||
46 | - } | ||
47 | - | ||
48 | - public String getContent() { | ||
49 | - return content; | ||
50 | - } | ||
51 | - | ||
52 | - public void setContent(String content) { | ||
53 | - this.content = content; | ||
54 | - } | ||
55 | - | ||
56 | - public String getImgUrl() { | ||
57 | - return imgUrl; | ||
58 | - } | ||
59 | - | ||
60 | - public void setImgUrl(String imgUrl) { | ||
61 | - this.imgUrl = imgUrl; | ||
62 | - } | ||
63 | - | ||
64 | - public static String getBeanNameByBusinessType(int businessType) { | ||
65 | - if(businessType == 0) { | ||
66 | - return ""; | ||
67 | - } | ||
68 | - InboxBusinessTypeEnum[] var1 = values(); | ||
69 | - int var2 = var1.length; | ||
70 | - for(int var3 = 0; var3 < var2; ++var3) { | ||
71 | - InboxBusinessTypeEnum b = var1[var3]; | ||
72 | - if(b.getBusinessType().intValue() == businessType) { | ||
73 | - return b.getBeanName(); | ||
74 | - } | ||
75 | - } | ||
76 | - return ""; | ||
77 | - } | ||
78 | -} |
1 | -package com.yoho.ufo.user.dal.inbox; | 1 | +package com.yohoufo.user.dal; |
2 | 2 | ||
3 | -import com.yoho.ufo.user.dal.inbox.model.InBox; | ||
4 | -import com.yoho.ufo.user.dal.inbox.model.TypeCountInbox; | 3 | +import com.yohoufo.user.dal.model.InBox; |
4 | +import com.yohoufo.user.dal.model.TypeCountInbox; | ||
5 | import org.apache.ibatis.annotations.MapKey; | 5 | import org.apache.ibatis.annotations.MapKey; |
6 | import org.apache.ibatis.annotations.Param; | 6 | import org.apache.ibatis.annotations.Param; |
7 | 7 |
1 | +package com.yohoufo.user.dal.enums; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by shengguo.cai on 2018/9/12. | ||
5 | + */ | ||
6 | +public enum InboxBusinessTypeEnum { | ||
7 | + PURCHASE_UNPAID(0,0, "未付款提醒", "请尽快完成订单支付"), | ||
8 | + PURCHASE_NOTIFIED_SELLER(0,1, "已通知卖家发货", "已通知卖家发货,请耐心等待"), | ||
9 | + PURCHASE_SENDED(0,2, "平台已发货", "平台已发货,请查看物流详情"), | ||
10 | + PURCHASE_CLOSED_SELLER(0,3, "交易关闭", "卖家取消:卖家取消商品出售,你已获得卖补偿款,请至有货账户查收"), | ||
11 | + PURCHASE_CLOSED_BUYER(0,4, "交易关闭", "买家取消:您已取消商品购买"), | ||
12 | + PURCHASE_CLOSED_PLATFORM(0,5, "交易关闭", "鉴定不通过:您购买的商品鉴定未通过,你已获得卖补偿款,请至有货账户查收"), | ||
13 | + SALE_SHELF(1,0, "上架成功", "商品上架成功"), | ||
14 | + SALE_UNSHELF(1,1, "下架成功", "商品下架成功"), | ||
15 | + SALE_SELLED(1,2, "商品售出提醒", "你的商品已被下单,请关注发货提醒"), | ||
16 | + SALE_SEND(1,3, "发货提醒", "买家已付款,请尽快完成发货,否则会扣除部分保证金"), | ||
17 | + SALE_CLOSED_SELLER(1,4, "交易关闭", "卖家取消:您已取消商品出售,您支付的保证金作已为补偿赔付给买家"), | ||
18 | + SALE_CLOSED_BUYER(1,5, "交易关闭", "买家取消:买家取消订单,您的商品已重新上架出售"), | ||
19 | + SALE_CLOSED_PLATFORM(1,6, "交易关闭", "鉴定不通过:您出售的商品鉴定未通过,商品已寄回您提供的守护地址,您支付的保证金已作为补偿赔付给买家"), | ||
20 | + SALE_NOTIFIED_UNSHELF(1,7, "商品下架提醒", "因为特殊原因,商品不能售卖,您支付的保证金已退回,请至有货账户查收"), | ||
21 | + SYSTEM_NEWUSER(2,0, "新用户引导", "欢迎使用UFO,详情使用说明请点击"), | ||
22 | + SYSTEM_VERIFED(2,1, "实名认证提醒", "请尽快完成实名认证,详情请点击"), | ||
23 | + SYSTEM_BINDBANK(2,2, "绑定银行卡提醒", "请尽快绑定银行卡,详情请点击"), | ||
24 | + SMS_SEND(3,0, "发货提醒", "买家已付款,请尽快完成发货,否则会扣除部分保证金"); | ||
25 | + | ||
26 | + private Integer businessType; | ||
27 | + private String title; | ||
28 | + private String content; | ||
29 | + private Integer type; | ||
30 | + | ||
31 | + InboxBusinessTypeEnum(Integer type, Integer businessType, String title, String content) { | ||
32 | + this.businessType = businessType; | ||
33 | + this.title = title; | ||
34 | + this.content = content; | ||
35 | + this.type = type; | ||
36 | + } | ||
37 | + | ||
38 | + public Integer getType() { | ||
39 | + return type; | ||
40 | + } | ||
41 | + | ||
42 | + public void setType(Integer type) { | ||
43 | + this.type = type; | ||
44 | + } | ||
45 | + | ||
46 | + public Integer getBusinessType() { | ||
47 | + return businessType; | ||
48 | + } | ||
49 | + | ||
50 | + public void setBusinessType(Integer businessType) { | ||
51 | + this.businessType = businessType; | ||
52 | + } | ||
53 | + | ||
54 | + public String getTitle() { | ||
55 | + return title; | ||
56 | + } | ||
57 | + | ||
58 | + public void setTitle(String title) { | ||
59 | + this.title = title; | ||
60 | + } | ||
61 | + | ||
62 | + public String getContent() { | ||
63 | + return content; | ||
64 | + } | ||
65 | + | ||
66 | + public void setContent(String content) { | ||
67 | + this.content = content; | ||
68 | + } | ||
69 | + | ||
70 | +} |
1 | -package com.yoho.ufo.user.dal.inbox.model; | ||
2 | - | ||
3 | -import java.util.List; | 1 | +package com.yohoufo.user.dal.model; |
4 | 2 | ||
5 | /** | 3 | /** |
6 | * Created by shengguo.cai on 2018/9/11. | 4 | * Created by shengguo.cai on 2018/9/11. |
@@ -34,8 +32,6 @@ public class InBox { | @@ -34,8 +32,6 @@ public class InBox { | ||
34 | 32 | ||
35 | private String tableName; | 33 | private String tableName; |
36 | 34 | ||
37 | - private List<Integer> ids; | ||
38 | - | ||
39 | private Integer businessType; | 35 | private Integer businessType; |
40 | 36 | ||
41 | private Integer groupType; | 37 | private Integer groupType; |
@@ -136,14 +132,6 @@ public class InBox { | @@ -136,14 +132,6 @@ public class InBox { | ||
136 | this.tableName = tableName; | 132 | this.tableName = tableName; |
137 | } | 133 | } |
138 | 134 | ||
139 | - public List<Integer> getIds() { | ||
140 | - return ids; | ||
141 | - } | ||
142 | - | ||
143 | - public void setIds(List<Integer> ids) { | ||
144 | - this.ids = ids; | ||
145 | - } | ||
146 | - | ||
147 | public Integer getBusinessType() { | 135 | public Integer getBusinessType() { |
148 | return businessType; | 136 | return businessType; |
149 | } | 137 | } |
1 | <?xml version="1.0" encoding="UTF-8" ?> | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
3 | -<mapper namespace="com.yoho.ufo.user.dal.inbox.InBoxMapper"> | ||
4 | - <resultMap id="BaseResultMap" type="com.yoho.ufo.user.dal.inbox.model.InBox"> | 3 | +<mapper namespace="com.yohoufo.user.dal.InBoxMapper"> |
4 | + <resultMap id="BaseResultMap" type="com.yohoufo.user.dal.model.InBox"> | ||
5 | <id column="id" property="id" jdbcType="INTEGER"/> | 5 | <id column="id" property="id" jdbcType="INTEGER"/> |
6 | <result column="uid" property="uid" jdbcType="INTEGER"/> | 6 | <result column="uid" property="uid" jdbcType="INTEGER"/> |
7 | <result column="send_uid" property="sendUid" jdbcType="INTEGER"/> | 7 | <result column="send_uid" property="sendUid" jdbcType="INTEGER"/> |
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | <result column="business_type" property="businessType" jdbcType="INTEGER" /> | 16 | <result column="business_type" property="businessType" jdbcType="INTEGER" /> |
17 | <result column="group_type" property="groupType" jdbcType="INTEGER"/> | 17 | <result column="group_type" property="groupType" jdbcType="INTEGER"/> |
18 | </resultMap> | 18 | </resultMap> |
19 | - <resultMap id="TypeCountInboxMap" type="com.yoho.ufo.user.dal.inbox.model.TypeCountInbox"> | 19 | + <resultMap id="TypeCountInboxMap" type="com.yohoufo.user.dal.model.TypeCountInbox"> |
20 | <result column="type" property="type" jdbcType="INTEGER"/> | 20 | <result column="type" property="type" jdbcType="INTEGER"/> |
21 | <result column="count" property="count" jdbcType="INTEGER"/> | 21 | <result column="count" property="count" jdbcType="INTEGER"/> |
22 | </resultMap> | 22 | </resultMap> |
@@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
39 | SELECT type, count(1) count FROM #{tableName} WHERE uid = #{uid} | 39 | SELECT type, count(1) count FROM #{tableName} WHERE uid = #{uid} |
40 | and is_read = #{isRead} and is_del = #{isDel} GROUP BY type | 40 | and is_read = #{isRead} and is_del = #{isDel} GROUP BY type |
41 | </select> | 41 | </select> |
42 | - <select id="selectNewInboxs" resultType="com.yoho.ufo.user.dal.inbox.model.InBox"> | 42 | + <select id="selectNewInboxs" resultType="com.yohoufo.user.dal.model.InBox"> |
43 | SELECT | 43 | SELECT |
44 | <include refid="Base_Column_List"/> | 44 | <include refid="Base_Column_List"/> |
45 | FROM #{tableName} where uid = #{uid} and is_read='N' and is_del='N' | 45 | FROM #{tableName} where uid = #{uid} and is_read='N' and is_del='N' |
1 | -package com.yoho.ufo.user.responseVO; | ||
2 | - | ||
3 | -/** | ||
4 | - * Created by shengguo.cai on 2018/9/12. | ||
5 | - */ | ||
6 | -public class InboxDetailRespVO { | ||
7 | - private int id; | ||
8 | - private int uid; | ||
9 | - private String from = "有货"; | ||
10 | - private String title; | ||
11 | - private Object body; | ||
12 | - private String type; | ||
13 | - private String is_read; | ||
14 | - private long create_time; | ||
15 | - private String create_date; | ||
16 | - private String content; | ||
17 | - private Integer businessType; | ||
18 | - private String pcLink; | ||
19 | - private String appLink; | ||
20 | - | ||
21 | - public int getId() { | ||
22 | - return id; | ||
23 | - } | ||
24 | - | ||
25 | - public void setId(int id) { | ||
26 | - this.id = id; | ||
27 | - } | ||
28 | - | ||
29 | - public int getUid() { | ||
30 | - return uid; | ||
31 | - } | ||
32 | - | ||
33 | - public void setUid(int uid) { | ||
34 | - this.uid = uid; | ||
35 | - } | ||
36 | - | ||
37 | - public String getFrom() { | ||
38 | - return from; | ||
39 | - } | ||
40 | - | ||
41 | - public void setFrom(String from) { | ||
42 | - this.from = from; | ||
43 | - } | ||
44 | - | ||
45 | - public String getTitle() { | ||
46 | - return title; | ||
47 | - } | ||
48 | - | ||
49 | - public void setTitle(String title) { | ||
50 | - this.title = title; | ||
51 | - } | ||
52 | - | ||
53 | - public Object getBody() { | ||
54 | - return body; | ||
55 | - } | ||
56 | - | ||
57 | - public void setBody(Object body) { | ||
58 | - this.body = body; | ||
59 | - } | ||
60 | - | ||
61 | - public String getType() { | ||
62 | - return type; | ||
63 | - } | ||
64 | - | ||
65 | - public void setType(String type) { | ||
66 | - this.type = type; | ||
67 | - } | ||
68 | - | ||
69 | - public String getIs_read() { | ||
70 | - return is_read; | ||
71 | - } | ||
72 | - | ||
73 | - public void setIs_read(String is_read) { | ||
74 | - this.is_read = is_read; | ||
75 | - } | ||
76 | - | ||
77 | - public long getCreate_time() { | ||
78 | - return create_time; | ||
79 | - } | ||
80 | - | ||
81 | - public void setCreate_time(long create_time) { | ||
82 | - this.create_time = create_time; | ||
83 | - } | ||
84 | - | ||
85 | - public String getCreate_date() { | ||
86 | - return create_date; | ||
87 | - } | ||
88 | - | ||
89 | - public void setCreate_date(String create_date) { | ||
90 | - this.create_date = create_date; | ||
91 | - } | ||
92 | - | ||
93 | - public String getContent() { | ||
94 | - return content; | ||
95 | - } | ||
96 | - | ||
97 | - public void setContent(String content) { | ||
98 | - this.content = content; | ||
99 | - } | ||
100 | - | ||
101 | - public Integer getBusinessType() { | ||
102 | - return businessType; | ||
103 | - } | ||
104 | - | ||
105 | - public void setBusinessType(Integer businessType) { | ||
106 | - this.businessType = businessType; | ||
107 | - } | ||
108 | - | ||
109 | - public String getPcLink() { | ||
110 | - return pcLink; | ||
111 | - } | ||
112 | - | ||
113 | - public void setPcLink(String pcLink) { | ||
114 | - this.pcLink = pcLink; | ||
115 | - } | ||
116 | - | ||
117 | - public String getAppLink() { | ||
118 | - return appLink; | ||
119 | - } | ||
120 | - | ||
121 | - public void setAppLink(String appLink) { | ||
122 | - this.appLink = appLink; | ||
123 | - } | ||
124 | -} |
1 | -package com.yoho.ufo.user.controller.inbox; | 1 | +package com.yohoufo.user.controller.inbox; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
4 | import com.yoho.core.common.restbean.ResponseBean; | 4 | import com.yoho.core.common.restbean.ResponseBean; |
5 | import com.yoho.error.ServiceError; | 5 | import com.yoho.error.ServiceError; |
6 | import com.yoho.error.exception.ServiceException; | 6 | import com.yoho.error.exception.ServiceException; |
7 | -import com.yoho.ufo.user.requestVO.InboxReqVO; | ||
8 | -import com.yoho.ufo.user.requestVO.ListInboxTypeInfoReqVO; | ||
9 | -import com.yoho.ufo.user.requestVO.ListNewInboxReqVO; | ||
10 | -import com.yoho.ufo.user.responseVO.InboxDetailRespVO; | ||
11 | -import com.yoho.ufo.user.responseVO.PageResponseVO; | ||
12 | -import com.yoho.ufo.user.service.IInBoxService; | 7 | +import com.yohoufo.user.dal.model.InBox; |
8 | +import com.yohoufo.user.requestVO.InboxReqVO; | ||
9 | +import com.yohoufo.user.requestVO.ListInboxTypeInfoReqVO; | ||
10 | +import com.yohoufo.user.requestVO.ListNewInboxReqVO; | ||
11 | +import com.yohoufo.user.requestVO.UpdateReadedReqVO; | ||
12 | +import com.yohoufo.user.responseVO.PageResponseVO; | ||
13 | +import com.yohoufo.user.service.IInBoxService; | ||
13 | import org.slf4j.Logger; | 14 | import org.slf4j.Logger; |
14 | import org.slf4j.LoggerFactory; | 15 | import org.slf4j.LoggerFactory; |
15 | import org.springframework.web.bind.annotation.RequestBody; | 16 | import org.springframework.web.bind.annotation.RequestBody; |
@@ -61,7 +62,7 @@ public class InBoxController { | @@ -61,7 +62,7 @@ public class InBoxController { | ||
61 | public ResponseBean listNewInboxs(@RequestBody ListNewInboxReqVO reqVO){ | 62 | public ResponseBean listNewInboxs(@RequestBody ListNewInboxReqVO reqVO){ |
62 | logger.info("enter listNewInboxByTypes param is {}", reqVO); | 63 | logger.info("enter listNewInboxByTypes param is {}", reqVO); |
63 | ResponseBean responseBean = new ResponseBean(); | 64 | ResponseBean responseBean = new ResponseBean(); |
64 | - PageResponseVO<InboxDetailRespVO> pageList = inBoxService.listNewInboxByTypes(reqVO); | 65 | + PageResponseVO<InBox> pageList = inBoxService.listNewInboxByTypes(reqVO); |
65 | responseBean.setCode("200"); | 66 | responseBean.setCode("200"); |
66 | responseBean.setMessage("success"); | 67 | responseBean.setMessage("success"); |
67 | responseBean.setData(pageList); | 68 | responseBean.setData(pageList); |
@@ -83,15 +84,17 @@ public class InBoxController { | @@ -83,15 +84,17 @@ public class InBoxController { | ||
83 | } | 84 | } |
84 | 85 | ||
85 | /** | 86 | /** |
86 | - * 删除消息 | 87 | + * 将某类型下的未读消息更新为已读 |
88 | + * @param reqVO | ||
89 | + * @return | ||
87 | */ | 90 | */ |
88 | - @RequestMapping("/delInbox") | ||
89 | - public ResponseBean delInbox(@RequestBody InboxReqVO reqVO){ | ||
90 | - logger.info("addInbox with param is {}", reqVO); | ||
91 | - inBoxService.addInbox(reqVO); | 91 | + @RequestMapping("/updateReadedByType") |
92 | + public ResponseBean updateReadedByType(@RequestBody UpdateReadedReqVO reqVO){ | ||
93 | + logger.info("updateReadedByType with param is {}", reqVO); | ||
94 | + inBoxService.updateReadedByType(reqVO); | ||
92 | ResponseBean responseBean = new ResponseBean(); | 95 | ResponseBean responseBean = new ResponseBean(); |
93 | responseBean.setCode("200"); | 96 | responseBean.setCode("200"); |
94 | - responseBean.setMessage("保存成功"); | 97 | + responseBean.setMessage("更新成功"); |
95 | return responseBean; | 98 | return responseBean; |
96 | } | 99 | } |
97 | } | 100 | } |
1 | +package com.yohoufo.user.requestVO; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by shengguo.cai on 2018/9/12. | ||
5 | + */ | ||
6 | +public class InboxReqVO { | ||
7 | + private int uid; | ||
8 | + private String type; | ||
9 | + private Integer businessType; | ||
10 | + | ||
11 | + public int getUid() { | ||
12 | + return uid; | ||
13 | + } | ||
14 | + | ||
15 | + public void setUid(int uid) { | ||
16 | + this.uid = uid; | ||
17 | + } | ||
18 | + | ||
19 | + public String getType() { | ||
20 | + return type; | ||
21 | + } | ||
22 | + | ||
23 | + public void setType(String type) { | ||
24 | + this.type = type; | ||
25 | + } | ||
26 | + | ||
27 | + public Integer getBusinessType() { | ||
28 | + return businessType; | ||
29 | + } | ||
30 | + | ||
31 | + public void setBusinessType(Integer businessType) { | ||
32 | + this.businessType = businessType; | ||
33 | + } | ||
34 | +} |
1 | -package com.yoho.ufo.user.requestVO; | 1 | +package com.yohoufo.user.requestVO; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Created by shengguo.cai on 2018/9/12. | 4 | * Created by shengguo.cai on 2018/9/12. |
@@ -12,7 +12,7 @@ public class PageReqVO { | @@ -12,7 +12,7 @@ public class PageReqVO { | ||
12 | } | 12 | } |
13 | 13 | ||
14 | public void setLimit(int limit) { | 14 | public void setLimit(int limit) { |
15 | - this.limit = limit<1 ? 1 : limit; | 15 | + this.limit = limit<10 ? 1 : limit; |
16 | } | 16 | } |
17 | 17 | ||
18 | public int getPage() { | 18 | public int getPage() { |
1 | +package com.yohoufo.user.requestVO; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by shengguo.cai on 2018/9/13. | ||
5 | + */ | ||
6 | +public class UpdateReadedReqVO { | ||
7 | + private int uid; | ||
8 | + private int type; | ||
9 | + | ||
10 | + public int getUid() { | ||
11 | + return uid; | ||
12 | + } | ||
13 | + | ||
14 | + public void setUid(int uid) { | ||
15 | + this.uid = uid; | ||
16 | + } | ||
17 | + | ||
18 | + public int getType() { | ||
19 | + return type; | ||
20 | + } | ||
21 | + | ||
22 | + public void setType(int type) { | ||
23 | + this.type = type; | ||
24 | + } | ||
25 | +} |
1 | -package com.yoho.ufo.user.requestVO; | 1 | +package com.yohoufo.user.responseVO; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Created by shengguo.cai on 2018/9/12. | 4 | * Created by shengguo.cai on 2018/9/12. |
5 | */ | 5 | */ |
6 | -public class InboxReqVO { | 6 | +public class InboxDetailRespVO { |
7 | + private int id; | ||
7 | private int uid; | 8 | private int uid; |
8 | - private String couponName; | ||
9 | - private String client_type; | ||
10 | - private String app_version; | ||
11 | - private String isRead; | ||
12 | private String title; | 9 | private String title; |
13 | - private String content; | ||
14 | private String type; | 10 | private String type; |
15 | - private Integer verifyKey; | ||
16 | - private Integer sendUid; | ||
17 | - private Integer businessType=400; | ||
18 | - | ||
19 | - public int getUid() { | ||
20 | - return uid; | ||
21 | - } | ||
22 | - | ||
23 | - public void setUid(int uid) { | ||
24 | - this.uid = uid; | ||
25 | - } | 11 | + private String isRead; |
12 | + private int createTime; | ||
13 | + private String content; | ||
14 | + private Integer businessType; | ||
26 | 15 | ||
27 | - public String getCouponName() { | ||
28 | - return couponName; | 16 | + public String getIsRead() { |
17 | + return isRead; | ||
29 | } | 18 | } |
30 | 19 | ||
31 | - public void setCouponName(String couponName) { | ||
32 | - this.couponName = couponName; | 20 | + public void setIsRead(String isRead) { |
21 | + this.isRead = isRead; | ||
33 | } | 22 | } |
34 | 23 | ||
35 | - public String getClient_type() { | ||
36 | - return client_type; | 24 | + public int getCreateTime() { |
25 | + return createTime; | ||
37 | } | 26 | } |
38 | 27 | ||
39 | - public void setClient_type(String client_type) { | ||
40 | - this.client_type = client_type; | 28 | + public void setCreateTime(int createTime) { |
29 | + this.createTime = createTime; | ||
41 | } | 30 | } |
42 | 31 | ||
43 | - public String getApp_version() { | ||
44 | - return app_version; | 32 | + public int getId() { |
33 | + return id; | ||
45 | } | 34 | } |
46 | 35 | ||
47 | - public void setApp_version(String app_version) { | ||
48 | - this.app_version = app_version; | 36 | + public void setId(int id) { |
37 | + this.id = id; | ||
49 | } | 38 | } |
50 | 39 | ||
51 | - public String getIsRead() { | ||
52 | - return isRead; | 40 | + public int getUid() { |
41 | + return uid; | ||
53 | } | 42 | } |
54 | 43 | ||
55 | - public void setIsRead(String isRead) { | ||
56 | - this.isRead = isRead; | 44 | + public void setUid(int uid) { |
45 | + this.uid = uid; | ||
57 | } | 46 | } |
58 | 47 | ||
59 | public String getTitle() { | 48 | public String getTitle() { |
@@ -64,14 +53,6 @@ public class InboxReqVO { | @@ -64,14 +53,6 @@ public class InboxReqVO { | ||
64 | this.title = title; | 53 | this.title = title; |
65 | } | 54 | } |
66 | 55 | ||
67 | - public String getContent() { | ||
68 | - return content; | ||
69 | - } | ||
70 | - | ||
71 | - public void setContent(String content) { | ||
72 | - this.content = content; | ||
73 | - } | ||
74 | - | ||
75 | public String getType() { | 56 | public String getType() { |
76 | return type; | 57 | return type; |
77 | } | 58 | } |
@@ -80,20 +61,12 @@ public class InboxReqVO { | @@ -80,20 +61,12 @@ public class InboxReqVO { | ||
80 | this.type = type; | 61 | this.type = type; |
81 | } | 62 | } |
82 | 63 | ||
83 | - public Integer getVerifyKey() { | ||
84 | - return verifyKey; | ||
85 | - } | ||
86 | - | ||
87 | - public void setVerifyKey(Integer verifyKey) { | ||
88 | - this.verifyKey = verifyKey; | ||
89 | - } | ||
90 | - | ||
91 | - public Integer getSendUid() { | ||
92 | - return sendUid; | 64 | + public String getContent() { |
65 | + return content; | ||
93 | } | 66 | } |
94 | 67 | ||
95 | - public void setSendUid(Integer sendUid) { | ||
96 | - this.sendUid = sendUid; | 68 | + public void setContent(String content) { |
69 | + this.content = content; | ||
97 | } | 70 | } |
98 | 71 | ||
99 | public Integer getBusinessType() { | 72 | public Integer getBusinessType() { |
@@ -103,4 +76,5 @@ public class InboxReqVO { | @@ -103,4 +76,5 @@ public class InboxReqVO { | ||
103 | public void setBusinessType(Integer businessType) { | 76 | public void setBusinessType(Integer businessType) { |
104 | this.businessType = businessType; | 77 | this.businessType = businessType; |
105 | } | 78 | } |
79 | + | ||
106 | } | 80 | } |
1 | -package com.yoho.ufo.user.service; | 1 | +package com.yohoufo.user.service; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
4 | -import com.yoho.ufo.user.requestVO.InboxReqVO; | ||
5 | -import com.yoho.ufo.user.requestVO.ListInboxTypeInfoReqVO; | ||
6 | -import com.yoho.ufo.user.requestVO.ListNewInboxReqVO; | ||
7 | -import com.yoho.ufo.user.responseVO.InboxDetailRespVO; | ||
8 | -import com.yoho.ufo.user.responseVO.PageResponseVO; | 4 | +import com.yohoufo.user.dal.model.InBox; |
5 | +import com.yohoufo.user.requestVO.InboxReqVO; | ||
6 | +import com.yohoufo.user.requestVO.ListInboxTypeInfoReqVO; | ||
7 | +import com.yohoufo.user.requestVO.ListNewInboxReqVO; | ||
8 | +import com.yohoufo.user.requestVO.UpdateReadedReqVO; | ||
9 | +import com.yohoufo.user.responseVO.PageResponseVO; | ||
9 | 10 | ||
10 | /** | 11 | /** |
11 | * Created by shengguo.cai on 2018/9/11. | 12 | * Created by shengguo.cai on 2018/9/11. |
@@ -18,7 +19,9 @@ public interface IInBoxService { | @@ -18,7 +19,9 @@ public interface IInBoxService { | ||
18 | */ | 19 | */ |
19 | JSONArray listInboxTypeInfo(ListInboxTypeInfoReqVO reqBO); | 20 | JSONArray listInboxTypeInfo(ListInboxTypeInfoReqVO reqBO); |
20 | 21 | ||
21 | - PageResponseVO<InboxDetailRespVO> listNewInboxByTypes(ListNewInboxReqVO reqVO); | 22 | + PageResponseVO<InBox> listNewInboxByTypes(ListNewInboxReqVO reqVO); |
22 | 23 | ||
23 | void addInbox(InboxReqVO reqVO); | 24 | void addInbox(InboxReqVO reqVO); |
25 | + | ||
26 | + void updateReadedByType(UpdateReadedReqVO reqVO); | ||
24 | } | 27 | } |
1 | -package com.yoho.ufo.user.service.impl; | 1 | +package com.yohoufo.user.service.impl; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
5 | import com.yoho.core.common.utils.DateUtil; | 5 | import com.yoho.core.common.utils.DateUtil; |
6 | import com.yoho.error.ServiceError; | 6 | import com.yoho.error.ServiceError; |
7 | import com.yoho.error.exception.ServiceException; | 7 | import com.yoho.error.exception.ServiceException; |
8 | -import com.yoho.ufo.user.dal.inbox.InBoxMapper; | ||
9 | -import com.yoho.ufo.user.dal.inbox.enums.InboxTypeEnum; | ||
10 | -import com.yoho.ufo.user.dal.inbox.model.InBox; | ||
11 | -import com.yoho.ufo.user.dal.inbox.model.TypeCountInbox; | ||
12 | -import com.yoho.ufo.user.requestVO.InboxReqVO; | ||
13 | -import com.yoho.ufo.user.requestVO.ListInboxTypeInfoReqVO; | ||
14 | -import com.yoho.ufo.user.requestVO.ListNewInboxReqVO; | ||
15 | -import com.yoho.ufo.user.responseVO.InboxDetailRespVO; | ||
16 | -import com.yoho.ufo.user.responseVO.PageResponseVO; | ||
17 | -import com.yoho.ufo.user.service.IInBoxService; | 8 | +import com.yohoufo.user.dal.InBoxMapper; |
9 | +import com.yohoufo.user.dal.enums.InboxTypeEnum; | ||
10 | +import com.yohoufo.user.dal.model.InBox; | ||
11 | +import com.yohoufo.user.dal.model.TypeCountInbox; | ||
12 | +import com.yohoufo.user.requestVO.InboxReqVO; | ||
13 | +import com.yohoufo.user.requestVO.ListInboxTypeInfoReqVO; | ||
14 | +import com.yohoufo.user.requestVO.ListNewInboxReqVO; | ||
15 | +import com.yohoufo.user.requestVO.UpdateReadedReqVO; | ||
16 | +import com.yohoufo.user.responseVO.PageResponseVO; | ||
17 | +import com.yohoufo.user.service.IInBoxService; | ||
18 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
19 | import org.slf4j.LoggerFactory; | 19 | import org.slf4j.LoggerFactory; |
20 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
21 | import org.springframework.stereotype.Service; | 21 | import org.springframework.stereotype.Service; |
22 | 22 | ||
23 | -import java.util.ArrayList; | ||
24 | -import java.util.Date; | ||
25 | import java.util.List; | 23 | import java.util.List; |
26 | import java.util.Map; | 24 | import java.util.Map; |
27 | 25 | ||
@@ -42,8 +40,8 @@ public class InBoxServiceImpl implements IInBoxService { | @@ -42,8 +40,8 @@ public class InBoxServiceImpl implements IInBoxService { | ||
42 | JSONArray result = new JSONArray(); | 40 | JSONArray result = new JSONArray(); |
43 | for(InboxTypeEnum typeEnum : InboxTypeEnum.values()) { | 41 | for(InboxTypeEnum typeEnum : InboxTypeEnum.values()) { |
44 | JSONObject obj = new JSONObject(); | 42 | JSONObject obj = new JSONObject(); |
45 | - obj.put("id", typeEnum.getId()); | ||
46 | - obj.put("img_url", typeEnum.getImgUrl()); | 43 | + obj.put("type", typeEnum.getId()); |
44 | + obj.put("imgUrl", typeEnum.getImgUrl()); | ||
47 | obj.put("description", typeEnum.getDescription()); | 45 | obj.put("description", typeEnum.getDescription()); |
48 | obj.put("unReadCount", typeCountMap.containsKey(typeEnum.getId()) ? typeCountMap.get(typeEnum.getId()) : 0); | 46 | obj.put("unReadCount", typeCountMap.containsKey(typeEnum.getId()) ? typeCountMap.get(typeEnum.getId()) : 0); |
49 | result.add(obj); | 47 | result.add(obj); |
@@ -52,14 +50,14 @@ public class InBoxServiceImpl implements IInBoxService { | @@ -52,14 +50,14 @@ public class InBoxServiceImpl implements IInBoxService { | ||
52 | } | 50 | } |
53 | 51 | ||
54 | @Override | 52 | @Override |
55 | - public PageResponseVO<InboxDetailRespVO> listNewInboxByTypes(ListNewInboxReqVO reqVO) { | 53 | + public PageResponseVO<InBox> listNewInboxByTypes(ListNewInboxReqVO reqVO) { |
56 | log.info("entre listNewInboxByTypes with param is {}", reqVO); | 54 | log.info("entre listNewInboxByTypes with param is {}", reqVO); |
57 | //判断为空 | 55 | //判断为空 |
58 | if (reqVO.getUid() <= 0) { | 56 | if (reqVO.getUid() <= 0) { |
59 | log.warn("listNewInboxByTypes error because uid is null with param is {}", reqVO); | 57 | log.warn("listNewInboxByTypes error because uid is null with param is {}", reqVO); |
60 | throw new ServiceException(ServiceError.SMS_INBOX_UID_NULL); | 58 | throw new ServiceException(ServiceError.SMS_INBOX_UID_NULL); |
61 | } | 59 | } |
62 | - PageResponseVO<InboxDetailRespVO> response = new PageResponseVO<>(); | 60 | + PageResponseVO<InBox> response = new PageResponseVO<>(); |
63 | 61 | ||
64 | int total = inBoxMapper.selectTotalNewInboxs(getTableName(reqVO.getUid()),reqVO.getType(), | 62 | int total = inBoxMapper.selectTotalNewInboxs(getTableName(reqVO.getUid()),reqVO.getType(), |
65 | reqVO.getUid()); | 63 | reqVO.getUid()); |
@@ -69,15 +67,10 @@ public class InBoxServiceImpl implements IInBoxService { | @@ -69,15 +67,10 @@ public class InBoxServiceImpl implements IInBoxService { | ||
69 | response.setTotal(0); | 67 | response.setTotal(0); |
70 | return response; | 68 | return response; |
71 | } | 69 | } |
72 | - List<InBox> list = inBoxMapper.selectNewInboxs(getTableName(reqVO.getUid()),reqVO.getType(), | 70 | + List<InBox> inBoxes = inBoxMapper.selectNewInboxs(getTableName(reqVO.getUid()),reqVO.getType(), |
73 | reqVO.getUid(),reqVO.getRowNo(),reqVO.getLimit()); | 71 | reqVO.getUid(),reqVO.getRowNo(),reqVO.getLimit()); |
74 | - List<InboxDetailRespVO> inboxDetailRespVOList = initInboxDetails(list); | ||
75 | - // 将当前分类下用户所有的未读消息置为已读 | ||
76 | - if(null!=reqVO.getType()){ | ||
77 | - inBoxMapper.updateReadedByUidAndType(getTableName(reqVO.getUid()),reqVO.getUid(),reqVO.getType(),DateUtil.getCurrentTimeSecond()); | ||
78 | - } | ||
79 | 72 | ||
80 | - response.setList(inboxDetailRespVOList); | 73 | + response.setList(inBoxes); |
81 | response.setPage(reqVO.getPage()); | 74 | response.setPage(reqVO.getPage()); |
82 | response.setSize(reqVO.getLimit()); | 75 | response.setSize(reqVO.getLimit()); |
83 | response.setTotal(total); | 76 | response.setTotal(total); |
@@ -88,8 +81,7 @@ public class InBoxServiceImpl implements IInBoxService { | @@ -88,8 +81,7 @@ public class InBoxServiceImpl implements IInBoxService { | ||
88 | public void addInbox(InboxReqVO reqVO) { | 81 | public void addInbox(InboxReqVO reqVO) { |
89 | InBox inBox = new InBox(); | 82 | InBox inBox = new InBox(); |
90 | inBox.setUid(reqVO.getUid()); | 83 | inBox.setUid(reqVO.getUid()); |
91 | - inBox.setSendUid(reqVO.getSendUid()); | ||
92 | - inBox.setType(reqVO.getBusinessType() / 100); | 84 | + inBox.setType(reqVO.getBusinessType()); |
93 | inBox.setIsRead("N"); | 85 | inBox.setIsRead("N"); |
94 | inBox.setIsDel("N"); | 86 | inBox.setIsDel("N"); |
95 | inBox.setTitle(reqVO.getTitle()); | 87 | inBox.setTitle(reqVO.getTitle()); |
@@ -100,50 +92,13 @@ public class InBoxServiceImpl implements IInBoxService { | @@ -100,50 +92,13 @@ public class InBoxServiceImpl implements IInBoxService { | ||
100 | inBoxMapper.insertInbox(getTableName(inBox.getUid()),inBox); | 92 | inBoxMapper.insertInbox(getTableName(inBox.getUid()),inBox); |
101 | } | 93 | } |
102 | 94 | ||
103 | - private List<InboxDetailRespVO> initInboxDetails(List<InBox> inBoxList){ | ||
104 | - List<InboxDetailRespVO> inboxDetailRespVOList = new ArrayList<>(); | ||
105 | - InboxDetailRespVO resp = null; | ||
106 | - String date = ""; | ||
107 | - //取当天的年月日的时间毫秒数 | ||
108 | - long now = DateUtil.stringToDate(DateUtil.long2DateStr(new Date().getTime(), DateUtil.DATE_FORMAT), DateUtil.DATE_FORMAT).getTime(); | ||
109 | - String lastDate = DateUtil.dateAdd(DateUtil.getcurrentDate(), "d", -1, DateUtil.DATE_FORMAT); | ||
110 | - for (InBox box : inBoxList) { | ||
111 | - // 校验消息业务类型 | ||
112 | - if (box.getBusinessType() == null) { | ||
113 | - log.warn("initInboxDetails inbox BusinessType is null. with box={}", box); | ||
114 | - continue; | ||
115 | - } | ||
116 | - date = DateUtil.long2DateStr((long) box.getCreateTime() * 1000, DateUtil.DATE_TIME_FORMAT); | ||
117 | - if (box.getCreateTime() * 1000 >= now) { | ||
118 | - date = "今天" + DateUtil.dateToString(DateUtil.long2Date(box.getCreateTime() * 1000), "HH:mm"); | ||
119 | - } else if (box.getCreateTime() * 1000 > DateUtil.stringToDate(lastDate, DateUtil.DATE_FORMAT).getTime()) { | ||
120 | - date = "昨天" + DateUtil.dateToString(DateUtil.long2Date(box.getCreateTime() * 1000), "HH:mm"); | ||
121 | - } | ||
122 | - resp = new InboxDetailRespVO(); | ||
123 | - resp.setContent(box.getContent()); | ||
124 | - resp.setId(box.getId()); | ||
125 | - resp.setUid(box.getUid()); | ||
126 | - resp.setTitle(box.getTitle()); | ||
127 | - resp.setBusinessType(box.getBusinessType()); | ||
128 | - if (box.getBusinessType() != null && box.getBusinessType() > 0) { | ||
129 | - // final String beanName = InboxBusinessTypeEnum.getBeanNameByBusinessType(box.getBusinessType()); | ||
130 | -// IInBoxBusinessService service = SpringContextUtil.getBean(beanName, IInBoxBusinessService.class); | ||
131 | -// Map<String, Object> map = service.getMessage(box); | ||
132 | -// String imgUrl = BusinessTypeEnum.getImgUrlByBusinessType(box.getBusinessType()); | ||
133 | -// resp.setBody(map); | ||
134 | - } else { | ||
135 | - continue; | ||
136 | - } | ||
137 | -// Map<String, String> urlMap = InboxJumpUrlHelper.getJumpUrl(box, resp.getBody()); | ||
138 | -// resp.setPcLink(StringUtils.isNotEmpty(urlMap.get("pc_link")) ? urlMap.get("pc_link") : ""); | ||
139 | -// resp.setAppLink(StringUtils.isNotEmpty(urlMap.get("app_link")) ? urlMap.get("app_link") : ""); | ||
140 | - resp.setIs_read(box.getIsRead()); | ||
141 | - resp.setCreate_time(box.getCreateTime()); | ||
142 | - resp.setCreate_date(date); | ||
143 | - resp.setType(String.valueOf(box.getType())); | ||
144 | - inboxDetailRespVOList.add(resp); | 95 | + @Override |
96 | + public void updateReadedByType(UpdateReadedReqVO reqVO) { | ||
97 | + if (reqVO.getUid() < 1) { | ||
98 | + log.warn("updateReadedByType error because uid is null with param is {}", reqVO); | ||
99 | + throw new ServiceException(ServiceError.SMS_INBOX_UID_NULL); | ||
145 | } | 100 | } |
146 | - return inboxDetailRespVOList; | 101 | + inBoxMapper.updateReadedByUidAndType(getTableName(reqVO.getUid()),reqVO.getUid(),reqVO.getType(),DateUtil.getCurrentTimeSecond()); |
147 | } | 102 | } |
148 | 103 | ||
149 | private String getTableName(Integer uid) { | 104 | private String getTableName(Integer uid) { |
-
Please register or login to post a comment