接口调整步骤一,对有问题的接口进行调整,后续需要将不需要的代码及字段进行清理

This commit is contained in:
daichao 2025-04-12 15:06:00 +08:00
parent f451d2fdcb
commit 1198cb0a00
38 changed files with 1081 additions and 513 deletions

View File

@ -68,6 +68,13 @@
<version>${tcctlo.version}</version>
</dependency>
<!-- io常用工具类 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>

View File

@ -1,5 +1,4 @@
package com.tcctlo;
import org.dromara.x.file.storage.spring.EnableFileStorage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -10,12 +9,11 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableFileStorage
public class TCCTLawOfficeApplication
{
public static void main(String[] args)
{
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class TCCTLawOfficeApplication {
public static void main(String[] args) {
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(TCCTLawOfficeApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +

View File

@ -1,12 +1,15 @@
package com.tcctlo.law.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tcctlo.common.annotation.Anonymous;
import com.tcctlo.common.core.controller.BaseController;
import com.tcctlo.common.core.domain.AjaxResult;
import com.tcctlo.law.entity.CaseInformation;
import com.tcctlo.law.entity.FileManager;
import com.tcctlo.law.searcher.CaseInformationEnterSearcher;
import com.tcctlo.law.service.ICaseInformationService;
import com.tcctlo.law.vo.CaseArchivedVO;
import com.tcctlo.law.vo.CaseInformationEnterOverrideVO;
import com.tcctlo.law.vo.CaseInformationEnterVO;
import com.tcctlo.law.vo.CaseInformationListVO;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,7 +26,6 @@ import java.util.Map;
* @author 张世琪
* @since 2025-02-06
*/
@RestController
@RequestMapping("/caseInformation")
public class CaseInformationController extends BaseController {
@ -34,16 +36,18 @@ public class CaseInformationController extends BaseController {
/**
* 案件审核
*
* @param params 参数案件编号审核状态审核意见idauditStatusauditOpinion
* @return
*/
@PostMapping(value = "/caseReview")
public AjaxResult caseReview(@RequestBody Map<String,Object> params) {
public AjaxResult caseReview(@RequestBody Map<String, Object> params) {
return AjaxResult.success(iCaseInformationService.caseReview(params));
}
/**
* 案件相关文件上传
*
* @param fileManager 案件相关文件
* @return
*/
@ -54,31 +58,34 @@ public class CaseInformationController extends BaseController {
/**
* 案件撤销
*
* @param params 参数案件编号收案状态idcaseStatus
* @return
*/
@PostMapping(value = "/claimWithdrawal")
public AjaxResult claimWithdrawal(@RequestBody Map<String,Object> params) {
public AjaxResult claimWithdrawal(@RequestBody Map<String, Object> params) {
return AjaxResult.success(iCaseInformationService.claimWithdrawal(params));
}
/**
* 案件终止
*
* @param params 参数案件编号收案状态idcaseStatus
* @return
*/
@PostMapping(value = "/closeCase")
public AjaxResult closeCase(@RequestBody Map<String,Object> params) {
public AjaxResult closeCase(@RequestBody Map<String, Object> params) {
return AjaxResult.success(iCaseInformationService.closeCase(params));
}
/**
* 设置案件结案
*
* @param params 参数案件编号审核状态审核意见idauditStatusauditOpinion
* @return
*/
@PostMapping(value = "/caseClosed")
public AjaxResult caseClosed(@RequestBody Map<String,Object> params) {
public AjaxResult caseClosed(@RequestBody Map<String, Object> params) {
return AjaxResult.success(iCaseInformationService.caseClosed(params));
}
@ -87,17 +94,17 @@ public class CaseInformationController extends BaseController {
*
* @param caseInfo 案件信息
* @return 是否录入成功
* TODO 需要调整案件录入修改详情列表删除接口
*/
@PostMapping(value = "/enterCaseInfo")
public AjaxResult enterCaseInfo(@RequestBody CaseInformationEnterVO caseInfo) {
Boolean result = iCaseInformationService.enterCaseInfo(caseInfo);
if (result) {
return AjaxResult.success("案件信息录入成功");
} else {
return AjaxResult.error("案件信息录入失败");
}
}
// @PostMapping(value = "/enterCaseInfo")
// public AjaxResult enterCaseInfo(@RequestBody CaseInformationEnterVO caseInfo) {
// Boolean result = iCaseInformationService.enterCaseInfo(caseInfo);
// if (result) {
// return AjaxResult.success("案件信息录入成功");
// } else {
// return AjaxResult.error("案件信息录入失败");
// }
// }
@PostMapping(value = "/list")
public AjaxResult list(@RequestParam(required = false) Integer current,
@RequestParam(required = false) Integer size,
@ -114,6 +121,7 @@ public class CaseInformationController extends BaseController {
/**
* 案件查询利冲信息库页面展示利冲信息对应的案件信息
*
* @param id 案件ID
* @return 案件信息
*/
@ -129,11 +137,11 @@ public class CaseInformationController extends BaseController {
* @param id 案件ID
* @return 结果集
*/
@GetMapping(value = "/selectCaseInfoById/{id}")
public AjaxResult selectCaseInfoById(@PathVariable("id") Long id) {
CaseInformationEnterVO caseInformationEnterVO = iCaseInformationService.selectCaseInfoById(id);
return AjaxResult.success(caseInformationEnterVO);
}
// @GetMapping(value = "/selectCaseInfoById/{id}")
// public AjaxResult selectCaseInfoById(@PathVariable("id") Long id) {
// CaseInformationEnterVO caseInformationEnterVO = iCaseInformationService.selectCaseInfoById(id);
// return AjaxResult.success(caseInformationEnterVO);
// }
/**
* 案件信息修改
@ -141,15 +149,15 @@ public class CaseInformationController extends BaseController {
* @param params 入参
* @return 是否修改成功
*/
@PostMapping(value = "/updateCaseInfo")
public AjaxResult updateCaseInfo(@RequestBody CaseInformationEnterVO params) {
Boolean res = iCaseInformationService.updateCaseInfo(params);
if (res) {
return AjaxResult.success("案件信息录入成功");
} else {
return AjaxResult.error("案件信息录入失败");
}
}
// @PostMapping(value = "/updateCaseInfo")
// public AjaxResult updateCaseInfo(@RequestBody CaseInformationEnterVO params) {
// Boolean res = iCaseInformationService.updateCaseInfo(params);
// if (res) {
// return AjaxResult.success("案件信息录入成功");
// } else {
// return AjaxResult.error("案件信息录入失败");
// }
// }
/**
* 案件归档单个案件
@ -201,11 +209,43 @@ public class CaseInformationController extends BaseController {
/**
* 根据案件状态统计案件数量
*
* @return
*/
@GetMapping("/statisticsCaseStatus")
public AjaxResult statisticsCaseStatus(@RequestParam(value = "type",required = false) Integer type){
public AjaxResult statisticsCaseStatus(@RequestParam(value = "type", required = false) Integer type) {
return AjaxResult.success(iCaseInformationService.statisticsCaseStatus(type));
}
/**
* 案件信息录入接口
*
* @param searcher
* @return
*/
@PostMapping(value = "/enterCaseInfo")
public AjaxResult enterCaseInfo(@RequestBody CaseInformationEnterSearcher searcher) {
Integer result = iCaseInformationService.enterCaseInfo2(searcher);
return AjaxResult.success(result);
}
/**
* 案件信息详情接口
*/
@GetMapping(value = "/selectCaseInfoById/{id}")
public AjaxResult selectCaseInfoById(@PathVariable("id") Long id) {
CaseInformationEnterOverrideVO vo = iCaseInformationService.selectCaseInfoByIdOverride(id);
return AjaxResult.success(vo);
}
/**
* 案件信息修改接口
*/
@PostMapping(value = "/updateCaseInfo")
public AjaxResult updateCaseInfo(@RequestBody CaseInformationEnterSearcher params) {
Integer result = iCaseInformationService.updateCaseInfoOverride(params);
return AjaxResult.success(result);
}
}

View File

@ -105,32 +105,33 @@ public class CollectionRecordController {
* 批量缴费
* @param params 参数
* @return 结果集
* TODO 待修改
*/
@PostMapping(value = "/casePaymentBatch")
public AjaxResult casePaymentBatch(@RequestBody List<CollectionRecordEnterVO> params) {
// @PostMapping(value = "/casePaymentBatch")
// public AjaxResult casePaymentBatch(@RequestBody List<CollectionRecordEnterVO> params) {
//
// AjaxResult ajaxResult = null;
// Boolean res = iCollectionRecordService.casePaymentBatch(params);
// if (res){
// ajaxResult = AjaxResult.success();
// return ajaxResult;
// }else {
// ajaxResult = AjaxResult.error();
// return ajaxResult;
// }
// }
AjaxResult ajaxResult = null;
Boolean res = iCollectionRecordService.casePaymentBatch(params);
if (res){
ajaxResult = AjaxResult.success();
return ajaxResult;
}else {
ajaxResult = AjaxResult.error();
return ajaxResult;
}
}
/**
* 案件缴费
* @param params 参数
* @return 缴费结果
*/
@PostMapping(value = "/casePayment")
public AjaxResult casePayment(@RequestBody CollectionRecordEnterVO params) {
iCollectionRecordService.casePayment(params);
return AjaxResult.success();
}
// /**
// * 案件缴费
// * @param params 参数
// * @return 缴费结果
// */
// @PostMapping(value = "/casePayment")
// public AjaxResult casePayment(@RequestBody CollectionRecordEnterVO params) {
//
// iCollectionRecordService.casePayment(params);
// return AjaxResult.success();
// }
@PostMapping(value = "/delete/{id}")
public AjaxResult delete(@PathVariable("id") Long id) {

View File

@ -2,7 +2,9 @@ package com.tcctlo.law.controller;
import com.tcctlo.common.core.domain.AjaxResult;
import com.tcctlo.law.entity.IndexStatistics;
import com.tcctlo.law.searcher.TimeSearcher;
import com.tcctlo.law.service.IIndexService;
import com.tcctlo.law.vo.IndexLawCaseMoneyInfo;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
@ -69,13 +71,13 @@ public class IndexController {
}
/**
* 统计所有律师信息
* @return 结果集
* 统计所有律师信息
* @return
*/
@PostMapping("/lawInfo")
public AjaxResult lawInfo() {
Object res = iIndexService.lawInfo();
return AjaxResult.success(res);
public AjaxResult lawInfo(TimeSearcher searcher) {
List<IndexLawCaseMoneyInfo> result = iIndexService.lawInfo(searcher);
return AjaxResult.success(result);
}
}

View File

@ -88,6 +88,6 @@ public class AuditRecord implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
}

View File

@ -1,4 +1,5 @@
package com.tcctlo.law.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
@ -12,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 案件信息表
@ -93,7 +95,7 @@ public class CaseInformation implements Serializable {
/**
* 付款期限备注
*/
private String paymentDeadlineRemake;
private String paymentDeadlineRemark;
/**
* 预留款
@ -154,13 +156,24 @@ public class CaseInformation implements Serializable {
/**
* 案件涉及律师ID集合
* FIXME 关联的地方进行修改后将该字段删除
*/
private String caseLawyerIds;
// private String caseLawyerIds;
/**
* 委托律师
*/
private Long entrustedLawyerId;
/**
* 协办律师多个逗号分隔
*/
private String coLawyerIds;
/**
* 案件信息备注
*/
private String caseRemake;
private String caseRemark;
/**
* 状态0正常1停用
@ -198,6 +211,18 @@ public class CaseInformation implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
/**
* 委托律师姓名
*/
@TableField(exist = false)
private String entrustedLawyerName;
/**
* 协办律师姓名,多个英文逗号分隔
*/
@TableField(exist = false)
private String coLawyerNames;
}

View File

@ -87,6 +87,6 @@ public class CaseLawyer implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
}

View File

@ -47,8 +47,13 @@ public class CollectionRecord implements Serializable {
/**
* 收款相关凭证关联文件管理表ID
* FIXME 修改完成后将该字段删除需要前端做调整
*/
private String collectionUrlId;
// private String collectionUrlId;
/** 收款记录凭证地址,多条收款凭证英文逗号分隔 */
private String collectionUrl;
/**
* 收款时间
@ -59,7 +64,7 @@ public class CollectionRecord implements Serializable {
/**
* 收款记录
*/
private String collectionRemake;
private String collectionRemark;
/**
* 收款人ID
@ -112,6 +117,6 @@ public class CollectionRecord implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
}

View File

@ -86,6 +86,6 @@ public class ContractFormParameter implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
}

View File

@ -125,6 +125,6 @@ public class ContractTemplate implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
}

View File

@ -87,6 +87,6 @@ public class DemandPaymentRecord implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
}

View File

@ -93,6 +93,6 @@ public class FileManager implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
}

View File

@ -107,6 +107,6 @@ public class ImpulseInformation implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
}

View File

@ -101,6 +101,6 @@ public class InvoiceRecord implements Serializable {
/**
* 备注
*/
private String remake;
private String remark;
}

View File

@ -3,7 +3,9 @@ package com.tcctlo.law.mapper;
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.searcher.TimeSearcher;
import com.tcctlo.law.vo.CaseInformationListVO;
import com.tcctlo.law.vo.IndexLawCaseMoneyInfo;
import com.tcctlo.law.vo.IndexLawInfo;
import org.apache.ibatis.annotations.Param;
@ -124,7 +126,7 @@ public interface CaseInformationMapper extends BaseMapper<CaseInformation> {
* @param params 参数
* @return 结案结果
*/
Boolean caseClosed(@Param("params") Map<String, Object> params);
Integer caseClosed(@Param("params") Map<String, Object> params);
/**
* 根据业务类型查询案件数量
@ -253,4 +255,10 @@ public interface CaseInformationMapper extends BaseMapper<CaseInformation> {
* @return 结果集
*/
BigDecimal selectLawCaseMoneyCount(@Param("lawId") Long lawId);
/**
* 统计所有律师的案件信息及已收款信息
* @return
*/
List<IndexLawCaseMoneyInfo> staticCaseNumAndMoney(TimeSearcher searcher);
}

View File

@ -21,6 +21,7 @@ public interface ImpulseInformationMapper extends BaseMapper<ImpulseInformation>
/**
* 批量插入
*
* @param list 数据集
* @return 受影响行数
*/
@ -28,6 +29,7 @@ public interface ImpulseInformationMapper extends BaseMapper<ImpulseInformation>
/**
* 批量软删除
*
* @param list 参数
* @return 结果集
*/
@ -36,7 +38,8 @@ public interface ImpulseInformationMapper extends BaseMapper<ImpulseInformation>
/**
* 根据案件id查询
* @param caseId 案件ID
*
* @param caseId 案件ID
* @param clientFlag 是否委托方标志
* @return 结果集
*/
@ -44,6 +47,7 @@ public interface ImpulseInformationMapper extends BaseMapper<ImpulseInformation>
/**
* 查询修改后的委托方+相对方信息
*
* @param caseId 案件ID
* @return 结果集
*/
@ -51,6 +55,7 @@ public interface ImpulseInformationMapper extends BaseMapper<ImpulseInformation>
/**
* 利冲检索
*
* @param impulseInformation 检索数据
* @return 结果集
*/
@ -58,6 +63,7 @@ public interface ImpulseInformationMapper extends BaseMapper<ImpulseInformation>
/**
* 根据案件ID批量删除
*
* @param caseId 案件ID集合
* @return 结果集
*/
@ -66,7 +72,8 @@ public interface ImpulseInformationMapper extends BaseMapper<ImpulseInformation>
/**
* 分页条件查询
* @param page 分页
*
* @param page 分页
* @param condition 条件
* @return 结果集
*/
@ -74,8 +81,17 @@ public interface ImpulseInformationMapper extends BaseMapper<ImpulseInformation>
/**
* 根据案件ID查询利冲信息在审核时做利冲消息提示
*
* @param caseId 案件ID
* @return 结果集
*/
List<ImpulseInformation> auditClashMsg(Long caseId);
/**
* 根据caseId将利冲信息表中关联案件的利冲信息置为无需检索
*
* @param caseId
* @return
*/
Integer updateByCaseId(@Param("caseId") Long caseId);
}

View File

@ -0,0 +1,42 @@
package com.tcctlo.law.searcher;
import com.tcctlo.law.entity.CaseInformation;
import com.tcctlo.law.entity.CaseLawyer;
import com.tcctlo.law.entity.ImpulseInformation;
import com.tcctlo.law.vo.CollectionRecordEnterVO;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data
public class CaseInformationEnterSearcher implements Serializable {
private static final long serialVersionUID = 4014133758567882903L;
/**
* 案件未收款的金额
*/
private BigDecimal uncollectedMoney;
/**
* 案件信息
*/
private CaseInformation caseInformation;
/**
* 利冲信息-委托方信息
*/
private List<ImpulseInformation> entrustingParty;
/**
* 利冲信息-相对方
*/
private List<ImpulseInformation> opposite;
/**
* 案件收款记录信息
*/
private List<CollectionRecordSearcher> collectionRecordList;
}

View File

@ -0,0 +1,62 @@
package com.tcctlo.law.searcher;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CollectionRecordSearcher implements Serializable {
private static final long serialVersionUID = 3318529006642229496L;
/**
* 主键ID
*/
private Long id;
/**
* 关联案件表id
*/
private Long caseId;
/**
* 收款方式
*/
private String collectionType;
/**
* 已收金额
*/
private BigDecimal amountReceived;
/** 收款记录凭证地址,多条收款凭证英文逗号分隔 */
private String collectionUrl;
/**
* 收款时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date collectionDate;
/**
* 收款记录备注
*/
private String collectionRemark;
/**
* 收款人ID
*/
private Long userId;
/**
* 收款人名称
*/
private String userName;
}

View File

@ -0,0 +1,21 @@
package com.tcctlo.law.searcher;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class TimeSearcher implements Serializable {
private static final long serialVersionUID = 4196456675491042591L;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
/** 结束时间 */
private Date endTime;
}

View File

@ -5,7 +5,9 @@ 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.searcher.CaseInformationEnterSearcher;
import com.tcctlo.law.vo.CaseArchivedVO;
import com.tcctlo.law.vo.CaseInformationEnterOverrideVO;
import com.tcctlo.law.vo.CaseInformationEnterVO;
import com.tcctlo.law.vo.CaseInformationListVO;
@ -88,21 +90,21 @@ public interface ICaseInformationService extends IService<CaseInformation>{
* @param caseInfo 案件信息
* @return 是否录入成功
*/
Boolean enterCaseInfo(CaseInformationEnterVO caseInfo);
// Boolean enterCaseInfo(CaseInformationEnterVO caseInfo);
/**
* 根据案件ID查询案件详细信息
* @param id 案件ID
* @return 结果集
*/
CaseInformationEnterVO selectCaseInfoById(Long id);
// CaseInformationEnterVO selectCaseInfoById(Long id);
/**
* 案件信息修改
* @param params 案件信息
* @return 受影响行数
*/
Boolean updateCaseInfo(CaseInformationEnterVO params);
// Boolean updateCaseInfo(CaseInformationEnterVO params);
/**
* 删除案件信息
@ -145,7 +147,7 @@ public interface ICaseInformationService extends IService<CaseInformation>{
* @param params 参数
* @return 是否结案成功
*/
Boolean caseClosed(Map<String, Object> params);
Integer caseClosed(Map<String, Object> params);
/**
* 案件相关文件上传
@ -159,4 +161,25 @@ public interface ICaseInformationService extends IService<CaseInformation>{
*/
Map<String, List<CaseStatistics>> statisticsCaseStatus(Integer type);
/**
*
* 案件信息录入
* @param searcher
* @return
*/
Integer enterCaseInfo2(CaseInformationEnterSearcher searcher);
/**
* 案件信息详情接口
* @param id
* @return
*/
CaseInformationEnterOverrideVO selectCaseInfoByIdOverride(Long id);
/**
* 案件信息修改接口
* @param params
* @return
*/
Integer updateCaseInfoOverride(CaseInformationEnterSearcher params);
}

View File

@ -75,14 +75,14 @@ public interface ICollectionRecordService extends IService<CollectionRecord> {
*
* @param params 参数
*/
void casePayment(CollectionRecordEnterVO params);
// void casePayment(CollectionRecordEnterVO params);
/**
* 批量案件缴费
*
* @param params 参数
*/
Boolean casePaymentBatch(List<CollectionRecordEnterVO> params);
// /**
// * 批量案件缴费
// *
// * @param params 参数
// */
// Boolean casePaymentBatch(List<CollectionRecordEnterVO> params);
/**
* 逻辑删除缴费记录

View File

@ -1,6 +1,8 @@
package com.tcctlo.law.service;
import com.tcctlo.law.entity.IndexStatistics;
import com.tcctlo.law.searcher.TimeSearcher;
import com.tcctlo.law.vo.IndexLawCaseMoneyInfo;
import java.util.Date;
import java.util.List;
@ -44,5 +46,5 @@ public interface IIndexService {
* 所有律师信息
* @return 结果集
*/
Object lawInfo();
List<IndexLawCaseMoneyInfo> lawInfo(TimeSearcher searcher);
}

View File

@ -3,24 +3,30 @@ 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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tcctlo.common.core.domain.entity.SysRole;
import com.tcctlo.common.core.domain.entity.SysUser;
import com.tcctlo.common.core.domain.model.LoginUser;
import com.tcctlo.common.utils.SecurityUtils;
import com.tcctlo.common.utils.StringUtils;
import com.tcctlo.law.CaseEnum;
import com.tcctlo.law.entity.*;
import com.tcctlo.law.mapper.*;
import com.tcctlo.law.searcher.CaseInformationEnterSearcher;
import com.tcctlo.law.searcher.CollectionRecordSearcher;
import com.tcctlo.law.service.*;
import com.tcctlo.law.tools.RedisGenerateCaseNo;
import com.tcctlo.law.tools.RichTextToWordSimple;
import com.tcctlo.law.vo.*;
import com.tcctlo.system.mapper.SysUserMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
@ -73,7 +79,7 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
* 利冲信息service
*/
@Resource
private IImpulseInformationService informationService;
private IImpulseInformationService impulseInformationService;
/**
* 案件关联律师mapper
@ -117,6 +123,7 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
@Resource
private InvoiceRecordMapper invoiceRecordMapper;
/*@Override
public Page<CaseInformation> list(Integer pageNo, Integer pageSize, Map<String, Object> params) {
LoginUser loginUser = SecurityUtils.getLoginUser();
@ -176,7 +183,7 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
Date paymentDeadline = item.getPaymentDeadline();
if (paymentDeadline != null) {
if (DateUtil.compare(paymentDeadline, new Date()) < 0 && item.getAmountReceivedSum().compareTo(item.getAmountReceivable()) < 0) {
caseInformationMapper.updateCollectionStatus(item.getId(),3);
caseInformationMapper.updateCollectionStatus(item.getId(), 3);
}
}
@ -190,28 +197,46 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
item.setOpposite(opposite.stream().map(ImpulseInformation::getCaseName).collect(Collectors.joining(",")));
}
CaseLawyer attorneyAgent = caseLawyerMapper.selectAttorneyAgentLawByCaseId(item.getId());
if (BeanUtil.isNotEmpty(attorneyAgent)) {
item.setAttorneyAgent(attorneyAgent.getLawyerName());
// CaseLawyer attorneyAgent = caseLawyerMapper.selectAttorneyAgentLawByCaseId(item.getId());
// if (BeanUtil.isNotEmpty(attorneyAgent)) {
// item.setAttorneyAgent(attorneyAgent.getLawyerName());
// }
//处理委托律师及协办律师姓名
List<SysUser> sysUserList = sysUserMapper.queryUserList();
Map<Long, String> userIdAndNameMap = new HashMap<>();
if (!CollectionUtils.isEmpty(sysUserList)) {
for (SysUser sysUser : sysUserList) {
userIdAndNameMap.put(sysUser.getUserId(), sysUser.getNickName());
}
}
item.setEntrustedLawyerName(userIdAndNameMap.get(item.getEntrustedLawyerId()));
// 考虑协办律师可能为空的情况需要进行判空处理
if (!StringUtils.isEmpty(item.getCoLawyerIds())) {
List<String> coLawyerIds = Arrays.asList(item.getCoLawyerIds().split(","));
List<String> coLawyerNames = new ArrayList<>();
for (String coLawyerId : coLawyerIds) {
coLawyerNames.add(userIdAndNameMap.get(Long.parseLong(coLawyerId)));
}
item.setCoLawyerNames(StringUtils.join(coLawyerNames, ","));
}
List<CaseLawyer> assistingLawyer = caseLawyerMapper.selectAssistingLawyerByCaseId(item.getId());
if (CollUtil.isNotEmpty(assistingLawyer)) {
item.setAssistingLawyer(assistingLawyer.stream().map(CaseLawyer::getLawyerName).collect(Collectors.joining(",")));
}
// List<CaseLawyer> assistingLawyer = caseLawyerMapper.selectAssistingLawyerByCaseId(item.getId());
// if (CollUtil.isNotEmpty(assistingLawyer)) {
// item.setAssistingLawyer(assistingLawyer.stream().map(CaseLawyer::getLawyerName).collect(Collectors.joining(",")));
// }
item.setUncollectedMoney(item.getAmountReceivable().subtract(item.getAmountReceivedSum()));
int fileNum = caseInformationMapper.selectCaseFileNum(item.getId());
item.setFileFlag(fileNum > 0);
item.setFileList(fileManagerMapper.selectFileByCaseId(item.getId()));
// int fileNum = caseInformationMapper.selectCaseFileNum(item.getId());
// item.setFileFlag(fileNum > 0);
// item.setFileList(fileManagerMapper.selectFileByCaseId(item.getId()));
//开票状态
List<InvoiceRecordVO> invoiceRecords = invoiceRecordMapper.selectByCaseId(item.getId());
if (invoiceRecords.size() > 0){
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 {
} else {
item.setInvoiceStatus("0");
}
@ -224,8 +249,23 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
@Override
public CaseInformationListVO selectCaseById(Long id) {
CaseInformationListVO item = caseInformationMapper.selectCaseById(id);
item.setAttorneyAgent(caseLawyerMapper.selectAttorneyAgentLawByCaseId(item.getId()).getLawyerName()); //代理律师
item.setAssistingLawyer(caseLawyerMapper.selectAssistingLawyerByCaseId(item.getId()).stream().map(CaseLawyer::getLawyerName).collect(Collectors.joining(","))); //协办律师
List<SysUser> sysUserList = sysUserMapper.queryUserList();
Map<Long, String> userIdAndNameMap = new HashMap<>();
if (!CollectionUtils.isEmpty(sysUserList)) {
for (SysUser sysUser : sysUserList) {
userIdAndNameMap.put(sysUser.getUserId(), sysUser.getNickName());
}
}
item.setEntrustedLawyerName(userIdAndNameMap.get(item.getEntrustedLawyerId()));
// 考虑协办律师可能为空的情况需要进行判空处理
if (!StringUtils.isEmpty(item.getCoLawyerIds())) {
List<String> coLawyerIds = Arrays.asList(item.getCoLawyerIds().split(","));
List<String> coLawyerNames = new ArrayList<>();
for (String coLawyerId : coLawyerIds) {
coLawyerNames.add(userIdAndNameMap.get(Long.parseLong(coLawyerId)));
}
item.setCoLawyerNames(StringUtils.join(coLawyerNames, ","));
}
return item;
}
@ -324,237 +364,236 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
return "null";
}
@Override
@Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
public Boolean enterCaseInfo(CaseInformationEnterVO caseInfo) {
// @Override
// @Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
// public Boolean enterCaseInfo(CaseInformationEnterVO caseInfo) {
//
// LoginUser loginUser = SecurityUtils.getLoginUser();
// Long userId = loginUser.getUserId();
// String username = loginUser.getUsername();
// String nickName = loginUser.getUser().getNickName();
// try {
// CaseInformation caseInformation = caseInfo.getCaseInformation(); //案件信息
// caseInformation.setCaseNo(redisGenerateCaseNo.generateCaseNo(Integer.parseInt(caseInformation.getBusinessClassify()))); //生成案件编号
//
//
// caseInformationMapper.insert(caseInfo.getCaseInformation()); //插入案件信息
// Long caseId = caseInformation.getId(); //获取案件ID
//
// Date paymentDeadline = caseInformation.getPaymentDeadline();
// if (paymentDeadline != null) {
// if (DateUtil.compare(paymentDeadline, new Date()) < 0 && caseInformation.getAmountReceivedSum().compareTo(caseInformation.getAmountReceivable()) < 0) {
// caseInformationMapper.updateCollectionStatus(caseId, 3);
// }
// }
//
//
// //插入案件关联利冲信息设置委托方和相对方
// List<ImpulseInformation> impulseInformationList = new ArrayList<>();
// List<ImpulseInformation> entrustingParty = caseInfo.getEntrustingParty();
// if (CollUtil.isNotEmpty(entrustingParty)) {
// impulseInformationList.addAll(caseInfo.getEntrustingParty().stream().peek(item -> {
// item.setCaseId(caseId);
// item.setIsClient(0);
// }).collect(Collectors.toList()));
// }
// List<ImpulseInformation> opposite = caseInfo.getOpposite();
// if (CollUtil.isNotEmpty(opposite)) {
// impulseInformationList.addAll(caseInfo.getOpposite().stream().peek(item -> {
// item.setCaseId(caseId);
// item.setIsClient(1);
// }).collect(Collectors.toList()));
// }
// impulseInformationService.saveBatch(impulseInformationList);
// List<Long> impulseInformationIds = impulseInformationList.stream().map(item -> item.getId()).collect(Collectors.toList());
// caseInformation.setImpulseInformationIds(StringUtils.join(impulseInformationIds, ","));
//
// //插入案件关联律师数据
// List<CaseLawyer> caseLawyerList = new ArrayList<>();
// CaseLawyer attorneyAgent = caseInfo.getAttorneyAgent();
// if (BeanUtil.isNotEmpty(attorneyAgent)) {
// attorneyAgent.setLawyerType(0);
// attorneyAgent.setCaseId(caseId);
// caseLawyerList.add(attorneyAgent); //代理律师
// }
// List<CaseLawyer> assistingLawyer = caseInfo.getAssistingLawyer();
// if (CollUtil.isNotEmpty(assistingLawyer)) {
// caseLawyerList.addAll(assistingLawyer.stream().peek(item -> {
// item.setCaseId(caseId);
// item.setLawyerType(1);
// }).collect(Collectors.toList())); //协办律师
// }
// caseLawyerService.saveBatch(caseLawyerList);
// List<Long> caseLawyerIds = caseLawyerList.stream().map(item -> item.getLawyerId()).collect(Collectors.toList());
// caseInformation.setCaseLawyerIds(StringUtils.join(caseLawyerIds, ","));
// caseInformationMapper.updateById(caseInformation); //更新案件表中的律师IDS和利冲信息IDS
//
// //插入案件关联收款记录信息收款记录文件插入
// List<CollectionRecordEnterVO> collectionRecordList = caseInfo.getCollectionRecordList();
// if (CollUtil.isNotEmpty(collectionRecordList)) {
// collectionRecordList.forEach(item -> {
// item.setCaseId(caseId);
// List<FileManager> fileManagerList = item.getFileManager().stream().peek(i -> {
// i.setCaseId(caseId);
// i.setFileType(1); //设置文件类型为收款记录文件
// }).collect(Collectors.toList());
// fileManagerService.saveBatch(fileManagerList);
// List<Long> fileIds = fileManagerList.stream().map(FileManager::getId).collect(Collectors.toList());
// item.setCollectionUrlId(StringUtils.join(fileIds, ","));
// item.setUserId(userId);
// item.setUserName(nickName);
// String collect = loginUser.getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.joining(","));
// if (!collect.contains("FINANCE")) {
// item.setAuditStatus(0);
// } else {
// item.setAuditStatus(1);
// }
// collectionRecordMapper.insert(item);
// });
// }
// } catch (Exception e) {
// throw new RuntimeException("案件录入失败");
// }
// return true;
// }
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserId();
String username = loginUser.getUsername();
String nickName = loginUser.getUser().getNickName();
try {
CaseInformation caseInformation = caseInfo.getCaseInformation(); //案件信息
caseInformation.setCaseNo(redisGenerateCaseNo.generateCaseNo(Integer.parseInt(caseInformation.getBusinessClassify()))); //生成案件编号
// @Override
// public CaseInformationEnterVO selectCaseInfoById(Long id) {
// CaseInformationEnterVO result = new CaseInformationEnterVO();
// //案件信息表----caseInformation
// CaseInformation caseInformation = caseInformationMapper.selectCaseInfoById(id);
// result.setCaseInformation(caseInformation);
//
// //设置案件未收金额
// result.setUncollectedMoney(caseInformation.getAmountReceivable().subtract(caseInformation.getAmountReceivedSum()));
//
// //案件关联委托方----entrustingParty
// result.setEntrustingParty(informationMapper.selectByCaseId(id, 0));
//
// //案件关联相对方----opposite
// result.setOpposite(informationMapper.selectByCaseId(id, 1));
//
// //代理律师----attorneyAgent
// result.setAttorneyAgent(caseLawyerMapper.selectAttorneyAgentLawByCaseId(id));
//
// //协办律师----assistingLawyer
// result.setAssistingLawyer(caseLawyerMapper.selectAssistingLawyerByCaseId(id));
//
// /**
// * 收款记录----collectionRecordList
// * 收款记录基本信息
// * 收款记录文件
// */
// List<CollectionRecordEnterVO> records = collectionRecordMapper.selectByCaseId(id);
// result.setCollectionRecordList(records);
// records.stream().peek(item -> {
// if (StringUtils.isNotBlank(item.getCollectionUrlId())) {
// List<Long> fileIds = Arrays.stream(item.getCollectionUrlId().split(","))
// .map(Long::parseLong)
// .collect(Collectors.toList());
// item.setFileManager(fileManagerMapper.selectBatchIds(fileIds));
// }
// }).collect(Collectors.toList());
// return result;
// }
caseInformationMapper.insert(caseInfo.getCaseInformation()); //插入案件信息
Long caseId = caseInformation.getId(); //获取案件ID
Date paymentDeadline = caseInformation.getPaymentDeadline();
if (paymentDeadline != null) {
if (DateUtil.compare(paymentDeadline, new Date()) < 0 && caseInformation.getAmountReceivedSum().compareTo(caseInformation.getAmountReceivable()) < 0) {
caseInformationMapper.updateCollectionStatus(caseId,3);
}
}
//插入案件关联利冲信息设置委托方和相对方
List<ImpulseInformation> impulseInformationList = new ArrayList<>();
List<ImpulseInformation> entrustingParty = caseInfo.getEntrustingParty();
if (CollUtil.isNotEmpty(entrustingParty)) {
impulseInformationList.addAll(caseInfo.getEntrustingParty().stream().peek(item -> {
item.setCaseId(caseId);
item.setIsClient(0);
}).collect(Collectors.toList()));
}
List<ImpulseInformation> opposite = caseInfo.getOpposite();
if (CollUtil.isNotEmpty(opposite)) {
impulseInformationList.addAll(caseInfo.getOpposite().stream().peek(item -> {
item.setCaseId(caseId);
item.setIsClient(1);
}).collect(Collectors.toList()));
}
informationService.saveBatch(impulseInformationList);
List<Long> impulseInformationIds = impulseInformationList.stream().map(item -> item.getId()).collect(Collectors.toList());
caseInformation.setImpulseInformationIds(StringUtils.join(impulseInformationIds, ","));
//插入案件关联律师数据
List<CaseLawyer> caseLawyerList = new ArrayList<>();
CaseLawyer attorneyAgent = caseInfo.getAttorneyAgent();
if (BeanUtil.isNotEmpty(attorneyAgent)) {
attorneyAgent.setLawyerType(0);
attorneyAgent.setCaseId(caseId);
caseLawyerList.add(attorneyAgent); //代理律师
}
List<CaseLawyer> assistingLawyer = caseInfo.getAssistingLawyer();
if (CollUtil.isNotEmpty(assistingLawyer)) {
caseLawyerList.addAll(assistingLawyer.stream().peek(item -> {
item.setCaseId(caseId);
item.setLawyerType(1);
}).collect(Collectors.toList())); //协办律师
}
caseLawyerService.saveBatch(caseLawyerList);
List<Long> caseLawyerIds = caseLawyerList.stream().map(item -> item.getLawyerId()).collect(Collectors.toList());
caseInformation.setCaseLawyerIds(StringUtils.join(caseLawyerIds, ","));
caseInformationMapper.updateById(caseInformation); //更新案件表中的律师IDS和利冲信息IDS
//插入案件关联收款记录信息收款记录文件插入
List<CollectionRecordEnterVO> collectionRecordList = caseInfo.getCollectionRecordList();
if (CollUtil.isNotEmpty(collectionRecordList)) {
collectionRecordList.forEach(item -> {
item.setCaseId(caseId);
List<FileManager> fileManagerList = item.getFileManager().stream().peek(i -> {
i.setCaseId(caseId);
i.setFileType(1); //设置文件类型为收款记录文件
}).collect(Collectors.toList());
fileManagerService.saveBatch(fileManagerList);
List<Long> fileIds = fileManagerList.stream().map(FileManager::getId).collect(Collectors.toList());
item.setCollectionUrlId(StringUtils.join(fileIds, ","));
item.setUserId(userId);
item.setUserName(nickName);
String collect = loginUser.getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.joining(","));
if (!collect.contains("FINANCE")) {
item.setAuditStatus(0);
} else {
item.setAuditStatus(1);
}
collectionRecordMapper.insert(item);
});
}
} catch (Exception e) {
throw new RuntimeException("案件录入失败");
}
return true;
}
@Override
public CaseInformationEnterVO selectCaseInfoById(Long id) {
CaseInformationEnterVO result = new CaseInformationEnterVO();
//案件信息表----caseInformation
CaseInformation caseInformation = caseInformationMapper.selectCaseInfoById(id);
result.setCaseInformation(caseInformation);
//设置案件未收金额
result.setUncollectedMoney(caseInformation.getAmountReceivable().subtract(caseInformation.getAmountReceivedSum()));
//案件关联委托方----entrustingParty
result.setEntrustingParty(informationMapper.selectByCaseId(id, 0));
//案件关联相对方----opposite
result.setOpposite(informationMapper.selectByCaseId(id, 1));
//代理律师----attorneyAgent
result.setAttorneyAgent(caseLawyerMapper.selectAttorneyAgentLawByCaseId(id));
//协办律师----assistingLawyer
result.setAssistingLawyer(caseLawyerMapper.selectAssistingLawyerByCaseId(id));
/**
* 收款记录----collectionRecordList
* 收款记录基本信息
* 收款记录文件
*/
List<CollectionRecordEnterVO> records = collectionRecordMapper.selectByCaseId(id);
result.setCollectionRecordList(records);
records.stream().peek(item -> {
if (StringUtils.isNotBlank(item.getCollectionUrlId())) {
List<Long> fileIds = Arrays.stream(item.getCollectionUrlId().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
item.setFileManager(fileManagerMapper.selectBatchIds(fileIds));
}
}).collect(Collectors.toList());
return result;
}
@Override
@Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
public Boolean updateCaseInfo(CaseInformationEnterVO params) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserId();
String username = loginUser.getUsername();
String nickName = loginUser.getUser().getNickName();
try {
//案件信息表----caseInformation
CaseInformation caseInformation = params.getCaseInformation();
Long caseId = caseInformation.getId();
//案件关联委托方----entrustingParty--从数据库获取出原来的委托方信息与通过接口传入的进行比对
List<ImpulseInformation> oldImpulse = informationMapper.selectByCaseId(params.getCaseInformation().getId(), 0);
List<ImpulseInformation> newImpulse = params.getEntrustingParty();
editImpulseInformation(oldImpulse, newImpulse, caseId);
//案件关联相对方----opposite
List<ImpulseInformation> oldOpposite = informationMapper.selectByCaseId(params.getCaseInformation().getId(), 1);
List<ImpulseInformation> newOpposite = params.getOpposite();
editImpulseInformation(oldOpposite, newOpposite, caseId);
caseInformation.setImpulseInformationIds(informationMapper.selectByCaseIdAdnDelFlag(params.getCaseInformation().getId()).stream().map(i -> i.getId().toString()).collect(Collectors.joining(",")));
//代理律师----attorneyAgent----修改原来的律师信息
CaseLawyer newAttorneyAgent = params.getAttorneyAgent();
if (BeanUtil.isNotEmpty(newAttorneyAgent)) {
if (newAttorneyAgent.getId() == null) {
CaseLawyer oldCaseLawyer = caseLawyerMapper.selectAttorneyAgentLawByCaseId(params.getCaseInformation().getId());
if (oldCaseLawyer != null) {
oldCaseLawyer.setIsPrime(1);
caseLawyerMapper.updateById(oldCaseLawyer);
}
newAttorneyAgent.setCaseId(params.getCaseInformation().getId());
caseLawyerMapper.insert(newAttorneyAgent);
}
}
//协办律师----assistingLawyer
List<CaseLawyer> newAssistingLawyer = params.getAssistingLawyer(); //协办律师
List<CaseLawyer> oldAssistingLawyer = caseLawyerMapper.selectAssistingLawyerByCaseId(params.getCaseInformation().getId());
editAssistingLawyer(oldAssistingLawyer, newAssistingLawyer, caseId);
caseInformation.setCaseLawyerIds(caseLawyerMapper.selectAllPrimeLawyerByCaseId(params.getCaseInformation().getId()).stream().map(c -> c.getLawyerId().toString()).collect(Collectors.joining(",")));
/**
* 收款记录----collectionRecordList
* 收款记录基本信息----collectionRecord
* 收款记录文件----fileManager
*/
List<CollectionRecordEnterVO> newData = params.getCollectionRecordList(); //收款记录信息
List<CollectionRecordEnterVO> oldData = collectionRecordMapper.selectByCaseId(caseId);
List<Long> newIds = newData.stream().map(item -> item.getId()).collect(Collectors.toList());
List<Long> oldIds = oldData.stream().map(item -> item.getId()).collect(Collectors.toList());
//获取新添加的收款记录计算出新的收款记录金额在总金额中加上
List<CollectionRecordEnterVO> insert = newData.stream().filter(item -> item.getId() == null).peek(item -> item.setCaseId(caseId)).collect(Collectors.toList());
insert.forEach(item -> {
List<FileManager> fileManager = item.getFileManager().stream().peek(i -> i.setCaseId(caseId)).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")) {
item.setAuditStatus(0);
} else {
item.setAuditStatus(1);
}
});
List<CollectionRecord> list = BeanUtil.copyToList(insert, CollectionRecord.class);
collectionRecordService.saveBatch(list);
//获取删除的收款记录,计算出删除的收款记录的金额在总金额中减去
List<Long> deleteIds = (List<Long>) CollUtil.subtract(oldIds, newIds);
List<CollectionRecordEnterVO> deleteData = oldData.stream().filter(item -> CollUtil.contains(deleteIds, item.getId())).peek(item -> {
item.setDelFlag(1);
item.setStatus(1);
}).collect(Collectors.toList());
for (CollectionRecordEnterVO item : deleteData) {
//根据caseId和收款记录ID删除收款记录
collectionRecordMapper.removeByCaseIdAdnRecordId(item.getId(), caseId);
//根据caseId和收款记录ID删除收款记录文件
List<Long> fileIds = Arrays.stream(item.getCollectionUrlId().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
fileManagerMapper.removeByCaseIdAndFileIds(caseId, fileIds);
}
caseInformationMapper.updateById(caseInformation);
} catch (Exception e) {
throw new RuntimeException("保存失败");
}
return true;
}
// @Override
// @Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
// public Boolean updateCaseInfo(CaseInformationEnterVO params) {
//
// LoginUser loginUser = SecurityUtils.getLoginUser();
// Long userId = loginUser.getUserId();
// String username = loginUser.getUsername();
// String nickName = loginUser.getUser().getNickName();
// try {
// //案件信息表----caseInformation
// CaseInformation caseInformation = params.getCaseInformation();
// Long caseId = caseInformation.getId();
//
// //案件关联委托方----entrustingParty--从数据库获取出原来的委托方信息与通过接口传入的进行比对
// List<ImpulseInformation> oldImpulse = informationMapper.selectByCaseId(params.getCaseInformation().getId(), 0);
// List<ImpulseInformation> newImpulse = params.getEntrustingParty();
// editImpulseInformation(oldImpulse, newImpulse, caseId);
//
// //案件关联相对方----opposite
// List<ImpulseInformation> oldOpposite = informationMapper.selectByCaseId(params.getCaseInformation().getId(), 1);
// List<ImpulseInformation> newOpposite = params.getOpposite();
// editImpulseInformation(oldOpposite, newOpposite, caseId);
// caseInformation.setImpulseInformationIds(informationMapper.selectByCaseIdAdnDelFlag(params.getCaseInformation().getId()).stream().map(i -> i.getId().toString()).collect(Collectors.joining(",")));
//
//
// //代理律师----attorneyAgent----修改原来的律师信息
// CaseLawyer newAttorneyAgent = params.getAttorneyAgent();
// if (BeanUtil.isNotEmpty(newAttorneyAgent)) {
// if (newAttorneyAgent.getId() == null) {
// CaseLawyer oldCaseLawyer = caseLawyerMapper.selectAttorneyAgentLawByCaseId(params.getCaseInformation().getId());
// if (oldCaseLawyer != null) {
// oldCaseLawyer.setIsPrime(1);
// caseLawyerMapper.updateById(oldCaseLawyer);
// }
// newAttorneyAgent.setCaseId(params.getCaseInformation().getId());
// caseLawyerMapper.insert(newAttorneyAgent);
// }
// }
//
//
// //协办律师----assistingLawyer
// List<CaseLawyer> newAssistingLawyer = params.getAssistingLawyer(); //协办律师
// List<CaseLawyer> oldAssistingLawyer = caseLawyerMapper.selectAssistingLawyerByCaseId(params.getCaseInformation().getId());
// editAssistingLawyer(oldAssistingLawyer, newAssistingLawyer, caseId);
// caseInformation.setCoLawyerIds(caseLawyerMapper.selectAllPrimeLawyerByCaseId(params.getCaseInformation().getId()).stream().map(c -> c.getLawyerId().toString()).collect(Collectors.joining(",")));
//
// /**
// * 收款记录----collectionRecordList
// * 收款记录基本信息----collectionRecord
// * 收款记录文件----fileManager
// */
// List<CollectionRecordEnterVO> newData = params.getCollectionRecordList(); //收款记录信息
// List<CollectionRecordEnterVO> oldData = collectionRecordMapper.selectByCaseId(caseId);
// List<Long> newIds = newData.stream().map(item -> item.getId()).collect(Collectors.toList());
// List<Long> oldIds = oldData.stream().map(item -> item.getId()).collect(Collectors.toList());
// //获取新添加的收款记录计算出新的收款记录金额在总金额中加上
// List<CollectionRecordEnterVO> insert = newData.stream().filter(item -> item.getId() == null).peek(item -> item.setCaseId(caseId)).collect(Collectors.toList());
// insert.forEach(item -> {
// List<FileManager> fileManager = item.getFileManager().stream().peek(i -> i.setCaseId(caseId)).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")) {
// item.setAuditStatus(0);
// } else {
// item.setAuditStatus(1);
// }
//
// });
// List<CollectionRecord> list = BeanUtil.copyToList(insert, CollectionRecord.class);
// collectionRecordService.saveBatch(list);
//
// //获取删除的收款记录,计算出删除的收款记录的金额在总金额中减去
// List<Long> deleteIds = (List<Long>) CollUtil.subtract(oldIds, newIds);
// List<CollectionRecordEnterVO> deleteData = oldData.stream().filter(item -> CollUtil.contains(deleteIds, item.getId())).peek(item -> {
// item.setDelFlag(1);
// item.setStatus(1);
// }).collect(Collectors.toList());
//
//
// for (CollectionRecordEnterVO item : deleteData) {
// //根据caseId和收款记录ID删除收款记录
// collectionRecordMapper.removeByCaseIdAdnRecordId(item.getId(), caseId);
// //根据caseId和收款记录ID删除收款记录文件
// List<Long> fileIds = Arrays.stream(item.getCollectionUrlId().split(","))
// .map(Long::parseLong)
// .collect(Collectors.toList());
// fileManagerMapper.removeByCaseIdAndFileIds(caseId, fileIds);
// }
// caseInformationMapper.updateById(caseInformation);
// } catch (Exception e) {
// throw new RuntimeException("保存失败");
// }
// return true;
// }
@Override
@Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
@ -566,11 +605,11 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
.collect(Collectors.toList());
caseInformationMapper.removeByIds(longList);
//逻辑删除案件相关律师信息
caseLawyerMapper.deleteLawyerByCaseId(longList);
// caseLawyerMapper.deleteLawyerByCaseId(longList);
//逻辑删除收款记录
collectionRecordMapper.removeByCaseId(longList);
//逻辑删除案件相关文件
fileManagerMapper.removeByCaseId(longList);
// fileManagerMapper.removeByCaseId(longList);
//将案件相关利冲信息设置为不需要检索并将状态设置为停用删除标志设置为已删除
informationMapper.removeByCaseId(longList);
} catch (Exception e) {
@ -613,8 +652,11 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
}
@Override
public Boolean caseClosed(Map<String, Object> params) {
return caseInformationMapper.caseClosed(params);
public Integer caseClosed(Map<String, Object> params) {
Integer result = caseInformationMapper.caseClosed(params);
//案件结案后需要将利冲信息表中的用户信息置为无需检索
impulseInformationMapper.updateByCaseId((Long) params.get("id"));
return result;
}
@Override
@ -628,7 +670,8 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
return getStatisticsCaseStatusDate(type);
}
public Map<String, List<CaseStatistics>> getStatisticsCaseStatusDate(Integer type){
public Map<String, List<CaseStatistics>> getStatisticsCaseStatusDate(Integer type) {
LoginUser loginUser = SecurityUtils.getLoginUser();
String roleKey = sysUserMapper.selectUserRoleByUserId(loginUser.getUserId());
@ -723,14 +766,195 @@ public class CaseInformationServiceImpl extends ServiceImpl<CaseInformationMappe
if (CollUtil.isNotEmpty(insert)) {
informationService.saveBatch(insert);
impulseInformationService.saveBatch(insert);
}
if (CollUtil.isNotEmpty(updateDate)) {
informationService.updateBatchById(updateDate);
impulseInformationService.updateBatchById(updateDate);
}
if (CollUtil.isNotEmpty(deleteData)) {
informationMapper.deleteBatchLogic(deleteData);
}
}
/**
* 案件信息录入接口
*
* @param searcher
* @return
*/
@Override
@Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
public Integer enterCaseInfo2(CaseInformationEnterSearcher searcher) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserId();
String nickName = loginUser.getUser().getNickName();
CaseInformation caseInformation = searcher.getCaseInformation();
//生成案件编号
caseInformation.setCaseNo(redisGenerateCaseNo.generateCaseNo(Integer.parseInt(caseInformation.getBusinessClassify())));
Date paymentDeadline = caseInformation.getPaymentDeadline();
if (Objects.nonNull(paymentDeadline)) {
if (DateUtil.compare(paymentDeadline, new Date()) < 0 && caseInformation.getAmountReceivedSum().compareTo(caseInformation.getAmountReceivable()) < 0) {
caseInformation.setCollectionStatus(3);
}
}
Integer result = caseInformationMapper.insert(caseInformation);
//获取案件id
Long caseId = caseInformation.getId();
// 录入委托方与相对方信息
List<ImpulseInformation> entrustingParty = searcher.getEntrustingParty();
List<ImpulseInformation> opposite = searcher.getOpposite();
List<ImpulseInformation> impulseInformationList = new ArrayList<>();
if (!CollectionUtils.isEmpty(entrustingParty)) {
impulseInformationList.addAll(entrustingParty.stream().peek(item -> {
item.setCaseId(caseId);
item.setIsClient(0);
}).collect(Collectors.toList()));
}
if (!CollectionUtils.isEmpty(opposite)) {
impulseInformationList.addAll(opposite.stream().peek(item -> {
item.setCaseId(caseId);
item.setIsClient(1);
}).collect(Collectors.toList()));
}
impulseInformationService.saveBatch(impulseInformationList);
List<Long> impulseInformationIds = impulseInformationList.stream().map(item -> item.getId()).collect(Collectors.toList());
caseInformation.setImpulseInformationIds(StringUtils.join(impulseInformationIds, ","));
caseInformationService.updateById(caseInformation);
//录入收款记录
List<CollectionRecordSearcher> collectionRecordList = searcher.getCollectionRecordList();
List<CollectionRecord> collectionRecordListNew = new ArrayList<>();
if (!CollectionUtils.isEmpty(collectionRecordList)) {
for (CollectionRecordSearcher item : collectionRecordList) {
item.setCaseId(caseId);
item.setUserId(userId);
item.setUserName(nickName);
CollectionRecord collectionRecord = new CollectionRecord();
BeanUtils.copyProperties(item, collectionRecord);
collectionRecordListNew.add(collectionRecord);
}
}
collectionRecordService.saveBatch(collectionRecordListNew);
return result;
}
@Override
public CaseInformationEnterOverrideVO selectCaseInfoByIdOverride(Long id) {
CaseInformationEnterOverrideVO resultVO = new CaseInformationEnterOverrideVO();
CaseInformation caseInformation = caseInformationMapper.selectById(id);
//处理委托律师及协办律师姓名
List<SysUser> sysUserList = sysUserMapper.queryUserList();
Map<Long, String> userIdAndNameMap = new HashMap<>();
if (!CollectionUtils.isEmpty(sysUserList)) {
for (SysUser sysUser : sysUserList) {
userIdAndNameMap.put(sysUser.getUserId(), sysUser.getNickName());
}
}
caseInformation.setEntrustedLawyerName(userIdAndNameMap.get(caseInformation.getEntrustedLawyerId()));
// 考虑协办律师可能为空的情况需要进行判空处理
if (!StringUtils.isEmpty(caseInformation.getCoLawyerIds())) {
List<String> coLawyerIds = Arrays.asList(caseInformation.getCoLawyerIds().split(","));
List<String> coLawyerNames = new ArrayList<>();
for (String coLawyerId : coLawyerIds) {
coLawyerNames.add(userIdAndNameMap.get(Long.parseLong(coLawyerId)));
}
caseInformation.setCoLawyerNames(StringUtils.join(coLawyerNames, ","));
}
resultVO.setUncollectedMoney(caseInformation.getAmountReceivable().subtract(caseInformation.getAmountReceivedSum()));
resultVO.setCaseInformation(caseInformation);
//案件涉及的委托方与相对方
//案件关联委托方----entrustingParty
resultVO.setEntrustingParty(informationMapper.selectByCaseId(id, 0));
//案件关联相对方----opposite
resultVO.setOpposite(informationMapper.selectByCaseId(id, 1));
//收款记录
List<CollectionRecordEnterVO> collectionRecordList = collectionRecordMapper.selectByCaseId(id);
resultVO.setCollectionRecordList(collectionRecordList);
return resultVO;
}
@Override
public Integer updateCaseInfoOverride(CaseInformationEnterSearcher params) {
/*
* 修改接口可能存在修改的部分
* 1案件基本信息
* 2案件关联的委托人相对方存在新增修改删除等情况
* 3案件关联的收款记录存在新增修改删除等情况案件信息表中的已收金额需要重新进行汇总
* */
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserId();
String nickName = loginUser.getUser().getNickName();
// 获取当前的案件信息
CaseInformation caseInformation = params.getCaseInformation();
Long caseId = caseInformation.getId();
//查询所有的案件关联的委托方与相对方信息在修改信息的时候不再去做利冲检索只负责修改
List<ImpulseInformation> currentImpulseInformationList = impulseInformationMapper.selectList(new QueryWrapper<ImpulseInformation>().lambda()
.eq(ImpulseInformation::getCaseId, caseId)
.eq(ImpulseInformation::getDelFlag, 0)
.eq(ImpulseInformation::getCheckFlag, 1)
);
//前端传进来的相对方与委托方
List<ImpulseInformation> entrustingParty = params.getEntrustingParty();
List<ImpulseInformation> opposite = params.getOpposite();
List<ImpulseInformation> impulseInformationList = new ArrayList<>();
if (!CollectionUtils.isEmpty(entrustingParty)) {
impulseInformationList.addAll(entrustingParty);
}
if (!CollectionUtils.isEmpty(opposite)) {
impulseInformationList.addAll(opposite);
}
//统一处理对当前数据判断是需要新增修改还是删除
editImpulseInformation(currentImpulseInformationList, impulseInformationList, caseId);
//获取信息的利冲信息ids
String impulseInformationIds = informationMapper.selectByCaseIdAdnDelFlag(caseId).stream().map(i -> i.getId().toString()).collect(Collectors.joining(","));
//处理收款记录没有收款记录id的是新增的有id的是修改的前端传的收款记录若不在收款记录列表中则是删除的
List<CollectionRecord> currentCollectionRecordList = collectionRecordMapper.selectList(new QueryWrapper<CollectionRecord>().lambda()
.eq(CollectionRecord::getCaseId, caseId)
.eq(CollectionRecord::getDelFlag, 0)
.eq(CollectionRecord::getStatus, 0)
);
List<Long> currentCollectionRecordIdList = currentCollectionRecordList.stream().map(CollectionRecord::getId).collect(Collectors.toList());
List<CollectionRecordSearcher> collectionRecordList = params.getCollectionRecordList();
//重新计算已收金额
BigDecimal amountReceivedSum = new BigDecimal("0");
List<CollectionRecord> addCollectionRecordList = new ArrayList<>();
List<CollectionRecord> updateCollectionRecordList = new ArrayList<>();
List<CollectionRecord> deleteCollectionRecordList = new ArrayList<>();
if (!CollectionUtils.isEmpty(collectionRecordList)) {
List<CollectionRecord> collectionRecordListNew = BeanUtil.copyToList(collectionRecordList, CollectionRecord.class);
for (CollectionRecord item : collectionRecordListNew) {
if (Objects.isNull(item.getId())) {
item.setCaseId(caseId);
item.setUserId(userId);
item.setUserName(nickName);
addCollectionRecordList.add(item);
} else if (currentCollectionRecordIdList.contains(item.getId())) {
updateCollectionRecordList.add(item);
} else {
deleteCollectionRecordList.add(item);
}
//重新计算已收金额
if (Objects.nonNull(item.getAmountReceived())) {
amountReceivedSum = amountReceivedSum.add(item.getAmountReceived());
}
}
}
collectionRecordService.saveBatch(addCollectionRecordList);
collectionRecordService.updateBatchById(updateCollectionRecordList);
collectionRecordService.removeBatchByIds(deleteCollectionRecordList);
//修改案件信息
caseInformation.setAmountReceivedSum(amountReceivedSum);
caseInformation.setImpulseInformationIds(impulseInformationIds);
Integer result = caseInformationMapper.updateById(caseInformation);
return result;
}
}

View File

@ -90,97 +90,98 @@ public class CollectionRecordServiceImpl extends ServiceImpl<CollectionRecordMap
}
@Override
@Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
public void casePayment(CollectionRecordEnterVO params) {
try {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserId();
String nickName = loginUser.getUser().getNickName();
CollectionRecord collectionRecord = BeanUtil.copyProperties(params, CollectionRecord.class);
collectionRecord.setUserId(userId);
collectionRecord.setUserName(nickName);
String collect = loginUser.getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.joining(","));
if (!collect.contains("FINANCE")) {
collectionRecord.setAuditStatus(0);
} else {
collectionRecord.setAuditStatus(1);
}
// @Override
// @Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
// public void casePayment(CollectionRecordEnterVO params) {
// try {
// LoginUser loginUser = SecurityUtils.getLoginUser();
// Long userId = loginUser.getUserId();
// String nickName = loginUser.getUser().getNickName();
// CollectionRecord collectionRecord = BeanUtil.copyProperties(params, CollectionRecord.class);
// collectionRecord.setUserId(userId);
// collectionRecord.setUserName(nickName);
// String collect = loginUser.getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.joining(","));
// if (!collect.contains("FINANCE")) {
// collectionRecord.setAuditStatus(0);
// } else {
// collectionRecord.setAuditStatus(1);
// }
//
// List<FileManager> fileManagerList = params.getFileManager().stream().peek(item -> item.setFileType(1)).collect(Collectors.toList());
// fileManagerService.saveBatch(fileManagerList);
// String fileIds = fileManagerList.stream().map(fileManager -> fileManager.getId().toString()).collect(Collectors.joining(","));
// collectionRecord.setCollectionUrlId(fileIds);
// collectionRecordMapper.insert(collectionRecord);
//
//
// //修改案件信息表中的已收金额-----根据案件ID查询缴费记录做一个累加
// List<CollectionRecord> lists = BeanUtil.copyToList(collectionRecordMapper.selectByCaseId(params.getCaseId()), CollectionRecord.class);
// BigDecimal reduce = lists.stream().map(CollectionRecord::getAmountReceived).reduce(BigDecimal.ZERO, BigDecimal::add);
// caseInformationMapper.updateCaseAmount(params.getCaseId(), reduce); //修改案件信息表中已收金额总计
//
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("缴费失败");
// }
// }
List<FileManager> fileManagerList = params.getFileManager().stream().peek(item -> item.setFileType(1)).collect(Collectors.toList());
fileManagerService.saveBatch(fileManagerList);
String fileIds = fileManagerList.stream().map(fileManager -> fileManager.getId().toString()).collect(Collectors.joining(","));
collectionRecord.setCollectionUrlId(fileIds);
collectionRecordMapper.insert(collectionRecord);
//修改案件信息表中的已收金额-----根据案件ID查询缴费记录做一个累加
List<CollectionRecord> lists = BeanUtil.copyToList(collectionRecordMapper.selectByCaseId(params.getCaseId()), CollectionRecord.class);
BigDecimal reduce = lists.stream().map(CollectionRecord::getAmountReceived).reduce(BigDecimal.ZERO, BigDecimal::add);
caseInformationMapper.updateCaseAmount(params.getCaseId(), reduce); //修改案件信息表中已收金额总计
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("缴费失败");
}
}
@Override
@Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
public Boolean casePaymentBatch(List<CollectionRecordEnterVO> params) {
try {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserId();
String nickName = loginUser.getUser().getNickName();
if (CollUtil.isNotEmpty(params)) {
List<CollectionRecordEnterVO> newData = params; //收款记录信息
//获取新添加的收款记录计算出新的收款记录金额在总金额中加上
List<CollectionRecordEnterVO> insert = newData.stream().filter(item -> item.getId() == null).collect(Collectors.toList());
insert.forEach(item -> {
if (CollUtil.isEmpty(item.getFileManager())){
throw new RuntimeException("请上传缴费凭证");
}
List<FileManager> 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("CAIWU")) {
item.setAuditStatus(0);
} else {
item.setAuditStatus(1);
}
});
List<CollectionRecord> list = BeanUtil.copyToList(insert, CollectionRecord.class);
BigDecimal addMoney = list.stream().map(CollectionRecord::getAmountReceived).reduce(BigDecimal.ZERO, BigDecimal::add); //新增收款记录金额
this.saveBatch(list);
Long caseId = list.get(0).getCaseId();
CaseInformationListVO caseInfo = caseInformationMapper.selectCaseById(caseId);
caseInformationMapper.updateCaseAmount(caseId, caseInfo.getAmountReceivedSum().add(addMoney));
CaseInformationListVO updateInfo = caseInformationMapper.selectCaseById(caseId);
Date paymentDeadline = updateInfo.getPaymentDeadline();
if (paymentDeadline != null) {
if (updateInfo.getAmountReceivedSum().compareTo(new BigDecimal(0.0)) == 0){
caseInformationMapper.updateCollectionStatus(updateInfo.getId(),0);
}
if (updateInfo.getAmountReceivedSum().compareTo(updateInfo.getAmountReceivable()) < 0){
caseInformationMapper.updateCollectionStatus(updateInfo.getId(),1);
}
if (updateInfo.getAmountReceivedSum().compareTo(updateInfo.getAmountReceivable()) == 0){
caseInformationMapper.updateCollectionStatus(updateInfo.getId(),2);
}
}
}
return true;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("批量收款失败");
}
}
// @Override
// @Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
// public Boolean casePaymentBatch(List<CollectionRecordEnterVO> params) {
// try {
// LoginUser loginUser = SecurityUtils.getLoginUser();
// Long userId = loginUser.getUserId();
// String nickName = loginUser.getUser().getNickName();
//
// //TODO 待调整
// if (CollUtil.isNotEmpty(params)) {
// List<CollectionRecordEnterVO> newData = params; //收款记录信息
//
// //获取新添加的收款记录计算出新的收款记录金额在总金额中加上
// List<CollectionRecordEnterVO> insert = newData.stream().filter(item -> item.getId() == null).collect(Collectors.toList());
// insert.forEach(item -> {
// if (CollUtil.isEmpty(item.getFileManager())){
// throw new RuntimeException("请上传缴费凭证");
// }
// List<FileManager> 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("CAIWU")) {
// item.setAuditStatus(0);
// } else {
// item.setAuditStatus(1);
// }
// });
// List<CollectionRecord> list = BeanUtil.copyToList(insert, CollectionRecord.class);
// BigDecimal addMoney = list.stream().map(CollectionRecord::getAmountReceived).reduce(BigDecimal.ZERO, BigDecimal::add); //新增收款记录金额
// this.saveBatch(list);
// Long caseId = list.get(0).getCaseId();
// CaseInformationListVO caseInfo = caseInformationMapper.selectCaseById(caseId);
// caseInformationMapper.updateCaseAmount(caseId, caseInfo.getAmountReceivedSum().add(addMoney));
// CaseInformationListVO updateInfo = caseInformationMapper.selectCaseById(caseId);
// Date paymentDeadline = updateInfo.getPaymentDeadline();
// if (paymentDeadline != null) {
// if (updateInfo.getAmountReceivedSum().compareTo(new BigDecimal(0.0)) == 0){
// caseInformationMapper.updateCollectionStatus(updateInfo.getId(),0);
// }
// if (updateInfo.getAmountReceivedSum().compareTo(updateInfo.getAmountReceivable()) < 0){
// caseInformationMapper.updateCollectionStatus(updateInfo.getId(),1);
// }
// if (updateInfo.getAmountReceivedSum().compareTo(updateInfo.getAmountReceivable()) == 0){
// caseInformationMapper.updateCollectionStatus(updateInfo.getId(),2);
// }
//
// }
// }
// return true;
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("批量收款失败");
// }
// }
@Override
@Transactional(isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
@ -196,11 +197,11 @@ public class CollectionRecordServiceImpl extends ServiceImpl<CollectionRecordMap
if (caseInfo.getAmountReceivedSum().compareTo(new BigDecimal(0.0)) == 0){
caseInformationMapper.updateCollectionStatus(caseId,0);
}
String urlStr = collectionRecord.getCollectionUrlId();
if (StrUtil.isNotBlank(urlStr)){
List<Long> fileIds = Arrays.stream(collectionRecord.getCollectionUrlId().split(",")).map(Long::parseLong).collect(Collectors.toList());
fileManagerMapper.removeByCaseIdAndFileIds(caseId, fileIds);
}
// String urlStr = collectionRecord.getCollectionUrlId();
// if (StrUtil.isNotBlank(urlStr)){
// List<Long> fileIds = Arrays.stream(collectionRecord.getCollectionUrlId().split(",")).map(Long::parseLong).collect(Collectors.toList());
// fileManagerMapper.removeByCaseIdAndFileIds(caseId, fileIds);
// }
} catch (Exception e) {
e.printStackTrace();
@ -212,20 +213,20 @@ public class CollectionRecordServiceImpl extends ServiceImpl<CollectionRecordMap
@Override
public List<CollectionRecordEnterVO> selectByCaseId(Long caseId) {
List<CollectionRecordEnterVO> lists = collectionRecordMapper.selectByCaseId(caseId);
for (CollectionRecordEnterVO item : lists) {
if (StrUtil.isNotBlank(item.getCollectionUrlId())){ //排除用户只进行缴费没有上传收费凭证的情况
List<Long> collect = Arrays.stream(item.getCollectionUrlId().split(",")).map(Long::parseLong).collect(Collectors.toList());
item.setFileManager(fileManagerMapper.selectByCRid(collect));
}
Long userId = item.getUserId();
String roleKey = sysUserMapper.selectUserRoleByUserId(userId);
if ("CAIWU".equals(roleKey)){
item.setIsEdit(item.getAuditStatus() == 1);
}else {
item.setIsEdit(item.getAuditStatus() == 0);
}
}
// for (CollectionRecordEnterVO item : lists) {
// if (StrUtil.isNotBlank(item.getCollectionUrlId())){ //排除用户只进行缴费没有上传收费凭证的情况
// List<Long> collect = Arrays.stream(item.getCollectionUrlId().split(",")).map(Long::parseLong).collect(Collectors.toList());
// item.setFileManager(fileManagerMapper.selectByCRid(collect));
// }
// 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;
}

View File

@ -8,6 +8,7 @@ import com.tcctlo.law.entity.CollectionRecord;
import com.tcctlo.law.entity.IndexStatistics;
import com.tcctlo.law.mapper.CaseInformationMapper;
import com.tcctlo.law.mapper.CollectionRecordMapper;
import com.tcctlo.law.searcher.TimeSearcher;
import com.tcctlo.law.service.ICollectionRecordService;
import com.tcctlo.law.service.IIndexService;
import com.tcctlo.law.vo.IndexLawCaseMoneyInfo;
@ -125,26 +126,21 @@ public class IIndexServiceImpl implements IIndexService {
}
@Override
public Object lawInfo() {
public List<IndexLawCaseMoneyInfo> lawInfo(TimeSearcher searcher) {
List<IndexLawInfo> indexLawInfos = caseInformationMapper.selectLawInfo(); //所有的律师信息
List<IndexLawCaseMoneyInfo> res = indexLawInfos.stream().map(new Function<IndexLawInfo, IndexLawCaseMoneyInfo>() {
@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;
List<IndexLawCaseMoneyInfo> statcicList = caseInformationMapper.staticCaseNumAndMoney(searcher);
Map<Long, IndexLawCaseMoneyInfo> indexLawCaseMoneyInfoMap = statcicList.stream().collect(Collectors.toMap(IndexLawCaseMoneyInfo::getLawyerId, Function.identity()));
List<IndexLawCaseMoneyInfo> voList = new ArrayList<>();
for (IndexLawInfo item : indexLawInfos) {
IndexLawCaseMoneyInfo indexLawCaseMoneyInfo = new IndexLawCaseMoneyInfo();
indexLawCaseMoneyInfo.setLawyerId(item.getUserId());
indexLawCaseMoneyInfo.setLawName(item.getNickName());
if (indexLawCaseMoneyInfoMap.containsKey(item.getUserId())) {
indexLawCaseMoneyInfo.setCaseNum(indexLawCaseMoneyInfoMap.get(item.getUserId()).getCaseNum());
indexLawCaseMoneyInfo.setAmountReceived(indexLawCaseMoneyInfoMap.get(item.getUserId()).getAmountReceived());
}
}).collect(Collectors.toList());
return res;
voList.add(indexLawCaseMoneyInfo);
}
return voList;
}
}

View File

@ -11,6 +11,7 @@ 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.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -22,15 +23,15 @@ import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
* 开票记录表 服务实现类
* </p>
*
* @author
* @since 2025-03-07
*/
* <p>
* 开票记录表 服务实现类
* </p>
*
* @author
* @since 2025-03-07
*/
@Service
public class InvoiceRecordServiceImpl extends ServiceImpl<InvoiceRecordMapper,InvoiceRecord> implements IInvoiceRecordService {
public class InvoiceRecordServiceImpl extends ServiceImpl<InvoiceRecordMapper, InvoiceRecord> implements IInvoiceRecordService {
@Resource
@ -92,10 +93,19 @@ public class InvoiceRecordServiceImpl extends ServiceImpl<InvoiceRecordMapper,In
@Override
public List<InvoiceRecordVO> selectByCaseId(Long caseId) {
List<InvoiceRecordVO> invoiceRecords = invoiceRecordMapper.selectByCaseId(caseId);
invoiceRecords.stream().peek(item -> {
List<Long> collect = Arrays.stream(item.getInvoiceFileUrl().split(",")).map(Long::parseLong).collect(Collectors.toList());
item.setFileManager(fileManagerMapper.selectByCRid(collect));
}).collect(Collectors.toList());
// invoiceRecords.stream().peek(item -> {
// List<Long> collect = Arrays.stream(item.getInvoiceFileUrl().split(",")).map(Long::parseLong).collect(Collectors.toList());
// TODO 此处的InvoiceFileUrl 中存的是fileManager 的id ,后续需要将对应的表结构同步进行调整
// item.setFileManager(fileManagerMapper.selectByCRid(collect));
// }).collect(Collectors.toList());
for (InvoiceRecordVO item : invoiceRecords) {
if (!StringUtils.isBlank(item.getInvoiceFileUrl())) {
String invoiceFileUrl = item.getInvoiceFileUrl();
List<Long> fileIds = Arrays.stream(invoiceFileUrl.split(",")).map(Long::parseLong).collect(Collectors.toList());
item.setFileManager(fileManagerMapper.selectBatchIds(fileIds));
}
}
return invoiceRecords;
}

View File

@ -0,0 +1,42 @@
package com.tcctlo.law.vo;
import com.tcctlo.law.entity.CaseInformation;
import com.tcctlo.law.entity.CaseLawyer;
import com.tcctlo.law.entity.ImpulseInformation;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data
public class CaseInformationEnterOverrideVO implements Serializable {
private static final long serialVersionUID = 1964104079456373949L;
/**
* 案件未收款的金额
*/
private BigDecimal uncollectedMoney;
/**
* 案件信息
*/
private CaseInformation caseInformation;
/**
* 利冲信息-委托方信息
*/
private List<ImpulseInformation> entrustingParty;
/**
* 利冲信息-相对方
*/
private List<ImpulseInformation> opposite;
/**
* 案件收款记录信息
*/
private List<CollectionRecordEnterVO> collectionRecordList;
}

View File

@ -40,16 +40,6 @@ public class CaseInformationListVO extends CaseInformation {
*/
private String opposite;
/**
* 代理律师
*/
private String attorneyAgent;
/**
* 协办律师
*/
private String assistingLawyer;
/**
* 当前案件是否包含相关文件
* 主要用于前端来判断是否显示下载按钮

View File

@ -20,6 +20,7 @@ public class CollectionRecordEnterVO extends CollectionRecord {
/**
* 文件管理
* FIXME ,后续确认不需要了之后可以将该字段删除
*/
private List<FileManager> fileManager;
}

View File

@ -11,6 +11,8 @@ import java.math.BigDecimal;
@AllArgsConstructor
public class IndexLawCaseMoneyInfo {
private Long lawyerId;
/**
* 律师名称
*/

View File

@ -17,7 +17,7 @@
ci.amount_receivable,
ci.amount_received_sum,
ci.payment_deadline,
ci.payment_deadline_remake,
ci.payment_deadline_remark,
ci.reserve_money,
ci.term_of_consultancy_start,
ci.term_of_consultancy_end,
@ -29,14 +29,14 @@
ci.is_finish_case,
ci.impulse_information_ids,
ci.case_lawyer_ids,
ci.case_remake,
ci.case_remark,
ci.status,
ci.del_flag,
ci.create_by,
ci.create_time,
ci.update_by,
ci.update_time,
ci.remake
ci.remark
</sql>
<update id="caseArchived">
update case_information ci
@ -143,7 +143,7 @@
<id column="amount_receivable" property="amountReceivable"/>
<id column="amount_received_sum" property="amountReceivedSum"/>
<id column="payment_deadline" property="paymentDeadline"/>
<id column="payment_deadline_remake" property="paymentDeadlineRemake"/>
<id column="payment_deadline_remark" property="paymentDeadlineRemark"/>
<id column="reserve_money" property="reserveMoney"/>
<id column="term_of_consultancy_start" property="termOfConsultancyStart"/>
<id column="term_of_consultancy_end" property="termOfConsultancyEnd"/>
@ -155,14 +155,14 @@
<id column="is_finish_case" property="isFinishCase"/>
<id column="impulse_information_ids" property="impulseInformationIds"/>
<id column="case_lawyer_ids" property="caseLawyerIds"/>
<id column="case_remake" property="caseRemake"/>
<id column="case_remark" property="caseRemark"/>
<id column="status" property="status"/>
<id column="del_flag" property="delFlag"/>
<id column="create_by" property="createBy"/>
<id column="create_time" property="createTime"/>
<id column="update_by" property="updateBy"/>
<id column="update_time" property="updateTime"/>
<id column="remake" property="remake"/>
<id column="remark" property="remark"/>
</resultMap>
@ -239,7 +239,7 @@
<id column="amount_receivable" property="amountReceivable"/>
<id column="amount_received_sum" property="amountReceivedSum"/>
<id column="payment_deadline" property="paymentDeadline"/>
<id column="payment_deadline_remake" property="paymentDeadlineRemake"/>
<id column="payment_deadline_remark" property="paymentDeadlineRemark"/>
<id column="reserve_money" property="reserveMoney"/>
<id column="term_of_consultancy_start" property="termOfConsultancyStart"/>
<id column="term_of_consultancy_end" property="termOfConsultancyEnd"/>
@ -251,14 +251,14 @@
<id column="is_finish_case" property="isFinishCase"/>
<id column="impulse_information_ids" property="impulseInformationIds"/>
<id column="case_lawyer_ids" property="caseLawyerIds"/>
<id column="case_remake" property="caseRemake"/>
<id column="case_remark" property="caseRemark"/>
<id column="status" property="status"/>
<id column="del_flag" property="delFlag"/>
<id column="create_by" property="createBy"/>
<id column="create_time" property="createTime"/>
<id column="update_by" property="updateBy"/>
<id column="update_time" property="updateTime"/>
<id column="remake" property="remake"/>
<id column="remark" property="remark"/>
</resultMap>
@ -538,6 +538,23 @@
where find_in_set(#{lawId}, ci.case_lawyer_ids) and ci.status = 0 and ci.del_flag = 0
</select>
<select id="staticCaseNumAndMoney" resultType="com.tcctlo.law.vo.IndexLawCaseMoneyInfo">
SELECT
entrusted_lawyer_id AS lawyerId,
COUNT( id ) AS caseNum,
SUM( amount_received_sum ) AS amountReceived
FROM
case_information
WHERE
`status` = '0'
AND del_flag = '0'
<if test="startTime != null and endTime != null">
and create_time between #{startTime} and #{endTime}
</if>
GROUP BY
entrusted_lawyer_id
</select>
<!-- 费用统计-逾期未收费 -->
<!--<select id="overdue" resultType="java.lang.Integer">

View File

@ -7,9 +7,9 @@
cr.case_id caseId,
cr.collection_type collectionType,
cr.amount_received amountReceived,
cr.collection_url_id collectionUrlId,
cr.collection_url collectionUrl,
cr.collection_date collectionDate,
cr.collection_remake collectionRemake,
cr.collection_remark collectionRemark,
cr.user_id userId,
cr.user_name userName,
cr.audit_status auditStatus,
@ -19,7 +19,7 @@
cr.create_time createTime,
cr.update_by updateBy,
cr.update_time updateTime,
cr.remake remake
cr.remark remark
</sql>
<update id="removeByCaseId">
update collection_record cr

View File

@ -29,6 +29,15 @@
#{item}
</foreach>
</update>
<update id="updateByCaseId">
UPDATE impulse_information
SET check_flag = 0
WHERE
case_id = #{caseId}
</update>
<select id="selectByCaseId" resultType="com.tcctlo.law.entity.ImpulseInformation">
select * from impulse_information ii
<where>

View File

@ -153,4 +153,10 @@ public interface SysUserMapper
* @return 结果集
*/
List<LawUserVO> getUserByRole(@Param("lawName") String lawName);
/**
* 查询用户信息
* @return
*/
List<SysUser> queryUserList();
}

View File

@ -1,10 +1,7 @@
package com.tcctlo.system.service.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import javax.validation.Validator;

View File

@ -326,4 +326,25 @@
</foreach>
</delete>
<select id="queryUserList" resultType="com.tcctlo.common.core.domain.entity.SysUser">
select user_id,
dept_id,
user_name,
nick_name,
email,
phonenumber,
sex,
avatar,
password,
status,
create_by,
create_time,
update_by,
update_time,
remark,
del_flag
from sys_user
where del_flag = '0'
</select>
</mapper>