Преглед изворни кода

把工单添加到 消息表

weiximei пре 6 година
родитељ
комит
dd5711e8ac

+ 10
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpMessage.java Прегледај датотеку

5
 public class TpMessage {
5
 public class TpMessage {
6
     private Integer id;
6
     private Integer id;
7
 
7
 
8
+    private Integer ticketId;
9
+
8
     private Integer communityId;
10
     private Integer communityId;
9
 
11
 
10
     private String messageType;
12
     private String messageType;
45
         this.id = id;
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
     public Integer getCommunityId() {
58
     public Integer getCommunityId() {
49
         return communityId;
59
         return communityId;
50
     }
60
     }

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java Прегледај датотеку

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

+ 45
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java Прегледај датотеку

44
     @Autowired
44
     @Autowired
45
     private TdImagesMapper tdImagesMapper;
45
     private TdImagesMapper tdImagesMapper;
46
 
46
 
47
+    @Autowired
48
+    private TpMessageMapper tpMessageMapper;
49
+
47
     @Override
50
     @Override
48
     public ResponseBean getList(TpTicket tpTicket, Integer pageNum, Integer pageSize) {
51
     public ResponseBean getList(TpTicket tpTicket, Integer pageNum, Integer pageSize) {
49
 
52
 
233
         tpTicketRecord.setCreateDate(new Date());
236
         tpTicketRecord.setCreateDate(new Date());
234
 
237
 
235
         tpTicketRecordMapper.insertSelective(tpTicketRecord);
238
         tpTicketRecordMapper.insertSelective(tpTicketRecord);
239
+
240
+        // 把工单信息添加到消息表
241
+        insertTicketMessage(tpTicket,userId);
242
+
236
         response.addSuccess(tpTicketReco);
243
         response.addSuccess(tpTicketReco);
237
         return response;
244
         return response;
238
     }
245
     }
320
             return responseBean;
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 Прегледај датотеку

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