无关风月
2025-03-07 6d85e681bb7a4c2aba7558b943f84741be1416bf
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/AddNotice.java
@@ -33,56 +33,56 @@
            System.err.println(("----定时1秒后生成公告记录-----"));
            TNotices tNotices = tNoticesService.selectById(noticeId);
            if (SinataUtil.isNotEmpty(tNotices)){
                if (tNotices.getIsUser() == 2){
                    List<TUser> tUsers = tUserService.selectList(new EntityWrapper<TUser>().eq("state",1));
                    //发送公告给用户
                    for (TUser user : tUsers){
                        TSystemNotice notice = new TSystemNotice();
                        notice.setType(1);
                        notice.setUserType(1);
                        notice.setNoticesId(noticeId);
                        notice.setContent(tNotices.getContent());
                        notice.setUserId(user.getId());
                        notice.setInsertTime(new Date());
                        notice.setRead(1);
                        tSystemNoticeService.insert(notice);
                    /*Map<String,Object> map = new HashMap<String,Object>();
                    map.put("sound", userInfo.getIsVoice());   //是否有声音  1=否 2=是
                    map.put("vibrate", userInfo.getIsShake()); //是否有震动  1=否 2=是
                    map.put("type", 2);    //消息类型 1=互动  2=公告
                    map.put("id", record.getId()); //对象ID
                    JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/
                    }
                }
                if (tNotices.getIsDriver() == 2){
                    List<TDriver> tDrivers = tDriverService.selectList(new EntityWrapper<TDriver>().eq("authState",2));
                    //发送公告给用户
                    for (TDriver driver : tDrivers){
                        TSystemNotice notice = new TSystemNotice();
                        notice.setType(1);
                        notice.setUserType(2);
                        notice.setNoticesId(noticeId);
                        notice.setContent(tNotices.getContent());
                        notice.setUserId(driver.getId());
                        notice.setInsertTime(new Date());
                        notice.setRead(1);
                        tSystemNoticeService.insert(notice);
                        /*Map<String,Object> map = new HashMap<String,Object>();
                        map.put("sound", userInfo.getIsVoice());   //是否有声音  1=否 2=是
                        map.put("vibrate", userInfo.getIsShake()); //是否有震动  1=否 2=是
                        map.put("type", 2);    //消息类型 1=互动  2=公告
                        map.put("id", record.getId()); //对象ID
                        JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/
                        if (tNotices.getIsBroadcast() == 1){
                            //增加极光推送
                            JpushUtil.SendPushWithCustomForSh("DRIVER"+driver.getId().toString(),tNotices.getTitle(),"通知消息",null);
                        }
                    }
                }
//                if (tNotices.getIsUser() == 2){
//                    List<TUser> tUsers = tUserService.selectList(new EntityWrapper<TUser>().eq("state",1));
//                    //发送公告给用户
//                    for (TUser user : tUsers){
//                        TSystemNotice notice = new TSystemNotice();
//                        notice.setType(1);
//                        notice.setUserType(1);
//                        notice.setNoticesId(noticeId);
//                        notice.setContent(tNotices.getContent());
//                        notice.setUserId(user.getId());
//                        notice.setInsertTime(new Date());
//                        notice.setRead(1);
//                        tSystemNoticeService.insert(notice);
//
//                    /*Map<String,Object> map = new HashMap<String,Object>();
//                    map.put("sound", userInfo.getIsVoice());   //是否有声音  1=否 2=是
//                    map.put("vibrate", userInfo.getIsShake()); //是否有震动  1=否 2=是
//                    map.put("type", 2);    //消息类型 1=互动  2=公告
//                    map.put("id", record.getId()); //对象ID
//                    JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/
//                    }
//                }
//                if (tNotices.getIsDriver() == 2){
//                    List<TDriver> tDrivers = tDriverService.selectList(new EntityWrapper<TDriver>().eq("authState",2));
//                    //发送公告给用户
//                    for (TDriver driver : tDrivers){
//                        TSystemNotice notice = new TSystemNotice();
//                        notice.setType(1);
//                        notice.setUserType(2);
//                        notice.setNoticesId(noticeId);
//                        notice.setContent(tNotices.getContent());
//                        notice.setUserId(driver.getId());
//                        notice.setInsertTime(new Date());
//                        notice.setRead(1);
//                        tSystemNoticeService.insert(notice);
//
//                        /*Map<String,Object> map = new HashMap<String,Object>();
//                        map.put("sound", userInfo.getIsVoice());   //是否有声音  1=否 2=是
//                        map.put("vibrate", userInfo.getIsShake()); //是否有震动  1=否 2=是
//                        map.put("type", 2);    //消息类型 1=互动  2=公告
//                        map.put("id", record.getId()); //对象ID
//                        JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/
//
//                        if (tNotices.getIsBroadcast() == 1){
//                            //增加极光推送
//                            JpushUtil.SendPushWithCustomForSh("DRIVER"+driver.getId().toString(),tNotices.getTitle(),"通知消息",null);
//                        }
//
//                    }
//                }
            }
        } catch (Exception e) {
            e.printStackTrace();