|
@@ -0,0 +1,203 @@
|
|
|
+package com.care.client.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.care.bms.service.BmsEventOrderService;
|
|
|
+import com.care.common.annotation.Permission;
|
|
|
+import com.care.common.enums.OrderStatusEnum;
|
|
|
+import com.care.common.exception.BDException;
|
|
|
+import com.care.common.util.PageResult;
|
|
|
+import com.care.common.util.Result;
|
|
|
+import com.care.common.util.WebPageUtils;
|
|
|
+import com.care.common.vo.PageReqVO;
|
|
|
+import com.care.common.vo.UserLogindConvertVO;
|
|
|
+import com.care.common.vo.event.*;
|
|
|
+import com.care.common.vo.outcall.CcCallResultVO;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author: lilt
|
|
|
+ * @Date: 2021/5/26
|
|
|
+ * @Desc:
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@Api(value = "EventHandleController", tags = { "我的紧急联系人" })
|
|
|
+@Slf4j
|
|
|
+@RequestMapping("/pinanbao/contact")
|
|
|
+@Permission
|
|
|
+public class ContactApiController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BmsEventOrderService bmsEventOrderService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *未处理事件查询 分页
|
|
|
+ * @param request
|
|
|
+ * @param pageReqVo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/not-handle/list")
|
|
|
+ @ApiOperation(tags = {"未处理事件"},value = "未处理事件查询-分页")
|
|
|
+ public PageResult<List<EventOrderVO>> listNotHandle(HttpServletRequest request, @RequestHeader(value = "token") String token,
|
|
|
+ PageReqVO pageReqVo){
|
|
|
+ try {
|
|
|
+ UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
+ IPage<EventOrderVO> pageResponse = this.bmsEventOrderService.listEvent(OrderStatusEnum.TODO.getValue(), null,loginUser ,pageReqVo);
|
|
|
+ return PageResult.success(pageResponse.getRecords(),pageResponse.getCurrent(),pageResponse.getSize(),pageResponse.getTotal());
|
|
|
+ }catch (BDException e) {
|
|
|
+ log.error("未处理事件查询-分页列表出现异常",e);
|
|
|
+ return PageResult.error(e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("事件处理: 未处理事件查询出现异常",e);
|
|
|
+ return PageResult.error( "获取列表失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @GetMapping("/my-handle/list")
|
|
|
+ @ApiOperation(tags = {"我的处理事件"},value = "我的处理事件查询 分页")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(paramType = "header", name = "status", value = "状态"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "status", value = "状态"),
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "olderName", value = "老人姓名"),
|
|
|
+ })
|
|
|
+ public PageResult<List<EventOrderVO>> listMyHandle(HttpServletRequest request,@RequestHeader(value = "token") String token,
|
|
|
+ @RequestParam(value = "status", required = false) String status,
|
|
|
+ @RequestParam(value = "olderName", required = false) String olderName,
|
|
|
+ PageReqVO pageReqVo){
|
|
|
+ try {
|
|
|
+ UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
+ IPage<EventOrderVO> pageResponse = this.bmsEventOrderService.listEvent4MyDo(status, olderName,loginUser ,pageReqVo);
|
|
|
+ return PageResult.success(pageResponse.getRecords(),pageResponse.getCurrent(),pageResponse.getSize(),pageResponse.getTotal());
|
|
|
+ }catch (BDException e) {
|
|
|
+ log.error("我的处理事件查询-分页列表出现异常",e);
|
|
|
+ return PageResult.error(e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("事件处理: 未处理事件查询出现异常",e);
|
|
|
+ return PageResult.error( "获取列表失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperation(tags = {"事件查询"},value = "事件查询 分页")
|
|
|
+ public PageResult<List<EventOrderVO>> list(HttpServletRequest request,
|
|
|
+ @RequestParam(value = "status", required = false) String status,
|
|
|
+ @RequestParam(value = "olderName", required = false) String olderName,
|
|
|
+ PageReqVO pageReqVo){
|
|
|
+ try {
|
|
|
+ UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
+ IPage<EventOrderVO> pageResponse = this.bmsEventOrderService.listEvent(status, olderName,loginUser ,pageReqVo);
|
|
|
+ return PageResult.success(pageResponse.getRecords(),pageResponse.getCurrent(),pageResponse.getSize(),pageResponse.getTotal());
|
|
|
+ }catch (BDException e) {
|
|
|
+ log.error("我的处理事件查询-分页列表出现异常",e);
|
|
|
+ return PageResult.error(e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("事件处理: 未处理事件查询出现异常",e);
|
|
|
+ return PageResult.error( "获取列表失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @PostMapping("/receive/{orderId}")
|
|
|
+ @ApiOperation(tags = {"未处理事件"},value = "立即处理-领取工单")
|
|
|
+ public Result<Object> receiveOrder(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("orderId") Long orderId){
|
|
|
+ UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
+ this.bmsEventOrderService.receiveOrder(orderId,loginUser);
|
|
|
+ return Result.success("领取工单成功!");
|
|
|
+ }
|
|
|
+ @GetMapping("/getEventInfo/{orderId}")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "事件详情")
|
|
|
+ public Result<EventOrderVO> getEventInfo(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("orderId") Long orderId){
|
|
|
+ EventOrderVO orderInfo = this.bmsEventOrderService.getOrderInfo(orderId);
|
|
|
+ return Result.success("查询成功!",orderInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getOlderList/{orderId}")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "被监护人信息列表")
|
|
|
+ public Result<List<OrderOlderVO>> getOlderInfo(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("orderId") Long orderId){
|
|
|
+ List<OrderOlderVO> older = this.bmsEventOrderService.queryOrderOlderList(orderId);
|
|
|
+ return Result.success("查询成功!",older);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/queryDoHis/{orderId}")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "事件处理历史记录")
|
|
|
+ public Result<List<OrderHandleHisVO>> queryDoHis(HttpServletRequest request, @RequestHeader("token") String token, @PathVariable("orderId") Long orderId){
|
|
|
+ return Result.success("查询成功!",this.bmsEventOrderService.queryOrderHandleHis(orderId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/queryContactList/{orderId}")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "跟事件相关的联系人列表")
|
|
|
+ public Result<Object> queryContactList(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("orderId") Long orderId){
|
|
|
+ return Result.success("查询成功!",this.bmsEventOrderService.queryContactList(orderId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/complete/{orderId}")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "完成工单")
|
|
|
+ public Result<Object> complete(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("orderId") Long orderId){
|
|
|
+ this.bmsEventOrderService.updateOrderStatus(orderId,OrderStatusEnum.COMPLETE);
|
|
|
+ return Result.success("操作成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/keyAuth/list/{orderId}")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "钥匙申请列表")
|
|
|
+ public Result<List<OrderKeyApplyVO>> queryKeyAuthList(HttpServletRequest request, @RequestHeader("token") String token, @PathVariable("orderId") Long orderId){
|
|
|
+ return Result.success("查询成功!",this.bmsEventOrderService.queryKeyAuthList(orderId));
|
|
|
+ }
|
|
|
+ @PostMapping("/key/auth/{applyId}")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "钥匙授权")
|
|
|
+ public Result<Object> keyAuth(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("applyId") Long applyId){
|
|
|
+ UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
+ if (this.bmsEventOrderService.keyAuth(applyId,loginUser)) {
|
|
|
+ return Result.success("钥匙授权成功!");
|
|
|
+ }else{
|
|
|
+ return Result.error("钥匙授权失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @PostMapping("/contact/updateStatus/{orderContactId}/{status}")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "更新联系人状态")
|
|
|
+ public Result<Object> updateOrderContactStatus(HttpServletRequest request,@RequestHeader("token") String token,
|
|
|
+ @PathVariable("orderContactId") Long orderContactId,
|
|
|
+ @PathVariable("status") Integer status){
|
|
|
+ UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
+ if (this.bmsEventOrderService.updateOrderContactStatus(orderContactId,status,loginUser)) {
|
|
|
+ return Result.success("更新成功!");
|
|
|
+ }else{
|
|
|
+ return Result.error("更新失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ @PostMapping("/sendSms")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "发送短信")
|
|
|
+ public Result<Object> sendSms(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("orderId") Long orderId){
|
|
|
+ UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
+
|
|
|
+ return Result.success("发送短信成功!");
|
|
|
+ }
|
|
|
+ @GetMapping("/getCallRadio/{hisId}")
|
|
|
+ @ApiOperation(tags = {"事件处理"},value = "获取通话录音")
|
|
|
+ public Result<Object> getCallRadio(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("hisId") Long hisId){
|
|
|
+ CcCallResultVO ccCallResultVO = this.bmsEventOrderService.getCallRadio(hisId);
|
|
|
+ if (ccCallResultVO != null) {
|
|
|
+ return Result.success("获取通话录音!");
|
|
|
+ }else{
|
|
|
+ return Result.error("通话记录不存在!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @GetMapping("/stat")
|
|
|
+ @ApiOperation(tags = {"事件查询"},value = "查询事件统计信息")
|
|
|
+ public Result<Object> stat(HttpServletRequest request,@RequestHeader("token") String token){
|
|
|
+ UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
+ EventStaVO ccCallResultVO = this.bmsEventOrderService.statOrder(loginUser);
|
|
|
+ if (ccCallResultVO != null) {
|
|
|
+ return Result.success("查询成功!");
|
|
|
+ }else{
|
|
|
+ return Result.error("查询失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|