Bladeren bron

把工单添加到 消息表

weiximei 6 jaren geleden
bovenliggende
commit
dd5711e8ac

+ 10
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpMessage.java Bestand weergeven

@@ -5,6 +5,8 @@ import java.util.Date;
5 5
 public class TpMessage {
6 6
     private Integer id;
7 7
 
8
+    private Integer ticketId;
9
+
8 10
     private Integer communityId;
9 11
 
10 12
     private String messageType;
@@ -45,6 +47,14 @@ public class TpMessage {
45 47
         this.id = id;
46 48
     }
47 49
 
50
+    public Integer getTicketId() {
51
+        return ticketId;
52
+    }
53
+
54
+    public void setTicketId(Integer ticketId) {
55
+        this.ticketId = ticketId;
56
+    }
57
+
48 58
     public Integer getCommunityId() {
49 59
         return communityId;
50 60
     }

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java Bestand weergeven

@@ -42,7 +42,7 @@ public interface ITicketService {
42 42
 
43 43
 
44 44
 	/**
45
-	 * 添加报修
45
+	 * 添加 维修/投诉/联系单
46 46
 	 * @param userId
47 47
 	 * @param parameter
48 48
 	 * @return
@@ -57,7 +57,7 @@ public interface ITicketService {
57 57
 	Integer updateTicketsReply(TpTicketRecordComment tpTicketRecordComment, Integer userId);
58 58
 
59 59
 	/**
60
-	 * 修改报修内容
60
+	 * 修改 维修/投诉/联系单 内容
61 61
 	 * @param ticketId
62 62
 	 * @param tpTicket
63 63
 	 * @param type
@@ -66,7 +66,7 @@ public interface ITicketService {
66 66
 	void updateTicketContent(Integer ticketId, TpTicket tpTicket, String type,Integer userId);
67 67
 
68 68
 	/**
69
-	 * 终止报修
69
+	 * 终止 维修/投诉/联系单
70 70
 	 * @param communityId
71 71
 	 * @param ticketId
72 72
 	 * @return

+ 45
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java Bestand weergeven

@@ -44,6 +44,9 @@ public class TicketServiceImpl implements ITicketService {
44 44
     @Autowired
45 45
     private TdImagesMapper tdImagesMapper;
46 46
 
47
+    @Autowired
48
+    private TpMessageMapper tpMessageMapper;
49
+
47 50
     @Override
48 51
     public ResponseBean getList(TpTicket tpTicket, Integer pageNum, Integer pageSize) {
49 52
 
@@ -233,6 +236,10 @@ public class TicketServiceImpl implements ITicketService {
233 236
         tpTicketRecord.setCreateDate(new Date());
234 237
 
235 238
         tpTicketRecordMapper.insertSelective(tpTicketRecord);
239
+
240
+        // 把工单信息添加到消息表
241
+        insertTicketMessage(tpTicket,userId);
242
+
236 243
         response.addSuccess(tpTicketReco);
237 244
         return response;
238 245
     }
@@ -320,4 +327,42 @@ public class TicketServiceImpl implements ITicketService {
320 327
             return responseBean;
321 328
         }
322 329
     }
330
+
331
+    /**
332
+     * 公共方法
333
+     *      把工单插入消息表
334
+     * @param tpTicket 工单
335
+     * @param userId 用户id
336
+     */
337
+    private TpMessage insertTicketMessage(TpTicket tpTicket,Integer userId) {
338
+
339
+        TpMessage tpMessage = new TpMessage();
340
+        tpMessage.setCommunityId(tpTicket.getCommunityId());
341
+        tpMessage.setTicketId(tpTicket.getId());
342
+        tpMessage.setMessageType(tpTicket.getType());
343
+        // 通知方式: APP 内通知
344
+        tpMessage.setAdviceType("1");
345
+        // 模板类型为 消息模板
346
+        tpMessage.setModelType("1");
347
+        tpMessage.setUuid(userId);
348
+        // 接收人类型: APP用户
349
+        tpMessage.setUuidType("1");
350
+        // 来源: APP 端用户
351
+        tpMessage.setSource("1");
352
+        // 这里的消息内容对应, 工单标题
353
+        tpMessage.setMessageContent(tpTicket.getTicketTitle());
354
+        tpMessage.setStatus("1");
355
+        // 阅读状态: 0未阅读
356
+        tpMessage.setReadStatus("0");
357
+        tpMessage.setCreateUser(userId);
358
+        tpMessage.setCreateDate(new Date());
359
+        tpMessage.setUpdateUser(userId);
360
+        tpMessage.setUpdateDate(new Date());
361
+
362
+        tpMessageMapper.insertSelective(tpMessage);
363
+
364
+        return tpMessage;
365
+
366
+    }
367
+
323 368
 }

+ 16
- 5
CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml Bestand weergeven

@@ -3,6 +3,7 @@
3 3
 <mapper namespace="com.community.huiju.dao.TpMessageMapper" >
4 4
   <resultMap id="BaseResultMap" type="com.community.huiju.model.TpMessage" >
5 5
     <id column="id" property="id" jdbcType="INTEGER" />
6
+    <id column="ticket_id" property="ticketId" jdbcType="INTEGER" />
6 7
     <result column="community_id" property="communityId" jdbcType="INTEGER" />
7 8
     <result column="message_type" property="messageType" jdbcType="CHAR" />
8 9
     <result column="advice_type" property="adviceType" jdbcType="CHAR" />
@@ -21,7 +22,7 @@
21 22
     <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
22 23
   </resultMap>
23 24
   <sql id="Base_Column_List" >
24
-    id, community_id, message_type, advice_type, model_type, uuid, uuid_type, source, 
25
+    id, ticket_id,community_id, message_type, advice_type, model_type, uuid, uuid_type, source,
25 26
     message_content, status, result, meaasge_type_id, read_status, create_user, create_date, 
26 27
     update_user, update_date
27 28
   </sql>
@@ -36,25 +37,28 @@
36 37
     where id = #{id,jdbcType=INTEGER}
37 38
   </delete>
38 39
   <insert id="insert" parameterType="com.community.huiju.model.TpMessage" >
39
-    insert into tp_message (id, community_id, message_type, 
40
+    insert into tp_message (id, ticket_id, community_id, message_type,
40 41
       advice_type, model_type, uuid, 
41 42
       uuid_type, source, message_content, 
42 43
       status, result, meaasge_type_id, 
43 44
       read_status, create_user, create_date, 
44 45
       update_user, update_date)
45
-    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{messageType,jdbcType=CHAR}, 
46
+    values (#{id,jdbcType=INTEGER}, #{ticketId,jdbcType=INTEGER},#{communityId,jdbcType=INTEGER}, #{messageType,jdbcType=CHAR},
46 47
       #{adviceType,jdbcType=CHAR}, #{modelType,jdbcType=CHAR}, #{uuid,jdbcType=INTEGER}, 
47 48
       #{uuidType,jdbcType=CHAR}, #{source,jdbcType=CHAR}, #{messageContent,jdbcType=VARCHAR}, 
48 49
       #{status,jdbcType=CHAR}, #{result,jdbcType=VARCHAR}, #{meaasgeTypeId,jdbcType=VARCHAR}, 
49 50
       #{readStatus,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
50 51
       #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
51 52
   </insert>
52
-  <insert id="insertSelective" parameterType="com.community.huiju.model.TpMessage" >
53
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpMessage" useGeneratedKeys="true" keyProperty="id" >
53 54
     insert into tp_message
54 55
     <trim prefix="(" suffix=")" suffixOverrides="," >
55 56
       <if test="id != null" >
56 57
         id,
57 58
       </if>
59
+      <if test="ticketId != null">
60
+        ticket_id,
61
+      </if>
58 62
       <if test="communityId != null" >
59 63
         community_id,
60 64
       </if>
@@ -108,6 +112,9 @@
108 112
       <if test="id != null" >
109 113
         #{id,jdbcType=INTEGER},
110 114
       </if>
115
+      <if test="ticketId != null">
116
+        #{ticketId,jdbcType=INTEGER},
117
+      </if>
111 118
       <if test="communityId != null" >
112 119
         #{communityId,jdbcType=INTEGER},
113 120
       </if>
@@ -161,6 +168,9 @@
161 168
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpMessage" >
162 169
     update tp_message
163 170
     <set >
171
+      <if test="ticketId != null">
172
+        ticket_id = #{ticketId,jdbcType=INTEGER},
173
+      </if>
164 174
       <if test="communityId != null" >
165 175
         community_id = #{communityId,jdbcType=INTEGER},
166 176
       </if>
@@ -214,7 +224,8 @@
214 224
   </update>
215 225
   <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpMessage" >
216 226
     update tp_message
217
-    set community_id = #{communityId,jdbcType=INTEGER},
227
+    set ticket_id = #{ticketId,jdbcType=INTEGER},
228
+      community_id = #{communityId,jdbcType=INTEGER},
218 229
       message_type = #{messageType,jdbcType=CHAR},
219 230
       advice_type = #{adviceType,jdbcType=CHAR},
220 231
       model_type = #{modelType,jdbcType=CHAR},