Browse Source

fix: 修复重点人员督察记录不能正常保存文件的问题

fix: 修复问题办理流程,多次退回导致多个二级机构参与办理,所队再退回报错的问题
master
wxc 4 months ago
parent
commit
66e82fe470
  1. 5
      src/main/java/com/biutag/supervision/controller/mobileSupervision/SupRiskPersonController.java
  2. 4
      src/main/java/com/biutag/supervision/flow/action/ThreeSignReturnAction.java
  3. 2
      src/main/java/com/biutag/supervision/job/RiskJob.java
  4. 45
      src/main/java/com/biutag/supervision/service/SupRiskPersonalService.java
  5. 50
      src/main/java/com/biutag/supervision/service/SupRiskPersonalSupRecordAsyncService.java
  6. 53
      src/main/java/com/biutag/supervision/service/SupRiskPersonalSupRecordService.java

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

@ -8,6 +8,7 @@ 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 com.biutag.supervision.service.SupRiskPersonalSupRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@ -19,6 +20,8 @@ public class SupRiskPersonController {
private final SupRiskPersonalService supRiskPersonalService;
private final SupRiskPersonalSupRecordService riskPersonalSupRecordService;
@GetMapping
Result<Page<SupRiskPersonalVo>> queryPage(SupRiskPersonalQueryParam queryParam){
return Result.success(supRiskPersonalService.page(queryParam));
@ -32,7 +35,7 @@ public class SupRiskPersonController {
//保存督察记录
@PostMapping("/saveSupRecord")
Result saveSupRecord(@RequestBody SupRiskPersonalSupRecordDto supRecordDto){
if( supRiskPersonalService.saveSupRecord(supRecordDto)){
if( riskPersonalSupRecordService.saveSupRecord(supRecordDto)){
return Result.success();
}else{
return Result.failed("操作失败");

4
src/main/java/com/biutag/supervision/flow/action/ThreeSignReturnAction.java

@ -100,15 +100,17 @@ public class ThreeSignReturnAction implements Action {
public void addWork(String negativeId, boolean secondFlag) {
String roleCode = secondFlag ? RoleCodeEnum.SECOND_ADMIN.getCode() : RoleCodeEnum.FIRST_ADMIN.getCode();
Negative negative = negativeService.getById(negativeId);
NegativeWork work = workService.getOne(new LambdaQueryWrapper<NegativeWork>()
.eq(NegativeWork::getNegativeId, negativeId)
.eq(NegativeWork::getDepartId, negative.getHandleSecondDepartId())
.eq(NegativeWork::getRoleCode, roleCode));
if (Objects.nonNull(work)) {
work.setUpdateTime(LocalDateTime.now())
.setStatus(WorkStatusEnum.todo.name());
workService.updateById(work);
} else {
Negative negative = negativeService.getById(negativeId);
work = new NegativeWork()
.setNegativeId(negativeId)
.setRoleCode(roleCode)

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

@ -69,7 +69,7 @@ public class RiskJob {
if (!riskPersonalSupRecordService.exists(new LambdaQueryWrapper<SupRiskPersonalSupRecord>()
.eq(SupRiskPersonalSupRecord::getTaskId, riskPersonal.getTaskId())
.eq(SupRiskPersonalSupRecord::getIdCode, riskPersonal.getIdCode())
.between(SupRiskPersonalSupRecord::getSupTime, now.minusMinutes(remainder), now))) {
.between(SupRiskPersonalSupRecord::getSupTime, now.minusMinutes(remainder), LocalDateTime.now()))) {
// 状态更新为未督察
riskPersonalService.update(new LambdaUpdateWrapper<SupRiskPersonal>().eq(SupRiskPersonal::getIdCode, riskPersonal.getIdCode())
.set(SupRiskPersonal::getWorkStatus, WorkStatusEnum.todo.name()));

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

@ -2,42 +2,26 @@ package com.biutag.supervision.service;
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.dto.SupRiskPersonalSupRecordDto;
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.pojo.model.UserAuth;
import com.biutag.supervision.pojo.param.SupRiskPersonalQueryParam;
import com.biutag.supervision.pojo.param.SupRiskPersonalSupRecordQueryParam;
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;
@RequiredArgsConstructor
@Service
public class SupRiskPersonalService extends ServiceImpl<SupRiskPersonalMapper, SupRiskPersonal> {
private final SupRiskPersonalSupRecordService supRecordService;
private final SupRiskPersonalSupRecordMapper supRiskPersonalSupRecordMapper;
private final SupTaskService taskService;
/**
* 分页查询
* */
@ -57,35 +41,6 @@ public class SupRiskPersonalService extends ServiceImpl<SupRiskPersonalMapper, S
return baseMapper.getPersonal(taskId, idCode);
}
/**
* 录入督察记录数据
* */
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()));
boolean b = supRecordService.saveOrUpdate(supRecord);
if (b) {
update(new LambdaUpdateWrapper<SupRiskPersonal>().eq(SupRiskPersonal::getIdCode, supRecordDto.getIdCode())
.set(SupRiskPersonal::getWorkStatus, WorkStatusEnum.done.name())
.set(SupRiskPersonal::getSupStatus, supRecordDto.getSupStatus()));
if (!exists(new LambdaUpdateWrapper<SupRiskPersonal>()
.eq(SupRiskPersonal::getTaskId, supRecordDto.getTaskId())
.eq(SupRiskPersonal::getWorkStatus, WorkStatusEnum.todo.name()))) {
taskService.update(new LambdaUpdateWrapper<SupTask>().eq(SupTask::getId, supRecordDto.getTaskId())
.set(SupTask::getTaskStatus, WorkStatusEnum.done.name()));
}
}
return b;
}
/**
* 督察记录列表

50
src/main/java/com/biutag/supervision/service/SupRiskPersonalSupRecordAsyncService.java

@ -0,0 +1,50 @@
package com.biutag.supervision.service;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.supervision.mapper.SupRiskPersonalSupRecordMapper;
import com.biutag.supervision.pojo.entity.SupRiskPersonalSupRecord;
import com.biutag.supervision.pojo.vo.FileVo;
import com.biutag.supervision.util.JSON;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.util.Base64;
import java.util.List;
@RequiredArgsConstructor
@Service
public class SupRiskPersonalSupRecordAsyncService {
private final FileService fileService;
private final SupRiskPersonalSupRecordMapper baseMapper;
@Async
public void uploadFile(List<FileVo> files, Integer id) {
if (!files.isEmpty()) {
for (FileVo file : files) {
if (StrUtil.isNotBlank(file.getFilePath())) {
continue;
}
String base64 = file.getBase64();
if (base64.contains(",")) {
base64 = base64.substring(base64.indexOf(",") + 1);
}
byte[] decodedBytes = Base64.getDecoder().decode(base64);
ByteArrayInputStream is = new ByteArrayInputStream(decodedBytes);
String filePath = fileService.upload(is, is.available(), FileUtil.extName(file.getFileName()));
file.setFilePath(filePath);
file.setBase64(null);
}
LambdaUpdateWrapper<SupRiskPersonalSupRecord> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(SupRiskPersonalSupRecord::getId, id)
.set(SupRiskPersonalSupRecord::getFiles, JSON.toJSONString(files));
baseMapper.update(updateWrapper);
}
}
}

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

@ -1,12 +1,61 @@
package com.biutag.supervision.service;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.mapper.SupRiskPersonalSupMapper;
import com.biutag.supervision.common.UserContextHolder;
import com.biutag.supervision.constants.AppConstants;
import com.biutag.supervision.constants.enums.WorkStatusEnum;
import com.biutag.supervision.mapper.SupRiskPersonalSupRecordMapper;
import com.biutag.supervision.pojo.entity.SupRiskPersonalSup;
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.entity.SupTask;
import com.biutag.supervision.pojo.model.UserAuth;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
@RequiredArgsConstructor
@Service
public class SupRiskPersonalSupRecordService extends ServiceImpl<SupRiskPersonalSupRecordMapper, SupRiskPersonalSupRecord> {
private final SupTaskService taskService;
private final SupRiskPersonalService riskPersonalService;
private final SupRiskPersonalSupRecordAsyncService riskPersonalSupRecordAsyncService;
/**
* 录入督察记录数据
* */
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()));
boolean b = saveOrUpdate(supRecord);
if (b) {
riskPersonalService.update(new LambdaUpdateWrapper<SupRiskPersonal>().eq(SupRiskPersonal::getIdCode, supRecordDto.getIdCode())
.set(SupRiskPersonal::getWorkStatus, WorkStatusEnum.done.name())
.set(SupRiskPersonal::getSupStatus, supRecordDto.getSupStatus()));
if (!riskPersonalService.exists(new LambdaUpdateWrapper<SupRiskPersonal>()
.eq(SupRiskPersonal::getTaskId, supRecordDto.getTaskId())
.eq(SupRiskPersonal::getWorkStatus, WorkStatusEnum.todo.name()))) {
taskService.update(new LambdaUpdateWrapper<SupTask>().eq(SupTask::getId, supRecordDto.getTaskId())
.set(SupTask::getTaskStatus, WorkStatusEnum.done.name()));
}
riskPersonalSupRecordAsyncService.uploadFile(supRecordDto.getFiles(), supRecord.getId());
}
return b;
}
}

Loading…
Cancel
Save