Pārlūkot izejas kodu

报修进度接口

傅行帆 6 gadus atpakaļ
vecāks
revīzija
c14b46cdf0

+ 10
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java Parādīt failu

@@ -16,6 +16,7 @@ import org.springframework.cloud.context.config.annotation.RefreshScope;
16 16
 import org.springframework.web.bind.annotation.*;
17 17
 
18 18
 import javax.servlet.http.HttpSession;
19
+import java.util.List;
19 20
 
20 21
 @RestController
21 22
 @RefreshScope
@@ -49,8 +50,16 @@ public class TicketController {
49 50
         return response;
50 51
     }
51 52
     
52
-    public ResponseBean getTicketSchedule(){
53
+    @ApiOperation(value = "获取报修详情数据",notes = "获取报修详情数据")
54
+    @ApiImplicitParams({
55
+            @ApiImplicitParam(paramType = "path",dataType = "String",name = "communityId",value = "小区编号"),
56
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "ticketId",value = "报修id")
57
+    })
58
+    @RequestMapping(value = "/ticket/schedule/{communityId}", method = RequestMethod.GET)
59
+    public ResponseBean getTicketSchedule(@PathVariable(value = "communityId") String communityId,@RequestParam Integer ticketId){
53 60
         ResponseBean responseBean = new ResponseBean();
61
+        TpTicket ticket = iTicketService.getTicketSchedule(communityId,ticketId);
62
+        responseBean.addSuccess(ticket);
54 63
         return responseBean;
55 64
     }
56 65
     

+ 9
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTicketMapper.java Parādīt failu

@@ -2,6 +2,7 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpTicket;
4 4
 import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
5 6
 
6 7
 import java.util.List;
7 8
 import java.util.Map;
@@ -26,4 +27,12 @@ public interface TpTicketMapper {
26 27
      * @return
27 28
      */
28 29
     List<TpTicket> selectByCommuniytIdAndByTaUserIdAndByType(Map map);
30
+    
31
+    /**
32
+     * 获取报修进度
33
+     * @param communityId
34
+     * @param ticketId
35
+     * @return
36
+     */
37
+	TpTicket selectByTicketId(@Param("communityId") String communityId,@Param("ticketId") Integer ticketId);
29 38
 }

+ 8
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTicketRecordCommentMapper.java Parādīt failu

@@ -1,5 +1,6 @@
1 1
 package com.community.huiju.dao;
2 2
 
3
+import com.community.huiju.model.TpTicketRecord;
3 4
 import com.community.huiju.model.TpTicketRecordComment;
4 5
 import org.apache.ibatis.annotations.Mapper;
5 6
 
@@ -30,4 +31,11 @@ public interface TpTicketRecordCommentMapper {
30 31
      * @return
31 32
      */
32 33
     List<TpTicketRecordComment> selectByTicketId(Map map);
34
+    
35
+    /**
36
+     * 查询出这个处理撞他下所有的回复数据
37
+     * @param tpTicketRecord
38
+     * @return
39
+     */
40
+	List<TpTicketRecordComment> selectByTicketRecordId(TpTicketRecord tpTicketRecord);
33 41
 }

+ 5
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTicketRecordMapper.java Parādīt failu

@@ -2,6 +2,9 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpTicketRecord;
4 4
 import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
5 8
 
6 9
 @Mapper
7 10
 public interface TpTicketRecordMapper {
@@ -16,4 +19,6 @@ public interface TpTicketRecordMapper {
16 19
     int updateByPrimaryKeySelective(TpTicketRecord record);
17 20
 
18 21
     int updateByPrimaryKey(TpTicketRecord record);
22
+	
23
+	List<TpTicketRecord> getTicketRecordByTicketId(@Param("communityId") String communityId,@Param("ticketId") Integer ticketId);
19 24
 }

+ 24
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTicket.java Parādīt failu

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.List;
4 5
 
5 6
 public class TpTicket {
6 7
     private Integer id;
@@ -18,6 +19,11 @@ public class TpTicket {
18 19
     private String type;
19 20
 
20 21
     private String repairType;
22
+    
23
+    /**
24
+     * 报修类型的名字
25
+     */
26
+    private String repairName;
21 27
 
22 28
     private Integer tpUserId;
23 29
 
@@ -32,6 +38,8 @@ public class TpTicket {
32 38
     private Integer updateUser;
33 39
 
34 40
     private Date updateDate;
41
+    
42
+    private List<TpTicketRecord> ticketRecordList;
35 43
 
36 44
     public Integer getId() {
37 45
         return id;
@@ -152,4 +160,20 @@ public class TpTicket {
152 160
     public void setUpdateDate(Date updateDate) {
153 161
         this.updateDate = updateDate;
154 162
     }
163
+    
164
+    public String getRepairName() {
165
+        return repairName;
166
+    }
167
+    
168
+    public void setRepairName(String repairName) {
169
+        this.repairName = repairName;
170
+    }
171
+    
172
+    public List<TpTicketRecord> getTicketRecordList() {
173
+        return ticketRecordList;
174
+    }
175
+    
176
+    public void setTicketRecordList(List<TpTicketRecord> ticketRecordList) {
177
+        this.ticketRecordList = ticketRecordList;
178
+    }
155 179
 }

+ 21
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTicketRecord.java Parādīt failu

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.List;
4 5
 
5 6
 public class TpTicketRecord {
6 7
     private Integer id;
@@ -10,10 +11,14 @@ public class TpTicketRecord {
10 11
     private Integer ticketId;
11 12
 
12 13
     private String status;
14
+    
15
+    private String ticketStatusName;
13 16
 
14 17
     private Integer createUser;
15 18
 
16 19
     private Date createDate;
20
+    
21
+    private List<TpTicketRecordComment> ticketRecordCommentList;
17 22
 
18 23
     public Integer getId() {
19 24
         return id;
@@ -62,4 +67,20 @@ public class TpTicketRecord {
62 67
     public void setCreateDate(Date createDate) {
63 68
         this.createDate = createDate;
64 69
     }
70
+    
71
+    public String getTicketStatusName() {
72
+        return ticketStatusName;
73
+    }
74
+    
75
+    public void setTicketStatusName(String ticketStatusName) {
76
+        this.ticketStatusName = ticketStatusName;
77
+    }
78
+    
79
+    public List<TpTicketRecordComment> getTicketRecordCommentList() {
80
+        return ticketRecordCommentList;
81
+    }
82
+    
83
+    public void setTicketRecordCommentList(List<TpTicketRecordComment> ticketRecordCommentList) {
84
+        this.ticketRecordCommentList = ticketRecordCommentList;
85
+    }
65 86
 }

+ 8
- 8
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTicketRecordComment.java Parādīt failu

@@ -7,7 +7,7 @@ public class TpTicketRecordComment {
7 7
 
8 8
     private Integer communityId;
9 9
 
10
-    private Integer tickerId;
10
+    private Integer ticketId;
11 11
 
12 12
     private Integer ticketRecordId;
13 13
 
@@ -38,15 +38,15 @@ public class TpTicketRecordComment {
38 38
     public void setCommunityId(Integer communityId) {
39 39
         this.communityId = communityId;
40 40
     }
41
-
42
-    public Integer getTickerId() {
43
-        return tickerId;
41
+    
42
+    public Integer getTicketId() {
43
+        return ticketId;
44 44
     }
45
-
46
-    public void setTickerId(Integer tickerId) {
47
-        this.tickerId = tickerId;
45
+    
46
+    public void setTicketId(Integer ticketId) {
47
+        this.ticketId = ticketId;
48 48
     }
49
-
49
+    
50 50
     public Integer getTicketRecordId() {
51 51
         return ticketRecordId;
52 52
     }

+ 8
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java Parādīt failu

@@ -29,6 +29,12 @@ public interface ITicketService {
29 29
      * @return 返回 维修/投诉/联系单 记录列表
30 30
      */
31 31
     ResponseBean getByTypeList(TpTicket tpTicket,Integer pageNum, Integer pageSize);
32
-
33
-
32
+	
33
+	/**
34
+	 * 获取报修详情
35
+	 * @param communityId
36
+	 * @param ticketId
37
+	 * @return
38
+	 */
39
+	TpTicket getTicketSchedule(String communityId, Integer ticketId);
34 40
 }

+ 26
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java Parādīt failu

@@ -3,7 +3,9 @@ package com.community.huiju.service.impl;
3 3
 import com.community.commom.mode.ResponseBean;
4 4
 import com.community.huiju.dao.TpTicketMapper;
5 5
 import com.community.huiju.dao.TpTicketRecordCommentMapper;
6
+import com.community.huiju.dao.TpTicketRecordMapper;
6 7
 import com.community.huiju.model.TpTicket;
8
+import com.community.huiju.model.TpTicketRecord;
7 9
 import com.community.huiju.model.TpTicketRecordComment;
8 10
 import com.community.huiju.service.ITicketService;
9 11
 import com.community.huiju.vo.TpTicketVO;
@@ -28,6 +30,9 @@ public class TicketServiceImpl implements ITicketService {
28 30
 
29 31
     @Autowired
30 32
     private TpTicketMapper tpTicketMapper;
33
+    
34
+    @Autowired
35
+    private TpTicketRecordMapper tpTicketRecordMapper;
31 36
 
32 37
     @Autowired
33 38
     private TpTicketRecordCommentMapper tpTicketRecordCommentMapper;
@@ -137,4 +142,25 @@ public class TicketServiceImpl implements ITicketService {
137 142
 
138 143
         return response;
139 144
     }
145
+    
146
+    /**
147
+     * 获取报修详情
148
+     * @param communityId
149
+     * @param ticketId
150
+     * @return
151
+     */
152
+    @Override
153
+    public TpTicket getTicketSchedule(String communityId, Integer ticketId) {
154
+        //查看工单详情
155
+        TpTicket ticket = tpTicketMapper.selectByTicketId(communityId,ticketId);
156
+        //工单进度
157
+        List<TpTicketRecord> ticketRecordList = tpTicketRecordMapper.getTicketRecordByTicketId(communityId,ticketId);
158
+        //工单回复
159
+        ticketRecordList.stream().forEach(TpTicketRecord -> {
160
+            List<TpTicketRecordComment> ticketRecordCommentList = tpTicketRecordCommentMapper.selectByTicketRecordId(TpTicketRecord);
161
+            TpTicketRecord.setTicketRecordCommentList(ticketRecordCommentList);
162
+         });
163
+        ticket.setTicketRecordList(ticketRecordList);
164
+        return ticket;
165
+    }
140 166
 }

+ 23
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpTicketMapper.xml Parādīt failu

@@ -10,6 +10,7 @@
10 10
     <result column="status" property="status" jdbcType="CHAR" />
11 11
     <result column="type" property="type" jdbcType="CHAR" />
12 12
     <result column="repair_type" property="repairType" jdbcType="CHAR" />
13
+    <result column="repair_name" property="repairName" jdbcType="VARCHAR" />
13 14
     <result column="tp_user_id" property="tpUserId" jdbcType="INTEGER" />
14 15
     <result column="score" property="score" jdbcType="VARCHAR" />
15 16
     <result column="comment" property="comment" jdbcType="VARCHAR" />
@@ -224,4 +225,26 @@
224 225
         </if>
225 226
       </trim>
226 227
   </select>
228
+
229
+  <select id="selectByTicketId" resultMap="BaseResultMap" >
230
+     SELECT
231
+        t.id,
232
+        t.community_id,
233
+        t.ticket_title,
234
+        t.ticket_content,
235
+        t.STATUS,
236
+        t.type,
237
+        t.repair_type,
238
+        d.name as repair_name,
239
+        t.score,
240
+        t.COMMENT,
241
+        t.create_date
242
+    FROM
243
+        tp_ticket t
244
+        LEFT JOIN sys_dictionary d ON t.repair_type = d.CODE
245
+        AND d.group_id = ( SELECT id FROM sys_dictionary WHERE CODE = "ticket_repair_type" )
246
+    WHERE
247
+        t.id = #{ticketId,jdbcType=INTEGER}
248
+        AND t.community_id = #{communityId,jdbcType=INTEGER}
249
+  </select>
227 250
 </mapper>

+ 23
- 12
CODE/smart-community/app-api/src/main/resources/mapper/TpTicketRecordCommentMapper.xml Parādīt failu

@@ -4,7 +4,7 @@
4 4
   <resultMap id="BaseResultMap" type="com.community.huiju.model.TpTicketRecordComment" >
5 5
     <id column="id" property="id" jdbcType="INTEGER" />
6 6
     <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
-    <result column="ticker_id" property="tickerId" jdbcType="INTEGER" />
7
+    <result column="ticket_id" property="ticketId" jdbcType="INTEGER" />
8 8
     <result column="ticket_record_id" property="ticketRecordId" jdbcType="INTEGER" />
9 9
     <result column="uuid" property="uuid" jdbcType="INTEGER" />
10 10
     <result column="user_type" property="userType" jdbcType="CHAR" />
@@ -14,7 +14,7 @@
14 14
     <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
15 15
   </resultMap>
16 16
   <sql id="Base_Column_List" >
17
-    id, community_id, ticker_id, ticket_record_id, uuid, user_type, content, parent_id, 
17
+    id, community_id, ticket_id, ticket_record_id, uuid, user_type, content, parent_id,
18 18
     user_name, create_date
19 19
   </sql>
20 20
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
@@ -28,11 +28,11 @@
28 28
     where id = #{id,jdbcType=INTEGER}
29 29
   </delete>
30 30
   <insert id="insert" parameterType="com.community.huiju.model.TpTicketRecordComment" >
31
-    insert into tp_ticket_record_comment (id, community_id, ticker_id, 
31
+    insert into tp_ticket_record_comment (id, community_id, ticket_id,
32 32
       ticket_record_id, uuid, user_type, 
33 33
       content, parent_id, user_name, 
34 34
       create_date)
35
-    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{tickerId,jdbcType=INTEGER}, 
35
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{ticketId,jdbcType=INTEGER},
36 36
       #{ticketRecordId,jdbcType=INTEGER}, #{uuid,jdbcType=INTEGER}, #{userType,jdbcType=CHAR}, 
37 37
       #{content,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, 
38 38
       #{createDate,jdbcType=TIMESTAMP})
@@ -46,8 +46,8 @@
46 46
       <if test="communityId != null" >
47 47
         community_id,
48 48
       </if>
49
-      <if test="tickerId != null" >
50
-        ticker_id,
49
+      <if test="ticketId != null" >
50
+        ticket_id,
51 51
       </if>
52 52
       <if test="ticketRecordId != null" >
53 53
         ticket_record_id,
@@ -78,8 +78,8 @@
78 78
       <if test="communityId != null" >
79 79
         #{communityId,jdbcType=INTEGER},
80 80
       </if>
81
-      <if test="tickerId != null" >
82
-        #{tickerId,jdbcType=INTEGER},
81
+      <if test="ticketId != null" >
82
+        #{ticketId,jdbcType=INTEGER},
83 83
       </if>
84 84
       <if test="ticketRecordId != null" >
85 85
         #{ticketRecordId,jdbcType=INTEGER},
@@ -110,8 +110,8 @@
110 110
       <if test="communityId != null" >
111 111
         community_id = #{communityId,jdbcType=INTEGER},
112 112
       </if>
113
-      <if test="tickerId != null" >
114
-        ticker_id = #{tickerId,jdbcType=INTEGER},
113
+      <if test="ticketId != null" >
114
+        ticket_id = #{ticketId,jdbcType=INTEGER},
115 115
       </if>
116 116
       <if test="ticketRecordId != null" >
117 117
         ticket_record_id = #{ticketRecordId,jdbcType=INTEGER},
@@ -140,7 +140,7 @@
140 140
   <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpTicketRecordComment" >
141 141
     update tp_ticket_record_comment
142 142
     set community_id = #{communityId,jdbcType=INTEGER},
143
-      ticker_id = #{tickerId,jdbcType=INTEGER},
143
+      ticket_id = #{ticketId,jdbcType=INTEGER},
144 144
       ticket_record_id = #{ticketRecordId,jdbcType=INTEGER},
145 145
       uuid = #{uuid,jdbcType=INTEGER},
146 146
       user_type = #{userType,jdbcType=CHAR},
@@ -155,6 +155,17 @@
155 155
     select ttrc.* from tp_ticket tp
156 156
                 inner join tp_ticket_record ttr on tp.id = ttr.ticket_id
157 157
                 inner join tp_ticket_record_comment ttrc on ttr.ticket_id = ttrc.ticket_record_id
158
-    where tp.id=#{tickerId,jdbcType=INTEGER} order by ttrc.create_date DESC LIMIT #{size,jdbcType=INTEGER}
158
+    where tp.id=#{ticketId,jdbcType=INTEGER} order by ttrc.create_date DESC LIMIT #{size,jdbcType=INTEGER}
159
+  </select>
160
+
161
+  <select id="selectByTicketRecordId" parameterType="com.community.huiju.model.TpTicketRecord" resultMap="BaseResultMap" >
162
+    SELECT
163
+    <include refid="Base_Column_List" />
164
+    FROM
165
+        tp_ticket_record_comment
166
+    WHERE
167
+        community_id = #{communityId,jdbcType=INTEGER}
168
+        AND ticket_id = #{ticketId,jdbcType=INTEGER}
169
+        AND ticket_record_id = #{id,jdbcType=INTEGER}
159 170
   </select>
160 171
 </mapper>

+ 15
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpTicketRecordMapper.xml Parādīt failu

@@ -103,4 +103,19 @@
103 103
       create_date = #{createDate,jdbcType=TIMESTAMP}
104 104
     where id = #{id,jdbcType=INTEGER}
105 105
   </update>
106
+
107
+  <select id="getTicketRecordByTicketId" resultType="com.community.huiju.model.TpTicketRecord">
108
+    SELECT
109
+        t.id,
110
+        t.ticket_id AS ticketId,
111
+        t.community_id AS communityId,
112
+        d.NAME AS ticketStatusName
113
+    FROM
114
+        tp_ticket_record t
115
+        LEFT JOIN sys_dictionary d ON t.STATUS = d.CODE
116
+        AND d.group_id = ( SELECT id FROM sys_dictionary WHERE CODE = "ticket_status" )
117
+    WHERE
118
+        community_id = #{communityId,jdbcType=INTEGER}
119
+        AND ticket_id = #{ticketId,jdbcType=INTEGER}
120
+  </select>
106 121
 </mapper>