|
@@ -1,6 +1,8 @@
|
|
|
package shop.alien.store.service.impl;
|
|
package shop.alien.store.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
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.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
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;
|
|
@@ -14,9 +16,12 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
import shop.alien.entity.result.R;
|
|
import shop.alien.entity.result.R;
|
|
|
import shop.alien.entity.store.LawyerConsultationOrder;
|
|
import shop.alien.entity.store.LawyerConsultationOrder;
|
|
|
|
|
+import shop.alien.entity.store.LawyerServiceArea;
|
|
|
import shop.alien.entity.store.LawyerUser;
|
|
import shop.alien.entity.store.LawyerUser;
|
|
|
import shop.alien.entity.store.vo.LawyerConsultationOrderVO;
|
|
import shop.alien.entity.store.vo.LawyerConsultationOrderVO;
|
|
|
|
|
+import shop.alien.entity.store.vo.LifeCouponVo;
|
|
|
import shop.alien.mapper.LawyerConsultationOrderMapper;
|
|
import shop.alien.mapper.LawyerConsultationOrderMapper;
|
|
|
|
|
+import shop.alien.mapper.LawyerServiceAreaMapper;
|
|
|
import shop.alien.store.service.LawyerConsultationOrderService;
|
|
import shop.alien.store.service.LawyerConsultationOrderService;
|
|
|
import shop.alien.store.service.LawyerUserService;
|
|
import shop.alien.store.service.LawyerUserService;
|
|
|
|
|
|
|
@@ -39,6 +44,7 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
|
|
|
|
|
|
|
|
private final LawyerConsultationOrderMapper consultationOrderMapper;
|
|
private final LawyerConsultationOrderMapper consultationOrderMapper;
|
|
|
private final LawyerUserService lawyerUserService;
|
|
private final LawyerUserService lawyerUserService;
|
|
|
|
|
+ private final LawyerServiceAreaMapper lawyerServiceAreaMapper;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public R<IPage<LawyerConsultationOrderVO>> getConsultationOrderList(int pageNum, int pageSize, String orderNumber,
|
|
public R<IPage<LawyerConsultationOrderVO>> getConsultationOrderList(int pageNum, int pageSize, String orderNumber,
|
|
@@ -254,5 +260,66 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
|
|
|
return R.fail("失败");
|
|
return R.fail("失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R<IPage<LawyerConsultationOrderVO>> getConsultationOrderListById(int pageNum, int pageSize, String userId, String orderStatus ,String lawyerName) {
|
|
|
|
|
+
|
|
|
|
|
+ Page<LawyerConsultationOrderVO> page = new Page<>(pageNum, pageSize);
|
|
|
|
|
+ // 如果按律師姓名搜索,先查詢匹配的律師ID列表
|
|
|
|
|
+ List<Integer> lawyerUserIds = null;
|
|
|
|
|
+ if (StringUtils.hasText(lawyerName)) {
|
|
|
|
|
+ LambdaQueryWrapper<LawyerUser> lawyerQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lawyerQueryWrapper.eq(LawyerUser::getDeleteFlag, 0);
|
|
|
|
|
+ lawyerQueryWrapper.like(LawyerUser::getName, lawyerName);
|
|
|
|
|
+ List<LawyerUser> lawyerUsers = lawyerUserService.list(lawyerQueryWrapper);
|
|
|
|
|
+ if (lawyerUsers != null && !lawyerUsers.isEmpty()) {
|
|
|
|
|
+ lawyerUserIds = lawyerUsers.stream()
|
|
|
|
|
+ .map(LawyerUser::getId)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果沒有找到匹配的律師,返回空結果
|
|
|
|
|
+ Page<LawyerConsultationOrderVO> emptyPage = new Page<>(pageNum, pageSize);
|
|
|
|
|
+ emptyPage.setRecords(Collections.emptyList());
|
|
|
|
|
+ emptyPage.setTotal(0);
|
|
|
|
|
+ return R.data(emptyPage);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询订单列表
|
|
|
|
|
+ IPage<LawyerConsultationOrderVO> voPage = consultationOrderMapper.getConsultationOrderListById(
|
|
|
|
|
+ page, userId, orderStatus, lawyerUserIds);
|
|
|
|
|
+ List<LawyerConsultationOrderVO> lawyerConsultationOrderVOS = voPage.getRecords();
|
|
|
|
|
+ if(CollectionUtils.isNotEmpty(lawyerConsultationOrderVOS)){
|
|
|
|
|
+ List<Integer> lawyerIdList = lawyerConsultationOrderVOS.stream()
|
|
|
|
|
+ .map(LawyerConsultationOrderVO::getLawyerUserId)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ if(CollectionUtils.isNotEmpty(lawyerIdList)){
|
|
|
|
|
+ QueryWrapper<LawyerServiceArea> wrapper = new QueryWrapper<>();
|
|
|
|
|
+ wrapper.in("lsa.lawyer_user_id", lawyerIdList);
|
|
|
|
|
+ wrapper.in("lsa.delete_flag", 0);
|
|
|
|
|
+ wrapper.in("lsa.status", 1);
|
|
|
|
|
+
|
|
|
|
|
+ List<Map<String, Object>> lawyerLegalProblemScenarioData = lawyerServiceAreaMapper.getLawyerLegalProblemScenarioList(wrapper);
|
|
|
|
|
+ Map<String, List<String>> lawyerLegalProblemScenarioLawyer = new HashMap<>();
|
|
|
|
|
+ for (Map<String, Object> row : lawyerLegalProblemScenarioData) {
|
|
|
|
|
+ String lawyerUserId = String.valueOf(row.get("lawyer_user_id"));
|
|
|
|
|
+ String ScenarioName = (String) row.get("name");
|
|
|
|
|
+ if (lawyerUserId != null) {
|
|
|
|
|
+ lawyerLegalProblemScenarioLawyer.computeIfAbsent(lawyerUserId, k -> new ArrayList<>())
|
|
|
|
|
+ .add(ScenarioName != null ? ScenarioName : "");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(!lawyerLegalProblemScenarioLawyer.isEmpty()){
|
|
|
|
|
+ voPage.getRecords().forEach(entity -> {
|
|
|
|
|
+ String lawyerUserId = String.valueOf(entity.getLawyerUserId());
|
|
|
|
|
+ if(lawyerLegalProblemScenarioLawyer.containsKey(lawyerUserId)){
|
|
|
|
|
+ entity.setLawyerLegalProblemScenarioList(lawyerLegalProblemScenarioLawyer.get(lawyerUserId));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.data(voPage);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|