|  | @@ -0,0 +1,144 @@
 | 
												
													
														
															|  | 
 |  | +package com.care.bms.controller;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
												
													
														
															|  | 
 |  | +import com.care.bms.service.CareEventOrderService;
 | 
												
													
														
															|  | 
 |  | +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.WebPageUtils;
 | 
												
													
														
															|  | 
 |  | +import com.care.common.vo.PageReqVO;
 | 
												
													
														
															|  | 
 |  | +import com.care.common.vo.UserLogindConvertVO;
 | 
												
													
														
															|  | 
 |  | +import com.care.common.vo.event.CareEventOrderVO;
 | 
												
													
														
															|  | 
 |  | +import io.swagger.annotations.Api;
 | 
												
													
														
															|  | 
 |  | +import io.swagger.annotations.ApiOperation;
 | 
												
													
														
															|  | 
 |  | +import lombok.extern.slf4j.Slf4j;
 | 
												
													
														
															|  | 
 |  | +import org.springframework.beans.BeanUtils;
 | 
												
													
														
															|  | 
 |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | 
 |  | +import org.springframework.validation.BindingResult;
 | 
												
													
														
															|  | 
 |  | +import org.springframework.validation.annotation.Validated;
 | 
												
													
														
															|  | 
 |  | +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("/bms/event")
 | 
												
													
														
															|  | 
 |  | +@Permission
 | 
												
													
														
															|  | 
 |  | +public class EventHandleController {
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    @Autowired
 | 
												
													
														
															|  | 
 |  | +    private CareEventOrderService careEventOrderService;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    /**
 | 
												
													
														
															|  | 
 |  | +     *未处理事件查询 分页
 | 
												
													
														
															|  | 
 |  | +     * @param request
 | 
												
													
														
															|  | 
 |  | +     * @param pageReqVo
 | 
												
													
														
															|  | 
 |  | +     * @return
 | 
												
													
														
															|  | 
 |  | +     */
 | 
												
													
														
															|  | 
 |  | +    @GetMapping("/not-handle/list")
 | 
												
													
														
															|  | 
 |  | +    @ApiOperation(tags = {"未处理事件"},value = "未处理事件查询-分页")
 | 
												
													
														
															|  | 
 |  | +    public PageResult<List<CareEventOrderVO>> listNotHandle(HttpServletRequest request,@RequestHeader(value = "token") String token,
 | 
												
													
														
															|  | 
 |  | +                                                            PageReqVO pageReqVo){
 | 
												
													
														
															|  | 
 |  | +        try {
 | 
												
													
														
															|  | 
 |  | +            UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
 | 
												
													
														
															|  | 
 |  | +            IPage<CareEventOrderVO> pageResponse = this.careEventOrderService.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 = "我的处理事件查询 分页")
 | 
												
													
														
															|  | 
 |  | +    public PageResult<List<CareEventOrderVO>> 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<CareEventOrderVO> pageResponse = this.careEventOrderService.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<CareEventOrderVO>> 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<CareEventOrderVO> pageResponse = this.careEventOrderService.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( "获取列表失败");
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    //TODO 老人基本信息查询-事件ID
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    //TODO 事件统计
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    //TODO 某个事件处理记录查询 - 事件ID
 | 
												
													
														
															|  | 
 |  | +   /* *//**
 | 
												
													
														
															|  | 
 |  | +     * 复制线路
 | 
												
													
														
															|  | 
 |  | +     * @param mapAddReqVO
 | 
												
													
														
															|  | 
 |  | +     * @return
 | 
												
													
														
															|  | 
 |  | +     *//*
 | 
												
													
														
															|  | 
 |  | +    @PostMapping("/copyLine")
 | 
												
													
														
															|  | 
 |  | +    @ApiOperation(tags = {"定单管理"},value = "复制线路")
 | 
												
													
														
															|  | 
 |  | +    public Result<RimsLineResVO> copyLine(@RequestHeader("Authorization") String authorization, @Validated @RequestBody RimsLineOrderMapAddReqVO mapAddReqVO, BindingResult bindingResult){
 | 
												
													
														
															|  | 
 |  | +        if(bindingResult.hasErrors()){
 | 
												
													
														
															|  | 
 |  | +            return Result.error(bindingResult.getFieldErrors().get(0).getDefaultMessage());
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        try {
 | 
												
													
														
															|  | 
 |  | +            UserDTO userDTO = this.sysUserService.queryUserInfo(authorization,null);
 | 
												
													
														
															|  | 
 |  | +            RimsLine line = this.rimsLineService.copyLine(mapAddReqVO.getLineId(),userDTO);
 | 
												
													
														
															|  | 
 |  | +            RimsLineResVO vo = null;
 | 
												
													
														
															|  | 
 |  | +            if(line!=null){
 | 
												
													
														
															|  | 
 |  | +                mapAddReqVO.setLineId(line.getId());
 | 
												
													
														
															|  | 
 |  | +                this.rimsLineOrderMapService.insertLineOrderMap(mapAddReqVO);
 | 
												
													
														
															|  | 
 |  | +                vo = new RimsLineResVO();
 | 
												
													
														
															|  | 
 |  | +                BeanUtils.copyProperties(line,vo);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +            return  Result.success("复制成功",vo);
 | 
												
													
														
															|  | 
 |  | +        } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  | +            log.warn("线路管理:复制线路出现异常",e);
 | 
												
													
														
															|  | 
 |  | +            return  Result.error("复制线路失败");
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +    }*/
 | 
												
													
														
															|  | 
 |  | +    //todo 紧急联系人和管家查询 - 事件ID
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    //todo 呼叫: 事件ID、呼叫人、呼叫角色
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    //TODO 发送短信: 事件ID、接收人ID
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    //TODO 联系人 状态设置:  事件ID、联系人ID、状态
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    //TODO 完成工单: 事件工单ID
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +}
 |