Browse Source

新增基础数据模块数据导入

main
sjh 1 year ago
parent
commit
25840a9c20
  1. 22
      src/main/java/com/biutag/supervision/job/Job.java
  2. 8
      src/main/java/com/biutag/supervision/mapper/BusinessLogMapper.java
  3. 15
      src/main/java/com/biutag/supervision/mapper/GBaseCJDMapper.java
  4. 15
      src/main/java/com/biutag/supervision/mapper/GBaseJJDMapper.java
  5. 18
      src/main/java/com/biutag/supervision/mapper/StatisticsDepartMapper.java
  6. 18
      src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java
  7. 3
      src/main/java/com/biutag/supervision/pojo/entity/BusinessDepart.java
  8. 37
      src/main/java/com/biutag/supervision/pojo/entity/BusinessLog.java
  9. 5
      src/main/java/com/biutag/supervision/pojo/entity/BusinessPolice.java
  10. 34
      src/main/java/com/biutag/supervision/pojo/entity/GBaseCJD.java
  11. 30
      src/main/java/com/biutag/supervision/pojo/entity/GBaseJJD.java
  12. 47
      src/main/java/com/biutag/supervision/pojo/entity/StatisticsDepart.java
  13. 47
      src/main/java/com/biutag/supervision/pojo/entity/StatisticsGroup.java
  14. 85
      src/main/java/com/biutag/supervision/service/BusinessDepartService.java
  15. 11
      src/main/java/com/biutag/supervision/service/BusinessLogService.java
  16. 110
      src/main/java/com/biutag/supervision/service/BusinessPoliceService.java
  17. 11
      src/main/java/com/biutag/supervision/service/StatisticsDepartService.java
  18. 11
      src/main/java/com/biutag/supervision/service/StatisticsGroupService.java
  19. 5
      src/main/resources/application-dev.yml
  20. 5
      src/main/resources/application-prod.yml
  21. 13
      src/main/resources/mapper/GBaseCJDMapper.xml
  22. 13
      src/main/resources/mapper/GBaseJJDMapper.xml

22
src/main/java/com/biutag/supervision/job/Job.java

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.supervision.constants.enums.ProcessingStatusEnum;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.service.BusinessDepartService;
import com.biutag.supervision.service.BusinessPoliceService;
import com.biutag.supervision.service.NegativeService;
import com.biutag.supervision.service.SupDepartService;
import com.biutag.supervision.util.TimeUtil;
@ -12,6 +14,10 @@ import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RequiredArgsConstructor
@ -22,6 +28,10 @@ public class Job {
private final SupDepartService departService;
private final BusinessPoliceService businessPoliceService;
private final BusinessDepartService businessDepartService;
// 10分钟
// 更新流程状态
@Scheduled(fixedRate = 600000)
@ -69,4 +79,16 @@ public class Job {
}
});
}
// 每日04:00更新基础数据
@Scheduled(cron = "0 0 4 * * ?")
public void updateBaseData() {
List<Date> happenTime = new ArrayList<>();
Date start = Date.from(LocalDateTime.now().minusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0).atZone(ZoneId.systemDefault()).toInstant());
Date end = Date.from(LocalDateTime.now().minusDays(1).withHour(23).withMinute(59).withSecond(59).withNano(0).atZone(ZoneId.systemDefault()).toInstant());
happenTime.add(start);
happenTime.add(end);
businessDepartService.generate(happenTime);
businessPoliceService.generate(happenTime);
}
}

8
src/main/java/com/biutag/supervision/mapper/BusinessLogMapper.java

@ -0,0 +1,8 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.BusinessLog;
public interface BusinessLogMapper extends BaseMapper<BusinessLog> {
}

15
src/main/java/com/biutag/supervision/mapper/GBaseCJDMapper.java

@ -0,0 +1,15 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.biutag.supervision.pojo.entity.GBaseCJD;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface GBaseCJDMapper extends BaseMapper<GBaseCJD> {
List<GBaseCJD> selectCJDList(@Param(Constants.WRAPPER) QueryWrapper<GBaseCJD> queryWrapper);
}

15
src/main/java/com/biutag/supervision/mapper/GBaseJJDMapper.java

@ -0,0 +1,15 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.biutag.supervision.pojo.entity.GBaseJJD;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface GBaseJJDMapper extends BaseMapper<GBaseJJD> {
List<GBaseJJD> selectJJDList(@Param(Constants.WRAPPER) QueryWrapper<GBaseJJD> queryWrapper);
}

18
src/main/java/com/biutag/supervision/mapper/StatisticsDepartMapper.java

@ -0,0 +1,18 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.StatisticsDepart;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
public interface StatisticsDepartMapper extends BaseMapper<StatisticsDepart> {
@Select("<script>"
+ "SELECT departId, groupId FROM statistics_depart WHERE departId IN "
+ "<foreach item='item' index='index' collection='list' open='(' separator=',' close=')'>"
+ "#{item}"
+ "</foreach>"
+ "</script>")
List<Map<String, Object>> getGroupIdsByDepartIds(List<String> departIds);
}

18
src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java

@ -0,0 +1,18 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.StatisticsGroup;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
public interface StatisticsGroupMapper extends BaseMapper<StatisticsGroup> {
@Select("<script>"
+ "SELECT groupId, name FROM statistics_group WHERE groupId IN "
+ "<foreach item='item' index='index' collection='list' open='(' separator=',' close=')'>"
+ "#{item}"
+ "</foreach>"
+ "</script>")
List<Map<Long, Object>> getNameByGroupIds(List<Long> groupIds);
}

3
src/main/java/com/biutag/supervision/pojo/entity/BusinessDepart.java

@ -1,5 +1,6 @@
package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
@ -12,7 +13,7 @@ import java.time.LocalDateTime;
public class BusinessDepart {
//
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
// 日期(天)

37
src/main/java/com/biutag/supervision/pojo/entity/BusinessLog.java

@ -0,0 +1,37 @@
package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
@Accessors(chain = true)
@Setter
@Getter
public class BusinessLog {
// id
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
// 类型
@TableField("type")
private String type;
// 应更新数量
@TableField("num")
private Integer num;
// 实际更新数量
@TableField("actual_num")
private Integer actualNum;
// 创建时间
@TableField("create_time")
private LocalDateTime createTime;
}

5
src/main/java/com/biutag/supervision/pojo/entity/BusinessPolice.java

@ -1,5 +1,6 @@
package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
@ -12,7 +13,7 @@ import java.time.LocalDateTime;
public class BusinessPolice {
//
@TableId(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
// 日期(天)
@ -29,7 +30,7 @@ public class BusinessPolice {
// 警号
@TableField("emp_no")
private Integer empNo;
private String empNo;
// 警员所属单位ID
@TableField("depart_id")

34
src/main/java/com/biutag/supervision/pojo/entity/GBaseCJD.java

@ -0,0 +1,34 @@
package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Setter
@Getter
public class GBaseCJD {
private Integer clwbrxmTotal;
// 处理完毕人姓名
@TableField("clwbrxm")
private String clwbrxm;
// 处警时间
@TableField("cjsj")
private LocalDateTime cjsj;
// 处理完毕人编号
@TableField("clwbrbh")
private String clwbrbh;
// 处警对象所属单位代码
@TableField("cjdxssdwdm")
private String cjdxssdwdm;
// 处警对象所属单位名称
@TableField("cjdxssdwmc")
private String cjdxssdwmc;
}

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

@ -0,0 +1,30 @@
package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Setter
@Getter
public class GBaseJJD {
private Integer jjdbhTotal;
// 接警单编号
@TableField("jjdbh")
private String jjdbh;
// 创建时间
@TableField("cjsj")
private LocalDateTime cjsj;
// 管辖单位代码
@TableField("gxdwdm")
private String gxdwdm;
// 管辖单位名称
@TableField("gxdwmc")
private String gxdwmc;
}

47
src/main/java/com/biutag/supervision/pojo/entity/StatisticsDepart.java

@ -0,0 +1,47 @@
package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Setter
@Getter
public class StatisticsDepart {
//
@TableId(value = "departId")
private String departId;
//
@TableField("name")
private String name;
//
@TableField("level")
private Integer level;
//
@TableField("groupId")
private String groupId;
//
@TableField("pid")
private String pid;
// 总人数
@TableField("total")
private Integer total;
// 警察人数
@TableField("policeNumber")
private Integer policeNumber;
// 辅警人数
@TableField("auxiliaryPoliceNumber")
private Integer auxiliaryPoliceNumber;
}

47
src/main/java/com/biutag/supervision/pojo/entity/StatisticsGroup.java

@ -0,0 +1,47 @@
package com.biutag.supervision.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Setter
@Getter
public class StatisticsGroup {
//
@TableId(value = "groupId")
private String groupId;
//
@TableField("name")
private String name;
//
@TableField("level")
private Integer level;
//
@TableField("remark")
private String remark;
//
@TableField("type")
private String type;
//
@TableField("pid")
private String pid;
// 特殊处理, 为1为派出所
@TableField("flag")
private String flag;
//
@TableField("sort")
private Integer sort;
}

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

@ -1,18 +1,50 @@
package com.biutag.supervision.service;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
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.biutag.supervision.mapper.*;
import com.biutag.supervision.pojo.entity.BusinessDepart;
import com.biutag.supervision.mapper.BusinessDepartMapper;
import com.biutag.supervision.pojo.entity.BusinessLog;
import com.biutag.supervision.pojo.entity.GBaseJJD;
import com.biutag.supervision.pojo.model.BusinessPoliceModel;
import com.biutag.supervision.pojo.param.BusinessQueryParam;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.executor.BatchResult;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@Service
public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, BusinessDepart> {
private final GBaseJJDMapper gBaseJJDMapper;
private final StatisticsDepartMapper statisticsDepartMapper;
private final StatisticsGroupMapper statisticsGroupMapper;
private final BusinessLogMapper businessLogMapper;
public Page<BusinessPoliceModel> page(BusinessQueryParam businessQueryParam) {
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-10-14T23:59:59", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
happenTime.add(start);
happenTime.add(end);
generate(happenTime);
}
if (businessQueryParam.getDepartName().equals("测试")) {
generate(businessQueryParam.getHappenTime());
}
QueryWrapper<BusinessPoliceModel> queryWrapper = new QueryWrapper<>();
queryWrapper
.like(StrUtil.isNotBlank(businessQueryParam.getDepartName()), "depart_name", businessQueryParam.getDepartName())
@ -24,4 +56,55 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
}
return baseMapper.queryPage(Page.of(businessQueryParam.getCurrent(), businessQueryParam.getSize()), queryWrapper);
}
public void generate(List<Date> happenTime) {
List<BusinessDepart> businessDepartList = new ArrayList<>();
List<GBaseJJD> gBaseJJDSList = selectJJDList(happenTime);
List<String> departIds = gBaseJJDSList.stream().map(GBaseJJD::getGxdwdm).toList();
List<Map<String, Object>> resultList = statisticsDepartMapper.getGroupIdsByDepartIds(departIds);
Map<String, Long> resultMap = resultList.stream().collect(Collectors.toMap(map -> (String) map.get("departId"), map -> (Long) map.get("groupId")));
List<Long> groupIds = new ArrayList<>();
for (GBaseJJD gBaseJJD : gBaseJJDSList) {
Long groupId = resultMap.get(gBaseJJD.getGxdwdm());
groupIds.add(groupId);
BusinessDepart businessDepart = getBusinessDepart(gBaseJJD, groupId);
businessDepartList.add(businessDepart);
}
List<Map<Long, Object>> nameList = statisticsGroupMapper.getNameByGroupIds(groupIds);
Map<Long, String> names = nameList.stream().collect(Collectors.toMap(map -> (Long) map.get("groupId"), map -> (String) map.get("name")));
for (BusinessDepart businessDepart : businessDepartList) {
businessDepart.setGroupName(names.get(businessDepart.getGroupId()));
businessDepart.setCreateTime(LocalDateTime.now());
}
List<BatchResult> insert = baseMapper.insert(businessDepartList);
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()));
}
private static BusinessDepart getBusinessDepart(GBaseJJD gBaseJJD, Long groupId) {
BusinessDepart businessDepart = new BusinessDepart();
businessDepart.setDate(gBaseJJD.getCjsj());
businessDepart.setDepartId(gBaseJJD.getGxdwdm());
businessDepart.setDepartName(gBaseJJD.getGxdwmc());
businessDepart.setGroupId(groupId);
businessDepart.setNumber(gBaseJJD.getJjdbhTotal());
if (groupId != null) {
if (groupId == 10L) {
businessDepart.setBusinessType("1");
businessDepart.setBusinessTypeName("110接处警");
} else if (groupId == 11L) {
businessDepart.setBusinessType("2");
businessDepart.setBusinessTypeName("122接处警");
}
}
return businessDepart;
}
@DS("slave2")
public List<GBaseJJD> selectJJDList(List<Date> happenTime) {
QueryWrapper<GBaseJJD> queryWrapper = new QueryWrapper<>();
queryWrapper.between("cjsj", happenTime.get(0), happenTime.get(1));
queryWrapper.groupBy("gxdwdm", "gxdwmc", "cjsj");
return gBaseJJDMapper.selectJJDList(queryWrapper);
}
}

11
src/main/java/com/biutag/supervision/service/BusinessLogService.java

@ -0,0 +1,11 @@
package com.biutag.supervision.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.pojo.entity.BusinessLog;
import com.biutag.supervision.mapper.BusinessLogMapper;
import org.springframework.stereotype.Service;
@Service
public class BusinessLogService extends ServiceImpl<BusinessLogMapper, BusinessLog> {
}

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

@ -1,18 +1,49 @@
package com.biutag.supervision.service;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
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.biutag.supervision.mapper.BusinessPoliceMapper;
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.GBaseCJD;
import com.biutag.supervision.pojo.model.BusinessPoliceModel;
import com.biutag.supervision.pojo.param.BusinessQueryParam;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.executor.BatchResult;
import org.springframework.stereotype.Service;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@Service
public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, BusinessPolice> {
private final GBaseCJDMapper gBaseCJDMapper;
private final StatisticsDepartMapper statisticsDepartMapper;
private final StatisticsGroupMapper statisticsGroupMapper;
private final BusinessLogMapper businessLogMapper;
public Page<BusinessPoliceModel> page(BusinessQueryParam businessQueryParam) {
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-10-14T23: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 = String.valueOf(Integer.parseInt(businessQueryParam.getEmpNo()));
@ -29,4 +60,81 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
}
return baseMapper.queryPage(Page.of(businessQueryParam.getCurrent(), businessQueryParam.getSize()), queryWrapper);
}
public void generate(List<Date> happenTime) {
List<BusinessPolice> businessPoliceList = new ArrayList<>();
List<GBaseCJD> gBaseCJDSList = selectCJDList(happenTime);
List<String> departIds = gBaseCJDSList.stream().map(GBaseCJD::getCjdxssdwdm).toList();
List<Map<String, Object>> resultList = statisticsDepartMapper.getGroupIdsByDepartIds(departIds);
Map<String, Long> resultMap = resultList.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(gBaseCJD.getCjdxssdwdm());
groupIds.add(groupId);
BusinessPolice businessPolice = getBusinessPolice(gBaseCJD, groupId);
businessPoliceList.add(businessPolice);
}
List<Map<Long, Object>> nameList = statisticsGroupMapper.getNameByGroupIds(groupIds);
Map<Long, String> names = nameList.stream().collect(Collectors.toMap(
map -> (Long) map.get("groupId"),
map -> (String) map.get("name")
));
for (BusinessPolice businessPolice : businessPoliceList) {
businessPolice.setGroupName(names.get(businessPolice.getGroupId()));
businessPolice.setCreateTime(LocalDateTime.now());
}
List<BatchResult> insert = baseMapper.insert(businessPoliceList);
int actualNum = (int) Arrays.stream(insert.get(0).getUpdateCounts()).parallel().filter(num -> num != 0).count();
businessLogMapper.insert(new BusinessLog().setType("个人业务数据").setNum(gBaseCJDSList.size()).setActualNum(actualNum).setCreateTime(LocalDateTime.now()));
}
private static BusinessPolice getBusinessPolice(GBaseCJD gBaseCJD, Long groupId) {
BusinessPolice businessPolice = new BusinessPolice();
businessPolice.setDate(gBaseCJD.getCjsj());
businessPolice.setDepartId(gBaseCJD.getCjdxssdwdm());
businessPolice.setDepartName(gBaseCJD.getCjdxssdwmc());
businessPolice.setGroupId(groupId);
businessPolice.setNumber(gBaseCJD.getClwbrxmTotal());
businessPolice.setPoliceName(gBaseCJD.getClwbrxm());
businessPolice.setEmpNo(gBaseCJD.getClwbrbh());
businessPolice.setPoliceIdCode(hashConcatenatedStrings(gBaseCJD.getClwbrxm(), gBaseCJD.getClwbrbh()));
if (groupId != null) {
if (groupId == 10L) {
businessPolice.setBusinessType("1");
businessPolice.setBusinessTypeName("110接处警");
} else if (groupId == 11L) {
businessPolice.setBusinessType("2");
businessPolice.setBusinessTypeName("122接处警");
}
}
return businessPolice;
}
@DS("slave2")
public List<GBaseCJD> selectCJDList(List<Date> happenTime) {
QueryWrapper<GBaseCJD> queryWrapper = new QueryWrapper<>();
queryWrapper.between("cjsj", happenTime.get(0), happenTime.get(1));
queryWrapper.groupBy("clwbrxm", "clwbrbh", "cjdxssdwdm", "cjdxssdwmc", "cjsj");
return gBaseCJDMapper.selectCJDList(queryWrapper);
}
public static String hashConcatenatedStrings(String a, String b) {
try {
String concatenated = a + b;
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(concatenated.getBytes());
StringBuilder hexString = new StringBuilder();
for (byte b1 : hash) {
String hex = Integer.toHexString(0xff & b1);
if(hex.length() == 1) hexString.append('0');
hexString.append(hex);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Error while hashing", e);
}
}
}

11
src/main/java/com/biutag/supervision/service/StatisticsDepartService.java

@ -0,0 +1,11 @@
package com.biutag.supervision.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.pojo.entity.StatisticsDepart;
import com.biutag.supervision.mapper.StatisticsDepartMapper;
import org.springframework.stereotype.Service;
@Service
public class StatisticsDepartService extends ServiceImpl<StatisticsDepartMapper, StatisticsDepart> {
}

11
src/main/java/com/biutag/supervision/service/StatisticsGroupService.java

@ -0,0 +1,11 @@
package com.biutag.supervision.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.pojo.entity.StatisticsGroup;
import com.biutag.supervision.mapper.StatisticsGroupMapper;
import org.springframework.stereotype.Service;
@Service
public class StatisticsGroupService extends ServiceImpl<StatisticsGroupMapper, StatisticsGroup> {
}

5
src/main/resources/application-dev.yml

@ -12,6 +12,11 @@ spring:
url: jdbc:mysql://172.31.217.20:31868/open-platform?serverTimezone=GMT%2B8
username: root
password: ip12341234
slave2:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://172.31.217.20:31868/negative?serverTimezone=GMT%2B8
username: root
password: ip12341234
data:
redis:
host: 172.31.217.20

5
src/main/resources/application-prod.yml

@ -12,6 +12,11 @@ spring:
url: jdbc:mysql://65.47.6.109:3306/open-platform?serverTimezone=GMT%2B8&useSSL=false
username: root
password: ip12341234
slave2:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://65.47.16.209:5258/csga_dwd?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF8
username: csga_wdpc
password: csga_wdpc@123
data:
redis:
host: 65.47.6.109

13
src/main/resources/mapper/GBaseCJDMapper.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.biutag.supervision.mapper.GBaseCJDMapper">
<select id="selectCJDList" resultType="com.biutag.supervision.pojo.entity.GBaseCJD">
select count(clwbrxm) as clwbrxmTotal, clwbrxm, clwbrbh, cjdxssdwdm, cjdxssdwmc, cjsj
from dwd_asj_zhtx_cjd
${ew.getCustomSqlSegment}
</select>
</mapper>

13
src/main/resources/mapper/GBaseJJDMapper.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.biutag.supervision.mapper.GBaseJJDMapper">
<select id="selectJJDList" resultType="com.biutag.supervision.pojo.entity.GBaseJJD">
select count(jjdbh) as jjdbhTotal, gxdwdm, gxdwmc, cjsj
from dwd_asj_zhtx_jjd
${ew.getCustomSqlSegment}
</select>
</mapper>
Loading…
Cancel
Save