|
@@ -3,18 +3,17 @@ package com.community.huiju.service.impl;
|
3
|
3
|
import com.community.commom.constant.Constant;
|
4
|
4
|
import com.community.commom.mode.ResponseBean;
|
5
|
5
|
import com.community.commom.session.UserElement;
|
6
|
|
-import com.community.huiju.dao.TpBillInvoiceMapper;
|
7
|
|
-import com.community.huiju.dao.TpBillMapper;
|
8
|
|
-import com.community.huiju.dao.TpMessageMapper;
|
9
|
|
-import com.community.huiju.dao.TpTicketMapper;
|
|
6
|
+import com.community.huiju.dao.*;
|
10
|
7
|
import com.community.huiju.model.TpBill;
|
11
|
8
|
import com.community.huiju.model.TpMessage;
|
12
|
9
|
import com.community.huiju.model.TpTicket;
|
|
10
|
+import com.community.huiju.model.TpTransaction;
|
13
|
11
|
import com.community.huiju.service.MessageServiceI;
|
14
|
12
|
import com.github.pagehelper.Page;
|
15
|
13
|
import com.github.pagehelper.PageHelper;
|
16
|
14
|
import org.springframework.beans.factory.annotation.Autowired;
|
17
|
15
|
import org.springframework.stereotype.Service;
|
|
16
|
+import org.springframework.transaction.annotation.Transactional;
|
18
|
17
|
import org.springframework.util.StringUtils;
|
19
|
18
|
|
20
|
19
|
import java.util.Date;
|
|
@@ -28,16 +27,19 @@ import java.util.Map;
|
28
|
27
|
*/
|
29
|
28
|
@Service("messageService")
|
30
|
29
|
public class MessageServiceImpl implements MessageServiceI {
|
31
|
|
-
|
|
30
|
+
|
32
|
31
|
@Autowired
|
33
|
32
|
private TpMessageMapper tpMessageMapper;
|
34
|
|
-
|
|
33
|
+
|
35
|
34
|
@Autowired
|
36
|
35
|
private TpBillMapper tpBillMapper;
|
37
|
36
|
|
38
|
37
|
@Autowired
|
39
|
38
|
private TpTicketMapper tpTicketMapper;
|
40
|
|
-
|
|
39
|
+
|
|
40
|
+ @Autowired
|
|
41
|
+ private TpTransactionMapper tpTransactionMapper;
|
|
42
|
+
|
41
|
43
|
/**
|
42
|
44
|
* 获取消息数量
|
43
|
45
|
* @param communityId
|
|
@@ -47,7 +49,7 @@ public class MessageServiceImpl implements MessageServiceI {
|
47
|
49
|
public Map<String, Object> getMessageTotal(Integer communityId, Integer verifyId) {
|
48
|
50
|
return tpMessageMapper.getMessageTotal(verifyId,communityId);
|
49
|
51
|
}
|
50
|
|
-
|
|
52
|
+
|
51
|
53
|
/**
|
52
|
54
|
* 分页获取消息或待办
|
53
|
55
|
* @param communityId
|
|
@@ -70,12 +72,15 @@ public class MessageServiceImpl implements MessageServiceI {
|
70
|
72
|
// tpMessage.setContent(tpBill.getBillExplain());
|
71
|
73
|
// }
|
72
|
74
|
//}
|
73
|
|
-
|
|
75
|
+
|
74
|
76
|
if(tpMessage.getMessageType().equals(Constant.MESSAGE_TYPE_VISITOR) || tpMessage.getMessageType().equals(Constant.MESSAGE_TYPE_ANNOUNCEMENT)
|
75
|
77
|
|| tpMessage.getMessageType().equals(Constant.MESSAGE_TYPE_SYS) || tpMessage.getMessageType().equals(Constant.MESSAGE_TYPE_BILL)
|
76
|
78
|
|| tpMessage.getMessageType().equals(Constant.MESSAGE_TYPE_ACTIVITY)){
|
77
|
|
- tpMessage.setContent(tpMessage.getMessageContent());
|
78
|
|
- tpMessage.setMessageContent("");
|
|
79
|
+ // 当transactionId为空时把15条临时数据的内容去掉
|
|
80
|
+ if(null == tpMessage.getTransactionId()) {
|
|
81
|
+ tpMessage.setContent(tpMessage.getMessageContent());
|
|
82
|
+ tpMessage.setMessageContent("");
|
|
83
|
+ }
|
79
|
84
|
}
|
80
|
85
|
// 查询工单是否待评价,如果为待评价把Content改为工单的标题
|
81
|
86
|
TpTicket tpTicket= tpTicketMapper.selectByPrimaryKey(tpMessage.getTicketId());
|
|
@@ -84,6 +89,11 @@ public class MessageServiceImpl implements MessageServiceI {
|
84
|
89
|
tpMessage.setContent(tpTicket.getTicketTitle());
|
85
|
90
|
}
|
86
|
91
|
}
|
|
92
|
+ // 帖子推消息设置Content帖子标题
|
|
93
|
+ TpTransaction tpTransaction = tpTransactionMapper.selectByPrimaryKey(tpMessage.getTransactionId(),tpMessage.getCommunityId());
|
|
94
|
+ if (null != tpTransaction){
|
|
95
|
+ tpMessage.setContent(tpTransaction.getTransactionTitle());
|
|
96
|
+ }
|
87
|
97
|
if (!StringUtils.isEmpty(tpMessage.getMessageDetailUrl())){
|
88
|
98
|
Integer id = getMessageIdByType(tpMessage);
|
89
|
99
|
tpMessage.setMessageDetailUrl(tpMessage.getMessageDetailUrl() + "&id=" + id);
|
|
@@ -94,7 +104,7 @@ public class MessageServiceImpl implements MessageServiceI {
|
94
|
104
|
map.put("total",page.getTotal());
|
95
|
105
|
return map;
|
96
|
106
|
}
|
97
|
|
-
|
|
107
|
+
|
98
|
108
|
/**
|
99
|
109
|
* 根据不同的类型取不同的id
|
100
|
110
|
* @param tpMessage
|
|
@@ -108,6 +118,8 @@ public class MessageServiceImpl implements MessageServiceI {
|
108
|
118
|
id = tpMessage.getAnnouncementId();
|
109
|
119
|
break;
|
110
|
120
|
case Constant.MESSAGE_TYPE_SYS:
|
|
121
|
+ // 临时用系统通知测试,后期用11话题状态
|
|
122
|
+ id = tpMessage.getTransactionId();
|
111
|
123
|
break;
|
112
|
124
|
case Constant.MESSAGE_TYPE_BILL:
|
113
|
125
|
id = tpMessage.getBillId();
|
|
@@ -116,10 +128,10 @@ public class MessageServiceImpl implements MessageServiceI {
|
116
|
128
|
id = tpMessage.getActivityId();
|
117
|
129
|
break;
|
118
|
130
|
}
|
119
|
|
-
|
|
131
|
+
|
120
|
132
|
return id;
|
121
|
133
|
}
|
122
|
|
-
|
|
134
|
+
|
123
|
135
|
/**
|
124
|
136
|
* 消息全部已读
|
125
|
137
|
*/
|