Browse Source

fit:定时任务改造(维权督察)

master
pengwei 1 month ago
parent
commit
b4f8074e56
  1. 2
      src/main/java/com/biutag/supervision/config/InterceptorConfig.java
  2. 70
      src/main/java/com/biutag/supervision/controller/CommonController.java
  3. 5
      src/main/java/com/biutag/supervision/controller/data/DataMailBoxController.java
  4. 3
      src/main/java/com/biutag/supervision/controller/datav/DataVSupervisionNotifyController.java
  5. 81
      src/main/java/com/biutag/supervision/job/Job.java
  6. 16
      src/main/java/com/biutag/supervision/mapper/DwdAsjZfbaShrxxMapper.java
  7. 22
      src/main/java/com/biutag/supervision/mapper/TXsshrxxbMapper.java
  8. 19
      src/main/java/com/biutag/supervision/pojo/entity/DwdAsjZfbaShrxx.java
  9. 39
      src/main/java/com/biutag/supervision/pojo/entity/TXsshrxxb.java
  10. 20
      src/main/java/com/biutag/supervision/service/DwdAsjZfbaShrxxService.java
  11. 21
      src/main/java/com/biutag/supervision/service/TXsshrxxbService.java
  12. 6
      src/main/resources/application-dev.yml
  13. 8
      src/main/resources/application-local.yml
  14. 6
      src/main/resources/application-prod.yml

2
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/**");

70
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<DwdAsjZfbaShrxx2> 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();
}
}

5
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();
}
}

3
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<SuperviseReport> queryWrapper = new QueryWrapper<>();
UserAuth user = UserContextHolder.getCurrentUser();
// 权限

81
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<DwdAsjZfbaShrxx2> shrxxList = dwdAsjZfbaShrxx2Service.list(startTime,endTime);
List<DwdAsjZfbaShrxx> shrxxList = dwdAsjZfbaShrxxService.list(startTime,endTime);
if(CollectionUtil.isEmpty(shrxxList)){
log.info("时间范围内无受害人信息");
return;
}
log.info("数据:{}条", shrxxList.size());
shrxxList.forEach(item -> {
List<String> zjList = shrxxList.stream().map(s->s.getZj()).toList();
List<TXsshrxxb> 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<SupDepart>().eq(SupDepart::getName,StatisticsGroupName));
SupDepart groupDept= supDepartMapper.selectOne(new LambdaQueryWrapper<SupDepart>().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());
}

16
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<DwdAsjZfbaShrxx> {
@Select("select * from dwd_asj_zfba_shrxx where czsj between #{startTime} and #{endTime}")
List<DwdAsjZfbaShrxx> selectList(Date startTime, Date endTime);
}

22
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<TXsshrxxb> {
@Select("<script>"
+ "SELECT * FROM t_xshrxxb WHERE a.sfmfj in(1,2) and zj in "
+ "<foreach item='item' index='index' collection='zjs' open='(' separator=',' close=')'>"
+ "#{item}"
+ "</foreach>"
+ "</script>")
List<TXsshrxxb> getListAllByZjs(List<String> zjs);
}

19
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;
}

39
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;
}

20
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<DwdAsjZfbaShrxxMapper, DwdAsjZfbaShrxx> {
public List<DwdAsjZfbaShrxx> list(Date startTime, Date endTime) {
return baseMapper.selectList(startTime, endTime);
}
}

21
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<TXsshrxxbMapper, TXsshrxxb> {
public List<TXsshrxxb> getListAllByZjs(List<String> zjs){
return baseMapper.getListAllByZjs(zjs);
}
}

6
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

8
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/
video-ws: ws://65.47.6.105:80/

6
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

Loading…
Cancel
Save