Commit ad680c7b15cf74ef36c607c58cbac367f1507a4f
1 parent
e69fcc95
Exists in
master
考勤推送
Showing
18 changed files
with
307 additions
and
64 deletions
Show diff stats
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/CensusKqDto.java
0 → 100644
| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | +package com.sincere.common.dto.smartCampus; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * @author chen | |
| 5 | + * @version 1.0 | |
| 6 | + * @date 2019/11/29 0029 14:27 | |
| 7 | + */ | |
| 8 | +public class CensusKqDto { | |
| 9 | + private String className ; | |
| 10 | + private int allT ; | |
| 11 | + private int kqT ; | |
| 12 | + | |
| 13 | + public String getClassName() { | |
| 14 | + return className; | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void setClassName(String className) { | |
| 18 | + this.className = className; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public int getAllT() { | |
| 22 | + return allT; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setAllT(int allT) { | |
| 26 | + this.allT = allT; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public int getKqT() { | |
| 30 | + return kqT; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setKqT(int kqT) { | |
| 34 | + this.kqT = kqT; | |
| 35 | + } | |
| 36 | +} | ... | ... |
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/KqTeacherDto.java
| ... | ... | @@ -13,7 +13,7 @@ public class KqTeacherDto { |
| 13 | 13 | private String pass ; |
| 14 | 14 | private String DingUserId ; |
| 15 | 15 | private String weChatUserId ; |
| 16 | - private String xSTOpenId ; | |
| 16 | + private String openId ; | |
| 17 | 17 | private String face ; |
| 18 | 18 | |
| 19 | 19 | public String getUserId() { |
| ... | ... | @@ -72,12 +72,12 @@ public class KqTeacherDto { |
| 72 | 72 | this.weChatUserId = weChatUserId; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public String getxSTOpenId() { | |
| 76 | - return xSTOpenId; | |
| 75 | + public String getOpenId() { | |
| 76 | + return openId; | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public void setxSTOpenId(String xSTOpenId) { | |
| 80 | - this.xSTOpenId = xSTOpenId; | |
| 79 | + public void setOpenId(String openId) { | |
| 80 | + this.openId = openId; | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public String getFace() { | ... | ... |
cloud/common/src/main/java/com/sincere/common/util/DateUtils.java
| ... | ... | @@ -72,4 +72,33 @@ public class DateUtils { |
| 72 | 72 | int weekday = c.get(Calendar.DAY_OF_WEEK); |
| 73 | 73 | return weekday-1 ; |
| 74 | 74 | } |
| 75 | + | |
| 76 | + public static String getWeekName(){ | |
| 77 | + Date today = new Date(); | |
| 78 | + Calendar c = Calendar.getInstance(); | |
| 79 | + c.setTime(today); | |
| 80 | + int weekday = c.get(Calendar.DAY_OF_WEEK); | |
| 81 | + if(weekday == 1){ | |
| 82 | + return "周日"; | |
| 83 | + } | |
| 84 | + if(weekday == 2){ | |
| 85 | + return "周一"; | |
| 86 | + } | |
| 87 | + if(weekday == 3){ | |
| 88 | + return "周二"; | |
| 89 | + } | |
| 90 | + if(weekday == 4){ | |
| 91 | + return "周三"; | |
| 92 | + } | |
| 93 | + if(weekday == 5){ | |
| 94 | + return "周四"; | |
| 95 | + } | |
| 96 | + if(weekday == 6){ | |
| 97 | + return "周五"; | |
| 98 | + } | |
| 99 | + if(weekday == 7){ | |
| 100 | + return "周六"; | |
| 101 | + } | |
| 102 | + return ""; | |
| 103 | + } | |
| 75 | 104 | } | ... | ... |
cloud/quartz/pom.xml
| ... | ... | @@ -89,7 +89,7 @@ |
| 89 | 89 | <configuration> |
| 90 | 90 | <archive> |
| 91 | 91 | <manifest> |
| 92 | - <mainClass>com.sincere.smartSearch.SmartSearchApplication</mainClass> | |
| 92 | + <mainClass>com.sincere.quartz.QuartzApplication</mainClass> | |
| 93 | 93 | <addClasspath>true</addClasspath> |
| 94 | 94 | <classpathPrefix>lib/</classpathPrefix> |
| 95 | 95 | </manifest> | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/enums/KqTypeEnums.java
0 → 100644
| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | +package com.sincere.quartz.enums; | |
| 2 | + | |
| 3 | +import com.sincere.common.dto.smartCampus.KqTeacherDto; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * @author chen | |
| 7 | + * @version 1.0 | |
| 8 | + * @date 2019/11/29 0029 11:44 | |
| 9 | + */ | |
| 10 | +public enum KqTypeEnums { | |
| 11 | + morning_to_school(1,"早上到校"), | |
| 12 | + noon_le_school(2,"中午离校"), | |
| 13 | + afternoon_to_school(3,"下午到校"), | |
| 14 | + afternoon_le_school(4,"下午离校"), | |
| 15 | + night_to_school(5,"晚上到校"), | |
| 16 | + night_le_school(6,"晚上离校"), | |
| 17 | + morning_to_chamber(7,"早上离寝"), | |
| 18 | + noon_to_chamber(8,"中午到寝"), | |
| 19 | + noon_le_chamber(9,"中午离寝"), | |
| 20 | + afternoon_to_chamber(10,"下午到寝"), | |
| 21 | + afternoon_le_chamber(11,"下午离寝"), | |
| 22 | + night_to_chamber(12,"晚上到寝"); | |
| 23 | + | |
| 24 | + private int type ; | |
| 25 | + private String name ; | |
| 26 | + | |
| 27 | + public int getType() { | |
| 28 | + return type; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setType(int type) { | |
| 32 | + this.type = type; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public String getName() { | |
| 36 | + return name; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setName(String name) { | |
| 40 | + this.name = name; | |
| 41 | + } | |
| 42 | + | |
| 43 | + KqTypeEnums(int type, String name) { | |
| 44 | + this.type = type; | |
| 45 | + this.name = name; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public static String getName(int type){ | |
| 49 | + for(KqTypeEnums enums : KqTypeEnums.values()){ | |
| 50 | + if(enums.getType() == type){ | |
| 51 | + return enums.getName(); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + return "" ; | |
| 55 | + } | |
| 56 | +} | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/enums/TypeEnums.java
0 → 100644
| ... | ... | @@ -0,0 +1,35 @@ |
| 1 | +package com.sincere.quartz.enums; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * @author chen | |
| 5 | + * @version 1.0 | |
| 6 | + * @date 2019/11/29 0029 11:25 | |
| 7 | + */ | |
| 8 | +public enum TypeEnums { | |
| 9 | + | |
| 10 | + kaoqing(10,"考勤"); | |
| 11 | + | |
| 12 | + TypeEnums(int type, String name) { | |
| 13 | + this.type = type; | |
| 14 | + this.name = name; | |
| 15 | + } | |
| 16 | + | |
| 17 | + private int type ; | |
| 18 | + private String name ; | |
| 19 | + | |
| 20 | + public int getType() { | |
| 21 | + return type; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setType(int type) { | |
| 25 | + this.type = type; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public String getName() { | |
| 29 | + return name; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setName(String name) { | |
| 33 | + this.name = name; | |
| 34 | + } | |
| 35 | +} | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/feign/ScFeign.java
| 1 | 1 | package com.sincere.quartz.feign; |
| 2 | 2 | |
| 3 | 3 | import com.sincere.common.dto.smartCampus.AppDto; |
| 4 | +import com.sincere.common.dto.smartCampus.CensusKqDto; | |
| 4 | 5 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
| 5 | 6 | import com.sincere.common.dto.smartCampus.TemplateDto; |
| 6 | 7 | import org.springframework.cloud.openfeign.FeignClient; |
| ... | ... | @@ -26,4 +27,7 @@ public interface ScFeign { |
| 26 | 27 | |
| 27 | 28 | @RequestMapping(value = "/sm/kq/getApp",method = RequestMethod.GET) |
| 28 | 29 | AppDto getApp(@RequestParam("schoolId")int schoolId , @RequestParam("type") int type); |
| 30 | + | |
| 31 | + @RequestMapping(value = "/sm/kq/getCensusKq",method = RequestMethod.GET) | |
| 32 | + List<CensusKqDto> getCensusKq(@RequestParam("userId") String userId , @RequestParam("type") int type); | |
| 29 | 33 | } | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/job/QDService.java
| 1 | 1 | package com.sincere.quartz.job; |
| 2 | 2 | |
| 3 | 3 | import com.sincere.common.dto.smartCampus.AppDto; |
| 4 | +import com.sincere.common.dto.smartCampus.CensusKqDto; | |
| 4 | 5 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
| 5 | 6 | import com.sincere.common.dto.smartCampus.TemplateDto; |
| 6 | 7 | import com.sincere.common.util.DateUtils; |
| 8 | +import com.sincere.quartz.enums.KqTypeEnums; | |
| 9 | +import com.sincere.quartz.enums.TypeEnums; | |
| 7 | 10 | import com.sincere.quartz.feign.ScFeign; |
| 8 | 11 | import com.sincere.quartz.mapper.SmsMapper; |
| 9 | 12 | import com.sincere.quartz.model.DingSms; |
| ... | ... | @@ -16,6 +19,8 @@ import org.springframework.stereotype.Service; |
| 16 | 19 | import java.util.*; |
| 17 | 20 | |
| 18 | 21 | /** |
| 22 | + * 考勤任务推送调用 | |
| 23 | + * 主要推送盯盯以及企业号 | |
| 19 | 24 | * @author chen |
| 20 | 25 | * @version 1.0 |
| 21 | 26 | * @date 2019/11/27 0027 17:05 |
| ... | ... | @@ -47,8 +52,7 @@ public class QDService { |
| 47 | 52 | List<String> keyList = new ArrayList<>(); |
| 48 | 53 | for(Map.Entry<String, String> entity : map.entrySet()){ |
| 49 | 54 | String endTime = entity.getValue().split("_")[1]; |
| 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){ | |
| 55 | + if(DateUtils.getDateDifference(new Date(),DateUtils.string2Date(now+" "+endTime+":00",DateUtils.format2),"m")>=2){ | |
| 52 | 56 | String key = entity.getKey(); |
| 53 | 57 | String[] messageArray = key.split("_"); |
| 54 | 58 | List<KqTeacherDto> list = scFeign.getTeacherList(Integer.valueOf(messageArray[1])); |
| ... | ... | @@ -81,9 +85,10 @@ public class QDService { |
| 81 | 85 | String endTime = msg.substring(msg.indexOf("EndTime")+9,msg.indexOf("EndTime")+14); |
| 82 | 86 | String templateId = msg.substring(msg.indexOf("TemplateID")+12,msg.indexOf("TemplateID")+22); |
| 83 | 87 | String Week = msg.substring(msg.indexOf("Week")+6,msg.indexOf("Week")+19); |
| 88 | + String type = msg.substring(msg.indexOf("Type")+6,msg.indexOf("Type")+7); | |
| 84 | 89 | int nowWeek = DateUtils.getWeek() ; |
| 85 | 90 | if(Week.contains(nowWeek+"")){ |
| 86 | - map.put(templateId+"_"+templateDto.getSchoolId()+"_"+templateDto.getType() , beginTime+"_"+endTime); | |
| 91 | + map.put(templateId+"_"+templateDto.getSchoolId()+"_"+templateDto.getType() , beginTime+"_"+endTime+"_"+type); | |
| 87 | 92 | } |
| 88 | 93 | }catch (Exception e){ |
| 89 | 94 | e.printStackTrace(); |
| ... | ... | @@ -94,48 +99,71 @@ public class QDService { |
| 94 | 99 | |
| 95 | 100 | private void dingPush(List<KqTeacherDto> list , String key){ |
| 96 | 101 | String[] times = key.split("_"); |
| 97 | - String Date = DateUtils.date2String(new Date(),DateUtils.format1); | |
| 98 | 102 | String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); |
| 99 | 103 | AppDto appDto = scFeign.getApp(list.get(0).getSchoolId(),1); |
| 100 | 104 | for(KqTeacherDto teacher : list){ |
| 101 | - if(StringUtils.isNotBlank(teacher.getDingUserId())){ | |
| 102 | - DingSms dingSms = new DingSms(); | |
| 103 | - dingSms.setTableName("DingSmsNew"+tableSuffix); | |
| 104 | - dingSms.setMsg("{\"title\":\"请查看签到信息\",\"form\":[{\"key\":\"开始时间:\",\"value\":\"" + | |
| 105 | - Date+" "+times[0]+"\"},{\"key\":\"结束时间:\",\"value\":\""+Date+" "+times[1]+"\"}]}"); | |
| 106 | - dingSms.setSchoolId(teacher.getSchoolId()); | |
| 107 | - dingSms.setDingUserId(teacher.getDingUserId()); | |
| 108 | - dingSms.setAgentId(appDto.getAgentId()); //智能校卫 | |
| 109 | - String wapUrl = "http://campus.myjxt.com/studentRecord/znxwwebapp/index.html?" + | |
| 110 | - "schoolid="+teacher.getSchoolId()+"&userId="+teacher.getUserId()+"&name="+teacher.getName()+ | |
| 111 | - "&data="+teacher.getDingUserId()+"&type=1&stype=4&mobile="+teacher.getMobile()+"&pass="+teacher.getPass()+ | |
| 112 | - "&face=&sourcetype=16&soutype=3×tamp="+ DateUtils.getDate() ; | |
| 113 | - dingSms.setWapUrl(wapUrl); | |
| 114 | - smsMapper.insertDing(dingSms); | |
| 105 | + if(teacher.getName().equals("陈杰") || teacher.getName().equals("沈川")) { | |
| 106 | + if(StringUtils.isNotBlank(teacher.getDingUserId())){ | |
| 107 | + List<CensusKqDto> censusKqDtos = scFeign.getCensusKq(teacher.getUserId(),Integer.valueOf(times[2])); | |
| 108 | + String message = ""; | |
| 109 | + for(CensusKqDto censusKqDto : censusKqDtos){ | |
| 110 | + int number = censusKqDto.getAllT() - censusKqDto.getKqT() ; | |
| 111 | + message += "[" + censusKqDto.getClassName() + "]未考勤" + number + "人;"; | |
| 112 | + } | |
| 113 | + DingSms dingSms = new DingSms(); | |
| 114 | + dingSms.setTableName("DingSmsNew"+tableSuffix); | |
| 115 | + dingSms.setMsg("报告类型:"+KqTypeEnums.getName(Integer.valueOf(times[2])) + "出勤报告 \n - "+ | |
| 116 | + "签到日期:"+DateUtils.date2String(new Date(),DateUtils.format1)+ "("+DateUtils.getWeekName()+") \n - "+ | |
| 117 | + "签到时间:"+times[0]+"-"+ times[1] +" \n - "+ | |
| 118 | + "整体数据:" + message.substring(0,message.length()-1)); | |
| 119 | + dingSms.setSchoolId(teacher.getSchoolId()); | |
| 120 | + dingSms.setDingUserId(teacher.getDingUserId()); | |
| 121 | + dingSms.setAgentId(appDto.getAgentId()); | |
| 122 | + String wapUrl = "http://campus.myjxt.com/studentRecord/znxwwebapp/index.html?" + | |
| 123 | + "schoolid="+teacher.getSchoolId()+"&userId="+teacher.getUserId()+"&name="+teacher.getName()+ | |
| 124 | + "&data="+teacher.getDingUserId()+"&type=1&stype=4&mobile="+teacher.getMobile()+"&pass="+teacher.getPass()+ | |
| 125 | + "&face=&sourcetype=16&soutype=3×tamp="+ DateUtils.getDate() ; | |
| 126 | + dingSms.setWapUrl(wapUrl); | |
| 127 | + dingSms.setTdType(TypeEnums.kaoqing.getType()); | |
| 128 | + smsMapper.insertDing(dingSms); | |
| 129 | + } | |
| 115 | 130 | } |
| 116 | 131 | } |
| 117 | 132 | } |
| 118 | 133 | |
| 119 | 134 | private void weChatPush(List<KqTeacherDto> list , String key){ |
| 135 | + String[] times = key.split("_"); | |
| 120 | 136 | String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); |
| 121 | 137 | AppDto appDto = scFeign.getApp(list.get(0).getSchoolId(),0); |
| 122 | 138 | for(KqTeacherDto teacher : list){ |
| 123 | - if(StringUtils.isNotBlank(teacher.getxSTOpenId())){ | |
| 124 | - WeChatSms weChatSms = new WeChatSms(); | |
| 125 | - weChatSms.setTableName("qyhSmsNew"+tableSuffix); | |
| 126 | - weChatSms.setSchoolId(teacher.getSchoolId()); | |
| 127 | - weChatSms.setName(teacher.getName()); | |
| 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()); | |
| 133 | - String msgUrl = "http://campus.myjxt.com/studentRecord/znxwwebapp/index.html?" + | |
| 134 | - "schoolid="+teacher.getSchoolId()+"&userId="+teacher.getUserId()+"&name="+teacher.getName()+ | |
| 135 | - "&data="+teacher.getWeChatUserId()+"&type=1&stype=3&mobile="+teacher.getMobile()+"&pass="+teacher.getPass()+ | |
| 136 | - "&face="+ teacher.getFace() +"&sourcetype=16&soutype=2×tamp="+ DateUtils.getDate() ; | |
| 137 | - weChatSms.setMsgUrl(msgUrl); | |
| 138 | - smsMapper.insertWeChat(weChatSms); | |
| 139 | + if(teacher.getName().equals("陶汉栋") || teacher.getName().equals("沈川")) { | |
| 140 | + if (StringUtils.isNotBlank(teacher.getOpenId())) { | |
| 141 | + List<CensusKqDto> censusKqDtos = scFeign.getCensusKq(teacher.getUserId(),Integer.valueOf(times[2])); | |
| 142 | + String message = ""; | |
| 143 | + for(CensusKqDto censusKqDto : censusKqDtos){ | |
| 144 | + int number = censusKqDto.getAllT() - censusKqDto.getKqT() ; | |
| 145 | + message += "[" + censusKqDto.getClassName() + "]未考勤" + number + "人;"; | |
| 146 | + } | |
| 147 | + WeChatSms weChatSms = new WeChatSms(); | |
| 148 | + weChatSms.setTableName("qyhSmsNew" + tableSuffix); | |
| 149 | + weChatSms.setMsg("报告类型:"+KqTypeEnums.getName(Integer.valueOf(times[2])) + "出勤报告 \n - "+ | |
| 150 | + "签到日期:"+DateUtils.date2String(new Date(),DateUtils.format1)+ "("+DateUtils.getWeekName()+") \n - "+ | |
| 151 | + "签到时间:"+times[0]+"-"+ times[1] +" \n - "+ | |
| 152 | + "整体数据:" + message.substring(0,message.length()-1)); | |
| 153 | + weChatSms.setSchoolId(teacher.getSchoolId()); | |
| 154 | + weChatSms.setName(teacher.getName()); | |
| 155 | + weChatSms.setQiYeHaoUserId(teacher.getWeChatUserId()); | |
| 156 | + weChatSms.setReceiveUserId(teacher.getUserId()); | |
| 157 | + weChatSms.setAppId(appDto.getAgentId()); | |
| 158 | + weChatSms.setSecret(appDto.getAgentSecret()); | |
| 159 | + String msgUrl = "http://campus.myjxt.com/studentRecord/znxwwebapp/index.html?" + | |
| 160 | + "schoolid=" + teacher.getSchoolId() + "&userId=" + teacher.getUserId() + "&name=" + teacher.getName() + | |
| 161 | + "&data=" + teacher.getWeChatUserId() + "&type=1&stype=3&mobile=" + teacher.getMobile() + "&pass=" + teacher.getPass() + | |
| 162 | + "&face=" + teacher.getFace() + "&sourcetype=16&soutype=2×tamp=" + DateUtils.getDate(); | |
| 163 | + weChatSms.setMsgUrl(msgUrl); | |
| 164 | + weChatSms.setTdType(TypeEnums.kaoqing.getType()); | |
| 165 | + smsMapper.insertWeChat(weChatSms); | |
| 166 | + } | |
| 139 | 167 | } |
| 140 | 168 | } |
| 141 | 169 | } | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/model/DingSms.java
| ... | ... | @@ -13,6 +13,7 @@ public class DingSms { |
| 13 | 13 | private String dingUserId ; |
| 14 | 14 | private String wapUrl ; |
| 15 | 15 | private String agentId ; |
| 16 | + private int tdType ; | |
| 16 | 17 | |
| 17 | 18 | public String getTableName() { |
| 18 | 19 | return tableName; |
| ... | ... | @@ -61,4 +62,12 @@ public class DingSms { |
| 61 | 62 | public void setAgentId(String agentId) { |
| 62 | 63 | this.agentId = agentId; |
| 63 | 64 | } |
| 65 | + | |
| 66 | + public int getTdType() { | |
| 67 | + return tdType; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setTdType(int tdType) { | |
| 71 | + this.tdType = tdType; | |
| 72 | + } | |
| 64 | 73 | } | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/model/WeChatSms.java
| ... | ... | @@ -14,9 +14,10 @@ public class WeChatSms { |
| 14 | 14 | private int schoolId ; |
| 15 | 15 | private String msgUrl ; |
| 16 | 16 | private String name ; |
| 17 | - private String xSTOpenId ; | |
| 18 | 17 | private String appId ; |
| 19 | 18 | private String secret ; |
| 19 | + private int tdType ; | |
| 20 | + private String msg ; | |
| 20 | 21 | |
| 21 | 22 | |
| 22 | 23 | public String getAppId() { |
| ... | ... | @@ -83,11 +84,19 @@ public class WeChatSms { |
| 83 | 84 | this.name = name; |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | - public String getxSTOpenId() { | |
| 87 | - return xSTOpenId; | |
| 87 | + public int getTdType() { | |
| 88 | + return tdType; | |
| 88 | 89 | } |
| 89 | 90 | |
| 90 | - public void setxSTOpenId(String xSTOpenId) { | |
| 91 | - this.xSTOpenId = xSTOpenId; | |
| 91 | + public void setTdType(int tdType) { | |
| 92 | + this.tdType = tdType; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public String getMsg() { | |
| 96 | + return msg; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public void setMsg(String msg) { | |
| 100 | + this.msg = msg; | |
| 92 | 101 | } |
| 93 | 102 | } | ... | ... |
cloud/quartz/src/main/resources/mapper/SmsMapper.xml
| ... | ... | @@ -3,12 +3,12 @@ |
| 3 | 3 | <mapper namespace="com.sincere.quartz.mapper.SmsMapper"> |
| 4 | 4 | |
| 5 | 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}) | |
| 6 | + insert into ${tableName} (Msg,MsgID,SchoolID,Type,Status,intime,sendtime,DingUserId,WapUrl,agentid,tdtype) | |
| 7 | + values (#{msg},-1,#{schoolId},1,0,GETDATE(),GETDATE(),#{dingUserId},#{wapUrl},#{agentId},#{tdType}) | |
| 8 | 8 | </insert> |
| 9 | 9 | |
| 10 | 10 | <insert id="insertWeChat" parameterType="com.sincere.quartz.model.WeChatSms"> |
| 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}) | |
| 11 | + insert into ${tableName} (SchoolID,MsgID,Guid,WapUrl,Status,intime,sendTime,SendUserName,ReceiveUserID,QiYeHaoUserId,AppID,Secret,tdtype) | |
| 12 | + values (#{schoolId},-1,#{msg},#{msgUrl},0,GETDATE(),GETDATE(),'智能校卫',#{receiveUserId},#{qiYeHaoUserId},#{appId},#{secret},#{tdType}) | |
| 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 | 3 | import com.sincere.common.dto.smartCampus.AppDto; |
| 4 | +import com.sincere.common.dto.smartCampus.CensusKqDto; | |
| 4 | 5 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
| 5 | 6 | import com.sincere.common.dto.smartCampus.TemplateDto; |
| 7 | +import com.sincere.common.util.DateUtils; | |
| 6 | 8 | import com.sincere.smartSearch.model.KqTemplate; |
| 7 | 9 | import com.sincere.smartSearch.service.KqService; |
| 8 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -11,10 +13,7 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 11 | 13 | import org.springframework.web.bind.annotation.RequestParam; |
| 12 | 14 | import org.springframework.web.bind.annotation.RestController; |
| 13 | 15 | |
| 14 | -import java.util.ArrayList; | |
| 15 | -import java.util.HashMap; | |
| 16 | -import java.util.List; | |
| 17 | -import java.util.Map; | |
| 16 | +import java.util.*; | |
| 18 | 17 | |
| 19 | 18 | /** |
| 20 | 19 | * @author chen |
| ... | ... | @@ -55,4 +54,14 @@ public class KqController { |
| 55 | 54 | map.put("type",type); |
| 56 | 55 | return kqService.selectApp(map); |
| 57 | 56 | } |
| 57 | + | |
| 58 | + @RequestMapping(value = "getCensusKq",method = RequestMethod.GET) | |
| 59 | + public List<CensusKqDto> getCensusKq(@RequestParam("userId") String userId , @RequestParam("type") int type){ | |
| 60 | + String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); | |
| 61 | + Map<String,String> map = new HashMap<>(); | |
| 62 | + map.put("userId",userId); | |
| 63 | + map.put("tableName","SZ_AttendanceRecords"+tableSuffix); | |
| 64 | + map.put("type",type+""); | |
| 65 | + return kqService.selectCensusKq(map); | |
| 66 | + } | |
| 58 | 67 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/KqTemplateMapper.java
| 1 | 1 | package com.sincere.smartSearch.mapper; |
| 2 | 2 | |
| 3 | 3 | import com.sincere.common.dto.smartCampus.AppDto; |
| 4 | +import com.sincere.common.dto.smartCampus.CensusKqDto; | |
| 4 | 5 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
| 5 | 6 | import com.sincere.smartSearch.model.KqTemplate; |
| 6 | 7 | |
| ... | ... | @@ -19,4 +20,6 @@ public interface KqTemplateMapper { |
| 19 | 20 | List<KqTeacherDto> selectSchoolTeacher(int schoolId); |
| 20 | 21 | |
| 21 | 22 | AppDto selectApp(Map<String,Integer> map); |
| 23 | + | |
| 24 | + List<CensusKqDto> selectCensusKq(Map<String ,String> map); | |
| 22 | 25 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/KqService.java
| 1 | 1 | package com.sincere.smartSearch.service; |
| 2 | 2 | |
| 3 | 3 | import com.sincere.common.dto.smartCampus.AppDto; |
| 4 | +import com.sincere.common.dto.smartCampus.CensusKqDto; | |
| 4 | 5 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
| 5 | 6 | import com.sincere.smartSearch.model.KqTemplate; |
| 6 | 7 | |
| ... | ... | @@ -19,4 +20,6 @@ public interface KqService { |
| 19 | 20 | List<KqTeacherDto> selectSchoolTeacher(int schoolId); |
| 20 | 21 | |
| 21 | 22 | AppDto selectApp(Map<String,Integer> map); |
| 23 | + | |
| 24 | + List<CensusKqDto> selectCensusKq(Map<String ,String> map); | |
| 22 | 25 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/KqServiceImpl.java
| 1 | 1 | package com.sincere.smartSearch.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.sincere.common.dto.smartCampus.AppDto; |
| 4 | +import com.sincere.common.dto.smartCampus.CensusKqDto; | |
| 4 | 5 | import com.sincere.common.dto.smartCampus.KqTeacherDto; |
| 5 | 6 | import com.sincere.smartSearch.mapper.KqTemplateMapper; |
| 6 | 7 | import com.sincere.smartSearch.model.KqTemplate; |
| ... | ... | @@ -36,4 +37,9 @@ public class KqServiceImpl implements KqService { |
| 36 | 37 | public AppDto selectApp(Map<String, Integer> map) { |
| 37 | 38 | return kqTemplateMapper.selectApp(map); |
| 38 | 39 | } |
| 40 | + | |
| 41 | + @Override | |
| 42 | + public List<CensusKqDto> selectCensusKq(Map<String, String> map) { | |
| 43 | + return kqTemplateMapper.selectCensusKq(map); | |
| 44 | + } | |
| 39 | 45 | } | ... | ... |
cloud/search_smartCampus/src/main/resources/application.yml
cloud/search_smartCampus/src/main/resources/logback.xml
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <configuration debug="true"> |
| 3 | 3 | <!-- 项目名称 --> |
| 4 | - <property name="PROJECT_NAME" value="schedule" /> | |
| 4 | + <property name="PROJECT_NAME" value="search_smartCampus" /> | |
| 5 | 5 | |
| 6 | 6 | <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> |
| 7 | - <!-- <property name="LOG_HOME" value="/opt/web/log/" />--> | |
| 8 | - <property name="LOG_HOME" value="C://smartCampus_java//log"/> | |
| 7 | + <property name="LOG_HOME" value="C://log"/> | |
| 9 | 8 | |
| 10 | 9 | <!-- 控制台输出 --> |
| 11 | 10 | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
| ... | ... | @@ -22,7 +21,7 @@ |
| 22 | 21 | <!-- 过滤器,只打印ERROR级别的日志 --> |
| 23 | 22 | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| 24 | 23 | <!--日志文件输出的文件名--> |
| 25 | - <FileNamePattern>${LOG_HOME}/${PROJECT_NAME}.system-dev.%d{yyyy-MM-dd HH}.%i.log</FileNamePattern> | |
| 24 | + <FileNamePattern>${LOG_HOME}/${PROJECT_NAME}/%d{yyyy-MM-dd HH}.%i.log</FileNamePattern> | |
| 26 | 25 | <!--日志文件保留天数--> |
| 27 | 26 | <MaxHistory>30</MaxHistory> |
| 28 | 27 | <!--日志文件最大的大小--> | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/KqTemplateMapper.xml
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | <select id="selectKqTemplate" resultMap="TemplateMap"> |
| 12 | 12 | select XA_KqTemplate.config , XA_KqTemplate.SchoolId ,SZ_School.MsgTypes as type from XA_KqTemplate |
| 13 | 13 | join SZ_School on XA_KqTemplate.SchoolId = SZ_School.school_id |
| 14 | - where XA_KqTemplate.State = 1 and XA_KqTemplate.ScenceType = 0 | |
| 14 | + where XA_KqTemplate.State = 1 and XA_KqTemplate.ScenceType = 0 and XA_KqTemplate.TType = 1 | |
| 15 | 15 | and (SZ_School.MsgTypes like '%4%' or SZ_School.MsgTypes like '%5%') |
| 16 | 16 | </select> |
| 17 | 17 | |
| ... | ... | @@ -23,14 +23,16 @@ |
| 23 | 23 | <result column="pass" property="pass"/> |
| 24 | 24 | <result column="DingUserId" property="dingUserId"/> |
| 25 | 25 | <result column="QiYeHaoUserId" property="weChatUserId"/> |
| 26 | - <result column="XSTOpenId" property="xSTOpenId"/> | |
| 26 | + <result column="OpenId" property="openId"/> | |
| 27 | 27 | <result column="face" property="face"/> |
| 28 | 28 | </resultMap> |
| 29 | 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 | |
| 30 | + select distinct a.user_id,a.school_id,a.name,a.mobile,a.face,a.pass, a.OpenId,a.QiYeHaoUserId,a.DingUserId | |
| 31 | + from SZ_V_School_Teacher a | |
| 32 | + inner join SZ_Class b on a.class_id=b.class_id and b.state=1 and b.is_finish=0 | |
| 33 | + join SZ_UserRole on a.user_id = SZ_UserRole.user_id | |
| 34 | + and a.school_id=#{schoolId} | |
| 35 | + where a.role_state=1 and SZ_UserRole.userType = 0 | |
| 34 | 36 | </select> |
| 35 | 37 | |
| 36 | 38 | <resultMap id="AppMap" type="com.sincere.common.dto.smartCampus.AppDto"> |
| ... | ... | @@ -41,4 +43,20 @@ |
| 41 | 43 | select AgentId,AgentSecret from EM_QYHApply where SchoolId=#{schoolId} and type= #{type} |
| 42 | 44 | and ApplyName = '智能校卫' |
| 43 | 45 | </select> |
| 46 | + | |
| 47 | + <resultMap id="KqMap" type="com.sincere.common.dto.smartCampus.CensusKqDto"> | |
| 48 | + <result column="class_name" property="className"/> | |
| 49 | + <result column="allT" property="allT"/> | |
| 50 | + <result column="kqT" property="kqT"/> | |
| 51 | + </resultMap> | |
| 52 | + <select id="selectCensusKq" parameterType="java.util.Map" resultMap="KqMap"> | |
| 53 | + select distinct b.class_name, | |
| 54 | + (select count(distinct user_id) from SZ_V_School_Student x where c.class_id=x.class_id) as allT, | |
| 55 | + (select count(distinct customerid) from dblan27.xiaoanhxy.dbo.${tableName} y | |
| 56 | + where convert(varchar(10),y.intime,120)=convert(varchar(10),getdate(),120) and y.class_id=c.class_id and y.card_type=#{type}) as kqT | |
| 57 | + from sz_userrole c | |
| 58 | + inner join SZ_Class b on c.class_id=b.class_id and b.state=1 and b.is_finish=0 | |
| 59 | + inner join SZ_V_School_Teacher a on a.user_id=c.user_id and c.usertype=0 | |
| 60 | + where a.role_state=1 and a.user_id=#{userId} | |
| 61 | + </select> | |
| 44 | 62 | </mapper> | ... | ... |