Commit e69fcc959a13c8254a304440904acbbab3cbcaf7
1 parent
81cae9e2
Exists in
master
考勤推送
Showing
14 changed files
with
211 additions
and
97 deletions
Show diff stats
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/AppDto.java
0 → 100644
... | ... | @@ -0,0 +1,27 @@ |
1 | +package com.sincere.common.dto.smartCampus; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/11/28 0028 15:58 | |
7 | + */ | |
8 | +public class AppDto { | |
9 | + private String agentId ; | |
10 | + private String agentSecret ; | |
11 | + | |
12 | + public String getAgentId() { | |
13 | + return agentId; | |
14 | + } | |
15 | + | |
16 | + public void setAgentId(String agentId) { | |
17 | + this.agentId = agentId; | |
18 | + } | |
19 | + | |
20 | + public String getAgentSecret() { | |
21 | + return agentSecret; | |
22 | + } | |
23 | + | |
24 | + public void setAgentSecret(String agentSecret) { | |
25 | + this.agentSecret = agentSecret; | |
26 | + } | |
27 | +} | ... | ... |
cloud/common/src/main/java/com/sincere/common/util/DateUtils.java
cloud/quartz/pom.xml
... | ... | @@ -66,15 +66,87 @@ |
66 | 66 | </dependencyManagement> |
67 | 67 | |
68 | 68 | <build> |
69 | + <!--打包文件名--> | |
70 | + <finalName>quartz_server</finalName> | |
71 | + <!--打包方式--> | |
69 | 72 | <plugins> |
73 | + <!-- 设置编译版本 --> | |
70 | 74 | <plugin> |
71 | - <groupId>org.springframework.boot</groupId> | |
72 | - <artifactId>spring-boot-maven-plugin</artifactId> | |
75 | + <groupId>org.apache.maven.plugins</groupId> | |
76 | + <artifactId>maven-compiler-plugin</artifactId> | |
77 | + <version>3.1</version> | |
73 | 78 | <configuration> |
74 | - <includeSystemScope>true</includeSystemScope> | |
79 | + <source>1.8</source> | |
80 | + <target>1.8</target> | |
81 | + <encoding>UTF-8</encoding> | |
75 | 82 | </configuration> |
76 | 83 | </plugin> |
77 | - | |
84 | + <!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 --> | |
85 | + <!-- 本地启动需要注释--> | |
86 | + <plugin> | |
87 | + <groupId>org.apache.maven.plugins</groupId> | |
88 | + <artifactId>maven-jar-plugin</artifactId> | |
89 | + <configuration> | |
90 | + <archive> | |
91 | + <manifest> | |
92 | + <mainClass>com.sincere.smartSearch.SmartSearchApplication</mainClass> | |
93 | + <addClasspath>true</addClasspath> | |
94 | + <classpathPrefix>lib/</classpathPrefix> | |
95 | + </manifest> | |
96 | + <manifestEntries> | |
97 | + <Class-Path>./config/</Class-Path> | |
98 | + </manifestEntries> | |
99 | + </archive> | |
100 | + <excludes> | |
101 | + <exclude>config/**</exclude> | |
102 | + </excludes> | |
103 | + <classesDirectory></classesDirectory> | |
104 | + </configuration> | |
105 | + </plugin> | |
106 | + <!-- 拷贝依赖的jar包到lib目录 --> | |
107 | + <plugin> | |
108 | + <groupId>org.apache.maven.plugins</groupId> | |
109 | + <artifactId>maven-dependency-plugin</artifactId> | |
110 | + <executions> | |
111 | + <execution> | |
112 | + <id>copy</id> | |
113 | + <phase>package</phase> | |
114 | + <goals> | |
115 | + <goal>copy-dependencies</goal> | |
116 | + </goals> | |
117 | + <configuration> | |
118 | + <outputDirectory> | |
119 | + ${project.build.directory}/lib | |
120 | + </outputDirectory> | |
121 | + </configuration> | |
122 | + </execution> | |
123 | + </executions> | |
124 | + </plugin> | |
125 | + <!-- 解决资源文件的编码问题 --> | |
126 | + <plugin> | |
127 | + <groupId>org.apache.maven.plugins</groupId> | |
128 | + <artifactId>maven-resources-plugin</artifactId> | |
129 | + <version>2.5</version> | |
130 | + <configuration> | |
131 | + <encoding>UTF-8</encoding> | |
132 | + </configuration> | |
133 | + </plugin> | |
134 | + <!-- 打包source文件为jar文件 --> | |
135 | + <plugin> | |
136 | + <artifactId>maven-source-plugin</artifactId> | |
137 | + <version>2.2</version> | |
138 | + <configuration> | |
139 | + <attach>true</attach> | |
140 | + </configuration> | |
141 | + <executions> | |
142 | + <execution> | |
143 | + <phase>compile</phase> | |
144 | + <goals> | |
145 | + <goal>jar</goal> | |
146 | + </goals> | |
147 | + </execution> | |
148 | + </executions> | |
149 | + </plugin> | |
78 | 150 | </plugins> |
79 | 151 | </build> |
80 | 152 | </project> |
81 | 153 | \ No newline at end of file | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/feign/ScFeign.java
1 | 1 | package com.sincere.quartz.feign; |
2 | 2 | |
3 | +import com.sincere.common.dto.smartCampus.AppDto; | |
3 | 4 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
4 | 5 | import com.sincere.common.dto.smartCampus.TemplateDto; |
5 | 6 | import org.springframework.cloud.openfeign.FeignClient; |
... | ... | @@ -22,4 +23,7 @@ public interface ScFeign { |
22 | 23 | |
23 | 24 | @RequestMapping(value = "/sm/kq/getTeacherList",method = RequestMethod.GET) |
24 | 25 | List<KqTeacherDto> getTeacherList(@RequestParam("schoolId")int schoolId); |
26 | + | |
27 | + @RequestMapping(value = "/sm/kq/getApp",method = RequestMethod.GET) | |
28 | + AppDto getApp(@RequestParam("schoolId")int schoolId , @RequestParam("type") int type); | |
25 | 29 | } | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/job/QDService.java
1 | 1 | package com.sincere.quartz.job; |
2 | 2 | |
3 | +import com.sincere.common.dto.smartCampus.AppDto; | |
3 | 4 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
4 | 5 | import com.sincere.common.dto.smartCampus.TemplateDto; |
5 | 6 | import com.sincere.common.util.DateUtils; |
... | ... | @@ -31,7 +32,7 @@ public class QDService { |
31 | 32 | private static String date ; |
32 | 33 | private static Map<String , String> map = new HashMap<>(); |
33 | 34 | |
34 | - @Scheduled(cron = "0/10 * * * * ?") | |
35 | + @Scheduled(cron = "* 0/1 * * * ?") | |
35 | 36 | public void kaoQing() { |
36 | 37 | String now = DateUtils.date2String(new Date(),DateUtils.format1) ; |
37 | 38 | if(StringUtils.isBlank(date)){ |
... | ... | @@ -46,14 +47,17 @@ public class QDService { |
46 | 47 | List<String> keyList = new ArrayList<>(); |
47 | 48 | for(Map.Entry<String, String> entity : map.entrySet()){ |
48 | 49 | String endTime = entity.getValue().split("_")[1]; |
49 | - if(DateUtils.getDateDifference(new Date(),DateUtils.string2Date(now+" "+endTime+":00",DateUtils.format2),"s")>0){ | |
50 | + if(DateUtils.getDateDifference(new Date(),DateUtils.string2Date(now+" "+endTime+":00",DateUtils.format2),"m")>0 | |
51 | + && DateUtils.getDateDifference(new Date(),DateUtils.string2Date(now+" "+endTime+":00",DateUtils.format2),"m")<5){ | |
50 | 52 | String key = entity.getKey(); |
51 | 53 | String[] messageArray = key.split("_"); |
52 | 54 | List<KqTeacherDto> list = scFeign.getTeacherList(Integer.valueOf(messageArray[1])); |
53 | 55 | if(messageArray[2].contains("4")){ |
56 | + System.out.println("企业号推送:" + messageArray[0] + "__" + messageArray[1]); | |
54 | 57 | weChatPush(list,entity.getValue()); |
55 | 58 | } |
56 | 59 | if(messageArray[2].contains("5")){ |
60 | + System.out.println("盯盯推送:" + messageArray[0] + "__" + messageArray[1]); | |
57 | 61 | dingPush(list,entity.getValue()); |
58 | 62 | } |
59 | 63 | keyList.add(key); |
... | ... | @@ -65,19 +69,24 @@ public class QDService { |
65 | 69 | } |
66 | 70 | |
67 | 71 | private void initMap(){ |
72 | + map = new HashMap<>(); | |
68 | 73 | List<TemplateDto> list = scFeign.getAllTemplate(); |
69 | 74 | for(TemplateDto templateDto : list){ |
70 | 75 | String config = templateDto.getConfig(); |
71 | 76 | String[] array = config.split("<Template"); |
72 | 77 | 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); | |
78 | + try{ | |
79 | + String msg = array[i]; | |
80 | + String beginTime = msg.substring(msg.indexOf("BeginTime")+11,msg.indexOf("BeginTime")+16); | |
81 | + String endTime = msg.substring(msg.indexOf("EndTime")+9,msg.indexOf("EndTime")+14); | |
82 | + String templateId = msg.substring(msg.indexOf("TemplateID")+12,msg.indexOf("TemplateID")+22); | |
83 | + String Week = msg.substring(msg.indexOf("Week")+6,msg.indexOf("Week")+19); | |
84 | + int nowWeek = DateUtils.getWeek() ; | |
85 | + if(Week.contains(nowWeek+"")){ | |
86 | + map.put(templateId+"_"+templateDto.getSchoolId()+"_"+templateDto.getType() , beginTime+"_"+endTime); | |
87 | + } | |
88 | + }catch (Exception e){ | |
89 | + e.printStackTrace(); | |
81 | 90 | } |
82 | 91 | } |
83 | 92 | } |
... | ... | @@ -87,43 +96,45 @@ public class QDService { |
87 | 96 | String[] times = key.split("_"); |
88 | 97 | String Date = DateUtils.date2String(new Date(),DateUtils.format1); |
89 | 98 | String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); |
99 | + AppDto appDto = scFeign.getApp(list.get(0).getSchoolId(),1); | |
90 | 100 | for(KqTeacherDto teacher : list){ |
91 | - if(StringUtils.isNotBlank(teacher.getDingUserId()) && teacher.getName().equals("陈杰")){ | |
101 | + if(StringUtils.isNotBlank(teacher.getDingUserId())){ | |
92 | 102 | DingSms dingSms = new DingSms(); |
93 | 103 | dingSms.setTableName("DingSmsNew"+tableSuffix); |
94 | 104 | dingSms.setMsg("{\"title\":\"请查看签到信息\",\"form\":[{\"key\":\"开始时间:\",\"value\":\"" + |
95 | 105 | Date+" "+times[0]+"\"},{\"key\":\"结束时间:\",\"value\":\""+Date+" "+times[1]+"\"}]}"); |
96 | 106 | dingSms.setSchoolId(teacher.getSchoolId()); |
97 | 107 | dingSms.setDingUserId(teacher.getDingUserId()); |
98 | - dingSms.setAgentId("314950914"); //智能校卫 | |
108 | + dingSms.setAgentId(appDto.getAgentId()); //智能校卫 | |
99 | 109 | String wapUrl = "http://campus.myjxt.com/studentRecord/znxwwebapp/index.html?" + |
100 | 110 | "schoolid="+teacher.getSchoolId()+"&userId="+teacher.getUserId()+"&name="+teacher.getName()+ |
101 | 111 | "&data="+teacher.getDingUserId()+"&type=1&stype=4&mobile="+teacher.getMobile()+"&pass="+teacher.getPass()+ |
102 | 112 | "&face=&sourcetype=16&soutype=3×tamp="+ DateUtils.getDate() ; |
103 | 113 | dingSms.setWapUrl(wapUrl); |
104 | - //smsMapper.insertDing(dingSms); | |
114 | + smsMapper.insertDing(dingSms); | |
105 | 115 | } |
106 | 116 | } |
107 | 117 | } |
108 | 118 | |
109 | 119 | private void weChatPush(List<KqTeacherDto> list , String key){ |
110 | - String[] times = key.split("_"); | |
111 | - String Date = DateUtils.date2String(new Date(),DateUtils.format1); | |
112 | 120 | String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); |
121 | + AppDto appDto = scFeign.getApp(list.get(0).getSchoolId(),0); | |
113 | 122 | for(KqTeacherDto teacher : list){ |
114 | - if(StringUtils.isNotBlank(teacher.getxSTOpenId()) && teacher.getName().equals("陶汉栋")){ | |
123 | + if(StringUtils.isNotBlank(teacher.getxSTOpenId())){ | |
115 | 124 | WeChatSms weChatSms = new WeChatSms(); |
116 | - weChatSms.setTableName("wxSmsNew"+tableSuffix); | |
125 | + weChatSms.setTableName("qyhSmsNew"+tableSuffix); | |
117 | 126 | weChatSms.setSchoolId(teacher.getSchoolId()); |
118 | 127 | weChatSms.setName(teacher.getName()); |
119 | 128 | weChatSms.setxSTOpenId(teacher.getxSTOpenId()); |
129 | + weChatSms.setQiYeHaoUserId(teacher.getWeChatUserId()); | |
130 | + weChatSms.setReceiveUserId(teacher.getUserId()); | |
131 | + weChatSms.setAppId(appDto.getAgentId()); | |
132 | + weChatSms.setSecret(appDto.getAgentSecret()); | |
120 | 133 | String msgUrl = "http://campus.myjxt.com/studentRecord/znxwwebapp/index.html?" + |
121 | 134 | "schoolid="+teacher.getSchoolId()+"&userId="+teacher.getUserId()+"&name="+teacher.getName()+ |
122 | 135 | "&data="+teacher.getWeChatUserId()+"&type=1&stype=3&mobile="+teacher.getMobile()+"&pass="+teacher.getPass()+ |
123 | 136 | "&face="+ teacher.getFace() +"&sourcetype=16&soutype=2×tamp="+ DateUtils.getDate() ; |
124 | 137 | weChatSms.setMsgUrl(msgUrl); |
125 | - weChatSms.setMsg("{\"title\":\"请查看签到信息\",\"form\":[{\"key\":\"开始时间:\",\"value\":\"" + | |
126 | - Date+" "+times[0]+"\"},{\"key\":\"结束时间:\",\"value\":\""+Date+" "+times[1]+"\"}]}"); | |
127 | 138 | smsMapper.insertWeChat(weChatSms); |
128 | 139 | } |
129 | 140 | } | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/model/WeChatSms.java
... | ... | @@ -9,11 +9,47 @@ public class WeChatSms { |
9 | 9 | |
10 | 10 | private String tableName ; |
11 | 11 | |
12 | + private String receiveUserId ; | |
13 | + private String qiYeHaoUserId ; | |
12 | 14 | private int schoolId ; |
13 | 15 | private String msgUrl ; |
14 | - private String msg ; | |
15 | 16 | private String name ; |
16 | 17 | private String xSTOpenId ; |
18 | + private String appId ; | |
19 | + private String secret ; | |
20 | + | |
21 | + | |
22 | + public String getAppId() { | |
23 | + return appId; | |
24 | + } | |
25 | + | |
26 | + public void setAppId(String appId) { | |
27 | + this.appId = appId; | |
28 | + } | |
29 | + | |
30 | + public String getSecret() { | |
31 | + return secret; | |
32 | + } | |
33 | + | |
34 | + public void setSecret(String secret) { | |
35 | + this.secret = secret; | |
36 | + } | |
37 | + | |
38 | + public String getReceiveUserId() { | |
39 | + return receiveUserId; | |
40 | + } | |
41 | + | |
42 | + public void setReceiveUserId(String receiveUserId) { | |
43 | + this.receiveUserId = receiveUserId; | |
44 | + } | |
45 | + | |
46 | + public String getQiYeHaoUserId() { | |
47 | + return qiYeHaoUserId; | |
48 | + } | |
49 | + | |
50 | + public void setQiYeHaoUserId(String qiYeHaoUserId) { | |
51 | + this.qiYeHaoUserId = qiYeHaoUserId; | |
52 | + } | |
17 | 53 | |
18 | 54 | public String getTableName() { |
19 | 55 | return tableName; |
... | ... | @@ -39,14 +75,6 @@ public class WeChatSms { |
39 | 75 | this.msgUrl = msgUrl; |
40 | 76 | } |
41 | 77 | |
42 | - public String getMsg() { | |
43 | - return msg; | |
44 | - } | |
45 | - | |
46 | - public void setMsg(String msg) { | |
47 | - this.msg = msg; | |
48 | - } | |
49 | - | |
50 | 78 | public String getName() { |
51 | 79 | return name; |
52 | 80 | } | ... | ... |
cloud/quartz/src/main/resources/application.yaml
cloud/quartz/src/main/resources/logback.xml
... | ... | @@ -1,61 +0,0 @@ |
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> |
cloud/quartz/src/main/resources/mapper/SmsMapper.xml
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | </insert> |
9 | 9 | |
10 | 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}) | |
11 | + insert into ${tableName} (SchoolID,WapUrl,Status,intime,sendTime,SendUserName,ReceiveUserID,QiYeHaoUserId,AppID,Secret) | |
12 | + values (#{schoolId},#{msgUrl},0,GETDATE(),GETDATE(),#{name},#{receiveUserId},#{qiYeHaoUserId},#{appId},#{secret}) | |
13 | 13 | </insert> |
14 | 14 | </mapper> | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/KqController.java
1 | 1 | package com.sincere.smartSearch.controller; |
2 | 2 | |
3 | +import com.sincere.common.dto.smartCampus.AppDto; | |
3 | 4 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
4 | 5 | import com.sincere.common.dto.smartCampus.TemplateDto; |
5 | 6 | import com.sincere.smartSearch.model.KqTemplate; |
... | ... | @@ -11,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestParam; |
11 | 12 | import org.springframework.web.bind.annotation.RestController; |
12 | 13 | |
13 | 14 | import java.util.ArrayList; |
15 | +import java.util.HashMap; | |
14 | 16 | import java.util.List; |
17 | +import java.util.Map; | |
15 | 18 | |
16 | 19 | /** |
17 | 20 | * @author chen |
... | ... | @@ -44,4 +47,12 @@ public class KqController { |
44 | 47 | public List<KqTeacherDto> getTeacherList(@RequestParam("schoolId")int schoolId){ |
45 | 48 | return kqService.selectSchoolTeacher(schoolId); |
46 | 49 | } |
50 | + | |
51 | + @RequestMapping(value = "getApp",method = RequestMethod.GET) | |
52 | + public AppDto getApp(@RequestParam("schoolId")int schoolId , @RequestParam("type") int type){ | |
53 | + Map<String ,Integer> map = new HashMap<>(); | |
54 | + map.put("schoolId",schoolId); | |
55 | + map.put("type",type); | |
56 | + return kqService.selectApp(map); | |
57 | + } | |
47 | 58 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/KqTemplateMapper.java
1 | 1 | package com.sincere.smartSearch.mapper; |
2 | 2 | |
3 | +import com.sincere.common.dto.smartCampus.AppDto; | |
3 | 4 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
4 | 5 | import com.sincere.smartSearch.model.KqTemplate; |
5 | 6 | |
6 | 7 | import java.util.List; |
8 | +import java.util.Map; | |
7 | 9 | |
8 | 10 | /** |
9 | 11 | * @author chen |
... | ... | @@ -15,4 +17,6 @@ public interface KqTemplateMapper { |
15 | 17 | List<KqTemplate> selectKqTemplate(); |
16 | 18 | |
17 | 19 | List<KqTeacherDto> selectSchoolTeacher(int schoolId); |
20 | + | |
21 | + AppDto selectApp(Map<String,Integer> map); | |
18 | 22 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/KqService.java
1 | 1 | package com.sincere.smartSearch.service; |
2 | 2 | |
3 | +import com.sincere.common.dto.smartCampus.AppDto; | |
3 | 4 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
4 | 5 | import com.sincere.smartSearch.model.KqTemplate; |
5 | 6 | |
6 | 7 | import java.util.List; |
8 | +import java.util.Map; | |
7 | 9 | |
8 | 10 | /** |
9 | 11 | * @author chen |
... | ... | @@ -16,4 +18,5 @@ public interface KqService { |
16 | 18 | |
17 | 19 | List<KqTeacherDto> selectSchoolTeacher(int schoolId); |
18 | 20 | |
21 | + AppDto selectApp(Map<String,Integer> map); | |
19 | 22 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/KqServiceImpl.java
1 | 1 | package com.sincere.smartSearch.service.impl; |
2 | 2 | |
3 | +import com.sincere.common.dto.smartCampus.AppDto; | |
3 | 4 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
4 | 5 | import com.sincere.smartSearch.mapper.KqTemplateMapper; |
5 | 6 | import com.sincere.smartSearch.model.KqTemplate; |
... | ... | @@ -8,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
8 | 9 | import org.springframework.stereotype.Service; |
9 | 10 | |
10 | 11 | import java.util.List; |
12 | +import java.util.Map; | |
11 | 13 | |
12 | 14 | /** |
13 | 15 | * @author chen |
... | ... | @@ -29,4 +31,9 @@ public class KqServiceImpl implements KqService { |
29 | 31 | public List<KqTeacherDto> selectSchoolTeacher(int schoolId) { |
30 | 32 | return kqTemplateMapper.selectSchoolTeacher(schoolId); |
31 | 33 | } |
34 | + | |
35 | + @Override | |
36 | + public AppDto selectApp(Map<String, Integer> map) { | |
37 | + return kqTemplateMapper.selectApp(map); | |
38 | + } | |
32 | 39 | } | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/KqTemplateMapper.xml
... | ... | @@ -32,4 +32,13 @@ |
32 | 32 | from SZ_User join SZ_UserRole on SZ_User.user_id = SZ_UserRole.user_id |
33 | 33 | where SZ_UserRole.school_id = #{schoolId} and SZ_UserRole.usertype = 0 |
34 | 34 | </select> |
35 | + | |
36 | + <resultMap id="AppMap" type="com.sincere.common.dto.smartCampus.AppDto"> | |
37 | + <result column="AgentId" property="agentId"/> | |
38 | + <result column="AgentSecret" property="agentSecret"/> | |
39 | + </resultMap> | |
40 | + <select id="selectApp" parameterType="java.util.Map" resultMap="AppMap"> | |
41 | + select AgentId,AgentSecret from EM_QYHApply where SchoolId=#{schoolId} and type= #{type} | |
42 | + and ApplyName = '智能校卫' | |
43 | + </select> | |
35 | 44 | </mapper> | ... | ... |