From 9138932f017f2055e1e4f52dc2c9313599aa3cdb Mon Sep 17 00:00:00 2001 From: "DESKTOP-4U0TDEF\\20371" <2037158277@qq.com> Date: Fri, 16 Jul 2021 11:12:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A0=B8=E6=9F=A5=E6=B3=95=E4=BA=BA=E4=BB=BB=E5=8A=A1=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/controller/FirePointController.java | 10 ++++++ .../com/xkrs/service/FirePointService.java | 9 +++++ .../service/impl/FirePointServiceImpl.java | 33 ++++++++++++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) 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); } }