From ec12480dedafe50de85943126cb3e53e005bb084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E7=90=AA?= <2231925844@qq.com> Date: Thu, 20 Mar 2025 19:11:20 +0800 Subject: [PATCH] =?UTF-8?q?[UPDATE]=EF=BC=9A=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 8 +- .../controller/CaseInformationController.java | 14 +- .../law/controller/IndexController.java | 14 +- .../controller/InvoiceRecordController.java | 96 ++++++ .../tcctlo/law/entity/CaseInformation.java | 34 ++- .../com/tcctlo/law/entity/CaseStatistics.java | 18 ++ .../tcctlo/law/entity/CollectionRecord.java | 5 + .../com/tcctlo/law/entity/InvoiceRecord.java | 106 +++++++ .../law/mapper/CaseInformationMapper.java | 130 +++++++- .../tcctlo/law/mapper/FileManagerMapper.java | 1 + .../law/mapper/InvoiceRecordMapper.java | 32 ++ .../law/service/ICaseInformationService.java | 7 + .../com/tcctlo/law/service/IIndexService.java | 7 + .../law/service/IInvoiceRecordService.java | 80 +++++ .../impl/CaseInformationServiceImpl.java | 108 ++++++- .../impl/CollectionRecordServiceImpl.java | 57 +++- .../impl/DemandPaymentRecordServiceImpl.java | 6 +- .../law/service/impl/IIndexServiceImpl.java | 32 +- .../impl/ImpulseInformationServiceImpl.java | 52 ++-- .../impl/InvoiceRecordServiceImpl.java | 102 +++++++ .../tcctlo/law/tools/RedisGenerateCaseNo.java | 12 +- .../tcctlo/law/vo/CaseInformationListVO.java | 8 + .../tcctlo/law/vo/ImpulseInformationVO.java | 14 +- .../tcctlo/law/vo/IndexLawCaseMoneyInfo.java | 28 ++ .../java/com/tcctlo/law/vo/IndexLawInfo.java | 38 +++ .../com/tcctlo/law/vo/InvoiceRecordVO.java | 32 ++ .../CaseInformationMapper.xml | 278 +++++++++++++++++- .../CollectionRecordMapper.xml | 1 + .../ContractTemplateMapper.xml | 2 +- .../tcctlo-law-office/InvoiceRecordMapper.xml | 26 ++ .../tcctlo/system/mapper/SysUserMapper.java | 1 + 31 files changed, 1253 insertions(+), 96 deletions(-) create mode 100644 tcctlo-law-office/src/main/java/com/tcctlo/law/controller/InvoiceRecordController.java create mode 100644 tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CaseStatistics.java create mode 100644 tcctlo-law-office/src/main/java/com/tcctlo/law/entity/InvoiceRecord.java create mode 100644 tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/InvoiceRecordMapper.java create mode 100644 tcctlo-law-office/src/main/java/com/tcctlo/law/service/IInvoiceRecordService.java create mode 100644 tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/InvoiceRecordServiceImpl.java create mode 100644 tcctlo-law-office/src/main/java/com/tcctlo/law/vo/IndexLawCaseMoneyInfo.java create mode 100644 tcctlo-law-office/src/main/java/com/tcctlo/law/vo/IndexLawInfo.java create mode 100644 tcctlo-law-office/src/main/java/com/tcctlo/law/vo/InvoiceRecordVO.java create mode 100644 tcctlo-law-office/src/main/resources/mapper/tcctlo-law-office/InvoiceRecordMapper.xml diff --git a/tcctlo-admin/src/main/resources/application.yml b/tcctlo-admin/src/main/resources/application.yml index 9d16ce05..fdc9a857 100644 --- a/tcctlo-admin/src/main/resources/application.yml +++ b/tcctlo-admin/src/main/resources/application.yml @@ -137,11 +137,11 @@ dromara: aliyun-oss: - platform: aliyun-oss-1 # 存储平台标识 enable-storage: true # 启用存储 - access-key: LTAI5tL4rKPPR71Ki5CgEHme - secret-key: 8OFQDahu0XHj0ctxGrywA37c81PDiU - end-point: oss-cn-beijing.aliyuncs.com + access-key: + secret-key: + end-point: bucket-name: low-office - domain: https://low-office.oss-cn-beijing.aliyuncs.com/ # 访问域名,注意“/”结尾,例如:https://abc.oss-cn-shanghai.aliyuncs.com/ + domain: # 访问域名,注意“/”结尾,例如:https://abc.oss-cn-shanghai.aliyuncs.com/ base-path: low-office-images/ # 基础路径 minio: - platform: minio-1 # 存储平台标识 diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/CaseInformationController.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/CaseInformationController.java index 78da951d..acdf466f 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/CaseInformationController.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/CaseInformationController.java @@ -32,8 +32,6 @@ public class CaseInformationController extends BaseController { private ICaseInformationService iCaseInformationService; - - /** * 案件审核 * @param params 参数:案件编号、审核状态、审核意见【id、auditStatus、auditOpinion】 @@ -101,7 +99,9 @@ public class CaseInformationController extends BaseController { } @PostMapping(value = "/list") - public AjaxResult list(@RequestParam(required = false) Integer current, @RequestParam(required = false) Integer size, @RequestBody(required = false) Map params) { + public AjaxResult list(@RequestParam(required = false) Integer current, + @RequestParam(required = false) Integer size, + @RequestBody(required = false) Map params) { if (current == null) { current = 1; } @@ -199,5 +199,13 @@ public class CaseInformationController extends BaseController { return AjaxResult.success(result); } + /** + * 根据案件状态统计案件数量 + * @return + */ + @GetMapping("/statisticsCaseStatus") + public AjaxResult statisticsCaseStatus(@RequestParam(value = "type",required = false) Integer type){ + return AjaxResult.success(iCaseInformationService.statisticsCaseStatus(type)); + } } diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/IndexController.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/IndexController.java index 4e2b5046..b6a71ef6 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/IndexController.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/IndexController.java @@ -4,10 +4,7 @@ import com.tcctlo.common.core.domain.AjaxResult; import com.tcctlo.law.entity.IndexStatistics; import com.tcctlo.law.service.IIndexService; import org.springframework.format.annotation.DateTimeFormat; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Date; @@ -71,5 +68,14 @@ public class IndexController { return AjaxResult.success(integerIntegerMap); } + /** + * 统计所有律师信息 + * @return 结果集 + */ + @PostMapping("/lawInfo") + public AjaxResult lawInfo() { + Object res = iIndexService.lawInfo(); + return AjaxResult.success(res); + } } diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/InvoiceRecordController.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/InvoiceRecordController.java new file mode 100644 index 00000000..a88348da --- /dev/null +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/controller/InvoiceRecordController.java @@ -0,0 +1,96 @@ +package com.tcctlo.law.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.tcctlo.common.core.domain.AjaxResult; +import com.tcctlo.law.entity.InvoiceRecord; +import com.tcctlo.law.vo.InvoiceRecordVO; +import com.tcctlo.law.service.IInvoiceRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 开票记录表 前端控制器 + *

+ * + * @author + * @since 2025-03-07 + */ + +@RestController +@RequestMapping("/invoiceRecord") +public class InvoiceRecordController { + + + @Autowired + private IInvoiceRecordService iInvoiceRecordService; + + @GetMapping(value = "/list") + public AjaxResult list(@RequestParam(required = false) Integer current, @RequestParam(required = false) Integer size) { + if (current == null) { + current = 1; + } + if (size == null) { + size = 10; + } + Page pageList = iInvoiceRecordService.list(current, size); + return AjaxResult.success(pageList); + } + + /** + * 根据案件ID获取开票记录 + * @param caseId 案件ID + * @return 结果集 + */ + @GetMapping(value = "/selectByCaseId/{caseId}") + public AjaxResult selectByCaseId(@PathVariable("caseId") Long caseId) { + List res = iInvoiceRecordService.selectByCaseId(caseId); + return AjaxResult.success(res); + } + + + @GetMapping(value = "/{id}") + public AjaxResult getById(@PathVariable("id") Long id) { + InvoiceRecord invoiceRecord = iInvoiceRecordService.getById(id); + return AjaxResult.success(invoiceRecord); + } + + @PostMapping(value = "/create") + public AjaxResult create(@RequestBody InvoiceRecordVO params) { + return AjaxResult.success(iInvoiceRecordService.create(params)); + } + + @PostMapping(value = "/delete/{id}") + public AjaxResult delete(@PathVariable("id") Long id) { + Integer result = iInvoiceRecordService.delete(id); + return AjaxResult.success(result); + } + + /** + * 逻辑删除 + * @param params 参数 + * @return 结果集 + */ + @PostMapping(value = "/deleteBatch") + public AjaxResult deleteBatch(@RequestBody Map params) { + AjaxResult ajaxResult = new AjaxResult(); + Integer result = iInvoiceRecordService.deleteBatch(params); + if (result > 0) { + ajaxResult.put("msg", "删除成功"); + ajaxResult.put("code", 200); + } else { + ajaxResult.put("msg", "删除失败"); + ajaxResult.put("code", 500); + } + return ajaxResult; + } + + @PostMapping(value = "/update") + public AjaxResult update(@RequestBody InvoiceRecord params) { + Integer result = iInvoiceRecordService.update(params); + return AjaxResult.success(result); + } +} diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CaseInformation.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CaseInformation.java index af99406f..6a9a2503 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CaseInformation.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CaseInformation.java @@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.annotation.*; import java.util.Date; import java.io.Serializable; +import java.util.List; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.JsonNode; import lombok.Data; import lombok.EqualsAndHashCode; /** @@ -48,12 +51,12 @@ public class CaseInformation implements Serializable { /** * 业务类型【0:诉讼业务,1:非诉讼业务】 */ - private Integer businessType; + private String businessType; /** * 业务分类【0:民商事业务、1:刑事辩护业务、2:行政复议及诉讼业务、3:企业常年法律顾问、4:企业专项法律顾问】 */ - private Integer businessClassify; + private String businessClassify; /** * 案件类型 @@ -63,12 +66,13 @@ public class CaseInformation implements Serializable { /** * 代理阶段 */ - private String agencyStage; + @TableField(typeHandler = JacksonTypeHandler.class) + private JsonNode agencyStage; /** * 案件来源【0:市场案源,1:律师独立案源】 */ - private Integer caseSource; + private String caseSource; /** * 应收金额 @@ -86,16 +90,27 @@ public class CaseInformation implements Serializable { @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date paymentDeadline; + /** + * 付款期限备注 + */ + private String paymentDeadlineRemake; + /** * 预留款 */ private BigDecimal reserveMoney; /** - * 顾问期限 + * 顾问期限开始时间 */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Date termOfConsultancy; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date termOfConsultancyStart; + + /** + * 顾问期限结束时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date termOfConsultancyEnd; /** * 收款状态【0:未付款、1:部分付款,2:已结清】 @@ -142,6 +157,11 @@ public class CaseInformation implements Serializable { */ private String caseLawyerIds; + /** + * 案件信息备注 + */ + private String caseRemake; + /** * 状态【0:正常,1:停用】 */ diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CaseStatistics.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CaseStatistics.java new file mode 100644 index 00000000..82376f11 --- /dev/null +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CaseStatistics.java @@ -0,0 +1,18 @@ +package com.tcctlo.law.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 案件不同状态统计实体类 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CaseStatistics { + + private String statusName; + + private Integer statusNum; +} diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CollectionRecord.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CollectionRecord.java index 9f3a83ca..1e478208 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CollectionRecord.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/CollectionRecord.java @@ -56,6 +56,11 @@ public class CollectionRecord implements Serializable { @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date collectionDate; + /** + * 收款记录 + */ + private String collectionRemake; + /** * 收款人ID */ diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/InvoiceRecord.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/InvoiceRecord.java new file mode 100644 index 00000000..9b5cb2bc --- /dev/null +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/entity/InvoiceRecord.java @@ -0,0 +1,106 @@ +package com.tcctlo.law.entity; +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.*; + +import java.util.Date; +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +/** + *

+ * 开票记录表 + *

+ * + * @author + * @since 2025-03-07 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("invoice_record") +public class InvoiceRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 关联案件 ID + */ + private Long caseId; + + /** + * 开票日期 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date invoiceDate; + + /** + * 开票金额 + */ + private BigDecimal invoiceMoney; + + /** + * 发票 OSS 地址 + */ + private String invoiceFileUrl; + + /** + * 开票人ID + */ + private Long invoiceUserId; + + /** + * 开票人名称 + */ + private String invoiceUserName; + + /** + * 开票状态【未开票:0,已开票:计算当前案件已开票的金额返回】 + */ + private String invoiceStatus; + + /** + * 状态【0:正常,1:停用】 + */ + private Integer status; + + /** + * 删除标志【0:未删除,1:已删除】 + */ + private Integer delFlag; + + /** + * 创建者 + */ + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 更新者 + */ + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + /** + * 备注 + */ + private String remake; + +} diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/CaseInformationMapper.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/CaseInformationMapper.java index 38752e8c..b514ce2d 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/CaseInformationMapper.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/CaseInformationMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.tcctlo.law.entity.CaseInformation; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.tcctlo.law.vo.CaseInformationListVO; +import com.tcctlo.law.vo.IndexLawInfo; import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; @@ -21,25 +22,39 @@ import java.util.Map; */ public interface CaseInformationMapper extends BaseMapper { + /** + * 首页统计律师信息--查询所有律师信息 + * @return 所有律师信息 + */ + List selectLawInfo(); + /** * 分页条件查询 - * @param page 分页对象 + * + * @param page 分页对象 * @param condition 条件参数 * @return 结果集 */ Page selectCondition(@Param("page") Page page, @Param("condition") Map condition); + /** + * 修改案件收款状态 + * @param caseId 案件ID + * @return 结果集 + */ + int updateCollectionStatus(@Param("caseId") Long caseId, @Param("collectionStatus") Integer collectionStatus); + /** * 修改案件审核状态 - * @param caseId 案件Id + * + * @param caseId 案件Id * @param auditStatus 审核状态吗 * @return 结果集 */ int updateAuditStatusInt(@Param("caseId") Long caseId, @Param("auditStatus") Integer auditStatus); /** - * - * @param caseId 案件ID + * @param caseId 案件ID * @param amountReceived 收款金额 * @return 结果集 */ @@ -47,14 +62,18 @@ public interface CaseInformationMapper extends BaseMapper { /** * 根据案件ID查询案件信息 + * * @param id 案件ID * @return 结果集 */ CaseInformationListVO selectCaseById(@Param("id") Long id); + + /** * 案件归档 + * * @param caseId 要归档的案件ID * @return 受影响记录数 */ @@ -62,12 +81,14 @@ public interface CaseInformationMapper extends BaseMapper { /** * 批量逻辑删除案件信息 + * * @param longList 案件ID集合 */ int removeByIds(@Param("ids") List longList); /** * 判断案件是否有相关文件 + * * @param id 案件id * @return 结果集 */ @@ -75,6 +96,7 @@ public interface CaseInformationMapper extends BaseMapper { /** * 根据案件ID查询案件信息 + * * @param id 案件ID * @return 结果集 */ @@ -82,6 +104,7 @@ public interface CaseInformationMapper extends BaseMapper { /** * 案件审核 + * * @param params 参数 * @return 是否审核成功 */ @@ -89,6 +112,7 @@ public interface CaseInformationMapper extends BaseMapper { /** * 案件撤销 + * * @param params 参数 * @return 是否撤销成功 */ @@ -96,6 +120,7 @@ public interface CaseInformationMapper extends BaseMapper { /** * 案件结案 + * * @param params 参数 * @return 结案结果 */ @@ -103,54 +128,129 @@ public interface CaseInformationMapper extends BaseMapper { /** * 根据业务类型查询案件数量 + * * @param type 业务类型 * @return 结果集 */ Integer selectCountByBusinessType(@Param("userId") String userId, @Param("type") Integer type, - @Param("startTime")Date startTime, - @Param("endTime")Date endTime); + @Param("startTime") Date startTime, + @Param("endTime") Date endTime); /** * 利冲统计 + * * @param caseStatus 收案状态 * @return 结果集 */ Integer conflictStatistics(@Param("userId") String userId, @Param("caseStatus") Integer caseStatus, - @Param("startTime")Date startTime, - @Param("endTime")Date endTime); + @Param("startTime") Date startTime, + @Param("endTime") Date endTime); /** * 未收款统计 + * * @return 结果集 */ Integer outstandingPayment(@Param("userId") String userId, - @Param("startTime")Date startTime, - @Param("endTime")Date endTime); + @Param("startTime") Date startTime, + @Param("endTime") Date endTime); /** * 部分收费统计 + * * @return 结果集 */ Integer partialCharge(@Param("userId") String userId, - @Param("startTime")Date startTime, - @Param("endTime")Date endTime); + @Param("startTime") Date startTime, + @Param("endTime") Date endTime); /** * 逾期未收费 + * * @return 结果集 */ Integer overdue(@Param("userId") String userId, - @Param("startTime")Date startTime, - @Param("endTime")Date endTime); + @Param("startTime") Date startTime, + @Param("endTime") Date endTime); /** * 修改案件涉及律师 - * @param id 案件ID + * + * @param id 案件ID * @param ids 涉及律师IDS * @return 结果集 */ Integer updateLawyerIds(@Param("caseId") Long caseId, @Param("lawIds") String lawIds); + + + /** + * 根据用户ID和案件状态统计案件数量 + * + * @param userId 用户ID + * @param caseStatus 案件状态 + * @return 结果集 + */ + Integer statisticsCaseStatus(@Param("userId") String userId, @Param("caseStatus") Integer caseStatus, @Param("businessType") Integer businessType); + + /** + * 根据用户ID和收款状态统计案件数量 + * + * @param userId 用户ID + * @param collectionStatus 收款状态 + * @return 结果集 + */ + Integer statisticsCaseCollectionStatus(@Param("userId") String userId, @Param("collectionStatus") Integer collectionStatus, @Param("businessType") Integer businessType); + + /** + * 根据用户ID和收款状态统计案件数量 + * + * @param userId 用户ID + * @param impulseStatus 收款状态 + * @return 结果集 + */ + Integer statisticsCaseImpulseStatus(@Param("userId") String userId, @Param("impulseStatus") Integer impulseStatus, @Param("businessType") Integer businessType); + + /** + * 根据用户ID和审核状态统计案件数量 + * + * @param userId 用户ID + * @param auditStatus 审核状态 + * @return 结果集 + */ + Integer statisticsCaseAuditStatus(@Param("userId") String userId, @Param("auditStatus") Integer auditStatus, @Param("businessType") Integer businessType); + + /** + * 根据用户ID和归档状态统计案件数量 + * + * @param userId 用户ID + * @param archiveStatus 归档状态 + * @return 结果集 + */ + Integer statisticsCaseArchiveStatus(@Param("userId") String userId, @Param("archiveStatus") Integer archiveStatus, @Param("businessType") Integer businessType); + + /** + * 根据用户ID和结案状态统计案件数量 + * + * @param userId 用户ID + * @param finishStatus 结案状态 + * @return 结果集 + */ + Integer statisticsCaseFinishStatus(@Param("userId") String userId, @Param("finishStatus") Integer finishStatus, @Param("businessType") Integer businessType); + + /** + * 首页-统计律师涉及案件数量 + * @param lawId 律师ID + * @return 结果集 + */ + Integer selectLawCaseCount(@Param("lawId") Long lawId); + + /** + * 首页-统计律师涉及案件金额总计 + * @param lawId 律师ID + * @return 结果集 + */ + BigDecimal selectLawCaseMoneyCount(@Param("lawId") Long lawId); } diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/FileManagerMapper.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/FileManagerMapper.java index 248fa10b..44600b30 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/FileManagerMapper.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/FileManagerMapper.java @@ -56,6 +56,7 @@ public interface FileManagerMapper extends BaseMapper { /** * 根据收款记录表中记录的文件ID查询文件 + * 根据开票记录表中记录的文件ID查询文件 * @param ids ids * @return 数据集 */ diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/InvoiceRecordMapper.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/InvoiceRecordMapper.java new file mode 100644 index 00000000..dd5b29b1 --- /dev/null +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/mapper/InvoiceRecordMapper.java @@ -0,0 +1,32 @@ +package com.tcctlo.law.mapper; + +import com.tcctlo.law.entity.InvoiceRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.tcctlo.law.vo.InvoiceRecordVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 开票记录表 Mapper 接口 + *

+ * + * @author + * @since 2025-03-07 + */ +public interface InvoiceRecordMapper extends BaseMapper { + + /** + * 逻辑删除 + * @param ids ids + */ + int deleteBatch(@Param("ids") List ids); + + /** + * 根据案件ID查询 + * @param caseId 案件ID + * @return 结果集 + */ + List selectByCaseId(@Param("caseId") Long caseId); +} diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/ICaseInformationService.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/ICaseInformationService.java index 0ddf8dd4..84a00576 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/ICaseInformationService.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/ICaseInformationService.java @@ -3,6 +3,7 @@ package com.tcctlo.law.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.tcctlo.law.entity.CaseInformation; +import com.tcctlo.law.entity.CaseStatistics; import com.tcctlo.law.entity.FileManager; import com.tcctlo.law.vo.CaseArchivedVO; import com.tcctlo.law.vo.CaseInformationEnterVO; @@ -152,4 +153,10 @@ public interface ICaseInformationService extends IService{ * @return 是否上传成功 */ Boolean caseInfoUpload(List fileManager); + + /** + * 根据案件状态统计案件数量 + */ + Map> statisticsCaseStatus(Integer type); + } diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/IIndexService.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/IIndexService.java index 4085ea37..57786410 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/IIndexService.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/IIndexService.java @@ -38,4 +38,11 @@ public interface IIndexService { * @return 数据集 */ List earningsTrend(Date startTime, Date endTime); + + + /** + * 所有律师信息 + * @return 结果集 + */ + Object lawInfo(); } diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/IInvoiceRecordService.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/IInvoiceRecordService.java new file mode 100644 index 00000000..06fcb758 --- /dev/null +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/IInvoiceRecordService.java @@ -0,0 +1,80 @@ +package com.tcctlo.law.service; + +import com.tcctlo.law.entity.InvoiceRecord; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.tcctlo.law.vo.InvoiceRecordVO; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 开票记录表 服务类 + *

+ * + * @author + * @since 2025-03-07 + */ +public interface IInvoiceRecordService { + + /** + *

+ * 分页列表查询 + *

+ * @param pageNo + * @param pageSize + * @return + */ + Page list(Integer pageNo, Integer pageSize); + + /** + *

+ * 详情接口 + *

+ * @param id + * @return + */ + InvoiceRecord getById(Long id); + + /** + *

+ * 新增接口 + *

+ * @param invoiceRecord + * @return + */ + Boolean create(InvoiceRecordVO invoiceRecord); + + + /** + *

+ * 删除接口 + *

+ * @param id + * @return + */ + Integer delete(Long id); + + /** + *

+ * 更新接口 + *

+ * @param invoiceRecord + * @return + */ + Integer update(InvoiceRecord invoiceRecord); + + /** + * 批量逻辑删除 + * @param params 参数 + * @return 是否删除成功 + */ + Integer deleteBatch(Map params); + + /** + * 根据案件ID获取开票记录 + * @return 结果集 + */ + List selectByCaseId(Long caseId); + +} diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/CaseInformationServiceImpl.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/CaseInformationServiceImpl.java index fbfd5cce..13f7cad4 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/CaseInformationServiceImpl.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/CaseInformationServiceImpl.java @@ -15,10 +15,7 @@ import com.tcctlo.law.mapper.*; import com.tcctlo.law.service.*; import com.tcctlo.law.tools.RedisGenerateCaseNo; import com.tcctlo.law.tools.RichTextToWordSimple; -import com.tcctlo.law.vo.CaseArchivedVO; -import com.tcctlo.law.vo.CaseInformationEnterVO; -import com.tcctlo.law.vo.CaseInformationListVO; -import com.tcctlo.law.vo.CollectionRecordEnterVO; +import com.tcctlo.law.vo.*; import com.tcctlo.system.mapper.SysUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -26,7 +23,9 @@ import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.*; +import java.util.function.Consumer; import java.util.stream.Collectors; /** @@ -112,6 +111,12 @@ public class CaseInformationServiceImpl extends ServiceImpl list(Integer pageNo, Integer pageSize, Map params) { LoginUser loginUser = SecurityUtils.getLoginUser(); @@ -171,7 +176,7 @@ public class CaseInformationServiceImpl extends ServiceImpl 0); item.setFileList(fileManagerMapper.selectFileByCaseId(item.getId())); + //开票状态 + List invoiceRecords = invoiceRecordMapper.selectByCaseId(item.getId()); + if (invoiceRecords.size() > 0){ + String invoiceMonet = invoiceRecords.stream().map(InvoiceRecord::getInvoiceMoney).collect(Collectors.toList()).stream().reduce(BigDecimal.ZERO, BigDecimal::add).toString(); + item.setInvoiceStatus(invoiceMonet); + }else { + item.setInvoiceStatus("0"); + } + item.setDemandPaymentRecordList(demandPaymentRecordMapper.selectByCaseId(item.getId())); } return caseInformationPage; @@ -320,10 +334,21 @@ public class CaseInformationServiceImpl extends ServiceImpl impulseInformationList = new ArrayList<>(); List entrustingParty = caseInfo.getEntrustingParty(); @@ -379,9 +404,9 @@ public class CaseInformationServiceImpl extends ServiceImpl records = collectionRecordMapper.selectByCaseId(id); result.setCollectionRecordList(records); records.stream().peek(item -> { - if (StringUtils.isNotBlank(item.getCollectionUrlId())){ + if (StringUtils.isNotBlank(item.getCollectionUrlId())) { List fileIds = Arrays.stream(item.getCollectionUrlId().split(",")) .map(Long::parseLong) .collect(Collectors.toList()); @@ -598,6 +623,63 @@ public class CaseInformationServiceImpl extends ServiceImpl> statisticsCaseStatus(Integer type) { + return getStatisticsCaseStatusDate(type); + } + + public Map> getStatisticsCaseStatusDate(Integer type){ + LoginUser loginUser = SecurityUtils.getLoginUser(); + String roleKey = sysUserMapper.selectUserRoleByUserId(loginUser.getUserId()); + + //如果当前登录用户的角色【律师】,则查询当前登录律师的案件信息,否则查询全部案件信息 + String userId = ""; + if (CaseEnum.LAWYER.getRoleKey().equals(roleKey)) { + userId = loginUser.getUserId().toString(); + } + Map> resMap = new HashMap<>(); + //案件状态统计 + List caseStatus = new ArrayList<>(); + caseStatus.add(new CaseStatistics("利冲收案", caseInformationMapper.statisticsCaseStatus(userId, 0, type))); + caseStatus.add(new CaseStatistics("正常收案", caseInformationMapper.statisticsCaseStatus(userId, 1, type))); + caseStatus.add(new CaseStatistics("终止收案", caseInformationMapper.statisticsCaseStatus(userId, 2, type))); + caseStatus.add(new CaseStatistics("案件撤销", caseInformationMapper.statisticsCaseStatus(userId, 3, type))); + resMap.put("caseStatus", caseStatus); + + //收款状态统计 + List collectionStatus = new ArrayList<>(); + collectionStatus.add(new CaseStatistics("未付款", caseInformationMapper.statisticsCaseCollectionStatus(userId, 0, type))); + collectionStatus.add(new CaseStatistics("部分付款", caseInformationMapper.statisticsCaseCollectionStatus(userId, 1, type))); + collectionStatus.add(new CaseStatistics("已结清", caseInformationMapper.statisticsCaseCollectionStatus(userId, 2, type))); + collectionStatus.add(new CaseStatistics("逾期部分未付款", caseInformationMapper.statisticsCaseCollectionStatus(userId, 3, type))); + resMap.put("collectionStatus", collectionStatus); + + //利冲状态 + List impulseStatus = new ArrayList<>(); + impulseStatus.add(new CaseStatistics("未检索", caseInformationMapper.statisticsCaseImpulseStatus(userId, 0, type))); + impulseStatus.add(new CaseStatistics("疑似利冲", caseInformationMapper.statisticsCaseImpulseStatus(userId, 1, type))); + impulseStatus.add(new CaseStatistics("检索通过", caseInformationMapper.statisticsCaseImpulseStatus(userId, 2, type))); + resMap.put("impulseStatus", impulseStatus); + + //审核状态 + List auditStatus = new ArrayList<>(); + auditStatus.add(new CaseStatistics("未审核", caseInformationMapper.statisticsCaseAuditStatus(userId, 0, type))); + auditStatus.add(new CaseStatistics("已审核", caseInformationMapper.statisticsCaseAuditStatus(userId, 1, type))); + auditStatus.add(new CaseStatistics("审核不通过", caseInformationMapper.statisticsCaseAuditStatus(userId, 2, type))); + resMap.put("auditStatus", auditStatus); + //归档状态 + List archiveStatus = new ArrayList<>(); + archiveStatus.add(new CaseStatistics("未归档", caseInformationMapper.statisticsCaseArchiveStatus(userId, 0, type))); + archiveStatus.add(new CaseStatistics("已归档", caseInformationMapper.statisticsCaseArchiveStatus(userId, 1, type))); + resMap.put("archiveStatus", archiveStatus); + //结案状态 + List finishStatus = new ArrayList<>(); + finishStatus.add(new CaseStatistics("未结案", caseInformationMapper.statisticsCaseFinishStatus(userId, 0, type))); + finishStatus.add(new CaseStatistics("已结案", caseInformationMapper.statisticsCaseFinishStatus(userId, 1, type))); + resMap.put("isFinishStatus", finishStatus); + return resMap; + } + /** * 编辑协办律师 * @@ -606,6 +688,12 @@ public class CaseInformationServiceImpl extends ServiceImpl oldData, List newData, Long caseId) { List insert = newData.stream().filter(c -> c.getId() == null).peek(c -> c.setCaseId(caseId)).collect(Collectors.toList()); + insert.stream().peek(new Consumer() { + @Override + public void accept(CaseLawyer item) { + item.setLawyerType(1); + } + }).collect(Collectors.toList()); List oldIds = oldData.stream().map(c -> c.getId()).collect(Collectors.toList()); List newIds = newData.stream().map(c -> c.getId()).collect(Collectors.toList()); List deleteIds = (List) CollUtil.subtract(oldIds, newIds); //将原来的数据与现在数据进行比较,得到需要删除的ID diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/CollectionRecordServiceImpl.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/CollectionRecordServiceImpl.java index 71fc75f6..6c80bfda 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/CollectionRecordServiceImpl.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/CollectionRecordServiceImpl.java @@ -2,6 +2,7 @@ package com.tcctlo.law.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -17,17 +18,16 @@ import com.tcctlo.law.mapper.CollectionRecordMapper; import com.tcctlo.law.mapper.FileManagerMapper; import com.tcctlo.law.service.ICollectionRecordService; import com.tcctlo.law.service.IFileManagerService; +import com.tcctlo.law.vo.CaseInformationListVO; import com.tcctlo.law.vo.CollectionRecordEnterVO; +import com.tcctlo.system.mapper.SysUserMapper; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; @@ -56,6 +56,12 @@ public class CollectionRecordServiceImpl extends ServiceImpl list(Integer pageNo, Integer pageSize) { @@ -133,13 +139,16 @@ public class CollectionRecordServiceImpl extends ServiceImpl insert = newData.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); insert.forEach(item -> { + if (CollUtil.isEmpty(item.getFileManager())){ + throw new RuntimeException("请上传缴费凭证"); + } List fileManager = item.getFileManager().stream().peek(item1 -> item1.setFileType(1)).collect(Collectors.toList()); fileManagerService.saveBatch(fileManager); item.setCollectionUrlId(fileManager.stream().map(i -> i.getId().toString()).collect(Collectors.joining(","))); item.setUserId(userId); item.setUserName(nickName); String collect = loginUser.getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.joining(",")); - if (!collect.contains("FINANCE")) { + if (!collect.contains("CAIWU")) { item.setAuditStatus(0); } else { item.setAuditStatus(1); @@ -149,7 +158,22 @@ public class CollectionRecordServiceImpl extends ServiceImpl fileIds = Arrays.stream(collectionRecord.getCollectionUrlId().split(",")).map(Long::parseLong).collect(Collectors.toList()); - fileManagerMapper.removeByCaseIdAndFileIds(caseId, fileIds); + CaseInformationListVO caseInfo = caseInformationMapper.selectCaseById(caseId); + if (caseInfo.getAmountReceivedSum().compareTo(new BigDecimal(0.0)) == 0){ + caseInformationMapper.updateCollectionStatus(caseId,0); + } + String urlStr = collectionRecord.getCollectionUrlId(); + if (StrUtil.isNotBlank(urlStr)){ + List fileIds = Arrays.stream(collectionRecord.getCollectionUrlId().split(",")).map(Long::parseLong).collect(Collectors.toList()); + fileManagerMapper.removeByCaseIdAndFileIds(caseId, fileIds); + } } catch (Exception e) { e.printStackTrace(); @@ -187,7 +217,14 @@ public class CollectionRecordServiceImpl extends ServiceImpl collect = Arrays.stream(item.getCollectionUrlId().split(",")).map(Long::parseLong).collect(Collectors.toList()); item.setFileManager(fileManagerMapper.selectByCRid(collect)); } - item.setIsEdit(item.getAuditStatus() == 0); + Long userId = item.getUserId(); + String roleKey = sysUserMapper.selectUserRoleByUserId(userId); + if ("CAIWU".equals(roleKey)){ + item.setIsEdit(item.getAuditStatus() == 1); + }else { + item.setIsEdit(item.getAuditStatus() == 0); + } + } return lists; } diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/DemandPaymentRecordServiceImpl.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/DemandPaymentRecordServiceImpl.java index dc8ee415..d43f3622 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/DemandPaymentRecordServiceImpl.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/DemandPaymentRecordServiceImpl.java @@ -84,9 +84,11 @@ public class DemandPaymentRecordServiceImpl extends ServiceImpl list = recordMapper.earningsTrend(userId, startTime, endTime); - Map> map = list.stream().collect(Collectors.groupingBy(item -> DateUtil.parse(DateUtil.format(item.getCreateTime(), "yyyy-MM-dd")))); + Map> map = list.stream().collect(Collectors.groupingBy(item -> DateUtil.parse(DateUtil.format(item.getCollectionDate(), "yyyy-MM-dd")))); TreeMap> treeMap = new TreeMap<>(map); List res = new ArrayList<>(); TreeMap> itemMap = new TreeMap<>(); @@ -117,4 +123,28 @@ public class IIndexServiceImpl implements IIndexService { }); return res; } + + @Override + public Object lawInfo() { + List indexLawInfos = caseInformationMapper.selectLawInfo(); //所有的律师信息 + List res = indexLawInfos.stream().map(new Function() { + @Override + public IndexLawCaseMoneyInfo apply(IndexLawInfo item) { + IndexLawCaseMoneyInfo caseLawItem = new IndexLawCaseMoneyInfo(); + caseLawItem.setLawName(item.getNickName()); + caseLawItem.setCaseNum(caseInformationMapper.selectLawCaseCount(item.getUserId())); //律师涉及案件数量 + + //律师涉及案件金额总计 + BigDecimal sumMoney = caseInformationMapper.selectLawCaseMoneyCount(item.getUserId()); + if (sumMoney == null) { + caseLawItem.setAmountReceived(new BigDecimal(0.0)); + } else { + caseLawItem.setAmountReceived(sumMoney); + } + /*caseLawItem.setAmountReceived(caseInformationMapper.selectLawCaseMoneyCount(item.getUserId())); */ + return caseLawItem; + } + }).collect(Collectors.toList()); + return res; + } } diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/ImpulseInformationServiceImpl.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/ImpulseInformationServiceImpl.java index 0c2a856c..32e2319d 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/ImpulseInformationServiceImpl.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/ImpulseInformationServiceImpl.java @@ -3,6 +3,7 @@ package com.tcctlo.law.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -52,7 +53,10 @@ public class ImpulseInformationServiceImpl extends ServiceImpl resMap = new TreeMap<>(); List clashInfoVOS = new ArrayList<>(); Long id = impulseInformation.getId(); - /*if (id != null){ - ImpulseInformation item = impulseInformationMapper.selectById(id); - if (item.getCheckFlag() == 0){ - resMap.put("result", false); - ClashInfoVO clashInfoVO = BeanUtil.copyProperties(item, ClashInfoVO.class); - clashInfoVOS.add(clashInfoVO); - resMap.put("clashInfo", clashInfoVOS); - return resMap; - }else { - resMap.put("result", true); - resMap.put("clashInfo", null); - return resMap; - } - }*/ if (id != null) { @@ -204,13 +194,17 @@ public class ImpulseInformationServiceImpl extends ServiceImpl resList = impulseInformationMapper.retrievalConflict(item); item.setIsClient(1 - item.getIsClient()); CaseInformation caseItem = caseInformationMapper.selectById(item.getCaseId()); //查询当前案件信息【暂时不需要】 - clashMsgWithCaseInfo.setMsgMain("当前案件中:" + (item.getIsClient() == 0 ? "【委托方】->" : "【相对方】->") + item.getCaseName() + "[" + item.getCaseNo() + "]" + "与以下案件中的委托方/相对方有利冲嫌疑:"); + clashMsgWithCaseInfo.setMsgMain("当前案件中:" + (item.getIsClient() == 0 ? "【委托方】->" : "【相对方】->") + item.getCaseName() + (item.getCaseNo() == null ? "" : "[" + item.getCaseNo() + "]") + "与以下案件中的委托方/相对方有利冲嫌疑:"); List list = new ArrayList<>(); for (ImpulseInformation in : resList) { - CaseInformation ci = caseInformationMapper.selectById(in.getCaseId()); + CaseInformation ci = null; ClashMsgCaseInfoItem clashMsgCaseInfoItem = new ClashMsgCaseInfoItem(); - clashMsgCaseInfoItem.setCaseId(ci.getId()); - clashMsgCaseInfoItem.setMsg(ci.getCaseName() + "【" + ci.getCaseNo() + "】案件中的" + (in.getIsClient() == 0 ? "【委托方】" : "【相对方】") + in.getCaseName() + "[" + in.getCaseNo() + "]" + "有疑似利冲信息"); + if (in.getCaseId() != null){ + ci = caseInformationMapper.selectById(in.getCaseId()); + clashMsgCaseInfoItem.setCaseId(ci.getId()); + clashMsgCaseInfoItem.setMsg(ci.getCaseName() + "【" + ci.getCaseNo() + "】案件中的" + (in.getIsClient() == 0 ? "【委托方】" : "【相对方】") + in.getCaseName() + "[" + in.getCaseNo() + "]" + "有疑似利冲信息"); + }else { + clashMsgCaseInfoItem.setMsg((in.getIsClient() == 0 ? "【委托方】" : "【相对方】") + in.getCaseName() + "有疑似利冲信息"); + } + list.add(clashMsgCaseInfoItem); } clashMsgWithCaseInfo.setMsgSub(list); diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/InvoiceRecordServiceImpl.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/InvoiceRecordServiceImpl.java new file mode 100644 index 00000000..519ce0da --- /dev/null +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/service/impl/InvoiceRecordServiceImpl.java @@ -0,0 +1,102 @@ +package com.tcctlo.law.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.tcctlo.common.core.domain.model.LoginUser; +import com.tcctlo.common.utils.SecurityUtils; +import com.tcctlo.law.entity.FileManager; +import com.tcctlo.law.entity.InvoiceRecord; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.tcctlo.law.mapper.FileManagerMapper; +import com.tcctlo.law.vo.InvoiceRecordVO; +import com.tcctlo.law.mapper.InvoiceRecordMapper; +import com.tcctlo.law.service.IInvoiceRecordService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** +*

+* 开票记录表 服务实现类 +*

+* +* @author +* @since 2025-03-07 +*/ +@Service +public class InvoiceRecordServiceImpl extends ServiceImpl implements IInvoiceRecordService { + + + @Resource + private InvoiceRecordMapper invoiceRecordMapper; + + @Resource + private FileManagerServiceImpl fileManagerService; + + @Resource + private FileManagerMapper fileManagerMapper; + + @Override + public Page list(Integer pageNo, Integer pageSize) { + return invoiceRecordMapper.selectPage(new Page<>(pageNo, pageSize), new QueryWrapper<>()); + } + + @Override + public InvoiceRecord getById(Long id) { + InvoiceRecord invoiceRecord = invoiceRecordMapper.selectById(id); + return invoiceRecord; + } + + @Override + public Boolean create(InvoiceRecordVO invoiceRecord) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + Long userId = loginUser.getUserId(); + String nickName = loginUser.getUser().getNickName(); + invoiceRecord.setInvoiceUserId(userId); + invoiceRecord.setInvoiceUserName(nickName); + + List fileManager = invoiceRecord.getFileManager(); + fileManager.stream().peek(item -> item.setFileType(3)).collect(Collectors.toList()); + fileManagerService.saveBatch(fileManager); + String ids = fileManager.stream().map(item -> item.getId().toString()).collect(Collectors.joining(",")); + invoiceRecord.setInvoiceFileUrl(ids); + int insert = invoiceRecordMapper.insert(invoiceRecord); + return insert > 0; + } + + @Override + public Integer delete(Long id) { + return invoiceRecordMapper.deleteById(id); + } + + @Override + public Integer update(InvoiceRecord invoiceRecord) { + return invoiceRecordMapper.updateById(invoiceRecord); + } + + @Override + public Integer deleteBatch(Map params) { + List ids = Arrays.stream(params.get("ids").split(",")) + .map(Long::parseLong) + .collect(Collectors.toList()); + + return invoiceRecordMapper.deleteBatch(ids); + } + + @Override + public List selectByCaseId(Long caseId) { + List invoiceRecords = invoiceRecordMapper.selectByCaseId(caseId); + invoiceRecords.stream().peek(item -> { + List collect = Arrays.stream(item.getInvoiceFileUrl().split(",")).map(Long::parseLong).collect(Collectors.toList()); + item.setFileManager(fileManagerMapper.selectByCRid(collect)); + }).collect(Collectors.toList()); + return invoiceRecords; + } + +} diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/tools/RedisGenerateCaseNo.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/tools/RedisGenerateCaseNo.java index 3ee4f6bf..9fd6e47a 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/tools/RedisGenerateCaseNo.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/tools/RedisGenerateCaseNo.java @@ -34,11 +34,17 @@ public class RedisGenerateCaseNo { case 1: return String.format("XS-%s-%03d", currentDate, counter); case 2: - return String.format("XZ-%s-%03d", currentDate, counter); + return String.format("XZFY-%s-%03d", currentDate, counter); case 3: - return String.format("CN-%s-%03d", currentDate, counter); + return String.format("QYCN-%s-%03d", currentDate, counter); case 4: - return String.format("ZX-%s-%03d", currentDate, counter); + return String.format("QYZX-%s-%03d", currentDate, counter); + case 5: + return String.format("QTFSS-%s-%03d", currentDate, counter); + case 6: + return String.format("LDZY-%s-%03d", currentDate, counter); + case 7: + return String.format("SHZC-%s-%03d", currentDate, counter); } return String.format("DEFAULT-%s-%03d", currentDate, counter); diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/CaseInformationListVO.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/CaseInformationListVO.java index 541dcb3a..ee18624d 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/CaseInformationListVO.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/CaseInformationListVO.java @@ -23,6 +23,13 @@ public class CaseInformationListVO extends CaseInformation { */ private BigDecimal uncollectedMoney; + /** + * 案件发票 + * 已开票金额:根据案件ID查询开票记录,将金额累加范湖 + * 未开票:直接返回0 + */ + private String invoiceStatus; + /** * 委托方 */ @@ -61,4 +68,5 @@ public class CaseInformationListVO extends CaseInformation { + } diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/ImpulseInformationVO.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/ImpulseInformationVO.java index 989f4ca7..191af12b 100644 --- a/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/ImpulseInformationVO.java +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/ImpulseInformationVO.java @@ -21,8 +21,20 @@ public class ImpulseInformationVO extends ImpulseInformation { /** * 顾问期限 */ + /*@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date termOfConsultancy;*/ + + /** + * 顾问期限开始时间 + */ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Date termOfConsultancy; + private Date termOfConsultancyStart; + + /** + * 顾问期限结束时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date termOfConsultancyEnd; /** * 归档状态【0:未归档,1:已归档】 diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/IndexLawCaseMoneyInfo.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/IndexLawCaseMoneyInfo.java new file mode 100644 index 00000000..ef04a8ed --- /dev/null +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/IndexLawCaseMoneyInfo.java @@ -0,0 +1,28 @@ +package com.tcctlo.law.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class IndexLawCaseMoneyInfo { + + /** + * 律师名称 + */ + private String lawName; + + /** + * 律师案件数量 + */ + private int caseNum; + + /** + * 律师涉及案件已收金额 + */ + private BigDecimal amountReceived; +} diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/IndexLawInfo.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/IndexLawInfo.java new file mode 100644 index 00000000..5e0cc5c7 --- /dev/null +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/IndexLawInfo.java @@ -0,0 +1,38 @@ +package com.tcctlo.law.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 首页律师信息 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class IndexLawInfo { + /** + * 用户ID + */ + private Long userId; + + /** + * 用户名称 + */ + private String nickName; + + /** + * 角色ID + */ + private Long roleId; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 角色key + */ + private String roleKey; +} diff --git a/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/InvoiceRecordVO.java b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/InvoiceRecordVO.java new file mode 100644 index 00000000..e15caf72 --- /dev/null +++ b/tcctlo-law-office/src/main/java/com/tcctlo/law/vo/InvoiceRecordVO.java @@ -0,0 +1,32 @@ +package com.tcctlo.law.vo; + +import com.tcctlo.law.entity.FileManager; +import com.tcctlo.law.entity.InvoiceRecord; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 开票记录表 + *

+ * + * @author + * @since 2025-03-07 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class InvoiceRecordVO extends InvoiceRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 开票文件 + */ + private List fileManager; + +} diff --git a/tcctlo-law-office/src/main/resources/mapper/tcctlo-law-office/CaseInformationMapper.xml b/tcctlo-law-office/src/main/resources/mapper/tcctlo-law-office/CaseInformationMapper.xml index 82eb05d3..36c9a6de 100644 --- a/tcctlo-law-office/src/main/resources/mapper/tcctlo-law-office/CaseInformationMapper.xml +++ b/tcctlo-law-office/src/main/resources/mapper/tcctlo-law-office/CaseInformationMapper.xml @@ -5,14 +5,42 @@ - ci - . - id - ,ci.case_no,ci.case_name,ci.case_context,ci.business_type,ci.business_classify,ci.case_type,ci.agency_stage,ci.case_source,ci.amount_receivable,ci.amount_received_sum,ci.payment_deadline,ci.reserve_money,ci.term_of_consultancy,ci.collection_status,ci.impulse_state,ci.case_status,ci.audit_status,ci.archive_status,ci.is_finish_case,ci.impulse_information_ids,ci.case_lawyer_ids,ci.status,ci.del_flag,ci.create_by,ci.create_time,ci.update_by,ci.update_time,ci.remake + ci.id, + ci.case_no, + ci.case_name, + ci.case_context, + ci.business_type, + ci.business_classify, + ci.case_type, + ci.agency_stage, + ci.case_source, + ci.amount_receivable, + ci.amount_received_sum, + ci.payment_deadline, + ci.payment_deadline_remake, + ci.reserve_money, + ci.term_of_consultancy_start, + ci.term_of_consultancy_end, + ci.collection_status, + ci.impulse_state, + ci.case_status, + ci.audit_status, + ci.archive_status, + ci.is_finish_case, + ci.impulse_information_ids, + ci.case_lawyer_ids, + ci.case_remake, + ci.status, + ci.del_flag, + ci.create_by, + ci.create_time, + ci.update_by, + ci.update_time, + ci.remake update case_information ci - set ci.archive_status = 1 + set ci.archive_status = 1,ci.is_finish_case = 1 where id = #{caseId} @@ -92,9 +120,53 @@ where ci.id = #{caseId} + + update case_information ci + + ci.collection_status = #{collectionStatus} + + where ci.id = #{caseId} + - select * from case_information ci @@ -137,7 +209,12 @@ and fm.status = 0 - select from case_information ci @@ -149,6 +226,43 @@ and ci.status = 0 and ci.del_flag = 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --> - + select count(ci.id) as sumNum + from case_information ci + + 1 = 1 + and ci.collection_status = 1 + + and find_in_set(#{userId},ci.case_lawyer_ids) + + + and ci.create_time between #{startTime} and #{endTime} + + and ci.del_flag = 0 + and ci.status = 0 + @@ -260,7 +390,7 @@ - + select count(ci.id) as sumNum + from case_information ci + + 1 = 1 + and ci.collection_status = 3 + + and find_in_set(#{userId},ci.case_lawyer_ids) + + + and ci.create_time between #{startTime} and #{endTime} + + and ci.del_flag = 0 + and ci.status = 0 + + + + + + + + + + + + + + + +