|
|
|
@ -1,5 +1,6 @@
|
|
|
|
package cn.iocoder.yudao.module.system.controller.admin.dustpatrolrecord;
|
|
|
|
package cn.iocoder.yudao.module.system.controller.admin.dustpatrolrecord;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import jakarta.annotation.Resource;
|
|
|
|
import jakarta.annotation.Resource;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
@ -37,7 +38,8 @@ public class DustPatrolRecordController {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private DustPatrolRecordService dustPatrolRecordService;
|
|
|
|
private DustPatrolRecordService dustPatrolRecordService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private FileApi fileApi;
|
|
|
|
@PostMapping("/create")
|
|
|
|
@PostMapping("/create")
|
|
|
|
@Operation(summary = "创建巡查记录")
|
|
|
|
@Operation(summary = "创建巡查记录")
|
|
|
|
@PreAuthorize("@ss.hasPermission('system:dust-patrol-record:create')")
|
|
|
|
@PreAuthorize("@ss.hasPermission('system:dust-patrol-record:create')")
|
|
|
|
@ -77,7 +79,18 @@ public class DustPatrolRecordController {
|
|
|
|
@PreAuthorize("@ss.hasPermission('system:dust-patrol-record:query')")
|
|
|
|
@PreAuthorize("@ss.hasPermission('system:dust-patrol-record:query')")
|
|
|
|
public CommonResult<DustPatrolRecordRespVO> getDustPatrolRecord(@RequestParam("id") String id) {
|
|
|
|
public CommonResult<DustPatrolRecordRespVO> getDustPatrolRecord(@RequestParam("id") String id) {
|
|
|
|
DustPatrolRecordDO dustPatrolRecord = dustPatrolRecordService.getDustPatrolRecord(id);
|
|
|
|
DustPatrolRecordDO dustPatrolRecord = dustPatrolRecordService.getDustPatrolRecord(id);
|
|
|
|
return success(BeanUtils.toBean(dustPatrolRecord, DustPatrolRecordRespVO.class));
|
|
|
|
DustPatrolRecordRespVO respVO = BeanUtils.toBean(dustPatrolRecord, DustPatrolRecordRespVO.class);
|
|
|
|
|
|
|
|
String[] strings = dustPatrolRecord.getPatrolPicture().split(",");
|
|
|
|
|
|
|
|
List<String> arrayList = new ArrayList<>();
|
|
|
|
|
|
|
|
for (String imgId : strings) {
|
|
|
|
|
|
|
|
CommonResult<String> urlById = fileApi.getUrlById(imgId);
|
|
|
|
|
|
|
|
if (urlById.getData()!=null){
|
|
|
|
|
|
|
|
String url = urlById.getData();
|
|
|
|
|
|
|
|
arrayList.add(url);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
respVO.setPatrolPictures(arrayList);
|
|
|
|
|
|
|
|
return success(respVO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/page")
|
|
|
|
@GetMapping("/page")
|
|
|
|
@ -85,10 +98,28 @@ public class DustPatrolRecordController {
|
|
|
|
@PreAuthorize("@ss.hasPermission('system:dust-patrol-record:query')")
|
|
|
|
@PreAuthorize("@ss.hasPermission('system:dust-patrol-record:query')")
|
|
|
|
public CommonResult<PageResult<DustPatrolRecordRespVO>> getDustPatrolRecordPage(@Valid DustPatrolRecordPageReqVO pageReqVO) {
|
|
|
|
public CommonResult<PageResult<DustPatrolRecordRespVO>> getDustPatrolRecordPage(@Valid DustPatrolRecordPageReqVO pageReqVO) {
|
|
|
|
PageResult<DustPatrolRecordDO> pageResult = dustPatrolRecordService.getDustPatrolRecordPage(pageReqVO);
|
|
|
|
PageResult<DustPatrolRecordDO> pageResult = dustPatrolRecordService.getDustPatrolRecordPage(pageReqVO);
|
|
|
|
return success(BeanUtils.toBean(pageResult, DustPatrolRecordRespVO.class));
|
|
|
|
PageResult<DustPatrolRecordRespVO> voPageResult = BeanUtils.toBean(pageResult, DustPatrolRecordRespVO.class);
|
|
|
|
|
|
|
|
// 获取巡查图片
|
|
|
|
|
|
|
|
List<DustPatrolRecordRespVO> list = voPageResult.getList();
|
|
|
|
|
|
|
|
for (DustPatrolRecordRespVO vo : list) {
|
|
|
|
|
|
|
|
if (vo.getPatrolPicture() != null) {
|
|
|
|
|
|
|
|
List<String> strings = Arrays.stream(vo.getPatrolPicture().split(",")).toList();
|
|
|
|
|
|
|
|
List<String> urls = new ArrayList<>();
|
|
|
|
|
|
|
|
for (String id : strings) {
|
|
|
|
|
|
|
|
CommonResult<String> urlById = fileApi.getUrlById(id);
|
|
|
|
|
|
|
|
if (urlById.getData()!=null){
|
|
|
|
|
|
|
|
String url = urlById.getData();
|
|
|
|
|
|
|
|
urls.add(url);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
vo.setPatrolPictures(urls);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return success(voPageResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/export-excel")
|
|
|
|
@GetMapping("/export-excel")
|
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "导出巡查记录 Excel")
|
|
|
|
@Operation(summary = "导出巡查记录 Excel")
|
|
|
|
@PreAuthorize("@ss.hasPermission('system:dust-patrol-record:export')")
|
|
|
|
@PreAuthorize("@ss.hasPermission('system:dust-patrol-record:export')")
|
|
|
|
@ApiAccessLog(operateType = EXPORT)
|
|
|
|
@ApiAccessLog(operateType = EXPORT)
|
|
|
|
|