|
@@ -19,6 +19,7 @@ import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -30,17 +31,17 @@ public class ImageUploadController {
|
|
@Autowired
|
|
@Autowired
|
|
private ResumeService resumeService;
|
|
private ResumeService resumeService;
|
|
private ResourceLoader resourceLoader;
|
|
private ResourceLoader resourceLoader;
|
|
- public static final String ROOT = "/usr/local/tomcat/tomcat7/webapps/resume/img/";
|
|
|
|
- public static final String ResumeFile = "/usr/local/tomcat/tomcat7/webapps/resume/";
|
|
|
|
- public static final String httpRoot = "http://yuesuo.yueguanjia.com/resume/img/";
|
|
|
|
- public static final String httphtmlRoot = "http://yuesuo.yueguanjia.com/resume/";
|
|
|
|
- public static final String modulePath = "/usr/local/tomcat/tomcat7/webapps/resume/resume.html";
|
|
|
|
|
|
+// public static final String ROOT = "/usr/local/tomcat/tomcat7/webapps/resume/img/";
|
|
|
|
+// public static final String ResumeFile = "/usr/local/tomcat/tomcat7/webapps/resume/";
|
|
|
|
+// public static final String httpRoot = "http://yuesuo.yueguanjia.com/resume/img/";
|
|
|
|
+// public static final String httphtmlRoot = "http://yuesuo.yueguanjia.com/resume/";
|
|
|
|
+// public static final String modulePath = "/usr/local/tomcat/tomcat7/webapps/resume/resume.html";
|
|
|
|
|
|
-// public static final String ROOT = "D:/apache-tomcat-9.0.6/webapps/resume/img/";
|
|
|
|
-// public static final String ResumeFile = "D:/apache-tomcat-9.0.6/webapps/resume/";
|
|
|
|
-// public static final String httpRoot = "http://localhost:8080/resume/img/";
|
|
|
|
-// public static final String httphtmlRoot = "http://localhost:8080/resume/";
|
|
|
|
-// public static final String modulePath = "E:/Yuemum/ygj-yuemum/src/main/resources/resume/resume.html";
|
|
|
|
|
|
+ public static final String ROOT = "D:/apache-tomcat-9.0.6/webapps/resume/img/";
|
|
|
|
+ public static final String ResumeFile = "D:/apache-tomcat-9.0.6/webapps/resume/";
|
|
|
|
+ public static final String httpRoot = "http://localhost:8080/resume/img/";
|
|
|
|
+ public static final String httphtmlRoot = "http://localhost:8080/resume/";
|
|
|
|
+ public static final String modulePath = "D:/apache-tomcat-9.0.6/webapps/resume/resume.html";
|
|
|
|
|
|
@RequestMapping(value = "/upload", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/upload", method = RequestMethod.GET)
|
|
public String upload() {
|
|
public String upload() {
|
|
@@ -52,7 +53,7 @@ public class ImageUploadController {
|
|
public int uploadImg(@RequestParam("file") MultipartFile file,
|
|
public int uploadImg(@RequestParam("file") MultipartFile file,
|
|
@RequestParam(value = "id") Integer id,
|
|
@RequestParam(value = "id") Integer id,
|
|
@RequestParam(value = "type") Integer type) {
|
|
@RequestParam(value = "type") Integer type) {
|
|
-// 照片类型 1:display 2:certificate 3:comment 4:service
|
|
|
|
|
|
+// 照片类型 1:display 2:certificate 3:comment 4:service 5:meal
|
|
String folder = "";
|
|
String folder = "";
|
|
int dot = file.getOriginalFilename().lastIndexOf('.');
|
|
int dot = file.getOriginalFilename().lastIndexOf('.');
|
|
String newName = file.getOriginalFilename().substring(dot);
|
|
String newName = file.getOriginalFilename().substring(dot);
|
|
@@ -106,12 +107,13 @@ public class ImageUploadController {
|
|
}
|
|
}
|
|
@PostMapping("/createResume")
|
|
@PostMapping("/createResume")
|
|
public String createResume(@ModelAttribute Photo photo) {
|
|
public String createResume(@ModelAttribute Photo photo) {
|
|
|
|
+ String urlName = UUID.randomUUID().toString().replace("-", "");
|
|
try {
|
|
try {
|
|
JlServiceUser jlServiceUser = jlServiceUserService.getResume(photo.getServant_code());
|
|
JlServiceUser jlServiceUser = jlServiceUserService.getResume(photo.getServant_code());
|
|
File file = ResourceUtils.getFile(modulePath);
|
|
File file = ResourceUtils.getFile(modulePath);
|
|
BufferedReader br = new BufferedReader(new FileReader(file));
|
|
BufferedReader br = new BufferedReader(new FileReader(file));
|
|
Resume resume =new Resume();
|
|
Resume resume =new Resume();
|
|
- Resume resumeold =new Resume();
|
|
|
|
|
|
+ Resume resumeold = new Resume();
|
|
StringBuilder stringHtml = new StringBuilder();
|
|
StringBuilder stringHtml = new StringBuilder();
|
|
String str = "";
|
|
String str = "";
|
|
String photoDisplay ="";
|
|
String photoDisplay ="";
|
|
@@ -119,6 +121,8 @@ public class ImageUploadController {
|
|
String certificatehref ="";
|
|
String certificatehref ="";
|
|
String service ="";
|
|
String service ="";
|
|
String servicehref ="";
|
|
String servicehref ="";
|
|
|
|
+ String meal = "";
|
|
|
|
+ String mealhref = "";
|
|
String comment ="";
|
|
String comment ="";
|
|
String littcomm = "";
|
|
String littcomm = "";
|
|
if(photo.getComment() == null){
|
|
if(photo.getComment() == null){
|
|
@@ -128,6 +132,7 @@ public class ImageUploadController {
|
|
if(photos.size() > 0 ) {
|
|
if(photos.size() > 0 ) {
|
|
int stepcertificate = 0;
|
|
int stepcertificate = 0;
|
|
int stepservice = 0;
|
|
int stepservice = 0;
|
|
|
|
+ int stepmeal = 0;
|
|
for(Photo onePhoto:photos){
|
|
for(Photo onePhoto:photos){
|
|
if(onePhoto.getPhoto_type() == 1){
|
|
if(onePhoto.getPhoto_type() == 1){
|
|
if(onePhoto.getPhoto_path() !=null){
|
|
if(onePhoto.getPhoto_path() !=null){
|
|
@@ -160,6 +165,19 @@ public class ImageUploadController {
|
|
stepservice++;
|
|
stepservice++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(onePhoto.getPhoto_type() == 5){
|
|
|
|
+ if(onePhoto.getPhoto_path() !=null) {
|
|
|
|
+ meal = meal+"<li class=\"poster-item zturn-item\">"+"\r\n"
|
|
|
|
+ + "<image class=\"zturn-item-image\" src='"+onePhoto.getPhoto_path()+"'></image>"+"\r\n"
|
|
|
|
+ +"</li>"+"\r\n";
|
|
|
|
+ if(stepmeal == 0) {
|
|
|
|
+ mealhref = mealhref + " <a href=\"javascript:void(0);\" value='"+stepmeal+"' class=\"indicator-list-item-service selected\"></a>" + "\r\n";
|
|
|
|
+ }else {
|
|
|
|
+ mealhref = mealhref + " <a href=\"javascript:void(0);\" value='"+stepmeal+"' class=\"indicator-list-item-service\"></a>" + "\r\n";
|
|
|
|
+ }
|
|
|
|
+ stepmeal++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if(onePhoto.getPhoto_type() == 3){
|
|
if(onePhoto.getPhoto_type() == 3){
|
|
comment = comment +"<a href=\"\"><img src='"+onePhoto.getPhoto_path()+"'/></a>"+"\r\n";
|
|
comment = comment +"<a href=\"\"><img src='"+onePhoto.getPhoto_path()+"'/></a>"+"\r\n";
|
|
littcomm = littcomm + "<image class=\"resume-comments-list\" src=\"" +onePhoto.getPhoto_path() + "\"/>";
|
|
littcomm = littcomm + "<image class=\"resume-comments-list\" src=\"" +onePhoto.getPhoto_path() + "\"/>";
|
|
@@ -224,20 +242,28 @@ public class ImageUploadController {
|
|
str = str.replace("$cfstyle",certificatehref);
|
|
str = str.replace("$cfstyle",certificatehref);
|
|
str = str.replace("$service",service);
|
|
str = str.replace("$service",service);
|
|
str = str.replace("$scstyle",servicehref);
|
|
str = str.replace("$scstyle",servicehref);
|
|
|
|
+ str = str.replace("$meal",meal);
|
|
|
|
+ str = str.replace("$smstyle",mealhref);
|
|
str = str.replace("$comment",comment);
|
|
str = str.replace("$comment",comment);
|
|
str = str.replace("$littcomm",littcomm);
|
|
str = str.replace("$littcomm",littcomm);
|
|
- str = str.replace("$yuesaohref",httphtmlRoot+photo.getServant_code() + ".html");
|
|
|
|
|
|
+ str = str.replace("$ystitle","悦所-月嫂简历:"+jlServiceUser.getTruename());
|
|
|
|
+ str = str.replace("$yuesaohref",httphtmlRoot+ urlName + ".html");
|
|
stringHtml.append(str+"\r\n");
|
|
stringHtml.append(str+"\r\n");
|
|
}
|
|
}
|
|
resumeold = resumeService.getResume(photo.getServant_code());
|
|
resumeold = resumeService.getResume(photo.getServant_code());
|
|
if(resumeold != null) {
|
|
if(resumeold != null) {
|
|
resumeService.deleteResume(resumeold.getId());
|
|
resumeService.deleteResume(resumeold.getId());
|
|
|
|
+ File fileDel = new File(resumeold.getRqcode_path());
|
|
|
|
+ if (file.exists()) {
|
|
|
|
+ fileDel.delete();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
resume.setServant_code(photo.getServant_code());
|
|
resume.setServant_code(photo.getServant_code());
|
|
resume.setResume_comment(photo.getComment());
|
|
resume.setResume_comment(photo.getComment());
|
|
- resume.setResume_path(httphtmlRoot+photo.getServant_code() + ".html");
|
|
|
|
|
|
+ resume.setResume_path(httphtmlRoot+ urlName + ".html");
|
|
|
|
+ resume.setRqcode_path(ResumeFile+urlName + ".html");
|
|
resumeService.addResume(resume);
|
|
resumeService.addResume(resume);
|
|
- File newResume = new File(ResumeFile + photo.getServant_code() + ".html");
|
|
|
|
|
|
+ File newResume = new File(ResumeFile + urlName + ".html");
|
|
FileWriter fileWriter = new FileWriter(newResume);
|
|
FileWriter fileWriter = new FileWriter(newResume);
|
|
fileWriter.write(stringHtml.toString());
|
|
fileWriter.write(stringHtml.toString());
|
|
fileWriter.close();
|
|
fileWriter.close();
|
|
@@ -245,7 +271,7 @@ public class ImageUploadController {
|
|
ex.printStackTrace();
|
|
ex.printStackTrace();
|
|
return "error";
|
|
return "error";
|
|
}
|
|
}
|
|
- return httphtmlRoot+photo.getServant_code() + ".html";
|
|
|
|
|
|
+ return httphtmlRoot+urlName+".html";
|
|
}
|
|
}
|
|
public String getpathtype(int type){
|
|
public String getpathtype(int type){
|
|
switch (type) {
|
|
switch (type) {
|
|
@@ -257,6 +283,8 @@ public class ImageUploadController {
|
|
return "comment";
|
|
return "comment";
|
|
case 4:
|
|
case 4:
|
|
return "service";
|
|
return "service";
|
|
|
|
+ case 5:
|
|
|
|
+ return "meal";
|
|
}
|
|
}
|
|
return "error";
|
|
return "error";
|
|
}
|
|
}
|