From 45cbb971e7772048b308f3b74a082bda42d52eef Mon Sep 17 00:00:00 2001 From: zhangjing <924187658@qq.com> Date: Thu, 26 Dec 2024 20:34:16 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=BB=9F=E8=AE=A1=E3=80=91=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../warn/common/constants/ReportConstants.java | 36 ++++ .../java/com/fkzy/warn/common/util/ReportUtil.java | 154 ++++++++++++++ .../com/fkzy/warn/mapper/AdministratorMapper.java | 14 ++ .../warn/mapper/EnterpriseAlarmInfoMapper.java | 14 ++ .../fkzy/warn/mapper/EnterpriseProvinceMapper.java | 14 ++ .../java/com/fkzy/warn/mapper/LawCaseMapper.java | 4 + .../java/com/fkzy/warn/model/Administrator.java | 72 +++++++ .../com/fkzy/warn/model/EnterpriseAlarmInfo.java | 229 +++++++++++++++++++++ .../com/fkzy/warn/model/EnterpriseProvince.java | 56 +++++ .../fkzy/warn/service/AdministratorService.java | 40 ++++ .../warn/service/EnterpriseAlarmInfoService.java | 48 +++++ .../warn/service/EnterpriseProvinceService.java | 48 +++++ .../java/com/fkzy/warn/service/LawCaseService.java | 12 +- .../service/impl/AdministratorServiceImpl.java | 43 ++++ .../impl/EnterpriseAlarmInfoServiceImpl.java | 58 ++++++ .../service/impl/EnterpriseInfoServiceImpl.java | 18 +- .../impl/EnterpriseProvinceServiceImpl.java | 58 ++++++ .../fkzy/warn/service/impl/LawCaseServiceImpl.java | 169 +++++++-------- src/main/resources/mapper/LawCaseMapper.xml | 16 ++ 19 files changed, 1007 insertions(+), 96 deletions(-) create mode 100644 src/main/java/com/fkzy/warn/mapper/AdministratorMapper.java create mode 100644 src/main/java/com/fkzy/warn/mapper/EnterpriseAlarmInfoMapper.java create mode 100644 src/main/java/com/fkzy/warn/mapper/EnterpriseProvinceMapper.java create mode 100644 src/main/java/com/fkzy/warn/model/Administrator.java create mode 100644 src/main/java/com/fkzy/warn/model/EnterpriseAlarmInfo.java create mode 100644 src/main/java/com/fkzy/warn/model/EnterpriseProvince.java create mode 100644 src/main/java/com/fkzy/warn/service/AdministratorService.java create mode 100644 src/main/java/com/fkzy/warn/service/EnterpriseAlarmInfoService.java create mode 100644 src/main/java/com/fkzy/warn/service/EnterpriseProvinceService.java create mode 100644 src/main/java/com/fkzy/warn/service/impl/AdministratorServiceImpl.java create mode 100644 src/main/java/com/fkzy/warn/service/impl/EnterpriseAlarmInfoServiceImpl.java create mode 100644 src/main/java/com/fkzy/warn/service/impl/EnterpriseProvinceServiceImpl.java create mode 100644 src/main/resources/mapper/LawCaseMapper.xml diff --git a/src/main/java/com/fkzy/warn/common/constants/ReportConstants.java b/src/main/java/com/fkzy/warn/common/constants/ReportConstants.java index a98f953..5af6ffb 100644 --- a/src/main/java/com/fkzy/warn/common/constants/ReportConstants.java +++ b/src/main/java/com/fkzy/warn/common/constants/ReportConstants.java @@ -82,4 +82,40 @@ public class ReportConstants { * 6.4 高频诉讼对手 **/ public static final String HIGH_FREQUENCY_TEXT = "highFrequencyText"; + public static final String[] PROVINCE = { + "北京市", + "天津市", + "河北省", + "山西省", + "内蒙古自治区", + "辽宁省", + "吉林省", + "黑龙江省", + "上海市", + "江苏省", + "浙江省", + "安徽省", + "福建省", + "江西省", + "山东省", + "河南省", + "湖北省", + "湖南省", + "广东省", + "广西壮族自治区", + "海南省", + "重庆市", + "四川省", + "贵州省", + "云南省", + "西藏自治区", + "陕西省", + "甘肃省", + "青海省", + "宁夏回族自治区", + "新疆维吾尔自治区", + "台湾省", + "香港", + "澳门" + }; } diff --git a/src/main/java/com/fkzy/warn/common/util/ReportUtil.java b/src/main/java/com/fkzy/warn/common/util/ReportUtil.java index 5291f04..12571e3 100644 --- a/src/main/java/com/fkzy/warn/common/util/ReportUtil.java +++ b/src/main/java/com/fkzy/warn/common/util/ReportUtil.java @@ -954,6 +954,160 @@ public class ReportUtil { return result.toString(); } /** + * 案件金额 + * + * @return java.lang.String + * @author zhangjing + * @create 2024/12/16 + **/ + public static BigDecimal getCaseAmount(List caseList) { + BigDecimal totalAmount = BigDecimal.ZERO; + for (LawCase lawCase : caseList) { + if (lawCase.getNQsbdje()!=null){ + totalAmount = totalAmount.add(lawCase.getNQsbdje()); + } + } + return totalAmount.divide(BigDecimal.valueOf(10000), 2, BigDecimal.ROUND_HALF_UP); + } + /** + * 设置案由,诉讼地位,审理阶段信息 + * + * @return java.lang.String + * @author zhangjing + * @create 2024/12/16 + **/ + public static void setAlarmInfo(EnterpriseAlarmInfo data,List caseList,List enterpriseProvinceList) { + Map roleCaseCountMap = new HashMap<>(); + Map roleCaseAmountMap = new HashMap<>(); + Map slcxCaseCountMap = new HashMap<>(); + Map slcxCaseAmountMap = new HashMap<>(); + Map caseReasonCountMap = new HashMap<>(); + Map caseReasonAmontMap = new HashMap<>(); + //省份 + + Map provinceMap = new HashMap<>(); + for(String name : ReportConstants.PROVINCE){ + provinceMap.put(name,new EnterpriseProvince(data.getCreditCode(), name,0,BigDecimal.ZERO)); + } + + + + + + + BigDecimal totalAmount = BigDecimal.ZERO; + slcxCaseCountMap.put("一审", 0); + slcxCaseCountMap.put("二审", 0); + slcxCaseCountMap.put("再审审查", 0); + slcxCaseCountMap.put("再审", 0); + slcxCaseAmountMap.put("一审", BigDecimal.ZERO); + slcxCaseAmountMap.put("二审", BigDecimal.ZERO); + slcxCaseAmountMap.put("再审审查", BigDecimal.ZERO); + slcxCaseAmountMap.put("再审", BigDecimal.ZERO); + + + roleCaseCountMap.put("原告", 0); + roleCaseCountMap.put("被告", 0); + roleCaseCountMap.put("第三人", 0); + roleCaseCountMap.put("其他", 0); + roleCaseAmountMap.put("原告", BigDecimal.ZERO); + roleCaseAmountMap.put("被告", BigDecimal.ZERO); + roleCaseAmountMap.put("第三人", BigDecimal.ZERO); + roleCaseAmountMap.put("其他", BigDecimal.ZERO); + + + for (LawCase lawCase : caseList) { + + + String slcx = lawCase.getNSlcx(); + String companyName = lawCase.getCompanyName(); + if (slcxCaseCountMap.containsKey(slcx)) { + slcxCaseCountMap.put(slcx, slcxCaseCountMap.get(slcx) + 1); + if (lawCase.getNQsbdje()!=null){ + slcxCaseAmountMap.put(slcx, slcxCaseAmountMap.getOrDefault(slcx, BigDecimal.ZERO).add(lawCase.getNQsbdje())); + } + } + if (lawCase.getCSsdy()!=null&&provinceMap.containsKey(lawCase.getCSsdy())){ + EnterpriseProvince enterpriseProvince = provinceMap.get(lawCase.getCSsdy()); + enterpriseProvince.setCount(enterpriseProvince.getCount()+1); + if (lawCase.getNQsbdje()!=null){ + enterpriseProvince.setAmount(enterpriseProvince.getAmount().add(lawCase.getNQsbdje())); + } + provinceMap.put(lawCase.getCSsdy(),enterpriseProvince); + } + + for (LitigantInfo litigantInfo : lawCase.getLitigantInfoList()) { + String role = litigantInfo.getNSsdw(); + if (companyName.equals(litigantInfo.getCMc())&&roleCaseCountMap.containsKey(role)) { + roleCaseCountMap.put(role, roleCaseCountMap.get(role) + 1); + if (lawCase.getNQsbdje()!=null){ + roleCaseAmountMap.put(role, roleCaseAmountMap.get(role).add(lawCase.getNQsbdje())); + } + } + } + if (lawCase.getNQsbdje()!=null){ + totalAmount = totalAmount.add(lawCase.getNQsbdje()); + } + // 统计案由 + String caseReason = lawCase.getNLaay(); + if (caseReason != null && !caseReason.isEmpty()) { + caseReasonCountMap.put(caseReason, caseReasonCountMap.getOrDefault(caseReason, 0) + 1); + if (lawCase.getNQsbdje()!=null){ + caseReasonAmontMap.put(caseReason, caseReasonAmontMap.getOrDefault(caseReason, BigDecimal.ZERO).add(lawCase.getNQsbdje())); + } + } + } + // 案由进行排序 + List> sortedCaseReasons = new ArrayList<>(caseReasonCountMap.entrySet()); + sortedCaseReasons.sort((entry1, entry2) -> entry2.getValue().compareTo(entry1.getValue())); + // 案由金额进行排序 + List> sortedCaseReasonAmonts = new ArrayList<>(caseReasonAmontMap.entrySet()); + sortedCaseReasonAmonts.sort((entry1, entry2) -> entry2.getValue().compareTo(entry1.getValue())); + // 取出前三的案由金额 + data.setAyAmountTop1(sortedCaseReasonAmonts.get(0).getValue()); + data.setAyAmountTop2(sortedCaseReasonAmonts.get(1).getValue()); + data.setAyAmountTop3(sortedCaseReasonAmonts.get(2).getValue()); + data.setAyNameAmountTop1(sortedCaseReasonAmonts.get(0).getKey()); + data.setAyNameAmountTop2(sortedCaseReasonAmonts.get(1).getKey()); + data.setAyNameAmountTop3(sortedCaseReasonAmonts.get(2).getKey()); + + + // 取出前三的案由 + data.setAyCountTop1(sortedCaseReasons.get(0).getValue()); + data.setAyCountTop2(sortedCaseReasons.get(1).getValue()); + data.setAyCountTop3(sortedCaseReasons.get(2).getValue()); + data.setAyNameTop1(sortedCaseReasons.get(0).getKey()); + data.setAyNameTop2(sortedCaseReasons.get(1).getKey()); + data.setAyNameTop3(sortedCaseReasons.get(2).getKey()); + //审理阶段 + data.setYsCount(slcxCaseCountMap.get("一审")); + data.setEsCount(slcxCaseCountMap.get("二审")); + data.setZsCount(slcxCaseCountMap.get("再审审查")); + data.setZxCount(slcxCaseCountMap.get("再审")); + data.setYsAmount(slcxCaseAmountMap.get("一审")); + data.setEsAmount(slcxCaseAmountMap.get("二审")); + data.setZsAmount(slcxCaseAmountMap.get("再审审查")); + data.setZxAmount(slcxCaseAmountMap.get("再审")); + //诉讼地位 + data.setYgCount(roleCaseCountMap.get("原告")); + data.setBgCount(roleCaseCountMap.get("被告")); + data.setDsrCount(roleCaseCountMap.get("第三人")); + data.setQtCount(roleCaseCountMap.get("其他")); + data.setYgAmount(roleCaseAmountMap.get("原告")); + data.setBgAmount(roleCaseAmountMap.get("被告")); + data.setDsrAmount(roleCaseAmountMap.get("第三人")); + data.setQtAmount(roleCaseAmountMap.get("其他")); + + for(String k:provinceMap.keySet()) { + enterpriseProvinceList.add(provinceMap.get(k)); + } + + data.setThreeYearsCount(caseList.size()); + data.setThreeYearsAmount(totalAmount); + + } + + /** * @Description: 跨列合并 * table * row:行 diff --git a/src/main/java/com/fkzy/warn/mapper/AdministratorMapper.java b/src/main/java/com/fkzy/warn/mapper/AdministratorMapper.java new file mode 100644 index 0000000..7d26ac1 --- /dev/null +++ b/src/main/java/com/fkzy/warn/mapper/AdministratorMapper.java @@ -0,0 +1,14 @@ +package com.fkzy.warn.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fkzy.warn.model.Administrator; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author zhangjing + * @date 2024/12/04 14:48 + * @description + */ +@Mapper +public interface AdministratorMapper extends BaseMapper { +} diff --git a/src/main/java/com/fkzy/warn/mapper/EnterpriseAlarmInfoMapper.java b/src/main/java/com/fkzy/warn/mapper/EnterpriseAlarmInfoMapper.java new file mode 100644 index 0000000..46df8c0 --- /dev/null +++ b/src/main/java/com/fkzy/warn/mapper/EnterpriseAlarmInfoMapper.java @@ -0,0 +1,14 @@ +package com.fkzy.warn.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fkzy.warn.model.EnterpriseAlarmInfo; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author zhangjing + * @date 2024/12/04 14:48 + * @description + */ +@Mapper +public interface EnterpriseAlarmInfoMapper extends BaseMapper { +} diff --git a/src/main/java/com/fkzy/warn/mapper/EnterpriseProvinceMapper.java b/src/main/java/com/fkzy/warn/mapper/EnterpriseProvinceMapper.java new file mode 100644 index 0000000..18c2f9f --- /dev/null +++ b/src/main/java/com/fkzy/warn/mapper/EnterpriseProvinceMapper.java @@ -0,0 +1,14 @@ +package com.fkzy.warn.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fkzy.warn.model.EnterpriseProvince; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author zhangjing + * @date 2024/12/04 14:48 + * @description + */ +@Mapper +public interface EnterpriseProvinceMapper extends BaseMapper { +} diff --git a/src/main/java/com/fkzy/warn/mapper/LawCaseMapper.java b/src/main/java/com/fkzy/warn/mapper/LawCaseMapper.java index db25f91..21e077e 100644 --- a/src/main/java/com/fkzy/warn/mapper/LawCaseMapper.java +++ b/src/main/java/com/fkzy/warn/mapper/LawCaseMapper.java @@ -3,6 +3,9 @@ package com.fkzy.warn.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.fkzy.warn.model.LawCase; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @author zhangjing @@ -11,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface LawCaseMapper extends BaseMapper { + List queryByAlarmCase(@Param("creditCode") String creditCode); } diff --git a/src/main/java/com/fkzy/warn/model/Administrator.java b/src/main/java/com/fkzy/warn/model/Administrator.java new file mode 100644 index 0000000..26d61ab --- /dev/null +++ b/src/main/java/com/fkzy/warn/model/Administrator.java @@ -0,0 +1,72 @@ +package com.fkzy.warn.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 企业基本信息 + * @author zhangjing + * @date 2024/12/05 14:07 + * @description + */ +@Data +@TableName("t_administrator") +public class Administrator extends BaseField{ + + @TableId(value = "id", type = IdType.ASSIGN_UUID) + private String id; + /** + * 统一信用代码 + */ + @ApiModelProperty("统一信用代码") + @TableField(value = "CREDITCODE") + private String CREDITCODE; + /** + * 企业名称 + */ + @ApiModelProperty("企业名称") + @TableField(value = "ENTNAME") + private String ENTNAME; + /** + * 高管姓名 + */ + @ApiModelProperty("高管姓名") + @TableField(value = "PERNAME") + private String PERNAME; + /** + * 职位 + */ + @ApiModelProperty("职位") + @TableField(value = "POSITION") + private String POSITION; + /** + * 高管总数量 + */ + @ApiModelProperty("高管总数量") + @TableField(value = "PERSONAMOUNT") + private Integer PERSONAMOUNT; + /** + * 任职开始时间 + */ + @ApiModelProperty("任职开始时间") + @TableField(value = "CEIINCLUDEDATE") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + private Date CEIINCLUDEDATE; + /** + * 任职截止时间 + */ + @ApiModelProperty("任职截止时间") + @TableField(value = "CEIREMOVEDATE") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + private Date CEIREMOVEDATE; + + + +} diff --git a/src/main/java/com/fkzy/warn/model/EnterpriseAlarmInfo.java b/src/main/java/com/fkzy/warn/model/EnterpriseAlarmInfo.java new file mode 100644 index 0000000..283692d --- /dev/null +++ b/src/main/java/com/fkzy/warn/model/EnterpriseAlarmInfo.java @@ -0,0 +1,229 @@ +package com.fkzy.warn.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 企业司法告警汇总 + * @author zhangjing + * @date 2024/12/05 14:07 + * @description + */ +@Data +@TableName("t_enterprise_alarm_info") +public class EnterpriseAlarmInfo extends BaseField{ + /** + * 统一社会信用代码 + */ + @ApiModelProperty("统一社会信用代码") + @TableId(value = "credit_code", type = IdType.INPUT) + private String creditCode; + /** + * 企业名称 + */ + @ApiModelProperty("企业名称") + private String companyName; + /** + * 企业法人 + */ + @ApiModelProperty("企业法人") + private String legalPerson; + /** + * 告警次数 + */ + @ApiModelProperty("告警次数") + private Integer alarmCount; + /** + * 告警金额 + */ + @ApiModelProperty("告警金额") + private BigDecimal alarmAmount; + + /** + * 近三月新发案件数 + */ + @ApiModelProperty("近三月新发案件数") + private Integer threeMonthsCount; + /** + * 近三月新发案件金额 + */ + @ApiModelProperty("近三月新发案件金额") + private BigDecimal threeMonthsAmount; + + /** + * 案由数量top1 + */ + @ApiModelProperty("案由数量top1") + private Integer ayCountTop1; + + /** + * 案由名top1 + */ + @ApiModelProperty("案由名top1") + private String ayNameTop1; + /** + * 案由数量top2 + */ + @ApiModelProperty("案由数量top2") + private Integer ayCountTop2; + + /** + * 案由名top2 + */ + @ApiModelProperty("案由名top2") + private String ayNameTop2; + + /** + * 案由数量top3 + */ + @ApiModelProperty("案由数量top3") + private Integer ayCountTop3; + + /** + * 案由名top3 + */ + @ApiModelProperty("案由名top3") + private String ayNameTop3; + + /** + * 原告数 + */ + @ApiModelProperty("原告数") + private Integer ygCount; + + /** + * 被告数 + */ + @ApiModelProperty("被告数") + private Integer bgCount; + + /** + * 第三人数 + */ + @ApiModelProperty("第三人数") + private Integer dsrCount; + + /** + * 其他数 + */ + @ApiModelProperty("其他数") + private Integer qtCount; + + /** + * 一审数 + */ + @ApiModelProperty("一审数") + private Integer ysCount; + + /** + * 二审数 + */ + @ApiModelProperty("二审数") + private Integer esCount; + + /** + * 再审数 + */ + @ApiModelProperty("再审数") + private Integer zsCount; + + /** + * 执行数 + */ + @ApiModelProperty("执行数") + private Integer zxCount; + /** + * 近三年案件数 + */ + @ApiModelProperty("近三年案件数") + private Integer threeYearsCount; + /** + * 近三年案件金额 + */ + @ApiModelProperty("近三年案件金额") + private BigDecimal threeYearsAmount; + + /** + * 案由金额top1 + */ + @ApiModelProperty("案由金额top1") + private BigDecimal ayAmountTop1; + /** + * 案由金额top2 + */ + @ApiModelProperty("案由金额top2") + private BigDecimal ayAmountTop2; + /** + * 案由金额top3 + */ + @ApiModelProperty("案由金额top3") + private BigDecimal ayAmountTop3; + + /** + * 原告金额 + */ + @ApiModelProperty("原告金额") + private BigDecimal ygAmount; + + /** + * 被告金额 + */ + @ApiModelProperty("被告金额") + private BigDecimal bgAmount; + + /** + * 第三人金额 + */ + @ApiModelProperty("第三人金额") + private BigDecimal dsrAmount; + + /** + * 其他金额 + */ + @ApiModelProperty("其他金额") + private BigDecimal qtAmount; + + /** + * 一审金额 + */ + @ApiModelProperty("一审金额") + private BigDecimal ysAmount; + + /** + * 二审金额 + */ + @ApiModelProperty("二审金额") + private BigDecimal esAmount; + + /** + * 再审金额 + */ + @ApiModelProperty("再审金额") + private BigDecimal zsAmount; + + /** + * 执行金额 + */ + @ApiModelProperty("执行金额") + private BigDecimal zxAmount; + /** + * 案由名top1(金额排序) + */ + @ApiModelProperty("案由名top1") + private String ayNameAmountTop1; + /** + * 案由名top2(金额排序) + */ + @ApiModelProperty("案由名top2") + private String ayNameAmountTop2; + /** + * 案由名top3(金额排序) + */ + @ApiModelProperty("案由名top3") + private String ayNameAmountTop3; +} diff --git a/src/main/java/com/fkzy/warn/model/EnterpriseProvince.java b/src/main/java/com/fkzy/warn/model/EnterpriseProvince.java new file mode 100644 index 0000000..dd75061 --- /dev/null +++ b/src/main/java/com/fkzy/warn/model/EnterpriseProvince.java @@ -0,0 +1,56 @@ +package com.fkzy.warn.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 企业案件地域信息汇总 + * @author zhangjing + * @date 2024/12/05 14:07 + * @description + */ +@Data +@TableName("t_enterprise_province") +public class EnterpriseProvince extends BaseField{ + + /** + * id + */ + @ApiModelProperty("id") + @TableId(type = IdType.AUTO) + private Long id; + /** + * 统一社会信用代码 + */ + @ApiModelProperty("统一社会信用代码") + private String creditCode; + /** + * 省份 + */ + @ApiModelProperty("省份") + private String province; + /** + * 数量 + */ + @ApiModelProperty("数量") + private Integer count; + /** + * 金额 + */ + @ApiModelProperty("金额") + private BigDecimal amount; + public EnterpriseProvince() { + + } + public EnterpriseProvince(String creditCode,String province, Integer count, BigDecimal amount) { + this.creditCode = creditCode; + this.province = province; + this.count = count; + this.amount = amount; + } +} diff --git a/src/main/java/com/fkzy/warn/service/AdministratorService.java b/src/main/java/com/fkzy/warn/service/AdministratorService.java new file mode 100644 index 0000000..da32c12 --- /dev/null +++ b/src/main/java/com/fkzy/warn/service/AdministratorService.java @@ -0,0 +1,40 @@ +package com.fkzy.warn.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.fkzy.warn.model.Administrator; + +import java.util.List; + +/** + * @author zhangjing + * @date 2023/10/16 18:17 + * @description + */ +public interface AdministratorService extends IService { + + /** + * 保存 + * @param entity + * @return + */ + void saveModel(Administrator entity,String ticket); + + /** + * 修改 + * @param entity + * @return + */ + void updateModel(Administrator entity,String ticket); + + /** + * 删除 + * @param ids + * @return + */ + void deleteModel(List ids); + + + + + +} diff --git a/src/main/java/com/fkzy/warn/service/EnterpriseAlarmInfoService.java b/src/main/java/com/fkzy/warn/service/EnterpriseAlarmInfoService.java new file mode 100644 index 0000000..9752423 --- /dev/null +++ b/src/main/java/com/fkzy/warn/service/EnterpriseAlarmInfoService.java @@ -0,0 +1,48 @@ +package com.fkzy.warn.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.fkzy.warn.common.request.RequestParameter; +import com.fkzy.warn.common.response.ApiResponse; +import com.fkzy.warn.model.EnterpriseAlarmInfo; + +import java.util.List; + +/** + * @author zhangjing + * @date 2023/10/16 18:17 + * @description + */ +public interface EnterpriseAlarmInfoService extends IService { + + /** + * 保存 + * @param entity + * @return + */ + ApiResponse saveModel(EnterpriseAlarmInfo entity, String ticket); + + /** + * 修改 + * @param entity + * @return + */ + ApiResponse updateModel(EnterpriseAlarmInfo entity,String ticket); + + /** + * 删除 + * @param ids + * @return + */ + ApiResponse deleteModel(List ids); + + /** + * 分页查询 + * @param parameter + * @return + */ + Page queryPage(RequestParameter parameter); + + + +} diff --git a/src/main/java/com/fkzy/warn/service/EnterpriseProvinceService.java b/src/main/java/com/fkzy/warn/service/EnterpriseProvinceService.java new file mode 100644 index 0000000..3275a74 --- /dev/null +++ b/src/main/java/com/fkzy/warn/service/EnterpriseProvinceService.java @@ -0,0 +1,48 @@ +package com.fkzy.warn.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.fkzy.warn.common.request.RequestParameter; +import com.fkzy.warn.common.response.ApiResponse; +import com.fkzy.warn.model.EnterpriseProvince; + +import java.util.List; + +/** + * @author zhangjing + * @date 2023/10/16 18:17 + * @description + */ +public interface EnterpriseProvinceService extends IService { + + /** + * 保存 + * @param entity + * @return + */ + ApiResponse saveModel(EnterpriseProvince entity, String ticket); + + /** + * 修改 + * @param entity + * @return + */ + ApiResponse updateModel(EnterpriseProvince entity,String ticket); + + /** + * 删除 + * @param ids + * @return + */ + ApiResponse deleteModel(List ids); + + /** + * 分页查询 + * @param parameter + * @return + */ + Page queryPage(RequestParameter parameter); + + + +} diff --git a/src/main/java/com/fkzy/warn/service/LawCaseService.java b/src/main/java/com/fkzy/warn/service/LawCaseService.java index ca594ec..c6fd9d4 100644 --- a/src/main/java/com/fkzy/warn/service/LawCaseService.java +++ b/src/main/java/com/fkzy/warn/service/LawCaseService.java @@ -41,6 +41,14 @@ public interface LawCaseService extends IService { * @return */ void judicialModelSave(JSONObject jsonObject); - - + /** + * + * 三年案件 + * @param creditCode + * @return java.util.List + * @author zhangjing + * @create 2024/12/26 + **/ + + List threeYearsCases(String creditCode); } diff --git a/src/main/java/com/fkzy/warn/service/impl/AdministratorServiceImpl.java b/src/main/java/com/fkzy/warn/service/impl/AdministratorServiceImpl.java new file mode 100644 index 0000000..06a5cb9 --- /dev/null +++ b/src/main/java/com/fkzy/warn/service/impl/AdministratorServiceImpl.java @@ -0,0 +1,43 @@ +package com.fkzy.warn.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fkzy.warn.common.constants.EntityConstants; +import com.fkzy.warn.mapper.AdministratorMapper; +import com.fkzy.warn.model.Administrator; +import com.fkzy.warn.service.AdministratorService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author zhangjing + * @date 2023/10/16 18:17 + * @description + */ +@Service +public class AdministratorServiceImpl extends ServiceImpl implements + AdministratorService { + + + @Override + public void saveModel(Administrator entity, String ticket) { + save(entity); + } + + @Override + public void updateModel(Administrator entity,String ticket) { + this.updateById(entity); + } + + @Override + public void deleteModel(List ids) { + Administrator entity = new Administrator(); + entity.setIsDel(EntityConstants.DEL); + QueryWrapper wrapper = new QueryWrapper(); + wrapper.in("id", ids); + update(entity, wrapper); + } + + +} diff --git a/src/main/java/com/fkzy/warn/service/impl/EnterpriseAlarmInfoServiceImpl.java b/src/main/java/com/fkzy/warn/service/impl/EnterpriseAlarmInfoServiceImpl.java new file mode 100644 index 0000000..5ec92d8 --- /dev/null +++ b/src/main/java/com/fkzy/warn/service/impl/EnterpriseAlarmInfoServiceImpl.java @@ -0,0 +1,58 @@ +package com.fkzy.warn.service.impl; + +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.fkzy.warn.common.constants.EntityConstants; +import com.fkzy.warn.common.request.RequestParameter; +import com.fkzy.warn.common.response.ApiResponse; +import com.fkzy.warn.mapper.EnterpriseAlarmInfoMapper; +import com.fkzy.warn.model.EnterpriseAlarmInfo; +import com.fkzy.warn.service.EnterpriseAlarmInfoService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author zhangjing + * @date 2023/10/16 18:17 + * @description + */ +@Service +public class EnterpriseAlarmInfoServiceImpl extends ServiceImpl implements + EnterpriseAlarmInfoService { + + + @Override + public ApiResponse saveModel(EnterpriseAlarmInfo entity, String ticket) { + save(entity); + return new ApiResponse(); + } + + @Override + public ApiResponse updateModel(EnterpriseAlarmInfo entity,String ticket) { + this.updateById(entity); + return new ApiResponse(); + } + + @Override + public ApiResponse deleteModel(List ids) { + EnterpriseAlarmInfo entity = new EnterpriseAlarmInfo(); + entity.setIsDel(EntityConstants.DEL); + QueryWrapper wrapper = new QueryWrapper(); + wrapper.in("id", ids); + update(entity, wrapper); + return new ApiResponse(); + } + + @Override + public Page queryPage(RequestParameter parameter) { + EnterpriseAlarmInfo entity = parameter.getParameter().toJavaObject(EnterpriseAlarmInfo.class); + Page page = new Page(parameter.getCurrent(), parameter.getSize()); + page.setSearchCount(true); + page.setOptimizeCountSql(true); + QueryWrapper eWrapper = new QueryWrapper(entity); + Page result = this.page(page, eWrapper); + return result; + } +} diff --git a/src/main/java/com/fkzy/warn/service/impl/EnterpriseInfoServiceImpl.java b/src/main/java/com/fkzy/warn/service/impl/EnterpriseInfoServiceImpl.java index baa4c83..d5a453a 100644 --- a/src/main/java/com/fkzy/warn/service/impl/EnterpriseInfoServiceImpl.java +++ b/src/main/java/com/fkzy/warn/service/impl/EnterpriseInfoServiceImpl.java @@ -1,14 +1,18 @@ package com.fkzy.warn.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fkzy.warn.common.constants.EntityConstants; import com.fkzy.warn.mapper.EnterpriseInfoMapper; +import com.fkzy.warn.model.Administrator; import com.fkzy.warn.model.EnterpriseInfo; import com.fkzy.warn.model.LawCase; +import com.fkzy.warn.service.AdministratorService; import com.fkzy.warn.service.EnterpriseInfoService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @@ -22,6 +26,9 @@ import java.util.List; public class EnterpriseInfoServiceImpl extends ServiceImpl implements EnterpriseInfoService { + @Autowired + AdministratorService administratorService; + @Override public void saveModel(EnterpriseInfo entity, String ticket) { @@ -46,8 +53,17 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl administratorList = JSON.parseArray(PERSON.toString(), Administrator.class); + for (Administrator administrator : administratorList){ + administrator.setCREDITCODE(enterpriseInfo.getCREDITCODE()); + } + QueryWrapper query = new QueryWrapper<>(); + query.eq("CREDITCODE", enterpriseInfo.getCREDITCODE()); + administratorService.remove(query); + administratorService.saveBatch(administratorList); + saveOrUpdate(enterpriseInfo); } diff --git a/src/main/java/com/fkzy/warn/service/impl/EnterpriseProvinceServiceImpl.java b/src/main/java/com/fkzy/warn/service/impl/EnterpriseProvinceServiceImpl.java new file mode 100644 index 0000000..81f654b --- /dev/null +++ b/src/main/java/com/fkzy/warn/service/impl/EnterpriseProvinceServiceImpl.java @@ -0,0 +1,58 @@ +package com.fkzy.warn.service.impl; + +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.fkzy.warn.common.constants.EntityConstants; +import com.fkzy.warn.common.request.RequestParameter; +import com.fkzy.warn.common.response.ApiResponse; +import com.fkzy.warn.mapper.EnterpriseProvinceMapper; +import com.fkzy.warn.model.EnterpriseProvince; +import com.fkzy.warn.service.EnterpriseProvinceService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author zhangjing + * @date 2023/10/16 18:17 + * @description + */ +@Service +public class EnterpriseProvinceServiceImpl extends ServiceImpl implements + EnterpriseProvinceService { + + + @Override + public ApiResponse saveModel(EnterpriseProvince entity, String ticket) { + save(entity); + return new ApiResponse(); + } + + @Override + public ApiResponse updateModel(EnterpriseProvince entity,String ticket) { + this.updateById(entity); + return new ApiResponse(); + } + + @Override + public ApiResponse deleteModel(List ids) { + EnterpriseProvince entity = new EnterpriseProvince(); + entity.setIsDel(EntityConstants.DEL); + QueryWrapper wrapper = new QueryWrapper(); + wrapper.in("id", ids); + update(entity, wrapper); + return new ApiResponse(); + } + + @Override + public Page queryPage(RequestParameter parameter) { + EnterpriseProvince entity = parameter.getParameter().toJavaObject(EnterpriseProvince.class); + Page page = new Page(parameter.getCurrent(), parameter.getSize()); + page.setSearchCount(true); + page.setOptimizeCountSql(true); + QueryWrapper eWrapper = new QueryWrapper(entity); + Page result = this.page(page, eWrapper); + return result; + } +} diff --git a/src/main/java/com/fkzy/warn/service/impl/LawCaseServiceImpl.java b/src/main/java/com/fkzy/warn/service/impl/LawCaseServiceImpl.java index e89d9a4..d0545a8 100644 --- a/src/main/java/com/fkzy/warn/service/impl/LawCaseServiceImpl.java +++ b/src/main/java/com/fkzy/warn/service/impl/LawCaseServiceImpl.java @@ -8,10 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fkzy.warn.common.constants.EntityConstants; import com.fkzy.warn.common.util.ReportUtil; import com.fkzy.warn.mapper.LawCaseMapper; -import com.fkzy.warn.model.EnterpriseInfo; -import com.fkzy.warn.model.LawCase; -import com.fkzy.warn.model.LitigantInfo; -import com.fkzy.warn.model.ReportModel; +import com.fkzy.warn.model.*; import com.fkzy.warn.service.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,6 +41,15 @@ public class LawCaseServiceImpl extends ServiceImpl impl @Autowired private EnterpriseInfoService enterpriseInfoService; + @Autowired + private EnterpriseAlarmInfoService enterpriseAlarmInfoService; + + + @Autowired + private AlarmCaseService alarmCaseService; + @Autowired + private EnterpriseProvinceService enterpriseProvinceService; + @Override public void saveModel(LawCase entity, String ticket) { save(entity); @@ -70,7 +76,7 @@ public class LawCaseServiceImpl extends ServiceImpl impl * @author zhangjing * @create 2024/12/15 **/ - private List threeMonthsCases() { + private List threeMonthsCases(String creditCode,boolean needLitigant) { // 获取当前日期 Date currentDate = new Date(); Calendar calendar = Calendar.getInstance(); @@ -81,11 +87,14 @@ public class LawCaseServiceImpl extends ServiceImpl impl QueryWrapper query = new QueryWrapper<>(); query.ge("d_larq", threeMonthsAgo); List caseList = this.list(query); - for (LawCase lawCase : caseList) { - QueryWrapper infoQueryWrapper = new QueryWrapper<>(); - infoQueryWrapper.eq("n_ajbs", lawCase.getNAjbs()); - lawCase.setLitigantInfoList(litigantInfoService.list(infoQueryWrapper)); + if (needLitigant){ + for (LawCase lawCase : caseList) { + QueryWrapper infoQueryWrapper = new QueryWrapper<>(); + infoQueryWrapper.eq("n_ajbs", lawCase.getNAjbs()); + lawCase.setLitigantInfoList(litigantInfoService.list(infoQueryWrapper)); + } } + return caseList; } /** @@ -95,7 +104,8 @@ public class LawCaseServiceImpl extends ServiceImpl impl * @author zhangjing * @create 2024/12/15 **/ - private List threeYearsCases() { + @Override + public List threeYearsCases(String creditCode) { // 获取当前日期 Date currentDate = new Date(); Calendar calendar = Calendar.getInstance(); @@ -114,19 +124,19 @@ public class LawCaseServiceImpl extends ServiceImpl impl return caseList; } - private ReportModel createReportData(){ + private ReportModel createReportData(String creditCode){ ReportModel reportModel = new ReportModel(); QueryWrapper enterpriseInfoQueryWrapper = new QueryWrapper<>(); - enterpriseInfoQueryWrapper.eq("CREDITCODE", "91440300087909371X"); + enterpriseInfoQueryWrapper.eq("CREDITCODE", creditCode); EnterpriseInfo enterpriseInfo = enterpriseInfoService.getOne(enterpriseInfoQueryWrapper); reportModel.setBackgroundJudicial(ReportUtil.backgroundJudicial(enterpriseInfo)); reportModel.setBasicEnterprise(enterpriseInfo); - List threeMonthsCases = threeMonthsCases(); + List threeMonthsCases = threeMonthsCases(creditCode,true); reportModel.setThreeMonthsText1(ReportUtil.threeMonthsText1(threeMonthsCases)); reportModel.setThreeMonthsCases(threeMonthsCases); reportModel.setThreeMonthsText2(ReportUtil.threeMonthsText2(threeMonthsCases)); reportModel.setThreeMonthsText3(ReportUtil.threeMonthsText3(threeMonthsCases)); - List threeYearsCases = threeYearsCases(); + List threeYearsCases = threeYearsCases(creditCode); reportModel.setCaseStageText1(ReportUtil.caseStageText1(threeYearsCases)); reportModel.setLocationText(ReportUtil.locationText(threeYearsCases)); reportModel.setCaseActionText1(ReportUtil.caseActionText1(threeYearsCases)); @@ -137,21 +147,54 @@ public class LawCaseServiceImpl extends ServiceImpl impl reportModel.setHighFrequencyText(ReportUtil.highFrequencyText(threeYearsCases)); return reportModel; } - - + /** + * + * 案件信息汇总 + * @param creditCode + * @return void + * @author zhangjing + * @create 2024/12/24 + **/ + private void setAlarmInfo(String creditCode){ + EnterpriseAlarmInfo data = new EnterpriseAlarmInfo(); + data.setCreditCode(creditCode); + //告警数 + QueryWrapper alarmCaseQueryWrapper = new QueryWrapper<>(); + alarmCaseQueryWrapper.eq("credit_code", creditCode); + data.setAlarmCount(alarmCaseService.count(alarmCaseQueryWrapper)); + //告警案件金额 + List alarmCases = baseMapper.queryByAlarmCase(creditCode); + data.setAlarmAmount(ReportUtil.getCaseAmount(alarmCases)); + //近三月案件信息 + List threeMonths = threeMonthsCases(creditCode,false); + data.setThreeMonthsCount(threeMonths.size()); + data.setThreeMonthsAmount(ReportUtil.getCaseAmount(threeMonths)); + //近三年案件信息 + List threeYears = threeYearsCases(creditCode); + List enterpriseProvinceList = new ArrayList<>(); + ReportUtil.setAlarmInfo(data, threeYears,enterpriseProvinceList); + QueryWrapper enterpriseProvinceQueue = new QueryWrapper<>(); + enterpriseProvinceQueue.eq("credit_code",creditCode); + enterpriseProvinceService.remove(enterpriseProvinceQueue); + enterpriseProvinceService.saveBatch(enterpriseProvinceList); + enterpriseAlarmInfoService.saveOrUpdate(data); + } @Override public void judicialModelSave(JSONObject jsonObject) { - ReportModel reportModel = createReportData(); - ReportUtil.createReport(reportModel); +// setAlarmInfo("91440300087909371X"); + +// ReportModel reportModel = createReportData(); +// ReportUtil.createReport(reportModel); // String filePath = "司法.txt"; -// String filePath = "工商.txt"; -// String jsonOutput = convertTextToJson(filePath); -// if (jsonOutput == null) { -// logger.error("转换失败,JSON 字符串为空"); -// return; -// } -// jsonObject = new JSONObject().parseObject(jsonOutput); + String filePath = "工商.txt"; + String jsonOutput = convertTextToJson(filePath); + if (jsonOutput == null) { + logger.error("转换失败,JSON 字符串为空"); + return; + } + jsonObject = new JSONObject().parseObject(jsonOutput); + enterpriseInfoService.industryModelSave(jsonObject); // JSONArray arr = jsonObject.getJSONArray("data"); // if (arr == null || arr.isEmpty()) { // logger.error("数据数组为空"); @@ -257,87 +300,27 @@ public class LawCaseServiceImpl extends ServiceImpl impl } } - - // 批量大小 - private static final int BATCH_SIZE = 20; - - - private static final int THREAD_COUNT = 1; public void saveOrUpdateCases(List entityList) { int batchSize=20; - int size = entityList.size(); // 总记录数 + int size = entityList.size(); for (int i = 0; i < size; i += batchSize) { - int toIndex = Math.min(i + batchSize, size); // 计算当前批次的结束索引 - List batch = entityList.subList(i, toIndex); // 提取当前批次的记录 - // 执行批量插入或更新操作 + int toIndex = Math.min(i + batchSize, size); + List batch = entityList.subList(i, toIndex); this.saveOrUpdateBatch(batch); } } -// public void saveOrUpdateCases(List lawCaseList) { -// ExecutorService executorService = Executors.newFixedThreadPool(THREAD_COUNT); -// AtomicInteger counter = new AtomicInteger(0); -// -// for (int i = 0; i < lawCaseList.size(); i += BATCH_SIZE) { -// int start = i; -// int end = Math.min(i + BATCH_SIZE, lawCaseList.size()); -// List batch = lawCaseList.subList(start, end); -// int finalCounter = counter.getAndIncrement(); -// executorService.submit(() -> { -// try { -// this.saveOrUpdateBatch(batch, BATCH_SIZE); -// } catch (Exception e) { -// // 处理异常 -// System.err.println("Error processing batch " + finalCounter + ": " + e.getMessage()); -// } -// }); -// } -// executorService.shutdown(); -// try { -// executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); -// } catch (InterruptedException e) { -// Thread.currentThread().interrupt(); -// throw new RuntimeException("Interrupted while waiting for tasks to complete", e); -// } -// } + public void saveOrUpdateLitigantInfo(List entityList) { int batchSize=20; - int size = entityList.size(); // 总记录数 + int size = entityList.size(); for (int i = 0; i < size; i += batchSize) { - int toIndex = Math.min(i + batchSize, size); // 计算当前批次的结束索引 - List batch = entityList.subList(i, toIndex); // 提取当前批次的记录 + int toIndex = Math.min(i + batchSize, size); + List batch = entityList.subList(i, toIndex); // 执行批量插入或更新操作 litigantInfoService.saveOrUpdateBatch(batch); } } -// public void saveOrUpdateLitigantInfo(List litigantInfoList) { -//// QueryWrapper query = new QueryWrapper(); -//// query.eq("n_ajbs", litigantInfoList.get(0).getN_ajbs()); -//// litigantInfoService.remove(query); -// ExecutorService executorService = Executors.newFixedThreadPool(THREAD_COUNT); -// AtomicInteger counter = new AtomicInteger(0); -// -// for (int i = 0; i < litigantInfoList.size(); i += BATCH_SIZE) { -// int start = i; -// int end = Math.min(i + BATCH_SIZE, litigantInfoList.size()); -// List batch = litigantInfoList.subList(start, end); -// int finalCounter = counter.getAndIncrement(); -// executorService.submit(() -> { -// try { -// litigantInfoService.saveOrUpdateBatch(batch, BATCH_SIZE); -// } catch (Exception e) { -// // 处理异常 -// System.err.println("Error processing batch LitigantInfo" + finalCounter + ": " + e.getMessage()); -// } -// }); -// } -// executorService.shutdown(); -// try { -// executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); -// } catch (InterruptedException e) { -// Thread.currentThread().interrupt(); -// throw new RuntimeException("Interrupted while waiting for tasks to complete", e); -// } -// } + public String convertTextToJson(String filePath) { StringBuilder contentBuilder = new StringBuilder(); diff --git a/src/main/resources/mapper/LawCaseMapper.xml b/src/main/resources/mapper/LawCaseMapper.xml new file mode 100644 index 0000000..7290ecd --- /dev/null +++ b/src/main/resources/mapper/LawCaseMapper.xml @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file