Browse Source

新增基础数据(执法办案受立破案数据)

main
sjh 1 year ago
parent
commit
9a536ba7a4
  1. 22
      src/main/java/com/biutag/supervision/pojo/entity/GBaseAJJBXX.java
  2. 1
      src/main/java/com/biutag/supervision/pojo/entity/GBaseJJD.java
  3. 10
      src/main/java/com/biutag/supervision/pojo/model/BusinessPoliceModel.java
  4. 143
      src/main/java/com/biutag/supervision/service/BusinessDepartService.java
  5. 317
      src/main/java/com/biutag/supervision/service/BusinessPoliceService.java
  6. 12
      src/main/resources/mapper/BusinessDepartMapper.xml
  7. 12
      src/main/resources/mapper/BusinessPoliceMapper.xml

22
src/main/java/com/biutag/supervision/pojo/entity/GBaseAJJBXX.java

@ -33,4 +33,26 @@ public class GBaseAJJBXX {
// 办案单位名称
@TableField("BADWIDmc")
private String BADWIDmc;
// 办案人1ID
@TableField("BAR1ID")
private String BAR1ID;
// 办案人2ID
@TableField("BAR2ID")
private String BAR2ID;
// 办案人姓名
@TableField("XM")
private String XM;
// 办案人ID
@TableField(exist = false)
private String BARID;
@TableField(exist = false)
private Integer BADWNum;
@TableField(exist = false)
private Integer BARNum;
}

1
src/main/java/com/biutag/supervision/pojo/entity/GBaseJJD.java

@ -12,6 +12,7 @@ import java.util.Date;
@Getter
public class GBaseJJD {
@TableField(exist = false)
private Integer jjdbhTotal;
// 接警单编号

10
src/main/java/com/biutag/supervision/pojo/model/BusinessPoliceModel.java

@ -27,8 +27,14 @@ public class BusinessPoliceModel {
// 身份证业务
private Integer shenfenzhengyewu;
// 执法办案
private Integer zhifabanan;
// 执法办案(受案)
private Integer zhifabananSA;
// 执法办案(立案)
private Integer zhifabananLA;
// 执法办案(破案)
private Integer zhifabananPA;
// 户口业务
private Integer hukouyewu;

143
src/main/java/com/biutag/supervision/service/BusinessDepartService.java

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.mapper.*;
import com.biutag.supervision.pojo.entity.BusinessDepart;
import com.biutag.supervision.pojo.entity.BusinessLog;
import com.biutag.supervision.pojo.entity.GBaseAJJBXX;
import com.biutag.supervision.pojo.entity.GBaseJJD;
import com.biutag.supervision.pojo.model.BusinessPoliceModel;
import com.biutag.supervision.pojo.param.BusinessQueryParam;
@ -16,7 +17,10 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.BatchResult;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -39,27 +43,29 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
private final SupExternalDepartService externalDepartService;
private final GBaseAJJBXXMapper gBaseAJJBXXMapper;
public Page<BusinessPoliceModel> page(BusinessQueryParam businessQueryParam) {
// if (businessQueryParam.getDepartName()!=null && businessQueryParam.getDepartName().equals("开始导入今年所有的数据")) {
// LocalDate start = LocalDate.parse("2024-05-23");
// LocalDate end = LocalDate.parse("2024-10-14");
// for (LocalDate date = start; !date.isAfter(end); date = date.plusDays(1)) {
// List<Date> happenTime = new ArrayList<>();
// Date startDate = Date.from(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
// Date endDate = Date.from(date.atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
// happenTime.add(startDate);
// happenTime.add(endDate);
// generate(happenTime);
// log.info("已经导入{}的单位数据", date.format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
// }
// } else if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("开始导入今天所有的数据")) {
// List<Date> happenTime = new ArrayList<>();
// Date start = Date.from(LocalDateTime.parse("2024-05-22T00:00:00", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
// Date end = Date.from(LocalDateTime.parse("2024-05-22T10:59:59", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
// happenTime.add(start);
// happenTime.add(end);
// generate(happenTime);
// }
if (businessQueryParam.getDepartName()!=null && businessQueryParam.getDepartName().equals("开始导入今年所有的数据")) {
LocalDate start = LocalDate.parse("2024-01-01");
LocalDate end = LocalDate.parse("2024-10-31");
for (LocalDate date = start; !date.isAfter(end); date = date.plusDays(1)) {
List<Date> happenTime = new ArrayList<>();
Date startDate = Date.from(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
Date endDate = Date.from(date.atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
happenTime.add(startDate);
happenTime.add(endDate);
generate(happenTime);
log.info("已经导入{}的单位数据", date.format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
}
} else if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("开始导入今天所有的数据")) {
List<Date> happenTime = new ArrayList<>();
Date start = Date.from(LocalDateTime.parse("2024-09-17T00:00:00", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
Date end = Date.from(LocalDateTime.parse("2024-09-17T23:59:59", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
happenTime.add(start);
happenTime.add(end);
generate(happenTime);
}
if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("运行测试1")) {
System.out.println("开始执行测试1");
modelClueService.generate(1);
@ -104,12 +110,30 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
public void generate(List<Date> happenTime) {
List<BusinessDepart> businessDepartList = new ArrayList<>();
List<GBaseJJD> gBaseJJDSList = selectJJDList(happenTime);
if (gBaseJJDSList.isEmpty()) {
List<GBaseAJJBXX> gBaseAJJBXXListSA = selectAJJBXX(1, happenTime);
List<GBaseAJJBXX> gBaseAJJBXXListLA = selectAJJBXX(2, happenTime);
List<GBaseAJJBXX> gBaseAJJBXXListPA = selectAJJBXX(3, happenTime);
if (gBaseJJDSList.isEmpty() && gBaseAJJBXXListSA.isEmpty() && gBaseAJJBXXListLA.isEmpty() && gBaseAJJBXXListPA.isEmpty()) {
businessLogMapper.insert(new BusinessLog().setType("单位业务数据").setNum(0).setCreateTime(LocalDateTime.now()));
log.info("{}没有单位数据", happenTime.get(0));
return;
}
List<String> departIds = gBaseJJDSList.stream().map(GBaseJJD::getGxdwdm).collect(Collectors.toList());// 430100221100
List<String> departIds = new ArrayList<>();
if (!gBaseJJDSList.isEmpty()) {
departIds.addAll(gBaseJJDSList.stream().map(GBaseJJD::getGxdwdm).toList());
}
if (!gBaseAJJBXXListSA.isEmpty()) {
departIds.addAll(gBaseAJJBXXListSA.stream().map(GBaseAJJBXX::getBADWIDdm).toList());
}
if (!gBaseAJJBXXListLA.isEmpty()) {
departIds.addAll(gBaseAJJBXXListLA.stream().map(GBaseAJJBXX::getLADWBMdm).toList());
}
if (!gBaseAJJBXXListPA.isEmpty()) {
departIds.addAll(gBaseAJJBXXListPA.stream().map(GBaseAJJBXX::getLADWBMdm).toList());
}
if (departIds.isEmpty()) {
return;
}
List<Map<String, Object>> idsByDepartIds = supDepartMapper.getIdsByDepartIds(departIds);// 430100221100-1011
List<Map<String, Object>> idsByCode = supDepartMapper.getIdsByCode(departIds);
Map<String, String> resultMap2 = idsByDepartIds.stream().collect(Collectors.toMap(map -> (String) map.get("domain_name"), map -> (String) map.get("id")));
@ -138,7 +162,34 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
groupId = resultMap4.get(resultMap2.get(gBaseJJD.getGxdwdm()));
}
groupIds.add(groupId);
BusinessDepart businessDepart = getBusinessDepart(happenTime, gBaseJJD, groupId);
BusinessDepart businessDepart = getJJDBusinessDepart(happenTime, gBaseJJD, groupId);
businessDepartList.add(businessDepart);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXListSA) {
Long groupId = resultMap.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
if (groupId == null) {
groupId = resultMap4.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
}
groupIds.add(groupId);
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 1);
businessDepartList.add(businessDepart);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXListLA) {
Long groupId = resultMap.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
if (groupId == null) {
groupId = resultMap4.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
}
groupIds.add(groupId);
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 2);
businessDepartList.add(businessDepart);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXListPA) {
Long groupId = resultMap.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
if (groupId == null) {
groupId = resultMap4.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
}
groupIds.add(groupId);
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 3);
businessDepartList.add(businessDepart);
}
List<Map<Long, Object>> nameList = statisticsGroupMapper.getNameByGroupIds(groupIds);
@ -151,10 +202,10 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
List<BatchResult> insert = baseMapper.insert(businessDepartList);
log.info("单位业务数据插入成功");
int actualNum = (int) Arrays.stream(insert.get(0).getUpdateCounts()).parallel().filter(num -> num != 0).count();
businessLogMapper.insert(new BusinessLog().setType("单位业务数据").setNum(gBaseJJDSList.size()).setActualNum(actualNum).setCreateTime(LocalDateTime.now()));
businessLogMapper.insert(new BusinessLog().setType("单位业务数据").setNum(gBaseJJDSList.size() + gBaseAJJBXXListSA.size() + gBaseAJJBXXListLA.size() + gBaseAJJBXXListPA.size()).setActualNum(actualNum).setCreateTime(LocalDateTime.now()));
}
private static BusinessDepart getBusinessDepart(List<Date> happenTime, GBaseJJD gBaseJJD, Long groupId) {
private static BusinessDepart getJJDBusinessDepart(List<Date> happenTime, GBaseJJD gBaseJJD, Long groupId) {
BusinessDepart businessDepart = new BusinessDepart();
businessDepart.setDate(happenTime.get(0));
businessDepart.setDepartId(gBaseJJD.getGxdwdm());
@ -173,6 +224,26 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
return businessDepart;
}
private static BusinessDepart getAJJBXXBusinessDepart(List<Date> happenTime, GBaseAJJBXX gBasAJJBXX, Long groupId, int type) {
BusinessDepart businessDepart = new BusinessDepart();
businessDepart.setDate(happenTime.get(0));
businessDepart.setDepartId(gBasAJJBXX.getBADWIDdm());
businessDepart.setDepartName(gBasAJJBXX.getBADWIDmc());
businessDepart.setGroupId(groupId);
businessDepart.setNumber(gBasAJJBXX.getBADWNum());
if (type == 1) {
businessDepart.setBusinessType("4");
businessDepart.setBusinessTypeName("执法办案(受案)");
} else if (type == 2) {
businessDepart.setBusinessType("5");
businessDepart.setBusinessTypeName("执法办案(立案)");
} else if (type == 3) {
businessDepart.setBusinessType("6");
businessDepart.setBusinessTypeName("执法办案(破案)");
}
return businessDepart;
}
@DS("slave2")
public List<GBaseJJD> selectJJDList(List<Date> happenTime) {
QueryWrapper<GBaseJJD> queryWrapper = new QueryWrapper<>();
@ -182,4 +253,26 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
queryWrapper.groupBy("gxdwdm", "gxdwmc");
return gBaseJJDMapper.selectJJDList(queryWrapper);
}
@DS("slave2")
private List<GBaseAJJBXX> selectAJJBXX(int type, List<Date> happenTime) {
List<GBaseAJJBXX> result = new ArrayList<>();
QueryWrapper<GBaseAJJBXX> queryWrapper = new QueryWrapper<>();
if (type == 1) {
queryWrapper.select("COUNT(BADWIDdm) as BADWNum, BADWIDdm, BADWIDmc").ne("AJBZdm", "3").between("slrq", happenTime.get(0), happenTime.get(1)).groupBy("BADWIDdm", "BADWIDmc");
} else if (type == 2) {
queryWrapper.select("COUNT(BADWIDdm) as BADWNum, BADWIDdm, BADWIDmc").ne("AJBZdm", "3").between("larq", happenTime.get(0), happenTime.get(1)).groupBy("BADWIDdm", "BADWIDmc");
} else if (type == 3) {
queryWrapper.select("COUNT(BADWIDdm) as BADWNum, BADWIDdm, BADWIDmc").ne("AJBZdm", "3").between("parq", happenTime.get(0), happenTime.get(1)).groupBy("BADWIDdm", "BADWIDmc");
}
List<GBaseAJJBXX> gBaseAJJBXXs = gBaseAJJBXXMapper.selectList(queryWrapper);
if (!gBaseAJJBXXs.isEmpty()) {
gBaseAJJBXXs.forEach(item -> {
if (item != null && item.getBADWIDdm() != null && !item.getBADWIDmc().isEmpty()) {
result.add(item);
}
});
}
return result;
}
}

317
src/main/java/com/biutag/supervision/service/BusinessPoliceService.java

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.mapper.*;
import com.biutag.supervision.pojo.entity.BusinessLog;
import com.biutag.supervision.pojo.entity.BusinessPolice;
import com.biutag.supervision.pojo.entity.GBaseAJJBXX;
import com.biutag.supervision.pojo.entity.GBaseCJD;
import com.biutag.supervision.pojo.model.BusinessPoliceModel;
import com.biutag.supervision.pojo.param.BusinessQueryParam;
@ -18,7 +19,11 @@ import org.springframework.stereotype.Service;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -37,32 +42,32 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
private final BusinessDepartService businessDepartService;
public final ModelClueDataMapper modelClueDataMapper;
private final SupDepartMapper supDepartMapper;
public Page<BusinessPoliceModel> page(BusinessQueryParam businessQueryParam) {
// if (businessQueryParam.getDepartName()!=null && businessQueryParam.getDepartName().equals("开始导入今年所有的数据")) {
// LocalDate start = LocalDate.parse("2024-01-01");
// LocalDate end = LocalDate.parse("2024-10-14");
//
// for (LocalDate date = start; !date.isAfter(end); date = date.plusDays(1)) {
// List<Date> happenTime = new ArrayList<>();
// Date startDate = Date.from(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
// Date endDate = Date.from(date.atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
// happenTime.add(startDate);
// happenTime.add(endDate);
// generate(happenTime);
// log.info("已经导入{}的个人数据", date.format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
// businessDepartService.generate(happenTime);
// log.info("已经导入{}的单位数据", date.format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
// }
// } else if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("开始导入今天所有的数据")) {
// List<Date> happenTime = new ArrayList<>();
// Date start = Date.from(LocalDateTime.parse("2024-01-01T00:00:00", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
// Date end = Date.from(LocalDateTime.parse("2024-01-01T09:59:59", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
// happenTime.add(start);
// happenTime.add(end);
// generate(happenTime);
// }
if (businessQueryParam.getDepartName()!=null && businessQueryParam.getDepartName().equals("开始导入今年所有的数据")) {
LocalDate start = LocalDate.parse("2024-01-01");
LocalDate end = LocalDate.parse("2024-10-31");
for (LocalDate date = start; !date.isAfter(end); date = date.plusDays(1)) {
List<Date> happenTime = new ArrayList<>();
Date startDate = Date.from(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
Date endDate = Date.from(date.atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
happenTime.add(startDate);
happenTime.add(endDate);
generate(happenTime);
businessDepartService.generate(happenTime);
log.info("已经导入{}的个人数据", date.format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
}
} else if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("开始导入今天所有的数据")) {
List<Date> happenTime = new ArrayList<>();
Date start = Date.from(LocalDateTime.parse("2024-09-02T00:00:00", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
Date end = Date.from(LocalDateTime.parse("2024-10-14T09:59:59", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
happenTime.add(start);
happenTime.add(end);
generate(happenTime);
}
String empNo = "";
if (businessQueryParam.getEmpNo() != null && !businessQueryParam.getEmpNo().isEmpty()) {
empNo = businessQueryParam.getEmpNo();
@ -82,13 +87,24 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
public void generate(List<Date> happenTime) {
List<BusinessPolice> businessPoliceList = new ArrayList<>();
// 110、122
List<GBaseCJD> gBaseCJDSList = selectCJDList(happenTime);
if (gBaseCJDSList.isEmpty()) {
// 执法办案
ZFBAResult zfbaresult = getZfbaResult(happenTime);
if (gBaseCJDSList.isEmpty() && zfbaresult.bar1().isEmpty() && zfbaresult.bar2().isEmpty() && zfbaresult.bar3().isEmpty() && zfbaresult.bar4().isEmpty() && zfbaresult.bar5().isEmpty() && zfbaresult.bar6().isEmpty()) {
log.info("{}没有个人数据", happenTime.get(0));
businessLogMapper.insert(new BusinessLog().setType("个人业务数据").setNum(0).setCreateTime(LocalDateTime.now()));
return;
}
List<String> departIds = gBaseCJDSList.stream().map(GBaseCJD::getCjdxssdwdm).collect(Collectors.toList());
Map<String, GBaseAJJBXX> gBaseAJJBXXMapSR = new HashMap<>();
Map<String, GBaseAJJBXX> gBaseAJJBXXMapLR = new HashMap<>();
Map<String, GBaseAJJBXX> gBaseAJJBXXMapPR = new HashMap<>();
setAJJBXXMap(zfbaresult, gBaseAJJBXXMapSR, gBaseAJJBXXMapLR, gBaseAJJBXXMapPR);
List<String> departIds = new ArrayList<>();
setDepartIds(gBaseCJDSList, departIds, zfbaresult);
if (departIds.isEmpty()) {
return;
}
List<Map<String, Object>> idsByDepartIds = supDepartMapper.getIdsByDepartIds(departIds);// 430100221100-1011
List<Map<String, Object>> idsByCode = supDepartMapper.getIdsByCode(departIds);
Map<String, String> resultMap2 = idsByDepartIds.stream().collect(Collectors.toMap(map -> (String) map.get("domain_name"), map -> (String) map.get("id")));
@ -104,15 +120,7 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
Map<String, Long> resultMap4 = resultList2.stream().collect(Collectors.toMap(map -> (String) map.get("departId"), map -> (Long) map.get("groupId")));
List<Long> groupIds = new ArrayList<>();
for (GBaseCJD gBaseCJD : gBaseCJDSList) {
Long groupId = resultMap.get(resultMap2.get(gBaseCJD.getCjdxssdwdm()));
if (groupId == null) {
groupId = resultMap4.get(resultMap2.get(gBaseCJD.getCjdxssdwdm()));
}
groupIds.add(groupId);
BusinessPolice businessPolice = getBusinessPolice(happenTime, gBaseCJD, groupId);
businessPoliceList.add(businessPolice);
}
setBusinessPoliceList(happenTime, gBaseCJDSList, resultMap, resultMap2, resultMap4, groupIds, businessPoliceList, gBaseAJJBXXMapSR, gBaseAJJBXXMapLR, gBaseAJJBXXMapPR);
List<Map<Long, Object>> nameList = statisticsGroupMapper.getNameByGroupIds(groupIds);
Map<Long, String> names = nameList.stream().collect(Collectors.toMap(
map -> (Long) map.get("groupId"),
@ -129,7 +137,223 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
businessLogMapper.insert(new BusinessLog().setType("个人业务数据").setNum(gBaseCJDSList.size()).setActualNum(actualNum).setCreateTime(LocalDateTime.now()));
}
private static BusinessPolice getBusinessPolice(List<Date> happenTime, GBaseCJD gBaseCJD, Long groupId) {
private static void setBusinessPoliceList(List<Date> happenTime, List<GBaseCJD> gBaseCJDSList, Map<String, Long> resultMap, Map<String, String> resultMap2, Map<String, Long> resultMap4, List<Long> groupIds, List<BusinessPolice> businessPoliceList, Map<String, GBaseAJJBXX> gBaseAJJBXXMapSR, Map<String, GBaseAJJBXX> gBaseAJJBXXMapLR, Map<String, GBaseAJJBXX> gBaseAJJBXXMapPR) {
for (GBaseCJD gBaseCJD : gBaseCJDSList) {
Long groupId = resultMap.get(resultMap2.get(gBaseCJD.getCjdxssdwdm()));
if (groupId == null) {
groupId = resultMap4.get(resultMap2.get(gBaseCJD.getCjdxssdwdm()));
}
groupIds.add(groupId);
BusinessPolice businessPolice = getJJDBusinessPolice(happenTime, gBaseCJD, groupId);
businessPoliceList.add(businessPolice);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXMapSR.values()) {
Long groupId = resultMap.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
if (groupId == null) {
groupId = resultMap4.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
}
groupIds.add(groupId);
BusinessPolice businessPolice = getAJJBXXBusinessPolice(happenTime, gBaseAJJBXX, groupId, 4);
businessPoliceList.add(businessPolice);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXMapLR.values()) {
Long groupId = resultMap.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
if (groupId == null) {
groupId = resultMap4.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
}
groupIds.add(groupId);
BusinessPolice businessPolice = getAJJBXXBusinessPolice(happenTime, gBaseAJJBXX, groupId, 5);
businessPoliceList.add(businessPolice);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXMapPR.values()) {
Long groupId = resultMap.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
if (groupId == null) {
groupId = resultMap4.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
}
groupIds.add(groupId);
BusinessPolice businessPolice = getAJJBXXBusinessPolice(happenTime, gBaseAJJBXX, groupId, 6);
businessPoliceList.add(businessPolice);
}
}
private static void setDepartIds(List<GBaseCJD> gBaseCJDSList, List<String> departIds, ZFBAResult zfbaresult) {
List<String> collect = gBaseCJDSList.stream().map(GBaseCJD::getCjdxssdwdm).toList();
if (!collect.isEmpty()) {
departIds.addAll(collect);
}
List<String> badwiDdm1 = zfbaresult.bar1().stream().map(map -> (String) map.get("BADWIDdm")).toList();
if (!badwiDdm1.isEmpty()) {
departIds.addAll(badwiDdm1);
}
List<String> badwiDdm2 = zfbaresult.bar2().stream().map(map -> (String) map.get("BADWIDdm")).toList();
if (!badwiDdm2.isEmpty()) {
departIds.addAll(badwiDdm2);
}
List<String> badwiDdm3 = zfbaresult.bar3().stream().map(map -> (String) map.get("BADWIDdm")).toList();
if (!badwiDdm3.isEmpty()) {
departIds.addAll(badwiDdm3);
}
List<String> badwiDdm4 = zfbaresult.bar4().stream().map(map -> (String) map.get("BADWIDdm")).toList();
if (!badwiDdm4.isEmpty()) {
departIds.addAll(badwiDdm4);
}
}
private static void setAJJBXXMap(ZFBAResult zfbaresult, Map<String, GBaseAJJBXX> gBaseAJJBXXMapSR, Map<String, GBaseAJJBXX> gBaseAJJBXXMapLR, Map<String, GBaseAJJBXX> gBaseAJJBXXMapPR) {
for (Map<String, Object> bar : zfbaresult.bar1()) {
if (bar.get("BAR1ID") == null) {
continue;
}
if (gBaseAJJBXXMapSR.containsKey((String)bar.get("BAR1ID"))) {
GBaseAJJBXX gBaseAJJBXX = gBaseAJJBXXMapSR.get((String) bar.get("BAR1ID"));
gBaseAJJBXX.setBARNum(gBaseAJJBXX.getBARNum() + Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapSR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
} else {
GBaseAJJBXX gBaseAJJBXX = new GBaseAJJBXX();
gBaseAJJBXX.setBARID((String)bar.get("BAR1ID"));
gBaseAJJBXX.setBADWIDdm((String)bar.get("BADWIDdm"));
gBaseAJJBXX.setBADWIDmc((String)bar.get("BADWIDmc"));
gBaseAJJBXX.setXM((String)bar.get("XM"));
gBaseAJJBXX.setBARNum(Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapSR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
}
}
for (Map<String, Object> bar : zfbaresult.bar2()) {
if (bar.get("BAR2ID") == null) {
continue;
}
if (gBaseAJJBXXMapSR.containsKey((String)bar.get("BAR2ID"))) {
GBaseAJJBXX gBaseAJJBXX = gBaseAJJBXXMapSR.get((String) bar.get("BAR2ID"));
gBaseAJJBXX.setBARNum(gBaseAJJBXX.getBARNum() + Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapSR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
} else {
GBaseAJJBXX gBaseAJJBXX = new GBaseAJJBXX();
gBaseAJJBXX.setBARID((String)bar.get("BAR2ID"));
gBaseAJJBXX.setBADWIDdm((String)bar.get("BADWIDdm"));
gBaseAJJBXX.setBADWIDmc((String)bar.get("BADWIDmc"));
gBaseAJJBXX.setXM((String)bar.get("XM"));
gBaseAJJBXX.setBARNum(Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapSR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
}
}
for (Map<String, Object> bar : zfbaresult.bar3()) {
if (bar.get("BAR1ID") == null) {
continue;
}
if (gBaseAJJBXXMapLR.containsKey((String)bar.get("BAR1ID"))) {
GBaseAJJBXX gBaseAJJBXX = gBaseAJJBXXMapLR.get((String) bar.get("BAR1ID"));
gBaseAJJBXX.setBARNum(gBaseAJJBXX.getBARNum() + Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapLR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
} else {
GBaseAJJBXX gBaseAJJBXX = new GBaseAJJBXX();
gBaseAJJBXX.setBARID((String)bar.get("BAR1ID"));
gBaseAJJBXX.setBADWIDdm((String)bar.get("BADWIDdm"));
gBaseAJJBXX.setBADWIDmc((String)bar.get("BADWIDmc"));
gBaseAJJBXX.setXM((String)bar.get("XM"));
gBaseAJJBXX.setBARNum(Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapLR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
}
}
for (Map<String, Object> bar : zfbaresult.bar4()) {
if (bar.get("BAR2ID") == null) {
continue;
}
if (gBaseAJJBXXMapLR.containsKey((String)bar.get("BAR2ID"))) {
GBaseAJJBXX gBaseAJJBXX = gBaseAJJBXXMapLR.get((String) bar.get("BAR2ID"));
gBaseAJJBXX.setBARNum(gBaseAJJBXX.getBARNum() + Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapLR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
} else {
GBaseAJJBXX gBaseAJJBXX = new GBaseAJJBXX();
gBaseAJJBXX.setBARID((String)bar.get("BAR2ID"));
gBaseAJJBXX.setBADWIDdm((String)bar.get("BADWIDdm"));
gBaseAJJBXX.setBADWIDmc((String)bar.get("BADWIDmc"));
gBaseAJJBXX.setXM((String)bar.get("XM"));
gBaseAJJBXX.setBARNum(Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapLR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
}
}
for (Map<String, Object> bar : zfbaresult.bar5()) {
if (bar.get("BAR1ID") == null) {
continue;
}
if (gBaseAJJBXXMapPR.containsKey((String)bar.get("BAR1ID"))) {
GBaseAJJBXX gBaseAJJBXX = gBaseAJJBXXMapPR.get((String) bar.get("BAR1ID"));
gBaseAJJBXX.setBARNum(gBaseAJJBXX.getBARNum() + Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapPR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
} else {
GBaseAJJBXX gBaseAJJBXX = new GBaseAJJBXX();
gBaseAJJBXX.setBARID((String)bar.get("BAR1ID"));
gBaseAJJBXX.setBADWIDdm((String)bar.get("BADWIDdm"));
gBaseAJJBXX.setBADWIDmc((String)bar.get("BADWIDmc"));
gBaseAJJBXX.setXM((String)bar.get("XM"));
gBaseAJJBXX.setBARNum(Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapPR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
}
}
for (Map<String, Object> bar : zfbaresult.bar6()) {
if (bar.get("BAR2ID") == null) {
continue;
}
if (gBaseAJJBXXMapPR.containsKey((String)bar.get("BAR2ID"))) {
GBaseAJJBXX gBaseAJJBXX = gBaseAJJBXXMapPR.get((String) bar.get("BAR2ID"));
gBaseAJJBXX.setBARNum(gBaseAJJBXX.getBARNum() + Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapPR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
} else {
GBaseAJJBXX gBaseAJJBXX = new GBaseAJJBXX();
gBaseAJJBXX.setBARID((String)bar.get("BAR2ID"));
gBaseAJJBXX.setBADWIDdm((String)bar.get("BADWIDdm"));
gBaseAJJBXX.setBADWIDmc((String)bar.get("BADWIDmc"));
gBaseAJJBXX.setXM((String)bar.get("XM"));
gBaseAJJBXX.setBARNum(Math.toIntExact((Long) bar.get("num")));
gBaseAJJBXXMapPR.put(gBaseAJJBXX.getBARID(), gBaseAJJBXX);
}
}
}
private ZFBAResult getZfbaResult(List<Date> happenTime) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 4:受案
List<Map<String, Object>> bar1 = modelClueDataMapper.selectByUniqueKeys("select COUNT(a.BAR1ID) as num, a.BAR1ID, a.BADWIDdm, a.BADWIDmc, b.XM " +
"FROM dwd_asj_zfba_ajjbxx a " +
"LEFT JOIN dwd_ry_zfba_baryxx b ON a.BAR1ID = b.ZJ " +
"WHERE a.SLRQ BETWEEN '" + formatter.format(happenTime.get(0)) + "' AND '" + formatter.format(happenTime.get(1)) + "' AND a.AJBZdm !=3 " +
"GROUP BY a.BAR1ID, a.BADWIDdm, a.BADWIDmc, b.XM;");
List<Map<String, Object>> bar2 = modelClueDataMapper.selectByUniqueKeys("select COUNT(a.BAR2ID) as num, a.BAR2ID, a.BADWIDdm, a.BADWIDmc, b.XM " +
"FROM dwd_asj_zfba_ajjbxx a " +
"LEFT JOIN dwd_ry_zfba_baryxx b ON a.BAR2ID = b.ZJ " +
"WHERE a.SLRQ BETWEEN '" + formatter.format(happenTime.get(0)) + "' AND '" + formatter.format(happenTime.get(1)) + "' AND a.AJBZdm !=3 " +
"GROUP BY a.BAR2ID, a.BADWIDdm, a.BADWIDmc, b.XM;");
// 5:立案
List<Map<String, Object>> bar3 = modelClueDataMapper.selectByUniqueKeys("select COUNT(a.BAR1ID) as num, a.BAR1ID, a.BADWIDdm, a.BADWIDmc, b.XM " +
"FROM dwd_asj_zfba_ajjbxx a " +
"LEFT JOIN dwd_ry_zfba_baryxx b ON a.BAR1ID = b.ZJ " +
"WHERE a.LARQ BETWEEN '" + formatter.format(happenTime.get(0)) + "' AND '" + formatter.format(happenTime.get(1)) + "' AND a.AJBZdm !=3 " +
"GROUP BY a.BAR1ID, a.BADWIDdm, a.BADWIDmc, b.XM;");
List<Map<String, Object>> bar4 = modelClueDataMapper.selectByUniqueKeys("select COUNT(a.BAR2ID) as num, a.BAR2ID, a.BADWIDdm, a.BADWIDmc, b.XM " +
"FROM dwd_asj_zfba_ajjbxx a " +
"LEFT JOIN dwd_ry_zfba_baryxx b ON a.BAR2ID = b.ZJ " +
"WHERE a.LARQ BETWEEN '" + formatter.format(happenTime.get(0)) + "' AND '" + formatter.format(happenTime.get(1)) + "' AND a.AJBZdm !=3 " +
"GROUP BY a.BAR2ID, a.BADWIDdm, a.BADWIDmc, b.XM;");
// 6:破案
List<Map<String, Object>> bar5 = modelClueDataMapper.selectByUniqueKeys("select COUNT(a.BAR1ID) as num, a.BAR1ID, a.BADWIDdm, a.BADWIDmc, b.XM " +
"FROM dwd_asj_zfba_ajjbxx a " +
"LEFT JOIN dwd_ry_zfba_baryxx b ON a.BAR1ID = b.ZJ " +
"WHERE a.PARQ BETWEEN '" + formatter.format(happenTime.get(0)) + "' AND '" + formatter.format(happenTime.get(1)) + "' AND a.AJBZdm !=3 " +
"GROUP BY a.BAR1ID, a.BADWIDdm, a.BADWIDmc, b.XM;");
List<Map<String, Object>> bar6 = modelClueDataMapper.selectByUniqueKeys("select COUNT(a.BAR2ID) as num, a.BAR2ID, a.BADWIDdm, a.BADWIDmc, b.XM " +
"FROM dwd_asj_zfba_ajjbxx a " +
"LEFT JOIN dwd_ry_zfba_baryxx b ON a.BAR2ID = b.ZJ " +
"WHERE a.PARQ BETWEEN '" + formatter.format(happenTime.get(0)) + "' AND '" + formatter.format(happenTime.get(1)) + "' AND a.AJBZdm !=3 " +
"GROUP BY a.BAR2ID, a.BADWIDdm, a.BADWIDmc, b.XM;");
ZFBAResult zfbaresult = new ZFBAResult(bar1, bar2, bar3, bar4, bar5, bar6);
return zfbaresult;
}
private record ZFBAResult(List<Map<String, Object>> bar1, List<Map<String, Object>> bar2, List<Map<String, Object>> bar3, List<Map<String, Object>> bar4, List<Map<String, Object>> bar5, List<Map<String, Object>> bar6) {
}
private static BusinessPolice getJJDBusinessPolice(List<Date> happenTime, GBaseCJD gBaseCJD, Long groupId) {
BusinessPolice businessPolice = new BusinessPolice();
businessPolice.setDate(happenTime.get(0));
businessPolice.setDepartId(gBaseCJD.getCjdxssdwdm());
@ -151,6 +375,29 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
return businessPolice;
}
private static BusinessPolice getAJJBXXBusinessPolice(List<Date> happenTime, GBaseAJJBXX gBaseAJJBXX, Long groupId, int type) {
BusinessPolice businessPolice = new BusinessPolice();
businessPolice.setDate(happenTime.get(0));
businessPolice.setDepartId(gBaseAJJBXX.getBADWIDdm());
businessPolice.setDepartName(gBaseAJJBXX.getBADWIDmc());
businessPolice.setGroupId(groupId);
businessPolice.setNumber(gBaseAJJBXX.getBARNum());
businessPolice.setPoliceName(gBaseAJJBXX.getXM());
businessPolice.setEmpNo(gBaseAJJBXX.getBARID());
businessPolice.setPoliceIdCode(hashConcatenatedStrings(businessPolice.getPoliceName(), businessPolice.getEmpNo()));
if (type == 4) {
businessPolice.setBusinessType("4");
businessPolice.setBusinessTypeName("执法办案(受案)");
} else if (type == 5) {
businessPolice.setBusinessType("5");
businessPolice.setBusinessTypeName("执法办案(立案)");
} else if (type == 6) {
businessPolice.setBusinessType("6");
businessPolice.setBusinessTypeName("执法办案(破案)");
}
return businessPolice;
}
@DS("slave2")
public List<GBaseCJD> selectCJDList(List<Date> happenTime) {
QueryWrapper<GBaseCJD> queryWrapper = new QueryWrapper<>();

12
src/main/resources/mapper/BusinessDepartMapper.xml

@ -9,11 +9,13 @@
SUM(CASE WHEN business_type = 1 THEN number ELSE 0 END) AS jiechujing110,
SUM(CASE WHEN business_type = 2 THEN number ELSE 0 END) AS jiechujing122,
SUM(CASE WHEN business_type = 3 THEN number ELSE 0 END) AS shenfenzhengyewu,
SUM(CASE WHEN business_type = 4 THEN number ELSE 0 END) AS zhifabanan,
SUM(CASE WHEN business_type = 5 THEN number ELSE 0 END) AS hukouyewu,
SUM(CASE WHEN business_type = 6 THEN number ELSE 0 END) AS churujingyewu,
SUM(CASE WHEN business_type = 7 THEN number ELSE 0 END) AS cheliangshangpai,
SUM(CASE WHEN business_type = 8 THEN number ELSE 0 END) AS jiashirenkaoshi
SUM(CASE WHEN business_type = 4 THEN number ELSE 0 END) AS zhifabananSA,
SUM(CASE WHEN business_type = 5 THEN number ELSE 0 END) AS zhifabananLA,
SUM(CASE WHEN business_type = 6 THEN number ELSE 0 END) AS zhifabananPA,
SUM(CASE WHEN business_type = 7 THEN number ELSE 0 END) AS hukouyewu,
SUM(CASE WHEN business_type = 8 THEN number ELSE 0 END) AS churujingyewu,
SUM(CASE WHEN business_type = 9 THEN number ELSE 0 END) AS cheliangshangpai,
SUM(CASE WHEN business_type = 10 THEN number ELSE 0 END) AS jiashirenkaoshi
from business_depart
${ew.getCustomSqlSegment}
</select>

12
src/main/resources/mapper/BusinessPoliceMapper.xml

@ -9,11 +9,13 @@
SUM(CASE WHEN business_type = 1 THEN number ELSE 0 END) AS jiechujing110,
SUM(CASE WHEN business_type = 2 THEN number ELSE 0 END) AS jiechujing122,
SUM(CASE WHEN business_type = 3 THEN number ELSE 0 END) AS shenfenzhengyewu,
SUM(CASE WHEN business_type = 4 THEN number ELSE 0 END) AS zhifabanan,
SUM(CASE WHEN business_type = 5 THEN number ELSE 0 END) AS hukouyewu,
SUM(CASE WHEN business_type = 6 THEN number ELSE 0 END) AS churujingyewu,
SUM(CASE WHEN business_type = 7 THEN number ELSE 0 END) AS cheliangshangpai,
SUM(CASE WHEN business_type = 8 THEN number ELSE 0 END) AS jiashirenkaoshi
SUM(CASE WHEN business_type = 4 THEN number ELSE 0 END) AS zhifabananSA,
SUM(CASE WHEN business_type = 5 THEN number ELSE 0 END) AS zhifabananLA,
SUM(CASE WHEN business_type = 6 THEN number ELSE 0 END) AS zhifabananPA,
SUM(CASE WHEN business_type = 7 THEN number ELSE 0 END) AS hukouyewu,
SUM(CASE WHEN business_type = 8 THEN number ELSE 0 END) AS churujingyewu,
SUM(CASE WHEN business_type = 9 THEN number ELSE 0 END) AS cheliangshangpai,
SUM(CASE WHEN business_type = 10 THEN number ELSE 0 END) AS jiashirenkaoshi
from business_police
${ew.getCustomSqlSegment}
</select>

Loading…
Cancel
Save