Browse Source

fix:优化

master
wang 2 weeks ago
parent
commit
f839419113
  1. 53
      yun-admin/src/main/java/net/lab1024/sa/admin/module/cost/controller/FirmReportsController.java
  2. 10
      yun-admin/src/main/java/net/lab1024/sa/admin/module/service/dao/ServiceApplicationsDao.java
  3. 7
      yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/entity/ServiceApplicationsEntity.java
  4. 16
      yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/form/LawyerStatisticsQueryForm.java
  5. 7
      yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/form/ServiceApplicationsQueryForm.java
  6. 5
      yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/vo/ServiceApplicationsVO.java
  7. 1521
      yun-admin/src/main/java/net/lab1024/sa/admin/module/service/service/ServiceApplicationsService.java
  8. 25
      yun-admin/src/main/java/net/lab1024/sa/admin/util/DateTimeUtil.java
  9. 5
      yun-admin/src/main/resources/dev/application.yaml
  10. 336
      yun-admin/src/main/resources/mapper/service/ServiceApplicationsMapper.xml
  11. 5
      yun-admin/src/main/resources/pre/application.yaml
  12. 5
      yun-admin/src/main/resources/prod/application.yaml
  13. 5
      yun-admin/src/main/resources/test/application.yaml
  14. 10
      yun-base/src/main/resources/dev/yun-base.yaml
  15. 4
      yun-base/src/main/resources/pre/yun-base.yaml
  16. 4
      yun-base/src/main/resources/prod/yun-base.yaml
  17. 4
      yun-base/src/main/resources/test/yun-base.yaml

53
yun-admin/src/main/java/net/lab1024/sa/admin/module/cost/controller/FirmReportsController.java

@ -143,64 +143,15 @@ public class FirmReportsController {
throw new IllegalArgumentException("月份必须在1-12之间");
}
// 使用指定的年月创建日期对象进行判断
Month targetMonth = Month.of(month);
int dayOfMonth = 1; // 默认使用月份第一天进行判断
// 第一季度:1月-3月,或4月1日-4月4日
if (targetMonth.getValue() < 4 || (targetMonth.getValue() == 4 && dayOfMonth < 5)) {
return 1;
}
// 第二季度:4月5日-6月30日,或7月1日-7月4日
else if ((targetMonth.getValue() == 4 && dayOfMonth >= 5) ||
(targetMonth.getValue() > 4 && targetMonth.getValue() < 7) ||
(targetMonth.getValue() == 7 && dayOfMonth < 5)) {
return 2;
}
// 第三季度:7月5日-9月30日,或10月1日-10月4日
else if ((targetMonth.getValue() == 7 && dayOfMonth >= 5) ||
(targetMonth.getValue() > 7 && targetMonth.getValue() < 10) ||
(targetMonth.getValue() == 10 && dayOfMonth < 5)) {
return 3;
}
// 第四季度:10月5日-12月31日(包含跨年情况)
else {
return 4;
}
return (month - 1) / 3 + 1;
}
/**
* 根据当前日期判断所属季度已考虑跨年情况
* 第一季度1月1日-4月4日
* 第二季度4月5日-7月4日
* 第三季度7月5日-10月4日
* 第四季度10月5日-12月31日
* @return 季度编号(1-4)
*/
private int getCurrentQuarter() {
LocalDate today = LocalDate.now();
Month month = today.getMonth();
int dayOfMonth = today.getDayOfMonth();
// 第一季度:1月-3月,或4月1日-4月4日
if (month.getValue() < 4 || (month.getValue() == 4 && dayOfMonth < 5)) {
return 1;
}
// 第二季度:4月5日-6月30日,或7月1日-7月4日
else if ((month.getValue() == 4 && dayOfMonth >= 5) ||
(month.getValue() > 4 && month.getValue() < 7) ||
(month.getValue() == 7 && dayOfMonth < 5)) {
return 2;
}
// 第三季度:7月5日-9月30日,或10月1日-10月4日
else if ((month.getValue() == 7 && dayOfMonth >= 5) ||
(month.getValue() > 7 && month.getValue() < 10) ||
(month.getValue() == 10 && dayOfMonth < 5)) {
return 3;
}
// 第四季度:10月5日-12月31日(包含跨年情况)
else {
return 4;
}
return (today.getMonthValue() - 1) / 3 + 1;
}
}

10
yun-admin/src/main/java/net/lab1024/sa/admin/module/service/dao/ServiceApplicationsDao.java

@ -174,6 +174,11 @@ public interface ServiceApplicationsDao extends BaseMapper<ServiceApplicationsEn
*/
List<LawyerActivityCountVO> getLawyerActivityDetail(@Param("userId") Long userId, @Param("queryForm") LawyerStatisticsQueryFormPage queryForm);
/**
* 批量查询多个律师的活动统计避免N+1查询
*/
List<LawyerActivityCountVO> getLawyerActivityDetailBatch(@Param("userIds") List<Long> userIds, @Param("queryForm") LawyerStatisticsQueryFormPage queryForm);
/**
* 查询律所列表分页按活动总数排序
*/
@ -240,4 +245,9 @@ public interface ServiceApplicationsDao extends BaseMapper<ServiceApplicationsEn
List<ServiceApplicationsVO> queryByFirmIdAndTimeRange(@Param("firmId") Long firmId,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
/**
* 获取指定前缀的最大备案编号
*/
String getMaxFilingNo(@Param("prefix") String prefix);
}

7
yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/entity/ServiceApplicationsEntity.java

@ -123,10 +123,15 @@ public class ServiceApplicationsEntity {
private LocalDateTime associationAuditTime;
/**
* 备案编号
* 备案编号原有 recordNo 被用作案件编号/案号因此新建 filingNo 作为真正的备案编号
*/
private String recordNo;
/**
* 备案编号
*/
private String filingNo;
/**
* 备案状态0-未备案1-已备案
*/

16
yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/form/LawyerStatisticsQueryForm.java

@ -34,4 +34,20 @@ public class LawyerStatisticsQueryForm {
private String endTime;
private Long userId;
/**
* 排序字段可选值
* quarterlyServiceDuration - 季度累计公益服务时长
* quarterlyServiceCost - 季度累计公益服务成本
* annualServiceDuration - 年度累计公益服务时长
* annualServiceCost - 年度累计公益服务成本
*/
@Schema(description = "排序字段")
private String sortField;
/**
* 排序方向asc - 升序desc - 降序
*/
@Schema(description = "排序方向:asc/desc")
private String sortOrder;
}

7
yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/form/ServiceApplicationsQueryForm.java

@ -125,10 +125,15 @@ public class ServiceApplicationsQueryForm extends PageParam {
private String associationAuditTimeEnd;
/**
* 案编号
* 编号/案号
*/
private String recordNo;
/**
* 备案编号
*/
private String filingNo;
/**
* 备案状态0-未备案1-已备案
*/

5
yun-admin/src/main/java/net/lab1024/sa/admin/module/service/domain/vo/ServiceApplicationsVO.java

@ -84,9 +84,12 @@ public class ServiceApplicationsVO {
@Schema(description = "协会审核时间")
private LocalDateTime associationAuditTime;
@Schema(description = "案编号")
@Schema(description = "案号/案号")
private String recordNo;
@Schema(description = "备案编号")
private String filingNo;
@Schema(description = "备案状态:0-未备案,1-已备案")
private Integer recordStatus;

1521
yun-admin/src/main/java/net/lab1024/sa/admin/module/service/service/ServiceApplicationsService.java

File diff suppressed because it is too large

25
yun-admin/src/main/java/net/lab1024/sa/admin/util/DateTimeUtil.java

@ -27,29 +27,8 @@ public class DateTimeUtil {
*/
public static String getCurrentQuarter() {
LocalDate today = LocalDate.now();
Month month = today.getMonth();
int dayOfMonth = today.getDayOfMonth();
// 判断当前时间是不是小于4月5号,是则为第一季度
if (month.getValue() < 4 || (month.getValue() == 4 && dayOfMonth < 5)) {
return "Q1";
}
// 判断当前时间是不是大于4月5号小于7月5号,是则为第二季度
else if ((month.getValue() == 4 && dayOfMonth >= 5) ||
(month.getValue() > 4 && month.getValue() < 7) ||
(month.getValue() == 7 && dayOfMonth < 5)) {
return "Q2";
}
// 判断当前时间是不是大于7月5号小于10月5号,是则为第三季度
else if ((month.getValue() == 7 && dayOfMonth >= 5) ||
(month.getValue() > 7 && month.getValue() < 10) ||
(month.getValue() == 10 && dayOfMonth < 5)) {
return "Q3";
}
// 判断当前时间是不是大于10月5号小于第二年的1月5号,是则为第四季度
else {
return "Q4";
}
int quarter = (today.getMonthValue() - 1) / 3 + 1;
return "Q" + quarter;
}
/**

5
yun-admin/src/main/resources/dev/application.yaml

@ -16,6 +16,11 @@ server:
servlet:
context-path: /
# 文件上传大小限制(50MB)
spring.servlet.multipart:
max-file-size: 50MB
max-request-size: 50MB
# 环境
spring:
profiles:

336
yun-admin/src/main/resources/mapper/service/ServiceApplicationsMapper.xml

@ -25,6 +25,7 @@
t_service_applications.association_audit_user,
t_service_applications.association_audit_time,
t_service_applications.record_no,
t_service_applications.filing_no,
t_service_applications.record_status,
t_service_applications.record_time,
t_service_applications.update_time,
@ -122,6 +123,9 @@
<if test="queryForm.positionId != null and queryForm.positionId != ''">
and position_id = #{queryForm.positionId}
</if>
<if test="queryForm.filingNo != null and queryForm.filingNo != ''">
and filing_no like CONCAT('%', #{queryForm.filingNo}, '%')
</if>
<!-- 协会角色过滤条件:只在没有明确指定任一审核状态时才应用此规则,且对自己创建的数据不过滤 -->
<if test="queryForm.includeAssociationReviewed != null and queryForm.includeAssociationReviewed and (queryForm.associationAuditStatus == null or queryForm.associationAuditStatus == '') and (queryForm.firmAuditStatus == null or queryForm.firmAuditStatus == '')">
AND (
@ -305,117 +309,146 @@
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
WHERE tsa.deleted_flag = 0
AND tsa.association_audit_status = 3 <!-- PASS -->
GROUP BY tsa.user_id, tsa.certificate_number, e.actual_name
ORDER BY e.actual_name
GROUP BY tsa.user_id, tsa.certificate_number
ORDER BY annualServiceDuration DESC, tsa.user_id ASC, e.actual_name
</select>
<!-- 律师统计查询(带参数) -->
<select id="getLawyerStatisticsWithParam" resultType="net.lab1024.sa.admin.module.service.domain.form.ServiceLawyerImportForm">
SELECT
e.actual_name AS lawyerName,
e.employee_id as userId,
MAX(d.department_name) AS firmName,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
e.actual_name AS lawyerName,
agg.userId,
d.department_name AS firmName,
agg.certificateNumber,
agg.annualServiceDuration
FROM (
SELECT
tsa.user_id AS userId,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration,
MAX(tsa.firm_id) AS firmId
FROM t_service_applications tsa
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
AND tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null">
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id, tsa.certificate_number
) agg
LEFT JOIN t_employee e ON agg.userId = e.employee_id
LEFT JOIN t_department d ON agg.firmId = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3 <!-- 只统计律协审核通过的 -->
AND tsa.firm_id IS NOT NULL
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.lawyerName != null and queryForm.lawyerName != ''">
AND e.actual_name LIKE CONCAT('%', #{queryForm.lawyerName}, '%')
</if>
<if test="queryForm.firmName != null and queryForm.firmName != ''">
AND d.department_name LIKE CONCAT('%', #{queryForm.firmName}, '%')
</if>
<if test="queryForm.firmId != null">
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id, tsa.certificate_number
ORDER BY e.actual_name
</select>
ORDER BY annualServiceDuration DESC, userId ASC
</select>
<select id="getLawyerStatisticsWithParamYear"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
SELECT
e.actual_name AS lawyerName,
e.employee_id as userId,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
e.actual_name AS lawyerName,
agg.userId,
agg.certificateNumber,
agg.annualServiceDuration
FROM (
SELECT
tsa.user_id AS userId,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration,
MAX(tsa.firm_id) AS firmId
FROM t_service_applications tsa
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
AND tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null">
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id, tsa.certificate_number
) agg
LEFT JOIN t_employee e ON agg.userId = e.employee_id
LEFT JOIN t_department d ON agg.firmId = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.lawyerName != null and queryForm.lawyerName != ''">
AND e.actual_name LIKE CONCAT('%', #{queryForm.lawyerName}, '%')
</if>
<if test="queryForm.firmName != null and queryForm.firmName != ''">
AND d.department_name LIKE CONCAT('%', #{queryForm.firmName}, '%')
</if>
<if test="queryForm.firmId != null">
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id, tsa.certificate_number
ORDER BY annualServiceDuration DESC, userId ASC
</select>
<select id="getLawyerStatisticsWithParamYearNoPage"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
SELECT
e.actual_name AS lawyerName,
e.employee_id as userId,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
e.actual_name AS lawyerName,
agg.userId,
agg.certificateNumber,
agg.annualServiceDuration
FROM (
SELECT
tsa.user_id AS userId,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration,
MAX(tsa.firm_id) AS firmId
FROM t_service_applications tsa
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
AND tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null">
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id, tsa.certificate_number
) agg
LEFT JOIN t_employee e ON agg.userId = e.employee_id
LEFT JOIN t_department d ON agg.firmId = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.lawyerName != null and queryForm.lawyerName != ''">
AND e.actual_name LIKE CONCAT('%', #{queryForm.lawyerName}, '%')
</if>
<if test="queryForm.firmName != null and queryForm.firmName != ''">
AND d.department_name LIKE CONCAT('%', #{queryForm.firmName}, '%')
</if>
<if test="queryForm.firmId != null">
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id, tsa.certificate_number
ORDER BY annualServiceDuration DESC, userId ASC
</select>
<select id="getLawyerStatistic"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
@ -444,6 +477,7 @@
</if>
</where>
GROUP BY tsa.user_id, tsa.certificate_number
ORDER BY annualServiceDuration DESC, tsa.user_id ASC
LIMIT 1
</select>
<select id="getdepartmentStatistics"
@ -472,34 +506,41 @@
</if>
</where>
GROUP BY d.department_id, d.department_name
ORDER BY annualServiceDuration DESC, d.department_id ASC
</select>
<!-- 律所统计分页查询 -->
<select id="getdepartmentStatisticsPage"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
SELECT
d.department_name AS firmName,
d.department_id as firmId,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null">
and tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY d.department_id, d.department_name
agg.firmId AS firmId,
d.department_name AS firmName,
agg.annualServiceDuration
FROM (
SELECT
tsa.firm_id AS firmId,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration
FROM t_service_applications tsa
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
AND tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null">
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.firm_id
) agg
LEFT JOIN t_department d ON agg.firmId = d.department_id
ORDER BY annualServiceDuration DESC, firmId ASC
</select>
<select id="getdepartmentMothStatistic"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
@ -778,7 +819,7 @@
</where>
GROUP BY tsa.user_id, tsa.certificate_number
HAVING annualServiceCost > 0
ORDER BY e.actual_name
ORDER BY annualServiceDuration DESC, tsa.user_id ASC
</select>
<select id="selectByRecordNoNotMy"
resultType="net.lab1024.sa.admin.module.service.domain.vo.ServiceApplicationsVO">
@ -932,37 +973,40 @@
<!-- 查询律师列表(分页) -->
<select id="getLawyerActivityCount" resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerActivityCountVO">
SELECT DISTINCT
tsa.user_id AS userId,
e.actual_name AS lawyerName,
d.department_id AS firmId,
d.department_name AS firmName,
tsa.certificate_number AS certificateNumber,
COALESCE(stats.totalCount, 0) AS totalCount
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
LEFT JOIN (
SELECT
user_id,
SELECT
stats.user_id AS userId,
stats.lawyerName AS lawyerName,
stats.firmId AS firmId,
stats.firmName AS firmName,
stats.certificateNumber AS certificateNumber,
stats.totalCount AS totalCount
FROM (
SELECT
tsa.user_id AS user_id,
MAX(e.actual_name) AS lawyerName,
MAX(tsa.firm_id) AS firmId,
MAX(d.department_name) AS firmName,
MAX(tsa.certificate_number) AS certificateNumber,
COUNT(*) AS totalCount
FROM t_service_applications
WHERE deleted_flag = 0
AND association_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND report_time &lt;= #{queryForm.endTime}
</if>
GROUP BY user_id
) stats ON tsa.user_id = stats.user_id
WHERE tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
<if test="queryForm.firmId != null and queryForm.firmId != ''">
AND tsa.firm_id = #{queryForm.firmId}
</if>
ORDER BY totalCount DESC, tsa.user_id
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.firmId != null and queryForm.firmId != ''">
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id
) stats
ORDER BY totalCount DESC, stats.user_id
</select>
<!-- 查询指定律师的活动统计 -->
@ -992,6 +1036,33 @@
ORDER BY g.goods_id
</select>
<!-- 批量查询多个律师的活动统计(避免N+1) -->
<select id="getLawyerActivityDetailBatch" resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerActivityCountVO">
SELECT
tsa.user_id AS userId,
tsa.activity_name_id AS activityId,
g.goods_name AS activityName,
COUNT(*) AS count
FROM t_service_applications tsa
LEFT JOIN t_goods g ON tsa.activity_name_id = g.goods_id
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.user_id IN
<foreach collection="userIds" item="uid" open="(" separator="," close=")">
#{uid}
</foreach>
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.report_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.report_time &lt;= #{queryForm.endTime}
</if>
</where>
GROUP BY tsa.user_id, tsa.activity_name_id, g.goods_name
ORDER BY tsa.user_id, tsa.activity_name_id
</select>
<!-- 查询律所列表(分页,按活动总数排序) -->
<select id="getFirmActivityCount" resultType="net.lab1024.sa.admin.module.service.domain.vo.FirmActivityCountVO">
SELECT
@ -1243,4 +1314,13 @@
</if>
ORDER BY tsa.create_time DESC
</select>
<!-- 获取指定前缀的最大备案编号 -->
<select id="getMaxFilingNo" resultType="java.lang.String">
SELECT filing_no
FROM t_service_applications
WHERE filing_no LIKE CONCAT(#{prefix}, '%')
ORDER BY filing_no DESC
LIMIT 1
</select>
</mapper>

5
yun-admin/src/main/resources/pre/application.yaml

@ -16,6 +16,11 @@ server:
servlet:
context-path: /
# 文件上传大小限制(50MB)
spring.servlet.multipart:
max-file-size: 50MB
max-request-size: 50MB
# 环境
spring:
profiles:

5
yun-admin/src/main/resources/prod/application.yaml

@ -16,6 +16,11 @@ server:
servlet:
context-path: /
# 文件上传大小限制(50MB)
spring.servlet.multipart:
max-file-size: 50MB
max-request-size: 50MB
# 环境
spring:
profiles:

5
yun-admin/src/main/resources/test/application.yaml

@ -16,6 +16,11 @@ server:
servlet:
context-path: /
# 文件上传大小限制(50MB)
spring.servlet.multipart:
max-file-size: 50MB
max-request-size: 50MB
# 环境
spring:
profiles:

10
yun-base/src/main/resources/dev/yun-base.yaml

@ -1,10 +1,10 @@
spring:
# 数据库连接信息
datasource:
url: jdbc:mysql://127.0.0.1:3306/lawyer_welfare?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
url: jdbc:p6spy:mysql://8.148.67.92:3306/lawyer_welfare?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: root
password: root123456
driver-class-name: com.mysql.cj.jdbc.Driver
password: sdy@2025#
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
initial-size: 2
min-idle: 2
max-active: 10
@ -67,8 +67,8 @@ spring:
# 上传文件和请求大小
servlet:
multipart:
max-file-size: 20MB # 单个文件的最大大小
max-request-size: 10MB # 整个请求的最大大小
max-file-size: 50MB # 单个文件的最大大小
max-request-size: 50MB # 整个请求的最大大小
# 缓存实现类型
cache:

4
yun-base/src/main/resources/pre/yun-base.yaml

@ -67,8 +67,8 @@ spring:
# 上传文件和请求大小
servlet:
multipart:
max-file-size: 20MB # 单个文件的最大大小
max-request-size: 10MB # 整个请求的最大大小
max-file-size: 50MB # 单个文件的最大大小
max-request-size: 50MB # 整个请求的最大大小
# 缓存实现类型
cache:

4
yun-base/src/main/resources/prod/yun-base.yaml

@ -66,8 +66,8 @@ spring:
# 上传文件和请求大小
servlet:
multipart:
max-file-size: 20MB # 单个文件的最大大小
max-request-size: 10MB # 整个请求的最大大小
max-file-size: 50MB # 单个文件的最大大小
max-request-size: 50MB # 整个请求的最大大小
# 缓存实现类型
cache:

4
yun-base/src/main/resources/test/yun-base.yaml

@ -67,8 +67,8 @@ spring:
# 上传文件和请求大小
servlet:
multipart:
max-file-size: 20MB # 单个文件的最大大小
max-request-size: 10MB # 整个请求的最大大小
max-file-size: 50MB # 单个文件的最大大小
max-request-size: 50MB # 整个请求的最大大小
# 缓存实现类型
cache:

Loading…
Cancel
Save