Commit 81cae9e24a31251c314f18649818180c78d77b6c
1 parent
6398a6ab
Exists in
master
考勤推送
Showing
22 changed files
with
840 additions
and
6 deletions
Show diff stats
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/KqTeacherDto.java
0 → 100644
@@ -0,0 +1,90 @@ | @@ -0,0 +1,90 @@ | ||
1 | +package com.sincere.common.dto.smartCampus; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author chen | ||
5 | + * @version 1.0 | ||
6 | + * @date 2019/11/28 0028 9:10 | ||
7 | + */ | ||
8 | +public class KqTeacherDto { | ||
9 | + private String userId ; | ||
10 | + private int schoolId ; | ||
11 | + private String name ; | ||
12 | + private String mobile ; | ||
13 | + private String pass ; | ||
14 | + private String DingUserId ; | ||
15 | + private String weChatUserId ; | ||
16 | + private String xSTOpenId ; | ||
17 | + private String face ; | ||
18 | + | ||
19 | + public String getUserId() { | ||
20 | + return userId; | ||
21 | + } | ||
22 | + | ||
23 | + public void setUserId(String userId) { | ||
24 | + this.userId = userId; | ||
25 | + } | ||
26 | + | ||
27 | + public int getSchoolId() { | ||
28 | + return schoolId; | ||
29 | + } | ||
30 | + | ||
31 | + public void setSchoolId(int schoolId) { | ||
32 | + this.schoolId = schoolId; | ||
33 | + } | ||
34 | + | ||
35 | + public String getName() { | ||
36 | + return name; | ||
37 | + } | ||
38 | + | ||
39 | + public void setName(String name) { | ||
40 | + this.name = name; | ||
41 | + } | ||
42 | + | ||
43 | + public String getMobile() { | ||
44 | + return mobile; | ||
45 | + } | ||
46 | + | ||
47 | + public void setMobile(String mobile) { | ||
48 | + this.mobile = mobile; | ||
49 | + } | ||
50 | + | ||
51 | + public String getPass() { | ||
52 | + return pass; | ||
53 | + } | ||
54 | + | ||
55 | + public void setPass(String pass) { | ||
56 | + this.pass = pass; | ||
57 | + } | ||
58 | + | ||
59 | + public String getDingUserId() { | ||
60 | + return DingUserId; | ||
61 | + } | ||
62 | + | ||
63 | + public void setDingUserId(String dingUserId) { | ||
64 | + DingUserId = dingUserId; | ||
65 | + } | ||
66 | + | ||
67 | + public String getWeChatUserId() { | ||
68 | + return weChatUserId; | ||
69 | + } | ||
70 | + | ||
71 | + public void setWeChatUserId(String weChatUserId) { | ||
72 | + this.weChatUserId = weChatUserId; | ||
73 | + } | ||
74 | + | ||
75 | + public String getxSTOpenId() { | ||
76 | + return xSTOpenId; | ||
77 | + } | ||
78 | + | ||
79 | + public void setxSTOpenId(String xSTOpenId) { | ||
80 | + this.xSTOpenId = xSTOpenId; | ||
81 | + } | ||
82 | + | ||
83 | + public String getFace() { | ||
84 | + return face; | ||
85 | + } | ||
86 | + | ||
87 | + public void setFace(String face) { | ||
88 | + this.face = face; | ||
89 | + } | ||
90 | +} |
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/TemplateDto.java
0 → 100644
@@ -0,0 +1,39 @@ | @@ -0,0 +1,39 @@ | ||
1 | +package com.sincere.common.dto.smartCampus; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | + | ||
5 | +/** | ||
6 | + * @author chen | ||
7 | + * @version 1.0 | ||
8 | + * @date 2019/11/28 0028 8:29 | ||
9 | + */ | ||
10 | +public class TemplateDto implements Serializable { | ||
11 | + | ||
12 | + private String config ; | ||
13 | + private int schoolId ; | ||
14 | + private String type ; | ||
15 | + | ||
16 | + public String getConfig() { | ||
17 | + return config; | ||
18 | + } | ||
19 | + | ||
20 | + public void setConfig(String config) { | ||
21 | + this.config = config; | ||
22 | + } | ||
23 | + | ||
24 | + public int getSchoolId() { | ||
25 | + return schoolId; | ||
26 | + } | ||
27 | + | ||
28 | + public void setSchoolId(int schoolId) { | ||
29 | + this.schoolId = schoolId; | ||
30 | + } | ||
31 | + | ||
32 | + public String getType() { | ||
33 | + return type; | ||
34 | + } | ||
35 | + | ||
36 | + public void setType(String type) { | ||
37 | + this.type = type; | ||
38 | + } | ||
39 | +} |
cloud/common/src/main/java/com/sincere/common/util/DateUtils.java
@@ -2,6 +2,7 @@ package com.sincere.common.util; | @@ -2,6 +2,7 @@ package com.sincere.common.util; | ||
2 | 2 | ||
3 | import java.text.ParseException; | 3 | import java.text.ParseException; |
4 | import java.text.SimpleDateFormat; | 4 | import java.text.SimpleDateFormat; |
5 | +import java.util.Calendar; | ||
5 | import java.util.Date; | 6 | import java.util.Date; |
6 | 7 | ||
7 | /** | 8 | /** |
@@ -11,7 +12,7 @@ import java.util.Date; | @@ -11,7 +12,7 @@ import java.util.Date; | ||
11 | */ | 12 | */ |
12 | public class DateUtils { | 13 | public class DateUtils { |
13 | 14 | ||
14 | - public static String format = "yyyy"; | 15 | + public static String format = "yyyyMM"; |
15 | 16 | ||
16 | public static String format1 = "yyyy-MM-dd"; | 17 | public static String format1 = "yyyy-MM-dd"; |
17 | 18 | ||
@@ -64,4 +65,11 @@ public class DateUtils { | @@ -64,4 +65,11 @@ public class DateUtils { | ||
64 | return difference; | 65 | return difference; |
65 | } | 66 | } |
66 | 67 | ||
68 | + public static int getWeek(){ | ||
69 | + Date today = new Date(); | ||
70 | + Calendar c = Calendar.getInstance(); | ||
71 | + c.setTime(today); | ||
72 | + int weekday = c.get(Calendar.DAY_OF_WEEK); | ||
73 | + return weekday-1 ; | ||
74 | + } | ||
67 | } | 75 | } |
cloud/pom.xml
@@ -30,7 +30,8 @@ | @@ -30,7 +30,8 @@ | ||
30 | <module>mypulsar</module> | 30 | <module>mypulsar</module> |
31 | <module>weigeng</module> | 31 | <module>weigeng</module> |
32 | <module>independence</module> | 32 | <module>independence</module> |
33 | -<!-- <module>test</module>--> | 33 | + <module>quartz</module> |
34 | + <!-- <module>test</module>--> | ||
34 | </modules> | 35 | </modules> |
35 | 36 | ||
36 | <properties> | 37 | <properties> |
@@ -0,0 +1,80 @@ | @@ -0,0 +1,80 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
5 | + <parent> | ||
6 | + <artifactId>cloud</artifactId> | ||
7 | + <groupId>com.sincere</groupId> | ||
8 | + <version>1.0.0</version> | ||
9 | + </parent> | ||
10 | + <modelVersion>4.0.0</modelVersion> | ||
11 | + | ||
12 | + <artifactId>quartz</artifactId> | ||
13 | + | ||
14 | + <dependencies> | ||
15 | + <dependency> | ||
16 | + <groupId>com.sincere</groupId> | ||
17 | + <artifactId>common</artifactId> | ||
18 | + <version>1.0.0</version> | ||
19 | + </dependency> | ||
20 | + <dependency> | ||
21 | + <groupId>org.springframework.boot</groupId> | ||
22 | + <artifactId>spring-boot-starter-quartz</artifactId> | ||
23 | + </dependency> | ||
24 | + <dependency> | ||
25 | + <groupId>org.springframework.boot</groupId> | ||
26 | + <artifactId>spring-boot-starter-test</artifactId> | ||
27 | + <scope>test</scope> | ||
28 | + </dependency> | ||
29 | + <dependency> | ||
30 | + <groupId>org.springframework.cloud</groupId> | ||
31 | + <artifactId>spring-cloud-starter-feign</artifactId> | ||
32 | + <version>1.3.6.RELEASE</version> | ||
33 | + </dependency> | ||
34 | + <dependency> | ||
35 | + <groupId>org.springframework.cloud</groupId> | ||
36 | + <artifactId>spring-cloud-openfeign-core</artifactId> | ||
37 | + <version>2.1.2.RELEASE</version> | ||
38 | + </dependency> | ||
39 | + <dependency> | ||
40 | + <groupId>org.apache.commons</groupId> | ||
41 | + <artifactId>commons-lang3</artifactId> | ||
42 | + <version>3.3.2</version> | ||
43 | + </dependency> | ||
44 | + <dependency> | ||
45 | + <groupId>org.mybatis.spring.boot</groupId> | ||
46 | + <artifactId>mybatis-spring-boot-starter</artifactId> | ||
47 | + <version>1.3.0</version> | ||
48 | + </dependency> | ||
49 | + <dependency> | ||
50 | + <groupId>com.microsoft.sqlserver</groupId> | ||
51 | + <artifactId>mssql-jdbc</artifactId> | ||
52 | + <version>6.4.0.jre8</version> | ||
53 | + </dependency> | ||
54 | + </dependencies> | ||
55 | + | ||
56 | + <dependencyManagement> | ||
57 | + <dependencies> | ||
58 | + <dependency> | ||
59 | + <groupId>org.springframework.cloud</groupId> | ||
60 | + <artifactId>spring-cloud-dependencies</artifactId> | ||
61 | + <version>${spring-cloud.version}</version> | ||
62 | + <type>pom</type> | ||
63 | + <scope>import</scope> | ||
64 | + </dependency> | ||
65 | + </dependencies> | ||
66 | + </dependencyManagement> | ||
67 | + | ||
68 | + <build> | ||
69 | + <plugins> | ||
70 | + <plugin> | ||
71 | + <groupId>org.springframework.boot</groupId> | ||
72 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
73 | + <configuration> | ||
74 | + <includeSystemScope>true</includeSystemScope> | ||
75 | + </configuration> | ||
76 | + </plugin> | ||
77 | + | ||
78 | + </plugins> | ||
79 | + </build> | ||
80 | +</project> | ||
0 | \ No newline at end of file | 81 | \ No newline at end of file |
cloud/quartz/src/main/java/com/sincere/quartz/QuartzApplication.java
0 → 100644
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +package com.sincere.quartz; | ||
2 | + | ||
3 | +import org.mybatis.spring.annotation.MapperScan; | ||
4 | +import org.springframework.boot.SpringApplication; | ||
5 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
6 | +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | ||
7 | +import org.springframework.cloud.openfeign.EnableFeignClients; | ||
8 | +import org.springframework.scheduling.annotation.EnableScheduling; | ||
9 | + | ||
10 | +/** | ||
11 | + * @author chen | ||
12 | + * @version 1.0 | ||
13 | + * @date 2019/11/27 0027 14:24 | ||
14 | + */ | ||
15 | +@EnableScheduling | ||
16 | +@EnableFeignClients(basePackages = "com.sincere.quartz.feign") | ||
17 | +@EnableEurekaClient | ||
18 | +@SpringBootApplication | ||
19 | +@MapperScan("com.sincere.quartz.mapper") | ||
20 | +public class QuartzApplication { | ||
21 | + | ||
22 | + public static void main(String[] args) { | ||
23 | + SpringApplication.run(QuartzApplication.class, args); | ||
24 | + } | ||
25 | +} |
cloud/quartz/src/main/java/com/sincere/quartz/feign/ScFeign.java
0 → 100644
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +package com.sincere.quartz.feign; | ||
2 | + | ||
3 | +import com.sincere.common.dto.smartCampus.KqTeacherDto; | ||
4 | +import com.sincere.common.dto.smartCampus.TemplateDto; | ||
5 | +import org.springframework.cloud.openfeign.FeignClient; | ||
6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
8 | +import org.springframework.web.bind.annotation.RequestParam; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +/** | ||
13 | + * @author chen | ||
14 | + * @version 1.0 | ||
15 | + * @date 2019/11/28 0028 9:17 | ||
16 | + */ | ||
17 | +@FeignClient("smartCampusSearch") | ||
18 | +public interface ScFeign { | ||
19 | + | ||
20 | + @RequestMapping(value = "/sm/kq/getAllTemplate",method = RequestMethod.GET) | ||
21 | + List<TemplateDto> getAllTemplate(); | ||
22 | + | ||
23 | + @RequestMapping(value = "/sm/kq/getTeacherList",method = RequestMethod.GET) | ||
24 | + List<KqTeacherDto> getTeacherList(@RequestParam("schoolId")int schoolId); | ||
25 | +} |
cloud/quartz/src/main/java/com/sincere/quartz/job/QDService.java
0 → 100644
@@ -0,0 +1,131 @@ | @@ -0,0 +1,131 @@ | ||
1 | +package com.sincere.quartz.job; | ||
2 | + | ||
3 | +import com.sincere.common.dto.smartCampus.KqTeacherDto; | ||
4 | +import com.sincere.common.dto.smartCampus.TemplateDto; | ||
5 | +import com.sincere.common.util.DateUtils; | ||
6 | +import com.sincere.quartz.feign.ScFeign; | ||
7 | +import com.sincere.quartz.mapper.SmsMapper; | ||
8 | +import com.sincere.quartz.model.DingSms; | ||
9 | +import com.sincere.quartz.model.WeChatSms; | ||
10 | +import org.apache.commons.lang3.StringUtils; | ||
11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
12 | +import org.springframework.scheduling.annotation.Scheduled; | ||
13 | +import org.springframework.stereotype.Service; | ||
14 | + | ||
15 | +import java.util.*; | ||
16 | + | ||
17 | +/** | ||
18 | + * @author chen | ||
19 | + * @version 1.0 | ||
20 | + * @date 2019/11/27 0027 17:05 | ||
21 | + */ | ||
22 | +@Service | ||
23 | +public class QDService { | ||
24 | + | ||
25 | + @Autowired | ||
26 | + ScFeign scFeign ; | ||
27 | + | ||
28 | + @Autowired | ||
29 | + SmsMapper smsMapper; | ||
30 | + | ||
31 | + private static String date ; | ||
32 | + private static Map<String , String> map = new HashMap<>(); | ||
33 | + | ||
34 | + @Scheduled(cron = "0/10 * * * * ?") | ||
35 | + public void kaoQing() { | ||
36 | + String now = DateUtils.date2String(new Date(),DateUtils.format1) ; | ||
37 | + if(StringUtils.isBlank(date)){ | ||
38 | + initMap(); | ||
39 | + date = now ; | ||
40 | + } | ||
41 | + if(!DateUtils.date2String(new Date(),DateUtils.format1).equals(date)){ | ||
42 | + initMap(); | ||
43 | + date = DateUtils.date2String(new Date(),DateUtils.format1) ; | ||
44 | + } | ||
45 | + //开始过滤数据 推送 | ||
46 | + List<String> keyList = new ArrayList<>(); | ||
47 | + for(Map.Entry<String, String> entity : map.entrySet()){ | ||
48 | + String endTime = entity.getValue().split("_")[1]; | ||
49 | + if(DateUtils.getDateDifference(new Date(),DateUtils.string2Date(now+" "+endTime+":00",DateUtils.format2),"s")>0){ | ||
50 | + String key = entity.getKey(); | ||
51 | + String[] messageArray = key.split("_"); | ||
52 | + List<KqTeacherDto> list = scFeign.getTeacherList(Integer.valueOf(messageArray[1])); | ||
53 | + if(messageArray[2].contains("4")){ | ||
54 | + weChatPush(list,entity.getValue()); | ||
55 | + } | ||
56 | + if(messageArray[2].contains("5")){ | ||
57 | + dingPush(list,entity.getValue()); | ||
58 | + } | ||
59 | + keyList.add(key); | ||
60 | + } | ||
61 | + } | ||
62 | + for(String key : keyList){ | ||
63 | + map.remove(key); | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | + private void initMap(){ | ||
68 | + List<TemplateDto> list = scFeign.getAllTemplate(); | ||
69 | + for(TemplateDto templateDto : list){ | ||
70 | + String config = templateDto.getConfig(); | ||
71 | + String[] array = config.split("<Template"); | ||
72 | + for(int i = 1 ; i<array.length ;i++){ | ||
73 | + String msg = array[i]; | ||
74 | + String beginTime = msg.substring(msg.indexOf("BeginTime")+11,msg.indexOf("BeginTime")+16); | ||
75 | + String endTime = msg.substring(msg.indexOf("EndTime")+9,msg.indexOf("EndTime")+14); | ||
76 | + String templateId = msg.substring(msg.indexOf("TemplateID")+12,msg.indexOf("TemplateID")+22); | ||
77 | + String Week = msg.substring(msg.indexOf("Week")+6,msg.indexOf("Week")+19); | ||
78 | + int nowWeek = DateUtils.getWeek() ; | ||
79 | + if(Week.contains(nowWeek+"")){ | ||
80 | + map.put(templateId+"_"+templateDto.getSchoolId()+"_"+templateDto.getType() , beginTime+"_"+endTime); | ||
81 | + } | ||
82 | + } | ||
83 | + } | ||
84 | + } | ||
85 | + | ||
86 | + private void dingPush(List<KqTeacherDto> list , String key){ | ||
87 | + String[] times = key.split("_"); | ||
88 | + String Date = DateUtils.date2String(new Date(),DateUtils.format1); | ||
89 | + String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); | ||
90 | + for(KqTeacherDto teacher : list){ | ||
91 | + if(StringUtils.isNotBlank(teacher.getDingUserId()) && teacher.getName().equals("陈杰")){ | ||
92 | + DingSms dingSms = new DingSms(); | ||
93 | + dingSms.setTableName("DingSmsNew"+tableSuffix); | ||
94 | + dingSms.setMsg("{\"title\":\"请查看签到信息\",\"form\":[{\"key\":\"开始时间:\",\"value\":\"" + | ||
95 | + Date+" "+times[0]+"\"},{\"key\":\"结束时间:\",\"value\":\""+Date+" "+times[1]+"\"}]}"); | ||
96 | + dingSms.setSchoolId(teacher.getSchoolId()); | ||
97 | + dingSms.setDingUserId(teacher.getDingUserId()); | ||
98 | + dingSms.setAgentId("314950914"); //智能校卫 | ||
99 | + String wapUrl = "http://campus.myjxt.com/studentRecord/znxwwebapp/index.html?" + | ||
100 | + "schoolid="+teacher.getSchoolId()+"&userId="+teacher.getUserId()+"&name="+teacher.getName()+ | ||
101 | + "&data="+teacher.getDingUserId()+"&type=1&stype=4&mobile="+teacher.getMobile()+"&pass="+teacher.getPass()+ | ||
102 | + "&face=&sourcetype=16&soutype=3×tamp="+ DateUtils.getDate() ; | ||
103 | + dingSms.setWapUrl(wapUrl); | ||
104 | + //smsMapper.insertDing(dingSms); | ||
105 | + } | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + private void weChatPush(List<KqTeacherDto> list , String key){ | ||
110 | + String[] times = key.split("_"); | ||
111 | + String Date = DateUtils.date2String(new Date(),DateUtils.format1); | ||
112 | + String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); | ||
113 | + for(KqTeacherDto teacher : list){ | ||
114 | + if(StringUtils.isNotBlank(teacher.getxSTOpenId()) && teacher.getName().equals("陶汉栋")){ | ||
115 | + WeChatSms weChatSms = new WeChatSms(); | ||
116 | + weChatSms.setTableName("wxSmsNew"+tableSuffix); | ||
117 | + weChatSms.setSchoolId(teacher.getSchoolId()); | ||
118 | + weChatSms.setName(teacher.getName()); | ||
119 | + weChatSms.setxSTOpenId(teacher.getxSTOpenId()); | ||
120 | + String msgUrl = "http://campus.myjxt.com/studentRecord/znxwwebapp/index.html?" + | ||
121 | + "schoolid="+teacher.getSchoolId()+"&userId="+teacher.getUserId()+"&name="+teacher.getName()+ | ||
122 | + "&data="+teacher.getWeChatUserId()+"&type=1&stype=3&mobile="+teacher.getMobile()+"&pass="+teacher.getPass()+ | ||
123 | + "&face="+ teacher.getFace() +"&sourcetype=16&soutype=2×tamp="+ DateUtils.getDate() ; | ||
124 | + weChatSms.setMsgUrl(msgUrl); | ||
125 | + weChatSms.setMsg("{\"title\":\"请查看签到信息\",\"form\":[{\"key\":\"开始时间:\",\"value\":\"" + | ||
126 | + Date+" "+times[0]+"\"},{\"key\":\"结束时间:\",\"value\":\""+Date+" "+times[1]+"\"}]}"); | ||
127 | + smsMapper.insertWeChat(weChatSms); | ||
128 | + } | ||
129 | + } | ||
130 | + } | ||
131 | +} |
cloud/quartz/src/main/java/com/sincere/quartz/mapper/SmsMapper.java
0 → 100644
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +package com.sincere.quartz.mapper; | ||
2 | + | ||
3 | +import com.sincere.quartz.model.DingSms; | ||
4 | +import com.sincere.quartz.model.WeChatSms; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author chen | ||
8 | + * @version 1.0 | ||
9 | + * @date 2019/11/28 0028 13:52 | ||
10 | + */ | ||
11 | +public interface SmsMapper { | ||
12 | + | ||
13 | + int insertDing(DingSms dingSms); | ||
14 | + | ||
15 | + int insertWeChat(WeChatSms weChatSms); | ||
16 | +} |
cloud/quartz/src/main/java/com/sincere/quartz/model/DingSms.java
0 → 100644
@@ -0,0 +1,64 @@ | @@ -0,0 +1,64 @@ | ||
1 | +package com.sincere.quartz.model; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author chen | ||
5 | + * @version 1.0 | ||
6 | + * @date 2019/11/28 0028 9:45 | ||
7 | + */ | ||
8 | +public class DingSms { | ||
9 | + private String tableName ; | ||
10 | + | ||
11 | + private String msg ; | ||
12 | + private int schoolId ; | ||
13 | + private String dingUserId ; | ||
14 | + private String wapUrl ; | ||
15 | + private String agentId ; | ||
16 | + | ||
17 | + public String getTableName() { | ||
18 | + return tableName; | ||
19 | + } | ||
20 | + | ||
21 | + public void setTableName(String tableName) { | ||
22 | + this.tableName = tableName; | ||
23 | + } | ||
24 | + | ||
25 | + public String getMsg() { | ||
26 | + return msg; | ||
27 | + } | ||
28 | + | ||
29 | + public void setMsg(String msg) { | ||
30 | + this.msg = msg; | ||
31 | + } | ||
32 | + | ||
33 | + public int getSchoolId() { | ||
34 | + return schoolId; | ||
35 | + } | ||
36 | + | ||
37 | + public void setSchoolId(int schoolId) { | ||
38 | + this.schoolId = schoolId; | ||
39 | + } | ||
40 | + | ||
41 | + public String getDingUserId() { | ||
42 | + return dingUserId; | ||
43 | + } | ||
44 | + | ||
45 | + public void setDingUserId(String dingUserId) { | ||
46 | + this.dingUserId = dingUserId; | ||
47 | + } | ||
48 | + | ||
49 | + public String getWapUrl() { | ||
50 | + return wapUrl; | ||
51 | + } | ||
52 | + | ||
53 | + public void setWapUrl(String wapUrl) { | ||
54 | + this.wapUrl = wapUrl; | ||
55 | + } | ||
56 | + | ||
57 | + public String getAgentId() { | ||
58 | + return agentId; | ||
59 | + } | ||
60 | + | ||
61 | + public void setAgentId(String agentId) { | ||
62 | + this.agentId = agentId; | ||
63 | + } | ||
64 | +} |
cloud/quartz/src/main/java/com/sincere/quartz/model/WeChatSms.java
0 → 100644
@@ -0,0 +1,65 @@ | @@ -0,0 +1,65 @@ | ||
1 | +package com.sincere.quartz.model; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author chen | ||
5 | + * @version 1.0 | ||
6 | + * @date 2019/11/28 0028 10:09 | ||
7 | + */ | ||
8 | +public class WeChatSms { | ||
9 | + | ||
10 | + private String tableName ; | ||
11 | + | ||
12 | + private int schoolId ; | ||
13 | + private String msgUrl ; | ||
14 | + private String msg ; | ||
15 | + private String name ; | ||
16 | + private String xSTOpenId ; | ||
17 | + | ||
18 | + public String getTableName() { | ||
19 | + return tableName; | ||
20 | + } | ||
21 | + | ||
22 | + public void setTableName(String tableName) { | ||
23 | + this.tableName = tableName; | ||
24 | + } | ||
25 | + | ||
26 | + public int getSchoolId() { | ||
27 | + return schoolId; | ||
28 | + } | ||
29 | + | ||
30 | + public void setSchoolId(int schoolId) { | ||
31 | + this.schoolId = schoolId; | ||
32 | + } | ||
33 | + | ||
34 | + public String getMsgUrl() { | ||
35 | + return msgUrl; | ||
36 | + } | ||
37 | + | ||
38 | + public void setMsgUrl(String msgUrl) { | ||
39 | + this.msgUrl = msgUrl; | ||
40 | + } | ||
41 | + | ||
42 | + public String getMsg() { | ||
43 | + return msg; | ||
44 | + } | ||
45 | + | ||
46 | + public void setMsg(String msg) { | ||
47 | + this.msg = msg; | ||
48 | + } | ||
49 | + | ||
50 | + public String getName() { | ||
51 | + return name; | ||
52 | + } | ||
53 | + | ||
54 | + public void setName(String name) { | ||
55 | + this.name = name; | ||
56 | + } | ||
57 | + | ||
58 | + public String getxSTOpenId() { | ||
59 | + return xSTOpenId; | ||
60 | + } | ||
61 | + | ||
62 | + public void setxSTOpenId(String xSTOpenId) { | ||
63 | + this.xSTOpenId = xSTOpenId; | ||
64 | + } | ||
65 | +} |
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +server: | ||
2 | + port: 9001 | ||
3 | + | ||
4 | +spring: | ||
5 | + application: | ||
6 | + name: quartz-server | ||
7 | + datasource: | ||
8 | + username: sa | ||
9 | + password: qaz!@#0401 | ||
10 | + url: jdbc:sqlserver://60.190.202.38:49469;database=XST | ||
11 | + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | ||
12 | +##mybatis | ||
13 | +mybatis: | ||
14 | + mapper-locations: classpath:mapper/*.xml | ||
15 | + type-aliases-package: com.sincere.quartz.mapper | ||
16 | + check-config-location: true | ||
17 | + | ||
18 | +eureka: | ||
19 | + instance: | ||
20 | + hostname: localhost | ||
21 | + lease-expiration-duration-in-seconds: 60 | ||
22 | + lease-renewal-interval-in-seconds: 10 | ||
23 | + client: | ||
24 | + service-url: | ||
25 | + # defaultZone: http://localhost:8761/eureka/ | ||
26 | + defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ | ||
27 | + |
@@ -0,0 +1,61 @@ | @@ -0,0 +1,61 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<configuration debug="true"> | ||
3 | + <!-- 项目名称 --> | ||
4 | + <property name="PROJECT_NAME" value="schedule" /> | ||
5 | + | ||
6 | + <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> | ||
7 | + <!-- <property name="LOG_HOME" value="/opt/web/log/" />--> | ||
8 | + <property name="LOG_HOME" value="C://smartCampus_java//log"/> | ||
9 | + | ||
10 | + <!-- 控制台输出 --> | ||
11 | + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | ||
12 | + <!--<withJansi>true</withJansi>--> | ||
13 | + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
14 | + <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> | ||
15 | + <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %highlight([%-5level] %logger{50} - %msg%n)</pattern> | ||
16 | + <charset>UTF-8</charset> | ||
17 | + </encoder> | ||
18 | + </appender> | ||
19 | + | ||
20 | + <!-- 按照每天生成日志文件 --> | ||
21 | + <appender name="SYSTEM_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
22 | + <!-- 过滤器,只打印ERROR级别的日志 --> | ||
23 | + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||
24 | + <!--日志文件输出的文件名--> | ||
25 | + <FileNamePattern>${LOG_HOME}/${PROJECT_NAME}.system-dev.%d{yyyy-MM-dd HH}.%i.log</FileNamePattern> | ||
26 | + <!--日志文件保留天数--> | ||
27 | + <MaxHistory>30</MaxHistory> | ||
28 | + <!--日志文件最大的大小--> | ||
29 | + <MaxFileSize>100MB</MaxFileSize> | ||
30 | + </rollingPolicy> | ||
31 | + | ||
32 | + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | ||
33 | + <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> | ||
34 | + <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n</pattern> | ||
35 | + <charset>UTF-8</charset> | ||
36 | + </encoder> | ||
37 | + </appender> | ||
38 | + <logger name="system_error" additivity="true"> | ||
39 | + <appender-ref ref="SYSTEM_FILE"/> | ||
40 | + </logger> | ||
41 | + | ||
42 | + <!-- 设置Spring&Hibernate日志输出级别 --> | ||
43 | + <logger name="org.springframework" level="WARN" /> | ||
44 | + <logger name="org.mybatis" level="WARN" /> | ||
45 | + <logger name="com.ibatis" level="DEBUG" /> | ||
46 | + <logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG" /> | ||
47 | + <logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG" /> | ||
48 | + <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" level="DEBUG" /> | ||
49 | + | ||
50 | + | ||
51 | + <logger name="java.sql.Connection" level="DEBUG" /> | ||
52 | + <logger name="java.sql.Statement" level="DEBUG" /> | ||
53 | + <logger name="java.sql.PreparedStatement" level="DEBUG" /> | ||
54 | + <logger name="com.sincere.smartSearch.mapper" level="DEBUG" /> | ||
55 | + <!-- 开发环境下的日志配置 --> | ||
56 | + <root level="ERROR"> | ||
57 | + <appender-ref ref="CONSOLE" /> | ||
58 | + <appender-ref ref="SYSTEM_FILE" /> | ||
59 | + </root> | ||
60 | + | ||
61 | +</configuration> |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.sincere.quartz.mapper.SmsMapper"> | ||
4 | + | ||
5 | + <insert id="insertDing" parameterType="com.sincere.quartz.model.DingSms"> | ||
6 | + insert into ${tableName} (Msg,SchoolID,Type,Status,intime,sendtime,DingUserId,WapUrl,agentid) | ||
7 | + values (#{msg},#{schoolId},2,0,GETDATE(),GETDATE(),#{dingUserId},#{wapUrl},#{agentId}) | ||
8 | + </insert> | ||
9 | + | ||
10 | + <insert id="insertWeChat" parameterType="com.sincere.quartz.model.WeChatSms"> | ||
11 | + insert into ${tableName} (SchoolID,MsgUrl,Status,OpenID,intime,sendTime,Msg,Name) | ||
12 | + values (#{schoolId},#{msgUrl},0,#{xSTOpenId},GETDATE(),GETDATE(),#{msg},#{name}) | ||
13 | + </insert> | ||
14 | +</mapper> |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/KqController.java
0 → 100644
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +package com.sincere.smartSearch.controller; | ||
2 | + | ||
3 | +import com.sincere.common.dto.smartCampus.KqTeacherDto; | ||
4 | +import com.sincere.common.dto.smartCampus.TemplateDto; | ||
5 | +import com.sincere.smartSearch.model.KqTemplate; | ||
6 | +import com.sincere.smartSearch.service.KqService; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
9 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
10 | +import org.springframework.web.bind.annotation.RequestParam; | ||
11 | +import org.springframework.web.bind.annotation.RestController; | ||
12 | + | ||
13 | +import java.util.ArrayList; | ||
14 | +import java.util.List; | ||
15 | + | ||
16 | +/** | ||
17 | + * @author chen | ||
18 | + * @version 1.0 | ||
19 | + * @date 2019/11/28 0028 8:28 | ||
20 | + */ | ||
21 | +@RestController | ||
22 | +@RequestMapping("/sm/kq") | ||
23 | +public class KqController { | ||
24 | + | ||
25 | + @Autowired | ||
26 | + KqService kqService ; | ||
27 | + | ||
28 | + @RequestMapping(value = "getAllTemplate",method = RequestMethod.GET) | ||
29 | + public List<TemplateDto> getAllTemplate(){ | ||
30 | + List<KqTemplate> list = kqService.selectKqTemplate(); | ||
31 | + List<TemplateDto> templateDtos = new ArrayList<>(); | ||
32 | + for(KqTemplate kqTemplate : list){ | ||
33 | + TemplateDto templateDto = new TemplateDto(); | ||
34 | + templateDto.setConfig(kqTemplate.getConfig()); | ||
35 | + templateDto.setSchoolId(kqTemplate.getSchoolId()); | ||
36 | + templateDto.setType(kqTemplate.getType()); | ||
37 | + templateDtos.add(templateDto); | ||
38 | + } | ||
39 | + return templateDtos; | ||
40 | + } | ||
41 | + | ||
42 | + | ||
43 | + @RequestMapping(value = "getTeacherList",method = RequestMethod.GET) | ||
44 | + public List<KqTeacherDto> getTeacherList(@RequestParam("schoolId")int schoolId){ | ||
45 | + return kqService.selectSchoolTeacher(schoolId); | ||
46 | + } | ||
47 | +} |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/KqTemplateMapper.java
0 → 100644
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +package com.sincere.smartSearch.mapper; | ||
2 | + | ||
3 | +import com.sincere.common.dto.smartCampus.KqTeacherDto; | ||
4 | +import com.sincere.smartSearch.model.KqTemplate; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author chen | ||
10 | + * @version 1.0 | ||
11 | + * @date 2019/11/28 0028 8:23 | ||
12 | + */ | ||
13 | +public interface KqTemplateMapper { | ||
14 | + | ||
15 | + List<KqTemplate> selectKqTemplate(); | ||
16 | + | ||
17 | + List<KqTeacherDto> selectSchoolTeacher(int schoolId); | ||
18 | +} |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/model/KqTemplate.java
0 → 100644
@@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
1 | +package com.sincere.smartSearch.model; | ||
2 | + | ||
3 | +/** | ||
4 | + * @author chen | ||
5 | + * @version 1.0 | ||
6 | + * @date 2019/11/28 0028 8:22 | ||
7 | + */ | ||
8 | +public class KqTemplate { | ||
9 | + | ||
10 | + private String config ; | ||
11 | + private int schoolId ; | ||
12 | + private String type ; | ||
13 | + | ||
14 | + public String getConfig() { | ||
15 | + return config; | ||
16 | + } | ||
17 | + | ||
18 | + public void setConfig(String config) { | ||
19 | + this.config = config; | ||
20 | + } | ||
21 | + | ||
22 | + public int getSchoolId() { | ||
23 | + return schoolId; | ||
24 | + } | ||
25 | + | ||
26 | + public void setSchoolId(int schoolId) { | ||
27 | + this.schoolId = schoolId; | ||
28 | + } | ||
29 | + | ||
30 | + public String getType() { | ||
31 | + return type; | ||
32 | + } | ||
33 | + | ||
34 | + public void setType(String type) { | ||
35 | + this.type = type; | ||
36 | + } | ||
37 | +} |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/KqService.java
0 → 100644
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +package com.sincere.smartSearch.service; | ||
2 | + | ||
3 | +import com.sincere.common.dto.smartCampus.KqTeacherDto; | ||
4 | +import com.sincere.smartSearch.model.KqTemplate; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author chen | ||
10 | + * @version 1.0 | ||
11 | + * @date 2019/11/28 0028 8:27 | ||
12 | + */ | ||
13 | +public interface KqService { | ||
14 | + | ||
15 | + List<KqTemplate> selectKqTemplate(); | ||
16 | + | ||
17 | + List<KqTeacherDto> selectSchoolTeacher(int schoolId); | ||
18 | + | ||
19 | +} |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/KqServiceImpl.java
0 → 100644
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +package com.sincere.smartSearch.service.impl; | ||
2 | + | ||
3 | +import com.sincere.common.dto.smartCampus.KqTeacherDto; | ||
4 | +import com.sincere.smartSearch.mapper.KqTemplateMapper; | ||
5 | +import com.sincere.smartSearch.model.KqTemplate; | ||
6 | +import com.sincere.smartSearch.service.KqService; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.stereotype.Service; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +/** | ||
13 | + * @author chen | ||
14 | + * @version 1.0 | ||
15 | + * @date 2019/11/28 0028 8:27 | ||
16 | + */ | ||
17 | +@Service | ||
18 | +public class KqServiceImpl implements KqService { | ||
19 | + | ||
20 | + @Autowired | ||
21 | + KqTemplateMapper kqTemplateMapper ; | ||
22 | + | ||
23 | + @Override | ||
24 | + public List<KqTemplate> selectKqTemplate() { | ||
25 | + return kqTemplateMapper.selectKqTemplate(); | ||
26 | + } | ||
27 | + | ||
28 | + @Override | ||
29 | + public List<KqTeacherDto> selectSchoolTeacher(int schoolId) { | ||
30 | + return kqTemplateMapper.selectSchoolTeacher(schoolId); | ||
31 | + } | ||
32 | +} |
cloud/search_smartCampus/src/main/resources/application.yml
@@ -4,9 +4,9 @@ spring: | @@ -4,9 +4,9 @@ spring: | ||
4 | application: | 4 | application: |
5 | name: smartCampusSearch | 5 | name: smartCampusSearch |
6 | datasource: | 6 | datasource: |
7 | - username: SZJXTUSER | ||
8 | - password: xst200919 | ||
9 | - url: jdbc:sqlserver://60.190.202.57:14333;database=SmartCampusSZ | 7 | + username: szjxtuser |
8 | + password: RQminVCJota3H1u8bBYH | ||
9 | + url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus | ||
10 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 10 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
11 | ##mybatis | 11 | ##mybatis |
12 | mybatis: | 12 | mybatis: |
cloud/search_smartCampus/src/main/resources/mapper/KqTemplateMapper.xml
0 → 100644
@@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.sincere.smartSearch.mapper.KqTemplateMapper"> | ||
4 | + | ||
5 | + <resultMap id="TemplateMap" type="com.sincere.smartSearch.model.KqTemplate"> | ||
6 | + <result column="config" property="config"/> | ||
7 | + <result column="SchoolId" property="schoolId"/> | ||
8 | + <result column="type" property="type"/> | ||
9 | + </resultMap> | ||
10 | + | ||
11 | + <select id="selectKqTemplate" resultMap="TemplateMap"> | ||
12 | + select XA_KqTemplate.config , XA_KqTemplate.SchoolId ,SZ_School.MsgTypes as type from XA_KqTemplate | ||
13 | + join SZ_School on XA_KqTemplate.SchoolId = SZ_School.school_id | ||
14 | + where XA_KqTemplate.State = 1 and XA_KqTemplate.ScenceType = 0 | ||
15 | + and (SZ_School.MsgTypes like '%4%' or SZ_School.MsgTypes like '%5%') | ||
16 | + </select> | ||
17 | + | ||
18 | + <resultMap id="TeacherMap" type="com.sincere.common.dto.smartCampus.KqTeacherDto"> | ||
19 | + <result column="user_id" property="userId"/> | ||
20 | + <result column="school_id" property="schoolId"/> | ||
21 | + <result column="name" property="name"/> | ||
22 | + <result column="mobile" property="mobile"/> | ||
23 | + <result column="pass" property="pass"/> | ||
24 | + <result column="DingUserId" property="dingUserId"/> | ||
25 | + <result column="QiYeHaoUserId" property="weChatUserId"/> | ||
26 | + <result column="XSTOpenId" property="xSTOpenId"/> | ||
27 | + <result column="face" property="face"/> | ||
28 | + </resultMap> | ||
29 | + <select id="selectSchoolTeacher" parameterType="java.lang.Integer" resultMap="TeacherMap"> | ||
30 | + select SZ_User.user_id , SZ_UserRole.school_id , SZ_User.name , SZ_User.mobile , SZ_User.pass , | ||
31 | + SZ_User.DingUserId , SZ_User.QiYeHaoUserId , SZ_User.XSTOpenId ,SZ_User.face | ||
32 | + from SZ_User join SZ_UserRole on SZ_User.user_id = SZ_UserRole.user_id | ||
33 | + where SZ_UserRole.school_id = #{schoolId} and SZ_UserRole.usertype = 0 | ||
34 | + </select> | ||
35 | +</mapper> |
cloud/weigeng/pom.xml
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | <dependency> | 22 | <dependency> |
23 | <groupId>com.sincere</groupId> | 23 | <groupId>com.sincere</groupId> |
24 | <artifactId>common</artifactId> | 24 | <artifactId>common</artifactId> |
25 | - <version>0.0.1-SNAPSHOT</version> | 25 | + <version>1.0.0</version> |
26 | </dependency> | 26 | </dependency> |
27 | <dependency> | 27 | <dependency> |
28 | <groupId>org.apache.mina</groupId> | 28 | <groupId>org.apache.mina</groupId> |