Просмотр исходного кода

工单,受理分配,正在处理,拒绝处理等接口.

dingxin 6 лет назад
Родитель
Сommit
8089a6c696

+ 42
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TpTicketAndTransactionController.java Просмотреть файл

@@ -113,4 +113,46 @@ public class TpTicketAndTransactionController {
113 113
         return tpTicketManageDetails;
114 114
     }
115 115
 
116
+    @ApiOperation(value = "app端工单管理回复业主", notes = "app端工单管理回复业主")
117
+    @ApiImplicitParams({
118
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName:手机号,communityId:小区,content:对话内容,imageUrl:[]图片,ticketId:工单id," +
119
+                    "status:工单状态(0:待分配  1:拒绝受理 2:待处理 3:正在处理 4:待评价 5:已评价 6:已终止)")
120
+    })
121
+    @RequestMapping(value = "/tpTicketManage/reply",method = RequestMethod.POST)
122
+    public ResponseBean tpTicketManageReply(@RequestBody String parameter) {
123
+        ResponseBean tpTicketManageReply= socialServiceI.tpTicketManageReply(parameter);
124
+        return tpTicketManageReply;
125
+    }
126
+
127
+    @ApiOperation(value = "app端工单管理受理分配", notes = "app端工单管理受理分配")
128
+    @ApiImplicitParams({
129
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName:手机号,communityId:小区,ticketId:工单id," +
130
+                    "id:当前处理人id")
131
+    })
132
+    @RequestMapping(value = "/ticketManage/addRecord", method = RequestMethod.POST)
133
+    public ResponseBean ticketManageRecord(@RequestBody String parameter){
134
+        ResponseBean  responseBean = socialServiceI.ticketManageRecord(parameter);
135
+        return responseBean;
136
+    }
137
+
138
+    @ApiOperation(value = "app端工单管理拒绝处理", notes = "app端工单管理拒绝处理")
139
+    @ApiImplicitParams({
140
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName:手机号,communityId:小区,ticketId:工单id,textContent:拒绝的内容" )
141
+    })
142
+    @RequestMapping(value = "/updateTicketStatus", method = RequestMethod.POST)
143
+    public ResponseBean updateTicketStatus(@RequestBody String parameter, HttpSession session){
144
+        ResponseBean  responseBean = socialServiceI.updateTicketStatus(parameter);
145
+        return responseBean;
146
+    }
147
+
148
+    @ApiOperation(value = "app端工单管理处理完成", notes = "app端工单管理处理完成")
149
+    @ApiImplicitParams({
150
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName:手机号,communityId:小区,content:对话内容,imageUrl:[]图片,ticketId:工单id" )
151
+    })
152
+    @RequestMapping(value = "/updateTicket", method = RequestMethod.POST)
153
+    public ResponseBean updateTicket(@RequestBody String parameter){
154
+        ResponseBean  responseBean = socialServiceI.updateTicket(parameter);
155
+        return responseBean;
156
+    }
157
+
116 158
 }

+ 6
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpMessageMapper.java Просмотреть файл

@@ -60,4 +60,10 @@ public interface TpMessageMapper {
60 60
      * @return
61 61
      */
62 62
     TpMessage selectBillinvoiceMessage(@Param("map") Map<String, Object> map);
63
+
64
+    /**
65
+     * 工单处理完成以后更新消状态
66
+     * @param ticketId
67
+     */
68
+    void updateTickMessageStatus(Integer ticketId);
63 69
 }

+ 28
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Просмотреть файл

@@ -281,4 +281,32 @@ public interface SocialServiceI {
281 281
 	 * @return
282 282
 	 */
283 283
 	ResponseBean tpTicketManageDetails(Integer tickedID,Integer communityId,String loginName);
284
+
285
+	/**
286
+	 * app端工单管理回复业主
287
+	 * @param parameter
288
+	 * @return
289
+	 */
290
+    ResponseBean tpTicketManageReply(String parameter);
291
+
292
+	/**
293
+	 * app端工单管理受理分配
294
+	 * @param parameter
295
+	 * @return
296
+	 */
297
+	ResponseBean ticketManageRecord(String parameter);
298
+
299
+	/**
300
+	 * app端工单管理拒绝处理
301
+	 * @param parameter
302
+	 * @return
303
+	 */
304
+	ResponseBean updateTicketStatus(String parameter);
305
+
306
+	/**
307
+	 * app端工单管理处理完成
308
+	 * @param parameter
309
+	 * @return
310
+	 */
311
+	ResponseBean updateTicket(String parameter);
284 312
 }

+ 265
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Просмотреть файл

@@ -1234,4 +1234,269 @@ public class SocialServiceImpl implements SocialServiceI {
1234 1234
         response.addSuccess(ticketVO);
1235 1235
         return response;
1236 1236
     }
1237
+
1238
+    @Override
1239
+    public ResponseBean tpTicketManageReply(String parameter) {
1240
+        ResponseBean response=new ResponseBean();
1241
+        JSONObject object= JSONObject.parseObject(parameter);
1242
+        String loginName = object.getString("loginName");
1243
+        Integer communityId =  object.getInteger("communityId");
1244
+        /*查询在物业端的信息*/
1245
+        TpUser tpUser= tpUserMapper.selectLoginName(loginName,communityId);
1246
+
1247
+        String  content = object.getString("content");
1248
+        Integer  ticketId = object.getInteger("ticketId");
1249
+        Integer  status = object.getInteger("status");
1250
+
1251
+        /*根据工单Id和状态查出工单记录ID*/
1252
+        TpTicket  tpTicket= tpTicketMapper.selectByPrimaryKey(ticketId);
1253
+        TpTicketRecord ticketRecord= tpTicketRecordMapper.selectTpTicketRecord(ticketId, Integer.valueOf(tpTicket.getStatus()));
1254
+        TpTicketRecordComment tpTicketRecordComment= new TpTicketRecordComment();
1255
+        tpTicketRecordComment.setCommunityId(communityId);
1256
+        tpTicketRecordComment.setContent(content);
1257
+        tpTicketRecordComment.setTicketId(ticketId);
1258
+        tpTicketRecordComment.setTicketRecordId(ticketRecord.getId());
1259
+        tpTicketRecordComment.setUuid(tpUser.getId());
1260
+        tpTicketRecordComment.setUserType("0");
1261
+        tpTicketRecordComment.setUserName(tpUser.getUserName());
1262
+        tpTicketRecordComment.setCreateDate(new Date());
1263
+        tpTicketRecordCommentMapper.insert(tpTicketRecordComment);
1264
+        JSONArray contentImg = object.getJSONArray("imageUrl");
1265
+        if (null!=contentImg){
1266
+            String[] contentImgArray = contentImg.toArray(new String[]{});
1267
+
1268
+            for (String img : contentImgArray) {
1269
+                TdImages tdImages = new TdImages();
1270
+                tdImages.setImageUrl(img);
1271
+                /*注意reply用于标记工单回复类的图片*/
1272
+                tdImages.setType("reply");
1273
+                tdImages.setUuid(tpTicketRecordComment.getId());
1274
+                tdImages.setCreateTime(new Date());
1275
+                tdImages.setCreateUser(tpUser.getId());
1276
+                tdImagesMapper.insert(tdImages);
1277
+            }
1278
+        }
1279
+        //1.5维护工单对话推送到app消息
1280
+        TpMessage message = new TpMessage();
1281
+        message.setCommunityId(communityId);
1282
+        message.setMessageType(tpTicket.getType());
1283
+        message.setTicketId(tpTicket.getId());
1284
+        message.setAdviceType("1");
1285
+        message.setUuid(tpTicket.getCreateUser());
1286
+        message.setModelType("1");
1287
+        message.setUuidType("1");
1288
+        message.setSource("2");
1289
+        message.setMessageContent("物业回复您:"+content);
1290
+        message.setStatus("1");
1291
+        message.setReadStatus("0");
1292
+        message.setCreateUser(tpTicket.getCreateUser());
1293
+        message.setCreateDate(new Date());
1294
+        message.setTicketId(ticketId);
1295
+        response.addSuccess("成功");
1296
+        tpMessageMapper.insert(message);
1297
+        return response;
1298
+    }
1299
+
1300
+    @Override
1301
+    public ResponseBean ticketManageRecord(String parameter) {
1302
+        ResponseBean response=new ResponseBean();
1303
+        JSONObject object= JSONObject.parseObject(parameter);
1304
+        String loginName = object.getString("loginName");
1305
+        Integer communityId =  object.getInteger("communityId");
1306
+        Integer  ticketId = object.getInteger("ticketId");
1307
+        /*当前处理人ID */
1308
+        String  status = object.getString("status");
1309
+        Integer  userID = object.getInteger("id");
1310
+        /*查询在物业端的信息*/
1311
+        TpUser tpUser= tpUserMapper.selectLoginName(loginName,communityId);
1312
+
1313
+        /**注意,这是受理人信息,不是当前用户信息*/
1314
+        TpUser userName= tpUserMapper.selectByPrimaryKey(userID);
1315
+        TpTicket tpTicket= new TpTicket();
1316
+        tpTicket.setId(ticketId);
1317
+        tpTicket.setStatus("3");
1318
+        tpTicket.setTpUserId(userID);
1319
+        tpTicket.setUpdateDate(new Date());
1320
+        tpTicketMapper.updateByPrimaryKeySelective(tpTicket);
1321
+
1322
+        TpTicketRecord tpTicketRecord= new TpTicketRecord();
1323
+        tpTicketRecord.setCommunityId(communityId);
1324
+        tpTicketRecord.setTicketId(ticketId);
1325
+        tpTicketRecord.setContent("您的联系单已经分配给物业处理人员" + userName.getUserName()+",联系方式:" + userName.getLoginName());
1326
+        tpTicketRecord.setStatus("3");
1327
+        tpTicketRecord.setCreateUser(tpUser.getId());
1328
+        tpTicketRecord.setCreateDate(new Date());
1329
+        tpTicketRecordMapper.insert(tpTicketRecord);
1330
+
1331
+        //待办模板
1332
+        TpTicket ticket = tpTicketMapper.getTicketTpUserId(ticketId,communityId);
1333
+        TpMessage message = new TpMessage();
1334
+        message.setCommunityId(communityId);
1335
+        message.setMessageType(ticket.getType());
1336
+        message.setTicketId(ticket.getId());
1337
+        message.setAdviceType("4");
1338
+        message.setUuid(userID);
1339
+        message.setModelType("2");
1340
+        message.setUuidType("2");
1341
+        message.setSource("2");
1342
+        message.setMessageContent("工单“" + ticket.getTicketTitle() + "”已被分配给您,点击查看并处理");
1343
+        message.setStatus("1");
1344
+        message.setReadStatus("0");
1345
+        message.setCreateUser(tpUser.getId());
1346
+        message.setCreateDate(new Date());
1347
+        message.setTicketId(ticketId);
1348
+        tpMessageMapper.insert(message);
1349
+        //如果分配给本人维护消息模板
1350
+        if (null!=userID&userID.equals(tpUser.getId())){
1351
+            message.setModelType("1");
1352
+            tpMessageMapper.insert(message);
1353
+        }
1354
+        //分配成功后推送app
1355
+        message.setUuidType("1");
1356
+        message.setUuid(ticket.getCreateUser());
1357
+        message.setMessageContent("工单“" + ticket.getTicketTitle() + "”已被分配给:"+userName.getUserName());
1358
+        message.setAdviceType("1");
1359
+        tpMessageMapper.insert(message);
1360
+        response.addSuccess("成功");
1361
+        return response;
1362
+    }
1363
+
1364
+    @Override
1365
+    public ResponseBean updateTicketStatus(String parameter) {
1366
+        /*拒绝处理仅在待分配的情况下修改,由前台控制拒绝处理的按钮是否显示*/
1367
+        ResponseBean response = new ResponseBean();
1368
+        JSONObject object = JSONObject.parseObject(parameter);
1369
+        String loginName = object.getString("loginName");
1370
+        Integer communityId =  object.getInteger("communityId");
1371
+        /**查询当前app用户在物业端的信息**/
1372
+        TpUser tpUser =  tpUserMapper.selectLoginName(loginName,communityId);
1373
+
1374
+        Integer ticketId = object.getInteger("ticketId");
1375
+        String textContent = object.getString("textContent");
1376
+        TpTicket tpTicket = new TpTicket();
1377
+        tpTicket.setId(ticketId);
1378
+        tpTicket.setStatus("1");
1379
+        tpTicket.setUpdateUser(tpUser.getId());
1380
+        tpTicket.setUpdateDate(new Date());
1381
+        tpTicketMapper.updateByPrimaryKeySelective(tpTicket);
1382
+        /*查询当前处理人的名字*/
1383
+
1384
+        TpTicketRecord tpTicketRecord = new TpTicketRecord();
1385
+        tpTicketRecord.setTicketId(ticketId);
1386
+        tpTicketRecord.setContent("您的报修被物业人员" + tpUser.getUserName() + "拒绝接受理,原因:" + textContent + ",有问题可以联系" + tpUser.getUserName() + ":联系方式:" + tpUser.getLoginName());
1387
+        tpTicketRecord.setCommunityId(communityId);
1388
+        tpTicketRecord.setStatus("1");
1389
+        tpTicketRecord.setCreateUser(tpUser.getId());
1390
+        tpTicketRecord.setCreateDate(new Date());
1391
+        tpTicketRecordMapper.insert(tpTicketRecord);
1392
+        /*把内容添加到对话中*/
1393
+        TpTicketRecordComment ticketRecordComment = new TpTicketRecordComment();
1394
+        ticketRecordComment.setCommunityId(communityId);
1395
+        ticketRecordComment.setTicketId(ticketId);
1396
+        ticketRecordComment.setTicketRecordId(tpTicketRecord.getId());
1397
+        ticketRecordComment.setUuid(tpUser.getId());
1398
+        ticketRecordComment.setUserType("0");
1399
+        ticketRecordComment.setContent("拒绝受理,原因——" + textContent);
1400
+        ticketRecordComment.setUserName(tpUser.getUserName());
1401
+        ticketRecordComment.setCreateDate(new Date());
1402
+        tpTicketRecordCommentMapper.insert(ticketRecordComment);
1403
+
1404
+        //维护1.5版本
1405
+        TpMessage message = new TpMessage();
1406
+        TpTicket ticket = tpTicketMapper.getTicketTpUserId(ticketId,communityId);
1407
+        message.setCommunityId(communityId);
1408
+        message.setMessageType(ticket.getType());
1409
+        message.setTicketId(ticket.getId());
1410
+        message.setAdviceType("1");
1411
+        message.setUuid(ticket.getCreateUser());
1412
+        message.setModelType("1");
1413
+        message.setUuidType("1");
1414
+        message.setSource("2");
1415
+        message.setMessageContent("您的工单“" + ticket.getTicketTitle() + "”已被拒绝受理");
1416
+        message.setStatus("1");
1417
+        message.setReadStatus("0");
1418
+        message.setCreateUser(tpUser.getId());
1419
+        message.setCreateDate(new Date());
1420
+        message.setTicketId(ticketId);
1421
+        tpMessageMapper.insert(message);
1422
+        response.addSuccess("成功");
1423
+        return response;
1424
+    }
1425
+
1426
+    @Override
1427
+    public ResponseBean updateTicket(String parameter) {
1428
+        ResponseBean response=new ResponseBean();
1429
+        JSONObject object= JSONObject.parseObject(parameter);
1430
+        String loginName = object.getString("loginName");
1431
+        Integer communityId =  object.getInteger("communityId");
1432
+        /**查询当前app用户在物业端的信息**/
1433
+        TpUser tpUser =  tpUserMapper.selectLoginName(loginName,communityId);
1434
+
1435
+        String  content = object.getString("content");
1436
+        Integer  ticketId = object.getInteger("ticketId");
1437
+        TpTicket tpTicket= new TpTicket();
1438
+        tpTicket.setId(ticketId);
1439
+        tpTicket.setStatus("4");
1440
+        tpTicket.setUpdateDate(new Date());
1441
+        tpTicketMapper.updateByPrimaryKeySelective(tpTicket);
1442
+        /**维护工单处理表**/
1443
+        TpTicketRecord tpTicketRecord = new TpTicketRecord();
1444
+        tpTicketRecord.setCommunityId(communityId);
1445
+        tpTicketRecord.setTicketId(ticketId);
1446
+        TpTicket tpTicketUserID= tpTicketMapper.selectByPrimaryKey(ticketId);
1447
+        tpTicketRecord.setContent("物业工作人员"+tpUser.getUserName()+"已经处理结束,如果没有问题请给好评,联系方式:"+tpUser.getLoginName());
1448
+        tpTicketRecord.setStatus("4");
1449
+        tpTicketRecord.setCreateUser(tpUser.getId());
1450
+        tpTicketRecord.setCreateDate(new Date());
1451
+        tpTicketRecordMapper.insert(tpTicketRecord);
1452
+        /*维护对话*/
1453
+        TpTicketRecordComment tpTicketRecordComment= new TpTicketRecordComment();
1454
+        tpTicketRecordComment.setCommunityId(communityId);
1455
+        tpTicketRecordComment.setTicketId(ticketId);
1456
+        tpTicketRecordComment.setTicketRecordId(tpTicketRecord.getId());
1457
+        tpTicketRecordComment.setUuid(tpUser.getId());
1458
+        tpTicketRecordComment.setUserType("0");
1459
+        tpTicketRecordComment.setContent("处理结果如下____"+content);
1460
+        tpTicketRecordComment.setUserName(tpUser.getUserName());
1461
+        tpTicketRecordComment.setCreateDate(new Date());
1462
+        tpTicketRecordCommentMapper.insert(tpTicketRecordComment);
1463
+        /* 传入图片*/
1464
+        JSONArray contentImg = object.getJSONArray("imageUrl");
1465
+        if (null!=contentImg){
1466
+            String[] contentImgArray = contentImg.toArray(new String[]{});
1467
+            for (String img : contentImgArray) {
1468
+                TdImages tdImages = new TdImages();
1469
+                tdImages.setImageUrl(img);
1470
+                /*注意reply用于标记工单回复类的图片*/
1471
+                tdImages.setType(Constant.REPLY);
1472
+                tdImages.setUuid(tpTicketRecordComment.getId());
1473
+                tdImages.setCreateTime(new Date());
1474
+                tdImages.setCreateUser(tpUser.getId());
1475
+                tdImagesMapper.insert(tdImages);
1476
+            }
1477
+        }
1478
+        //分配成功后这只messgae消息表status为无效
1479
+        tpMessageMapper.updateTickMessageStatus(ticketId);
1480
+
1481
+        // 处理完成后推送app
1482
+        TpTicket ticket = tpTicketMapper.getTicketTpUserId(ticketId,tpUser.getCommunityId());
1483
+        TpMessage message= new TpMessage();
1484
+        message.setCommunityId(tpUser.getCommunityId());
1485
+        message.setMessageType(ticket.getType());
1486
+        message.setTicketId(ticket.getId());
1487
+        message.setAdviceType("1");
1488
+        message.setUuid(ticket.getCreateUser());
1489
+        message.setModelType("1");
1490
+        message.setUuidType("1");
1491
+        message.setSource("2");
1492
+        message.setMessageContent("您的工单“" + ticket.getTicketTitle() + "”已处理完成,请查看详情");
1493
+        message.setStatus("1");
1494
+        message.setReadStatus("0");
1495
+        message.setCreateUser(tpUser.getId());
1496
+        message.setCreateDate(new Date());
1497
+        message.setTicketId(ticketId);
1498
+        tpMessageMapper.insert(message);
1499
+        response.addSuccess("成功");
1500
+        return response;
1501
+    }
1237 1502
 }

+ 11
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml Просмотреть файл

@@ -446,4 +446,15 @@
446 446
     and advice_type = 1
447 447
     and source = 2
448 448
   </select>
449
+
450
+  <update id="updateTickMessageStatus" >
451
+        update tp_message
452
+        set
453
+            status = 0
454
+        where
455
+        ticket_id = #{ticketId,jdbcType=INTEGER}
456
+        and model_type=2
457
+        order by create_date ASC
458
+        LIMIT 1
459
+    </update>
449 460
 </mapper>