|
@@ -186,7 +186,7 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
|
|
|
if (BeanUtils.isNotEmpty(list)){
|
|
if (BeanUtils.isNotEmpty(list)){
|
|
|
for (Map<String, Object> map : list) {
|
|
for (Map<String, Object> map : list) {
|
|
|
- String sql2 = " select id_,she_bei_ming_cheng_,yuan_she_bei_bian,guan_li_ren_,he_cha_xiao_zhun_,chu_chang_ri_qi_ from t_sbdj " +
|
|
|
|
|
|
|
+ String sql2 = " select id_,she_bei_ming_cheng_,yuan_she_bei_bian,guan_li_ren_,he_cha_xiao_zhun_,chu_chang_ri_qi_,bian_zhi_bu_men_ from t_sbdj " +
|
|
|
" where guan_li_ren_='"+map.get("guan_li_ren_")+"' and he_cha_xiao_zhun_!='' and he_cha_xiao_zhun_ is not null and chu_chang_ri_qi_!='' and chu_chang_ri_qi_ is not null ";
|
|
" where guan_li_ren_='"+map.get("guan_li_ren_")+"' and he_cha_xiao_zhun_!='' and he_cha_xiao_zhun_ is not null and chu_chang_ri_qi_!='' and chu_chang_ri_qi_ is not null ";
|
|
|
List<Map<String, Object>> equipList = (List<Map<String, Object>>) commonDao.query(sql2);
|
|
List<Map<String, Object>> equipList = (List<Map<String, Object>>) commonDao.query(sql2);
|
|
|
if (BeanUtils.isNotEmpty(equipList)){
|
|
if (BeanUtils.isNotEmpty(equipList)){
|
|
@@ -221,18 +221,20 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
LocalDate currDate = LocalDate.now();
|
|
LocalDate currDate = LocalDate.now();
|
|
|
|
|
|
|
|
String guanLiRen = StringUtil.defaultString(eqMap.get("guan_li_ren_").toString(),"");
|
|
String guanLiRen = StringUtil.defaultString(eqMap.get("guan_li_ren_").toString(),"");
|
|
|
- changeMessagePushUser(guanLiRen,pushuser);
|
|
|
|
|
- if(pushuser.isEmpty()){
|
|
|
|
|
- //当保管人所在的所有组都没有专业组组长的时候推送给保管者
|
|
|
|
|
- pushuser.add(guanLiRen);
|
|
|
|
|
- //过滤掉重复数据
|
|
|
|
|
- pushuser.stream()
|
|
|
|
|
- .distinct()
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String bianZhiBuMeng = StringUtil.defaultString(eqMap.get("bian_zhi_bu_men_").toString(),"");
|
|
|
|
|
+ //changeMessagePushUser(guanLiRen,pushuser);
|
|
|
|
|
|
|
|
// 比较 出厂日期 加上N年后是否小于等于 当前日期
|
|
// 比较 出厂日期 加上N年后是否小于等于 当前日期
|
|
|
if (futureDate.isBefore(currDate) || futureDate.isEqual(currDate)) {
|
|
if (futureDate.isBefore(currDate) || futureDate.isEqual(currDate)) {
|
|
|
|
|
+ changeMessagePushUser2(bianZhiBuMeng,pushuser);
|
|
|
|
|
+ if(pushuser.isEmpty()){
|
|
|
|
|
+ //当保管人所在的所有组都没有专业组组长的时候推送给保管者
|
|
|
|
|
+ pushuser.add(guanLiRen);
|
|
|
|
|
+ //过滤掉重复数据
|
|
|
|
|
+ pushuser.stream()
|
|
|
|
|
+ .distinct()
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
for(String zhanghao : pushuser){
|
|
for(String zhanghao : pushuser){
|
|
|
Map<String, Object> rili = commonDao.queryOne("select id_ from ibps_party_user_calendar where type_='EQUIP_OVERDUE' and data_info_='t_sbdj' and data_source_id_='"+sourceId+"' and user_id_ = '"+zhanghao+"' limit 1");
|
|
Map<String, Object> rili = commonDao.queryOne("select id_ from ibps_party_user_calendar where type_='EQUIP_OVERDUE' and data_info_='t_sbdj' and data_source_id_='"+sourceId+"' and user_id_ = '"+zhanghao+"' limit 1");
|
|
|
// 已经 添加过的日程不再提醒
|
|
// 已经 添加过的日程不再提醒
|
|
@@ -261,6 +263,32 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void changeMessagePushUser2(String bianZhiBuMeng, ArrayList<String> pushuser) {
|
|
|
|
|
+ String groupSql = "select id_,name_,depth_ from ibps_party_entity where id_ = '"+bianZhiBuMeng+"'";//DEPTH_为4以上的是组
|
|
|
|
|
+ List<Map<String, Object>> entity = (List<Map<String, Object>>) commonDao.query(groupSql);
|
|
|
|
|
+ if(BeanUtils.isEmpty(entity) || entity.size()<1){
|
|
|
|
|
+ logger.warn("设备编制建档部门:"+bianZhiBuMeng+"查询不到信息......");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ for(Map groupInfo :entity){//应该只有一条记录
|
|
|
|
|
+ String roleIdSql = "select id_ from ibps_party_entity where PARTY_ALIAS_='zhsfzr' limit 1";//专业组组长角色
|
|
|
|
|
+ List<Map<String, Object>> role = (List<Map<String, Object>>) commonDao.query(roleIdSql);
|
|
|
|
|
+ String roleId = role.get(0).get("id_").toString().trim();
|
|
|
|
|
+ String group = (String) groupInfo.get("id_");
|
|
|
|
|
+ //获取和设备保管人一个组并且是专业组组长的用户
|
|
|
|
|
+ String teamLeaderSql = "SELECT id_,name_,status_,positions_,job_ FROM IBPS_PARTY_EMPLOYEE WHERE STATUS_='actived' and POSITIONS_ LIKE '%"+group.trim()+"%' AND JOB_ LIKE '%"+roleId+"%';";
|
|
|
|
|
+ List<Map<String, Object>> userList = (List<Map<String, Object>>) commonDao.query(teamLeaderSql);
|
|
|
|
|
+ if(BeanUtils.isEmpty(userList) || userList.size()<1){
|
|
|
|
|
+ logger.warn("设备编制建档部门:"+bianZhiBuMeng+"不存在专业组组长");
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ for(Map user :userList){
|
|
|
|
|
+ pushuser.add(user.get("id_").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void changeMessagePushUser(String guanLiRen,List<String> pushuser) {
|
|
private void changeMessagePushUser(String guanLiRen,List<String> pushuser) {
|
|
|
String sql = "select id_,positions_ from IBPS_PARTY_EMPLOYEE WHERE ID_='"+guanLiRen+"' limit 1";
|
|
String sql = "select id_,positions_ from IBPS_PARTY_EMPLOYEE WHERE ID_='"+guanLiRen+"' limit 1";
|
|
|
List<Map<String, Object>> positions = (List<Map<String, Object>>) commonDao.query(sql);
|
|
List<Map<String, Object>> positions = (List<Map<String, Object>>) commonDao.query(sql);
|