Browse Source

Merge remote-tracking branch 'origin/master'

lizeyu 1 year ago
parent
commit
4eb5a82de5

+ 1 - 1
h5app/public/appconfig.json

@@ -1,5 +1,5 @@
 {
   "isDev": true,
   "webSiteUrl": "http://www.bowintek.com/hzyz/mobile/index.html/#",
-  "webApiServiceUrl": "http://www.bowintek.com/hzyz/api"
+  "webApiServiceUrl": ""
 }

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

@@ -56,7 +56,7 @@ public class WxController {
         data.put("keyword3","2014年9月22日");
 
 
-        return RespGenerstor.success(wechatService.sentMsg("admin",data));
+        return RespGenerstor.success(wechatService.sentMsg("admin",data,""));
     }
 
 }

+ 28 - 0
src/main/java/com/hz/employmentsite/jobs/sendWxMessageJob.java

@@ -0,0 +1,28 @@
+package com.hz.employmentsite.jobs;
+
+import com.hz.employmentsite.AppConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+@Slf4j
+public class sendWxMessageJob {
+    @Autowired
+    private AppConfig appConfig;
+
+    @Scheduled(cron="${appconfig.jobconfig.send-wxmessage-cron}")
+    public void syncClassData() {
+        if (appConfig.jobconfig_isRunJob) {
+            log.info("开始推送微信通知");
+            try {
+
+            } catch (Exception e) {
+                log.info("推送微信通知数据错误:" + e.getMessage());
+            }
+            log.info("推送微信通知结束");
+        }
+    }
+
+}

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

@@ -43,7 +43,7 @@ public class WechatServiceImpl implements WechatService {
     }
 
     @Override
-    public Integer sentMsg(String toUserId, Map<String,String> sentData){
+    public Integer sentMsg(String toUserId, Map<String,String> sentData,String url){
         String openId = "";
 
         //数据
@@ -58,7 +58,7 @@ public class WechatServiceImpl implements WechatService {
                 .toUser(openId)//要推送的用户openid
                 .data(data) //数据
                 .templateId(appConfig.wxMessageTemplateId)//模版id
-                .url("http://www.baidu.com") // 点击详情跳转地址
+                .url(url) // 点击详情跳转地址
                 .build();
         //发起推送
         try {

+ 28 - 14
src/main/java/com/hz/employmentsite/services/impl/baseSettings/SiteUserImpl.java

@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.UUID;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 @Service("SiteUserService")
@@ -52,6 +53,11 @@ public class SiteUserImpl implements SiteUserService {
     @Autowired
     private DictionaryService dictionaryService;
 
+    private final String MOBILE_REGEX = "0?(13|14|15|18|17)[0-9]{9}";
+
+    private final String ID_CARD_REGEX = "\\d{17}[\\d|x]|\\d{15}";
+
+
     @Override
     public PageInfo<SiteUserVo> getList(int pageIndex, int pageSize, List<String> siteUserIDList, String siteUserName, String siteID, String roleName, String regionCode, String userNo) {
         PageHelper.startPage(pageIndex, pageSize);
@@ -266,25 +272,33 @@ public class SiteUserImpl implements SiteUserService {
             if (stringUtils.IsNullOrEmpty(item.mobile)) {
                 errorInfo += "请填写联系电话!";
             } else {
-                String siteUserID = pcSiteUsers.stream()
-                        .filter(it -> it.getMobile() != null && it.getMobile().equals(item.getMobile().trim()))
-                        .findFirst()
-                        .orElse(new PcSiteUser())
-                        .getSiteUserID();
-                if (!stringUtils.IsNullOrEmpty(siteUserID)) {
-                    errorInfo += "联系电话已绑定其他驿站人员!";
+                if (Pattern.matches(MOBILE_REGEX, item.mobile)) {
+                    String siteUserID = pcSiteUsers.stream()
+                            .filter(it -> it.getMobile() != null && it.getMobile().equals(item.getMobile().trim()))
+                            .findFirst()
+                            .orElse(new PcSiteUser())
+                            .getSiteUserID();
+                    if (!stringUtils.IsNullOrEmpty(siteUserID)) {
+                        errorInfo += "联系电话已绑定其他驿站人员!";
+                    }
+                } else {
+                    errorInfo += "联系电话格式错误!";
                 }
             }
             if (stringUtils.IsNullOrEmpty(item.idCard)) {
                 errorInfo += "请填写身份证号码!";
             } else {
-                String siteUserID = pcSiteUsers.stream()
-                        .filter(it -> it.getIDCard() != null && it.getIDCard().equals(item.getIdCard().trim()))
-                        .findFirst()
-                        .orElse(new PcSiteUser())
-                        .getSiteUserID();
-                if (!stringUtils.IsNullOrEmpty(siteUserID)) {
-                    errorInfo += "身份证已绑定其他驿站人员!";
+                if (Pattern.matches(ID_CARD_REGEX, item.idCard)) {
+                    String siteUserID = pcSiteUsers.stream()
+                            .filter(it -> it.getIDCard() != null && it.getIDCard().equals(item.getIdCard().trim()))
+                            .findFirst()
+                            .orElse(new PcSiteUser())
+                            .getSiteUserID();
+                    if (!stringUtils.IsNullOrEmpty(siteUserID)) {
+                        errorInfo += "身份证已绑定其他驿站人员!";
+                    }
+                } else {
+                    errorInfo += "身份证格式错误!";
                 }
             }
             if (stringUtils.IsNullOrEmpty(item.roleName)) {

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

@@ -8,7 +8,7 @@ public interface WechatService {
 
     String getOAuthUrl(String redirectUrl);
 
-    Integer sentMsg(String toUserId, Map<String,String> sentData);
+    Integer sentMsg(String toUserId, Map<String,String> sentData,String url);
 
     String getOpenId(String code) throws WxErrorException;
 

+ 1 - 0
src/main/resources/application.yml

@@ -103,6 +103,7 @@ appconfig:
     class-cron: '0 0 5 1 * ?'
     student-cron: '0 0 6 1 * ?'
     teacher-cron: '0 0 7 1 * ?'
+    send-wxmessage-cron: '0 0/5 * * * ?'
 
   #同步教务系统组织结构数据配置
   educonfig:

src/main/resources/static/doc/template/驿站站点人员导入模板.xlsx → src/main/resources/static/doc/template/站点人员导入模板.xlsx


+ 1 - 1
vue/src/views/baseSettings/siteUser/index.vue

@@ -127,7 +127,7 @@ export default defineComponent({
         {cnName: '所属驿站', enName: 'siteName', width: 100},
       ],
       template: {
-        tempFileName: '站点人员信息导入模板.xlsx',
+        tempFileName: '站点人员导入模板.xlsx',
         url: '',
         params: null,
       },