Browse Source

fix: 移动督察APP BUG修复

master
wxc 7 months ago
parent
commit
0ef5b3af2c
  1. 11
      src/main/java/com/biutag/supervision/controller/FileController.java
  2. 8
      src/main/java/com/biutag/supervision/controller/mobileSupervision/PhotoController.java
  3. 2
      src/main/java/com/biutag/supervision/controller/mobileSupervision/SelfexaminationController.java
  4. 3
      src/main/java/com/biutag/supervision/controller/mobileSupervision/TaskProblemController.java
  5. 2
      src/main/java/com/biutag/supervision/job/RiskJob.java
  6. 2
      src/main/java/com/biutag/supervision/pojo/dto/TaskProblemDto.java
  7. 2
      src/main/java/com/biutag/supervision/pojo/entity/SupTaskProblem.java
  8. 2
      src/main/java/com/biutag/supervision/pojo/param/TaskProblemQueryParam.java
  9. 4
      src/main/java/com/biutag/supervision/service/SupTaskProblemService.java
  10. 4
      src/main/java/com/biutag/supervision/service/SupTaskService.java
  11. 2
      src/main/java/com/biutag/supervision/service/SupTaskTestingAlcoholPeopleAsyncService.java
  12. 2
      src/main/java/com/biutag/supervision/service/TaskManagementService.java
  13. 2
      src/main/resources/mapper/SupTaskMapper.xml

11
src/main/java/com/biutag/supervision/controller/FileController.java

@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;
import java.util.Objects;
import java.util.Optional;
@Slf4j
@ -76,7 +77,15 @@ public class FileController {
return Result.success(null);
}
FileBase64 fileBase64 = fileBase64Mapper.selectById(filepath);
return Result.success(Optional.ofNullable(fileBase64).map(FileBase64::getBase64).orElse(null));
if (Objects.nonNull(fileBase64)) {
return Result.success(fileBase64.getBase64());
}
InputStream is = fileService.download(filepath);
String base64 = Base64.getEncoder().encodeToString(is.readAllBytes());
if (ImgUtils.isImg(filepath)) {
base64 = String.format("data:image/%s;base64,", FileUtil.extName(filepath).toLowerCase()) + base64;
}
return Result.success(base64);
}
}

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

@ -60,13 +60,7 @@ public class PhotoController {
public Result<SupPhoto> add(@RequestBody FileBase64Dto file) {
log.info("文件BASE64上传 upload------------------------------");
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 extName = FileUtil.extName(file.getOriginalFilename());
String filePath = fileService.upload(is, is.available(), StrUtil.isNotBlank(extName)? extName : "png");
String filePath = fileService.uploadBase64(base64, file.getOriginalFilename());
SupPhoto photo = new SupPhoto();
photo.setFilePath(filePath);
photo.setFileName(file.getOriginalFilename());

2
src/main/java/com/biutag/supervision/controller/mobileSupervision/SelfexaminationController.java

@ -44,8 +44,6 @@ public class SelfexaminationController {
return Result.success(taskSelfexaminationService.get(taskId));
}
@PostMapping
public Result<Boolean> add(@RequestBody TaskSelfexaminationDto dto) {
return Result.success(taskSelfexaminationService.save(dto));

3
src/main/java/com/biutag/supervision/controller/mobileSupervision/TaskProblemController.java

@ -35,7 +35,8 @@ public class TaskProblemController {
public Result<Page<SupTaskProblem>> page(TaskProblemQueryParam queryParam) {
LambdaQueryWrapper<SupTaskProblem> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StrUtil.isNotBlank(queryParam.getTaskType()), SupTaskProblem::getTaskType, queryParam.getTaskType())
.eq(Objects.nonNull(queryParam.getTaskId()), SupTaskProblem::getTaskType, queryParam.getTaskType());
.eq(Objects.nonNull(queryParam.getTaskId()), SupTaskProblem::getTaskId, queryParam.getTaskId())
.eq(StrUtil.isNotBlank(queryParam.getContentId()), SupTaskProblem::getContentId, queryParam.getContentId());
UserAuth user = UserContextHolder.getCurrentUser();
if (TaskTypeEnum.problem_shooting.name().equals(queryParam.getTaskType()) && !AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) ) {
queryWrapper.eq(SupTaskProblem::getCreateUsername, user.getUserName());

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().plusHours(1)))) {
// 状态更新为未督察
riskPersonalService.update(new LambdaUpdateWrapper<SupRiskPersonal>().eq(SupRiskPersonal::getIdCode, riskPersonal.getIdCode())
.set(SupRiskPersonal::getWorkStatus, WorkStatusEnum.todo.name()));

2
src/main/java/com/biutag/supervision/pojo/dto/TaskProblemDto.java

@ -35,7 +35,7 @@ public class TaskProblemDto {
// 附件
private List<FileVo> files;
private Integer contentId;
private String contentId;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime supTime;

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

@ -65,4 +65,6 @@ public class SupTaskProblem {
private String taskType;
private String contentId;
}

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

@ -14,4 +14,6 @@ public class TaskProblemQueryParam extends BasePage {
private String taskType;
private Integer taskId;
private String contentId;
}

4
src/main/java/com/biutag/supervision/service/SupTaskProblemService.java

@ -48,9 +48,9 @@ public class SupTaskProblemService extends ServiceImpl<SupTaskProblemMapper, Sup
problem.setHasProblem(dto.getHasProblem());
problem.setDepartId(dto.getDepartId());
problem.setDepartName(departService.getById(dto.getDepartId()).getShortName());
problem.setThingDesc(dto.getThingDesc());
problem.setContentId(dto.getContentId());
if (dto.getHasProblem()) {
problem.setThingDesc(dto.getThingDesc());
problem.setProblemTypeCode(dto.getProblemTypeCode());
problem.setProblemType(problemTypeService.getFullName(dto.getProblemTypeCode()));
if (CollectionUtil.isNotEmpty(dto.getPeoples())) {

4
src/main/java/com/biutag/supervision/service/SupTaskService.java

@ -43,7 +43,7 @@ public class SupTaskService extends ServiceImpl<SupTaskMapper, SupTask> {
.and(q -> {
q.eq("p.id_code", user.getUserName());
if (StrUtil.isNotBlank(user.getPosition())) {
q.or().eq("t.sup_depart_id", user.getDepartId()).eq("t.task_type", TaskTypeEnum.selfexamination.name());
q.or().eq("d.depart_id", user.getDepartId()).eq("t.task_type", TaskTypeEnum.selfexamination.name());
}
});
queryWrapper.eq("t.task_status", queryParam.getTaskStatus())
@ -79,7 +79,7 @@ public class SupTaskService extends ServiceImpl<SupTaskMapper, SupTask> {
.and(q -> {
q.eq("p.id_code", user.getUserName());
if (StrUtil.isNotBlank(user.getPosition())) {
q.or().eq("t.sup_depart_id", user.getDepartId()).eq("t.task_type", TaskTypeEnum.selfexamination.name());
q.or().eq("d.depart_id", user.getDepartId()).eq("t.task_type", TaskTypeEnum.selfexamination.name());
}
});
TaskCountVo taskCountVo = baseMapper.queryTaskCount(queryWrapper);

2
src/main/java/com/biutag/supervision/service/SupTaskTestingAlcoholPeopleAsyncService.java

@ -55,7 +55,7 @@ public class SupTaskTestingAlcoholPeopleAsyncService {
long detected = peopleList.stream().filter(item -> "已检测".equals(item.getTestingResult())).count();
long problemCount = taskProblemService.count(new LambdaQueryWrapper<SupTaskProblem>().eq(SupTaskProblem::getTaskId, dto.getTaskId()));
String summary = String.format("应检%s人、已检%s人,未检%s人,发现%s哥问题。", peopleList.size(), detected, peopleList.size() - detected, problemCount);
String summary = String.format("应检%s人,已检%s人,未检%s人,发现%s个问题。", peopleList.size(), detected, peopleList.size() - detected, problemCount);
taskTestingAlcoholMapper.update(new LambdaUpdateWrapper<SupTaskTestingAlcohol>().eq(SupTaskTestingAlcohol::getTaskId, dto.getTaskId())
.set(SupTaskTestingAlcohol::getSummary, summary));
}

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

@ -152,7 +152,7 @@ public class TaskManagementService {
BeanUtils.copyProperties(dto, testingAlcohol);
testingAlcohol.setTaskId(task.getId());
testingAlcohol.setDataGenerationMethod(dto.getSamplingTarget());
testingAlcohol.setSummary(String.format("应检%s人已检0人,未检0人,发现0个问题。", dto.getPersons().size()));
testingAlcohol.setSummary(String.format("应检%s人已检0人,未检0人,发现0个问题。", dto.getPoliceVos().size()));
testingAlcoholService.save(testingAlcohol);
//处理关联关系
List<SupTaskTestingAlcoholSampling> samplings = new ArrayList<>();

2
src/main/resources/mapper/SupTaskMapper.xml

@ -25,6 +25,7 @@
left join sup_task_inspection i on t.id = i.task_id
left join sup_task_testing_alcohol a on t.id = a.task_id
left join sup_task_selfexamination s on t.id = s.task_id
left join sup_task_selfexamination_depart d on t.id = d.task_id
${ew.getCustomSqlSegment}
</select>
@ -67,6 +68,7 @@
left join sup_task_inspection i on t.id = i.task_id
left join sup_task_testing_alcohol a on t.id = a.task_id
left join sup_task_selfexamination s on t.id = s.task_id
left join sup_task_selfexamination_depart d on t.id = d.task_id
${ew.getCustomSqlSegment}) t
</select>

Loading…
Cancel
Save