|
@ -30,7 +30,7 @@ public class ResourceService {
|
30
|
30
|
@Autowrie
|
31
|
31
|
private ResourceDao resourceDao;
|
32
|
32
|
@Autowrie
|
33
|
|
private ImageService imageService;
|
|
33
|
private ImagesService imagesService;
|
34
|
34
|
|
35
|
35
|
public ImageDao getImageDao() {
|
36
|
36
|
return imageDao;
|
|
@ -48,21 +48,30 @@ public class ResourceService {
|
48
|
48
|
this.resourceDao = resourceDao;
|
49
|
49
|
}
|
50
|
50
|
|
51
|
|
public ImageService getImageService() {
|
52
|
|
return imageService;
|
|
51
|
public ImagesService getImagesService() {
|
|
52
|
return imagesService;
|
53
|
53
|
}
|
54
|
54
|
|
55
|
|
public void setImageService(ImageService imageService) {
|
56
|
|
this.imageService = imageService;
|
|
55
|
public void setImagesService(ImagesService imagesService) {
|
|
56
|
this.imagesService = imagesService;
|
57
|
57
|
}
|
58
|
58
|
|
59
|
59
|
@Post
|
60
|
60
|
@Path
|
61
|
|
public String insert(@JdbcConn(true) Connection con, Resource resource) throws SQLException, IOException {
|
|
61
|
public String insert(@JdbcConn(true) Connection con, Resource resource, String fn) {
|
62
|
62
|
String resourceId = StringUtil.buildUUID();
|
63
|
|
resource.setResourceId(resourceId);
|
64
|
|
this.resourceDao.insert(con, resource);
|
65
|
|
this.imageService.saveDefaultResourcePhoto(resourceId);
|
|
63
|
try {
|
|
64
|
this.imagesService.insert(con, resourceId, fn);
|
|
65
|
resource.setResourceId(resourceId);
|
|
66
|
this.resourceDao.insert(con, resource);
|
|
67
|
} catch (SQLException | IOException e) {
|
|
68
|
try {
|
|
69
|
con.rollback();
|
|
70
|
} catch (SQLException e1) {
|
|
71
|
e1.printStackTrace();
|
|
72
|
}
|
|
73
|
e.printStackTrace();
|
|
74
|
}
|
66
|
75
|
return resourceId;
|
67
|
76
|
}
|
68
|
77
|
|