|
|
@@ -10,6 +10,9 @@ import shop.alien.entity.store.LawyerLegalProblemScenario;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -235,5 +238,32 @@ public class LawyerConsultationOrderVO implements Serializable {
|
|
|
|
|
|
@ApiModelProperty(value = "举报处理结果")
|
|
|
private String reportResult;
|
|
|
+
|
|
|
+ @ApiModelProperty(value = "律师年限")
|
|
|
+ private Date practiceStartDate;
|
|
|
+ /**
|
|
|
+ * 获取执业年限(根据执业开始日期自动计算)
|
|
|
+ * 返回当前时间减去执业开始时间的年数
|
|
|
+ *
|
|
|
+ * @return 执业年限(年)
|
|
|
+ */
|
|
|
+ public Integer getPracticeYears() {
|
|
|
+ if (practiceStartDate == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ // 将 Date 转换为 LocalDate
|
|
|
+ LocalDate startDate = practiceStartDate.toInstant()
|
|
|
+ .atZone(ZoneId.systemDefault())
|
|
|
+ .toLocalDate();
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+
|
|
|
+ // 计算年数差
|
|
|
+ long years = ChronoUnit.YEARS.between(startDate, currentDate);
|
|
|
+ return (int) Math.max(0, years); // 确保不为负数
|
|
|
+ } catch (Exception e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|