|
@@ -10,21 +10,20 @@ import com.caimei365.user.model.ResponseJson;
|
|
import com.caimei365.user.model.dto.*;
|
|
import com.caimei365.user.model.dto.*;
|
|
import com.caimei365.user.model.po.OperationPo;
|
|
import com.caimei365.user.model.po.OperationPo;
|
|
import com.caimei365.user.model.po.SuperVipPo;
|
|
import com.caimei365.user.model.po.SuperVipPo;
|
|
-import com.caimei365.user.model.vo.*;
|
|
|
|
|
|
+import com.caimei365.user.model.vo.MessageCenter;
|
|
|
|
+import com.caimei365.user.model.vo.OperationVo;
|
|
|
|
+import com.caimei365.user.model.vo.UserLoginVo;
|
|
import com.caimei365.user.service.LoginService;
|
|
import com.caimei365.user.service.LoginService;
|
|
import com.caimei365.user.service.RemoteCallService;
|
|
import com.caimei365.user.service.RemoteCallService;
|
|
import com.caimei365.user.utils.JwtUtil;
|
|
import com.caimei365.user.utils.JwtUtil;
|
|
-import com.caimei365.user.utils.MathUtil;
|
|
|
|
import com.caimei365.user.utils.Md5Util;
|
|
import com.caimei365.user.utils.Md5Util;
|
|
import com.caimei365.user.utils.ValidateUtil;
|
|
import com.caimei365.user.utils.ValidateUtil;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
-import lombok.SneakyThrows;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
@@ -32,9 +31,6 @@ import javax.annotation.Resource;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.concurrent.Executors;
|
|
|
|
-import java.util.concurrent.ScheduledExecutorService;
|
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* Description
|
|
* Description
|
|
@@ -543,12 +539,16 @@ public class LoginServiceImpl implements LoginService {
|
|
Integer accountCount = messageCenterMapper.MessageCount(1, 2, commonId);
|
|
Integer accountCount = messageCenterMapper.MessageCount(1, 2, commonId);
|
|
Integer notificationCount = messageCenterMapper.MessageCount(1, 3, commonId);
|
|
Integer notificationCount = messageCenterMapper.MessageCount(1, 3, commonId);
|
|
Integer promotionCount = messageCenterMapper.MessageCount(1, 4, commonId);
|
|
Integer promotionCount = messageCenterMapper.MessageCount(1, 4, commonId);
|
|
|
|
+ Integer infoCount = messageCenterMapper.MessageCount(1, 5, commonId);
|
|
|
|
+ Integer activityCount = messageCenterMapper.MessageCount(1, 6, commonId);
|
|
Map<String, Object> map = new HashMap(10);
|
|
Map<String, Object> map = new HashMap(10);
|
|
map.put("count", count);
|
|
map.put("count", count);
|
|
map.put("tradeCount", tradeCount);
|
|
map.put("tradeCount", tradeCount);
|
|
map.put("account", accountCount);
|
|
map.put("account", accountCount);
|
|
map.put("notificationCount", notificationCount);
|
|
map.put("notificationCount", notificationCount);
|
|
map.put("promotionCount", promotionCount);
|
|
map.put("promotionCount", promotionCount);
|
|
|
|
+ map.put("infoCount", infoCount);
|
|
|
|
+ map.put("activityCount", activityCount);
|
|
return ResponseJson.success(map);
|
|
return ResponseJson.success(map);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -601,20 +601,6 @@ public class LoginServiceImpl implements LoginService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
- public Integer updateMessageAsRead(Integer messageType, Integer commonId) {
|
|
|
|
- return messageCenterMapper.updateMessageAsRead(1, messageType, commonId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public Integer updateShopMessageAsRead(Integer messageType, Integer commonId) {
|
|
|
|
- return messageCenterMapper.updateMessageAsRead(2, messageType, commonId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public Integer updateSpMessageAsRead(Integer messageType, Integer commonId) {
|
|
|
|
- return messageCenterMapper.updateMessageAsRead(3, messageType, commonId);
|
|
|
|
- }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Integer deleteMessage(String id) {
|
|
public Integer deleteMessage(String id) {
|
|
@@ -636,7 +622,28 @@ public class LoginServiceImpl implements LoginService {
|
|
return num;
|
|
return num;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<PageInfo<MessageCenter>> messageList(Integer commonId, Integer messageType, Integer userType, int pageNum, int pageSize) {
|
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
|
+ List<MessageCenter> list = setMessageList(userType, messageType, commonId);
|
|
|
|
+ PageInfo<MessageCenter> pageData = new PageInfo<>(list);
|
|
|
|
+ return ResponseJson.success(pageData);
|
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<Map<String, Object>> messageCount(Integer userType , Integer commonId) {
|
|
|
|
+ return ResponseJson.success(setMessageCount(userType,commonId));
|
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<Map<String, Object>> count(Integer userType,Integer messageType, Integer commonId) {
|
|
|
|
+ Integer count = messageCenterMapper.Count(userType, commonId);
|
|
|
|
+ Map<String, Object> map = new HashMap(1);
|
|
|
|
+ map.put("count", count);
|
|
|
|
+ return ResponseJson.success(map);
|
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ public Integer updateMessageAsRead(Integer userType,Integer messageType, Integer commonId) {
|
|
|
|
+ return messageCenterMapper.updateMessageAsRead(userType, messageType, commonId);
|
|
|
|
+ }
|
|
@Override
|
|
@Override
|
|
public ResponseJson<PageInfo<MessageCenter>> SpMessageList(Integer commonId, Integer messageType, Integer source, int pageNum, int pageSize) {
|
|
public ResponseJson<PageInfo<MessageCenter>> SpMessageList(Integer commonId, Integer messageType, Integer source, int pageNum, int pageSize) {
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
@@ -686,6 +693,12 @@ public class LoginServiceImpl implements LoginService {
|
|
mess.setRefundType(messageCenter.getRefundType());
|
|
mess.setRefundType(messageCenter.getRefundType());
|
|
mess.setStatus(messageCenter.getStatus());
|
|
mess.setStatus(messageCenter.getStatus());
|
|
}
|
|
}
|
|
|
|
+ if (5 == mess.getMessageType() || 6 == mess.getMessageType()) {
|
|
|
|
+ Map<String, String> typeValue = messageCenterMapper.getMessageTypeValues(mess.getMessageType(), mess.getThisId());
|
|
|
|
+ mess.setMainImage(typeValue.get("image"));
|
|
|
|
+ mess.setPcLink(typeValue.get("pcLink"));
|
|
|
|
+ mess.setAppLink(typeValue.get("appLink"));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
if (source == 2) {
|
|
if (source == 2) {
|
|
@@ -1641,6 +1654,45 @@ public class LoginServiceImpl implements LoginService {
|
|
}
|
|
}
|
|
return superVipDto;
|
|
return superVipDto;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * 初始化站内信
|
|
|
|
+ */
|
|
|
|
+ private List<MessageCenter> setMessageList(Integer userType,Integer messageType,Integer commonId) {
|
|
|
|
+ List<MessageCenter> list = messageCenterMapper.MessageList(userType, messageType, commonId);
|
|
|
|
+ list.forEach(mess -> {
|
|
|
|
+ if (null != mess.getOrderId()) {
|
|
|
|
+ MessageCenter messageCenter = messageCenterMapper.MainImage(userType, commonId, mess.getOrderId());
|
|
|
|
+ Integer productCount = messageCenterMapper.productCount(mess.getOrderId());
|
|
|
|
+ if (null != messageCenter) {
|
|
|
|
+ mess.setMainImage(messageCenter.getMainImage());
|
|
|
|
+ mess.setOnlinePayFlag(messageCenter.getOnlinePayFlag());
|
|
|
|
+ if (messageCenter.getProductName().length() > 10) {
|
|
|
|
+ mess.setProductName(StringUtils.strip(messageCenter.getProductName().substring(0, 11)));
|
|
|
|
+ } else {
|
|
|
|
+ mess.setProductName(messageCenter.getProductName());
|
|
|
|
+ }
|
|
|
|
+ mess.setProductCount(productCount);
|
|
|
|
+ mess.setRefundType(messageCenter.getRefundType());
|
|
|
|
+ mess.setStatus(messageCenter.getStatus());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private Map<String, Object> setMessageCount(Integer userType, Integer commonId) {
|
|
|
|
+ Integer count = messageCenterMapper.Count(userType, commonId);
|
|
|
|
+ Integer tradeCount = messageCenterMapper.MessageCount(userType, 1, commonId);
|
|
|
|
+ Integer accountCount = messageCenterMapper.MessageCount(userType, 2, commonId);
|
|
|
|
+ Integer notificationCount = messageCenterMapper.MessageCount(userType, 3, commonId);
|
|
|
|
+ Integer promotionCount = messageCenterMapper.MessageCount(userType, 4, commonId);
|
|
|
|
+ Map<String, Object> map = new HashMap(5);
|
|
|
|
+ map.put("count", count);
|
|
|
|
+ map.put("tradeCount", tradeCount);
|
|
|
|
+ map.put("accountCount", accountCount);
|
|
|
|
+ map.put("notificationCount", notificationCount);
|
|
|
|
+ map.put("promotionCount", promotionCount);
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|