Shanks 7 tahun lalu
induk
melakukan
55ab5bd056

+ 10 - 2
pom.xml

@@ -58,13 +58,21 @@
 			<artifactId>pagehelper-spring-boot-starter</artifactId>
 			<version>1.1.1</version>
 		</dependency>
-
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpclient</artifactId>
+			<version>4.5.4</version>
+		</dependency>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-test</artifactId>
 			<scope>test</scope>
 		</dependency>
-
+		<dependency>
+			<groupId>com.alibaba</groupId>
+			<artifactId>fastjson</artifactId>
+			<version>1.1.41</version>
+		</dependency>
 		<dependency>
 			<groupId>com.thetransactioncompany</groupId>
 			<artifactId>cors-filter</artifactId>

+ 15 - 0
src/main/java/com/ygj/yuemum/ScheduledService.java

@@ -0,0 +1,15 @@
+package com.ygj.yuemum;
+
+import com.ygj.yuemum.service.global.WeChatInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ScheduledService {
+    @Autowired
+    private WeChatInfoService weChatInfoService;
+//    @Scheduled(fixedRate = 5400000)
+//    public void timerCron() {
+////        weChatInfoService.SaveWeChatInfo();
+//    }
+}

+ 2 - 0
src/main/java/com/ygj/yuemum/YueMumApplication.java

@@ -3,9 +3,11 @@ package com.ygj.yuemum;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication
 @MapperScan("com.ygj.yuemum.dao")
+@EnableScheduling
 public class YueMumApplication {
 
     public static void main(String[] args) {

+ 116 - 71
src/main/java/com/ygj/yuemum/controller/admin/ImageUploadController.java

@@ -105,6 +105,7 @@ public class ImageUploadController {
         jso = jso.replaceAll("servant_code","name");
         return jso;
     }
+
     @PostMapping("/createResume")
     public String createResume(@ModelAttribute Photo photo) {
         String urlName = UUID.randomUUID().toString().replace("-", "");
@@ -133,93 +134,133 @@ public class ImageUploadController {
                 int stepcertificate = 0;
                 int stepservice = 0;
                 int stepmeal = 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";
+                String certificatestart = "<div class=\"resume-certificate-image\">"+ "\r\n"
+                        +"<span class=\"resume-item-title\">相关证件</span>"+ "\r\n"
+                        +"<div class=\"lb_gl_certificate\">"+ "\r\n"
+                        +"<div class=\"container\">"+ "\r\n"
+                        +"<div class=\"pictureSlider-certificate poster-main \">"+ "\r\n"
+                        +"<div class=\"left-modal modal-certificate\"></div>"+ "\r\n"
+                        +"<ul id=\"zturn-certificate\" class=\"poster-list\">"+ "\r\n"
+                        +"<div class=\"poster-btn poster-certificate-prev-btn certificate\"></div>"+ "\r\n";
+                String certificateend = "<div class=\"poster-btn poster-certificate-next-btn\"></div>"+ "\r\n"
+                        +"</ul>"+ "\r\n"
+                        +"<div class=\"right-modal modal-certificate\"></div>"+ "\r\n"
+                        +"<div class=\"indicator-list indicator-list-cer\">"+ "\r\n"
+                        +"$cfstyle"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n";
+                String mealstart = "<div class=\"resume-service-image\">"+ "\r\n"
+                        +"<span class=\"resume-item-title\">月子餐照片</span>"+ "\r\n"
+                        +"<div class=\"lb_gl\">"+ "\r\n"
+                        +"<div class=\"container\">"+ "\r\n"
+                        +"<div class=\"pictureSlider poster-main poster-main-yzfood\">"+ "\r\n"
+                        +"<div class=\"left-modal\"></div>"+ "\r\n"
+                        +"<ul id=\"yzfood\" class=\"poster-list\">"+ "\r\n"
+                        +"<div class=\"poster-btn poster-prev-btn poster-prev-btn-yzfood\"></div>"+ "\r\n";
+                String mealend = "<div class=\"poster-btn poster-next-btn poster-next-btn-yzfood\"></div>"+ "\r\n"
+                        +"</ul>"+ "\r\n"
+                        +"<div class=\"right-modal\"></div>"+ "\r\n"
+                        +"<div class=\"indicator-list indicator-list-service\">"+ "\r\n"
+                        +"$smstyle"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n";
+                String commentstart = "<div class=\"resume-comments\">" + "\r\n"
+                        + "<span class=\"resume-item-title\">最新评论</span>" + "\r\n"
+                        + "<div class=\"resume-comments-div\" id=\"resume-comments\">" + "\r\n"
+                        + "<div class=\"box_4\" id=\"box-comments\">" + "\r\n"
+                        + "<div class=\"roll\" id=\"roll\">" + "\r\n"
+                        + "<div class=\"roll_list\">" + "\r\n"
+                        + "<div class=\"ul_box\" id=\"ul_box\">" + "\r\n";
+                String commentend = "</div>"
+                        + "<div class=\"ul_box\" id=\"ul_box2\"></div>"
+                        + "</div>" + "\r\n" + "</div>" + "\r\n" + "</div>" + "\r\n" + "</div>" + "\r\n" + "</div>";
+                String servicestart = "<div class=\"resume-service-image\">"+ "\r\n"
+                        +"<span class=\"resume-item-title\">服务照片</span>"+ "\r\n"
+                        +"<div class=\"left-modal\" id=\"left-modal-service\"></div>"+ "\r\n"
+                        +"<div class=\"lb_gl\">"+ "\r\n"
+                        +"<div class=\"container\">"+ "\r\n"
+                        +"<div class=\"pictureSlider poster-main poster-main-services\">"+ "\r\n"
+                        +"<ul id=\"zturn\" class=\"poster-list\">"+ "\r\n"
+                        +"<div class=\"poster-btn poster-prev-btn poster-prev-btn-service\"></div>"+ "\r\n";
+                String serviceend = "<div class=\"poster-btn poster-next-btn poster-next-btn-service\"></div>"+ "\r\n"
+                        +"</ul>"+ "\r\n"
+                        +"<div class=\"right-modal\"></div>"+ "\r\n"
+                        +"<div class=\"indicator-list indicator-list-service\">"+ "\r\n"
+                        +"$scstyle"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n"
+                        +"</div>"+ "\r\n";
+
+                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";
+                    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";
+                                certificatehref = certificatehref + "<a href=\"javascript:void(0);\" value='" + stepcertificate + "' class=\"indicator-list-item \"></a>" + "\r\n";
                             }
-                            stepcertificate ++ ;
+                            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";
+                    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() == 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";
+                    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){
-                        comment = comment +"<a href=\"\"><img src='"+onePhoto.getPhoto_path()+"'/></a>"+"\r\n";
-                        littcomm = littcomm + "<image class=\"resume-comments-list\" src=\"" +onePhoto.getPhoto_path() + "\"/>";
+                    if (onePhoto.getPhoto_type() == 3) {
+                        comment = comment + "<a href=\"\"><img src='" + onePhoto.getPhoto_path() + "'/></a>" + "\r\n";
+                        littcomm = littcomm + "<image class=\"resume-comments-list\" src=\"" + onePhoto.getPhoto_path() + "\"/>";
                     }
                 }
-            }
-            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";
+                if (comment != "") {
+                    comment = commentstart + comment + commentend;
+                }
+                if (meal != "") {
+                    meal = mealstart + meal + mealend;
+                }
+                if (service != "") {
+                    service = servicestart + service + serviceend;
+                }
+                if (certificate != "") {
+                    certificate = certificatestart + certificate + certificateend;
+                }
             }
             while((str = br.readLine())!=null){
                 str = str.replace("$name",jlServiceUser.getTruename());
@@ -288,4 +329,8 @@ public class ImageUploadController {
         }
         return "error";
     }
+    @GetMapping("/reBulidResume")
+    public int getCouponbatchs(@RequestParam("servant_code") String servant_code) {
+        return photoService.reBuildResume(servant_code);
+    }
 }

+ 6 - 3
src/main/java/com/ygj/yuemum/controller/admin/JlServiceUserLogController.java

@@ -2,11 +2,10 @@ package com.ygj.yuemum.controller.admin;
 
 
 import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.domain.admin.JlServiceUserLog;
 import com.ygj.yuemum.service.admin.JlServiceUserLogService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.Map;
 
@@ -22,4 +21,8 @@ public class JlServiceUserLogController {
         String jso = JSONObject.toJSONString(jlServiceUserLog);
         return jso;
     }
+    @PostMapping("/insertJlServiceUserLog")
+    public int insertJlServiceUserLog(@ModelAttribute JlServiceUserLog jlServiceUserLog ) {
+        return jlServiceUserLogService.insertJlServiceUserLog(jlServiceUserLog);
+    }
 }

+ 1 - 0
src/main/java/com/ygj/yuemum/dao/global/WeChatInfoDao.java

@@ -7,5 +7,6 @@ import org.springframework.stereotype.Repository;
 public interface WeChatInfoDao {
 
     WeChatInfo getWeChatInfo();
+
     int updateWeChatInfo(WeChatInfo weChatInfo);
 }

+ 10 - 0
src/main/java/com/ygj/yuemum/domain/global/WeChatInfo.java

@@ -3,6 +3,16 @@ package com.ygj.yuemum.domain.global;
 public class WeChatInfo {
     private String access_token;
     private String jsapi_ticket;
+    private String update_time;
+
+
+    public String getUpdate_time() {
+        return update_time;
+    }
+
+    public void setUpdate_time(String update_time) {
+        this.update_time = update_time;
+    }
 
     public String getAccess_token() {
         return access_token;

+ 87 - 1
src/main/java/com/ygj/yuemum/service/admin/PhotoService.java

@@ -2,17 +2,32 @@ package com.ygj.yuemum.service.admin;
 
 import com.ygj.yuemum.dao.admin.PhotoDao;
 import com.ygj.yuemum.domain.admin.Photo;
+import com.ygj.yuemum.domain.admin.Resume;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class PhotoService {
 
     @Autowired
-
     private PhotoDao photoDao;
+    @Autowired
+    private ResumeService resumeService;
 
     public List<Photo> getPhotos() {
         List<Photo> photos = photoDao.getAll();
@@ -43,4 +58,75 @@ public class PhotoService {
     public Photo getPhoto(Integer id) {
         return photoDao.selectByPrimaryKey(id);
     }
+
+    public int reBuildResume(String servant_code) {
+        try {
+            if (servant_code != null) {
+                if (servant_code.equals("ALL")) {
+                    List<Resume> resumes = resumeService.getResums();
+                    for (Resume res : resumes) {
+                        if (res == null) {
+                            return 0;
+                        }
+                        Map<String, String> params = new LinkedHashMap<>();
+                        params.put("servant_code", String.valueOf(res.getServant_code()));
+                        params.put("comment", res.getResume_comment());
+                        String tt = sendPostDataByMap("http://127.0.0.1:8888/createResume", params, "utf-8");
+                    }
+                } else {
+                    Resume resume = resumeService.getResume(Integer.parseInt(servant_code));
+                    if (resume == null) {
+                        return 0;
+                    }
+                    Map<String, String> params = new LinkedHashMap<>();
+                    params.put("servant_code", String.valueOf(resume.getServant_code()));
+                    params.put("comment", resume.getResume_comment());
+                    String tt = sendPostDataByMap("http://127.0.0.1:8888/createResume", params, "utf-8");
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return 0;
+        }
+
+        return 1;
+    }
+
+    public static String sendPostDataByMap(String url, Map<String, String> map, String encoding) throws ClientProtocolException, IOException {
+        String result = "";
+
+        // 创建httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        // 创建post方式请求对象
+        HttpPost httpPost = new HttpPost(url);
+
+        // 装填参数
+        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
+        if (map != null) {
+            for (Map.Entry<String, String> entry : map.entrySet()) {
+                nameValuePairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
+            }
+        }
+
+        // 设置参数到请求对象中
+        httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, encoding));
+
+        // 设置header信息
+        // 指定报文头【Content-type】、【User-Agent】
+        httpPost.setHeader("Content-type", "application/x-www-form-urlencoded");
+        httpPost.setHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+
+        // 执行请求操作,并拿到结果(同步阻塞)
+        CloseableHttpResponse response = httpClient.execute(httpPost);
+        // 获取结果实体
+        // 判断网络连接状态码是否正常(0--200都数正常)
+        if (response.getStatusLine().getStatusCode() == 200) {
+            result = EntityUtils.toString(response.getEntity(), "utf-8");
+        }
+        // 释放链接
+        response.close();
+
+        return result;
+    }
+
 }

+ 4 - 77
src/main/java/com/ygj/yuemum/service/global/WeChatInfoService.java

@@ -7,22 +7,17 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.io.BufferedReader;
-import java.io.IOException;
 import java.io.InputStreamReader;
-import java.io.PrintWriter;
 import java.net.URL;
 import java.net.URLConnection;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 @Service
 public class WeChatInfoService {
     @Autowired
-
     private WeChatInfoDao weChatInfoDao;
     public static String APPID = "wx52852a3c47540fad";
     public static String APPSECRET = "31e4eef58038830327eb88661e3a681f";
@@ -39,23 +34,22 @@ public class WeChatInfoService {
     String signaTure;
 
     public int SaveWeChatInfo() {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         try {
             //access_token
             String resultToken = sendGet(ACCESS_TOKEN_URL + "?grant_type=" + GRANT_TYPE + "&appid=" + APPID + "&secret=" + APPSECRET);
             Map mapToken = JSON.parseObject(resultToken);
             access_Token = String.valueOf(mapToken.get("access_token"));
             expires_in = String.valueOf(mapToken.get("expires_in"));
-            System.out.println("access_Token=="+access_Token);
-            System.out.println("expires_in=="+expires_in);
             //get jsApi_ticket
             String resultJsapi = sendGet(JSAPI_TICKET_URL + "?access_token=" + access_Token + "&type=" + JSAPI_TICKET_TYPE);
             Map mapJsapi = JSON.parseObject(resultJsapi);
             jsapi_Ticket = String.valueOf(mapJsapi.get("ticket"));
-            System.out.println("jsapi_Ticket==="+jsapi_Ticket);
             //保存到数据库中
             WeChatInfo weChatInfo = new WeChatInfo();
             weChatInfo.setAccess_token(access_Token);
             weChatInfo.setJsapi_ticket(jsapi_Ticket);
+            weChatInfo.setUpdate_time(dateFormat.format(new Date()));
             weChatInfoDao.updateWeChatInfo(weChatInfo);
         }catch (Exception ex){
             ex.printStackTrace();
@@ -64,7 +58,6 @@ public class WeChatInfoService {
         return 1;
     }
     public Map<String,String> getWeChatInfo(String url){
-        System.out.println(url);
         WeChatInfo weChatInfo  = weChatInfoDao.getWeChatInfo();
         Map<String, String> result = new HashMap<>();
         String timestamp = getTimestamp();
@@ -137,11 +130,6 @@ public class WeChatInfoService {
             connection.connect();
             // 获取所有响应头字段
             Map<String, List<String>> map = connection.getHeaderFields();
-            // 遍历所有的响应头字段
-            for (String key : map.keySet()) {
-                System.out.println(key + "--->" + map.get(key));
-            }
-
             //ConstantUtil.UTF_CODE 编码格式
             InputStreamReader reader = new InputStreamReader(connection.getInputStream());
             char[] buff = new char[1024];
@@ -151,7 +139,6 @@ public class WeChatInfoService {
                 jsonStr.append(result);
             }
         } catch (Exception e) {
-            System.out.println("发送GET请求出现异常!" + e);
             e.printStackTrace();
         }
         // 使用finally块来关闭输入流
@@ -166,64 +153,4 @@ public class WeChatInfoService {
         }
         return jsonStr.toString();
     }
-
-    /**
-     * 向指定 URL 发送POST方法的请求
-     *
-     * @param url   发送请求的 URL
-     * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
-     * @return 所代表远程资源的响应结果
-     */
-    public static String sendPost(String url, String param) {
-        PrintWriter out = null;
-        BufferedReader in = null;
-        URLConnection conn = null;
-        StringBuilder jsonStr = new StringBuilder();
-        try {
-            URL realUrl = new URL(url);
-            // 打开和URL之间的连接
-            conn = realUrl.openConnection();
-            conn.setConnectTimeout(20000);
-            // 设置通用的请求属性
-            conn.setRequestProperty("accept", "*/*");
-            conn.setRequestProperty("connection", "Keep-Alive");
-            conn.setRequestProperty("user-agent",
-                    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
-            // 发送POST请求必须设置如下两行
-            conn.setDoOutput(true);
-            conn.setDoInput(true);
-            // 获取URLConnection对象对应的输出流
-            out = new PrintWriter(conn.getOutputStream());
-            // 发送请求参数
-            out.print(param);
-            // flush输出流的缓冲
-            out.flush();
-            // 定义BufferedReader输入流来读取URL的响应
-
-            InputStreamReader reader = new InputStreamReader(conn.getInputStream());
-            char[] buff = new char[1024];
-            int length = 0;
-            while ((length = reader.read(buff)) != -1) {
-                String result = new String(buff, 0, length);
-                jsonStr.append(result);
-            }
-        } catch (Exception e) {
-            System.out.println("发送 POST 请求出现异常!" + e);
-            e.printStackTrace();
-        }
-        //使用finally块来关闭输出流、输入流
-        finally {
-            try {
-                if (out != null) {
-                    out.close();
-                }
-                if (in != null) {
-                    in.close();
-                }
-            } catch (IOException ex) {
-                ex.printStackTrace();
-            }
-        }
-        return jsonStr.toString();
-    }
 }

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

@@ -19,7 +19,7 @@
     <select id="getAll" resultMap="BaseResultMap" >
         select
         <include refid="Base_Column_List" />
-        from resume
+        from mm_info_resume
     </select>
 
     <!-- 根据id查找某个简历信息 -->

+ 4 - 0
src/main/resources/mybatis/mapper/global/WeChatInfoMapper.xml

@@ -5,6 +5,7 @@
     <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.global.WeChatInfo" >
         <result column="access_token" property="access_token" jdbcType="VARCHAR" />
         <result column="jsapi_ticket" property="jsapi_ticket" jdbcType="VARCHAR" />
+        <result column="update_time" property="update_time" jdbcType="DATE" />
     </resultMap>
 
     <!--获取所有数据-->
@@ -23,6 +24,9 @@
             <if test="jsapi_ticket != null" >
                 jsapi_ticket = #{jsapi_ticket,jdbcType=VARCHAR},
             </if>
+            <if test="update_time != null" >
+                update_time = #{update_time,jdbcType=DATE}
+            </if>
         </set>
     </update>