From b4f8074e566d6faa39b2b84646a23b599ecd477b Mon Sep 17 00:00:00 2001 From: pengwei Date: Fri, 24 Oct 2025 16:08:58 +0800 Subject: [PATCH] =?UTF-8?q?fit:=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=94=B9=E9=80=A0=EF=BC=88=E7=BB=B4=E6=9D=83=E7=9D=A3=E5=AF=9F?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supervision/config/InterceptorConfig.java | 2 +- .../controller/CommonController.java | 70 +++++----------- .../data/DataMailBoxController.java | 5 -- .../DataVSupervisionNotifyController.java | 3 - .../java/com/biutag/supervision/job/Job.java | 81 ++++++++++--------- .../mapper/DwdAsjZfbaShrxxMapper.java | 16 ++++ .../supervision/mapper/TXsshrxxbMapper.java | 22 +++++ .../pojo/entity/DwdAsjZfbaShrxx.java | 19 +++++ .../supervision/pojo/entity/TXsshrxxb.java | 39 +++++++++ .../service/DwdAsjZfbaShrxxService.java | 20 +++++ .../supervision/service/TXsshrxxbService.java | 21 +++++ src/main/resources/application-dev.yml | 6 ++ src/main/resources/application-local.yml | 8 +- src/main/resources/application-prod.yml | 6 ++ 14 files changed, 220 insertions(+), 98 deletions(-) create mode 100644 src/main/java/com/biutag/supervision/mapper/DwdAsjZfbaShrxxMapper.java create mode 100644 src/main/java/com/biutag/supervision/mapper/TXsshrxxbMapper.java create mode 100644 src/main/java/com/biutag/supervision/pojo/entity/DwdAsjZfbaShrxx.java create mode 100644 src/main/java/com/biutag/supervision/pojo/entity/TXsshrxxb.java create mode 100644 src/main/java/com/biutag/supervision/service/DwdAsjZfbaShrxxService.java create mode 100644 src/main/java/com/biutag/supervision/service/TXsshrxxbService.java diff --git a/src/main/java/com/biutag/supervision/config/InterceptorConfig.java b/src/main/java/com/biutag/supervision/config/InterceptorConfig.java index 910c998..405a810 100644 --- a/src/main/java/com/biutag/supervision/config/InterceptorConfig.java +++ b/src/main/java/com/biutag/supervision/config/InterceptorConfig.java @@ -47,7 +47,7 @@ public class InterceptorConfig implements WebMvcConfigurer { .excludePathPatterns("/common/**") .excludePathPatterns("/app/**") // excel导出 - .excludePathPatterns("/data/mailbox/updateBaseData","/data/petitionComplaint12337/export/result","/err","/sampling/export/samplingPoling", "/negative/books/export/**","/data/petitionComplaint/export/**","/confinement/export","/books/dataThread/export") + .excludePathPatterns("/data/petitionComplaint12337/export/result","/err","/sampling/export/samplingPoling", "/negative/books/export/**","/data/petitionComplaint/export/**","/confinement/export","/books/dataThread/export") .excludePathPatterns(List.of("/doc.html", "/webjars/**", "/favicon.ico", "/v3/api-docs/**")); registry.addInterceptor(new ApiInterceptor()) .addPathPatterns("/api/jwdc/**"); diff --git a/src/main/java/com/biutag/supervision/controller/CommonController.java b/src/main/java/com/biutag/supervision/controller/CommonController.java index 3537b7c..fc9f020 100644 --- a/src/main/java/com/biutag/supervision/controller/CommonController.java +++ b/src/main/java/com/biutag/supervision/controller/CommonController.java @@ -3,16 +3,22 @@ package com.biutag.supervision.controller; import cn.hutool.core.util.StrUtil; import com.biutag.supervision.constants.enums.ComfortStatus; import com.biutag.supervision.constants.enums.RpcApplyTypeEnum; +import com.biutag.supervision.job.Job; import com.biutag.supervision.mapper.DwdAsjZfbaAjjbxxMapper; +import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.service.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneId; +import java.util.Date; import java.util.List; import java.util.Objects; @@ -33,60 +39,20 @@ public class CommonController { mailService.saveMailbox(); } - private final DwdAsjZfbaShrxx2Service dwdAsjZfbaShrxx2Service; - private final RpcApplyService rpcApplyService; - private final SupPoliceService policeService; - private final SupDepartService departService; - private final DwdAsjZfbaAjjbxxMapper dwdAsjZfbaAjjbxxMapper; - @RequestMapping("rights") - public void rights() { - log.info("rights--------------------"); - // 维权 - List shrxxList = dwdAsjZfbaShrxx2Service.listAll(); - log.info("数据:{}条", shrxxList.size()); - shrxxList.forEach(item -> { - RpcApply rpcApply = new RpcApply(); - rpcApply.setRpcId(item.getZj()); - rpcApply.setCrtTime(LocalDateTime.now()); - rpcApply.setUptTime(LocalDateTime.now()); - // 姓名 - rpcApply.setApplicantEmpName(item.getXm()); - // 受害日期 - if (Objects.nonNull(item.getShrq())) { - rpcApply.setHappenTime(item.getShrq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); - } - // 案件编号 - rpcApply.setCaseNumber(item.getAjbh()); - // 受害人警号 - SupPolice police = policeService.getByIdCode(item.getGmsfhm()); - if (Objects.nonNull(police)) { - // 警号 - rpcApply.setApplicantEmpNo(police.getEmpNo()); - SupDepart depart = departService.getById(police.getOrgId()); - rpcApply.setDepartId(depart.getId()); - rpcApply.setDepartId(depart.getName()); - } - if (StrUtil.isNotBlank(item.getAjbh())) { - DwdAsjZfbaAjjbxx ajjbxx = dwdAsjZfbaAjjbxxMapper.selectByAjbh(item.getAjbh()); - // 案件信息 - rpcApply.setFactReason(ajjbxx.getJyaq()); - if ("刑事".equals(ajjbxx.getAjbzmc())) { - rpcApply.setInfringerHandle("刑事追究"); - } - if ("行政".equals(ajjbxx.getAjbzmc())) { - rpcApply.setInfringerHandle("行政处罚"); - } - } - // 申请类型 - rpcApply.setType(RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue()); - // 已办结 - rpcApply.setRpcStatus(ComfortStatus.completed.name()); - // 数据来源 - rpcApply.setSource("gbase"); - rpcApplyService.save(rpcApply); - }); + + private final Job job; + @GetMapping("rights") + public void rights() throws ParseException { + job.rights(); } + + @GetMapping("/updateBaseData") + public Result updateBaseData(){ + + job.updateBaseData(); + return Result.success(); + } } diff --git a/src/main/java/com/biutag/supervision/controller/data/DataMailBoxController.java b/src/main/java/com/biutag/supervision/controller/data/DataMailBoxController.java index 3b50eed..8913ddc 100644 --- a/src/main/java/com/biutag/supervision/controller/data/DataMailBoxController.java +++ b/src/main/java/com/biutag/supervision/controller/data/DataMailBoxController.java @@ -107,10 +107,5 @@ public class DataMailBoxController { return Result.success(); } - @GetMapping("/updateBaseData") - public Result updateBaseData(){ - job.updateBaseData(); - return Result.success(); - } } diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java b/src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java index 9ecda36..97adc2a 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java @@ -147,9 +147,6 @@ public class DataVSupervisionNotifyController { overView.setProcessingNumber(negatives.size() - overView.getCompletedNumber()); // 办结率 overView.setCompletedRate(overView.getProblemNumber() == 0 ? 0: NumberUtil.roundHalfEven(NumberUtil.mul(NumberUtil.div(overView.getCompletedNumber(), overView.getProblemNumber()), 100), 0).doubleValue()); - - - QueryWrapper queryWrapper = new QueryWrapper<>(); UserAuth user = UserContextHolder.getCurrentUser(); // 权限 diff --git a/src/main/java/com/biutag/supervision/job/Job.java b/src/main/java/com/biutag/supervision/job/Job.java index d7dac99..46ecc92 100644 --- a/src/main/java/com/biutag/supervision/job/Job.java +++ b/src/main/java/com/biutag/supervision/job/Job.java @@ -23,10 +23,8 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.Month; import java.time.ZoneId; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Objects; +import java.util.*; +import java.util.stream.Collectors; import static com.biutag.supervision.util.TimeUtil.SECONDS_OF_A_DAY; @@ -106,6 +104,7 @@ public class Job { } private final DwdAsjZfbaShrxx2Service dwdAsjZfbaShrxx2Service; + private final DwdAsjZfbaShrxxService dwdAsjZfbaShrxxService; private final RpcApplyService rpcApplyService; private final SupPoliceService policeService; private final SupDepartService departService; @@ -116,6 +115,7 @@ public class Job { private final RpcInfringerResultService rpcInfringerResultService; private final DwdRyZfbaBaryxxService dwdRyZfbaBaryxxService; private final RpcApplySuperviseService rpcApplySuperviseService; + private final TXsshrxxbService tXsshrxxbService; // 每天一次 23:30:00 //todo 维权信息 @Scheduled(cron = "0 30 23 * * ?") @@ -127,9 +127,21 @@ public class Job { Date startTime = sdf.parse("2025-01-01 00:00:00"); Date endTime = sdf.parse("2025-12-30 00:00:00"); - List shrxxList = dwdAsjZfbaShrxx2Service.list(startTime,endTime); + List shrxxList = dwdAsjZfbaShrxxService.list(startTime,endTime); + if(CollectionUtil.isEmpty(shrxxList)){ + log.info("时间范围内无受害人信息"); + return; + } + log.info("数据:{}条", shrxxList.size()); - shrxxList.forEach(item -> { + + List zjList = shrxxList.stream().map(s->s.getZj()).toList(); + List tXsshrxxbs = tXsshrxxbService.getListAllByZjs(zjList); + if(CollectionUtil.isEmpty(tXsshrxxbs)){ + log.info("未找到受伤民辅警"); + return; + } + tXsshrxxbs.forEach(item -> { RpcApplySupervise rpcApply = new RpcApplySupervise(); rpcApply.setRpcId(item.getZj()); rpcApply.setCrtTime(LocalDateTime.now()); @@ -140,19 +152,13 @@ public class Job { if (Objects.nonNull(item.getShrq())) { rpcApply.setHappenTime(item.getShrq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); } - // 案件编号 rpcApply.setCaseNumber(item.getAjbh()); // 受害人警号 SupPolice police = policeService.getByIdCode(item.getGmsfhm()); - if (Objects.nonNull(police)) { // 警号 rpcApply.setApplicantEmpNo(police.getEmpNo()); -// //警员身份 -// SupDepart depart = departService.getById(police.getOrgId()); -// rpcApply.setDepartId(depart.getId()); -// rpcApply.setDepartId(depart.getName()); } if (StrUtil.isNotBlank(item.getAjbh())) { DwdAsjZfbaAjjbxx ajjbxx = dwdAsjZfbaAjjbxxMapper.selectByAjbh(item.getAjbh()); @@ -186,28 +192,33 @@ public class Job { rpcApply.setDepartName(supDepart.getShortName()); } //获取二级单位的信息 - String StatisticsGroupName = null; - //判断是否为非长沙市公安局 - if(!unitName.contains("长沙市公安局")){ - //非长沙市公安局 - String[] deptsData = ajjbxx.getBadwidmc().split("局"); - if(deptsData.length > 0){ - String[] depts =deptsData[0].split("省"); - if(depts.length > 0){ - StatisticsGroupName="湖南省长沙市公安局" + depts[1]+"局"; - }else{ - log.info("无法分割‘省’"); + String statisticsGroupName = null; + final String CHANGSHA_POLICE = "长沙市公安局"; + // 判断是否为非长沙市公安局 + if (unitName != null && !unitName.contains(CHANGSHA_POLICE)) { + // 非长沙市公安局 + String badwidmc = ajjbxx.getBadwidmc(); + if (badwidmc != null && !badwidmc.isEmpty()) { + // 优化字符串处理,使用indexOf代替split以提高性能 + int juIndex = badwidmc.indexOf('局'); + if (juIndex > 0) { + String beforeJu = badwidmc.substring(0, juIndex); + int shengIndex = beforeJu.indexOf('省'); + if (shengIndex > 0 && shengIndex < beforeJu.length() - 1) { + String afterSheng = beforeJu.substring(shengIndex + 1); + statisticsGroupName = "湖南省长沙市公安局" + afterSheng + "局"; + } else { + log.info("无法分割'省'或'省'后没有有效内容: {}", beforeJu); + } + } else { + log.info("无法在{}中找到'局'字", badwidmc); } - }else{ - log.info("无法分割‘局’"); + } else { + log.info("获取到的办案单位名称为空或null"); } - - }else{ - //长沙市公安局 - StatisticsGroupName ="长沙市公安局"; } - SupDepart groupDept= supDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupDepart::getName,StatisticsGroupName)); + SupDepart groupDept= supDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupDepart::getName,statisticsGroupName)); if(ObjectUtil.isNotEmpty(groupDept)){ rpcApply.setSecondDepartId(groupDept.getId()); } @@ -237,9 +248,9 @@ public class Job { RpcApplyPerson rpcApplyPerson= new RpcApplyPerson(); rpcApplyPerson.setType(RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue()); //受伤程度屏蔽 - if(StrUtil.isNotBlank(item.getShcdmc())){ - rpcApplyPerson.setInjurySeverity(item.getShcdmc()); - } +// if(StrUtil.isNotBlank(item.getShcdmc())){ +// rpcApplyPerson.setInjurySeverity(item.getShcdmc()); +// } rpcApplyPerson.setCreatTime(LocalDateTime.now()); rpcApplyPerson.setUdpTime(LocalDateTime.now()); rpcApplyPerson.setId(IdUtil.fastSimpleUUID()); @@ -249,11 +260,9 @@ public class Job { // rpcApplyPerson.setFormsOfTort(item.getShxsmc()); rpcApplyPerson.setEmpName(item.getXm()); if(StrUtil.isNotEmpty(item.getXbmc())){ - rpcApplyPerson.setGender( item.getXbmc().split("性")[0]); + rpcApplyPerson.setGender("1".equals(item.getXbmc())?"男":"女"); } - SupPolice policeData = policeService.getByIdCode(item.getGmsfhm()); -// rpcApplyPerson.setEmpNo(item.get); if(Objects.nonNull(police)){ rpcApply.setApplicantEmpNo(police.getEmpNo()); } diff --git a/src/main/java/com/biutag/supervision/mapper/DwdAsjZfbaShrxxMapper.java b/src/main/java/com/biutag/supervision/mapper/DwdAsjZfbaShrxxMapper.java new file mode 100644 index 0000000..2416b88 --- /dev/null +++ b/src/main/java/com/biutag/supervision/mapper/DwdAsjZfbaShrxxMapper.java @@ -0,0 +1,16 @@ +package com.biutag.supervision.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.entity.DwdAsjZfbaShrxx; +import com.biutag.supervision.pojo.entity.DwdAsjZfbaShrxx2; +import org.apache.ibatis.annotations.Select; + +import java.util.Date; +import java.util.List; + +@DS("slave2") +public interface DwdAsjZfbaShrxxMapper extends BaseMapper { + @Select("select * from dwd_asj_zfba_shrxx where czsj between #{startTime} and #{endTime}") + List selectList(Date startTime, Date endTime); +} diff --git a/src/main/java/com/biutag/supervision/mapper/TXsshrxxbMapper.java b/src/main/java/com/biutag/supervision/mapper/TXsshrxxbMapper.java new file mode 100644 index 0000000..ab189cb --- /dev/null +++ b/src/main/java/com/biutag/supervision/mapper/TXsshrxxbMapper.java @@ -0,0 +1,22 @@ +package com.biutag.supervision.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.entity.TXsshrxxb; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +@DS("slave5") +@Mapper +public interface TXsshrxxbMapper extends BaseMapper { + + @Select("") + List getListAllByZjs(List zjs); +} diff --git a/src/main/java/com/biutag/supervision/pojo/entity/DwdAsjZfbaShrxx.java b/src/main/java/com/biutag/supervision/pojo/entity/DwdAsjZfbaShrxx.java new file mode 100644 index 0000000..e4f928a --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/entity/DwdAsjZfbaShrxx.java @@ -0,0 +1,19 @@ +package com.biutag.supervision.pojo.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Getter; +import lombok.Setter; + +import java.util.Date; + +@Setter +@Getter +public class DwdAsjZfbaShrxx { + + // 主键 + @TableField("zj") + private String zj; + + @TableField("czsj") + private Date czsj; +} diff --git a/src/main/java/com/biutag/supervision/pojo/entity/TXsshrxxb.java b/src/main/java/com/biutag/supervision/pojo/entity/TXsshrxxb.java new file mode 100644 index 0000000..d74dd3a --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/entity/TXsshrxxb.java @@ -0,0 +1,39 @@ +package com.biutag.supervision.pojo.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Getter; +import lombok.Setter; + +import java.util.Date; + +@Setter +@Getter +public class TXsshrxxb { + // 主键 + @TableField("zj") + private String zj; + + @TableField("xm") + private String xm; + + // 受害日期 + @TableField("shrq") + private Date shrq; + + @TableField("ajbh") + private String ajbh; + + @TableField("gmsfhm") + private String gmsfhm; + + @TableField("xbmc") + private String xbmc; + + @TableField("shcdmc") + private String shcdmc; + + @TableField("sfmfj") + private String sfmfj; + + +} diff --git a/src/main/java/com/biutag/supervision/service/DwdAsjZfbaShrxxService.java b/src/main/java/com/biutag/supervision/service/DwdAsjZfbaShrxxService.java new file mode 100644 index 0000000..a25d081 --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/DwdAsjZfbaShrxxService.java @@ -0,0 +1,20 @@ +package com.biutag.supervision.service; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.mapper.DwdAsjZfbaShrxx2Mapper; +import com.biutag.supervision.mapper.DwdAsjZfbaShrxxMapper; +import com.biutag.supervision.pojo.entity.DwdAsjZfbaShrxx; +import com.biutag.supervision.pojo.entity.DwdAsjZfbaShrxx2; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class DwdAsjZfbaShrxxService extends ServiceImpl { + + public List list(Date startTime, Date endTime) { + return baseMapper.selectList(startTime, endTime); + } +} diff --git a/src/main/java/com/biutag/supervision/service/TXsshrxxbService.java b/src/main/java/com/biutag/supervision/service/TXsshrxxbService.java new file mode 100644 index 0000000..c2dd148 --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/TXsshrxxbService.java @@ -0,0 +1,21 @@ +package com.biutag.supervision.service; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.mapper.TXsshrxxbMapper; +import com.biutag.supervision.pojo.entity.TXsshrxxb; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class TXsshrxxbService extends ServiceImpl { + + + public List getListAllByZjs(List zjs){ + return baseMapper.getListAllByZjs(zjs); + } + +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 230b4e7..52db1f9 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -54,6 +54,12 @@ spring: url: jdbc:dm://65.32.34.9:5237?SCHEMA=CSGA110 username: dczd_cx password: dczd#110110 + slave5: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.gbase.jdbc.Driver + url: jdbc:gbase://65.47.16.209:5258/db_kxzd_xxzx + username: csga_wdpc + password: csga_wdpc@123 data: redis: host: 172.31.217.20 diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index dcc77e5..f876578 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -42,6 +42,12 @@ spring: url: jdbc:mysql://172.31.217.20:31868/wvp2?serverTimezone=GMT%2B8 username: root password: ip12341234 + slave5: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.gbase.jdbc.Driver + url: jdbc:gbase://65.47.16.209:5258/db_kxzd_xxzx + username: csga_wdpc + password: csga_wdpc@123 data: redis: host: 127.0.0.1 @@ -71,4 +77,4 @@ springdoc: videoInspection: url: video-img-url: http://65.47.6.105:18080/ - video-ws: ws://65.47.6.105:80/ \ No newline at end of file + video-ws: ws://65.47.6.105:80/ diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 13939a4..ef3146e 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -50,6 +50,12 @@ spring: url: jdbc:dm://65.32.34.9:5237?SCHEMA=CSGA110 username: dczd_cx password: dczd#110110 + slave5: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.gbase.jdbc.Driver + url: jdbc:gbase://65.47.16.209:5258/db_kxzd_xxzx + username: csga_wdpc + password: csga_wdpc@123 druid: min-evictable-idle-time-millis: 300000 test-on-borrow: false