修改了提交任务信息的接口
This commit is contained in:
parent
4b5be296a8
commit
6685e334ec
@ -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;
|
||||
|
||||
|
@ -214,8 +214,9 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"任务提交失败",locale);
|
||||
}
|
||||
List<FireTaskPhoto> fireTaskPhotos = PhotoUtil.uploadImage(files, appTaskBodyVo.getFireCode());
|
||||
List<FireTaskPhoto> fireTaskPhotos1 = jdbcUtils.batchWithJdbcTemplate(fireTaskPhotos);
|
||||
if(fireTaskPhotos1.size() == 0 || fireTaskPhotos1 == null){
|
||||
List<FireTaskPhoto> fireTaskPhotos1 = fireTaskPhotoDao.saveAll(fireTaskPhotos);
|
||||
//List<FireTaskPhoto> fireTaskPhotos1 = jdbcUtils.batchWithJdbcTemplate(fireTaskPhotos);
|
||||
if(fireTaskPhotos1 == null || fireTaskPhotos1.size() == 0){
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"图片上传失败,任务提交失败",locale);
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"任务提交成功",locale);
|
||||
|
@ -64,7 +64,8 @@ public class PhotoUtil {
|
||||
* @throws IOException
|
||||
*/
|
||||
public static List<FireTaskPhoto> 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<FireTaskPhoto> 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));
|
||||
|
Loading…
Reference in New Issue
Block a user