diff --git a/src/main/java/com/xkrs/model/entity/FireTaskPhoto.java b/src/main/java/com/xkrs/model/entity/FireTaskPhoto.java index 3113346..d22cc6e 100644 --- a/src/main/java/com/xkrs/model/entity/FireTaskPhoto.java +++ b/src/main/java/com/xkrs/model/entity/FireTaskPhoto.java @@ -14,7 +14,7 @@ public class FireTaskPhoto implements Serializable { * id 主键 */ @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fire_task_photo_seq_gen") + @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "fire_task_photo_seq_gen") @SequenceGenerator(name = "fire_task_photo_seq_gen", sequenceName = "fire_task_photo_id_seq",allocationSize = 1) private Integer id; diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 0cd37b7..88c1756 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -214,8 +214,9 @@ public class FirePointServiceImpl implements FirePointService { return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"任务提交失败",locale); } List fireTaskPhotos = PhotoUtil.uploadImage(files, appTaskBodyVo.getFireCode()); - List fireTaskPhotos1 = jdbcUtils.batchWithJdbcTemplate(fireTaskPhotos); - if(fireTaskPhotos1.size() == 0 || fireTaskPhotos1 == null){ + List fireTaskPhotos1 = fireTaskPhotoDao.saveAll(fireTaskPhotos); + //List fireTaskPhotos1 = jdbcUtils.batchWithJdbcTemplate(fireTaskPhotos); + if(fireTaskPhotos1 == null || fireTaskPhotos1.size() == 0){ return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"图片上传失败,任务提交失败",locale); } return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"任务提交成功",locale); diff --git a/src/main/java/com/xkrs/utils/PhotoUtil.java b/src/main/java/com/xkrs/utils/PhotoUtil.java index 35dda85..86ff2f8 100644 --- a/src/main/java/com/xkrs/utils/PhotoUtil.java +++ b/src/main/java/com/xkrs/utils/PhotoUtil.java @@ -64,7 +64,8 @@ public class PhotoUtil { * @throws IOException */ public static List uploadImage(MultipartFile[] files, String fireCode) throws IOException { - String uploadPath = "http://139.199.98.175:2099/forestTaskImage/"; + //String uploadPath = "http://139.199.98.175:2099/forestTaskImage/"; + String uploadPath = "http://192.168.2.139/"; String newName = ""; String oldName = ""; List fireTaskPhotos = new ArrayList<>(); @@ -78,13 +79,13 @@ public class PhotoUtil { //uuid生成新的文件名 newName = UUID.randomUUID().toString() + suffix; //将图片保存到本地/usr/etc/images/Folder - File file1 = new File("/home/web/wf-fire-service/forestTaskImage/"); - //File file1 = new File("E:/wfTaskImage/"); + //File file1 = new File("/home/web/wf-fire-service/forestTaskImage/"); + File file1 = new File("E:/file/work/image/"); if (!file1.exists()) { file1.mkdirs(); } - String path = "/home/web/wf-fire-service/forestTaskImage/" + newName; - //String path = "E:/wfTaskImage/" + newName; + //String path = "/home/web/wf-fire-service/forestTaskImage/" + newName; + String path = "E:/file/work/image/" + newName; String uploadPaths = uploadPath + newName; //实现上传 file.transferTo(new File(path));