Browse Source

fix: 重点人员、随手拍调整

master
wxc 5 months ago
parent
commit
e63c40f23d
  1. 5
      src/main/java/com/biutag/supervision/controller/mobileSupervision/PhotoController.java
  2. 12
      src/main/java/com/biutag/supervision/controller/mobileSupervision/SupRiskPersonController.java
  3. 70
      src/main/java/com/biutag/supervision/job/RiskJob.java
  4. 27
      src/main/java/com/biutag/supervision/mapper/SupRiskPersonalMapper.java
  5. 6
      src/main/java/com/biutag/supervision/pojo/entity/SupRiskPersonal.java
  6. 2
      src/main/java/com/biutag/supervision/pojo/param/SupRiskPersonalQueryParam.java
  7. 3
      src/main/java/com/biutag/supervision/pojo/vo/SupRiskPersonalSupRecordVo.java
  8. 8
      src/main/java/com/biutag/supervision/pojo/vo/SupRiskPersonalVo.java
  9. 25
      src/main/java/com/biutag/supervision/service/SupRiskPersonalService.java
  10. 9
      src/main/resources/mapper/SupRiskPersonalMapper.xml

5
src/main/java/com/biutag/supervision/controller/mobileSupervision/PhotoController.java

@ -42,7 +42,8 @@ public class PhotoController {
@GetMapping
public Result<List<PhotoGroupVo>> list() {
UserAuth user = UserContextHolder.getCurrentUser();
List<SupPhoto> list = photoService.list(new LambdaQueryWrapper<SupPhoto>().eq(SupPhoto::getCreateUsername, user.getUserName()).orderByDesc(SupPhoto::getCreateTime));
List<SupPhoto> list = photoService.list(new LambdaQueryWrapper<SupPhoto>().eq(SupPhoto::getCreateUsername, user.getUserName())
.orderByAsc(SupPhoto::getIsUse).orderByDesc(SupPhoto::getCreateTime));
Map<String, List<SupPhoto>> collect = list.stream().collect(Collectors.groupingBy(SupPhoto::getDate));
List<PhotoGroupVo> result = collect.keySet().stream().sorted(Comparator.reverseOrder()).map(date -> {
PhotoGroupVo vo = new PhotoGroupVo();
@ -72,7 +73,7 @@ public class PhotoController {
UserAuth user = UserContextHolder.getCurrentUser();
photo.setCreateUsername(user.getUserName());
// 创建缩略图
photo.setThumbnailBase64(ImgUtils.createSquareThumbnailBase64(is, 100));
photo.setThumbnailBase64(ImgUtils.createSquareThumbnailBase64(fileService.download(filePath), 100));
photoService.save(photo);
return Result.success(photo);
}

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

@ -3,10 +3,6 @@ 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;
@ -15,8 +11,6 @@ import com.biutag.supervision.service.SupRiskPersonalService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RequestMapping("/task/supRisk")
@RestController
@ -30,6 +24,11 @@ public class SupRiskPersonController {
return Result.success(supRiskPersonalService.page(queryParam));
}
@GetMapping("personal")
Result<SupRiskPersonalVo> getPersonal(Integer taskId, String idCode){
return Result.success(supRiskPersonalService.getPersonal(taskId, idCode));
}
//保存督察记录
@PostMapping("/saveSupRecord")
Result saveSupRecord(@RequestBody SupRiskPersonalSupRecordDto supRecordDto){
@ -44,6 +43,7 @@ public class SupRiskPersonController {
Result<Page<SupRiskPersonalSupRecordVo>> recordPage(SupRiskPersonalSupRecordQueryParam queryParam){
return Result.success(supRiskPersonalService.recordPage(queryParam));
}
//删除督察记录
@DeleteMapping("/supRecord/{id}")
Result delRecordData(@PathVariable Integer id){

70
src/main/java/com/biutag/supervision/job/RiskJob.java

@ -0,0 +1,70 @@
package com.biutag.supervision.job;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.supervision.constants.enums.WorkStatusEnum;
import com.biutag.supervision.pojo.entity.SupRiskPersonal;
import com.biutag.supervision.pojo.entity.SupRiskPersonalSupRecord;
import com.biutag.supervision.pojo.entity.SupTask;
import com.biutag.supervision.service.SupRiskPersonalService;
import com.biutag.supervision.service.SupRiskPersonalSupRecordService;
import com.biutag.supervision.service.SupTaskService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author wxc
* @date 2025/7/9
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class RiskJob {
private final SupRiskPersonalService riskPersonalService;
private final SupRiskPersonalSupRecordService riskPersonalSupRecordService;
private final SupTaskService taskService;
// 每10分钟执行一次
@Scheduled(fixedRate = 600000)
public void updateHandleTimeout() {
LocalDateTime now = LocalDateTime.now();
List<SupRiskPersonal> list = riskPersonalService.list(new LambdaQueryWrapper<SupRiskPersonal>().eq(SupRiskPersonal::getWorkStatus, WorkStatusEnum.done.name()));
for (SupRiskPersonal riskPersonal : list) {
SupTask task = taskService.getById(riskPersonal.getTaskId());
Duration duration = Duration.between(now, task.getCreateTime());
// 4小时、1天、30天
long minutes = duration.toMinutes();
long util = 240;
if ("4小时".equals(riskPersonal.getControlTimeInterval())) {
util = 240;
}
if ("1天".equals(riskPersonal.getControlTimeInterval())) {
util = 1440;
}
if ("4小时".equals(riskPersonal.getControlTimeInterval())) {
util = 43200;
}
// 取余数
long remainder = minutes % util;
if (!riskPersonalSupRecordService.exists(new LambdaQueryWrapper<SupRiskPersonalSupRecord>()
.eq(SupRiskPersonalSupRecord::getTaskId, riskPersonal.getTaskId())
.eq(SupRiskPersonalSupRecord::getIdCode, riskPersonal.getIdCode())
.between(SupRiskPersonalSupRecord::getSupTime, now.minusMinutes(remainder), now))) {
// 状态更新为未督察
riskPersonalService.update(new LambdaUpdateWrapper<SupRiskPersonal>().eq(SupRiskPersonal::getIdCode, riskPersonal.getIdCode())
.set(SupRiskPersonal::getWorkStatus, WorkStatusEnum.todo.name()));
}
}
}
}

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

@ -10,9 +10,36 @@ 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;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface SupRiskPersonalMapper extends BaseMapper<SupRiskPersonal> {
Page<SupRiskPersonalVo> queryPage(@Param("page") Page<SupRiskPersonalQueryParam> page, @Param(Constants.WRAPPER) QueryWrapper<SupRiskPersonal> queryWrapper);
@Select("SELECT\n" +
" srp.id_code,\n" +
" srp.name,\n" +
" srp.gender,\n" +
" srp.age,\n" +
" p.mobile police_mobile,\n" +
" srp.personal_type,\n" +
" srp.control_level,\n" +
" srp.responsible_depart_id,\n" +
" srp.responsible_depart_name,\n" +
" srp.responsible_emp_no,\n" +
" srp.responsible_name,\n" +
" srp.control_time_interval,\n" +
" srp.create_time,\n" +
" srp.task_person_id,\n" +
" srp.task_id,\n" +
" stp.name as controlName,\n" +
" stp.emp_no as controlEmpNo,\n" +
" srp.sup_status, " +
" info.image_base64\n" +
" FROM sup_risk_personal as srp\n" +
" LEFT JOIN sup_task_person as stp on srp.task_person_id = stp.id\n" +
" LEFT JOIN risk_person_info as info on srp.id_code = info.id_code LEFT JOIN sup_police p on stp.emp_no = p.emp_no where srp.id_code = #{idCode} and srp.task_id = #{taskId}")
SupRiskPersonalVo getPersonal(Integer taskId, String idCode);
}

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

@ -69,4 +69,10 @@ public class SupRiskPersonal {
@TableField("task_id")
private Integer taskId;
// 督察状态
private String supStatus;
// 工作状态
private String workStatus;
}

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

@ -12,4 +12,6 @@ public class SupRiskPersonalQueryParam extends BasePage{
private String idCode;
//姓名
private String name;
private String workStatus;
}

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

@ -1,5 +1,6 @@
package com.biutag.supervision.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
@ -27,9 +28,11 @@ public class SupRiskPersonalSupRecordVo {
private List<FileVo> fileVoList;
//督察时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime supTime;
//创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime createTime;
private String createEmpNo;

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

@ -22,8 +22,8 @@ public class SupRiskPersonalVo {
// 年龄
private Integer age;
// 手机号
private String mobile;
// 民警手机号
private String policeMobile;
// 人员类别
private String personalType;
@ -56,4 +56,8 @@ public class SupRiskPersonalVo {
private String controlName;
//督察人员警号
private String controlEmpNo;
private String imageBase64;
private String supStatus;
}

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

@ -1,34 +1,30 @@
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.core.conditions.update.LambdaUpdateWrapper;
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.constants.enums.WorkStatusEnum;
import com.biutag.supervision.mapper.SupRiskPersonalMapper;
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.pojo.vo.FileVo;
import com.biutag.supervision.pojo.vo.SupRiskPersonalSupRecordVo;
import com.biutag.supervision.pojo.vo.SupRiskPersonalVo;
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
@ -45,6 +41,7 @@ public class SupRiskPersonalService extends ServiceImpl<SupRiskPersonalMapper, S
public Page<SupRiskPersonalVo> page(SupRiskPersonalQueryParam queryParam) {
QueryWrapper<SupRiskPersonal> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("srp.task_id", queryParam.getTaskId())
.eq("srp.work_status", queryParam.getWorkStatus())
.like(StrUtil.isNotEmpty(queryParam.getIdCode()),"srp.id_code",queryParam.getIdCode())
.like(StrUtil.isNotEmpty(queryParam.getName()),"srp.name",queryParam.getName())
.orderByAsc("srp.create_time");
@ -52,6 +49,10 @@ public class SupRiskPersonalService extends ServiceImpl<SupRiskPersonalMapper, S
return page;
}
public SupRiskPersonalVo getPersonal(Integer taskId, String idCode) {
return baseMapper.getPersonal(taskId, idCode);
}
/**
* 录入督察记录数据
* */
@ -66,7 +67,9 @@ public class SupRiskPersonalService extends ServiceImpl<SupRiskPersonalMapper, S
}
//补充file
supRecord.setFiles(JSON.toJSONString(supRecordDto.getFiles()));
update(new LambdaUpdateWrapper<SupRiskPersonal>().eq(SupRiskPersonal::getIdCode, supRecordDto.getIdCode())
.set(SupRiskPersonal::getWorkStatus, WorkStatusEnum.done.name())
.set(SupRiskPersonal::getSupStatus, supRecordDto.getSupStatus()));
return supRecordService.saveOrUpdate(supRecord);
}

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

@ -6,11 +6,12 @@
<select id="queryPage" resultType="com.biutag.supervision.pojo.vo.SupRiskPersonalVo">
SELECT
DISTINCT
srp.id_code,
srp.name,
srp.gender,
srp.age,
srp.mobile,
p.mobile police_mobile,
srp.personal_type,
srp.control_level,
srp.responsible_depart_id,
@ -22,9 +23,13 @@
srp.task_person_id,
srp.task_id,
stp.name as controlName,
stp.emp_no as controlEmpNo
stp.emp_no as controlEmpNo,
srp.sup_status,
info.image_base64
FROM sup_risk_personal as srp
LEFT JOIN sup_task_person as stp on srp.task_person_id = stp.id
LEFT JOIN risk_person_info as info on srp.id_code = info.id_code
LEFT JOIN sup_police p on stp.emp_no = p.emp_no
${ew.getCustomSqlSegment}
</select>
</mapper>

Loading…
Cancel
Save