Shanks 7 年之前
父節點
當前提交
ace3be5909

+ 111 - 3
src/main/java/com/ygj/yuemum/controller/admin/ImageUploadController.java

@@ -2,8 +2,10 @@ package com.ygj.yuemum.controller.admin;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ygj.yuemum.domain.admin.Photo;
+import com.ygj.yuemum.domain.admin.Resume;
 import com.ygj.yuemum.domain.maternitymatron.JlServiceUser;
 import com.ygj.yuemum.service.admin.PhotoService;
+import com.ygj.yuemum.service.admin.ResumeService;
 import com.ygj.yuemum.service.maternitymatron.JlServiceUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ResourceLoader;
@@ -25,10 +27,13 @@ public class ImageUploadController {
     private PhotoService photoService;
     @Autowired
     private JlServiceUserService jlServiceUserService;
+    @Autowired
+    private ResumeService resumeService;
     private ResourceLoader resourceLoader;
     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/";
 
     @RequestMapping(value = "/upload", method = RequestMethod.GET)
     public String upload() {
@@ -93,13 +98,102 @@ public class ImageUploadController {
         return jso;
     }
     @PostMapping("/createResume")
-    public int createResume(@ModelAttribute Photo photo) {
+    public String createResume(@ModelAttribute Photo photo) {
         try {
             JlServiceUser jlServiceUser  = jlServiceUserService.getResume(photo.getServant_code());
             File file = ResourceUtils.getFile("classpath:resume/resume.html");
             BufferedReader br = new BufferedReader(new FileReader(file));
+            Resume resume =new Resume();
+            Resume resumeold =new Resume();
             StringBuilder stringHtml = new StringBuilder();
             String str = "";
+            String photoDisplay ="";
+            String certificate ="";
+            String certificatehref ="";
+            String service ="";
+            String servicehref ="";
+            String comment ="";
+            if(photo.getComment() == null){
+                photo.setComment(" ");
+            }
+            List<Photo> photos = photoService.queryPhoto(photo);
+            if(photos.size() > 0 ) {
+                int stepcertificate = 0;
+                int stepservice = 0;
+                for(Photo onePhoto:photos){
+                    if(onePhoto.getPhoto_type() == 1){
+                        if(onePhoto.getPhoto_path() !=null){
+                            photoDisplay = "<image class=\"resume-header-left-image\" src='"+onePhoto.getPhoto_path()+"'></image>"+"\r\n";
+                        }
+                    }
+                    if(onePhoto.getPhoto_type() == 2){
+                        if(onePhoto.getPhoto_path() !=null){
+                            certificate = certificate +"<li class=\"poster-item zturn-item\">"+"\r\n"
+                                    +"<image class=\"zturn-item-image-cer\" src='"+onePhoto.getPhoto_path()+"'></image>"+"\r\n"
+                                    +"</li>"+"\r\n";
+                            if(stepcertificate == 0) {
+                                certificatehref = certificatehref + "<a href=\"javascript:void(0);\" value='"+stepcertificate+"' class=\"indicator-list-item selected\"></a>" + "\r\n";
+                            } else {
+                                certificatehref = certificatehref + "<a href=\"javascript:void(0);\" value='"+stepcertificate+"' class=\"indicator-list-item \"></a>" + "\r\n";
+                            }
+                            stepcertificate ++ ;
+                        }
+                    }
+                    if(onePhoto.getPhoto_type() == 4){
+                        if(onePhoto.getPhoto_path() !=null) {
+                            service = service+"<li class=\"poster-item zturn-item\">"+"\r\n"
+                                    + "<image class=\"zturn-item-image\" src='"+onePhoto.getPhoto_path()+"'></image>"+"\r\n"
+                                    +"</li>"+"\r\n";
+                            if(stepservice == 0) {
+                                servicehref = servicehref + " <a href=\"javascript:void(0);\" value='"+stepservice+"' class=\"indicator-list-item-service selected\"></a>" + "\r\n";
+                            }else {
+                                servicehref = servicehref + " <a href=\"javascript:void(0);\" value='"+stepservice+"' class=\"indicator-list-item-service\"></a>" + "\r\n";
+                            }
+                            stepservice++;
+                        }
+                    }
+                    if(onePhoto.getPhoto_type() == 3){
+                        comment = comment +"<a href=\"\"><img src='"+onePhoto.getPhoto_path()+"'/></a>"+"\r\n";
+                    }
+                }
+            }
+            if(photoDisplay == ""){
+                photoDisplay = "<image class=\"resume-header-left-image\" src=\"img/header.jpg\"></image>"+"\r\n";
+            }
+            if(certificate == ""){
+                certificate = "<li class=\"poster-item zturn-item\">"+"\r\n"
+                        +"<image class=\"zturn-item-image-cer\" src=\"img/certificate01.jpg\"></image>"+"\r\n"
+                        +"</li>"+"\r\n"
+                        +"<li class=\"poster-item  zturn-item\">"+"\r\n"
+                        +"<image class=\"zturn-item-image-cer\" src=\"img/certificate02.jpg\"></image>"+"\r\n"
+                        +"</li>"+"\r\n"
+                        +"<li class=\"poster-item zturn-item\">"+"\r\n"
+                        +"<image class=\"zturn-item-image-cer\" src=\"img/certificate03.jpg\"></image>"+"\r\n"
+                        +"</li>"+"\r\n";
+                certificatehref = "<a href=\"javascript:void(0);\" value=\"0\" class=\"indicator-list-item selected\"></a>"+"\r\n"
+                        +"<a href=\"javascript:void(0);\" value=\"1\" class=\"indicator-list-item\"></a>"+"\r\n"
+                        +"<a href=\"javascript:void(0);\" value=\"2\" class=\"indicator-list-item\"></a>"+"\r\n";
+
+            }
+            if(service == ""){
+                service = "<li class=\"poster-item zturn-item\">"+"\r\n"
+                        +"<image class=\"zturn-item-image\" src=\"img/service01.png\"></image>"+"\r\n"
+                        +"</li>"+"\r\n"
+                        +"<li class=\"poster-item  zturn-item\">"+"\r\n"
+                        +"<image class=\"zturn-item-image\" src=\"img/service01.png\"></image>"+"\r\n"
+                        +"</li>"+"\r\n"
+                        +"<li class=\"poster-item zturn-item\">"+"\r\n"
+                        +"<image class=\"zturn-item-image\" src=\"img/service01.png\"></image>"+"\r\n"
+                        +"</li>"+"\r\n";
+                servicehref = " <a href=\"javascript:void(0);\" value=\"0\" class=\"indicator-list-item-service selected\"></a>"+"\r\n"
+                        +"<a href=\"javascript:void(0);\" value=\"1\" class=\"indicator-list-item-service\"></a>"+"\r\n"
+                        +"<a href=\"javascript:void(0);\" value=\"2\" class=\"indicator-list-item-service\"></a>"+"\r\n";
+            }
+            if(comment == ""){
+                comment = "<a href=\"\"><img src=\"img/comments01.jpg\"/></a>"+"\r\n"
+                        +"<a href=\"\"><img src=\"img/comments02.jpg\"/></a>"+"\r\n"
+                        +"<a href=\"\"><img src=\"img/comments03.jpg\"/></a>"+"\r\n";
+            }
             while((str = br.readLine())!=null){
                 str = str.replace("$name",jlServiceUser.getTruename());
                 str = str.replace("$np",jlServiceUser.getNp()+"人");
@@ -116,17 +210,31 @@ public class ImageUploadController {
                 str = str.replace("$zodiac",jlServiceUser.getZodiac());
                 str = str.replace("$height",jlServiceUser.getHeight());
                 str = str.replace("$starts",jlServiceUser.getGender());
+                str = str.replace("$display",photoDisplay);
+                str = str.replace("$credentials",certificate);
+                str = str.replace("$cfstyle",certificatehref);
+                str = str.replace("$service",service);
+                str = str.replace("$scstyle",servicehref);
+                str = str.replace("$comment",comment);
                 stringHtml.append(str+"\r\n");
             }
+            resumeold = resumeService.getResume(photo.getServant_code());
+            if(resumeold != null) {
+                resumeService.deleteResume(resumeold.getId());
+            }
+            resume.setServant_code(photo.getServant_code());
+            resume.setResume_comment(photo.getComment());
+            resume.setResume_path(httphtmlRoot+photo.getServant_code() + ".html");
+            resumeService.addResume(resume);
             File newResume = new File(ResumeFile + photo.getServant_code() + ".html");
             FileWriter fileWriter = new FileWriter(newResume);
             fileWriter.write(stringHtml.toString());
             fileWriter.close();
         } catch (Exception ex){
             ex.printStackTrace();
-            return 0;
+            return "error";
         }
-        return 1;
+        return httphtmlRoot+photo.getServant_code() + ".html";
     }
     public String getpathtype(int type){
         switch (type) {

+ 2 - 2
src/main/java/com/ygj/yuemum/controller/admin/ResumeController.java

@@ -32,6 +32,6 @@ public class ResumeController {
     @PostMapping("/updateResume")
     public int update(@ModelAttribute Resume resume) { return resumeService.updateResume(resume);}
 
-    @GetMapping("/getResume/{id}")
-    public Resume getOne(@PathVariable("id") Integer id) {return  resumeService.getResume(id);}
+    @GetMapping("/getResumeOne")
+    public Resume getOne(@RequestParam("id") Integer id) {return  resumeService.getResume(id);}
 }

+ 9 - 0
src/main/java/com/ygj/yuemum/domain/maternitymatron/JlServiceUser.java

@@ -35,6 +35,15 @@ public class JlServiceUser {
     private String weight;
     private String citycode;
     private String city;
+    private String resume_path;
+
+    public String getResume_path() {
+        return resume_path;
+    }
+
+    public void setResume_path(String resume_path) {
+        this.resume_path = resume_path;
+    }
 
     public String getCity() {
         return city;

+ 2 - 1
src/main/resources/mybatis/mapper/admin/PhotoMapper.xml

@@ -25,7 +25,7 @@
 
     <select id="queryPhoto" resultMap="BaseResultMap" parameterType="com.ygj.yuemum.domain.admin.Photo">
         select
-        photo_name,photo_path
+        photo_name,photo_path,photo_type
         from mm_info_photo
         where 1=1
         <if test="photo_type != null and photo_type !=''">
@@ -34,6 +34,7 @@
         <if test="servant_code != null and servant_code !=''">
             and servant_code = #{servant_code,jdbcType=VARCHAR}
         </if>
+        order by photo_type asc
     </select>
 
     <!-- 根据id查找某个照片信息 -->

+ 6 - 6
src/main/resources/mybatis/mapper/admin/ResumeMapper.xml

@@ -25,18 +25,18 @@
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
         select
         <include refid="Base_Column_List" />
-        from resume
+        from mm_info_resume
         where servant_code = #{servant_code,jdbcType=INTEGER}
     </select>
     <!-- 根据id删除某个简历信息 -->
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
-        delete from resume
+        delete from mm_info_resume
         where id = #{id,jdbcType=INTEGER}
     </delete>
 
     <!-- 插入一条简历信息 -->
     <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.admin.Resume" >
-        insert into resume
+        insert into mm_info_resume
         <trim prefix="(" suffix=")" suffixOverrides="," >
             <if test="servant_code != null" >
                 servant_code,
@@ -45,7 +45,7 @@
                 module_code,
             </if>
             <if test="resume_comment != null" >
-                resume_comment
+                resume_comment,
             </if>
             <if test="resume_path != null" >
                 resume_path
@@ -59,7 +59,7 @@
                 #{module_code,jdbcType=VARCHAR},
             </if>
             <if test="resume_comment != null" >
-                #{resume_comment,jdbcType=VARCHAR}
+                #{resume_comment,jdbcType=VARCHAR},
             </if>
             <if test="resume_path != null" >
                 #{resume_path,jdbcType=VARCHAR}
@@ -69,7 +69,7 @@
 
     <!-- 根据id更新一条简历信息 -->
     <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.admin.Resume" >
-        update resume
+        update mm_info_resume
         <set >
             <if test="servant_code != null" >
                 servant_code = #{servant_code,jdbcType=INTEGER},

+ 7 - 2
src/main/resources/mybatis/mapper/maternitymatron/JlServiceUserMapper.xml

@@ -59,6 +59,7 @@
         <result column="citycode" property="citycode" jdbcType="VARCHAR"/>
         <result column="weight" property="weight" jdbcType="VARCHAR"/>
         <result column="city" property="city" jdbcType="VARCHAR"/>
+        <result column="resume_path" property="resume_path" jdbcType="VARCHAR"/>
     </resultMap>
     <sql id="Base_Column_List">
         id, password, truename,mobile_phone,status,last_login_time,last_login_ip,salt,token,zone_code,updated_at,stock_status,usertype
@@ -210,12 +211,14 @@
         jl_service_user_info.seniority,
         jl_service_user_info.gender,
         jl_service_user.status,
-        jl_service_user_info.babynumber
+        jl_service_user_info.babynumber,
+        IFNULL(mm_info_resume.resume_path,0) resume_path
         from jl_service_user
         LEFT JOIN jl_service_user_info on jl_service_user.id = jl_service_user_info.id
         LEFT JOIN (select service_id,GROUP_CONCAT(jl_region.`name`) cityname from jl_store_service LEFT JOIN jl_region
         on jl_store_service.store_id = jl_region.`code` group by service_id) as
         city ON jl_service_user.id = city.service_id
+        left join mm_info_resume on jl_service_user.id = mm_info_resume.servant_code
         order by  gender desc , babynumber desc , status asc
     </select>
 
@@ -310,12 +313,14 @@
         jl_service_user_info.marriage,
         jl_service_user_info.highlight,
         jl_service_user_info.weight,
-        city.citycode
+        city.citycode,
+        IFNULL(mm_info_resume.resume_path,0) resume_path
         from jl_service_user
         LEFT JOIN jl_service_user_info on jl_service_user.id = jl_service_user_info.id
         LEFT JOIN (select service_id,GROUP_CONCAT(jl_region.`name`) cityname,GROUP_CONCAT(store_id) citycode from jl_store_service LEFT JOIN jl_region
         on jl_store_service.store_id = jl_region.`code` group by service_id) as
         city ON jl_service_user.id = city.service_id
+        left join mm_info_resume on jl_service_user.id = mm_info_resume.servant_code
         where 1=1
         <if test="ids != null ">
             and jl_service_user.id not in ( #{ids,jdbcType=INTEGER} )

+ 4 - 4
src/main/resources/resume/resume.html

@@ -23,7 +23,7 @@
     <!--头部响应信息-->
     <div class="resume-header-info">
         <div class="resume-header-left">
-            <image class="resume-header-left-image" src="img/header.jpg"></image>
+            $display
             <p class="resume-name">$name</p>
             <image id="resume-header-starts" class="resume-header-left-comment-image" src=""></image>
         </div>
@@ -110,13 +110,13 @@
                     <div class="left-modal modal-certificate"></div>
                     <ul id="zturn-certificate" class="poster-list">
                         <div class="poster-btn poster-certificate-prev-btn certificate"></div>
-                         $certificate
+                         $credentials
                         <div class="poster-btn poster-certificate-next-btn"></div>
                     </ul>
                     <div class="right-modal modal-certificate"></div>
                     <!--indicators-->
                     <div class="indicator-list indicator-list-cer">
-                        $certificatehref
+                        $cfstyle
                     </div>
                 </div>
 
@@ -147,7 +147,7 @@
 
                     <!--indicators-->
                     <div class="indicator-list indicator-list-service">
-                        $certificatehref
+                        $scstyle
                     </div>
 
                 </div>