Browse Source

fit: 完善督察问题

master
wxc 5 months ago
parent
commit
296707aa35
  1. 7
      src/main/java/com/biutag/supervision/controller/mobileSupervision/PhotoController.java
  2. 6
      src/main/java/com/biutag/supervision/controller/mobileSupervision/TaskProblemController.java
  3. 3
      src/main/java/com/biutag/supervision/controller/mobileSupervision/TestingAlcoholController.java
  4. 3
      src/main/java/com/biutag/supervision/pojo/dto/SupRiskPersonalSupRecordDto.java
  5. 14
      src/main/java/com/biutag/supervision/service/SupTaskProblemService.java

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

@ -66,6 +66,7 @@ public class PhotoController {
String filePath = fileService.upload(is, is.available(), StrUtil.isNotBlank(extName)? extName : "png");
SupPhoto photo = new SupPhoto();
photo.setFilePath(filePath);
photo.setFileName(file.getOriginalFilename());
photo.setCreateTime(LocalDateTime.now());
photo.setDate(LocalDate.now().toString());
UserAuth user = UserContextHolder.getCurrentUser();
@ -76,4 +77,10 @@ public class PhotoController {
return Result.success(photo);
}
@DeleteMapping("{id}")
public Result<Void> del(@PathVariable Integer id) {
photoService.removeById(id);
return Result.success();
}
}

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

@ -2,6 +2,8 @@ package com.biutag.supervision.controller.mobileSupervision;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.TaskProblemDto;
@ -27,7 +29,9 @@ public class TaskProblemController {
@GetMapping
public Result<Page<SupTaskProblem>> page(TaskProblemQueryParam queryParam) {
Page<SupTaskProblem> page = taskProblemService.page(Page.of(queryParam.getCurrent(), queryParam.getSize()));
LambdaQueryWrapper<SupTaskProblem> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByDesc(SupTaskProblem::getCreateTime);
Page<SupTaskProblem> page = taskProblemService.page(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper);
page.getRecords().forEach(item -> {
if (StrUtil.isNotBlank(item.getPeoples())) {
item.setPeoples(JSON.parseArray(item.getPeoples(), SupTaskPerson.class).stream().map(SupTaskPerson::getName).collect(Collectors.joining("、")));

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

@ -68,9 +68,6 @@ public class TestingAlcoholController {
return Result.success(taskTestingAlcoholService.getDetailFun(taskId));
}
@GetMapping("getPersonNumber")
public Result<List<SupTaskTestingAlcoholPeople>> getPersonNumber(TestingAlcoholFilter condition) {
List<String> departIds = departService.getAllNodeIds(condition.getDepartId());

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

@ -33,10 +33,9 @@ public class SupRiskPersonalSupRecordDto {
private String supDesc;
//督察时间
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime supTime;
// 检测照片
private List<FileVo> files = new ArrayList<>();

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

@ -1,6 +1,7 @@
package com.biutag.supervision.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.constants.enums.DistributionStateEnum;
@ -8,9 +9,11 @@ import com.biutag.supervision.constants.enums.TaskStatusEnum;
import com.biutag.supervision.constants.enums.TaskTypeEnum;
import com.biutag.supervision.mapper.SupTaskProblemMapper;
import com.biutag.supervision.pojo.dto.TaskProblemDto;
import com.biutag.supervision.pojo.entity.SupPhoto;
import com.biutag.supervision.pojo.entity.SupTask;
import com.biutag.supervision.pojo.entity.SupTaskProblem;
import com.biutag.supervision.pojo.entity.SupTaskSelfexaminationContent;
import com.biutag.supervision.pojo.vo.FileVo;
import com.biutag.supervision.util.JSON;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -29,6 +32,8 @@ public class SupTaskProblemService extends ServiceImpl<SupTaskProblemMapper, Sup
private final SupDepartService departService;
private final SupPhotoService photoService;
@Transactional(rollbackFor = Exception.class)
public boolean save(TaskProblemDto dto) {
SupTaskProblem problem = new SupTaskProblem();
@ -61,7 +66,14 @@ public class SupTaskProblemService extends ServiceImpl<SupTaskProblemMapper, Sup
// 问题随拍
problem.setTaskType(TaskTypeEnum.problem_shooting.name());
}
// 更新照片
if (CollectionUtil.isNotEmpty(dto.getFiles())) {
for (FileVo file : dto.getFiles()) {
if (StrUtil.isNotBlank(file.getId())) {
photoService.update(new LambdaUpdateWrapper<SupPhoto>().eq(SupPhoto::getId, file.getId()).set(SupPhoto::getIsUse, true));
}
}
}
return save(problem);
}

Loading…
Cancel
Save