From bc9b3881443190de6df4867a6b0a67bc472bab93 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 09 六月 2020 17:44:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java | 181 +++++++++++++++++++++++++++++++++++---------
1 files changed, 143 insertions(+), 38 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
index 94f9ef1..3089d9f 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
@@ -39,9 +39,11 @@
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
+import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
+import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.goods.RecommendUserGoods;
@@ -59,24 +61,28 @@
import com.yeshi.fanli.service.inter.goods.RecommendUserGoodsService;
import com.yeshi.fanli.service.inter.homemodule.SpecialService;
import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
-import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService;
+import com.yeshi.fanli.service.inter.money.msg.MsgMoneyDetailService;
import com.yeshi.fanli.service.inter.msg.MsgConfigService;
import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService;
-import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
-import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
-import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
import com.yeshi.fanli.service.inter.msg.MsgOtherDetailService;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.service.inter.msg.UserSystemMsgService;
+import com.yeshi.fanli.service.inter.order.msg.MsgOrderDetailService;
import com.yeshi.fanli.service.inter.push.DeviceActiveService;
import com.yeshi.fanli.service.inter.push.PushGoodsService;
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
+import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
+import com.yeshi.fanli.service.inter.user.invite.MsgInviteDetailService;
+import com.yeshi.fanli.service.inter.user.msg.MsgAccountDetailService;
import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.RedisKeyEnum;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.VersionUtil;
+import com.yeshi.fanli.util.account.UserUtil;
+import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
import com.yeshi.fanli.util.factory.msg.UserMsgVOFactory;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
@@ -152,6 +158,9 @@
@Resource
private MsgDeviceReadStateService msgDeviceReadStateService;
+ @Resource
+ private UserInfoExtraService userInfoExtraService;
+
// 娑堟伅鐨勭被鍨�
final static String MSG_TYPE_ORDER = "order";
final static String MSG_TYPE_MONEY = "money";
@@ -170,7 +179,6 @@
*/
@RequestMapping(value = "getMsgList", method = RequestMethod.POST)
public void getMsgList(AcceptData acceptData, Long uid, int page, String type, PrintWriter out) {
-
if (uid == null) {
out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
return;
@@ -193,8 +201,12 @@
for (MsgOrderDetail detail : detailList) {
JSONObject params = new JSONObject();
params.put("orderNo", detail.getOrderId());
- list.add(UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"),
- params));
+ if (detail.getType() == MsgTypeOrderTypeEnum.invite || detail.getType() == MsgTypeOrderTypeEnum.orderInvite)
+ params.put("orderHideNo", UserUtil.filterOrderId(detail.getOrderId()));
+
+ UserMsgVO msgVO = UserMsgVOFactory.create(detail, jumpDetailV2Service.getByTypeCache("order_search"), params);
+ msgVO.setType(MSG_TYPE_ORDER);
+ list.add(msgVO);
}
break;
case MSG_TYPE_MONEY:
@@ -202,16 +214,22 @@
List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page);
count = msgMoneyDetailService.countMsgMoneyDetail(uid);
if (detailList1 != null)
- for (MsgMoneyDetail detail : detailList1)
- list.add(UserMsgVOFactory.create(detail));
+ for (MsgMoneyDetail detail : detailList1) {
+ UserMsgVO msgVO = UserMsgVOFactory.create(detail);
+ msgVO.setType(MSG_TYPE_MONEY);
+ list.add(msgVO);
+ }
break;
case MSG_TYPE_ACCOUNT:
userMsgReadStateService.readAccountMsg(uid);
List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page);
count = msgAccountDetailService.countMsgAccountDetail(uid);
if (detailList2 != null)
- for (MsgAccountDetail detail : detailList2)
- list.add(UserMsgVOFactory.create(detail));
+ for (MsgAccountDetail detail : detailList2) {
+ UserMsgVO msgVO = UserMsgVOFactory.create(detail);
+ msgVO.setType(MSG_TYPE_ACCOUNT);
+ list.add(msgVO);
+ }
break;
case MSG_TYPE_INVITE:
userMsgReadStateService.readInviteMsg(uid);
@@ -220,10 +238,12 @@
if (detailList3 != null)
for (MsgInviteDetail detail : detailList3) {
UserMsgVO vo = UserMsgVOFactory.create(detail);
- if (vo != null)
+ if (vo != null) {
+ vo.setType(MSG_TYPE_INVITE);
list.add(vo);
- else
+ } else {
count--;
+ }
}
break;
case MSG_TYPE_OTHER:
@@ -233,10 +253,12 @@
if (detailList4 != null)
for (MsgOtherDetail detail : detailList4) {
UserMsgVO vo = UserMsgVOFactory.create(detail);
- if (vo != null)
+ if (vo != null) {
+ vo.setType(MSG_TYPE_OTHER);
list.add(vo);
- else
+ } else {
count--;
+ }
}
break;
}
@@ -256,6 +278,7 @@
* @param uid
* @param out
*/
+ @RequestSerializableByKey(key = "#acceptData.device")
@RequestMapping(value = "getUnReadMsgCount", method = RequestMethod.POST)
public void getUnReadMsgCount(AcceptData acceptData, Long uid, PrintWriter out) {
GsonBuilder androidBuilder = new GsonBuilder().registerTypeAdapter(Integer.class,
@@ -304,7 +327,7 @@
"android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, MsgDeviceReadState.TYPE_KEFU);
data.put("totalCount", totalCount);
}
-
+ data.put("mineCount", 0);
out.print(JsonUtil.loadTrueResult(data));
return;
}
@@ -326,6 +349,18 @@
data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
}
data.put("totalCount", totalCount);
+ // "鎴戠殑"閫夐」瑙掓爣
+ int welfareCenterNews = 0;
+ if (uid != null) {
+ UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
+ if (userInfoExtra != null) {
+ if (userInfoExtra.getCouponNews() != null) {
+ welfareCenterNews = userInfoExtra.getCouponNews();
+ }
+ }
+ }
+
+ data.put("mineCount", welfareCenterNews);
try {
UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
@@ -379,7 +414,7 @@
}
private void addRecommendGoods(Long uid, String device, String imei, String idfa) {
- TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(1, 50, imei, idfa);
+ TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(1, 50, imei, idfa,"");
if (result != null && result.getTaoBaoGoodsBriefs() != null) {
for (int i = 0; i < result.getTaoBaoGoodsBriefs().size(); i++) {
if (result.getTaoBaoGoodsBriefs().get(i).getCouponAmount() == null
@@ -468,6 +503,9 @@
public void getHomeMsgList(AcceptData acceptData, Long uid, int page, HttpSession session, PrintWriter out) {
if (uid != null && uid == 0)
uid = null;
+ if (uid != null)
+ userSystemMsgService.syncSystemZNX(uid);
+
String device = acceptData.getDevice();
if (device == null || device.trim().length() == 0) {
out.print(JsonUtil.loadFalseResult("璁惧鍙蜂笉鑳戒负绌�"));
@@ -492,7 +530,7 @@
}
// String key = "recommend-goods-user-" + uid;
- String key = "recommend-goods-user-" + device;
+ String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.recommendGoodsUser, device);
if (Constant.IS_OUTNET) {
if (canAdd && StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
if (Constant.IS_OUTNET)
@@ -567,7 +605,9 @@
// 鍒涘缓鏃堕棿鍦�28鍙峰悗鐨勬墠鏈夋柊浜烘杩�
if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) {
UserHomeMsgVO vo = new UserHomeMsgVO();
- vo.setContent("鎭枩浣狅紝鎴愪负杩斿埄鍒哥殑鐢ㄦ埛\n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁╄繑鍒╁埜鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒");
+ vo.setContent(String.format("鎭枩浣狅紝鎴愪负%s鐨勭敤鎴穃n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁�%s鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒",
+ Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()),
+ Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion())));
vo.setTitle("鏂颁汉娆㈣繋");
vo.setCreateTime(getTimeDesc(now, new Date(time)));
vo.setType(UserHomeMsgVO.TYPE_WELCOME);
@@ -630,10 +670,14 @@
* @param type
* @param out
*/
+ @RequestSerializableByKey(key = "#acceptData.device")
@RequestMapping(value = "getHomeMsgListNew", method = RequestMethod.POST)
public void getHomeMsgListNew(AcceptData acceptData, Long uid, PrintWriter out) {
if (uid != null && uid == 0)
uid = null;
+ if (uid != null) {
+ userSystemMsgService.syncSystemZNX(uid);
+ }
List<UserMsgCenter> listCenter = new ArrayList<>();
@@ -662,7 +706,7 @@
}
}
- // 杩斿埄鍒稿皬鍔╂墜
+ // 鏉挎牀蹇渷灏忓姪鎵�
MsgCommonDTO zhuShouMsg = msgConfigService.getZhuShouMsg();
if (zhuShouMsg != null && zhuShouMsg.getShow() == true) {
boolean read = false;
@@ -713,7 +757,10 @@
// list = pushGoodsService.listHistoryByPushTime(0, 1, uid, createTime);
// 1銆佹椿鍔ㄥ尯鍩�
- List<Special> listSpecial = specialService.listByPlaceKey("msg_activities");
+ int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
+
+ List<Special> listSpecial = specialService.listByPlaceKey("msg_activities", platformCode,
+ Integer.parseInt(acceptData.getVersion()));
if (listSpecial != null && listSpecial.size() > 0) {
for (Special special : listSpecial) {
@@ -739,6 +786,8 @@
for (MsgOrderDetail detail : detailList) {
JSONObject params = new JSONObject();
params.put("orderNo", detail.getOrderId());
+ if (detail.getType() == MsgTypeOrderTypeEnum.invite || detail.getType() == MsgTypeOrderTypeEnum.orderInvite)
+ params.put("orderHideNo", UserUtil.filterOrderId(detail.getOrderId()));
UserMsgVO userMsgVO = UserMsgVOFactory.create(detail,
jumpDetailV2Service.getByTypeCache("order_search"), params);
userMsgVO.setType(MSG_TYPE_ORDER);
@@ -808,7 +857,10 @@
if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("title", "鏂颁汉娆㈣繋");
- map.put("content", "鎭枩浣狅紝鎴愪负杩斿埄鍒哥殑鐢ㄦ埛\n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁╄繑鍒╁埜鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒");
+ map.put("content",
+ String.format("鎭枩浣狅紝鎴愪负%s鐨勭敤鎴穃n鐙浼樻儬鍒稿府浣犵渷閽憋紱\n鍙備笌濂栭噾娲诲姩甯綘璧氶挶锛沑n璁�%s鎴愪负浣犵殑鐪侀挶鍔╂墜鍚э紒",
+ Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()),
+ Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion())));
map.put("createTime", new Date(time));
UserMsgCenter msgCenternre = new UserMsgCenter();
msgCenternre.setWelcomeMsg(map);
@@ -837,24 +889,27 @@
/**
* 鎻愰啋澶у浘
*/
- MsgCommonDTO notify = msgConfigService.getNotifyMsg();
+ if (!"douyin".equalsIgnoreCase(acceptData.getChannel())) {
+ MsgCommonDTO notify = msgConfigService.getNotifyMsg();
- if (notify != null && notify.getShow() == true) {
- boolean read = false;
- MsgDeviceReadState state = msgDeviceReadStateService.getByDeviceAndPlatformAndType(
- UserCommonMsgVO.TYPE_NOTIFY, acceptData.getDevice(),
- acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
- if (state != null && state.getReadTime() != null
- && zhuShouMsg.getUpdateTime().getTime() < state.getReadTime().getTime())
- read = true;
- // 鏌ヨ鏄惁宸茶
- UserCommonMsgVO vo = new UserCommonMsgVO(notify.getIcon(), notify.getTitle(), notify.getUpdateTime(),
- UserCommonMsgVO.TYPE_NOTIFY, notify.getContent(), read, notify.getJumpDetail(), notify.getParams(),
- 0);
- vo.setPicture(notify.getPicture());
- root.put("notifyMsg", builder.create().toJson(vo));
+ if (notify != null && notify.getShow() == true) {
+ boolean read = false;
+ MsgDeviceReadState state = msgDeviceReadStateService.getByDeviceAndPlatformAndType(
+ UserCommonMsgVO.TYPE_NOTIFY, acceptData.getDevice(),
+ acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
+ if (state != null && state.getReadTime() != null
+ && zhuShouMsg.getUpdateTime().getTime() < state.getReadTime().getTime())
+ read = true;
+ if (notify.getJumpDetail() == null)
+ read = true;
+ // 鏌ヨ鏄惁宸茶
+ UserCommonMsgVO vo = new UserCommonMsgVO(notify.getIcon(), notify.getTitle(), notify.getUpdateTime(),
+ UserCommonMsgVO.TYPE_NOTIFY, notify.getContent(), read, notify.getJumpDetail(),
+ notify.getParams(), 0);
+ vo.setPicture(notify.getPicture());
+ root.put("notifyMsg", builder.create().toJson(vo));
+ }
}
-
root.put("list", builder.create().toJson(listCenter));
root.put("commonList", builder.create().toJson(commonMsgList));
root.put("count", listCenter.size());
@@ -1021,4 +1076,54 @@
out.print(JsonUtil.loadTrueResult(""));
}
+
+ /**
+ * 鍒犻櫎娑堟伅
+ * @param acceptData
+ * @param type
+ * @param id
+ * @param out
+ */
+ @RequestMapping(value = "deleteMsg", method = RequestMethod.POST)
+ public void deleteMsg(AcceptData acceptData, String type, Long id, Long uid, PrintWriter out) {
+ if (StringUtil.isNullOrEmpty(type) || id == null || uid == null) {
+ out.print(JsonUtil.loadFalseResult("鍙傛暟涓嶅畬鏁�"));
+ return;
+ }
+
+ switch (type) {
+ case MSG_TYPE_ORDER:
+ MsgOrderDetail msgOrderDetail = msgOrderDetailService.selectByPrimaryKey(id);
+ if (msgOrderDetail != null && msgOrderDetail.getUser().getId().longValue() == uid.longValue()) {
+ msgOrderDetailService.deleteByPrimaryKey(id);
+ }
+ break;
+ case MSG_TYPE_MONEY:
+ MsgMoneyDetail moneyDetail = msgMoneyDetailService.selectByPrimaryKey(id);
+ if (moneyDetail != null && moneyDetail.getUser().getId().longValue() == uid.longValue()) {
+ msgMoneyDetailService.deleteByPrimaryKey(id);
+ }
+ break;
+ case MSG_TYPE_ACCOUNT:
+ MsgAccountDetail accountDetail = msgAccountDetailService.selectByPrimaryKey(id);
+ if (accountDetail != null && accountDetail.getUser().getId().longValue() == uid.longValue()) {
+ msgAccountDetailService.deleteByPrimaryKey(id);
+ }
+ break;
+ case MSG_TYPE_INVITE:
+ MsgInviteDetail inviteDetail = msgInviteDetailService.selectByPrimaryKey(id);
+ if (inviteDetail != null && inviteDetail.getUser().getId().longValue() == uid.longValue()) {
+ msgInviteDetailService.deleteByPrimaryKey(id);
+ }
+ break;
+ case MSG_TYPE_OTHER:
+ MsgOtherDetail otherDetail = msgOtherDetailService.selectByPrimaryKey(id);
+ if (otherDetail != null && otherDetail.getUser().getId().longValue() == uid.longValue()) {
+ msgOtherDetailService.deleteByPrimaryKey(id);
+ }
+ break;
+ }
+ out.print(JsonUtil.loadTrueResult(""));
+ }
+
}
--
Gitblit v1.8.0