Ver Fonte

添加消息

Wei Ruifeng há 5 anos atrás
pai
commit
c9ba3f8a06

+ 5 - 0
lift-ud-service/src/main/java/cn/com/ty/lift/ud/chat/service/impl/LiftCaseServiceImpl.java

@@ -645,6 +645,11 @@ public class LiftCaseServiceImpl extends ServiceImpl<LiftCaseMapper, LiftCaseEnt
             // 更新余额
             userInfoMapper.rechargePayBalance(selectById.getChargerId(), travelFree);
 
+            PushUserInfo pushUserInfo =
+                iUserAccountService.getPushUserInfoByUserId(selectById.getChargerId().toString());
+            PushMessage pushMessage = PushMessage.orderChargeStatus("用戶已确认打卡");
+            pushMessage.sendTokenOnPlatform(jmsMessagingTemplate, pushUserInfo);
+            
             return RestResponse.success("success");
         } else {
             return RestResponse.fail("fail");

+ 14 - 0
lift-ud-service/src/main/java/cn/com/ty/lift/ud/expertComment/service/impl/ExpertCommentServiceImpl.java

@@ -6,12 +6,15 @@ import cn.com.ty.lift.ud.expertComment.mapper.entity.ScoreInfo;
 import cn.com.ty.lift.ud.userInfo.mapper.entity.UserInfoEntity;
 import cn.com.xwy.util.collection.ListUtil;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.core.JmsMessagingTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import cn.com.ty.lift.common.model.PushMessage;
+import cn.com.ty.lift.common.model.PushUserInfo;
 import cn.com.ty.lift.ud.chat.mapper.LiftCaseMapper;
 import cn.com.ty.lift.ud.chat.mapper.entity.LiftCaseEntity;
 import cn.com.ty.lift.ud.chat.service.ILiftCaseService;
@@ -21,6 +24,7 @@ import cn.com.ty.lift.ud.expertComment.mapper.entity.ExpertCommentEntity;
 import cn.com.ty.lift.ud.expertComment.service.IExpertCommentService;
 import cn.com.ty.lift.ud.operation.mapper.entity.ExpertLevelSettingEntity;
 import cn.com.ty.lift.ud.operation.service.IExpertLevelSettingService;
+import cn.com.ty.lift.ud.userAccount.service.IUserAccountService;
 import cn.com.ty.lift.ud.userInfo.service.IUserInfoService;
 import cn.com.xwy.boot.web.dto.RestResponse;
 
@@ -40,6 +44,11 @@ public class ExpertCommentServiceImpl extends ServiceImpl<ExpertCommentMapper, E
 
     private @Autowired LiftCaseMapper caseMapper;
 
+    @Autowired
+    private JmsMessagingTemplate jmsMessagingTemplate;
+    
+    private @Autowired IUserAccountService iUserAccountService;
+    
     @Autowired
     private IExpertLevelSettingService iExpertLevelSettingService;
 
@@ -171,6 +180,11 @@ public class ExpertCommentServiceImpl extends ServiceImpl<ExpertCommentMapper, E
         } else {
             caseMapper.updateStatusById(selectById.getId(), 6);
         }
+        
+        PushUserInfo pushUserInfo =
+            iUserAccountService.getPushUserInfoByUserId(selectById.getChargerId().toString());
+        PushMessage pushMessage = PushMessage.orderChargeStatus("用戶有新评价");
+        pushMessage.sendTokenOnPlatform(jmsMessagingTemplate, pushUserInfo);
         return RestResponse.success(null, "新增成功");
     }
 

+ 4 - 1
lift-ud-service/src/main/java/cn/com/ty/lift/ud/liftCaseAppeal/service/impl/LiftCaseAppealServiceImpl.java

@@ -187,7 +187,10 @@ public class LiftCaseAppealServiceImpl extends ServiceImpl<LiftCaseAppealMapper,
             userBillEntity.setFlowNum(billId);
             iUserBillService.save(userBillEntity);
         }
-
+        // todo 发送消息给该用户
+        PushUserInfo pushUserInfo = iUserAccountService.getPushUserInfoByUserId(selectById.getAppealerId().toString());
+        PushMessage pushMessage = PushMessage.auditNotice(pushUserInfo.getUserName(), "诊单申诉", "已退款");
+        pushMessage.sendTokenOnPlatform(jmsMessagingTemplate, pushUserInfo);
         return RestResponse.success(null, "退款成功");
     }
 

+ 15 - 4
lift-ud-service/src/main/java/cn/com/ty/lift/ud/pay/service/impl/AlipayServiceImpl.java

@@ -2,8 +2,11 @@ package cn.com.ty.lift.ud.pay.service.impl;
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.time.ZoneOffset;
 import java.util.*;
 
+import cn.com.ty.lift.common.model.PushMessage;
+import cn.com.ty.lift.common.model.PushUserInfo;
 import cn.com.ty.lift.ud.chat.mapper.entity.ChatSessionEntity;
 import cn.com.ty.lift.ud.chat.mapper.entity.LiftCaseEntity;
 import cn.com.ty.lift.ud.chat.service.IChatSessionService;
@@ -54,6 +57,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.core.JmsMessagingTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -81,6 +85,9 @@ public class AlipayServiceImpl implements AlipayService {
 
     private final Logger logger = LoggerFactory.getLogger(AlipayServiceImpl.class);
 
+    @Autowired
+    private JmsMessagingTemplate jmsMessagingTemplate;
+    
     private @Autowired AlipayClient alipayClient;
 
     private @Autowired AlipayConfig alipayConfig;
@@ -506,7 +513,7 @@ public class AlipayServiceImpl implements AlipayService {
         RoomInfo roomInfo = new RoomInfo();
         roomInfo.setSessionid(entity.getSessionid());
         roomInfo.setDataTable(entity.getDataTable());
-        roomInfo.setLastTime(entity.getCreateTime());
+        roomInfo.setLastTime(entity.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli());
         UserInfo userInfo1 = new UserInfo();
         userInfo1.setUserId(entity.getUserId());
         List<UserInfo> userList = new ArrayList<>();
@@ -643,7 +650,7 @@ public class AlipayServiceImpl implements AlipayService {
         RoomInfo roomInfo = new RoomInfo();
         roomInfo.setSessionid(entity.getSessionid());
         roomInfo.setDataTable(entity.getDataTable());
-        roomInfo.setLastTime(entity.getCreateTime());
+        roomInfo.setLastTime(entity.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli());
         UserInfo userInfo1 = new UserInfo();
         userInfo1.setUserId(entity.getUserId());
         List<UserInfo> userList = new ArrayList<>();
@@ -704,6 +711,10 @@ public class AlipayServiceImpl implements AlipayService {
         billUpEntity.setBalance(latestBalance);
         iUserBillService.save(billUpEntity);
 
+        PushUserInfo pushUserInfo =
+            iUserAccountService.getPushUserInfoByUserId(caseEntity.getChargerId().toString());
+        PushMessage pushMessage = PushMessage.orderChargeStatus("用戶已付款");
+        pushMessage.sendTokenOnPlatform(jmsMessagingTemplate, pushUserInfo);
         // log.info("开始记录专家流水信息");
         // //专家新增流水信息
         // BigDecimal fee = new BigDecimal("0");
@@ -781,7 +792,7 @@ public class AlipayServiceImpl implements AlipayService {
         RoomInfo roomInfo = new RoomInfo();
         roomInfo.setSessionid(entity.getSessionid());
         roomInfo.setDataTable(entity.getDataTable());
-        roomInfo.setLastTime(entity.getCreateTime());
+        roomInfo.setLastTime(entity.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli());
         UserInfo userInfo1 = new UserInfo();
         userInfo1.setUserId(entity.getUserId());
         List<UserInfo> userList = new ArrayList<>();
@@ -910,7 +921,7 @@ public class AlipayServiceImpl implements AlipayService {
         RoomInfo roomInfo = new RoomInfo();
         roomInfo.setSessionid(entity.getSessionid());
         roomInfo.setDataTable(entity.getDataTable());
-        roomInfo.setLastTime(entity.getCreateTime());
+        roomInfo.setLastTime(entity.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli());
         UserInfo userInfo1 = new UserInfo();
         userInfo1.setUserId(entity.getUserId());
         List<UserInfo> userList = new ArrayList<>();

+ 13 - 2
lift-ud-service/src/main/java/cn/com/ty/lift/ud/pay/service/impl/WxpayServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.ty.lift.ud.pay.service.impl;
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.time.ZoneOffset;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -9,11 +10,14 @@ import java.util.List;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.core.JmsMessagingTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 
+import cn.com.ty.lift.common.model.PushMessage;
+import cn.com.ty.lift.common.model.PushUserInfo;
 import cn.com.ty.lift.ud.chat.mapper.entity.ChatSessionEntity;
 import cn.com.ty.lift.ud.chat.mapper.entity.LiftCaseEntity;
 import cn.com.ty.lift.ud.chat.service.IChatSessionService;
@@ -65,6 +69,9 @@ public class WxpayServiceImpl implements WxpayService {
 
     private final Logger logger = LoggerFactory.getLogger(AlipayServiceImpl.class);
 
+    @Autowired
+    private JmsMessagingTemplate jmsMessagingTemplate;
+    
     private @Autowired ILiftCaseService liftCaseService;
 
     private @Autowired IChatSessionService chatSessionService;
@@ -135,7 +142,7 @@ public class WxpayServiceImpl implements WxpayService {
         RoomInfo roomInfo = new RoomInfo();
         roomInfo.setSessionid(entity.getSessionid());
         roomInfo.setDataTable(entity.getDataTable());
-        roomInfo.setLastTime(entity.getCreateTime());
+        roomInfo.setLastTime(entity.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli());
         UserInfo userInfo1 = new UserInfo();
         userInfo1.setUserId(entity.getUserId());
         List<UserInfo> userList = new ArrayList<>();
@@ -286,7 +293,7 @@ public class WxpayServiceImpl implements WxpayService {
         RoomInfo roomInfo = new RoomInfo();
         roomInfo.setSessionid(entity.getSessionid());
         roomInfo.setDataTable(entity.getDataTable());
-        roomInfo.setLastTime(entity.getCreateTime());
+        roomInfo.setLastTime(entity.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli());
         UserInfo userInfo1 = new UserInfo();
         userInfo1.setUserId(entity.getUserId());
         List<UserInfo> userList = new ArrayList<>();
@@ -346,6 +353,10 @@ public class WxpayServiceImpl implements WxpayService {
         billUpEntity.setBalance(latestBalance);
         iUserBillService.save(billUpEntity);
 
+        PushUserInfo pushUserInfo =
+            iUserAccountService.getPushUserInfoByUserId(caseEntity.getChargerId().toString());
+        PushMessage pushMessage = PushMessage.orderChargeStatus("用戶已付款");
+        pushMessage.sendTokenOnPlatform(jmsMessagingTemplate, pushUserInfo);
         log.info("交易成功,处理业务代码完成");
 
     }

+ 1 - 1
lift-ud-service/src/main/java/cn/com/ty/lift/ud/userInfo/mapper/UserInfoMapper.java

@@ -76,7 +76,7 @@ public interface UserInfoMapper extends BaseMapper<UserInfoEntity> {
      * @param lat
      * @return
      */
-    @Select("  SELECT us.user_id as userId,us.`name`as name,us.avatar_url as avatarUrl,\n" + "                ROUND(\n"
+    @Select("  SELECT us.user_id as userId,IF(show_which_name=2,IFNULL(real_name,NAME),NAME)`name`,us.avatar_url as avatarUrl,\n" + "                ROUND(\n"
         + "                6378.138 * 2 * ASIN(\n" + "                    SQRT(\n" + "                        POW(\n"
         + "                            SIN(\n" + "                                (\n"
         + "                                    #{lat} * PI() / 180 - lat * PI() / 180\n"

+ 1 - 1
lift-ud-service/src/main/java/cn/com/ty/lift/ud/userInfo/mapper/UserInfoMapper.xml

@@ -25,7 +25,7 @@
 
 	<select id="selectByQuery" resultType="cn.com.ty.lift.ud.userInfo.mapper.entity.UserInfoEntity">
 		SELECT
-			*,
+			*,IF(show_which_name=2,IFNULL(real_name,NAME),NAME)`name`
 			(SELECT GROUP_CONCAT(bt.name SEPARATOR ',') FROM lift_brand bt WHERE FIND_IN_SET(bt.id, a.proficiency_brand)) proficiencyBrandName
 		FROM user_info AS a
 		LEFT JOIN user_account b ON a.user_id = b.user_id