diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index 2ca1eec..e4d6ebc 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -149,4 +149,14 @@ public class FirePointController { } return firePointService.insertAppTask(files,appTaskBodyVo); } + + /** + * 查询核查的任务信息 + * @param fireCode + * @return + */ + @GetMapping("/selectAppTask") + public String selectAppTask(@RequestParam("fireCode") String fireCode) throws Exception { + return firePointService.selectAppTask(fireCode); + } } diff --git a/src/main/java/com/xkrs/service/FirePointService.java b/src/main/java/com/xkrs/service/FirePointService.java index b16308e..79c7289 100644 --- a/src/main/java/com/xkrs/service/FirePointService.java +++ b/src/main/java/com/xkrs/service/FirePointService.java @@ -56,4 +56,13 @@ public interface FirePointService { * @throws IOException */ String insertAppTask(MultipartFile[] files, AppTaskBodyVo appTaskBodyVo) throws IOException; + + /** + * 根据火点编码查询任务信息 + * @param fireCode + * @param + * @return + * @throws Exception + */ + String selectAppTask(String fireCode) throws Exception; } diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 41826f0..611f5a0 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -5,11 +5,13 @@ import com.xkrs.common.tool.TokenUtil; import com.xkrs.dao.*; import com.xkrs.model.entity.*; import com.xkrs.model.qo.FirePointQo; +import com.xkrs.model.vo.AppPhotoVo; import com.xkrs.model.vo.AppTaskBodyVo; import com.xkrs.service.FirePointService; import com.xkrs.utils.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.cglib.beans.BeanCopier; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -53,6 +55,9 @@ public class FirePointServiceImpl implements FirePointService { @Resource private JdbcUtils jdbcUtils; + @Resource + private FireTaskPhotoDao fireTaskPhotoDao; + /** * 添加火点信息 * @param firePointQo @@ -190,6 +195,32 @@ public class FirePointServiceImpl implements FirePointService { if(fireTaskPhotos1.size() == 0 || fireTaskPhotos1 == null){ return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"图片上传失败,任务提交失败",locale); } - return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"任务提交成功",locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"任务提交成功",locale); + } + + /** + * 根据火点编码查询任务信息 + * @param fireCode + * @return + * @throws Exception + */ + @Override + public String selectAppTask(String fireCode) throws Exception { + // 获取区域信息 + Locale locale = LocaleContextHolder.getLocale(); + FireTask byTaskFireCode = fireTaskDao.findByTaskFireCode(fireCode); + if(byTaskFireCode == null){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有该火点的任务信息",locale); + } + AppTaskBodyVo appTaskBodyVo = new AppTaskBodyVo(); + // 做映射,返回vo类对象 + BeanCopier beanCopier = BeanCopier.create(FireTask.class, AppTaskBodyVo.class, false); + beanCopier.copy(byTaskFireCode,appTaskBodyVo,null); + + List photoPath = fireTaskPhotoDao.findPhotoPath(fireCode); + List appPhotoVos = ObjectToBeanUtils.objectToBean(photoPath, AppPhotoVo.class); + appTaskBodyVo.setTaskFirePhoto(appPhotoVos); + + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,appTaskBodyVo,locale); } }