|
@ -23,6 +23,7 @@ import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
@ -56,6 +57,10 @@ public class MessageService extends BaseService {
|
|
|
private HttpClientUtil HttpClientUtil;
|
|
|
@Autowired
|
|
|
private MessageNoticeSettingDao messageNoticeSettingDao;
|
|
|
@Autowired
|
|
|
private StringRedisTemplate redisTemplate;
|
|
|
|
|
|
private final String MESSAGE_NOTICESETTING = "wlyy:message:setting:";
|
|
|
|
|
|
@Value("${im.im_list_get}")
|
|
|
private String im_list_get;
|
|
@ -496,26 +501,34 @@ public class MessageService extends BaseService {
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
public MessageNoticeSetting getMessageNoticSetting(String user,String type){
|
|
|
MessageNoticeSetting messageNoticeSetting = messageNoticeSettingDao.findByUserAndType(user,type);
|
|
|
if(messageNoticeSetting == null){
|
|
|
messageNoticeSetting = new MessageNoticeSetting();
|
|
|
messageNoticeSetting.setCreateTime(new Date());
|
|
|
messageNoticeSetting.setFamilyTopicSwitch(1);
|
|
|
messageNoticeSetting.setCoordinationSwitch(1);
|
|
|
messageNoticeSetting.setHealthSignSwitch(1);
|
|
|
messageNoticeSetting.setImSwitch(1);
|
|
|
messageNoticeSetting.setMasterSwitch(1);
|
|
|
messageNoticeSetting.setPrescriptionSwitch(1);
|
|
|
messageNoticeSetting.setSignSwitch(1);
|
|
|
messageNoticeSetting.setSoundSwitch(1);
|
|
|
messageNoticeSetting.setSystemSwitch(1);
|
|
|
messageNoticeSetting.setType(type);
|
|
|
messageNoticeSetting.setUser(user);
|
|
|
messageNoticeSetting.setVibrationSwitch(1);
|
|
|
messageNoticeSettingDao.save(messageNoticeSetting);
|
|
|
public com.alibaba.fastjson.JSONObject getMessageNoticSetting(String user, String type){
|
|
|
com.alibaba.fastjson.JSONObject re = null;
|
|
|
String key = MESSAGE_NOTICESETTING+user+":"+type;
|
|
|
String response = redisTemplate.opsForValue().get(key);
|
|
|
if(StringUtils.isBlank(response)){
|
|
|
MessageNoticeSetting messageNoticeSetting = messageNoticeSettingDao.findByUserAndType(user,type);
|
|
|
if(messageNoticeSetting == null){
|
|
|
messageNoticeSetting = new MessageNoticeSetting();
|
|
|
messageNoticeSetting.setCreateTime(new Date());
|
|
|
messageNoticeSetting.setFamilyTopicSwitch(1);
|
|
|
messageNoticeSetting.setCoordinationSwitch(1);
|
|
|
messageNoticeSetting.setHealthSignSwitch(1);
|
|
|
messageNoticeSetting.setImSwitch(1);
|
|
|
messageNoticeSetting.setMasterSwitch(1);
|
|
|
messageNoticeSetting.setPrescriptionSwitch(1);
|
|
|
messageNoticeSetting.setSignSwitch(1);
|
|
|
messageNoticeSetting.setSoundSwitch(1);
|
|
|
messageNoticeSetting.setSystemSwitch(1);
|
|
|
messageNoticeSetting.setType(type);
|
|
|
messageNoticeSetting.setUser(user);
|
|
|
messageNoticeSetting.setVibrationSwitch(1);
|
|
|
messageNoticeSettingDao.save(messageNoticeSetting);
|
|
|
}
|
|
|
response = com.alibaba.fastjson.JSONObject.toJSONString(messageNoticeSetting);
|
|
|
redisTemplate.opsForValue().set(key,response);
|
|
|
}
|
|
|
return messageNoticeSetting;
|
|
|
re = com.alibaba.fastjson.JSONObject.parseObject(response);
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -528,5 +541,10 @@ public class MessageService extends BaseService {
|
|
|
messageNoticeSetting.setCreateTime(oldSetting.getCreateTime());
|
|
|
messageNoticeSetting.setType(oldSetting.getType());
|
|
|
messageNoticeSettingDao.save(messageNoticeSetting);
|
|
|
|
|
|
//更新缓存
|
|
|
String key = MESSAGE_NOTICESETTING+oldSetting.getUser()+":"+oldSetting.getType();
|
|
|
String response = com.alibaba.fastjson.JSONObject.toJSONString(messageNoticeSetting);
|
|
|
redisTemplate.opsForValue().set(key,response);
|
|
|
}
|
|
|
}
|