|
@@ -0,0 +1,407 @@
|
|
|
|
|
+package shop.alien.lawyer.service.impl;
|
|
|
|
|
+
|
|
|
|
|
+import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
+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 lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.lang.math.RandomUtils;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
+import shop.alien.entity.result.R;
|
|
|
|
|
+import shop.alien.entity.store.LawyerConsultationOrder;
|
|
|
|
|
+import shop.alien.entity.store.LawyerServiceArea;
|
|
|
|
|
+import shop.alien.entity.store.LawyerUser;
|
|
|
|
|
+import shop.alien.entity.store.dto.LawyerConsultationOrderDto;
|
|
|
|
|
+import shop.alien.entity.store.dto.PayStatusRequest;
|
|
|
|
|
+import shop.alien.entity.store.vo.LawyerConsultationOrderVO;
|
|
|
|
|
+import shop.alien.lawyer.service.LawyerClientConsultationOrderService;
|
|
|
|
|
+import shop.alien.lawyer.service.LawyerConsultationOrderService;
|
|
|
|
|
+import shop.alien.lawyer.service.LawyerUserService;
|
|
|
|
|
+import shop.alien.lawyer.service.OrderExpirationService;
|
|
|
|
|
+import shop.alien.mapper.LawyerConsultationOrderMapper;
|
|
|
|
|
+import shop.alien.mapper.LawyerExpertiseAreaMapper;
|
|
|
|
|
+import shop.alien.mapper.LawyerServiceAreaMapper;
|
|
|
|
|
+import shop.alien.mapper.LawyerUserMapper;
|
|
|
|
|
+import shop.alien.util.common.constant.LawyerStatusEnum;
|
|
|
|
|
+
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
|
+import java.time.ZoneId;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 咨询订单 服务实现类
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author system
|
|
|
|
|
+ * @since 2025-01-XX
|
|
|
|
|
+ */
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+@Transactional
|
|
|
|
|
+@Service
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
|
+public class LawyerClientConsultationOrderServiceImpl extends ServiceImpl<LawyerConsultationOrderMapper, LawyerConsultationOrder> implements LawyerClientConsultationOrderService {
|
|
|
|
|
+
|
|
|
|
|
+ private final LawyerConsultationOrderMapper consultationOrderMapper;
|
|
|
|
|
+ private final LawyerUserService lawyerUserService;
|
|
|
|
|
+ private final LawyerServiceAreaMapper lawyerServiceAreaMapper;
|
|
|
|
|
+ private final LawyerUserMapper lawyerUserMapper;
|
|
|
|
|
+ private final OrderExpirationService orderExpirationService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除咨询订单
|
|
|
|
|
+ * <p>
|
|
|
|
|
+ * 删除前会进行以下校验:
|
|
|
|
|
+ * 1. 参数校验:订单ID不能为空
|
|
|
|
|
+ * 2. 订单存在性校验:订单必须存在
|
|
|
|
|
+ * 3. 订单状态校验:进行中的订单不允许删除
|
|
|
|
|
+ * 4. 如果订单是待支付状态,会取消Redis中的支付超时计时器
|
|
|
|
|
+ * </p>
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id 订单ID
|
|
|
|
|
+ * @return 删除结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public R<Boolean> deleteConsultationOrder(Integer id) {
|
|
|
|
|
+ log.info("开始删除咨询订单,订单ID={}", id);
|
|
|
|
|
+
|
|
|
|
|
+ // 参数校验
|
|
|
|
|
+ if (id == null) {
|
|
|
|
|
+ log.warn("删除咨询订单失败:订单ID为空");
|
|
|
|
|
+ return R.fail("订单ID不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询订单信息
|
|
|
|
|
+ LawyerConsultationOrder order = consultationOrderMapper.selectById(id);
|
|
|
|
|
+ if (order == null) {
|
|
|
|
|
+ log.warn("删除咨询订单失败:订单不存在,订单ID={}", id);
|
|
|
|
|
+ return R.fail("订单不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 检查订单状态:进行中的订单不允许删除
|
|
|
|
|
+ Integer orderStatus = order.getOrderStatus();
|
|
|
|
|
+ Integer inProgressStatus = LawyerStatusEnum.INPROGRESS.getStatus(); // 2:进行中
|
|
|
|
|
+ if (inProgressStatus.equals(orderStatus)) {
|
|
|
|
|
+ log.warn("删除咨询订单失败:订单进行中,不允许删除,订单ID={}, 订单编号={}",
|
|
|
|
|
+ id, order.getOrderNumber());
|
|
|
|
|
+ return R.fail("订单进行中,不允许删除");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如果订单是待支付状态,取消Redis中的订单支付超时计时
|
|
|
|
|
+ Integer waitPayStatus = LawyerStatusEnum.WAIT_PAY.getStatus(); // 0:待支付
|
|
|
|
|
+ if (waitPayStatus.equals(orderStatus) && order.getOrderNumber() != null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ orderExpirationService.cancelOrderPaymentTimeout(order.getOrderNumber());
|
|
|
|
|
+ log.info("已取消订单支付超时计时,订单编号={}", order.getOrderNumber());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("取消订单支付超时计时失败,订单编号={}", order.getOrderNumber(), e);
|
|
|
|
|
+ // 继续执行删除操作,不因取消计时器失败而中断
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 执行删除操作
|
|
|
|
|
+ boolean result = this.removeById(id);
|
|
|
|
|
+ if (result) {
|
|
|
|
|
+ log.info("删除咨询订单成功,订单ID={}, 订单编号={}", id, order.getOrderNumber());
|
|
|
|
|
+ return R.data(true, "删除成功");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.error("删除咨询订单失败:数据库操作失败,订单ID={}, 订单编号={}", id, order.getOrderNumber());
|
|
|
|
|
+ return R.fail("删除失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 填充律师服务领域信息到订单VO列表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param voPage 订单VO分页对象
|
|
|
|
|
+ */
|
|
|
|
|
+ private void fillLawyerServiceArea(IPage<LawyerConsultationOrderVO> voPage) {
|
|
|
|
|
+ List<LawyerConsultationOrderVO> orderList = voPage.getRecords();
|
|
|
|
|
+ if (CollectionUtils.isEmpty(orderList)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 提取所有律师ID
|
|
|
|
|
+ List<Integer> lawyerIdList = orderList.stream()
|
|
|
|
|
+ .map(LawyerConsultationOrderVO::getLawyerUserId)
|
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
|
+ .distinct()
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ if (CollectionUtils.isEmpty(lawyerIdList)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 批量查询律师问题场景
|
|
|
|
|
+ Map<String, List<String>> serviceAreaMap = getLawyerServiceArea(lawyerIdList);
|
|
|
|
|
+ if (serviceAreaMap.isEmpty()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 填充问题场景
|
|
|
|
|
+ orderList.forEach(order -> {
|
|
|
|
|
+ Integer lawyerUserId = order.getLawyerUserId();
|
|
|
|
|
+ if (lawyerUserId != null) {
|
|
|
|
|
+ String lawyerUserIdStr = String.valueOf(lawyerUserId);
|
|
|
|
|
+ List<String> serviceAreaList = serviceAreaMap.get(lawyerUserIdStr);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(serviceAreaList)) {
|
|
|
|
|
+ order.setLawyerLegalProblemScenarioList(serviceAreaList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 批量查询律师问题场景
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param lawyerIdList 律师ID列表
|
|
|
|
|
+ * @return 律师问题场景Map,key为律师ID(String),value为问题场景名称列表
|
|
|
|
|
+ */
|
|
|
|
|
+ private Map<String, List<String>> getLawyerServiceArea(List<Integer> lawyerIdList) {
|
|
|
|
|
+ Map<String, List<String>> serviceAreaMap = new HashMap<>();
|
|
|
|
|
+ if (CollectionUtils.isEmpty(lawyerIdList)) {
|
|
|
|
|
+ return serviceAreaMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ QueryWrapper<LawyerServiceArea> wrapper = new QueryWrapper<>();
|
|
|
|
|
+ wrapper.in("lsa.lawyer_user_id", lawyerIdList)
|
|
|
|
|
+ .eq("lsa.delete_flag", 0)
|
|
|
|
|
+ .eq("lsa.status", 1);
|
|
|
|
|
+
|
|
|
|
|
+ List<Map<String, Object>> serviceAreaDataList = lawyerServiceAreaMapper.getLawyerLegalProblemScenarioList(wrapper);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(serviceAreaDataList)) {
|
|
|
|
|
+ return serviceAreaMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (Map<String, Object> row : serviceAreaDataList) {
|
|
|
|
|
+ Object lawyerUserIdObj = row.get("lawyer_user_id");
|
|
|
|
|
+ if (lawyerUserIdObj == null) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String lawyerUserId = String.valueOf(lawyerUserIdObj);
|
|
|
|
|
+ String scenarioName = (String) row.get("name");
|
|
|
|
|
+ String scenarioNameValue = StringUtils.hasText(scenarioName) ? scenarioName : "";
|
|
|
|
|
+
|
|
|
|
|
+ serviceAreaMap.computeIfAbsent(lawyerUserId, k -> new ArrayList<>())
|
|
|
|
|
+ .add(scenarioNameValue);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return serviceAreaMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取咨询订单详情
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param lawyerOrderId 订单ID
|
|
|
|
|
+ * @return 咨询订单详情VO
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public LawyerConsultationOrderVO getConsultationOrderDetail(String lawyerOrderId) {
|
|
|
|
|
+ log.info("LawyerConsultationOrderServiceImpl.getConsultationOrderDetail?lawyerOrderId={}", lawyerOrderId);
|
|
|
|
|
+
|
|
|
|
|
+ LawyerConsultationOrderVO orderVO = new LawyerConsultationOrderVO();
|
|
|
|
|
+
|
|
|
|
|
+ // 参数校验
|
|
|
|
|
+ if (!StringUtils.hasText(lawyerOrderId)) {
|
|
|
|
|
+ return orderVO;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询订单信息
|
|
|
|
|
+ LawyerConsultationOrder order = consultationOrderMapper.selectById(lawyerOrderId);
|
|
|
|
|
+ if (order == null) {
|
|
|
|
|
+ return orderVO;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 复制订单基本信息
|
|
|
|
|
+ BeanUtils.copyProperties(order, orderVO);
|
|
|
|
|
+
|
|
|
|
|
+ // 查询并填充律师信息
|
|
|
|
|
+ Integer lawyerUserId = order.getLawyerUserId();
|
|
|
|
|
+ if (lawyerUserId != null) {
|
|
|
|
|
+ LawyerUser lawyerUser = lawyerUserMapper.selectById(lawyerUserId);
|
|
|
|
|
+ if (lawyerUser != null) {
|
|
|
|
|
+ fillLawyerInfo(orderVO, lawyerUser);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 查询律师问题场景
|
|
|
|
|
+ List<Integer> lawyerIdList = Collections.singletonList(lawyerUserId);
|
|
|
|
|
+ Map<String, List<String>> serviceAreaMap = getLawyerServiceArea(lawyerIdList);
|
|
|
|
|
+ String lawyerUserIdStr = String.valueOf(lawyerUserId);
|
|
|
|
|
+ if (!serviceAreaMap.isEmpty() && serviceAreaMap.containsKey(lawyerUserIdStr)) {
|
|
|
|
|
+ orderVO.setLawyerLegalProblemScenarioList(serviceAreaMap.get(lawyerUserIdStr));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return orderVO;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询咨询订单信息(律师端)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param pageNum 页码
|
|
|
|
|
+ * @param pageSize 页容
|
|
|
|
|
+ * @param startDate 开始时间
|
|
|
|
|
+ * @param endDate 结束时间
|
|
|
|
|
+ * @param lawyerId 律师ID
|
|
|
|
|
+ * @return 订单信息Map,包含订单列表、总数、进行中数量、已完成数量
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<String, Object> getLawyerConsultationOrderInfo(int pageNum, int pageSize, String startDate, String endDate, String clientUserName, String orderStatus, String lawyerId) {
|
|
|
|
|
+ log.info("LawyerConsultationOrderServiceImpl.getLawyerConsultationOrderInfo?pageNum={},pageSize={},startDate={},endDate={},clientUserName={},lawyerId={}",
|
|
|
|
|
+ pageNum, pageSize, startDate, endDate, clientUserName, lawyerId);
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 参数校验:律师ID不能为空
|
|
|
|
|
+ if (!StringUtils.hasText(lawyerId)) {
|
|
|
|
|
+ log.warn("查询咨询订单信息失败:律师ID为空");
|
|
|
|
|
+ Page<LawyerConsultationOrderVO> emptyPage = new Page<>(pageNum, pageSize);
|
|
|
|
|
+ emptyPage.setRecords(Collections.emptyList());
|
|
|
|
|
+ emptyPage.setTotal(0);
|
|
|
|
|
+ resultMap.put("lawyerOrderCount", 0L);
|
|
|
|
|
+ resultMap.put("lawyerInProgressOrderCount", 0);
|
|
|
|
|
+ resultMap.put("lawyerCompleteOrderCount", 0);
|
|
|
|
|
+ resultMap.put("lawyerConsultationOrderList", Collections.emptyList());
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 创建分页对象
|
|
|
|
|
+ Page<LawyerConsultationOrderVO> page = new Page<>(pageNum, pageSize);
|
|
|
|
|
+
|
|
|
|
|
+ // 构建查询条件:查询进行中(2)和已完成(3)状态的订单
|
|
|
|
|
+ QueryWrapper<LawyerConsultationOrderVO> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ QueryWrapper<LawyerConsultationOrderVO> queryStatisticsWrapper = new QueryWrapper<>();
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.hasText(orderStatus)){
|
|
|
|
|
+ queryWrapper.in("lco.order_status", Collections.singletonList(orderStatus));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ queryWrapper.in("lco.order_status", Arrays.asList("2", "3"));
|
|
|
|
|
+ }
|
|
|
|
|
+ queryWrapper.eq("lco.lawyer_user_id", lawyerId);
|
|
|
|
|
+ queryStatisticsWrapper.eq("lco.lawyer_user_id", lawyerId);
|
|
|
|
|
+ if(StringUtils.hasText(clientUserName)){
|
|
|
|
|
+ queryWrapper.like("lur.user_name", clientUserName);
|
|
|
|
|
+ queryStatisticsWrapper.like("lur.user_name", clientUserName);
|
|
|
|
|
+ }
|
|
|
|
|
+ queryWrapper.eq("lco.delete_flag", 0);
|
|
|
|
|
+ queryStatisticsWrapper.eq("lco.delete_flag", 0);
|
|
|
|
|
+ queryWrapper.orderByDesc("lco.created_time");
|
|
|
|
|
+ // 时间范围查询:如果开始时间和结束时间都存在,则进行范围查询
|
|
|
|
|
+ if (StringUtils.hasText(startDate) && StringUtils.hasText(endDate)) {
|
|
|
|
|
+ queryWrapper.between("lco.payment_time", startDate + " 00:00:00", endDate + " 23:59:59");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询订单列表
|
|
|
|
|
+ IPage<LawyerConsultationOrderVO> voPage = consultationOrderMapper.getLawyerConsultationOrderList(page, queryWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ // 填充律师问题场景信息
|
|
|
|
|
+ if (voPage != null) {
|
|
|
|
|
+ fillLawyerServiceArea(voPage);
|
|
|
|
|
+ // 为待支付订单计算倒计时(30分钟有效期)
|
|
|
|
|
+ calculateCountdownForPendingOrders(voPage);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //获取统计信息
|
|
|
|
|
+ queryStatisticsWrapper.groupBy("lco.order_status");
|
|
|
|
|
+ List<Map<String, Object>> statisticsInfo = consultationOrderMapper.getLawyerStatisticsInfo(queryStatisticsWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ Map<Integer, Integer> statusCountMap = new HashMap<>();
|
|
|
|
|
+ for (Map<String, Object> map : statisticsInfo) {
|
|
|
|
|
+ Integer status = (Integer) map.get("order_status");
|
|
|
|
|
+ Long countLong = (Long) map.get("order_count"); // COUNT(*) 返回类型可能是Long
|
|
|
|
|
+ statusCountMap.put(status, countLong.intValue());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 统计进行中订单数量
|
|
|
|
|
+ int inProgressCount = statusCountMap.getOrDefault(2, 0);
|
|
|
|
|
+ resultMap.put("lawyerInProgressOrderCount", inProgressCount);
|
|
|
|
|
+
|
|
|
|
|
+ // 统计已完成订单数量
|
|
|
|
|
+ int completeCount = statusCountMap.getOrDefault(3, 0);
|
|
|
|
|
+ resultMap.put("lawyerCompleteOrderCount", completeCount);
|
|
|
|
|
+
|
|
|
|
|
+ // 统计订单总数
|
|
|
|
|
+ resultMap.put("lawyerOrderCount", inProgressCount + completeCount);
|
|
|
|
|
+
|
|
|
|
|
+ // 设置订单列表
|
|
|
|
|
+ List<LawyerConsultationOrderVO> orderList = voPage != null && voPage.getRecords() != null
|
|
|
|
|
+ ? voPage.getRecords() : Collections.emptyList();
|
|
|
|
|
+ resultMap.put("lawyerConsultationOrderList", orderList);
|
|
|
|
|
+
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 为待支付订单计算倒计时(30分钟有效期)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param voPage 订单分页对象
|
|
|
|
|
+ */
|
|
|
|
|
+ private void calculateCountdownForPendingOrders(IPage<LawyerConsultationOrderVO> voPage) {
|
|
|
|
|
+ if (voPage == null || voPage.getRecords() == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Date now = new Date();
|
|
|
|
|
+ long validitySeconds = 30 * 60; // 30分钟 = 1800秒
|
|
|
|
|
+
|
|
|
|
|
+ for (LawyerConsultationOrderVO vo : voPage.getRecords()) {
|
|
|
|
|
+ // 仅对待支付订单(orderStatus=0)计算倒计时
|
|
|
|
|
+ if (vo.getOrderStatus() != null && vo.getOrderStatus() == 0) {
|
|
|
|
|
+ Date orderTime = vo.getOrderTime();
|
|
|
|
|
+ if (orderTime != null) {
|
|
|
|
|
+ long elapsedSeconds = (now.getTime() - orderTime.getTime()) / 1000;
|
|
|
|
|
+ long remainingSeconds = validitySeconds - elapsedSeconds;
|
|
|
|
|
+ // 如果已过期,设置为0
|
|
|
|
|
+ vo.setCountdownSeconds(Math.max(0, remainingSeconds));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ vo.setCountdownSeconds(0L);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 非待支付订单,倒计时为null
|
|
|
|
|
+ vo.setCountdownSeconds(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 填充律师信息到订单VO
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param orderVO 订单VO对象
|
|
|
|
|
+ * @param lawyerUser 律师用户对象
|
|
|
|
|
+ */
|
|
|
|
|
+ private void fillLawyerInfo(LawyerConsultationOrderVO orderVO, LawyerUser lawyerUser) {
|
|
|
|
|
+ orderVO.setLawyerName(lawyerUser.getName());
|
|
|
|
|
+ orderVO.setLawyerPhone(lawyerUser.getPhone());
|
|
|
|
|
+ orderVO.setLawyerEmail(lawyerUser.getEmail());
|
|
|
|
|
+ orderVO.setLawyerCertificateNo(lawyerUser.getLawyerCertificateNo());
|
|
|
|
|
+ orderVO.setLawFirm(lawyerUser.getLawFirm());
|
|
|
|
|
+ orderVO.setPracticeYears(lawyerUser.getPracticeYears());
|
|
|
|
|
+ orderVO.setSpecialtyFields(lawyerUser.getSpecialtyFields());
|
|
|
|
|
+ orderVO.setCertificationStatus(lawyerUser.getCertificationStatus());
|
|
|
|
|
+ orderVO.setServiceCount(lawyerUser.getServiceCount());
|
|
|
|
|
+ orderVO.setServiceScore(lawyerUser.getServiceScore());
|
|
|
|
|
+ orderVO.setLawyerConsultationFee(lawyerUser.getConsultationFee());
|
|
|
|
|
+ orderVO.setProvince(lawyerUser.getProvince());
|
|
|
|
|
+ orderVO.setCity(lawyerUser.getCity());
|
|
|
|
|
+ orderVO.setDistrict(lawyerUser.getDistrict());
|
|
|
|
|
+ orderVO.setAddress(lawyerUser.getAddress());
|
|
|
|
|
+ orderVO.setHeadImg(lawyerUser.getHeadImg());
|
|
|
|
|
+ orderVO.setNickName(lawyerUser.getNickName());
|
|
|
|
|
+ orderVO.setPersonalIntroduction(lawyerUser.getPersonalIntroduction());
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|