|
@@ -3,6 +3,7 @@ package shop.alien.store.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -12,14 +13,10 @@ import org.springframework.beans.BeanUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartRequest;
|
|
import org.springframework.web.multipart.MultipartRequest;
|
|
-import shop.alien.entity.store.LifeLikeRecord;
|
|
|
|
-import shop.alien.entity.store.StoreComment;
|
|
|
|
-import shop.alien.entity.store.StoreImg;
|
|
|
|
|
|
+import shop.alien.entity.store.*;
|
|
import shop.alien.entity.store.vo.StoreCommentVo;
|
|
import shop.alien.entity.store.vo.StoreCommentVo;
|
|
import shop.alien.entity.store.vo.StoreCommitPercentVo;
|
|
import shop.alien.entity.store.vo.StoreCommitPercentVo;
|
|
-import shop.alien.mapper.LifeLikeRecordMapper;
|
|
|
|
-import shop.alien.mapper.StoreCommentMapper;
|
|
|
|
-import shop.alien.mapper.StoreImgMapper;
|
|
|
|
|
|
+import shop.alien.mapper.*;
|
|
import shop.alien.store.service.StoreCommentService;
|
|
import shop.alien.store.service.StoreCommentService;
|
|
import shop.alien.store.util.FileUploadUtil;
|
|
import shop.alien.store.util.FileUploadUtil;
|
|
import shop.alien.util.common.DateUtils;
|
|
import shop.alien.util.common.DateUtils;
|
|
@@ -52,6 +49,12 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
|
|
|
|
|
|
private final StoreImgMapper storeImgMapper;
|
|
private final StoreImgMapper storeImgMapper;
|
|
|
|
|
|
|
|
+ private final LifeUserViolationMapper lifeUserViolationMapper;
|
|
|
|
+
|
|
|
|
+ private final StoreUserMapper storeUserMapper;
|
|
|
|
+
|
|
|
|
+ private final LifeUserMapper lifeUserMapper;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 评论列表
|
|
* 评论列表
|
|
*
|
|
*
|
|
@@ -84,6 +87,41 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
|
|
Date date = DateUtils.calcDays(new Date(), -days);
|
|
Date date = DateUtils.calcDays(new Date(), -days);
|
|
queryWrapper.ge("a.created_time", DateUtils.formatDate(date, "yyyy-MM-dd"));
|
|
queryWrapper.ge("a.created_time", DateUtils.formatDate(date, "yyyy-MM-dd"));
|
|
}
|
|
}
|
|
|
|
+ //通过当前登录人id 类型 查询举报业务id
|
|
|
|
+ List<LifeUserViolation> lifeUserViolations = new ArrayList<>();
|
|
|
|
+ if(businessType==2){
|
|
|
|
+ String userId;
|
|
|
|
+ if(phoneId.startsWith("store_")){
|
|
|
|
+ userId = phoneId.substring("store_".length());
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getPhone,userId));
|
|
|
|
+ if(storeUser!=null){
|
|
|
|
+ LambdaQueryWrapper<LifeUserViolation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ lambdaQueryWrapper.eq(LifeUserViolation::getReportingUserId,storeUser.getId());
|
|
|
|
+ lambdaQueryWrapper.eq(LifeUserViolation::getReportingUserType,1);
|
|
|
|
+ lambdaQueryWrapper.ne(LifeUserViolation::getProcessingStatus,2);
|
|
|
|
+ lifeUserViolations = lifeUserViolationMapper.selectList(lambdaQueryWrapper);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ userId = phoneId.substring("user_".length());
|
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectOne(new LambdaQueryWrapper<LifeUser>().eq(LifeUser::getUserPhone,userId));
|
|
|
|
+ if(lifeUser!=null){
|
|
|
|
+ LambdaQueryWrapper<LifeUserViolation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ lambdaQueryWrapper.eq(LifeUserViolation::getReportingUserId,lifeUser.getId());
|
|
|
|
+ lambdaQueryWrapper.eq(LifeUserViolation::getReportingUserType,2);
|
|
|
|
+ lambdaQueryWrapper.ne(LifeUserViolation::getProcessingStatus,2);
|
|
|
|
+ lifeUserViolations = lifeUserViolationMapper.selectList(lambdaQueryWrapper);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<Integer> businessIds = lifeUserViolations.stream()
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
+ .map(LifeUserViolation::getBusinessId)
|
|
|
|
+ .filter(id -> id != null && !id.toString().isEmpty())
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ if(businessIds!=null && businessIds.size()>0){
|
|
|
|
+ queryWrapper.notIn("a.id",businessIds);
|
|
|
|
+ }
|
|
|
|
+
|
|
//先查询父级评论
|
|
//先查询父级评论
|
|
queryWrapper.isNull(businessType != 1, "a.reply_id").eq("a.delete_flag", 0).orderByDesc("a.created_time");
|
|
queryWrapper.isNull(businessType != 1, "a.reply_id").eq("a.delete_flag", 0).orderByDesc("a.created_time");
|
|
IPage<StoreCommentVo> page = storeCommentMapper.getCommentPage(storeCommentIPage, queryWrapper);
|
|
IPage<StoreCommentVo> page = storeCommentMapper.getCommentPage(storeCommentIPage, queryWrapper);
|
|
@@ -145,6 +183,9 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
|
|
}
|
|
}
|
|
}
|
|
}
|
|
QueryWrapper<StoreCommentVo> childQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<StoreCommentVo> childQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ if(businessIds!=null && businessIds.size()>0){
|
|
|
|
+ childQueryWrapper.notIn("a.id",businessIds);
|
|
|
|
+ }
|
|
childQueryWrapper.eq(null != businessId && 6 == businessId, "a.business_id", businessId).eq("a.delete_flag", 0).eq("a.reply_id", storeCommentVo.getId()).orderByDesc("a.created_time");
|
|
childQueryWrapper.eq(null != businessId && 6 == businessId, "a.business_id", businessId).eq("a.delete_flag", 0).eq("a.reply_id", storeCommentVo.getId()).orderByDesc("a.created_time");
|
|
List<StoreCommentVo> childCommentList = storeCommentMapper.getCommentList(childQueryWrapper);
|
|
List<StoreCommentVo> childCommentList = storeCommentMapper.getCommentList(childQueryWrapper);
|
|
storeCommentVo.setCommitCount(storeCommentVo.getCommitCount() + childCommentList.size());
|
|
storeCommentVo.setCommitCount(storeCommentVo.getCommitCount() + childCommentList.size());
|
|
@@ -255,13 +296,55 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
|
|
* @return Integer
|
|
* @return Integer
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Map<String, String> getCommitCountAndScore(Integer businessId, Integer businessType, Integer storeId) {
|
|
|
|
|
|
+ public Map<String, String> getCommitCountAndScore(Integer businessId, Integer businessType, Integer storeId, String phoneId, Integer days) {
|
|
Map<String, String> map = new HashMap<>();
|
|
Map<String, String> map = new HashMap<>();
|
|
AtomicReference<Integer> count = new AtomicReference<>(0);
|
|
AtomicReference<Integer> count = new AtomicReference<>(0);
|
|
QueryWrapper<StoreCommentVo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<StoreCommentVo> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.eq(null != businessId, "a.business_id", businessId);
|
|
queryWrapper.eq(null != businessId, "a.business_id", businessId);
|
|
queryWrapper.eq(null != businessType, "a.business_type", businessType);
|
|
queryWrapper.eq(null != businessType, "a.business_type", businessType);
|
|
queryWrapper.eq(null != storeId, "a.store_id", storeId);
|
|
queryWrapper.eq(null != storeId, "a.store_id", storeId);
|
|
|
|
+
|
|
|
|
+ if (null != days) {
|
|
|
|
+ Date date = DateUtils.calcDays(new Date(), -days);
|
|
|
|
+ queryWrapper.ge("a.created_time", DateUtils.formatDate(date, "yyyy-MM-dd"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //通过当前登录人id 类型 查询举报业务id
|
|
|
|
+ List<LifeUserViolation> lifeUserViolations = new ArrayList<>();
|
|
|
|
+ if(businessType==2){
|
|
|
|
+ String userId;
|
|
|
|
+ if(phoneId!=null && !phoneId.equals("") && phoneId.startsWith("store_")){
|
|
|
|
+ userId = phoneId.substring("store_".length());
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getPhone,userId));
|
|
|
|
+ if(storeUser!=null){
|
|
|
|
+ LambdaQueryWrapper<LifeUserViolation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ lambdaQueryWrapper.eq(LifeUserViolation::getReportingUserId,storeUser.getId());
|
|
|
|
+ lambdaQueryWrapper.eq(LifeUserViolation::getReportingUserType,1);
|
|
|
|
+ lambdaQueryWrapper.ne(LifeUserViolation::getProcessingStatus,2);
|
|
|
|
+ lifeUserViolations = lifeUserViolationMapper.selectList(lambdaQueryWrapper);
|
|
|
|
+ }
|
|
|
|
+ }else if(phoneId!=null && !phoneId.equals("") && phoneId.startsWith("user_")){
|
|
|
|
+ userId = phoneId.substring("user_".length());
|
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectOne(new LambdaQueryWrapper<LifeUser>().eq(LifeUser::getUserPhone,userId));
|
|
|
|
+ if(lifeUser!=null){
|
|
|
|
+ LambdaQueryWrapper<LifeUserViolation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ lambdaQueryWrapper.eq(LifeUserViolation::getReportingUserId,lifeUser.getId());
|
|
|
|
+ lambdaQueryWrapper.eq(LifeUserViolation::getReportingUserType,2);
|
|
|
|
+ lambdaQueryWrapper.ne(LifeUserViolation::getProcessingStatus,2);
|
|
|
|
+ lifeUserViolations = lifeUserViolationMapper.selectList(lambdaQueryWrapper);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Integer> businessIds = lifeUserViolations.stream()
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
+ .map(LifeUserViolation::getBusinessId)
|
|
|
|
+ .filter(id -> id != null && !id.toString().isEmpty())
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ if(businessIds!=null && businessIds.size()>0){
|
|
|
|
+ queryWrapper.notIn("a.id",businessIds);
|
|
|
|
+ }
|
|
|
|
+
|
|
//先查询父级评论
|
|
//先查询父级评论
|
|
queryWrapper.isNull(businessType != 1, "a.reply_id").eq("a.delete_flag", 0).orderByDesc("a.created_time");
|
|
queryWrapper.isNull(businessType != 1, "a.reply_id").eq("a.delete_flag", 0).orderByDesc("a.created_time");
|
|
List<StoreCommentVo> storeCommentVoList = storeCommentMapper.getCommentList(queryWrapper);
|
|
List<StoreCommentVo> storeCommentVoList = storeCommentMapper.getCommentList(queryWrapper);
|