Browse Source

二维码扫码记录

pengjing 10 months ago
parent
commit
65703aafda

+ 24 - 1
doc/正式平台发布Url地址配置

@@ -7,4 +7,27 @@ mobile: appconfig.json文件
 }
 
 web: yml文件
-wxMessageBaseUrl: 'https://hjy.hz12311.cn/mobile/index.html/#'
+    appId: 'wx43e7f4f5df3505bf'
+    appSecret: '29f2741abb5b9a1559da7b2df31a0685'
+    wxMessageBaseUrl: 'https://hjy.hz12311.cn/mobile/index.html/#'
+
+
+--- 数据库执行消息模板配置
+delete from wx_messageTempSetting_field;
+delete from wx_messageTempSetting;
+
+insert into wx_messageTempSetting
+values('toCompany','应聘人员信息通知','cg2JOqSYJNfn-q5emAxP_23FQjZzVXmNJxu9SgaqZCw','/wxMessage/jobUserInfo');
+insert into wx_messageTempSetting
+values('toUser','岗位信息通知','cg2JOqSYJNfn-q5emAxP_0xsaKFJbuggqpgWb37nSUg','/wxMessage/companyInfo');
+
+insert into wx_messageTempSetting_field
+values
+    ('toCompany','phrase6','userName'),
+    ('toCompany','phone_number7','usermobile'),
+    ('toCompany','phrase9','userHuntPostName');
+insert into wx_messageTempSetting_field
+values
+    ('toUser','thing13','companyname'),
+    ('toUser','phrase9','postName'),
+    ('toUser','phone_number7','companymobile');

+ 3 - 1
h5app/src/App.vue

@@ -32,7 +32,9 @@ if (user.value != null) {
     redirectUrl = splits[1];
   }
 
-  router.push("/index?redirectUrl=" + redirectUrl.replace("/index?redirectUrl=",""))
+  redirectUrl = redirectUrl.replace("/index?redirectUrl=", "").replace("/?redirectUrl=","").replace("?redirectUrl=","");
+
+  router.push({path: "/index", query: {redirectUrl: redirectUrl}})
 }
 
 </script>

+ 30 - 4
h5app/src/api/wechat/index.ts

@@ -1,11 +1,11 @@
 import {request} from "@/utils/request";
 
-export function getOAuthUrl(redirectUrl:string) {
+export function getOAuthUrl(redirectUrl: string) {
     return request<object>(
         {
             url: 'wx/getOAuthUrl',
             method: 'get',
-            params: {redirectUrl:redirectUrl},
+            params: {redirectUrl: redirectUrl},
         },
         {
             isNew: true,
@@ -14,12 +14,38 @@ export function getOAuthUrl(redirectUrl:string) {
 }
 
 
-export function getWxOpenId(code:string) {
+export function getWxOpenId(code: string) {
     return request<object>(
         {
             url: 'wx/getOpenId',
             method: 'get',
-            params: {code:code},
+            params: {code: code},
+        },
+        {
+            isNew: true,
+        },
+    );
+}
+
+export function getQRCodeUrlToBase64(url: string, userId: string) {
+    return request<object>(
+        {
+            url: 'wx/getQRCodeUrlToBase64',
+            method: 'get',
+            params: {url: url, userId: userId},
+        },
+        {
+            isNew: true,
+        },
+    );
+}
+
+export function qrcodeVerify(qrCodeId: string, openId: string) {
+    return request<object>(
+        {
+            url: 'wx/qrcodeVerify',
+            method: 'get',
+            params: {qrCodeId: qrCodeId, openId: openId},
         },
         {
             isNew: true,

+ 2 - 2
h5app/src/router/index.ts

@@ -11,10 +11,10 @@ import JobUserInfoCompanyEdit from '../views/pages/jobUserInfo/companyEdit.vue';
 import IndexPage from '../views/index.vue';
 
 const routes: Array<RouteRecordRaw> = [
-    {
+    /*{
         path: '/',
         redirect: '/index'
-    },
+    },*/
     {
         path: '/tabs/',
         component: StudentTabsPage,

+ 5 - 1
h5app/src/utils/urlUtils.ts

@@ -34,7 +34,9 @@ export const uniqueSlash = (path: string) => path.replace(/(https?:\/)|(\/)+/g,
 
 
 export function getUrlParams() {
-    const href = location.href;
+    let href = decodeURIComponent(location.href);
+    href = decodeURIComponent(href);
+    /*alert("href:"+href);*/
     const theRequest = new Object();
     let urls = [];
     if (href.indexOf("#") != -1) {
@@ -63,5 +65,7 @@ export function getUrlParams() {
         }
     });
 
+    console.log(theRequest);
+
     return theRequest;
 }

+ 39 - 5
h5app/src/utils/wechat.ts

@@ -3,25 +3,34 @@ import {getOAuthUrl, getWxOpenId} from "@/api/wechat";
 import {useUserStore} from "@/store/modules/user";
 import {alertController, loadingController} from '@ionic/vue';
 import {getConfig} from "@/utils/config";
+import {useRouter} from "vue-router";
 
 export function isWechat() {
     return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger";
+    /* return true;*/
 }
 
 export const wxAuth = async <Object>(redirectUrl: string): Promise<string> => {
+    /*alert("22redirectUrl:" + decodeURIComponent(redirectUrl));*/
+    redirectUrl = decodeURIComponent(redirectUrl)
     try {
         const userStore = useUserStore();
+        let oAuthUrl_redirectUrl = "";
+        const router = useRouter();
 
         if (isWechat() && !userStore.getOpenId) {
             await getConfig().then((data: any) => {
-                redirectUrl = data.webSiteUrl + redirectUrl;
+                oAuthUrl_redirectUrl = data.webSiteUrl + "?redirectUrl=" + redirectUrl;
             })
             const urlParams = getUrlParams() as any;
             const code = urlParams["code"];
             const openId = urlParams["openId"];
             if (openId) {
                 userStore.setOpenId(openId);
+                /*alert("22redirectUrl:" + decodeURIComponent(redirectUrl));*/
+                router.push(redirectUrl);
             } else {
+                /* alert("33redirectUrl:" + decodeURIComponent(redirectUrl));*/
                 if (!code) {
                     const loading = await loadingController.create({
                         cssClass: 'my-custom-class',
@@ -29,7 +38,8 @@ export const wxAuth = async <Object>(redirectUrl: string): Promise<string> => {
                         duration: 2000,
                     });
                     await loading.present();
-                    getOAuthUrl(encodeURIComponent(redirectUrl)).then((res: any) => {
+
+                    getOAuthUrl(encodeURIComponent(oAuthUrl_redirectUrl)).then((res: any) => {
                         if (res) {
                             window.location.replace(res);
                         } else {
@@ -46,12 +56,36 @@ export const wxAuth = async <Object>(redirectUrl: string): Promise<string> => {
                     await getWxOpenId(code).then((res: any) => {
                         userStore.setOpenId(res);
 
-                        /*const currentUrl = redirectUrl + (redirectUrl.indexOf("?") >= 0 ? "&" : "?") + "openId=" + res;
-                        window.location.replace(currentUrl);*/
+                        const currentUrl = redirectUrl + (redirectUrl.indexOf("?") >= 0 ? "&" : "?") + "openId=" + res;
+
+                        alert("currentUrl:" + currentUrl);
+
+                        router.push(currentUrl);
                     });
                 }
             }
-        }
+        } else {
+            router.push(decodeURIComponent(redirectUrl));
+
+        }        /* const router = useRouter();
+         await getWxOpenId("").then((res: any) => {
+             userStore.setOpenId(res);
+
+             const currentUrl = redirectUrl + (redirectUrl.indexOf("?") >= 0 ? "&" : "?") + "openId=" + res;
+
+             alert("currentUrl:" + currentUrl);
+
+             router.push(currentUrl);
+         },()=>{
+             userStore.setOpenId("2222");
+
+
+             const currentUrl = redirectUrl + (redirectUrl.indexOf("?") >= 0 ? "&" : "?") + "openId=2222";
+
+             alert("currentUrl222:" + currentUrl);
+
+             router.push(currentUrl);
+         });*/
         return "";
     } catch (e) {
         return Promise.reject(null);

+ 24 - 21
h5app/src/views/index.vue

@@ -1,44 +1,47 @@
 <template>
-  <div>
-    系统加载中,请稍等...
-  </div>
+  <ion-page class="list-page">
+    <ion-content>
+      系统加载中,请稍等...
+    </ion-content>
+  </ion-page>
 </template>
 <script>
 import {defineComponent, ref} from "vue";
-import {useRouter} from "vue-router";
+import {useRoute, useRouter} from "vue-router";
 import {useUserStore} from "@/store/modules/user";
 import {isWechat, wxAuth} from "@/utils/wechat";
-import {getUrlParams} from "@/utils/urlUtils";
+import {onIonViewDidEnter} from "@ionic/vue";
 
 export default defineComponent({
   name: "sysindex",
   setup() {
+    const route = useRoute();
     const router = useRouter();
     const userStore = useUserStore();
-    const user = ref(userStore.getUserInfo);
-    const urlParams = getUrlParams();
-    let redirectUrl = urlParams["redirectUrl"] || '/login';
-
-    if (redirectUrl === '/index') {
-      redirectUrl = '/login';
-    }
+    const redirectUrl = ref("");
 
     const wxLogin = async function () {
-      await wxAuth(redirectUrl);
+      await wxAuth(redirectUrl.value);
     };
 
-    if (isWechat() && redirectUrl.indexOf("wxMessage") < 0) {
-      wxLogin().then(res => {
-        const currentUrl = redirectUrl + (redirectUrl.indexOf("?") >= 0 ? "&" : "?") + "openId=" + userStore.getOpenId
-        router.push(currentUrl);
-      });
-    } else {
-      router.push(redirectUrl);
-    }
+    onIonViewDidEnter(() => {
+      redirectUrl.value = route.query.redirectUrl || '/login';
+      if (redirectUrl.value === '/index') {
+        redirectUrl.value = '/login';
+      }
+
+      if (isWechat() && redirectUrl.value.indexOf("wxMessage") < 0) {
+        wxLogin();
+      } else {
+        router.push(redirectUrl.value);
+      }
+
+    });
 
     return {}
   }
 });
 </script>
 <style lang="less">
+
 </style>

+ 48 - 20
h5app/src/views/pages/jobUserInfo/index.vue

@@ -32,7 +32,7 @@
           <ion-text>{{ openId }}</ion-text>
         </div>
       </div>
-      <div class="page_button">
+      <div class="page_button" v-if="qrcodeVerifyResult">
         <ion-button shape="round" expand="block" @click="onCompany">我是企业</ion-button>
         <ion-button shape="round" expand="block" @click="onJobUser">我是求职者</ion-button>
       </div>
@@ -47,7 +47,7 @@ import {getUserByID} from "@/api/siteUserInfo";
 import {useRouter} from "vue-router";
 import {useUserStore} from "@/store/modules/user";
 import {getConfig} from "@/utils/config";
-
+import {qrcodeVerify} from "@/api/wechat";
 
 const presentAlert = async (message) => {
   const alert = await alertController.create({
@@ -62,45 +62,45 @@ const presentAlert = async (message) => {
 }
 
 const openId = ref("");
+const userId = ref("");
+const qrCodeId = ref("");
 
 export default defineComponent({
   name: "jobUserInfoIndex",
   setup() {
-
     const router = useRouter();
     const user = ref({userNo: '', name: '', IDCard: '', siteName: ''});
     const urlParams = getUrlParams();
-    const userId = urlParams["userId"];
+    const qrcodeVerifyResult = ref(false);
     const isDev = ref(false);
-    const userStore = useUserStore();
-    openId.value = userStore.getOpenId;
+    /*const userStore = useUserStore();
+    openId.value = userStore.getOpenId;*/
 
     const getUser = async function () {
-      const reqData = await getUserByID(userId);
+      const reqData = await getUserByID(userId.value);
       user.value = reqData;
     };
 
+    const getQrcodeVerify = () => {
+      qrcodeVerify(qrCodeId.value, userId.value).then(res => {
+        qrcodeVerifyResult.value = res;
+      });
+    };
+
     const onCompany = function () {
       router.push({
         path: '/jobUserInfo/companyEdit',
-        query: {reload: 1, openId: openId.value, loginUserId: userId, userId: userId}
+        query: {reload: 1, openId: openId.value, loginUserId: userId.value, userId: userId.value}
       });
     };
 
     const onJobUser = function () {
       router.push({
         path: '/jobUserInfo/userEdit',
-        query: {reload: 1, openId: openId.value, status: 1, loginUserId: userId, userId: userId}
+        query: {reload: 1, openId: openId.value, status: 1, loginUserId: userId.value, userId: userId.value}
       });
     };
 
-
-    if (!userId) {
-      presentAlert("驿站工作者信息获取失败");
-    } else {
-      getUser();
-    }
-
     getConfig().then(res => {
       isDev.value = res.isDev;
     }, () => {
@@ -108,7 +108,9 @@ export default defineComponent({
     })
 
     onIonViewDidEnter(() => {
-      openId.value = userStore.getOpenId;
+      openId.value = urlParams["openId"];
+      userId.value = urlParams["userId"];
+      qrCodeId.value = urlParams["qrCodeId"];
     });
 
     return {
@@ -116,12 +118,38 @@ export default defineComponent({
       onCompany,
       onJobUser,
       openId,
-      isDev
+      isDev,
+      qrcodeVerifyResult,
+      userId,
+      qrCodeId,
+      getQrcodeVerify,
+      getUser
     }
   },
+  created() {
+    /*const userStore = useUserStore();*/
+    const urlParams = getUrlParams();
+    openId.value = urlParams["openId"];
+    userId.value = urlParams["userId"];
+    qrCodeId.value = urlParams["qrCodeId"];
+    if (!userId.value) {
+      presentAlert("驿站工作者信息获取失败");
+      return;
+    }
+    if (!qrCodeId.value) {
+      presentAlert("二维码无效或已超出扫码次数");
+      return;
+    }
+
+    /*alert(1111);*/
+
+    this.getUser();
+
+    this.getQrcodeVerify();
+
+  },
   mounted() {
-    const userStore = useUserStore();
-    openId.value = userStore.getOpenId;
+    //
   }
 });
 </script>

+ 12 - 10
h5app/src/views/pages/userQrCode/index.vue

@@ -52,6 +52,9 @@ import {useUserStore} from "../../../store/modules/user";
 import {arrowBackOutline} from 'ionicons/icons';
 import {useRouter} from "vue-router";
 import {getConfig} from "../../../utils/config"
+import {onIonViewDidEnter} from "@ionic/vue";
+import {getQRCodeUrlToBase64} from "../../../api/wechat";
+import {base64ToBlob} from "../../../utils/imageUtils";
 
 const infoQrcodeUrl = ref("");
 
@@ -82,6 +85,15 @@ export default defineComponent({
     // 监听窗口大小变化
     window.addEventListener('resize', updateBrowserWidth);
 
+    onIonViewDidEnter(() => {
+      const qrCodeUrl = "/jobUserInfo/index";
+      getQRCodeUrlToBase64(encodeURIComponent(qrCodeUrl), user.value.userID).then(base64Str => {
+        infoQrcodeUrl.value = URL.createObjectURL(base64ToBlob("data:image/png;base64," + base64Str));
+      }, () => {
+        infoQrcodeUrl.value = "";
+      });
+    });
+
     return {
       infoQrcodeUrl,
       imgStyle,
@@ -89,16 +101,6 @@ export default defineComponent({
       arrowBackOutline,
       onBack
     }
-  },
-  mounted() {
-    const userStore = useUserStore();
-    const user = ref(userStore.getUserInfo);
-    getConfig().then((data) => {
-      const qrCodeUrl = data.webSiteUrl + "/jobUserInfo/index?userId=" + user.value.userID;
-      infoQrcodeUrl.value = data.webApiServiceUrl + "/common/getQRCode?code=" + encodeURIComponent(qrCodeUrl);
-    }, () => {
-      infoQrcodeUrl.value = "";
-    })
   }
 });
 </script>

+ 39 - 11
src/main/java/com/hz/employmentsite/controller/WxController.java

@@ -1,18 +1,22 @@
 package com.hz.employmentsite.controller;
 
+import com.google.zxing.WriterException;
 import com.hz.employmentsite.filter.exception.BaseResponse;
 import com.hz.employmentsite.filter.exception.RespGenerstor;
 import com.hz.employmentsite.services.service.WechatService;
+import com.hz.employmentsite.util.QrCodeUtils;
 import me.chanjar.weixin.common.error.WxErrorException;
 import org.apache.tomcat.util.buf.UDecoder;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
+import java.util.Base64;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -38,9 +42,12 @@ public class WxController {
     @Autowired
     private WechatService wechatService;
 
+    @Autowired
+    private QrCodeUtils qrCodeUtils;
+
     @GetMapping("getOAuthUrl")
     public BaseResponse<String> getOAuthUrl(String redirectUrl) throws UnsupportedEncodingException {
-        return RespGenerstor.success(wechatService.getOAuthUrl(URLDecoder.decode(redirectUrl,"UTF-8")));
+        return RespGenerstor.success(wechatService.getOAuthUrl(URLDecoder.decode(redirectUrl, "UTF-8")));
     }
 
 
@@ -51,14 +58,35 @@ public class WxController {
 
     @PostMapping("/sentMsg")
     public BaseResponse<String> sentMsg() throws Exception {
-        Map<String,String> data = new HashMap<>();
-        data.put("thing28","张三");
-        data.put("phone_number34","134556456456");
-        data.put("thing10","开发");
+        Map<String, String> data = new HashMap<>();
+        data.put("thing28", "张三");
+        data.put("phone_number34", "134556456456");
+        data.put("thing10", "开发");
+
+
+        return RespGenerstor.success(wechatService.sendMsg("ow5Mm61JAlqqNhZzcV9lLqTDnBCs", UUID.randomUUID().toString(), "http://www.bowintek.com/hzyz/mobile/index.html/#/jobUserInfo/index?userId=60ea0d5b-a75c-11ed-a6c5-7085c2a9999e",
+                "-R2xeAeey7rOKN5VAuUr8cFMsJFlFp7ksN7m6H5_5VU", data));
+    }
 
+    @GetMapping("/getQRCodeUrlToBase64")
+    public BaseResponse<String> getQRCodeUrlToBase64(@RequestParam("url") String url, @RequestParam("userId") String userId, @RequestParam(required = false) Integer margin) throws IOException, WriterException {
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        String fullUrl = wechatService.getQrcodeUrl(URLDecoder.decode(url, "UTF-8"), userId);
+
+        qrCodeUtils.getQrCode(bos, fullUrl, margin);
+
+        byte[] bytes = bos.toByteArray();
+        Base64.Encoder encoder = Base64.getEncoder();
+        String base64String = encoder.encodeToString(bytes);
+        bos.close();
+
+        return RespGenerstor.success(base64String);
+    }
 
-        return RespGenerstor.success(wechatService.sendMsg("ow5Mm61JAlqqNhZzcV9lLqTDnBCs", UUID.randomUUID().toString(),"http://www.bowintek.com/hzyz/mobile/index.html/#/jobUserInfo/index?userId=60ea0d5b-a75c-11ed-a6c5-7085c2a9999e",
-                "-R2xeAeey7rOKN5VAuUr8cFMsJFlFp7ksN7m6H5_5VU",data));
+    @GetMapping("qrcodeVerify")
+    public BaseResponse<Boolean> qrcodeVerify(@RequestParam("qrCodeId") String qrCodeId, @RequestParam(required = false) String openId) {
+        return RespGenerstor.success(wechatService.qrcodeVerify(qrCodeId, openId));
     }
 
 }

+ 78 - 4
src/main/java/com/hz/employmentsite/services/impl/WechatServiceImpl.java

@@ -1,12 +1,12 @@
 package com.hz.employmentsite.services.impl;
 
 import com.hz.employmentsite.AppConfig;
-import com.hz.employmentsite.mapper.WxMessagestatusMapper;
-import com.hz.employmentsite.mapper.WxMessagetempsettingFieldMapper;
-import com.hz.employmentsite.mapper.WxMessagetempsettingMapper;
+import com.hz.employmentsite.mapper.*;
 import com.hz.employmentsite.model.*;
 import com.hz.employmentsite.services.service.WechatService;
+import com.hz.employmentsite.util.DateUtils;
 import com.hz.employmentsite.util.StringUtils;
+import com.hz.employmentsite.util.UrlUtils;
 import lombok.extern.slf4j.Slf4j;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.mp.api.WxMpService;
@@ -38,9 +38,21 @@ public class WechatServiceImpl implements WechatService {
     @Autowired
     private WxMessagetempsettingFieldMapper wxMessagetempsettingFieldMapper;
 
+    @Autowired
+    private WxQrcodeMapper wxQrcodeMapper;
+
+    @Autowired
+    private WxQrcodeScanRecordMapper wxQrcodeScanRecordMapper;
+
     @Autowired
     private StringUtils stringUtils;
 
+    @Autowired
+    private DateUtils dateUtils;
+
+    @Autowired
+    private UrlUtils urlUtils;
+
     private final Logger logger;
 
     public WechatServiceImpl() {
@@ -109,7 +121,7 @@ public class WechatServiceImpl implements WechatService {
             throw new Exception("该消息已有成功推送记录,请勿重复推送!");
 
         String sendUrl = "";
-        if(!stringUtils.IsNullOrEmpty(url)){
+        if (!stringUtils.IsNullOrEmpty(url)) {
             sendUrl = appConfig.wxMessageBaseUrl + url;
         }
 
@@ -164,5 +176,67 @@ public class WechatServiceImpl implements WechatService {
         return wxMessagetempsettingFieldMapper.selectByExample(exp);
     }
 
+    @Override
+    public String getQrcodeUrl(String url, String userId) {
+        Date nowDate = dateUtils.formatDateToYYYYMMDD(new Date());
+
+        WxQrcodeExample exp = new WxQrcodeExample();
+        WxQrcodeExample.Criteria cri = exp.or();
+        cri.andUserIdEqualTo(userId);
+        cri.andQrcodeDateEqualTo(nowDate);
+
+        WxQrcode dbData = wxQrcodeMapper.selectByExample(exp).stream().findFirst().orElse(null);
+        if (dbData == null) {
+
+            String qrCodeId = UUID.randomUUID().toString();
+
+            Map<String, String> params = new HashMap<>();
+            params.put("userId", userId);
+            params.put("qrCodeId", qrCodeId);
+            String fullUrl = appConfig.wxMessageBaseUrl + "?redirectUrl=" + urlUtils.getUrl(url, params);
+
+            dbData = new WxQrcode();
+            dbData.setQrcodeId(qrCodeId);
+            dbData.setUserId(userId);
+            dbData.setUrl(fullUrl);
+            dbData.setScanMax(100);
+            dbData.setRecordStatus(1);
+            dbData.setCreateUserID(userId);
+            dbData.setCreateTime(new Date());
+            dbData.setQrcodeDate(nowDate);
+
+            wxQrcodeMapper.insert(dbData);
+        } else {
+            dbData.setModifyTime(new Date());
+            dbData.setModifyUserID(userId);
+        }
+
+        return dbData.getUrl();
+    }
+
+    @Override
+    public Boolean qrcodeVerify(String qrCodeId, String openId) {
+        Integer result = 0;
+
+        WxQrcode wxQrcode = wxQrcodeMapper.selectByPrimaryKey(qrCodeId);
+        WxQrcodeScanRecordExample exp = new WxQrcodeScanRecordExample();
+        WxQrcodeScanRecordExample.Criteria cri = exp.or();
+        cri.andQrcodeIdEqualTo(qrCodeId);
+        if (wxQrcode.getScanMax() <= wxQrcodeScanRecordMapper.selectByExample(exp).size())
+            return false;
+        else {
+            WxQrcodeScanRecord wxQrcodeScanRecord = new WxQrcodeScanRecord();
+            wxQrcodeScanRecord.setQrcodeScanRecordId(UUID.randomUUID().toString());
+            wxQrcodeScanRecord.setQrcodeId(qrCodeId);
+            wxQrcodeScanRecord.setOpenId(openId);
+            wxQrcodeScanRecord.setCreateTime(new Date());
+            wxQrcodeScanRecord.setRecordStatus(1);
+
+            result = wxQrcodeScanRecordMapper.insert(wxQrcodeScanRecord);
+        }
+
+        return result > 0;
+    }
+
 
 }

+ 4 - 0
src/main/java/com/hz/employmentsite/services/service/WechatService.java

@@ -19,4 +19,8 @@ public interface WechatService {
 
     List<WxMessagetempsettingField> getWxMessagetempFieldList(String templateNo);
 
+    String getQrcodeUrl(String url, String userId);
+
+    Boolean qrcodeVerify(String qrCodeId, String openId);
+
 }

+ 34 - 0
src/main/java/com/hz/employmentsite/util/UrlUtils.java

@@ -0,0 +1,34 @@
+package com.hz.employmentsite.util;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Component
+public class UrlUtils {
+
+    @Autowired
+    private StringUtils stringUtils;
+
+    public String getUrl(String url, Map<String, String> params) {
+        if (stringUtils.IsNullOrEmpty(url))
+            return "";
+
+        String fullUrl = url;
+
+        if (fullUrl.indexOf("?") < 0)
+            fullUrl = fullUrl + "?";
+
+        for (Map.Entry<String, String> param : params.entrySet()) {
+            if (!fullUrl.endsWith("?"))
+                fullUrl += "&";
+
+            fullUrl += (param.getKey() + "=" + param.getValue());
+        }
+
+
+        return fullUrl;
+    }
+
+}