|
|
@@ -14,12 +14,9 @@ import shop.alien.entity.store.*;
|
|
|
import shop.alien.entity.store.vo.ExpertGoodsTypeVo;
|
|
|
import shop.alien.entity.store.vo.LifeUserExpertOrderVo;
|
|
|
import shop.alien.entity.store.vo.LifeUserExpertVo;
|
|
|
-import shop.alien.mapper.LifeNoticeMapper;
|
|
|
-import shop.alien.mapper.LifeUserExpertMapper;
|
|
|
-import shop.alien.mapper.LifeUserExpertOrderMapper;
|
|
|
-import shop.alien.mapper.LifeUserExpertWorksMapper;
|
|
|
-import shop.alien.store.service.LifeUserExpertOrderService;
|
|
|
+import shop.alien.mapper.*;
|
|
|
import shop.alien.store.service.LifeUserExpertService;
|
|
|
+import shop.alien.util.common.ListToPage;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
@@ -46,7 +43,7 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
|
|
|
private final LifeUserExpertMapper lifeUserExpertMapper;
|
|
|
|
|
|
private final LifeUserExpertWorksMapper lifeUserExpertWorksMapper;
|
|
|
- private final LifeUserExpertOrderService lifeUserExpertOrderService;
|
|
|
+ private final ExpertImgMapper expertImgMapper;
|
|
|
private final LifeUserExpertOrderMapper lifeUserExpertOrderMapper;
|
|
|
private final LifeNoticeMapper lifeNoticeMapper;
|
|
|
|
|
|
@@ -76,25 +73,32 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean becomeExpert(Integer id, String userPhone ,String comment ,Integer expertStatus) {
|
|
|
+ public boolean becomeExpert(Integer id, String userPhone, String comment, Integer expertStatus ,Integer commissionRate, Integer advanceRate) {
|
|
|
LambdaQueryWrapper<LifeUserExpert> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(LifeUserExpert::getId, id);
|
|
|
- wrapper.eq(LifeUserExpert::getDeleteFlag, 1);
|
|
|
- LifeUserExpert lifeUserExpert = lifeUserExpertMapper.selectIsExpert(id);
|
|
|
- if (lifeUserExpert != null) {
|
|
|
- lifeUserExpert.setDeleteFlag(0);
|
|
|
- lifeUserExpert.setExpertStatus(expertStatus);
|
|
|
- return lifeUserExpertMapper.updateExpert(lifeUserExpert);
|
|
|
+ LifeUserExpert lifeUserExpert = lifeUserExpertMapper.selectIsExpertById(id);
|
|
|
+ if (lifeUserExpert == null) {
|
|
|
+ return false;
|
|
|
}
|
|
|
- LifeUserExpert expert = new LifeUserExpert();
|
|
|
- expert.setId(id);
|
|
|
- expert.setExpertStatus(expertStatus);
|
|
|
- if (expertStatus == 0){
|
|
|
- expert.setExpertCode(setExpertCode());
|
|
|
- } else if(expertStatus == 2){
|
|
|
- expert.setExpertCode(null);
|
|
|
- expert.setDeleteFlag(1);
|
|
|
+ lifeUserExpert.setDeleteFlag(0);
|
|
|
+ lifeUserExpert.setExpertStatus(expertStatus);
|
|
|
+ lifeUserExpert.setReviewTime(new Date());
|
|
|
+ lifeUserExpert.setUpdatedTime(new Date());
|
|
|
+ if (expertStatus == 0) {
|
|
|
+ lifeUserExpert.setRefuseBecause(null);
|
|
|
+ lifeUserExpert.setExpertCode(setExpertCode());
|
|
|
+ lifeUserExpert.setCommissionRate(commissionRate);
|
|
|
+ lifeUserExpert.setAdvanceRate(advanceRate);
|
|
|
+ } else if (expertStatus == 2) {
|
|
|
+ lifeUserExpert.setRefuseBecause(comment);
|
|
|
+ lifeUserExpert.setExpertStatus(2);
|
|
|
}
|
|
|
+ sendMessage(expertStatus, userPhone, comment);
|
|
|
+ return lifeUserExpertMapper.updateExpert(lifeUserExpert);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void sendMessage(Integer expertStatus,String userPhone ,String comment) {
|
|
|
LifeNotice lifeMessage = new LifeNotice();
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
String formattedDate = LocalDateTime.now().format(formatter);
|
|
|
@@ -123,7 +127,6 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
|
|
|
lifeMessage.setSenderId("system");
|
|
|
lifeNoticeMapper.insert(lifeMessage);
|
|
|
}
|
|
|
- return lifeUserExpertMapper.updateExpert(expert);
|
|
|
}
|
|
|
|
|
|
public Integer setExpertCode() {
|
|
|
@@ -346,16 +349,50 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IPage<LifeUserExpertVo> getApplicationExpertList(int page, int size, String userName, String expertCode, Integer userId) {
|
|
|
+ public IPage<LifeUserExpertVo> getApplicationExpertList(Integer page, Integer size, String userName, String realName, String userPhone, Integer expertStatus, String createdTime, String endTime , Integer userId) {
|
|
|
QueryWrapper<LifeUserExpertVo> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("expert.delete_flag", 0);
|
|
|
wrapper.eq("user.delete_flag", 0);
|
|
|
- wrapper.eq(userId != null, "user.id", userId);
|
|
|
- wrapper.eq( "expert.expert_status", 1);
|
|
|
+ wrapper.eq(userId != null, "expert.user_id", userId);
|
|
|
wrapper.like(StringUtils.isNotEmpty(userName), "user.user_name", userName);
|
|
|
- wrapper.like(StringUtils.isNotEmpty(expertCode), "expert.expert_code", expertCode);
|
|
|
- wrapper.orderByDesc("accountMoney");
|
|
|
- return lifeUserExpertMapper.getApplicationExpertList(new Page<>(page, size), wrapper);
|
|
|
+ wrapper.like(StringUtils.isNotEmpty(realName), "user.real_name", realName);
|
|
|
+ wrapper.like(StringUtils.isNotEmpty(userPhone), "user.user_phone", userPhone);
|
|
|
+ //查询在createdTime之后的数据
|
|
|
+ if (createdTime != null && !createdTime.isEmpty()){
|
|
|
+ wrapper.gt("expert.created_time", createdTime);
|
|
|
+ }
|
|
|
+// wrapper.gt(createdTime != null, "expert.created_time", createdTime);
|
|
|
+// //查询在createdTime之前数据
|
|
|
+ if (endTime != null && !endTime.isEmpty()) {
|
|
|
+ wrapper.lt("expert.created_time", endTime);
|
|
|
+ }
|
|
|
+// wrapper.lt(endTime != null, "expert.created_time", endTime);
|
|
|
+ List<LifeUserExpertVo> a=lifeUserExpertMapper.getApplicationExpertList( wrapper);
|
|
|
+ List<LifeUserExpertVo> list = a.stream()
|
|
|
+ .distinct()
|
|
|
+ .sorted(Comparator.comparing(LifeUserExpertVo::getCreatedTime).reversed())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return ListToPage.setPage(list,page, size);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public LifeUserExpertVo getViewDetails(Integer userId) {
|
|
|
+ QueryWrapper<ExpertImg> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("user_id", userId);
|
|
|
+ List<ExpertImg> list =expertImgMapper.selectList( wrapper);
|
|
|
+ //对list进行处理,提取图片路径,添加到一个新的String中,用,分割
|
|
|
+ String imgUrl = list.stream()
|
|
|
+ .map(ExpertImg::getImgUrl)
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ list.forEach(expertImg -> expertImg.setImgUrl(imgUrl));
|
|
|
+ LifeUserExpertVo expertVo=lifeUserExpertMapper.getViewDetails(userId);
|
|
|
+ expertVo.setImgUrl(imgUrl);
|
|
|
+ if (CollectionUtils.isEmpty(list)){
|
|
|
+ return expertVo;
|
|
|
+ }
|
|
|
+ String promoteType=list.get(0).getPromoteType();
|
|
|
+ expertVo.setPromoteType(promoteType);
|
|
|
+ return expertVo;
|
|
|
}
|
|
|
|
|
|
}
|