Просмотр исходного кода

通知返回结果新增字段

zhangchen 3 месяцев назад
Родитель
Сommit
c54514bcee

+ 2 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeNoticeVo.java

@@ -25,4 +25,6 @@ public class LifeNoticeVo extends LifeNotice {
     @ApiModelProperty(value = "订单提醒数量")
     private Long orderNum;
 
+    @ApiModelProperty(value = "平台类型,1,默认平台,2,其他")
+    private String platformType;
 }

+ 32 - 0
alien-store/src/main/java/shop/alien/store/service/impl/LifeNoticeServiceImpl.java

@@ -8,13 +8,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.LifeNotice;
+import shop.alien.entity.store.LifeUserViolation;
 import shop.alien.entity.store.vo.*;
 import shop.alien.mapper.LifeMessageMapper;
 import shop.alien.mapper.LifeNoticeMapper;
+import shop.alien.mapper.LifeUserViolationMapper;
 import shop.alien.store.service.LifeNoticeService;
 
 import java.util.*;
@@ -28,6 +31,8 @@ public class LifeNoticeServiceImpl extends ServiceImpl<LifeNoticeMapper, LifeNot
 
     private final LifeMessageMapper lifeMessageMapper;
 
+    private final LifeUserViolationMapper lifeUserViolationMapper;
+
     @Override
     public R<IPage<LifeNoticeVo>> getNoticeList(int pageNum, int pageSize, String receiverId, int noticeType) {
         IPage<LifeNotice> ipage = new Page<>(pageNum, pageSize);
@@ -41,6 +46,7 @@ public class LifeNoticeServiceImpl extends ServiceImpl<LifeNoticeMapper, LifeNot
 
         List<String> senderIdList = new ArrayList<>();
         Map<String, List<String>> collect = new HashMap<>();
+        List<Integer> businessIdList = new ArrayList<>();
         if (CollectionUtil.isNotEmpty(lifeNoticeList)) {
             collect = lifeNoticeList.stream()
                     .map(LifeNotice::getSenderId)
@@ -51,6 +57,23 @@ public class LifeNoticeServiceImpl extends ServiceImpl<LifeNoticeMapper, LifeNot
                                     item -> item.split("_")[1],  // 提取每个分组中的第二部分
                                     Collectors.toList()
                             )));
+            businessIdList = lifeNoticeList.stream()
+                    .map(LifeNotice::getBusinessId)
+                    .collect(Collectors.toList());
+        }
+
+        List<LifeUserViolation> lifeUserViolationList = new ArrayList<>();
+        if(CollectionUtil.isNotEmpty(businessIdList)){
+            lifeUserViolationList = lifeUserViolationMapper.selectBatchIds(businessIdList);
+        }
+        Map<Integer,String> lifeUserViolationMap = new HashMap<>();
+        if(CollectionUtil.isNotEmpty(lifeUserViolationList)){
+            lifeUserViolationMap = lifeUserViolationList.stream()
+                    .collect(Collectors.toMap(
+                            LifeUserViolation::getId,
+                            LifeUserViolation::getReportContextType,
+                            (existing, replacement) -> existing
+                    ));
         }
 
 
@@ -72,6 +95,15 @@ public class LifeNoticeServiceImpl extends ServiceImpl<LifeNoticeMapper, LifeNot
             });
         }
 
+        for(LifeNoticeVo lifeNoticeVo : noticeVoList){
+            if(lifeNoticeVo!=null && lifeNoticeVo.getBusinessId() != null && lifeUserViolationMap.containsKey(lifeNoticeVo.getBusinessId())){
+                String reportContextType = lifeUserViolationMap.get(lifeNoticeVo.getBusinessId());
+                if(StringUtils.isNotBlank(reportContextType) && "1,2,3".contains(reportContextType)){
+                    lifeNoticeVo.setPlatformType("1");
+                }
+            }
+        }
+
         List<LifeNoticeVo> pageList = noticeVoList.stream()
                 .skip((pageNum - 1) * pageSize)
                 .limit(pageSize)