| | |
| | | package com.dji.sample.territory.controller; |
| | | |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.media.model.MediaFileEntity; |
| | | import com.dji.sample.patches.model.entity.LotInfo; |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | |
| | | @Autowired |
| | | private ITbFJService tbFJService; |
| | | @Autowired |
| | | private GetPatchesService getPatches; |
| | | private GetPatchesService getPatchesService; |
| | | |
| | | /** |
| | | * 将地块所保留的照片、视频信息保存到sqlite |
| | | * |
| | | * @param dkbh |
| | | * @param workspaceId |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | @PostMapping("/insertDb") |
| | | public ResponseResult insertDb(String dkbh, String workspaceId) throws IOException { |
| | | List<MediaFileEntity> list = getPatches.listPohto(dkbh, workspaceId); |
| | | if(list.size()==0){ |
| | | return ResponseResult.error("未找到照片信息");} |
| | | LotInfo lotInfo = getPatches.getLotinfo(dkbh, workspaceId); |
| | | if(lotInfo==null){ |
| | | return ResponseResult.error("未找到图斑信息");} |
| | | TbFjEntity entity=tbFJService.insertData(list, lotInfo); |
| | | if (entity!=null){ |
| | | return ResponseResult.success("上传成功"); |
| | | public ResponseResult insertDb(String dkbh, String workspaceId) throws Exception { |
| | | List<MediaFileEntity> list = getPatchesService.listPohto(dkbh, workspaceId); |
| | | if (list.size() == 0) { |
| | | return ResponseResult.error("未找到该照片、视频信息"); |
| | | } |
| | | LotInfo lotInfo = getPatchesService.getLotinfo(dkbh, workspaceId); |
| | | if (lotInfo == null) { |
| | | return ResponseResult.error("未找到该图斑信息"); |
| | | } |
| | | int num = tbFJService.insertData(list, lotInfo); |
| | | if (num != 0) { |
| | | return ResponseResult.success("上传成功,上传了" + num + "个文件"); |
| | | } |
| | | return ResponseResult.error("上传失败"); |
| | | } |