|
@@ -8,12 +8,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import net.sf.jsqlparser.expression.StringValue;
|
|
|
|
|
import org.apache.commons.lang.math.RandomUtils;
|
|
import org.apache.commons.lang.math.RandomUtils;
|
|
|
-import org.apache.commons.lang.time.DateUtils;
|
|
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-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;
|
|
@@ -21,7 +19,6 @@ import shop.alien.entity.store.LawyerServiceArea;
|
|
|
import shop.alien.entity.store.LawyerUser;
|
|
import shop.alien.entity.store.LawyerUser;
|
|
|
import shop.alien.entity.store.dto.LawyerConsultationOrderDto;
|
|
import shop.alien.entity.store.dto.LawyerConsultationOrderDto;
|
|
|
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.mapper.LawyerServiceAreaMapper;
|
|
|
import shop.alien.mapper.LawyerUserMapper;
|
|
import shop.alien.mapper.LawyerUserMapper;
|
|
@@ -54,7 +51,7 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public R<IPage<LawyerConsultationOrderVO>> getConsultationOrderList(int pageNum, int pageSize, String orderNumber,
|
|
public R<IPage<LawyerConsultationOrderVO>> getConsultationOrderList(int pageNum, int pageSize, String orderNumber,
|
|
|
- Integer clientUserId, Integer lawyerUserId, String lawyerName, Integer orderStatus) {
|
|
|
|
|
|
|
+ Integer clientUserId, Integer lawyerUserId, String lawyerName, Integer orderStatus) {
|
|
|
log.info("LawyerConsultationOrderServiceImpl.getConsultationOrderList?pageNum={},pageSize={},orderNumber={},clientUserId={},lawyerUserId={},lawyerName={},orderStatus={}",
|
|
log.info("LawyerConsultationOrderServiceImpl.getConsultationOrderList?pageNum={},pageSize={},orderNumber={},clientUserId={},lawyerUserId={},lawyerName={},orderStatus={}",
|
|
|
pageNum, pageSize, orderNumber, clientUserId, lawyerUserId, lawyerName, orderStatus);
|
|
pageNum, pageSize, orderNumber, clientUserId, lawyerUserId, lawyerName, orderStatus);
|
|
|
|
|
|
|
@@ -85,6 +82,30 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
|
|
|
IPage<LawyerConsultationOrderVO> voPage = consultationOrderMapper.getConsultationOrderListWithLawyer(
|
|
IPage<LawyerConsultationOrderVO> voPage = consultationOrderMapper.getConsultationOrderListWithLawyer(
|
|
|
page, orderNumber, clientUserId, lawyerUserId, lawyerName, orderStatus, lawyerUserIds);
|
|
page, orderNumber, clientUserId, lawyerUserId, lawyerName, orderStatus, lawyerUserIds);
|
|
|
|
|
|
|
|
|
|
+ // 為待支付訂單計算倒計時(30分鐘有效期)
|
|
|
|
|
+ if (voPage != null && voPage.getRecords() != null) {
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return R.data(voPage);
|
|
return R.data(voPage);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -326,6 +347,30 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
|
|
|
|
|
|
|
|
// 填充律师问题场景信息
|
|
// 填充律师问题场景信息
|
|
|
fillLawyerServiceArea(voPage);
|
|
fillLawyerServiceArea(voPage);
|
|
|
|
|
+
|
|
|
|
|
+ // 為待支付訂單計算倒計時(30分鐘有效期)
|
|
|
|
|
+ if (voPage != null && voPage.getRecords() != null) {
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return R.data(voPage);
|
|
return R.data(voPage);
|
|
|
}
|
|
}
|