Browse Source

fit:1、督察任务发布后端v2(重点人员督察)

master
pengwei 5 months ago
parent
commit
4c6bd54ad0
  1. 52
      src/main/java/com/biutag/supervision/controller/mobileSupervision/SupRiskPersonController.java
  2. 37
      src/main/java/com/biutag/supervision/controller/mobileSupervision/TaskManagementController.java
  3. 14
      src/main/java/com/biutag/supervision/mapper/SupRiskPersonalMapper.java
  4. 22
      src/main/java/com/biutag/supervision/mapper/SupRiskPersonalSupRecordMapper.java
  5. 4
      src/main/java/com/biutag/supervision/mapper/SupTaskPersonMapper.java
  6. 18
      src/main/java/com/biutag/supervision/pojo/dto/SupRiskDto.java
  7. 41
      src/main/java/com/biutag/supervision/pojo/dto/SupRiskPersonalSupRecordDto.java
  8. 13
      src/main/java/com/biutag/supervision/pojo/entity/SupRiskPersonal.java
  9. 2
      src/main/java/com/biutag/supervision/pojo/entity/SupRiskPersonalSup.java
  10. 56
      src/main/java/com/biutag/supervision/pojo/entity/SupRiskPersonalSupRecord.java
  11. 15
      src/main/java/com/biutag/supervision/pojo/param/SupRiskPersonalQueryParam.java
  12. 11
      src/main/java/com/biutag/supervision/pojo/param/SupRiskPersonalSupRecordQueryParam.java
  13. 38
      src/main/java/com/biutag/supervision/pojo/vo/SupRiskPersonalSupRecordVo.java
  14. 59
      src/main/java/com/biutag/supervision/pojo/vo/SupRiskPersonalVo.java
  15. 83
      src/main/java/com/biutag/supervision/service/SupRiskPersonalService.java
  16. 12
      src/main/java/com/biutag/supervision/service/SupRiskPersonalSupRecordService.java
  17. 66
      src/main/java/com/biutag/supervision/service/TaskManagementService.java
  18. 53
      src/main/java/com/biutag/supervision/util/CommonUtil.java
  19. 30
      src/main/resources/mapper/SupRiskPersonalMapper.xml
  20. 13
      src/main/resources/mapper/SupRiskPersonalSupRecordMapper.xml

52
src/main/java/com/biutag/supervision/controller/mobileSupervision/SupRiskPersonController.java

@ -0,0 +1,52 @@
package com.biutag.supervision.controller.mobileSupervision;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.SupRiskPersonalSupRecordDto;
import com.biutag.supervision.pojo.entity.SupRiskPersonal;
import com.biutag.supervision.pojo.entity.SupRiskPersonalControlRecord;
import com.biutag.supervision.pojo.entity.SupRiskPersonalSup;
import com.biutag.supervision.pojo.entity.SupTaskProblem;
import com.biutag.supervision.pojo.param.SupRiskPersonalQueryParam;
import com.biutag.supervision.pojo.param.SupRiskPersonalSupRecordQueryParam;
import com.biutag.supervision.pojo.vo.SupRiskPersonalSupRecordVo;
import com.biutag.supervision.pojo.vo.SupRiskPersonalVo;
import com.biutag.supervision.service.SupRiskPersonalService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RequestMapping("/task/supRisk")
@RestController
@RequiredArgsConstructor
public class SupRiskPersonController {
private final SupRiskPersonalService supRiskPersonalService;
@GetMapping
Result<Page<SupRiskPersonalVo>> queryPage(SupRiskPersonalQueryParam queryParam){
return Result.success(supRiskPersonalService.page(queryParam));
}
//保存督察记录
@PostMapping("/saveSupRecord")
Result saveSupRecord(@RequestBody SupRiskPersonalSupRecordDto supRecordDto){
if( supRiskPersonalService.saveSupRecord(supRecordDto)){
return Result.success();
}else{
return Result.failed("操作失败");
}
}
//督察记录分页
@GetMapping("recordPage")
Result<Page<SupRiskPersonalSupRecordVo>> recordPage(SupRiskPersonalSupRecordQueryParam queryParam){
return Result.success(supRiskPersonalService.recordPage(queryParam));
}
//删除督察记录
@DeleteMapping("/supRecord/{id}")
Result delRecordData(@PathVariable Integer id){
return Result.success(supRiskPersonalService.delSupRecord(id));
}
}

37
src/main/java/com/biutag/supervision/controller/mobileSupervision/TaskManagementController.java

@ -15,12 +15,14 @@ import com.biutag.supervision.pojo.dto.SupRiskDto;
import com.biutag.supervision.pojo.dto.TaskManagementDto;
import com.biutag.supervision.pojo.dto.TemperancePoliceDto;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.pojo.entity.SupPolice;
import com.biutag.supervision.pojo.entity.SupRiskPersonal;
import com.biutag.supervision.pojo.param.TaskInspectionQueryParam;
import com.biutag.supervision.pojo.param.TaskQueryParam;
import com.biutag.supervision.pojo.vo.TaskInspectionVo;
import com.biutag.supervision.pojo.vo.TaskVo;
import com.biutag.supervision.service.SupDepartService;
import com.biutag.supervision.service.SupPoliceService;
import com.biutag.supervision.service.SupTaskService;
import com.biutag.supervision.service.TaskManagementService;
import lombok.RequiredArgsConstructor;
@ -43,6 +45,9 @@ public class TaskManagementController {
private final SupTaskService taskService;
private final SupDepartService departService;
private final SupPoliceService policeService;
@GetMapping
public Result<Page<TaskVo>> pageResult(TaskQueryParam queryParam) {
return Result.success(taskService.pageTaskData(queryParam));
@ -111,19 +116,29 @@ public class TaskManagementController {
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), SupRiskDto.class, new ReadListener<SupRiskDto>() {
@Override
public void invoke(SupRiskDto data, AnalysisContext analysisContext) {
String[] departParts = data.getResponsibleDepartName().replace("长沙市公安局", "").split("-");
String departName = departParts[departParts.length - 1];
List<SupDepart> departs = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getShortName, departName));
if (departs.size() == 1) {
data.setResponsibleDepartId(departs.get(0).getId());
} else if (departParts.length > 1) {
String departPart = departParts[0].replace("公安", "");
List<SupDepart> departs2 = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getShortName, departPart));
if (departs2.size() == 1) {
data.setResponsibleDepartId(departs2.get(0).getId());
if(StrUtil.isNotBlank(data.getResponsibleDepartName())){
String[] departParts = data.getResponsibleDepartName().replace("长沙市公安局", "").split("-");
String departName = departParts[departParts.length - 1];
List<SupDepart> departs = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getShortName, departName));
if (departs.size() == 1) {
data.setResponsibleDepartId(departs.get(0).getId());
} else if (departParts.length > 1) {
String departPart = departParts[0].replace("公安", "");
List<SupDepart> departs2 = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getShortName, departPart));
if (departs2.size() == 1) {
data.setResponsibleDepartId(departs2.get(0).getId());
}
}
List<SupPolice> polices = policeService.list(new LambdaQueryWrapper<SupPolice>().eq(SupPolice::getOrgId,data.getResponsibleDepartId()).eq(SupPolice::getName,data.getResponsibleName()));
data.setResponsibleEmpNo(polices.get(0).getEmpNo());
}
list.add(data);
if(ObjectUtil.isNotEmpty(data)){
list.add(data);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {

14
src/main/java/com/biutag/supervision/mapper/SupRiskPersonalMapper.java

@ -1,8 +1,18 @@
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.entity.SupRiskPersonal;
import com.biutag.supervision.pojo.entity.SupTaskSelfexamination;
import com.biutag.supervision.pojo.param.SupRiskPersonalQueryParam;
import com.biutag.supervision.pojo.param.TaskInspectionQueryParam;
import com.biutag.supervision.pojo.vo.SupRiskPersonalVo;
import org.apache.ibatis.annotations.Param;
public interface SupRiskPersonalMapper extends BaseMapper<SupRiskPersonal> {
import java.util.List;
}
public interface SupRiskPersonalMapper extends BaseMapper<SupRiskPersonal> {
Page<SupRiskPersonalVo> queryPage(@Param("page") Page<SupRiskPersonalQueryParam> page, @Param(Constants.WRAPPER) QueryWrapper<SupRiskPersonal> queryWrapper);
}

22
src/main/java/com/biutag/supervision/mapper/SupRiskPersonalSupRecordMapper.java

@ -0,0 +1,22 @@
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.dto.SupRiskPersonalSupRecordDto;
import com.biutag.supervision.pojo.entity.SupRiskPersonal;
import com.biutag.supervision.pojo.entity.SupRiskPersonalSupRecord;
import com.biutag.supervision.pojo.param.SupRiskPersonalSupRecordQueryParam;
import com.biutag.supervision.pojo.vo.SupRiskPersonalSupRecordVo;
import com.biutag.supervision.pojo.vo.SupRiskPersonalVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SupRiskPersonalSupRecordMapper extends BaseMapper<SupRiskPersonalSupRecord> {
Page<SupRiskPersonalSupRecordVo> queryPage(@Param("page") Page<SupRiskPersonalSupRecordQueryParam> page, @Param(Constants.WRAPPER) QueryWrapper<SupRiskPersonalSupRecord> queryWrapper);
}

4
src/main/java/com/biutag/supervision/mapper/SupTaskPersonMapper.java

@ -1,8 +1,10 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.SupRiskPersonal;
import com.biutag.supervision.pojo.entity.SupTaskPerson;
import com.biutag.supervision.pojo.param.TaskInspectionQueryParam;
public interface SupTaskPersonMapper extends BaseMapper<SupTaskPerson> {
}
}

18
src/main/java/com/biutag/supervision/pojo/dto/SupRiskDto.java

@ -32,15 +32,14 @@ public class SupRiskDto {
// 管控级别
@ExcelProperty({"管控级别*"})
private String controlLevel;
// 管控间隔
@ExcelProperty({"管控间隔*"})
private String controlTimeInterval;
//责任单位Id
private String responsibleDepartId;
// 责任单位名称
@ExcelProperty({"责任单位*"})
private String responsibleDepartName;
//责任民警警号
private String responsibleEmpNo;
// 责任民警姓名
@ExcelProperty({"责任民警*"})
private String responsibleName;
@ -53,8 +52,13 @@ public class SupRiskDto {
@ExcelProperty({"包保督察人员姓名*"})
private String controlName;
// 管控间隔
@ExcelProperty({"管控间隔*"})
private String controlTimeInterval;
//责任民警警号
@ExcelProperty({"责任民警警号"})
private String responsibleEmpNo;
//责任单位Id
@ExcelProperty({"责任单位Id"})
private String responsibleDepartId;
}

41
src/main/java/com/biutag/supervision/pojo/dto/SupRiskPersonalSupRecordDto.java

@ -0,0 +1,41 @@
package com.biutag.supervision.pojo.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.biutag.supervision.pojo.vo.FileVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
public class SupRiskPersonalSupRecordDto {
private int id;
//重点人员姓名
private String name;
//重点人员证件号码
private String idCode;
//督察状态
private String supStatus;
//督察方式
private String supType;
//督察情况
private String supDesc;
//督察时间
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm")
private LocalDateTime supTime;
// 检测照片
private List<FileVo> Files = new ArrayList<>();
}

13
src/main/java/com/biutag/supervision/pojo/entity/SupRiskPersonal.java

@ -59,7 +59,14 @@ public class SupRiskPersonal {
@TableField("create_time")
private LocalDateTime createTime;
// 督察人员id
private Integer supId;
// 包保督察人员ID
@TableField("task_person_id")
private Integer taskPersonId;
}
@TableField("control_time_interval")
private String controlTimeInterval;
@TableField("task_id")
private Integer taskId;
}

2
src/main/java/com/biutag/supervision/pojo/entity/SupRiskPersonalSup.java

@ -40,4 +40,4 @@ public class SupRiskPersonalSup {
@TableField("create_time")
private LocalDateTime createTime;
}
}

56
src/main/java/com/biutag/supervision/pojo/entity/SupRiskPersonalSupRecord.java

@ -0,0 +1,56 @@
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 com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
public class SupRiskPersonalSupRecord {
@TableId(value = "id", type = IdType.AUTO)
private int id;
//重点人员姓名
@TableField("name")
private String name;
//重点人员证件号码
@TableField("id_code")
private String idCode;
//督察状态
@TableField("sup_status")
private String supStatus;
//督察方式
@TableField("sup_type")
private String supType;
//督察情况
@TableField("sup_desc")
private String supDesc;
//附件 JSON格式
@TableField("files")
private String files;
//督察时间
@TableField("sup_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm")
private LocalDateTime supTime;
//创建时间
@TableField("create_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm")
private LocalDateTime createTime;
@TableField("create_emp_no")
private String createEmpNo;
@TableField("create_name")
private String createName;
}

15
src/main/java/com/biutag/supervision/pojo/param/SupRiskPersonalQueryParam.java

@ -0,0 +1,15 @@
package com.biutag.supervision.pojo.param;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class SupRiskPersonalQueryParam extends BasePage{
//任务ID
private Integer taskId;
//重点人员身份证
private String idCode;
//姓名
private String name;
}

11
src/main/java/com/biutag/supervision/pojo/param/SupRiskPersonalSupRecordQueryParam.java

@ -0,0 +1,11 @@
package com.biutag.supervision.pojo.param;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class SupRiskPersonalSupRecordQueryParam extends BasePage {
}

38
src/main/java/com/biutag/supervision/pojo/vo/SupRiskPersonalSupRecordVo.java

@ -0,0 +1,38 @@
package com.biutag.supervision.pojo.vo;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
public class SupRiskPersonalSupRecordVo {
//id
private int id;
//重点人员姓名
private String name;
//重点人员证件号码
private String idCode;
//督察状态
private String supStatus;
//督察方式
private String supType;
//督察情况
private String supDesc;
//附件 JSON格式
private String files;
//附件
private List<FileVo> fileVoList;
//督察时间
private LocalDateTime supTime;
//创建时间
private LocalDateTime createTime;
private String createEmpNo;
private String createName;
}

59
src/main/java/com/biutag/supervision/pojo/vo/SupRiskPersonalVo.java

@ -0,0 +1,59 @@
package com.biutag.supervision.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
public class SupRiskPersonalVo {
// 证件号码
private String idCode;
// 姓名
private String name;
// 性别男1女2
private String gender;
// 年龄
private Integer age;
// 手机号
private String mobile;
// 人员类别
private String personalType;
// 管控级别
private String controlLevel;
// 责任单位id
private String responsibleDepartId;
// 责任单位名称
private String responsibleDepartName;
// 责任民警警号
private String responsibleEmpNo;
// 责任民警姓名
private String responsibleName;
// 创建时间
private LocalDateTime createTime;
// 包保督察人员ID
private Integer taskPersonId;
private String controlTimeInterval;
private Integer taskId;
//督察人员姓名
private String controlName;
//督察人员警号
private String controlEmpNo;
}

83
src/main/java/com/biutag/supervision/service/SupRiskPersonalService.java

@ -1,11 +1,94 @@
package com.biutag.supervision.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
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.common.UserContextHolder;
import com.biutag.supervision.constants.AppConstants;
import com.biutag.supervision.mapper.SupRiskPersonalSupRecordMapper;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.SupRiskPersonalSupRecordDto;
import com.biutag.supervision.pojo.entity.RpcApplySupervise;
import com.biutag.supervision.pojo.entity.SupRiskPersonal;
import com.biutag.supervision.mapper.SupRiskPersonalMapper;
import com.biutag.supervision.pojo.entity.SupRiskPersonalSupRecord;
import com.biutag.supervision.pojo.entity.SupTaskTestingAlcoholPeople;
import com.biutag.supervision.pojo.model.UserAuth;
import com.biutag.supervision.pojo.param.SupRiskPersonalQueryParam;
import com.biutag.supervision.pojo.param.SupRiskPersonalSupRecordQueryParam;
import com.biutag.supervision.pojo.param.TaskInspectionQueryParam;
import com.biutag.supervision.pojo.param.TaskTestingAlcoholPeopleQueryParam;
import com.biutag.supervision.pojo.vo.*;
import com.biutag.supervision.util.JSON;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@RequiredArgsConstructor
@Service
public class SupRiskPersonalService extends ServiceImpl<SupRiskPersonalMapper, SupRiskPersonal> {
private final SupRiskPersonalSupRecordService supRecordService;
private final SupRiskPersonalSupRecordMapper supRiskPersonalSupRecordMapper;
/**
* 分页查询
* */
public Page<SupRiskPersonalVo> page(SupRiskPersonalQueryParam queryParam) {
QueryWrapper<SupRiskPersonal> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("srp.task_id", queryParam.getTaskId())
.like("srp.id_code",queryParam.getIdCode())
.like("srp.name",queryParam.getName())
.orderByAsc("srp.create_time");
Page<SupRiskPersonalVo> page = baseMapper.queryPage(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper);
return page;
}
/**
* 录入督察记录数据
* */
public Boolean saveSupRecord(SupRiskPersonalSupRecordDto supRecordDto){
SupRiskPersonalSupRecord supRecord = new SupRiskPersonalSupRecord();
BeanUtils.copyProperties(supRecordDto,supRecord);
supRecord.setCreateTime(LocalDateTime.now());
UserAuth user = UserContextHolder.getCurrentUser();
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType())) {
supRecord.setCreateEmpNo(user.getEmpNo());
supRecord.setCreateName(user.getUserName());
}
//补充file
supRecord.setFiles(JSON.toJSONString(supRecordDto.getFiles()));
return supRecordService.saveOrUpdate(supRecord);
}
/**
* 督察记录列表
* */
public Page<SupRiskPersonalSupRecordVo> recordPage(SupRiskPersonalSupRecordQueryParam queryParam){
QueryWrapper<SupRiskPersonalSupRecord> queryWrapper = new QueryWrapper<>();
Page<SupRiskPersonalSupRecordVo> page = supRiskPersonalSupRecordMapper.queryPage(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper);
page.getRecords().forEach(item -> {
if (StrUtil.isNotBlank(item.getFiles())) {
item.setFileVoList(com.alibaba.fastjson2.JSON.parseArray(item.getFiles(), FileVo.class));
}
});
return page;
}
/**
* 删除督察记录
* */
public Boolean delSupRecord(Integer id){
return supRiskPersonalSupRecordMapper.deleteById(id) > 0;
}
}

12
src/main/java/com/biutag/supervision/service/SupRiskPersonalSupRecordService.java

@ -0,0 +1,12 @@
package com.biutag.supervision.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.mapper.SupRiskPersonalSupMapper;
import com.biutag.supervision.mapper.SupRiskPersonalSupRecordMapper;
import com.biutag.supervision.pojo.entity.SupRiskPersonalSup;
import com.biutag.supervision.pojo.entity.SupRiskPersonalSupRecord;
import org.springframework.stereotype.Service;
@Service
public class SupRiskPersonalSupRecordService extends ServiceImpl<SupRiskPersonalSupRecordMapper, SupRiskPersonalSupRecord> {
}

66
src/main/java/com/biutag/supervision/service/TaskManagementService.java

@ -2,15 +2,18 @@ package com.biutag.supervision.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.constants.enums.TaskStatusEnum;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.SupRiskDto;
import com.biutag.supervision.pojo.dto.TaskInspectionDto;
import com.biutag.supervision.pojo.dto.TaskManagementDto;
import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.param.TaskQueryParam;
import com.biutag.supervision.pojo.vo.TaskVo;
import com.biutag.supervision.util.CommonUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@Service
@ -46,6 +50,9 @@ public class TaskManagementService {
private final SupTaskSelfexaminationDepartService supTaskSelfexaminationDepartService;
private final SupRiskPersonalSupService supRiskPersonalSupService;
private final SupRiskPersonalService supRiskPersonalService;
@Transactional(rollbackFor = Exception.class)
@ -138,19 +145,30 @@ public class TaskManagementService {
return testingAlcoholPeopleService.saveBatch(dto.getUserList());
}
if("重点人员管控".equals(dto.getSpecialType())){
// List<SupRiskPersonalControlRecord> uniquePersons = personList.stream()
// .collect(Collectors.toMap(
// Person::getId, // keyMapper,提取id作为key
// Function.identity(), // valueMapper,直接使用Person对象作为value
// (k, v) -> v // mergeFunction,处理key冲突,这里保留后者
// )).values().stream() // 获取Map的values()并转换为Stream
// .collect(Collectors.toList()); // 收集为List
// dto.getSupRiskDtoList().forEach(s->{
// SupRiskPersonal supRiskPersonal=new SupRiskPersonal();
// BeanUtils.copyProperties(s,supRiskPersonal);
// supRiskPersonal.setCreateTime(LocalDateTime.now());
// });
dto.getSupRiskDtoList().forEach(s->{
//参与人员表
SupTaskPerson personalSup=new SupTaskPerson();
personalSup.setEmpNo(s.getControlEmpNo());
personalSup.setName(s.getControlName());
personalSup.setCreateTime(LocalDateTime.now());
personalSup.setTaskId(task.getId());
taskPersonService.save(personalSup);
//重点人员
SupRiskPersonal supRiskPersonal=new SupRiskPersonal();
BeanUtils.copyProperties(s,supRiskPersonal);
supRiskPersonal.setCreateTime(LocalDateTime.now());
supRiskPersonal.setTaskPersonId(personalSup.getId());
supRiskPersonal.setIdCode(supRiskPersonal.getIdCode().trim());
supRiskPersonal.setTaskId(task.getId());
//age
if(StrUtil.isNotBlank(supRiskPersonal.getIdCode())){
int age = CommonUtil.getAgeFromIdCard(supRiskPersonal.getIdCode());
if (age > 0){
supRiskPersonal.setAge(age);
}
}
supRiskPersonalService.saveOrUpdate(supRiskPersonal);
});
return true;
}
@ -215,7 +233,25 @@ public class TaskManagementService {
if (CollectionUtil.isNotEmpty(taskTestingAlcoholPeople)){
taskManagementDto.setUserList(taskTestingAlcoholPeople);
}
case "risk_personal":
taskManagementDto.setSpecialType("重点人员管控");
taskManagementDto.setSupervisionType("专项督察");
List<SupRiskPersonal> personal = supRiskPersonalService.list(new LambdaQueryWrapper<SupRiskPersonal>().eq(SupRiskPersonal::getTaskId,id));
List<SupRiskDto> supRiskDtoList = new ArrayList<>();
if(CollectionUtil.isNotEmpty(personal)){
personal.forEach(s->{
SupRiskDto supRiskDto = new SupRiskDto();
BeanUtils.copyProperties(s,supRiskDto);
if(s.getTaskPersonId() != null){
SupTaskPerson person = taskPersonService.getById(s.getTaskPersonId());
supRiskDto.setControlEmpNo(person.getEmpNo());
supRiskDto.setControlName(person.getName());
}
supRiskDtoList.add(supRiskDto);
});
}
taskManagementDto.setSupRiskDtoList(supRiskDtoList);
break;
}
return taskManagementDto;
@ -244,6 +280,10 @@ public class TaskManagementService {
taskPersonService.remove(new LambdaQueryWrapper<SupTaskPerson>().eq(SupTaskPerson::getTaskId,id));
testingAlcoholPeopleService.remove(new LambdaQueryWrapper<SupTaskTestingAlcoholPeople>().eq(SupTaskTestingAlcoholPeople::getTaskId,id));
break;
case "risk_personal":
supRiskPersonalService.remove(new LambdaQueryWrapper<SupRiskPersonal>().eq(SupRiskPersonal::getTaskId,id));
taskPersonService.remove(new LambdaQueryWrapper<SupTaskPerson>().eq(SupTaskPerson::getTaskId,id));
break;
}
return true;
}

53
src/main/java/com/biutag/supervision/util/CommonUtil.java

@ -2,9 +2,13 @@ package com.biutag.supervision.util;
import org.springframework.beans.BeanUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
@ -48,4 +52,53 @@ public class CommonUtil {
int years = period.getYears();
return years;
}
/**
* 根据身份证号码获取年龄
*
* @param idCardNo 身份证号码
* @return 年龄如果身份证号码不合法则返回-1
*/
public static int getAgeFromIdCard(String idCardNo) {
// 检查身份证号码的长度
if (idCardNo == null || idCardNo.length() != 18) {
throw new IllegalArgumentException("身份证号码必须是18位");
}
// 提取出生日期部分
String birthDateStr = idCardNo.substring(6, 14);
// 定义日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Date birthDate = null;
try {
// 将字符串转换为Date对象
birthDate = sdf.parse(birthDateStr);
} catch (ParseException e) {
throw new RuntimeException("日期格式不正确");
}
// 获取当前日期
Date currentDate = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(currentDate);
int currentYear = calendar.get(Calendar.YEAR);
int currentMonth = calendar.get(Calendar.MONTH) + 1; // 月份从0开始,需要加1
int currentDay = calendar.get(Calendar.DAY_OF_MONTH);
// 获取出生日期的年、月、日
calendar.setTime(birthDate);
int birthYear = calendar.get(Calendar.YEAR);
int birthMonth = calendar.get(Calendar.MONTH) + 1; // 月份从0开始,需要加1
int birthDay = calendar.get(Calendar.DAY_OF_MONTH);
// 计算年龄
int age = currentYear - birthYear;
if (currentMonth < birthMonth || (currentMonth == birthMonth && currentDay < birthDay)) {
age--;
}
return age;
}
}

30
src/main/resources/mapper/SupRiskPersonalMapper.xml

@ -0,0 +1,30 @@
<?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.SupRiskPersonalMapper">
<select id="queryPage" resultType="com.biutag.supervision.pojo.vo.SupRiskPersonalVo">
SELECT
srp.id_code,
srp.name,
srp.gender,
srp.age,
srp.mobile,
srp.personal_type,
srp.control_level,
srp.responsible_depart_id,
srp.responsible_depart_name,
srp.responsible_emp_no,
srp.responsible_name,
srp.control_time_interval,
srp.create_time,
srp.task_person_id,
srp.task_id,
stp.name as controlName,
stp.emp_no as controlEmpNo
FROM sup_risk_personal as srp
LEFT JOIN sup_task_person as stp on srp.task_person_id = stp.id
${ew.getCustomSqlSegment}
</select>
</mapper>

13
src/main/resources/mapper/SupRiskPersonalSupRecordMapper.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.SupRiskPersonalSupRecordMapper">
<select id="queryPage" resultType="com.biutag.supervision.pojo.vo.SupRiskPersonalSupRecordVo">
SELECT
*
from sup_risk_personal_sup_record as t
${ew.getCustomSqlSegment}
</select>
</mapper>
Loading…
Cancel
Save