Commit e7df2a1057a444aaa004ee2345098ffe352a791b
1 parent
02191019
Exists in
master
考勤推送
Showing
3 changed files
with
18 additions
and
21 deletions
Show diff stats
cloud/quartz/src/main/java/com/sincere/quartz/job/BindPushJob.java
| @@ -58,7 +58,6 @@ public class BindPushJob { | @@ -58,7 +58,6 @@ public class BindPushJob { | ||
| 58 | private void bindPush(BindPushDto bindPushDto , Date nowDate){ | 58 | private void bindPush(BindPushDto bindPushDto , Date nowDate){ |
| 59 | if(bindPushDto.getPushTime().equals(DateUtils.date2String(nowDate,DateUtils.format4))){ | 59 | if(bindPushDto.getPushTime().equals(DateUtils.date2String(nowDate,DateUtils.format4))){ |
| 60 | List<ParentDto> unFollowList = scFeign.selectNotFollow(bindPushDto.getSchoolId()); | 60 | List<ParentDto> unFollowList = scFeign.selectNotFollow(bindPushDto.getSchoolId()); |
| 61 | - | ||
| 62 | List<ParentDto> unBindList =scFeign.selectNotBind(bindPushDto.getSchoolId(),getThirdType(bindPushDto.getType())); | 61 | List<ParentDto> unBindList =scFeign.selectNotBind(bindPushDto.getSchoolId(),getThirdType(bindPushDto.getType())); |
| 63 | 62 | ||
| 64 | intervalDaysMap.put(bindPushDto.getSchoolId(),DateUtils.date2String(nowDate,DateUtils.format1)); | 63 | intervalDaysMap.put(bindPushDto.getSchoolId(),DateUtils.date2String(nowDate,DateUtils.format1)); |
cloud/quartz/src/main/java/com/sincere/quartz/job/KQJob.java
| @@ -58,12 +58,12 @@ public class KQJob { | @@ -58,12 +58,12 @@ public class KQJob { | ||
| 58 | for(Map.Entry<String, String> entity : map.entrySet()){ | 58 | for(Map.Entry<String, String> entity : map.entrySet()){ |
| 59 | String endTime = entity.getValue().split("_")[1]; | 59 | String endTime = entity.getValue().split("_")[1]; |
| 60 | if(DateUtils.getDateDifference(new Date(),DateUtils.string2Date(now+" "+endTime+":00",DateUtils.format2),"m")>=2 | 60 | if(DateUtils.getDateDifference(new Date(),DateUtils.string2Date(now+" "+endTime+":00",DateUtils.format2),"m")>=2 |
| 61 | - ){ | 61 | + && DateUtils.getDateDifference(new Date(),DateUtils.string2Date(now+" "+endTime+":00",DateUtils.format2),"m")<5){ |
| 62 | String key = entity.getKey(); | 62 | String key = entity.getKey(); |
| 63 | String[] messageArray = key.split("_"); | 63 | String[] messageArray = key.split("_"); |
| 64 | if(messageArray[2].contains(PushTypeEnums.QIYEHAO.getType()+"")){ | 64 | if(messageArray[2].contains(PushTypeEnums.QIYEHAO.getType()+"")){ |
| 65 | logger.info("企业号推送:" + messageArray[0] + "__" + messageArray[1]); | 65 | logger.info("企业号推送:" + messageArray[0] + "__" + messageArray[1]); |
| 66 | - //weChatBatchPush(messageArray[0],Integer.valueOf(messageArray[1]),entity.getValue()); | 66 | + weChatBatchPush(messageArray[0],Integer.valueOf(messageArray[1]),entity.getValue()); |
| 67 | } | 67 | } |
| 68 | if(messageArray[2].contains(PushTypeEnums.DING.getType()+"")){ | 68 | if(messageArray[2].contains(PushTypeEnums.DING.getType()+"")){ |
| 69 | logger.info(("盯盯推送:" + messageArray[0] + "__" + messageArray[1])); | 69 | logger.info(("盯盯推送:" + messageArray[0] + "__" + messageArray[1])); |
| @@ -114,21 +114,18 @@ public class KQJob { | @@ -114,21 +114,18 @@ public class KQJob { | ||
| 114 | //出入校 推班主任 | 114 | //出入校 推班主任 |
| 115 | List<KqTeacherDto> list = scFeign.getTeacherList(schoolId); | 115 | List<KqTeacherDto> list = scFeign.getTeacherList(schoolId); |
| 116 | for(KqTeacherDto teacher : list){ | 116 | for(KqTeacherDto teacher : list){ |
| 117 | - logger.info("盯盯推送班主任—————" + templateId + "--------" + teacher.getName()); | ||
| 118 | - dingSchoolPush(templateId,teacher,key,appDto); | 117 | + dingSchoolPush(templateId,teacher,key,appDto,0); |
| 119 | } | 118 | } |
| 120 | }else { | 119 | }else { |
| 121 | //出入寝 推班主任 | 120 | //出入寝 推班主任 |
| 122 | List<KqTeacherDto> list = scFeign.getTeacherList(schoolId); | 121 | List<KqTeacherDto> list = scFeign.getTeacherList(schoolId); |
| 123 | for(KqTeacherDto teacher : list){ | 122 | for(KqTeacherDto teacher : list){ |
| 124 | - logger.info("盯盯推送班主任—————" + templateId + "--------" + teacher.getName()); | ||
| 125 | - //dingSchoolPush(templateId,teacher, key, appDto); | 123 | + dingSchoolPush(templateId,teacher, key, appDto,1); |
| 126 | } | 124 | } |
| 127 | //推宿管 | 125 | //推宿管 |
| 128 | List<KqTeacherDto> chamberList = scFeign.selectChamberTeacher(schoolId); | 126 | List<KqTeacherDto> chamberList = scFeign.selectChamberTeacher(schoolId); |
| 129 | for(KqTeacherDto teacher : chamberList){ | 127 | for(KqTeacherDto teacher : chamberList){ |
| 130 | - logger.info("盯盯推送宿管—————" + templateId + "--------" + teacher.getName()); | ||
| 131 | - //dingChamberPush(templateId,teacher, key, appDto); | 128 | + dingChamberPush(templateId,teacher, key, appDto); |
| 132 | } | 129 | } |
| 133 | } | 130 | } |
| 134 | } | 131 | } |
| @@ -141,32 +138,29 @@ public class KQJob { | @@ -141,32 +138,29 @@ public class KQJob { | ||
| 141 | //出入校 推班主任 | 138 | //出入校 推班主任 |
| 142 | List<KqTeacherDto> list = scFeign.getTeacherList(schoolId); | 139 | List<KqTeacherDto> list = scFeign.getTeacherList(schoolId); |
| 143 | for (KqTeacherDto teacher : list) { | 140 | for (KqTeacherDto teacher : list) { |
| 144 | - logger.info("企业号推送班主任—————" + templateId + "--------" + teacher.getName()); | ||
| 145 | - weChatSchoolPush(templateId,teacher, key, appDto); | 141 | + weChatSchoolPush(templateId,teacher, key, appDto,0); |
| 146 | } | 142 | } |
| 147 | }else { | 143 | }else { |
| 148 | //出入寝 推班主任 | 144 | //出入寝 推班主任 |
| 149 | List<KqTeacherDto> list = scFeign.getTeacherList(schoolId); | 145 | List<KqTeacherDto> list = scFeign.getTeacherList(schoolId); |
| 150 | for (KqTeacherDto teacher : list) { | 146 | for (KqTeacherDto teacher : list) { |
| 151 | - logger.info("企业号推送班主任—————" + templateId + "--------" + teacher.getName()); | ||
| 152 | - weChatSchoolPush(templateId,teacher, key, appDto); | 147 | + weChatSchoolPush(templateId,teacher, key, appDto,1); |
| 153 | } | 148 | } |
| 154 | //推宿管 | 149 | //推宿管 |
| 155 | List<KqTeacherDto> chamberList = scFeign.selectChamberTeacher(schoolId); | 150 | List<KqTeacherDto> chamberList = scFeign.selectChamberTeacher(schoolId); |
| 156 | for(KqTeacherDto teacher : chamberList){ | 151 | for(KqTeacherDto teacher : chamberList){ |
| 157 | - logger.info("企业号推送宿管—————" + templateId + "--------" + teacher.getName()); | ||
| 158 | weChatChamberPush(templateId,teacher, key, appDto); | 152 | weChatChamberPush(templateId,teacher, key, appDto); |
| 159 | } | 153 | } |
| 160 | } | 154 | } |
| 161 | } | 155 | } |
| 162 | 156 | ||
| 163 | //盯盯推送班主任 | 157 | //盯盯推送班主任 |
| 164 | - private void dingSchoolPush(String templateId ,KqTeacherDto teacher , String key , AppDto appDto){ | 158 | + private void dingSchoolPush(String templateId ,KqTeacherDto teacher , String key , AppDto appDto , int type){ |
| 165 | String[] times = key.split("_"); | 159 | String[] times = key.split("_"); |
| 166 | String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); | 160 | String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); |
| 167 | String thirdOpenId = scFeign.getThirdId(teacher.getUserId(),0); | 161 | String thirdOpenId = scFeign.getThirdId(teacher.getUserId(),0); |
| 168 | if(StringUtils.isNotBlank(thirdOpenId)){ | 162 | if(StringUtils.isNotBlank(thirdOpenId)){ |
| 169 | - List<CensusKqDto> censusKqDtos = getCensus(Integer.valueOf(times[3]),templateId,teacher.getSchoolId(),teacher.getUserId(),1); | 163 | + List<CensusKqDto> censusKqDtos = getCensus(Integer.valueOf(times[3]),templateId,teacher.getSchoolId(),teacher.getUserId(),type); |
| 170 | if(censusKqDtos != null &&censusKqDtos.size() > 0){ | 164 | if(censusKqDtos != null &&censusKqDtos.size() > 0){ |
| 171 | String message = ""; | 165 | String message = ""; |
| 172 | for(CensusKqDto censusKqDto : censusKqDtos){ | 166 | for(CensusKqDto censusKqDto : censusKqDtos){ |
| @@ -190,6 +184,7 @@ public class KQJob { | @@ -190,6 +184,7 @@ public class KQJob { | ||
| 190 | dingSms.setReceiveUserId(teacher.getUserId()); | 184 | dingSms.setReceiveUserId(teacher.getUserId()); |
| 191 | dingSms.setTdType(TypeEnums.kaoqing.getType()); | 185 | dingSms.setTdType(TypeEnums.kaoqing.getType()); |
| 192 | this.insertDing(dingSms); | 186 | this.insertDing(dingSms); |
| 187 | + logger.info("盯盯推送班主任—————" + templateId + "--------" + teacher.getName()); | ||
| 193 | } | 188 | } |
| 194 | } | 189 | } |
| 195 | } | 190 | } |
| @@ -223,17 +218,18 @@ public class KQJob { | @@ -223,17 +218,18 @@ public class KQJob { | ||
| 223 | dingSms.setReceiveUserId(teacher.getUserId()); | 218 | dingSms.setReceiveUserId(teacher.getUserId()); |
| 224 | dingSms.setTdType(TypeEnums.kaoqing.getType()); | 219 | dingSms.setTdType(TypeEnums.kaoqing.getType()); |
| 225 | this.insertDing(dingSms); | 220 | this.insertDing(dingSms); |
| 221 | + logger.info("盯盯推送宿管—————" + templateId + "--------" + teacher.getName()); | ||
| 226 | } | 222 | } |
| 227 | } | 223 | } |
| 228 | } | 224 | } |
| 229 | 225 | ||
| 230 | //企业号推送班主任 | 226 | //企业号推送班主任 |
| 231 | - private void weChatSchoolPush(String templateId, KqTeacherDto teacher , String key , AppDto appDto){ | 227 | + private void weChatSchoolPush(String templateId, KqTeacherDto teacher , String key , AppDto appDto , int type){ |
| 232 | String[] times = key.split("_"); | 228 | String[] times = key.split("_"); |
| 233 | String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); | 229 | String tableSuffix = DateUtils.date2String(new Date(), DateUtils.format); |
| 234 | String thirdOpenId = scFeign.getThirdId(teacher.getUserId(),1); | 230 | String thirdOpenId = scFeign.getThirdId(teacher.getUserId(),1); |
| 235 | if (StringUtils.isNotBlank(thirdOpenId)) { | 231 | if (StringUtils.isNotBlank(thirdOpenId)) { |
| 236 | - List<CensusKqDto> censusKqDtos = getCensus(Integer.valueOf(times[3]),templateId,teacher.getSchoolId(),teacher.getUserId(),1); | 232 | + List<CensusKqDto> censusKqDtos = getCensus(Integer.valueOf(times[3]),templateId,teacher.getSchoolId(),teacher.getUserId(),type); |
| 237 | if (censusKqDtos != null && censusKqDtos.size() > 0) { | 233 | if (censusKqDtos != null && censusKqDtos.size() > 0) { |
| 238 | String message = ""; | 234 | String message = ""; |
| 239 | for (CensusKqDto censusKqDto : censusKqDtos) { | 235 | for (CensusKqDto censusKqDto : censusKqDtos) { |
| @@ -258,6 +254,7 @@ public class KQJob { | @@ -258,6 +254,7 @@ public class KQJob { | ||
| 258 | weChatSms.setMsgUrl(msgUrl); | 254 | weChatSms.setMsgUrl(msgUrl); |
| 259 | weChatSms.setTdType(TypeEnums.kaoqing.getType()); | 255 | weChatSms.setTdType(TypeEnums.kaoqing.getType()); |
| 260 | this.insertQYH(weChatSms); | 256 | this.insertQYH(weChatSms); |
| 257 | + logger.info("企业号推送班主任—————" + templateId + "--------" + teacher.getName()); | ||
| 261 | } | 258 | } |
| 262 | } | 259 | } |
| 263 | } | 260 | } |
| @@ -292,6 +289,7 @@ public class KQJob { | @@ -292,6 +289,7 @@ public class KQJob { | ||
| 292 | weChatSms.setMsgUrl(msgUrl); | 289 | weChatSms.setMsgUrl(msgUrl); |
| 293 | weChatSms.setTdType(TypeEnums.kaoqing.getType()); | 290 | weChatSms.setTdType(TypeEnums.kaoqing.getType()); |
| 294 | this.insertQYH(weChatSms); | 291 | this.insertQYH(weChatSms); |
| 292 | + logger.info("企业号推送宿管—————" + templateId + "--------" + teacher.getName()); | ||
| 295 | } | 293 | } |
| 296 | } | 294 | } |
| 297 | } | 295 | } |
| @@ -299,19 +297,19 @@ public class KQJob { | @@ -299,19 +297,19 @@ public class KQJob { | ||
| 299 | //type 0 出入校 1 出入寝 | 297 | //type 0 出入校 1 出入寝 |
| 300 | private List<CensusKqDto> getCensus(int id , String templateId ,int schoolId , String userId ,int type){ | 298 | private List<CensusKqDto> getCensus(int id , String templateId ,int schoolId , String userId ,int type){ |
| 301 | List<CensusKqDto> list = new ArrayList<>(); | 299 | List<CensusKqDto> list = new ArrayList<>(); |
| 302 | - CensusKqDto censusKqDto = new CensusKqDto(); | ||
| 303 | String url = "http://campus.myjxt.com/api/EasyN/GeAttendDetailNew?schoolId="+schoolId+ | 300 | String url = "http://campus.myjxt.com/api/EasyN/GeAttendDetailNew?schoolId="+schoolId+ |
| 304 | "&id="+id+"&templateID="+templateId+"&type="+type+"&userId="+userId+"&time=" + DateUtils.date2String(new Date(),DateUtils.format1); | 301 | "&id="+id+"&templateID="+templateId+"&type="+type+"&userId="+userId+"&time=" + DateUtils.date2String(new Date(),DateUtils.format1); |
| 305 | JSONObject jsonObject = HttpClientUtils.httpGet(url); | 302 | JSONObject jsonObject = HttpClientUtils.httpGet(url); |
| 306 | try{ | 303 | try{ |
| 307 | JSONArray data = (JSONArray)jsonObject.get("data"); | 304 | JSONArray data = (JSONArray)jsonObject.get("data"); |
| 308 | for(int i = 0 ; i < data.size() ; i++){ | 305 | for(int i = 0 ; i < data.size() ; i++){ |
| 306 | + CensusKqDto censusKqDto = new CensusKqDto(); | ||
| 309 | JSONObject object = data.getJSONObject(i); | 307 | JSONObject object = data.getJSONObject(i); |
| 310 | censusKqDto.setLeaveCount((Integer) object.get("leaveCount")); | 308 | censusKqDto.setLeaveCount((Integer) object.get("leaveCount")); |
| 311 | censusKqDto.setNotAttendCount((Integer) object.get("noAttendCount")); | 309 | censusKqDto.setNotAttendCount((Integer) object.get("noAttendCount")); |
| 312 | censusKqDto.setTargetName((String)object.get("name")); | 310 | censusKqDto.setTargetName((String)object.get("name")); |
| 311 | + list.add(censusKqDto); | ||
| 313 | } | 312 | } |
| 314 | - list.add(censusKqDto); | ||
| 315 | }catch (Exception e){ | 313 | }catch (Exception e){ |
| 316 | 314 | ||
| 317 | } | 315 | } |
cloud/search_smartCampus/src/main/resources/mapper/KqTemplateMapper.xml
| @@ -53,6 +53,6 @@ | @@ -53,6 +53,6 @@ | ||
| 53 | 53 | ||
| 54 | 54 | ||
| 55 | <select id="selectThirdId" parameterType="java.util.Map" resultType="java.lang.String"> | 55 | <select id="selectThirdId" parameterType="java.util.Map" resultType="java.lang.String"> |
| 56 | - select DQuserId from EM_QyDingUser where HxyUserId = #{userId} and State = 1 and QyType = #{type} | 56 | + select top 1 DQuserId from EM_QyDingUser where HxyUserId = #{userId} and State = 1 and QyType = #{type} |
| 57 | </select> | 57 | </select> |
| 58 | </mapper> | 58 | </mapper> |