MessageServiceImpl.java 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. package com.goafanti.message.service.impl;
  2. import java.util.ArrayList;
  3. import java.util.Arrays;
  4. import java.util.Date;
  5. import java.util.HashMap;
  6. import java.util.List;
  7. import java.util.Map;
  8. import java.util.UUID;
  9. import org.apache.commons.lang3.StringUtils;
  10. import org.apache.shiro.SecurityUtils;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Service;
  13. import org.springframework.transaction.annotation.Transactional;
  14. import com.goafanti.app.bo.IndexBo;
  15. import com.goafanti.common.dao.JpushEasemobAccountMapper;
  16. import com.goafanti.common.dao.JtMessageConsumerMapper;
  17. import com.goafanti.common.dao.JtMessageProducerMapper;
  18. import com.goafanti.common.dao.MessageFromSystemMapper;
  19. import com.goafanti.common.dao.MessageProducerMapper;
  20. import com.goafanti.common.model.Admin;
  21. import com.goafanti.common.model.JpushEasemobAccount;
  22. import com.goafanti.common.model.JtMessageConsumer;
  23. import com.goafanti.common.model.MessageConsumer;
  24. import com.goafanti.common.model.MessageFromSystem;
  25. import com.goafanti.common.model.MessageProducer;
  26. import com.goafanti.common.model.User;
  27. import com.goafanti.core.mybatis.BaseMybatisDao;
  28. import com.goafanti.core.mybatis.page.Pagination;
  29. import com.goafanti.core.shiro.token.TokenManager;
  30. import com.goafanti.message.JGMessageHelper;
  31. import com.goafanti.message.bo.AppMessageBo;
  32. import com.goafanti.message.bo.MessageBo;
  33. import com.goafanti.message.bo.MessageListBo;
  34. import com.goafanti.message.enums.ConsumerType;
  35. import com.goafanti.message.enums.RecommendType;
  36. import com.goafanti.message.enums.SubjectType;
  37. import com.goafanti.message.service.MessageService;
  38. @Service
  39. public class MessageServiceImpl extends BaseMybatisDao<MessageFromSystemMapper> implements MessageService{
  40. @Autowired
  41. private MessageFromSystemMapper messageFromSystemMapper;
  42. @Autowired
  43. private MessageProducerMapper messageProducerMapper;
  44. @Autowired
  45. private JpushEasemobAccountMapper jpushEasemobAccountMapper;
  46. @Autowired
  47. private JGMessageHelper jgMessageHelper;
  48. @Autowired
  49. private JtMessageProducerMapper jtMessageProducerMapper;
  50. @Autowired
  51. private JtMessageConsumerMapper jtMessageConsumerMapper;
  52. @Override
  53. public String selectSendUser(Map<Integer, String> selectMap,Integer type) {
  54. if(selectMap.containsKey(ConsumerType.PERSON_CUSTOMER_RETAIL.getTypeCode())){ //客户散户
  55. return selectMap.get(ConsumerType.PERSON_CUSTOMER_RETAIL.getTypeCode());
  56. }else if(selectMap.containsKey(ConsumerType.ORGANIZATION_CUSTOMER_RETAIL.getTypeCode())){
  57. return selectMap.get(ConsumerType.ORGANIZATION_CUSTOMER_RETAIL.getTypeCode());
  58. }else if(selectMap.containsKey(ConsumerType.USER_RETAIL.getTypeCode())){
  59. return selectMap.get(ConsumerType.USER_RETAIL.getTypeCode()); //用户散户
  60. }else if(selectMap.containsKey(ConsumerType.SOCIETY_TAG.getTypeCode())){ // 社会标签
  61. String sql = "select group_concat(id) from user where source=0 and status != 2 and society_tag in("+ selectMap.get(ConsumerType.SOCIETY_TAG.getTypeCode()) +")";
  62. return messageFromSystemMapper.selectSendTarget(sql);
  63. }else if(selectMap.containsKey(ConsumerType.LOCATION.getTypeCode())){ //用户地区
  64. String sql = "";
  65. String result = "";
  66. if(selectMap.containsKey(ConsumerType.LOCATION_PROVINCE.getTypeCode())){ //省
  67. sql = "select group_concat(a.id) from user a left join user_identity b on a.id = b.uid where a.source=0 and b.province in (" + selectMap.get(ConsumerType.LOCATION_PROVINCE.getTypeCode()) + ")";
  68. String tmp=messageFromSystemMapper.selectSendTarget(sql);
  69. result +="," + tmp==null?"":tmp;
  70. }
  71. if(selectMap.containsKey(ConsumerType.LOCATION_CITY.getTypeCode())){ //市
  72. sql = "select group_concat(a.id) from user a left join user_identity b on a.id = b.uid where a.source=0 and b.city in (" + selectMap.get(ConsumerType.LOCATION_CITY.getTypeCode()) + ") and a.status != 2";
  73. String tmp=messageFromSystemMapper.selectSendTarget(sql);
  74. result +="," + tmp==null?"":tmp;
  75. }
  76. if(selectMap.containsKey(ConsumerType.LOCATION_AREA.getTypeCode())){ //区
  77. sql = "select group_concat(a.id) from user a left join user_identity b on a.id = b.uid where a.source=0 and b.area in (" + selectMap.get(ConsumerType.LOCATION_AREA.getTypeCode()) + ") and a.status != 2";
  78. String tmp=messageFromSystemMapper.selectSendTarget(sql);
  79. result +="," + tmp==null?"":tmp;
  80. }
  81. if(!result.equals("")&&result!=null){
  82. String data[] = result.substring(1).split(",");
  83. List<String> list = new ArrayList<String>();
  84. boolean flag;
  85. for(int i=0; i< data.length;i++){
  86. flag = false;
  87. for(int j=0; j<list.size(); j++){
  88. if(data[i].equals(list.get(j))){
  89. flag = true;
  90. break;
  91. }
  92. }
  93. if(!flag) list.add(data[i]);
  94. }
  95. String[] tmp = list.toArray(new String[list.size()]);
  96. return Arrays.toString(tmp);
  97. }
  98. }else if(selectMap.containsKey(ConsumerType.INDUSTRY.getTypeCode())){ //行业
  99. String sql = "select group_concat(a.id) from user a left join user_identity b on a.id = b.uid where a.source=0 and b.industry in (" + selectMap.get(ConsumerType.INDUSTRY.getTypeCode()) + ") and a.status != 2";
  100. if(messageFromSystemMapper.selectSendTarget(sql)==null){
  101. return "";
  102. }
  103. return messageFromSystemMapper.selectSendTarget(sql);
  104. }
  105. return "";
  106. }
  107. @Override
  108. public String selectSendAdmin(Map<Integer, String> selectMap,Integer type) {
  109. String sql = "";
  110. if(selectMap.containsKey(ConsumerType.COMPANY.getTypeCode())){
  111. sql = "select group_concat(id) from admin where department_id in ("+ changeSql(selectMap.get(ConsumerType.COMPANY.getTypeCode())) + ")";
  112. }else if(selectMap.containsKey(ConsumerType.ROLE.getTypeCode())){
  113. sql = "select group_concat(id) from admin a left join user_role b on a.id = b.uid where b.rid in (" + changeSql(selectMap.get(ConsumerType.ROLE.getTypeCode())) + ")";
  114. }
  115. if(!sql.equals("")) return messageFromSystemMapper.selectSendTarget(sql);
  116. return "";
  117. }
  118. @Override
  119. public List<MessageFromSystem> selectRecommend(Map<Integer, String> selectMap,Integer type){
  120. String sql = "";
  121. if(selectMap.containsKey(RecommendType.TECH_SERVICE.getTypeCode())){ //科技服务
  122. sql = "select bname as title,introduce as body,id as resourceId from business_project where id in (" + changeSql(selectMap.get(RecommendType.TECH_SERVICE.getTypeCode())) + ")";
  123. }else if(selectMap.containsKey(RecommendType.PERSON_ACHIEVEMENT.getTypeCode())){ //个人成果
  124. sql = "select name as title,summary as body,id as resourceId from achievement where id in (" + changeSql(selectMap.get(RecommendType.PERSON_ACHIEVEMENT.getTypeCode())) +")";
  125. }else if(selectMap.containsKey(RecommendType.ORGANIZATION_ACHIEVEMENT.getTypeCode())){ //组织成果
  126. sql = "select name as title,summary as body,id as resourceId from achievement where id in (" + changeSql(selectMap.get(RecommendType.ORGANIZATION_ACHIEVEMENT.getTypeCode())) +")";
  127. }else if(selectMap.containsKey(RecommendType.PERSONAL_DEMAND.getTypeCode())){ //个人需求
  128. sql = "select name as title,problem_des as body,id as resourceId from demand where id in (" + changeSql(selectMap.get(RecommendType.PERSONAL_DEMAND.getTypeCode())) +")";
  129. }else if(selectMap.containsKey(RecommendType.ORGANIZATION_DEMAND.getTypeCode())){ //组织需求
  130. sql = "select name as title,problem_des as body,id as resourceId from demand where id in (" + changeSql(selectMap.get(RecommendType.ORGANIZATION_DEMAND.getTypeCode())) +")";
  131. }else if(selectMap.containsKey(RecommendType.EXPERT.getTypeCode())){ //专家
  132. sql = "select nickname as title ,introduction as body,id as resourceId from user where id in("+ changeSql(selectMap.get(RecommendType.EXPERT.getTypeCode())) +")";
  133. }else if(selectMap.containsKey(RecommendType.NEWS.getTypeCode())){ //政策
  134. sql = "select title,summary as body,id as resourceId from news where id in("+ changeSql(selectMap.get(RecommendType.NEWS.getTypeCode())) +")";
  135. }
  136. if(!sql.equals("")) return messageFromSystemMapper.selectRecommendTarget(sql);
  137. return null;
  138. }
  139. @Override
  140. @Transactional
  141. public int insertSystemMessage(Map<Integer, String> targetMap, Integer targetType,String title, String body,
  142. Integer subject,Date createTime,Integer isDraft) {
  143. MessageFromSystem mfs = new MessageFromSystem();
  144. mfs.setId(UUID.randomUUID().toString());
  145. mfs.setTitle(title);
  146. mfs.setBody(body);
  147. mfs.setCreateTime(createTime);
  148. mfs.setSubject(subject);
  149. mfs.setConsumerType(getTargetType(targetType));
  150. mfs.setIsDraft(isDraft);
  151. mfs.setDeleteSign(Boolean.FALSE);
  152. if(SecurityUtils.getSubject().getPrincipal() instanceof Admin){
  153. Admin admin = (Admin)SecurityUtils.getSubject().getPrincipal();
  154. mfs.setCreater(admin.getName());
  155. mfs.setProducerId(admin.getId());
  156. }
  157. messageFromSystemMapper.insert(mfs);
  158. List<MessageProducer> producerTarget = new ArrayList<MessageProducer>();
  159. List<MessageBo> sendTarget = new ArrayList<MessageBo>();
  160. String[] cids;
  161. if(subject == SubjectType.KE_HU.getTypeCode()){
  162. String tmp = selectSendUser(targetMap,targetType);
  163. if(tmp !=null){
  164. cids = tmp.split(",");
  165. MessageProducer mp;
  166. MessageBo bo;
  167. String registrationId = "";
  168. for(String cid : cids){
  169. mp = new MessageProducer();
  170. mp.setId(UUID.randomUUID().toString());
  171. mp.setMessageId(mfs.getId());
  172. mp.setConsumerId(cid);
  173. mp.setCreateTime(createTime);
  174. mp.setSendTime(createTime);
  175. producerTarget.add(mp);
  176. registrationId = messageFromSystemMapper.selectJPushAcc(cid);
  177. if(StringUtils.isNotBlank(registrationId)){
  178. bo = new MessageBo();
  179. bo.setMessageId(mfs.getId());
  180. bo.setMessageTitle(mfs.getTitle());
  181. bo.setMessageBody(mfs.getBody());
  182. bo.setRegistrationId(registrationId);
  183. sendTarget.add(bo);
  184. }
  185. }
  186. }
  187. }else if(subject == SubjectType.YUN_YING.getTypeCode()){
  188. String tmp = selectSendUser(targetMap,targetType);
  189. if(tmp !=null){
  190. cids = tmp.split(",");
  191. MessageProducer mp;
  192. MessageBo bo;
  193. String registrationId = "";
  194. for(String cid : cids){
  195. mp = new MessageProducer();
  196. mp.setId(UUID.randomUUID().toString());
  197. mp.setMessageId(mfs.getId());
  198. mp.setConsumerId(cid);
  199. mp.setCreateTime(createTime);
  200. mp.setSendTime(createTime);
  201. producerTarget.add(mp);
  202. registrationId = messageFromSystemMapper.selectJPushAcc(cid);
  203. if(StringUtils.isNotBlank(registrationId)){
  204. bo = new MessageBo();
  205. bo.setMessageId(mfs.getId());
  206. bo.setMessageTitle(mfs.getTitle());
  207. bo.setMessageBody(mfs.getBody());
  208. bo.setRegistrationId(registrationId);
  209. sendTarget.add(bo);
  210. }
  211. }
  212. }
  213. }
  214. if(producerTarget.size()>0) insertBatchProducer(producerTarget);
  215. //推送消息
  216. if(sendTarget.size()>0) jgMessageHelper.sendSystemMessage(sendTarget);
  217. return 1;
  218. }
  219. @Override
  220. @Transactional
  221. public int insertRecommendMessage(Map<Integer, String> sourceMap, Integer sourceType, Map<Integer, String> targetMap,
  222. Integer targetType,Integer subject,Integer isDraft) {
  223. List<MessageFromSystem> mfsList = selectRecommend(sourceMap, sourceType);
  224. List<MessageProducer> producerTarget = new ArrayList<MessageProducer>();
  225. List<MessageFromSystem> messageTarget = new ArrayList<MessageFromSystem>();
  226. List<MessageBo> sendTarget = new ArrayList<MessageBo>();
  227. if(mfsList != null && mfsList.size()>0){
  228. MessageFromSystem message = null;
  229. for(MessageFromSystem mfs : mfsList){
  230. message = new MessageFromSystem();
  231. String messageId = "";
  232. Date createTime = new Date();
  233. message.setCreateTime(createTime);
  234. message.setSubject(subject);
  235. message.setConsumerType(getTargetType(targetType)); //适配客户类型
  236. message.setResourceType(getSourceType(sourceType)); //适配成果需求
  237. message.setIsDraft(isDraft);
  238. message.setDeleteSign(Boolean.FALSE);
  239. if(SecurityUtils.getSubject().getPrincipal() instanceof Admin){
  240. Admin admin = (Admin)SecurityUtils.getSubject().getPrincipal();
  241. message.setCreater(admin.getName());
  242. message.setProducerId(admin.getId());
  243. }
  244. messageId = UUID.randomUUID().toString();
  245. message.setId(messageId);
  246. message.setTitle(mfs.getTitle());
  247. message.setBody(mfs.getBody());
  248. message.setResourceId(mfs.getResourceId());
  249. messageTarget.add(message);
  250. //插入消息推送表
  251. if(subject == SubjectType.KE_HU.getTypeCode()||subject == SubjectType.TUI_JIAN.getTypeCode()){ //只推客户
  252. MessageProducer mp = null;
  253. MessageBo bo = null;
  254. String tmp = selectSendUser(targetMap,targetType);
  255. String[] cids = null;
  256. if(tmp != null){
  257. cids = tmp.split(",");
  258. String registrationId = "";
  259. for(String cid : cids){
  260. mp = new MessageProducer();
  261. mp.setId(UUID.randomUUID().toString());
  262. mp.setConsumerId(cid);
  263. mp.setMessageId(messageId);
  264. mp.setCreateTime(createTime);
  265. mp.setSendTime(createTime);
  266. producerTarget.add(mp);
  267. registrationId = messageFromSystemMapper.selectJPushAcc(cid);
  268. if(StringUtils.isNotBlank(registrationId)){
  269. bo = new MessageBo();
  270. bo.setMessageId(message.getId());
  271. bo.setMessageTitle(message.getTitle());
  272. bo.setMessageBody(message.getBody());
  273. bo.setResourceId(message.getResourceId());
  274. bo.setResourceType(String.valueOf(message.getResourceType()));
  275. bo.setRegistrationId(registrationId);
  276. sendTarget.add(bo);
  277. }
  278. }
  279. }
  280. }
  281. }
  282. //批量插入
  283. if(messageTarget.size()>0) messageFromSystemMapper.insertBatchMessage(messageTarget);
  284. if(producerTarget.size()>0) messageFromSystemMapper.insertBatchProducer(producerTarget);
  285. //推送消息
  286. if(sendTarget.size()>0) jgMessageHelper.sendSystemMessage(sendTarget);
  287. return 1;
  288. }
  289. return 0;
  290. }
  291. @Override
  292. public List<MessageBo> selectSyncMessage(String uid) {
  293. return messageFromSystemMapper.selectSyncMessage(uid);
  294. }
  295. @Override
  296. public int updateMessageProducer(List<MessageProducer> producerList){
  297. for(MessageProducer mp : producerList){
  298. messageProducerMapper.updateByPrimaryKeySelective(mp);
  299. }
  300. return 1;
  301. }
  302. @Override
  303. public int insertBatchProducer(List<MessageProducer> target){
  304. return messageFromSystemMapper.insertBatchProducer(target);
  305. }
  306. @Override
  307. public int insertBatchConsumer(List<MessageConsumer> target) {
  308. return messageFromSystemMapper.insertBatchConsumer(target);
  309. }
  310. @Override
  311. public int updateJpushEasemobAccount(String uuid,String registrationId,String easemobName, String easemobPass) {
  312. return messageFromSystemMapper.updateJpushEasemobAccount(uuid, registrationId,easemobName,easemobPass,TokenManager.getUserId(),new Date());
  313. }
  314. @Override
  315. public int updateMessageConsumer(String messageId) {
  316. return messageFromSystemMapper.updateMessageConsumer(messageId, TokenManager.getUserId() , new Date());
  317. // return messageFromSystemMapper.updateMessageConsumer(messageId, "71a05e9c-a392-480d-817e-678be136cddc" , new Date());
  318. }
  319. @SuppressWarnings("unchecked")
  320. @Override
  321. public Pagination<MessageListBo> listSystemMessage(Integer isDraft,Integer subject,Integer pageNo,Integer pageSize) {
  322. Map<String,Object> params = new HashMap<String,Object>();
  323. params.put("isDraft", isDraft);
  324. params.put("subject", subject);
  325. return (Pagination<MessageListBo>)findPage("listSystemMessageByPage", "listSystemMessageCount", params, pageNo, pageSize);
  326. }
  327. @Override
  328. public int updateSystemMessage(String messageId, String title, String body, Integer isDraft) {
  329. MessageFromSystem mfs = new MessageFromSystem();
  330. mfs.setId(messageId);
  331. mfs.setTitle(title);
  332. mfs.setBody(body);
  333. mfs.setIsDraft(isDraft);
  334. return messageFromSystemMapper.updateByPrimaryKeySelective(mfs);
  335. }
  336. @Override
  337. public int deleteSystemMessage(String messageId) {
  338. MessageFromSystem mfs = new MessageFromSystem();
  339. mfs.setDeleteSign(Boolean.TRUE);
  340. mfs.setId(messageId);
  341. return messageFromSystemMapper.updateByPrimaryKeySelective(mfs);
  342. }
  343. @Override
  344. public IndexBo selectMessageWithGroup() {
  345. if(TokenManager.getToken() instanceof Admin){
  346. return messageFromSystemMapper.selectMessageWithGroup(TokenManager.getAdminId());
  347. }else if(TokenManager.getToken() instanceof User){
  348. return messageFromSystemMapper.selectMessageWithGroup(TokenManager.getUserId());
  349. }
  350. return new IndexBo();
  351. }
  352. @SuppressWarnings("unchecked")
  353. @Override
  354. public Pagination<MessageListBo> listPersonalMessage(Integer subject, Integer resourceType,Integer pageNo,Integer pageSize) {
  355. Map<String,Object> params = new HashMap<String, Object>();
  356. // if(subject == SubjectType.KE_HU.getTypeCode() || subject == SubjectType.TUI_JIAN.getTypeCode()){
  357. // if(null != subject) params.put("subject", subject);
  358. if(null != resourceType) params.put("resourceType", resourceType);
  359. params.put("uid", TokenManager.getUserId());
  360. // params.put("uid","71a05e9c-a392-480d-817e-678be136cddc");
  361. return (Pagination<MessageListBo>)findPage("listPersonalMessageByPage", "listPersonalMessageCount", params, pageNo, pageSize);
  362. }
  363. @Override
  364. public MessageFromSystem selectSystemMessageDetail(String messageId) {
  365. return messageFromSystemMapper.selectByPrimaryKey(messageId);
  366. }
  367. /**
  368. * 为个人和组织做转换
  369. * @param sourceType
  370. * @return
  371. */
  372. private Integer getSourceType(Integer sourceType){
  373. if(RecommendType.PERSON_ACHIEVEMENT.getTypeCode() == sourceType
  374. || RecommendType.ORGANIZATION_ACHIEVEMENT.getTypeCode() == sourceType){
  375. sourceType = RecommendType.ACHIEVEMENT.getTypeCode();
  376. }else if(RecommendType.PERSONAL_DEMAND.getTypeCode() == sourceType
  377. || RecommendType.ORGANIZATION_DEMAND.getTypeCode() == sourceType){
  378. sourceType = RecommendType.DEMAND.getTypeCode();
  379. }
  380. return sourceType;
  381. }
  382. /**
  383. * 为个人和组织客户做转换
  384. * @param targetType
  385. * @return
  386. */
  387. private Integer getTargetType(Integer targetType){
  388. if(ConsumerType.PERSON_CUSTOMER_RETAIL.getTypeCode() == targetType
  389. || ConsumerType.ORGANIZATION_CUSTOMER_RETAIL.getTypeCode() == targetType){
  390. targetType = ConsumerType.CUSTOMER_RETAIL.getTypeCode();
  391. }
  392. return targetType;
  393. }
  394. @Override
  395. public JpushEasemobAccount selectSynAccByUid(String uid) {
  396. return jpushEasemobAccountMapper.selectSynAccByUid(uid);
  397. }
  398. private String changeSql(String source){
  399. String result = "";
  400. if(StringUtils.isNotBlank(source)){
  401. source = "'" + source + "'";
  402. result = source.replace(",", "','");
  403. }
  404. return result;
  405. }
  406. @Override
  407. public int addJpushEasemobAccount(String uuid,String uid,String easemobName,String easemobPass) {
  408. JpushEasemobAccount jea = new JpushEasemobAccount();
  409. jea.setUid(uid);
  410. jea.setUuid(uuid);
  411. jea.setEasemobName(easemobName);
  412. jea.setEasemobPass(easemobPass);
  413. return jpushEasemobAccountMapper.insert(jea);
  414. }
  415. @SuppressWarnings("unchecked")
  416. @Override
  417. public Pagination<AppMessageBo> applistMessage(Integer pageNo, Integer pageSize) {
  418. Map<String,Object> params = new HashMap<String,Object>();
  419. if(null==pageNo||pageNo<1)pageNo=1;
  420. if(null==pageSize||pageSize<1)pageSize=10;
  421. params.put("uid", TokenManager.getUserId());
  422. //params.put("uid", "2160baeb-8ea4-4192-a6f4-fccf8738e248");
  423. return (Pagination<AppMessageBo>)findPage("appMessageList", "appMessageCount", params, pageNo, pageSize);
  424. }
  425. @Override
  426. public AppMessageBo updateAppReadMessage(String id) {
  427. JtMessageConsumer mc=new JtMessageConsumer();
  428. mc.setId(id);
  429. mc.setIsRead(true);
  430. jtMessageConsumerMapper.updateByPrimaryKeySelective(mc);
  431. return jtMessageConsumerMapper.selectById(id);
  432. }
  433. @Override
  434. public int updateReadJpushMessage(String messageId) {
  435. JtMessageConsumer j=jtMessageConsumerMapper.getMessageConsumer(messageId,TokenManager.getUserId());
  436. int i=0;
  437. if (j!=null) {
  438. j.setIsRead(true);
  439. i=jtMessageConsumerMapper.updateByPrimaryKeySelective(j);
  440. }
  441. return i;
  442. }
  443. }