瀏覽代碼

调整后台接口

lilt085163@126.com 3 年之前
父節點
當前提交
f29ee1d8bc
共有 56 個文件被更改,包括 1741 次插入1114 次删除
  1. 5 0
      pom.xml
  2. 1 1
      src/main/java/com/care/bigscreen/schedule/BigScreenSchedule.java
  3. 43 8
      src/main/java/com/care/bms/controller/EventHandleController.java
  4. 59 8
      src/main/java/com/care/bms/service/BmsEventOrderService.java
  5. 1 1
      src/main/java/com/care/client/config/PlatformConfig.java
  6. 203 0
      src/main/java/com/care/client/controller/ContactApiController.java
  7. 206 0
      src/main/java/com/care/client/controller/EventApiController.java
  8. 87 0
      src/main/java/com/care/client/controller/HouseApiController.java
  9. 65 0
      src/main/java/com/care/client/controller/MemberApiController.java
  10. 49 0
      src/main/java/com/care/client/controller/PassportController.java
  11. 0 92
      src/main/java/com/care/client/passport/PassportService.java
  12. 0 155
      src/main/java/com/care/client/passport/WxPassportService.java
  13. 1 1
      src/main/java/com/care/client/passport/AbstractPassportService.java
  14. 56 0
      src/main/java/com/care/client/service/PassportService.java
  15. 86 0
      src/main/java/com/care/client/service/PinanbaoService.java
  16. 76 0
      src/main/java/com/care/client/service/WxPassportService.java
  17. 40 0
      src/main/java/com/care/client/vo/DeviceMonitorVO.java
  18. 77 0
      src/main/java/com/care/client/vo/HouseContactVO.java
  19. 2 3
      src/main/java/com/care/client/vo/MemberInfoVO.java
  20. 2 1
      src/main/java/com/care/client/vo/MemberInitParams.java
  21. 4 0
      src/main/java/com/care/common/cache/RedisKeyConstant.java
  22. 21 1
      src/main/java/com/care/common/config/SwaggerConfig.java
  23. 4 0
      src/main/java/com/care/common/entity/CareEventOrderOlder.java
  24. 4 3
      src/main/java/com/care/common/entity/CcCallResult.java
  25. 44 0
      src/main/java/com/care/common/enums/CallResultEnum.java
  26. 0 2
      src/main/java/com/care/common/enums/ContactorStatusEnum.java
  27. 3 3
      src/main/java/com/care/common/enums/KeyAuthEnum.java
  28. 5 1
      src/main/java/com/care/common/mapper/CareDeviceMapper.java
  29. 4 0
      src/main/java/com/care/common/mapper/CareEventOrderMapper.java
  30. 9 0
      src/main/java/com/care/common/service/CareDeviceService.java
  31. 9 0
      src/main/java/com/care/common/service/CareEventOrderService.java
  32. 2 1
      src/main/java/com/care/common/service/CcCallResultService.java
  33. 13 0
      src/main/java/com/care/common/service/impl/CareDeviceServiceImpl.java
  34. 12 0
      src/main/java/com/care/common/service/impl/CareEventOrderServiceImpl.java
  35. 35 7
      src/main/java/com/care/common/service/impl/CcCallResultServiceImpl.java
  36. 276 0
      src/main/java/com/care/common/util/CheckUtils.java
  37. 24 0
      src/main/java/com/care/common/vo/device/DeviceVO.java
  38. 90 0
      src/main/java/com/care/common/vo/event/CareHouseVO.java
  39. 1 1
      src/main/java/com/care/common/vo/event/EventOrderVO.java
  40. 23 0
      src/main/java/com/care/common/vo/event/EventStaVO.java
  41. 3 0
      src/main/java/com/care/common/vo/event/OrderHandleHisVO.java
  42. 0 6
      src/main/java/com/care/common/vo/outcall/CcCallResultVO.java
  43. 0 19
      src/main/java/com/care/demo/constant/RimsDictionariesConstant.java
  44. 0 240
      src/main/java/com/care/demo/controller/SystemDictionariesController.java
  45. 0 80
      src/main/java/com/care/demo/entity/RimsDictionaries.java
  46. 0 46
      src/main/java/com/care/demo/mapper/RimsDictionariesMapper.java
  47. 0 100
      src/main/java/com/care/demo/service/SystemDictionariesService.java
  48. 0 253
      src/main/java/com/care/demo/service/impl/SystemDictionariesServiceImpl.java
  49. 0 22
      src/main/java/com/care/demo/vo/RimsNetworkAreaSelectResVO.java
  50. 14 10
      src/main/java/com/care/outcall/controller/KoalaOutCallController.java
  51. 1 1
      src/main/resources/application.properties
  52. 2 2
      src/main/resources/mybatis/BigSreenMapper.xml
  53. 8 1
      src/main/resources/mybatis/CareDeviceMapper.xml
  54. 70 0
      src/main/resources/mybatis/CareEventOrderMapper.xml
  55. 0 44
      src/main/resources/mybatis/RimsDictionariesMapper.xml
  56. 1 1
      src/main/resources/mybatis/StStationMapper.xml

+ 5 - 0
pom.xml

@@ -241,6 +241,11 @@
             <!-- 请到https://search.maven.org/search?q=tencentcloud-sdk-java查询所有版本,最新版本如下 -->
             <version>3.1.283</version>
         </dependency>
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+            <version>1.9.3</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 1 - 1
src/main/java/com/care/bigscreen/schedule/BigScreenSchedule.java

@@ -28,7 +28,7 @@ public class BigScreenSchedule {
     /**
      * 10 分钟调用一次
      */
-    @Scheduled(cron = "* 0/10 * * * ?")
+   // @Scheduled(cron = "* 0/10 * * * ?")
     public void exeStatistics() {
         bigScreenService.exeStatistics();
     }

+ 43 - 8
src/main/java/com/care/bms/controller/EventHandleController.java

@@ -2,10 +2,9 @@ package com.care.bms.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.care.bms.service.BmsEventOrderService;
-import com.care.common.vo.event.EventOrderVO;
-import com.care.common.vo.event.OrderHandleHisVO;
-import com.care.common.vo.event.OrderKeyApplyVO;
-import com.care.common.vo.event.OrderOlderVO;
+import com.care.common.entity.CareEventOrderChamb;
+import com.care.common.enums.CallResultEnum;
+import com.care.common.vo.event.*;
 import com.care.common.annotation.Permission;
 import com.care.common.enums.OrderStatusEnum;
 import com.care.common.exception.BDException;
@@ -15,6 +14,7 @@ import com.care.common.util.WebPageUtils;
 import com.care.common.vo.PageReqVO;
 import com.care.common.vo.UserLogindConvertVO;
 import com.care.common.vo.outcall.CcCallResultVO;
+import com.google.common.collect.Maps;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -24,7 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Author: lilt
@@ -122,11 +124,18 @@ public class EventHandleController {
 
     @GetMapping("/getOlderList/{orderId}")
     @ApiOperation(tags = {"事件处理"},value = "被监护人信息列表")
-    public Result<List<OrderOlderVO>> getOlderInfo(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("orderId") Long orderId){
+    public Result<List<OrderOlderVO>> getOlderList(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("orderId") Long orderId){
         List<OrderOlderVO> older = this.bmsEventOrderService.queryOrderOlderList(orderId);
         return  Result.success("查询成功!",older);
     }
 
+    @GetMapping("/getChamberlain/{orderId}")
+    @ApiOperation(tags = {"事件处理"},value = "事件定单管家查询")
+    public Result<CareEventOrderChamb> getChamberlain(HttpServletRequest request, @RequestHeader("token") String token, @PathVariable("orderId") Long orderId){
+        CareEventOrderChamb chamb = this.bmsEventOrderService.queryChamberlain(orderId);
+        return  Result.success("查询成功!",chamb);
+    }
+
     @GetMapping("/queryDoHis/{orderId}")
     @ApiOperation(tags = {"事件处理"},value = "事件处理历史记录")
     public Result<List<OrderHandleHisVO>> queryDoHis(HttpServletRequest request, @RequestHeader("token") String token, @PathVariable("orderId") Long orderId){
@@ -174,11 +183,12 @@ public class EventHandleController {
         }
 
     }
-    @PostMapping("/sendSms")
+    @PostMapping("/sendSms/{orderContactId}")
     @ApiOperation(tags = {"事件处理"},value = "发送短信")
-    public Result<Object> sendSms(HttpServletRequest request,@RequestHeader("token") String token,@PathVariable("orderId") Long orderId){
+    public Result<Object> sendSms(HttpServletRequest request,@RequestHeader("token") String token,
+                                  @PathVariable("orderContactId") Long orderContactId){
         UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
-
+        this.bmsEventOrderService.sendSmsToLianxiren(orderContactId);
         return  Result.success("发送短信成功!");
     }
     @GetMapping("/getCallRadio/{hisId}")
@@ -191,4 +201,29 @@ public class EventHandleController {
             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("查询成功!",ccCallResultVO);
+        }else{
+            return  Result.error("查询失败!");
+        }
+    }
+
+    @GetMapping("/callResultCode")
+    @ApiOperation(tags = {"事件处理"},value = "呼叫结果编码")
+    public Result<List<Map<String,Object>>>getChamberlain(){
+        List<Map<String,Object>> datas = new ArrayList<>();
+        for (CallResultEnum callResultEnum : CallResultEnum.values()){
+            Map<String,Object> data = Maps.newHashMap();
+            data.put("name",callResultEnum.getName());
+            data.put("value",callResultEnum.getValue());
+            datas.add(data);
+        }
+        return  Result.success("查询成功!",datas);
+    }
+
 }

+ 59 - 8
src/main/java/com/care/bms/service/BmsEventOrderService.java

@@ -49,6 +49,10 @@ public class BmsEventOrderService {
     @Resource
     private CareSysUserService careSysUserService;
     @Resource
+    private CareEventOrderOlderService careEventOrderOlderService;
+    @Resource
+    private CareEventOrderChambService careEventOrderChambService;
+    @Resource
     private CareEventOrderContactStatusService careEventOrderContactStatusService;
     @Resource
     private CareEventOrderHandleHisService careEventOrderHandleHisService;
@@ -58,10 +62,7 @@ public class BmsEventOrderService {
     private CcCallResultService ccCallResultService;
     @Resource
     private CareHouseService careHouseService;
-    @Resource
-    private CareEventOrderOlderService careEventOrderOlderService;
-    @Resource
-    private CareEventOrderChambService careEventOrderChambService;
+
     @Resource
     private SmsSendService smsSendService;
 
@@ -182,7 +183,10 @@ public class BmsEventOrderService {
             eventOrderVO.setStatusName(OrderStatusEnum.getCodeToName(eventOrderVO.getStatus()));
             eventOrderVO.setOrderType(OrderTypeEnum.getCodeToName(eventOrderVO.getOrderType()));
             CareHouse house = this.careHouseService.getById(order.getHouseId());
-            eventOrderVO.setHouse(house);
+            CareHouseVO houseVO = new CareHouseVO();
+            BeanUtil.copyProperties(house,houseVO);
+            houseVO.setRelationTypeDesc("屋主");
+            eventOrderVO.setHouse(houseVO);
         }
         return  eventOrderVO;
     }
@@ -291,6 +295,7 @@ public class BmsEventOrderService {
             ceocs.forEach(item -> {
                 OrderKeyApplyVO keyApplyVO = new OrderKeyApplyVO();
                 BeanUtil.copyProperties(item,keyApplyVO);
+                result.add(keyApplyVO);
             });
         }
         return  result;
@@ -314,7 +319,7 @@ public class BmsEventOrderService {
        // his.setLogType();
         his.setLogObjectId(apply.getApplyUserId());
         his.setLogObjectName(apply.getApplyUserName());
-      //  his.setLogResult();
+        his.setLogResult("钥匙授权");
         his.setOpUserRole(UserRoleEnum.SEAT.getValue());
         his.setOpUserId(loginUser.getId());
         his.setOpUserName(loginUser.getName());
@@ -349,6 +354,7 @@ public class BmsEventOrderService {
         his.setOpUserName(loginUser.getName());
         his.setCreateTime(DateUtil.date());
         his.setRelationTypeDesc(contact.getRelationTypeDesc());
+        this.careEventOrderHandleHisService.save(his);
         return  this.careEventOrderContactStatusService.update(updateWrapper);
     }
 
@@ -403,6 +409,7 @@ public class BmsEventOrderService {
                CareEventOrderOlder ceoo = new CareEventOrderOlder();
                BeanUtil.copyProperties(item,ceoo);
                ceoo.setOrderId(order.getId());
+               ceoo.setOlderId(item.getId());
                if (order.getOlderId() == item.getId()){
                    //主动呼叫
                     ceoo.setIsZhudong(1);
@@ -427,7 +434,13 @@ public class BmsEventOrderService {
             CareSysUser user = this.careSysUserService.getById(house.getChambId());
             if (user != null){
                 CareEventOrderChamb chamb = new CareEventOrderChamb();
-                BeanUtil.copyProperties(user,chamb);
+                chamb.setOrgId(user.getOrgId());
+                chamb.setStationId(user.getStationId());
+                chamb.setOrderId(order.getId());
+                chamb.setChambId(user.getId());
+                chamb.setChambName(user.getName());
+                chamb.setPhone(user.getPhone());
+                chamb.setStatus(0);
                 chamb.setHouseId(house.getId());
                 chamb.setStatus(0);
                 chamb.setCreateTime(DateUtil.date());
@@ -474,6 +487,44 @@ public class BmsEventOrderService {
      */
     public boolean sendSmsToLianxiren(Long orderContactId){
         CareEventOrderContactStatus contactStatus = this.careEventOrderContactStatusService.getById(orderContactId);
-        return smsSendService.sendSmsToLianxiren(contactStatus.getContactPhone(),null);
+        CareEventOrderHandleHis his = new CareEventOrderHandleHis();
+        his.setOrgId(contactStatus.getOrgId());
+        his.setStationId(contactStatus.getStationId());
+        his.setOrderId(contactStatus.getOrderId());
+        // his.setLogType();
+        his.setLogObjectId(contactStatus.getContactId());
+        his.setLogObjectName(contactStatus.getContactName());
+        his.setLogResult("钥匙授权");
+        his.setOpUserRole(UserRoleEnum.SEAT.getValue());
+        his.setCreateTime(DateUtil.date());
+        his.setRelationTypeDesc(contactStatus.getRelationTypeDesc());
+        this.careEventOrderHandleHisService.save(his);
+        //return smsSendService.sendSmsToLianxiren(contactStatus.getContactPhone(),null);
+        return true;
+    }
+
+    /**
+     * 统计机构下的事件数量
+     * @param loginUser
+     * @return
+     */
+    public  EventStaVO statOrder(UserLogindConvertVO loginUser) {
+        return this.careEventOrderService.statOrder(loginUser.getOrgId(),null);
+    }
+
+    /**
+     * 查询管家
+     * @param orderId
+     * @return
+     */
+    public CareEventOrderChamb queryChamberlain(Long orderId){
+        CareEventOrderChamb data = new CareEventOrderChamb();
+        QueryWrapper<CareEventOrderChamb> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(CareEventOrderChamb::getOrderId,orderId);
+        List<CareEventOrderChamb> datas = this.careEventOrderChambService.list(queryWrapper);
+        if (CollUtil.isNotEmpty(datas)){
+            data = datas.get(0);
+        }
+        return data ;
     }
 }

+ 1 - 1
src/main/java/com/care/client/config/PlatformConfig.java

@@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
  * @create 2020/5/11 0:05
  **/
 @Configuration
-public class PlatformConfig {
+public class PlatformPinanbaoConfig {
 
     @Bean
     @ConfigurationProperties(prefix = "wx.pinanbao")

+ 203 - 0
src/main/java/com/care/client/controller/ContactApiController.java

@@ -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("查询失败!");
+        }
+    }
+
+}

+ 206 - 0
src/main/java/com/care/client/controller/EventApiController.java

@@ -0,0 +1,206 @@
+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/event")
+@Permission
+public class EventApiController {
+
+    @Autowired
+    private BmsEventOrderService bmsEventOrderService;
+
+    //TODO SOS求助 语音
+    //TODO 当前进行中的事件
+    //TODO 某个事件的处理历史
+
+    /**
+     *未处理事件查询 分页
+     * @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("查询失败!");
+        }
+    }
+
+}

+ 87 - 0
src/main/java/com/care/client/controller/HouseApiController.java

@@ -0,0 +1,87 @@
+package com.care.client.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.care.bms.service.BmsEventOrderService;
+import com.care.client.service.PassportService;
+import com.care.client.service.PinanbaoService;
+import com.care.client.vo.DeviceMonitorVO;
+import com.care.client.vo.MemberInfoVO;
+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.device.DeviceVO;
+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.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ * @Author: lilt
+ * @Date: 2021/5/26
+ * @Desc:
+ */
+@RestController
+@Api(value = "EventHandleController", tags = { "房屋信息" })
+@Slf4j
+@RequestMapping("/pinanbao/house")
+@Permission
+public class HouseApiController {
+    @Resource
+    private PassportService passportService;
+    @Autowired
+    private PinanbaoService pinanbaoService;
+    //TODO 设备列表
+    //todo 某个设备的心率、呼吸
+    //TODO 某个设备的睡眠报告 夜间、白天
+
+    /**
+     *设备列表
+     * @param token
+     * @return
+     */
+    @GetMapping("/device/list")
+    @ApiOperation(tags = {"首页"},value = "设备列表")
+    public Result<List<DeviceVO>> listNotHandle(@RequestHeader(value = "token") String token){
+        try {
+            MemberInfoVO current = passportService.checkToken(token);
+            List<DeviceVO> datas = pinanbaoService.devList(current.getId());
+            return Result.success(datas);
+        }catch (BDException e) {
+            log.error("未处理事件查询-分页列表出现异常",e);
+            return  PageResult.error(e.getMessage());
+        } catch (Exception e) {
+            log.error("事件处理: 未处理事件查询出现异常",e);
+            return PageResult.error( "获取列表失败");
+        }
+    }
+
+    @GetMapping("/device/monitor")
+    @ApiOperation(tags = {"首页"},value = "设备的监测信息")
+    public Result<DeviceMonitorVO> listNotHandle(@RequestHeader(value = "token") String token, @RequestParam("devId") Long devId){
+        try {
+
+            return Result.success(this.pinanbaoService.devMonitorData(devId));
+        }catch (BDException e) {
+            log.error("未处理事件查询-分页列表出现异常",e);
+            return  PageResult.error(e.getMessage());
+        } catch (Exception e) {
+            log.error("事件处理: 未处理事件查询出现异常",e);
+            return PageResult.error( "获取列表失败");
+        }
+    }
+
+}

+ 65 - 0
src/main/java/com/care/client/controller/MemberApiController.java

@@ -0,0 +1,65 @@
+package com.care.client.controller;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.care.client.service.AbstractPassportService;
+import com.care.client.service.PassportService;
+import com.care.client.vo.MemberInfoVO;
+import com.care.common.entity.CareMemberInfo;
+import com.care.common.service.CareMemberInfoService;
+import com.care.common.util.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 描述:
+ *
+ * @autho:wenskys
+ * @create 2020/5/12 14:13
+ **/
+@Api(tags = "会员相关接口")
+@RestController
+@RequestMapping("/pinanbao/member")
+public class MemberApiController {
+
+    @Resource
+    private CareMemberInfoService careMemberInfoService;
+
+    @Resource
+    private PassportService passportService;
+    @Autowired
+    private AbstractPassportService abstractPassportService;
+
+    @ApiOperation(value = "获取基本信息", notes = "获取用户基本录信息")
+    @PostMapping("detail/info")
+    public Result<Object> detailInfo(@RequestHeader String token) {
+        MemberInfoVO current = current(token);
+        CareMemberInfo member = careMemberInfoService.detailByOpenid(current.getOpenId());
+        BeanUtil.copyProperties(member,current);
+        return Result.success(current);
+    }
+
+    @ApiOperation(value = "刷新基本信息", notes = "刷新用户基本录信息")
+    @PostMapping("refresh")
+    public Result<Object> refreshMember(@RequestHeader String token) {
+        MemberInfoVO lastMemberInfoVO = abstractPassportService.refreshMember(token);
+        return Result.success(lastMemberInfoVO);
+    }
+
+   /* @ApiOperation(value = "校验是否要刷新小程序用户信息", notes = "校验是否要刷新小程序用户信息 true刷新")
+    @PostMapping("notMatchMemberField")
+    public Result<Object> notMatchMemberField(@RequestHeader String token) {
+        return Result.success(passportService.notMatchMemberField(token));
+    }
+*/
+    public MemberInfoVO current(String token) {
+        return passportService.checkToken(token);
+    }
+
+}

+ 49 - 0
src/main/java/com/care/client/controller/PassportController.java

@@ -0,0 +1,49 @@
+package com.care.client.controller;
+
+import com.care.client.service.PassportService;
+import com.care.client.vo.MemberInitParams;
+import com.care.common.util.CheckUtils;
+import com.care.common.util.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@Api(tags = "登录")
+@RestController
+@RequestMapping("/pinanbao")
+public class PassportController {
+
+
+    @Resource
+    private PassportService passportService;
+
+    @ApiOperation(value = "小程序登录", notes = "小程序授权登录")
+    @ApiParam(name = "params", value = "登录参数")
+    @PostMapping("login")
+    public Result<Object> login(@RequestBody MemberInitParams params) {
+
+        if ("wx".equalsIgnoreCase(params.getLoginType())) {
+            CheckUtils.valueIsNull(params, "code");
+        } else if ("pwd".equalsIgnoreCase(params.getLoginType())) {
+            if (StringUtils.isBlank(params.getPhone())) {
+                return Result.error("请输入手机号码");
+            }
+            if (StringUtils.isBlank(params.getPassword())) {
+                return Result.error("请输入密码");
+            }
+        }
+        return passportService.login(params);
+    }
+
+
+    @ApiOperation(value = "小程序登出", notes = "小程序登出")
+    @PostMapping("logout")
+    public Result<Object>  logout(@RequestHeader String token) {
+        passportService.logout(token);
+        return Result.success();
+    }
+}

+ 0 - 92
src/main/java/com/care/client/passport/PassportService.java

@@ -1,92 +0,0 @@
-package com.care.client.passport;
-
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-
-@Slf4j
-@Service
-public class PassportService {
-
-    /*@Resource
-    private RedisUtil redisUtil;
-    @Resource
-    private WxPassportService wxPassportService;
-    @Resource
-    private MemberOpenService memberOpenService;
-
-    private final Cache<Long, String> timeoutCache = CacheBuilder.newBuilder().expireAfterWrite(10, TimeUnit.SECONDS).build();
-
-    public ResultData login(MemberInitParams params) {
-        CheckUtils.valueIsNull(params, "platform");
-
-        if ("wx".equalsIgnoreCase(params.getLoginType())) {
-            CheckUtils.valueIsNull(params, "code");
-        } else if ("pwd".equalsIgnoreCase(params.getLoginType())) {
-            CheckUtils.valueIsNull(params, "phone");
-            CheckUtils.valueIsNull(params, "password");
-        }
-        ResultData result;
-        switch (params.getPlatform()) {
-            case WX:
-                result = wxPassportService.login(params);
-                break;
-            default:
-                throw BaseException.newException(PassportException.APP_NOT_SUPPORT, "platform[{0}] not support", params.getPlatform());
-        }
-        return result;
-    }
-
-    public void logout(String token) {
-        CheckUtils.notNull(token, "token");
-        MemberInfoVO open = (MemberInfoVO) redisUtil.hget(RedisKeyConstant.LOGIN_INFO, token);
-        if (open != null) {
-            redisUtil.hset(RedisKeyConstant.LOGIN_INFO, token, null);
-        }
-    }
-
-    public MemberInfoVO checkToken(String token) {
-        CheckUtils.notNull(token, "token");
-        if (!redisUtil.hHasKey(RedisKeyConstant.LOGIN_INFO, token)) {
-            throw BaseException.newException(PassportException.INVALID_TOKEN, "TOKEN WAS WRONG :[{0}]", token);
-        }
-        return (MemberInfoVO) redisUtil.hget(RedisKeyConstant.LOGIN_INFO, token);
-    }
-
-    public boolean notMatchMemberField(String token) {
-        CheckUtils.notNull(token, "token");
-        if (!redisUtil.hHasKey(RedisKeyConstant.LOGIN_INFO, token)) {
-            throw BaseException.newException(PassportException.INVALID_TOKEN, "TOKEN WAS WRONG :[{0}]", token);
-        }
-        MemberInfoVO oldMemberInfoVO = (MemberInfoVO) redisUtil.hget(RedisKeyConstant.LOGIN_INFO, token);
-        try {
-            String newKey = timeoutCache.get(oldMemberInfoVO.getId(), () -> {
-                MemberOpenDO dbMemberOpenDO = memberOpenService.get(oldMemberInfoVO.getId());
-                StringBuffer sb = new StringBuffer();
-                if (dbMemberOpenDO != null && dbMemberOpenDO.getMember() != null) {
-                    sb.append("isReadVip").append(dbMemberOpenDO.getMember().getIsReadVip());
-                    sb.append("isCourseVip").append(dbMemberOpenDO.getMember().getIsCourseVip());
-                    sb.append("readVipExpired").append(dbMemberOpenDO.getMember().getReadVipExpired());
-                    sb.append("courseVipExpired").append(dbMemberOpenDO.getMember().getCourseVipExpired());
-                    sb.append("deposited").append(dbMemberOpenDO.getMember().getDeposited());
-                }
-                return sb.toString();
-            });
-            StringBuffer oldSb = new StringBuffer();
-            oldSb.append("isReadVip").append(oldMemberInfoVO.getIsReadVip());
-            oldSb.append("isCourseVip").append(oldMemberInfoVO.getIsCourseVip());
-            oldSb.append("readVipExpired").append(oldMemberInfoVO.getReadVipExpired());
-            oldSb.append("courseVipExpired").append(oldMemberInfoVO.getCourseVipExpired());
-            oldSb.append("deposited").append(oldMemberInfoVO.getDeposited());
-            return !newKey.equalsIgnoreCase(oldSb.toString());
-        } catch (ExecutionException e) {
-            e.printStackTrace();
-        }
-        return false;
-    }*/
-}

+ 0 - 155
src/main/java/com/care/client/passport/WxPassportService.java

@@ -1,155 +0,0 @@
-package com.care.client.passport;
-
-import cn.hutool.core.util.StrUtil;
-import com.care.client.config.PlatformConfig;
-import com.care.client.vo.MemberInitParams;
-import com.care.common.cache.RedisUtil;
-import com.google.common.collect.Maps;
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.lang.reflect.Field;
-import java.text.MessageFormat;
-import java.util.Map;
-
-@Slf4j
-@Service
-public class WxPassportService extends AbstractPassportService {
-
-   /* @Resource
-    private RedisUtil redisUtil;
-
-    @Resource
-    private PlatformConfig platformConfig;
-
-    Gson gson = new Gson();
-
-    public ResultData login(MemberInitParams params) {
-        WxConfig wxConfig = platformConfig.wxConfig();
-        // 解析codeUrl
-        String codeUrl = MessageFormat.format(wxConfig.getCodeUrl(), wxConfig.getAppId(), wxConfig.getSecret(), params.getCode());
-        // 通过codeUrl获取openid
-        JSONObject jsonObject = this.httpGet(codeUrl);
-        log.warn("-----jsonObject:[{}]", jsonObject);
-
-        String openid = jsonObject.getString("openid");
-        String sessionKey = jsonObject.getString("session_key"); // TODO 暂时用不到
-        log.warn("-----openid:[{}], session_key:[{}]", openid, sessionKey);
-
-        // TODO 测试阶段先注释掉
-        params.setOpenid(openid);
-        return cache(params);
-    }
-
-    private JSONObject httpGet(String url) {
-        HttpResponse response = HttpRequest.get(url).send();
-        String json = response.charset("utf-8").bodyText();
-        JSONObject jsonObject = JSON.parseObject(json);
-        return jsonObject;
-    }
-
-    private String accessToken() {
-        WxConfig wxConfig = platformConfig.wxConfig();
-        String access_token = (String) redisUtil.hget(RedisKeyConstant.WX_ACCESS_TOKEN, wxConfig.getAppId());
-        if (access_token != null) {
-            return access_token;
-        }
-        return this.flushWxToken();
-    }
-
-    private String flushWxToken() {
-        WxConfig wxConfig = platformConfig.wxConfig();
-        // 解析codeUrl
-        String tokenUrl = MessageFormat.format(wxConfig.getTokenUrl(), wxConfig.getAppId(), wxConfig.getSecret());
-        // 通过codeUrl获取openid
-        JSONObject jsonObject = this.httpGet(tokenUrl);
-        String access_token = jsonObject.getString("access_token");
-        redisUtil.hset(RedisKeyConstant.WX_ACCESS_TOKEN, wxConfig.getAppId(), access_token, RedisKeyConstant.WX_ACCESS_TOKEN_TIME);
-        return access_token;
-    }
-
-    private JSONObject httpPost(String url, String content) {
-        HttpRequest httpRequest = HttpRequest.post(url).bodyText(content, "application/json", "utf-8");
-        HttpResponse res = httpRequest.send();
-        String json = res.charset("utf-8").bodyText();
-        JSONObject jsonObject = JSON.parseObject(json);
-        return jsonObject;
-    }
-
-    public  int msgSecCheck(String content){
-        WxConfig wxConfig = platformConfig.wxConfig();
-        int result = 0;
-        String url = "https://api.weixin.qq.com/wxa/msg_sec_check?access_token=" + this.accessToken();
-        Map<String ,String> map = Maps.newHashMap();
-        map.put("content",content);
-        String resBody = cn.hutool.http.HttpRequest.post(url).header(HTTP.CONTENT_TYPE,"application/json;charset=UTF-8").body(gson.toJson(map)).execute().body();
-        if (StrUtil.isNotEmpty(resBody)){
-            JsonObject object = gson.fromJson(resBody, JsonObject.class);
-            JsonElement ele = object.get("errcode");
-            if (ele != null){
-                if (ele.getAsInt() == 0 ){
-                    result = 1;
-                }else if(ele.getAsInt() == 87014){
-                    result = -1;
-                }else{
-                    result = 9999;
-                }
-            }
-        }
-        return result;
-    }
-    public boolean msgCheck(Object object) {
-        boolean flag = true;
-        try{
-            StringBuffer text = new StringBuffer();
-            Field[] fields = object.getClass().getDeclaredFields();
-            for (Field field : fields){
-                field.setAccessible( true );
-                if (field.isAnnotationPresent(MsgSecAnnotation.class)){
-                    if (null != field.get(object)){
-                        String value = (String)field.get(object);
-                        if (StrUtil.isNotBlank(value)){
-                            text.append(value).append("|");
-                        }
-                    }
-                }
-
-            }
-            if (StrUtil.isNotEmpty(text.toString())){
-                int  secCheck = this.msgSecCheck(text.toString());
-                if (-1 == secCheck){
-                    flag = false;
-                }else{
-                    flag = true;
-                }
-            }
-
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }catch (Exception e){
-
-        }
-        return  flag;
-    }
-
-    public static void main(String[] args) {
-        String code = "0117jbby1dPIob0szIdy1Xidby17jbby";
-        String appid = "wxfaea3a9cf3b92ded";
-        String secret = "36bd50d9a65c2950c00d85338fc76c25";
-        String url = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code";
-        String codeUrl = MessageFormat.format(url, appid, secret, code);
-        // 通过codeUrl获取openid
-        HttpResponse response = HttpRequest.get(codeUrl).send();
-        String json = response.charset("utf-8").bodyText();
-        JSONObject jsonObject = JSON.parseObject(json);
-
-        log.warn("-----jsonObject:[{}], ", jsonObject);
-        String openid = jsonObject.getString("openid");
-        String sessionKey = jsonObject.getString("session_key"); // TODO 暂时用不到
-        log.warn("-----openid:[{}], session_key:[{}]", openid, sessionKey);
-    }*/
-}

+ 1 - 1
src/main/java/com/care/client/passport/AbstractPassportService.java

@@ -1,4 +1,4 @@
-package com.care.client.passport;
+package com.care.client.service;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.IdUtil;

+ 56 - 0
src/main/java/com/care/client/service/PassportService.java

@@ -0,0 +1,56 @@
+package com.care.client.service;
+
+import com.care.client.vo.MemberInfoVO;
+import com.care.client.vo.MemberInitParams;
+import com.care.common.cache.RedisKeyConstant;
+import com.care.common.cache.RedisUtil;
+import com.care.common.exception.BDException;
+import com.care.common.util.CheckUtils;
+import com.care.common.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Slf4j
+@Service
+public class PassportService {
+
+    @Resource
+    private RedisUtil redisUtil;
+    @Resource
+    private WxPassportService wxPassportService;
+
+    public Result<Object> login(MemberInitParams params) {
+
+        if ("wx".equalsIgnoreCase(params.getLoginType())) {
+            CheckUtils.valueIsNull(params, "code");
+        } else if ("pwd".equalsIgnoreCase(params.getLoginType())) {
+            CheckUtils.valueIsNull(params, "phone");
+            CheckUtils.valueIsNull(params, "password");
+        }
+        Result<Object>  result = wxPassportService.login(params);
+        return result;
+    }
+
+    public void logout(String token) {
+        CheckUtils.notNull(token, "token");
+        MemberInfoVO memberInfoVO = (MemberInfoVO) redisUtil.hget(RedisKeyConstant.PINANBAO_LOGIN_INFO, token);
+        if (memberInfoVO != null) {
+            redisUtil.hset(RedisKeyConstant.PINANBAO_LOGIN_INFO, token, null);
+        }
+    }
+
+    public MemberInfoVO checkToken(String token) {
+        CheckUtils.notNull(token, "token");
+        if (!redisUtil.hHasKey(RedisKeyConstant.PINANBAO_LOGIN_INFO, token)) {
+            throw new BDException(400002, "TOKEN WAS WRONG :[{"+token+"}]" );
+        }
+        return (MemberInfoVO) redisUtil.hget(RedisKeyConstant.PINANBAO_LOGIN_INFO, token);
+    }
+
+    public boolean notMatchMemberField(String token) {
+
+        return false;
+    }
+}

+ 86 - 0
src/main/java/com/care/client/service/PinanbaoService.java

@@ -0,0 +1,86 @@
+package com.care.client.service;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.care.client.vo.DeviceMonitorVO;
+import com.care.client.vo.HouseContactVO;
+import com.care.common.entity.CareHouseContact;
+import com.care.common.entity.CareMemberInfo;
+import com.care.common.service.CareDeviceService;
+import com.care.common.service.CareHouseContactService;
+import com.care.common.service.CareMemberInfoService;
+import com.care.common.vo.device.DeviceVO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.compress.utils.Lists;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @Author: lilt
+ * @Date: 2021/6/7
+ * @Desc:
+ */
+@Slf4j
+@Service
+public class PinanbaoService {
+    @Resource
+    private CareDeviceService careDeviceService;
+    @Resource
+    private CareMemberInfoService careMemberInfoService;
+    @Resource
+    private CareHouseContactService careHouseContactService;
+
+    /**
+     * 查询房屋的设备列表
+     * @param memberId
+     * @return
+     */
+    public List<DeviceVO> devList(Long memberId){
+        CareMemberInfo memberInfo = this.careMemberInfoService.getById(memberId);
+        return this.careDeviceService.queryListByHouseId(memberInfo.getHouseId());
+    }
+
+    /**
+     * 设备监测数据
+     * @param devId
+     * @return
+     */
+    public DeviceMonitorVO devMonitorData(Long devId){
+        //TODO 获取监测数据,从redis中获取
+        DeviceMonitorVO vo = new DeviceMonitorVO();
+        vo.setId(devId);
+        vo.setBreathRate(30);
+        vo.setHeartRate(60);
+        vo.setActivityDistance(600);
+        vo.setActivityTimeHour(1);
+        vo.setActivityTimeMinute(20);
+        vo.setSleepTimeHour(8);
+        vo.setSleepTimeMinute(7);
+        return vo;
+    }
+
+    /**
+     * 查询房屋紧急联系人
+     * @param memberId
+     * @return
+     */
+    public List<HouseContactVO> queryContactByMemberId(Long memberId){
+        List<HouseContactVO> vos = Lists.newArrayList();
+        CareMemberInfo memberInfo = this.careMemberInfoService.getById(memberId);
+        QueryWrapper<CareHouseContact> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(CareHouseContact::getHouseId, memberInfo.getHouseId())
+        .orderByAsc(CareHouseContact::getContactLevel);
+        List<CareHouseContact> contacts = this.careHouseContactService.list(queryWrapper);
+        if (CollUtil.isNotEmpty(contacts)){
+            contacts.forEach(item -> {
+                HouseContactVO vo = new HouseContactVO();
+                BeanUtil.copyProperties(item,vo);
+                vos.add(vo);
+            });
+        }
+        return vos;
+    }
+}

+ 76 - 0
src/main/java/com/care/client/service/WxPassportService.java

@@ -0,0 +1,76 @@
+package com.care.client.service;
+
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.care.client.config.PlatformPinanbaoConfig;
+import com.care.client.config.WxConfig;
+import com.care.client.vo.MemberInitParams;
+import com.care.common.cache.RedisKeyConstant;
+import com.care.common.cache.RedisUtil;
+import com.care.common.util.Result;
+import com.google.gson.Gson;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.MessageFormat;
+
+@Slf4j
+@Service
+public class WxPassportService extends AbstractPassportService {
+
+    @Resource
+    private RedisUtil redisUtil;
+
+    @Resource
+    private PlatformPinanbaoConfig platformPinanbaoConfig;
+
+    Gson gson = new Gson();
+
+    public Result<Object> login(MemberInitParams params) {
+        WxConfig wxConfig = platformPinanbaoConfig.wxConfig();
+        // 解析codeUrl
+        String codeUrl = MessageFormat.format(wxConfig.getCodeUrl(), wxConfig.getAppId(), wxConfig.getSecret(), params.getCode());
+        // 通过codeUrl获取openid
+        JSONObject jsonObject = this.httpGet(codeUrl);
+        log.warn("-----jsonObject:[{}]", jsonObject);
+
+        String openid = jsonObject.getStr("openid");
+        String sessionKey = jsonObject.getStr("session_key"); // TODO 暂时用不到
+        log.warn("-----openid:[{}], session_key:[{}]", openid, sessionKey);
+
+        // TODO 测试阶段先注释掉
+        params.setOpenid(openid);
+        return cache(params);
+    }
+
+    private JSONObject httpGet(String url) {
+        HttpResponse response = HttpRequest.get(url).execute();
+        String json = response.charset("utf-8").body();
+        JSONObject jsonObject = JSONUtil.parseObj(json);
+        return jsonObject;
+    }
+
+    private String accessToken() {
+        WxConfig wxConfig = platformPinanbaoConfig.wxConfig();
+        String access_token = (String) redisUtil.hget(RedisKeyConstant.WX_ACCESS_TOKEN, wxConfig.getAppId());
+        if (access_token != null) {
+            return access_token;
+        }
+        return this.flushWxToken();
+    }
+
+    private String flushWxToken() {
+        WxConfig wxConfig = platformPinanbaoConfig.wxConfig();
+        // 解析codeUrl
+        String tokenUrl = MessageFormat.format(wxConfig.getTokenUrl(), wxConfig.getAppId(), wxConfig.getSecret());
+        // 通过codeUrl获取openid
+        JSONObject jsonObject = this.httpGet(tokenUrl);
+        String access_token = jsonObject.getStr("access_token");
+        redisUtil.hset(RedisKeyConstant.WX_ACCESS_TOKEN, wxConfig.getAppId(), access_token, RedisKeyConstant.WX_ACCESS_TOKEN_TIME);
+        return access_token;
+    }
+
+}

+ 40 - 0
src/main/java/com/care/client/vo/DeviceMonitorVO.java

@@ -0,0 +1,40 @@
+package com.care.client.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author: lilt
+ * @Date: 2021/6/8
+ * @Desc:
+ */
+@Data
+@ApiModel(description = "设备监测数据")
+public class DeviceMonitorVO {
+    private Long id;
+    @ApiModelProperty("呼吸频率")
+    private Integer breathRate;
+    @ApiModelProperty("呼吸频率单位")
+    private String breathRateUnit="次/分";
+
+    @ApiModelProperty("心跳频率")
+    private Integer heartRate;
+    @ApiModelProperty("心跳频率单位")
+    private String heartRateUnit="次/分";
+
+    @ApiModelProperty("活动距离")
+    private Integer activityDistance;
+    @ApiModelProperty("活动距离单位")
+    private String activityDistanceUnit = "m";
+
+    @ApiModelProperty("活动时长-N小时")
+    private Integer activityTimeHour;
+    @ApiModelProperty("活动时长-N分钟")
+    private Integer activityTimeMinute;
+
+    @ApiModelProperty("睡眠时长-N小时")
+    private Integer sleepTimeHour;
+    @ApiModelProperty("睡眠时长-N分钟")
+    private Integer sleepTimeMinute;
+}

+ 77 - 0
src/main/java/com/care/client/vo/HouseContactVO.java

@@ -0,0 +1,77 @@
+package com.care.client.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 被监护人紧急联系人(CareHouseContact)实体类
+ *
+ * @author makejava
+ * @since 2021-06-02 21:54:55
+ */
+
+@Data
+@ApiModel(value = "房屋紧急联系人", description = "")
+public class HouseContactVO implements Serializable {
+    private static final long serialVersionUID = -90072609726445263L;
+
+    @TableId(value = "ID", type = IdType.AUTO)
+    private Long id;
+
+
+    @ApiModelProperty("机构ID")
+    private Long orgId;
+
+
+    @ApiModelProperty("服务站ID")
+    private Long stationId;
+
+
+    @ApiModelProperty("房屋ID")
+    private Long houseId;
+
+
+    @ApiModelProperty("姓名")
+    private String name;
+
+
+    @ApiModelProperty("电话")
+    private String phone;
+
+
+    @ApiModelProperty("关系类别:kinsman亲属  neighbor:邻居")
+    private String relationType;
+    @ApiModelProperty("关系描述")
+    private String relationTypeDesc;
+
+    @ApiModelProperty("联系级别")
+    private Integer contactLevel;
+
+
+    @ApiModelProperty("经度")
+    private Double longitude;
+
+
+    @ApiModelProperty("纬度")
+    private Double latitude;
+
+
+    @ApiModelProperty("createTime")
+    private Date createTime;
+
+
+    @ApiModelProperty("modifyTime")
+    private Date modifyTime;
+
+
+}

+ 2 - 3
src/main/java/com/care/client/vo/MemberInfoVO.java

@@ -2,6 +2,7 @@ package com.care.client.vo;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -13,7 +14,7 @@ import java.io.Serializable;
  * @author makejava
  * @since 2021-06-07 00:18:53
  */
-
+@ApiModel(description = "登陆人信息")
 @Data
 public class MemberInfoVO implements Serializable {
     private static final long serialVersionUID = 676002338375207640L;
@@ -42,8 +43,6 @@ public class MemberInfoVO implements Serializable {
     private String phone;
 
 
-
-
     @ApiModelProperty("头像")
     private String profile;
 

+ 2 - 1
src/main/java/com/care/client/vo/MemberInitParams.java

@@ -11,7 +11,8 @@ import java.io.Serializable;
 public class MemberInitParams implements Serializable {
 
     private static final long serialVersionUID = 2825354998621065333L;
-
+    @ApiModelProperty(name = "code", value = "授权码")
+    private String code;
     @ApiModelProperty(name = "openid", value = "平台标识")
     private String openid;
 

+ 4 - 0
src/main/java/com/care/common/cache/RedisKeyConstant.java

@@ -34,4 +34,8 @@ public class RedisKeyConstant {
     //工单处理,同一工单仅1个人处理
     public static final String DO_ORDER = "SEAT_DO_ORDER:LOCK";
 
+    //设备监测信息
+    public static final String DEVICE_MONITOR = "DEVICE:MONITOR";
+    public static final int DEVICE_MONITOR_TIME = 60;
+
 }

+ 21 - 1
src/main/java/com/care/common/config/SwaggerConfig.java

@@ -98,5 +98,25 @@ public class SwaggerConfig {
                 .apis(RequestHandlerSelectors.basePackage("com.care.bms"))
                 .build();
     }
-
+    @Bean
+    public Docket docketC(){
+        return new Docket(DocumentationType.SWAGGER_2)
+                //设置分组名
+                .groupName("频安宝接口文档")
+                .apiInfo(new ApiInfo(
+                        "Swagger API文档标题",
+                        "Swagger API文档描述",
+                        "V1.0",
+                        "106",
+                        new Contact("作者名", "作者博客Url", "作者邮箱Email"),
+                        "Apache 2.0",
+                        "http://www.apache.org/licenses/LICENSE-2.0",
+                        new ArrayList<>()
+                ))
+                //配置 Swagger 信息
+                .select()
+                //basePackage("相对包路径"):指定要扫描的包(常用)
+                .apis(RequestHandlerSelectors.basePackage("com.care.client"))
+                .build();
+    }
 }

+ 4 - 0
src/main/java/com/care/common/entity/CareEventOrderOlder.java

@@ -51,6 +51,10 @@ public class CareEventOrderOlder implements Serializable {
     @TableField("ORDER_ID")
     private Long orderId;
 
+    @ApiModelProperty("老人ID")
+    @TableField("OLDER_ID")
+    private Long olderId;
+
 
     @ApiModelProperty("姓名")
     @TableField("NAME")

+ 4 - 3
src/main/java/com/care/common/entity/CcCallResult.java

@@ -64,9 +64,6 @@ public class CcCallResult implements Serializable {
     @TableField("STATION_ID")
     private Long stationId;
 
-    @ApiModelProperty("房屋ID")
-    @TableField("house_id")
-    private Long houseId;
 
     @ApiModelProperty("被监护人ID")
     @TableField("older_id")
@@ -77,6 +74,10 @@ public class CcCallResult implements Serializable {
     @TableField("order_id")
     private Long orderId;
 
+    @ApiModelProperty("房屋ID")
+    @TableField("HOUSE_ID")
+    private Long houseId;
+
     @ApiModelProperty("会话id,通话唯一标识")
     @TableField("session_id")
     private String sessionId;

+ 44 - 0
src/main/java/com/care/common/enums/CallResultEnum.java

@@ -0,0 +1,44 @@
+package com.care.common.enums;
+
+
+/**
+ * @Author:java
+ * @Date: 2021/05/27
+ */
+public enum CallResultEnum {
+    /**
+     *
+     */
+    WEI_JIE_TONG(2,"未接通"),
+    WU_FA_GAN_WANG(4,"无法赶往"),
+    YI_GAN_WANG(5,"已赶往"),
+    YI_DAO_DA(6,"已到达");
+    private Integer value;
+    private String name;
+    CallResultEnum(Integer value, String name) {
+        this.value = value;
+        this.name = name;
+    }
+    public Integer getValue() {
+        return value;
+    }
+    public String getName() {
+        return name;
+    }
+    public static String getCodeToName(Integer code){
+        if (code == null){
+            return null;
+        }
+         if (WEI_JIE_TONG.getValue().intValue() == code.intValue()){
+            return  WEI_JIE_TONG.name;
+        }else if (WU_FA_GAN_WANG.getValue().intValue() == code.intValue()){
+            return WU_FA_GAN_WANG.name;
+        }else if (YI_GAN_WANG.getValue().intValue() == code.intValue()){
+            return YI_GAN_WANG.name;
+        }else if (YI_DAO_DA.getValue().intValue() == code.intValue()){
+            return YI_DAO_DA.name;
+        }
+
+        return null;
+    }
+}

+ 0 - 2
src/main/java/com/care/common/enums/ContactorStatusEnum.java

@@ -1,8 +1,6 @@
 package com.care.common.enums;
 
 
-import cn.hutool.core.util.StrUtil;
-
 /**
  * @Author:java
  * @Date: 2021/05/27

+ 3 - 3
src/main/java/com/care/common/enums/KeyAuthEnum.java

@@ -11,9 +11,9 @@ public enum KeyAuthEnum {
     /**
      * 钥匙授权
      */
-    TODO("1","申请授权"),
-    AUTHED("SEAT","已授权"),
-    RETURN("older","归还");
+    TODO("0","申请授权"),
+    AUTHED("1","已授权"),
+    RETURN("2","归还钥匙");
     private String value;
     private String name;
     KeyAuthEnum(String value, String name) {

+ 5 - 1
src/main/java/com/care/common/mapper/CareDeviceMapper.java

@@ -2,6 +2,10 @@ package com.care.common.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.care.common.entity.CareDevice;
+import com.care.common.vo.device.DeviceVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 
 /**
@@ -11,5 +15,5 @@ import com.care.common.entity.CareDevice;
  * @since 2021-05-21 00:08:36
  */
 public interface CareDeviceMapper extends BaseMapper<CareDevice> {
-
+    List<DeviceVO> queryListByHouseId(@Param("houseId") Long houseId );
 }

+ 4 - 0
src/main/java/com/care/common/mapper/CareEventOrderMapper.java

@@ -2,6 +2,8 @@ package com.care.common.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.care.common.entity.CareEventOrder;
+import com.care.common.vo.event.EventStaVO;
+import org.apache.ibatis.annotations.Param;
 
 
 /**
@@ -12,4 +14,6 @@ import com.care.common.entity.CareEventOrder;
  */
 public interface CareEventOrderMapper extends BaseMapper<CareEventOrder> {
 
+    EventStaVO statOrder(@Param("orgId") Long orgId, @Param("stationId")Long stationId);
+
 }

+ 9 - 0
src/main/java/com/care/common/service/CareDeviceService.java

@@ -2,6 +2,9 @@ package com.care.common.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.care.common.entity.CareDevice;
+import com.care.common.vo.device.DeviceVO;
+
+import java.util.List;
 
 /**
  * 被监护人-设备(CareDevice)表服务接口
@@ -11,4 +14,10 @@ import com.care.common.entity.CareDevice;
  */
 public interface CareDeviceService extends IService<CareDevice> {
 
+    /**
+     * 查询房屋的设备列表
+     * @param houseId
+     * @return
+     */
+    List<DeviceVO> queryListByHouseId(Long houseId);
 }

+ 9 - 0
src/main/java/com/care/common/service/CareEventOrderService.java

@@ -2,6 +2,8 @@ package com.care.common.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.care.common.entity.CareEventOrder;
+import com.care.common.vo.event.EventStaVO;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 事件定单表(CareEventOrder)表服务接口
@@ -10,4 +12,11 @@ import com.care.common.entity.CareEventOrder;
  * @since 2021-05-21 00:08:29
  */
 public interface CareEventOrderService extends IService<CareEventOrder> {
+    /**
+     * 统计事件数量
+     * @param orgId
+     * @param stationId
+     * @return
+     */
+    EventStaVO statOrder(Long orgId, Long stationId);
 }

+ 2 - 1
src/main/java/com/care/common/service/CcCallResultService.java

@@ -2,6 +2,7 @@ package com.care.common.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.care.common.entity.CcCallResult;
+import com.care.common.vo.UserLogindConvertVO;
 import com.care.common.vo.outcall.CcCallResultVO;
 
 /**
@@ -18,5 +19,5 @@ public interface CcCallResultService extends IService<CcCallResult> {
      */
     CcCallResultVO getCallResult(Long id);
 
-    void saveCallResult(CcCallResult result);
+    void saveCallResult(CcCallResult result, UserLogindConvertVO loginUser);
 }

+ 13 - 0
src/main/java/com/care/common/service/impl/CareDeviceServiceImpl.java

@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.care.common.entity.CareDevice;
 import com.care.common.mapper.CareDeviceMapper;
 import com.care.common.service.CareDeviceService;
+import com.care.common.vo.device.DeviceVO;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 被监护人-设备(CareDevice)表服务实现类
  *
@@ -15,4 +18,14 @@ import org.springframework.stereotype.Service;
 @Service
 public class CareDeviceServiceImpl extends ServiceImpl<CareDeviceMapper, CareDevice> implements CareDeviceService {
 
+    /**
+     * 查询房屋的设备列表
+     *
+     * @param houseId
+     * @return
+     */
+    @Override
+    public List<DeviceVO> queryListByHouseId(Long houseId) {
+        return this.baseMapper.queryListByHouseId(houseId);
+    }
 }

+ 12 - 0
src/main/java/com/care/common/service/impl/CareEventOrderServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.care.common.entity.CareEventOrder;
 import com.care.common.mapper.CareEventOrderMapper;
 import com.care.common.service.CareEventOrderService;
+import com.care.common.vo.event.EventStaVO;
 import org.springframework.stereotype.Service;
 
 /**
@@ -14,4 +15,15 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class CareEventOrderServiceImpl extends ServiceImpl<CareEventOrderMapper, CareEventOrder> implements CareEventOrderService {
+    /**
+     * 统计事件数量
+     *
+     * @param orgId
+     * @param stationId
+     * @return
+     */
+    @Override
+    public EventStaVO statOrder(Long orgId, Long stationId) {
+        return this.baseMapper.statOrder(orgId,stationId);
+    }
 }

+ 35 - 7
src/main/java/com/care/common/service/impl/CcCallResultServiceImpl.java

@@ -1,16 +1,17 @@
 package com.care.common.service.impl;
 
 import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.care.common.entity.CareEventOrderHandleHis;
-import com.care.common.entity.CcCallResult;
+import com.care.common.entity.*;
 import com.care.common.enums.ContactorStatusEnum;
 import com.care.common.enums.UserRoleEnum;
 import com.care.common.mapper.CcCallResultMapper;
-import com.care.common.service.CareEventOrderHandleHisService;
-import com.care.common.service.CcCallResultService;
+import com.care.common.service.*;
+import com.care.common.vo.UserLogindConvertVO;
 import com.care.common.vo.outcall.CcCallResultVO;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 
@@ -25,6 +26,12 @@ public class CcCallResultServiceImpl extends ServiceImpl<CcCallResultMapper, CcC
 
     @Resource
     private CareEventOrderHandleHisService careEventOrderHandleHisService;
+    @Resource
+    private CareEventOrderOlderService careEventOrderOlderService;
+    @Resource
+    private CareEventOrderChambService careEventOrderChambService;
+    @Resource
+    private CareEventOrderContactStatusService careEventOrderContactStatusService;
     /**
      * 获取呼叫结果
      *
@@ -37,7 +44,8 @@ public class CcCallResultServiceImpl extends ServiceImpl<CcCallResultMapper, CcC
     }
 
     @Override
-    public void saveCallResult(CcCallResult result) {
+    @Transactional(rollbackFor = Exception.class)
+    public void saveCallResult(CcCallResult result, UserLogindConvertVO loginUser) {
 
         this.save(result);
 
@@ -50,11 +58,31 @@ public class CcCallResultServiceImpl extends ServiceImpl<CcCallResultMapper, CcC
         his.setLogObjectName(result.getCalledName());
         his.setLogResult(ContactorStatusEnum.getCodeToName(result.getCallStatus()));
         his.setOpUserRole(UserRoleEnum.SEAT.getValue());
-        //his.setOpUserId(loginUser.getId());
-        //his.setOpUserName(loginUser.getName());
+        his.setOpUserId(loginUser.getId());
+        his.setOpUserName(loginUser.getName());
         his.setCreateTime(DateUtil.date());
         his.setRelationTypeDesc(result.getRelationTypeDesc());
+        his.setCallResultId(result.getId());
         this.careEventOrderHandleHisService.save(his);
+
+        if (UserRoleEnum.OLDER.getValue().equals(result.getCalledType())){
+            UpdateWrapper<CareEventOrderOlder> updateWrapper = new UpdateWrapper<>();
+            //已联系
+            updateWrapper.lambda().eq(CareEventOrderOlder::getId,result.getCalledId())
+            .set(CareEventOrderOlder::getStatus,"1");
+            this.careEventOrderOlderService.update(updateWrapper);
+        }else if (UserRoleEnum.CONTACT.getValue().equals(result.getCalledType())){
+            UpdateWrapper<CareEventOrderContactStatus> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.lambda().eq(CareEventOrderContactStatus::getId,result.getCalledId())
+                    .set(CareEventOrderContactStatus::getStatus,result.getCallStatus());
+            this.careEventOrderContactStatusService.update(updateWrapper);
+        }else if(UserRoleEnum.CHANMB.getValue().equals(result.getCalledType())){
+            UpdateWrapper<CareEventOrderChamb> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.lambda().eq(CareEventOrderChamb::getId,result.getCalledId())
+                    .set(CareEventOrderChamb::getStatus,"1");
+            this.careEventOrderChambService.update(updateWrapper);
+        }
+
     }
 
 

+ 276 - 0
src/main/java/com/care/common/util/CheckUtils.java

@@ -0,0 +1,276 @@
+package com.care.common.util;
+
+import org.apache.commons.beanutils.BeanPredicate;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.PredicateUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.lang.reflect.Array;
+import java.math.BigDecimal;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 类CheckUtils.java的实现描述:一些通用的校验工具类 <br>
+ * 如果没有检验通过跑出IllegalArgumentException
+ * 
+ * @author suxuan
+ */
+public class CheckUtils {
+
+    /**
+     * 验证字符串是否为空串
+     * 
+     * @param str 被验证的字符串
+     * @param checkName 检查名称描述
+     * @throws IllegalArgumentException
+     */
+    public static void valueIsEmpty(String str, String checkName) {
+        if (StringUtils.isBlank(str)) {
+            StringBuffer sb = new StringBuffer();
+            sb.append(checkName).append(" must be specified");
+            throw new IllegalArgumentException(sb.toString());
+        }
+    }
+
+    /**
+     * 验证多个字符串是否为空串<br>
+     * 可变长度参数checkNames的长度要和strs的长度相同
+     * 
+     * @param strs 字符串数组
+     * @param checkNames 检查名称描述
+     * @throws IllegalArgumentException
+     */
+    public static void valueIsEmpty(String[] strs, String... checkNames) {
+        StringBuffer buffer = new StringBuffer();
+        if (strs.length != checkNames.length) throw new IllegalArgumentException(
+                                                                                 "strs's length is not equlas checkNames's length");
+        for (int i = 0; i < strs.length; i++) {
+            if (StringUtils.isBlank(strs[i])) {
+                buffer.append(checkNames[i]).append(",");
+            }
+        }
+        if (buffer.toString().endsWith(",")) {
+            buffer.append(" must be specified");
+            throw new IllegalArgumentException(buffer.toString());
+        }
+    }
+
+    /**
+     * 检查对象属性是否为NULL
+     * 
+     * @param obj 检查对象
+     * @param checkName 对象检查为NULL项(分隔符逗号) 格式为:"name,age"
+     * @throws IllegalArgumentException
+     */
+    public static void valueIsNull(Object obj, String checkName) {
+        StringBuffer sb = new StringBuffer();
+        checkValueIsNull(sb, obj, checkName);
+        if (sb.toString().endsWith(",")) {
+            sb.append(" must be specified");
+            throw new IllegalArgumentException(sb.toString());
+        }
+    }
+
+    /**
+     * 检查对象项是否为NULL
+     * 
+     * @param objs 检查对象集合
+     * @param checkNames 对象检查为NULL项(分隔符逗号) 其中每项格式为:"name,age"
+     * @throws IllegalArgumentException
+     */
+    public static void valueIsNull(Object[] objs, String[] checkNames) {
+        if (objs.length != checkNames.length) {
+            throw new IllegalArgumentException("objs's length is not equlas checkNames's length");
+        }
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < objs.length; i++) {
+            checkValueIsNull(sb, objs[i], checkNames[i]);
+        }
+        if (sb.toString().endsWith(",")) {
+            sb.append(" must be specified");
+            throw new IllegalArgumentException(sb.toString());
+        }
+    }
+
+    /**
+     * 判断对象项是否为NULL
+     *
+     * @param sb
+     * @param obj 检查对象
+     * @param checkNames 对象检查为NULL项(分隔符逗号) 其中每项格式为:"name,age"
+     */
+    private static void checkValueIsNull(StringBuffer sb, Object obj, String checkNames) {
+        if (obj == null) {
+            sb.append(checkNames + ",");
+            return;
+        }
+        if (!(isPrimitive(obj) || obj instanceof Date || obj instanceof String || obj instanceof BigDecimal)) {
+            String chkname[] = checkNames.split(",");
+            for (int j = 0; j < chkname.length; j++) {
+                Predicate predicate = new BeanPredicate(chkname[j], PredicateUtils.nullPredicate());
+                if (predicate.evaluate(obj)) sb.append(chkname[j] + ",");
+            }
+        }
+    }
+
+    /**
+     * 判断是否是基本类型及包装类 true:是,false:否
+     * 
+     * @param obj
+     * @return
+     * @throws IllegalArgumentException
+     */
+    public static boolean isPrimitive(Object obj) {
+        if (obj.getClass().isPrimitive()) return true;
+        if (obj instanceof Long || obj instanceof Integer || obj instanceof Float || obj instanceof Boolean
+            || obj instanceof Double) return true;
+        return false;
+    }
+
+    /**
+     * 验证对象是否为空
+     * 
+     * @param obj 被验证的对象
+     * @param message 异常信息
+     * @throws IllegalArgumentException
+     */
+    public static void notNull(Object obj, String message) {
+        if (obj == null) {
+            throw new IllegalArgumentException(message + " must be specified");
+        }
+    }
+
+    /**
+     * 验证对象集合是否为空
+     * 
+     * @param objs 被验证的对象
+     * @param messages 异常信息
+     * @throws IllegalArgumentException
+     */
+    public static void notNull(Object[] objs, String... messages) {
+        if (objs.length != messages.length) {
+            throw new IllegalArgumentException("objs's length is not equlas message's length");
+        }
+        for (int i = 0; i < objs.length; i++) {
+            if (objs[i] == null) {
+                throw new IllegalArgumentException(messages[i] + " must be specified");
+            }
+        }
+    }
+
+    /**
+     * 验证对象是否为空,或者字符串是否为空串(只有空格的字符串也认为是空串)
+     * 
+     * @param obj 被验证的对象
+     * @param message 异常信息
+     * @throws IllegalArgumentException
+     */
+    public static void strNotNull(Object obj, String message) {
+        if (obj == null) {
+            throw new IllegalArgumentException(message + " must be specified");
+        }
+        if (obj instanceof String && obj.toString().trim().length() == 0) {
+            throw new IllegalArgumentException(message + " must be specified");
+        }
+    }
+
+    /**
+     * 验证对象是否为NULL,空字符串,空数组,空的Collection或Map(只有空格的字符串也认为是空串)
+     * 
+     * @param obj 被验证的对象
+     * @param message 异常信息
+     * @throws IllegalArgumentException
+     */
+    @SuppressWarnings("rawtypes")
+    public static void notEmpty(Object obj, String message) {
+        if (obj == null) {
+            throw new IllegalArgumentException(message + " must be specified");
+        }
+        if (obj instanceof String && obj.toString().trim().length() == 0) {
+            throw new IllegalArgumentException(message + " must be specified");
+        }
+        if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
+            throw new IllegalArgumentException(message + " must be specified");
+        }
+        if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
+            throw new IllegalArgumentException(message + " must be specified");
+        }
+        if (obj instanceof Map && ((Map) obj).isEmpty()) {
+            throw new IllegalArgumentException(message + " must be specified");
+        }
+    }
+
+    /**
+     * 判断参数否非空
+     * 
+     * @param obj
+     * @return
+     */
+    public static boolean isNull(Object obj) {
+        if (obj == null) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 判断参数是否非NULL,空字符串,空数组,空的Collection或Map(只有空格的字符串也认为是空串)
+     * 
+     * @param obj
+     * @return
+     */
+    @SuppressWarnings("rawtypes")
+    public static boolean isEmpty(Object obj) {
+        if (obj == null) {
+            return true;
+        }
+        if (obj instanceof String && obj.toString().trim().length() == 0) {
+            return true;
+        }
+        if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
+            return true;
+        }
+        if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
+            return true;
+        }
+        if (obj instanceof Map && ((Map) obj).isEmpty()) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 判断是否是手机号码
+     *
+     * @param mobiles
+     * @return
+     */
+    public static boolean isMobileNO(String mobiles) {
+        Pattern p = Pattern.compile("^[1][3,4,5,6,7,8,9][0-9]{9}$");
+        Matcher m = p.matcher(mobiles);
+        return m.matches();
+    }
+
+    /**
+     * 判断是否是邮箱
+     *
+     * @param emails
+     * @return
+     */
+    public static boolean isEmail(String emails) {
+        Boolean isEmail = false;
+        String expr = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})$";
+
+        if (emails.matches(expr)) {
+            isEmail = true;
+        }
+        return isEmail;
+    }
+
+
+
+}

+ 24 - 0
src/main/java/com/care/common/vo/device/DeviceVO.java

@@ -0,0 +1,24 @@
+package com.care.common.vo.device;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author: lilt
+ * @Date: 2021/6/7
+ * @Desc:
+ */
+@Data
+public class DeviceVO {
+
+    @ApiModelProperty("设备ID")
+    private Long devId;
+
+
+    @ApiModelProperty("房屋ID")
+    private Long houseId;
+
+
+    @ApiModelProperty("设备别名:例如卧室")
+    private String devAliasName;
+}

+ 90 - 0
src/main/java/com/care/common/vo/event/CareHouseVO.java

@@ -0,0 +1,90 @@
+package com.care.common.vo.event;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 被监护房屋信息(CareHouse)实体类
+ *
+ * @author makejava
+ * @since 2021-06-02 22:00:37
+ */
+
+@Data
+@ApiModel(value = "被监护房屋信息", description = "")
+public class CareHouseVO implements Serializable {
+    private static final long serialVersionUID = -60036036914347085L;
+
+    private Long id;
+
+
+    @ApiModelProperty("机构ID")
+    private Long orgId;
+
+
+    @ApiModelProperty("服务站ID")
+    private Long stationId;
+
+
+    @ApiModelProperty("房屋简称")
+    @TableField("NAME")
+    private String name;
+
+
+    @ApiModelProperty("钥匙托管类型: 1 :电子 2:机械 0:未托管")
+    private String keyEscrowType;
+
+
+    @ApiModelProperty("状态: 1正常,2离开房间,3久滞,4摔倒,5坠床 6主动呼叫")
+    private Integer status;
+
+
+    @ApiModelProperty("地址")
+    private String addr;
+
+
+    @ApiModelProperty("经度")
+    private Double longitude;
+
+
+    @ApiModelProperty("纬度")
+    private Double latitude;
+
+
+    @ApiModelProperty("管理者电话")
+    private String managePhone;
+
+
+    @ApiModelProperty("管理者姓名")
+    private String manageName;
+
+
+    @ApiModelProperty("createTime")
+    private Date createTime;
+
+
+    @ApiModelProperty("modifyTime")
+    private Date modifyTime;
+
+
+    @ApiModelProperty("管家ID")
+    private Long chambId;
+
+
+    @ApiModelProperty("管家姓名")
+    private String chambName;
+
+    @ApiModelProperty("关系类别描述")
+    private String relationTypeDesc;
+
+}

+ 1 - 1
src/main/java/com/care/common/vo/event/EventOrderVO.java

@@ -96,7 +96,7 @@ public class EventOrderVO implements Serializable {
     private Date completeTime;
 
     @ApiModelProperty("房屋")
-    private CareHouse house;
+    private CareHouseVO house;
 
 
 }

+ 23 - 0
src/main/java/com/care/common/vo/event/EventStaVO.java

@@ -0,0 +1,23 @@
+package com.care.common.vo.event;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author: lilt
+ * @Date: 2021/6/7
+ * @Desc:
+ */
+@Data
+@ApiModel(value = "事件统计")
+public class EventStaVO {
+    @ApiModelProperty(value = "全部事件")
+    private Integer allCount;
+    @ApiModelProperty(value = "未处理事件")
+    private Integer notDoCount;
+    @ApiModelProperty(value = "进行中事件")
+    private Integer doingCount;
+    @ApiModelProperty(value = "完成事件")
+    private Integer doneCount;
+}

+ 3 - 0
src/main/java/com/care/common/vo/event/OrderHandleHisVO.java

@@ -3,6 +3,7 @@ package com.care.common.vo.event;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -54,10 +55,12 @@ public class OrderHandleHisVO implements Serializable {
 
 
     @ApiModelProperty("createTime")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     private Date createTime;
 
 
     @ApiModelProperty("modifyTime")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     private Date modifyTime;
 
 

+ 0 - 6
src/main/java/com/care/common/vo/outcall/CcCallResultVO.java

@@ -1,14 +1,8 @@
 package com.care.common.vo.outcall;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.util.Date;

+ 0 - 19
src/main/java/com/care/demo/constant/RimsDictionariesConstant.java

@@ -1,19 +0,0 @@
-package com.care.demo.constant;
-
-import io.swagger.annotations.ApiModel;
-import lombok.Data;
-
-/**
- * @Description 字典常量
- * @Author Flag
- * @Date: 2021/4/13 19:37
- * @Version: 1.0
- **/
-@ApiModel("字典常量")
-@Data
-public class RimsDictionariesConstant {
-
-    private RimsDictionariesConstant(){
-
-    }
-}

+ 0 - 240
src/main/java/com/care/demo/controller/SystemDictionariesController.java

@@ -1,240 +0,0 @@
-package com.care.demo.controller;
-
-import cn.hutool.json.JSONUtil;
-import com.care.common.vo.PageResVO;
-import com.care.demo.entity.RimsDictionaries;
-import com.care.demo.service.SystemDictionariesService;
-import com.care.common.util.PageResult;
-import com.care.common.util.PageUtil;
-import com.care.common.util.Result;
-import com.care.common.util.ResultCode;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-
-/**
- * @author javadoc
- * @version 1.0
- * @description 系统设置-字典管理模块-前端控制器
- * @date
- */
-@Slf4j
-@RestController
-@RequestMapping("/bms/system/dictionaries")
-public class SystemDictionariesController {
-
-    @Autowired
-    SystemDictionariesService systemDictionariesService;
-
-
-    /**
-     * 字典:分页查询
-     * 作用:从前端获取查询条件(可无条件)和分页数据,请求数据库获取数据
-     *
-     * @param rimsDictionaries 收集到的多条件字典查询对象
-     * @param page             分页对象(收集分页参数)
-     * @return 无搜索条件时返回的是有父子级结构的字典数据,有搜索条件时返回的时无父子结构的字典数据
-     */
-    @GetMapping("/getDictionariesByPage")
-    public PageResult<List<RimsDictionaries>> getDictionariesByPage(RimsDictionaries rimsDictionaries, PageResVO page) {
-        try {
-            //声明字典多条件查询分页对象集合(数据包含在分页工具类中)
-            PageUtil<RimsDictionaries> dictionariesByPage;
-            //若字典名称搜索条件为空则为无条件分页查询(返回数据包含父子级结构)
-            if(StringUtils.isBlank(rimsDictionaries.getDictionariesName())){
-                dictionariesByPage =
-                        systemDictionariesService.getDictionaries(page);
-            } else {
-                //获取字典多条件查询分页对象集合(数据包含在分页工具类中)
-                dictionariesByPage =
-                        systemDictionariesService.getDictionariesByPage(rimsDictionaries, page);
-            }
-            if (dictionariesByPage == null) {
-                return PageResult.error( "数据错误,获取字典数据失败");
-            } else {
-
-                return  PageResult.success(
-                        "查询成功",dictionariesByPage.getListT(),
-                        dictionariesByPage.getCurrent(),
-                        dictionariesByPage.getPageSize(),
-                        dictionariesByPage.getTotal());
-            }
-        } catch (Exception e) {
-           log.error("字典:分页查询出现异常",e);
-            return PageResult.error("系统错误,获取字典数据失败");
-        }
-    }
-
-
-    /**
-     * 字典:字段查重(字典选项代码)
-     * 作用:添加或修改时对必须唯一的字段进行查重
-     *
-     * @param rimsDictionaries 收集需要查重的字段参数
-     * @return 返回0表示字段没有重复,非零表示有重复
-     */
-    @GetMapping("/getDictionaRepetitionCount")
-    public Result<Object> getDictionaRepetitionCount(RimsDictionaries rimsDictionaries) {
-        try {
-            Integer repetitionCount =
-                    systemDictionariesService.getDictionaRepetitionCount(rimsDictionaries);
-            if (repetitionCount == 0) {
-                return Result.success(
-                        "字段查重通过");
-            }else{
-                return new Result<>(ResultCode.ERROR,
-                        "字段查重不通过");
-            }
-        } catch (Exception e) {
-           log.error("字典:字典查重出现异常",e);
-            return Result.error("系统错误,查询失败");
-        }
-    }
-
-
-    /**
-     * 字典:添加记录
-     * 作用:添加字典数据
-     *
-     * @param data 收集参数的json对象
-     * @return 添加成功返回 "00000"
-     */
-    @PostMapping(value = "/addDictionaries",produces = "application/json; charset=utf-8")
-    public Result<Object> addDictionaries(@RequestBody String data) {
-        try {
-            RimsDictionaries rimsDictionaries = JSONUtil.parse(data).toBean(RimsDictionaries.class);
-            //参数校验
-            Result<Object> result = checkDictionariesParameter(rimsDictionaries);
-            if (result != null) {
-                return result;
-            }
-            Integer indexFlag = systemDictionariesService.addDictionaries(rimsDictionaries);
-            return indexFlag == 1 ?
-                    Result.success("添加成功") :
-                    new Result<>(ResultCode.ERROR,"数据错误,添加失败") ;
-        } catch (Exception e) {
-           log.error("字典:添加出现异常",e);
-            return Result.error("系统错误,添加失败");
-        }
-    }
-
-
-    /**
-     * 字典:修改记录
-     * 作用:修改字典数据
-     *
-     * @param data 收集参数的json对象
-     * @return 添加成功返回 "00000"
-     */
-    @PutMapping(value = "/updateDictionaries",produces = "application/json; charset=utf-8")
-        public Result<Object> updateDictionaries(@RequestBody String data) {
-        try {
-            RimsDictionaries rimsDictionaries = JSONUtil.parse(data).toBean(RimsDictionaries.class);
-            //参数校验字典ID是否为空
-            if(rimsDictionaries.getId() == null){
-                return new Result<>(ResultCode.ERROR,"必要参数ID不能为空");
-            }
-            //参数校验
-            Result<Object> result = checkDictionariesParameter(rimsDictionaries);
-            if (result != null) {
-                return result;
-            }
-            Integer indexFlag = systemDictionariesService.updateDictionaries(rimsDictionaries);
-            return indexFlag == 1 ?
-                    Result.success("修改成功") :
-                    new Result<>(ResultCode.ERROR,"数据错误,修改失败") ;
-        } catch (Exception e) {
-           log.error("字典:修改出现异常",e);
-            return Result.error("系统错误,修改字典失败");
-        }
-    }
-
-
-    /**
-     * 字典:删除记录
-     * 作用:删除字典数据
-     *
-     * @param id 要删除字典的id
-     * @return 删除成功返回 "00000"
-     */
-    @DeleteMapping(value = "/deleteDictionariesById/{id}",produces = "application/json; charset=utf-8")
-    public Result<Object> deleteDictionariesById(@PathVariable Long id){
-        try{
-            Integer flag = systemDictionariesService.deleteDictionariesById(id);
-            if (flag == 0){
-                return Result.error("删除失败");
-            }else{
-                return Result.success( "删除成功") ;
-            }
-        }catch (Exception e){
-           log.error("字典:删除出现异常",e);
-            return Result.error("系统错误,删除失败");
-        }
-    }
-
-
-    /**
-     * 字典:启用/停用状态修改
-     * 作用:启用或停用某个字典记录数据
-     *
-     * @param data 收集参数的json对象(里面包含,id,pid,enable 三个参数)
-     * @return 删除成功返回 "00000"
-     */
-    @PutMapping(value = "/updateDictionariesEnableById",produces = "application/json; charset=utf-8")
-    public Result<Object> updateDictionariesEnableById(@RequestBody String data){
-        try{
-            //接收到参数转化成字典对象
-            RimsDictionaries rimsDictionaries = JSONUtil.parse(data).toBean(RimsDictionaries.class);
-            //参数校验
-            if(rimsDictionaries.getId() == null){
-                return new Result<>(ResultCode.ERROR,"缺少必要参数ID");
-            }
-            if(rimsDictionaries.getPid() == null){
-                return new Result<>(ResultCode.ERROR,"缺少必要参数PID");
-            }
-            if(rimsDictionaries.getEnable() == null){
-                return new Result<>(ResultCode.ERROR,"必要参数更新状态不能为null");
-            }
-            Integer flag = systemDictionariesService.updateDictionariesEnableById(rimsDictionaries);
-            if (flag == 0){
-                return Result.error("修改失败");
-            }else{
-                return Result.success( "修改成功") ;
-            }
-        }catch (Exception e){
-           log.error("字典:状态更新出现异常",e);
-            return Result.error("系统错误,状态更新失败");
-        }
-    }
-
-
-
-
-    /**
-     * 字典:校验必传参数
-     * 作用:添加和修改时确保关键字段非空,以及选项代码不为空时查重
-     *
-     * @param rimsDictionaries 要验证的参数对象
-     * @return 返回校验结果
-     */
-    private Result<Object> checkDictionariesParameter(RimsDictionaries rimsDictionaries) {
-        log.info("字典参数校验传参为 = " + rimsDictionaries);
-        if (rimsDictionaries.getPid() == null) {
-            return Result.error("参数PID不能为空");
-        }
-        if (StringUtils.isBlank(rimsDictionaries.getDictionariesName())) {
-            return Result.error("字典名称不能为空");
-        }
-        if(StringUtils.isNotBlank(rimsDictionaries.getDicCode())
-                && systemDictionariesService.getDictionaRepetitionCount(rimsDictionaries) != 0){
-            return Result.error("选项代码重复");
-        }
-        return null;
-    }
-
-
-}

+ 0 - 80
src/main/java/com/care/demo/entity/RimsDictionaries.java

@@ -1,80 +0,0 @@
-package com.care.demo.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.time.LocalDateTime;
-import java.util.List;
-
-/**
- * 字典表实体类
- *
- * @author little
- * @since 2021-01-02
- */
-@Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@TableName("RIMS_DICTIONARIES")
-@ApiModel(value = "RimsDictionaries对象")
-public class RimsDictionaries implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty(value = "主键")
-    @TableId(value = "ID", type = IdType.AUTO)
-    private Long id;
-
-    @ApiModelProperty(value = "父级ID")
-    @TableField("PID")
-    private Long pid;
-
-    @ApiModelProperty(value = "字典名称")
-    @TableField("DICTIONARIES_NAME")
-    private String dictionariesName;
-
-    @ApiModelProperty(value = "选项名称")
-    @TableField("DIC_NAME")
-    private String dicName;
-
-    @ApiModelProperty(value = "选项代码")
-    @TableField("DIC_CODE")
-    private String dicCode;
-
-    @ApiModelProperty(value = "排序字段")
-    @TableField("DIC_SORT")
-    private Integer dicSort;
-
-    @ApiModelProperty(value = "说明")
-    @TableField("DIC_DESCRIBE")
-    private String dicDescribe;
-
-    @ApiModelProperty(value = "创建时间")
-    @TableField("CREATE_TIME")
-    private LocalDateTime createTime;
-
-    @ApiModelProperty(value = "更新时间")
-    @TableField("MODIFY_TIME")
-    private LocalDateTime modifyTime;
-
-    /**
-     * @TableLogic 逻辑删除注解
-     */
-    @TableLogic
-    @ApiModelProperty(value = "是否删除 0否 1是")
-    @TableField("DELETED")
-    private int deleted;
-
-    @ApiModelProperty(value = "启用/停用 0 启用 1停用")
-    @TableField("ENABLE")
-    private Integer enable;
-
-    @ApiModelProperty(value = "字典对象子级集合")
-    @TableField(exist = false)
-    private List<RimsDictionaries> rimsDictionariesList;
-}

+ 0 - 46
src/main/java/com/care/demo/mapper/RimsDictionariesMapper.java

@@ -1,46 +0,0 @@
-package com.care.demo.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.care.demo.entity.RimsDictionaries;
-import com.care.common.util.PageUtil;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-
-/**
- * @author nhc
- * @version 1.0
- * @description 字典表DAO层接口
- * @date 2021/02/08/19:41
- */
-public interface RimsDictionariesMapper extends BaseMapper<RimsDictionaries> {
-
-
-    /**
-     * 多条件分页查询
-     * @param dictionaries 字典对象用来承载搜索条件
-     * @param pageUtil 分页工具对象
-     * @return 符合搜索条件的字典集合
-     */
-    List<RimsDictionaries> selectDictionariesByPage(
-            @Param("dictionaries") RimsDictionaries dictionaries,
-            @Param("pageUtil") PageUtil<RimsDictionaries> pageUtil);
-
-
-    /**
-     * 多条件查询总记录数
-     * @param dictionaries 字典对象用来承载搜索条件
-     * @return 返回多条件查询总记录数
-     */
-    Integer selectDictionariesByCount(RimsDictionaries dictionaries);
-
-
-    /**
-     * 根据传入的条件查询 数据总数
-     * @param dictionaries 字典对象用来承载搜索条件
-     * @return 返回查重数量不重复返回0
-     */
-    Integer selectDictionaRepetitionCount(RimsDictionaries dictionaries);
-
-}

+ 0 - 100
src/main/java/com/care/demo/service/SystemDictionariesService.java

@@ -1,100 +0,0 @@
-package com.care.demo.service;
-
-import com.care.demo.entity.RimsDictionaries;
-import com.care.common.vo.PageResVO;
-import com.care.common.util.PageUtil;
-
-import java.util.List;
-import java.util.Map;
-
-
-
-/**
- * @author nhc
- * @version 1.0
- * @description 系统设置-字典管理模块-业务逻辑层接口
- * @date 2021/02/08/19:41
- */
-public interface SystemDictionariesService {
-
-
-    /**
-     * 无条件分页查询
-     * @param page 分页对象
-     * @return 父子级分页字典集合
-     */
-    PageUtil<RimsDictionaries> getDictionaries(PageResVO page);
-
-
-    /**
-     * 多条件分页查询
-     * @param rimsDictionaries 字典对象用来承载搜索条件
-     * @param page 分页对象
-     * @return 符合搜索条件的字典集合
-     */
-    PageUtil<RimsDictionaries> getDictionariesByPage(RimsDictionaries rimsDictionaries, PageResVO page);
-
-
-    /**
-     * 字段查重
-     * @param rimsDictionaries 收集需要查重的字段参数
-     * @return 返回0表示字段没有重复,非零表示有重复
-     */
-    Integer getDictionaRepetitionCount(RimsDictionaries rimsDictionaries);
-
-
-    /**
-     * 添加记录
-     * @param rimsDictionaries 收集需要添加的字段参数
-     * @return 添加成功返回 1
-     */
-     Integer addDictionaries(RimsDictionaries rimsDictionaries);
-
-
-    /**
-     * 修改记录
-     * @param rimsDictionaries 收集需要添加的字段参数
-     * @return 修改成功返回 1
-     */
-    Integer updateDictionaries(RimsDictionaries rimsDictionaries);
-
-
-    /**
-     * 删除记录
-     * @param id 删除记录的id(有可能是父级id)
-     * @return 删除成功返回 1
-     */
-    Integer deleteDictionariesById(Long id);
-
-
-    /**
-     * 启用停用记录
-     * @param rimsDictionaries 字典对象里面包含要修改数据的id和启停值
-     * @return 修改成功返回 1
-     */
-    Integer updateDictionariesEnableById(RimsDictionaries rimsDictionaries);
-    /**
-     * 根据编码表dicCode,查询子节点列表
-     *
-     * @param dicCode
-     * @return
-     */
-    public List<RimsDictionaries> listDictionariesByDicCode(String dicCode);
-    /**
-     * 根据编码表父节点dicCode,节点dicCode查询节点名称
-     * @param pDicCode
-     * @param dicCode
-     * @return
-     */
-    public String getDictionariesNameByDicCode(String pDicCode,String dicCode);
-
-
-    /**
-     * 以名称为key ,code 为值返回map
-     * @param pDicCode
-     * @return
-     */
-    public Map<String,String> getReverseDicMapByDicCode(String pDicCode);
-
-
-}

+ 0 - 253
src/main/java/com/care/demo/service/impl/SystemDictionariesServiceImpl.java

@@ -1,253 +0,0 @@
-package com.care.demo.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.care.common.exception.BDException;
-import com.care.common.vo.PageResVO;
-import com.care.demo.entity.RimsDictionaries;
-import com.care.demo.mapper.RimsDictionariesMapper;
-import com.care.demo.service.SystemDictionariesService;
-import com.care.common.util.PageUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.*;
-
-
-/**
- * @author nhc
- * @version 1.0
- * @description 系统设置-字典管理模块-业务逻辑层接口实现类
- * @date 2021/02/08/19:41
- */
-@Service
-public class SystemDictionariesServiceImpl implements SystemDictionariesService {
-
-    @Resource
-    private RimsDictionariesMapper rimsDictionariesMapper;
-
-
-    /**
-     * 无条件分页查询
-     * 业务逻辑:
-     * 1、先通过传递过来的页面大小与查询到的总记录数算出总页数;
-     * 2、根据总页数限制当前页的范围不会越界
-     * 3、先查询一级字典集合,通过遍历id映射二级字典PID查询出的集合填充进对象
-     * 4、将补全完整的Page工具类携带所有搜索数据返回
-     * @param page 分页参数对象
-     * @return 返回携带数据的分页工具对象z
-     */
-    @Override
-    public PageUtil<RimsDictionaries> getDictionaries(PageResVO page) {
-        //1、创建一个分页工具对象(然后对分页数据进行整理)
-        PageUtil<RimsDictionaries> pageUtil = new PageUtil<>();
-        //2、更新当前页面大小
-        pageUtil.setPageSize(page.getPageSize());
-        //3、获取无条件查询总记录数
-        //因为只对一级记录进行分页,所以要查询的是所有一级记录的总记录数
-        QueryWrapper<RimsDictionaries> wrapper = new QueryWrapper<>();
-        //查询条件为 PID = 0 为一级目录
-        wrapper.lambda()
-                .eq(RimsDictionaries::getPid, 0);
-        pageUtil.setTotal(rimsDictionariesMapper.selectCount(wrapper));
-        //4、更新当前页码(此时页码将不会再发生越界问题)
-        pageUtil.setCurrent(page.getCurrent());
-        //一级字典分页集合
-        List<RimsDictionaries> dictionariesList1 = new ArrayList<>();
-        //添加查询条件查询 所有未被删除的字典数据
-        QueryWrapper<RimsDictionaries> dictionariesQueryWrapper = new QueryWrapper<>();
-        dictionariesQueryWrapper.lambda()
-                .eq(RimsDictionaries::getPid, 0)
-                .orderByAsc(RimsDictionaries::getEnable);
-        Page<RimsDictionaries> dictionariesPage = rimsDictionariesMapper.selectPage(
-                new Page<>(
-                        pageUtil.getCurrent(), pageUtil.getPageSize()),
-                dictionariesQueryWrapper);
-        List<RimsDictionaries> records = dictionariesPage.getRecords();
-        for (RimsDictionaries rimsDictionaries : records) {
-            //根据一级字典id获取所有二级字典对象集合
-            QueryWrapper<RimsDictionaries> wrapper2 = new QueryWrapper<>();
-            wrapper2.lambda()
-                    .eq(RimsDictionaries::getPid, rimsDictionaries.getId())
-                    .orderByAsc(RimsDictionaries::getEnable);
-            List<RimsDictionaries> rimsDictionariesList2 =
-                    rimsDictionariesMapper.selectList(wrapper2);
-            //将二级字典对象set进属性
-            rimsDictionaries.setRimsDictionariesList(rimsDictionariesList2);
-            //将一级分页对象set进一级字典分页对象集合
-            dictionariesList1.add(rimsDictionaries);
-        }
-        pageUtil.setListT(dictionariesList1);
-        return pageUtil;
-    }
-
-    /**
-     * 多条件分页查询
-     * @param rimsDictionaries 字典对象用来承载搜索条件
-     * @param page 分页对象
-     * @return 符合搜索条件的字典集合
-     */
-    @Override
-    public PageUtil<RimsDictionaries> getDictionariesByPage(RimsDictionaries rimsDictionaries, PageResVO page) {
-        //1、创建一个分页工具对象(然后对分页数据进行整理)
-        PageUtil<RimsDictionaries> pageUtil = new PageUtil<>();
-        //2、更新当前页面大小
-        pageUtil.setPageSize(page.getPageSize());
-        //3、获取多条件查询总记录数
-        pageUtil.setTotal(rimsDictionariesMapper.selectDictionariesByCount(rimsDictionaries));
-        //4、更新当前页码(此时页码将不会再发生越界问题)
-        pageUtil.setCurrent(page.getCurrent());
-        List<RimsDictionaries> dictionariesList = rimsDictionariesMapper.selectDictionariesByPage(rimsDictionaries, pageUtil);
-        pageUtil.setListT(dictionariesList);
-        return pageUtil;
-    }
-
-    /**
-     * 字段查重
-     * @param rimsDictionaries 收集需要查重的字段参数
-     * @return 返回0表示字段没有重复,非零表示有重复
-     */
-    @Override
-    public Integer getDictionaRepetitionCount(RimsDictionaries rimsDictionaries) {
-        return rimsDictionariesMapper.selectDictionaRepetitionCount(rimsDictionaries);
-    }
-
-    /**
-     * 添加记录
-     * @param rimsDictionaries 收集需要添加的字段参数
-     * @return 添加成功返回 1
-     */
-    @Override
-    public Integer addDictionaries(RimsDictionaries rimsDictionaries) {
-        return rimsDictionariesMapper.insert(rimsDictionaries);
-    }
-
-    /**
-     * 修改记录
-     * @param rimsDictionaries 收集需要添加的字段参数
-     * @return 修改成功返回 1
-     */
-    @Override
-    public Integer updateDictionaries(RimsDictionaries rimsDictionaries) {
-        return rimsDictionariesMapper.updateById(rimsDictionaries);
-    }
-
-    /**
-     * 删除记录
-     * @param id 删除记录的id(有可能是父级id)
-     * @return 删除成功返回 1
-     */
-    @Override
-    public Integer deleteDictionariesById(Long id) {
-        //先判定是否为父级id
-        RimsDictionaries rimsDictionaries = rimsDictionariesMapper.selectById(id);
-        if(rimsDictionaries == null){
-            return 0;
-        }
-        //若为父节点,则先删除所有子节点
-        if(0 == rimsDictionaries.getPid()){
-            QueryWrapper<RimsDictionaries> wrapper = new QueryWrapper<>();
-            wrapper.lambda().eq(RimsDictionaries::getPid,id);
-            rimsDictionariesMapper.delete(wrapper);
-        }
-        //最后删除当前节点
-        return rimsDictionariesMapper.deleteById(id);
-    }
-
-    /**
-     * 启用停用记录
-     * @param rimsDictionaries 字典对象里面包含要修改数据的id和启停值
-     * @return 修改成功返回 1
-     */
-    @Override
-    public Integer updateDictionariesEnableById(RimsDictionaries rimsDictionaries) {
-        //变更参数承载对象
-        RimsDictionaries rd = new RimsDictionaries();
-        //根据传入的启用停用值取反
-        rd.setEnable(rimsDictionaries.getEnable() == 0 ? 1 : 0);
-        //若修改的记录为一级目录,则先修改全部的子目录
-        if(rimsDictionaries.getPid() == 0){
-            //构建修改条件
-            UpdateWrapper<RimsDictionaries> wrapper = new UpdateWrapper<>();
-            wrapper.lambda().eq(RimsDictionaries::getPid,rimsDictionaries.getId());
-            rimsDictionariesMapper.update(rd, wrapper);
-        }
-        //最后修改当前节点
-        rd.setId(rimsDictionaries.getId());
-        return rimsDictionariesMapper.updateById(rd);
-    }
-    /**
-     * 根据编码表dicCode,查询子节点列表
-     *
-     * @param dicCode
-     * @return
-     */
-    @Override
-    public List<RimsDictionaries> listDictionariesByDicCode(String dicCode) {
-        if (StringUtils.isEmpty(dicCode)) {
-            throw new BDException("请指定要查询的父节点编码");
-        }
-        QueryWrapper<RimsDictionaries> queryWrapper = new QueryWrapper<>();
-        //查询未删除、启用的字典
-        queryWrapper.lambda().eq(RimsDictionaries::getDicCode, dicCode);
-        RimsDictionaries rimsDictionaries = rimsDictionariesMapper.selectOne(queryWrapper);
-        List<RimsDictionaries> rimsDictionariesList =null;
-        if(rimsDictionaries!=null){
-            QueryWrapper<RimsDictionaries> wrapper = new QueryWrapper<>();
-            wrapper.lambda().eq(RimsDictionaries::getPid, rimsDictionaries.getId())
-                    .eq(RimsDictionaries::getDeleted,0)
-                    .eq(RimsDictionaries::getEnable,0)
-                    .orderByAsc(RimsDictionaries::getDicSort);
-            rimsDictionariesList = rimsDictionariesMapper.selectList(wrapper);
-        }
-        return rimsDictionariesList;
-    }
-    /**
-     * 根据编码表父节点dicCode,节点dicCode查询节点名称
-     * @param pDicCode
-     * @param dicCode
-     * @return
-     */
-    @Override
-    public String getDictionariesNameByDicCode(String pDicCode,String dicCode) {
-        if (StringUtils.isEmpty(pDicCode)&&StringUtils.isEmpty(dicCode)) {
-            throw new BDException("请指定要查询的节点编码");
-        }
-        QueryWrapper<RimsDictionaries> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(RimsDictionaries::getDicCode, pDicCode);
-        RimsDictionaries pRimsDictionaries = rimsDictionariesMapper.selectOne(queryWrapper);
-        String dictionariesName = "";
-        if(pRimsDictionaries!=null){
-            QueryWrapper<RimsDictionaries> wrapper = new QueryWrapper<>();
-            wrapper.lambda().eq(RimsDictionaries::getPid, pRimsDictionaries.getId());
-            wrapper.lambda().eq(RimsDictionaries::getDicCode, dicCode);
-            RimsDictionaries rimsDictionaries = rimsDictionariesMapper.selectOne(wrapper);
-            if(rimsDictionaries!=null){
-                dictionariesName = rimsDictionaries.getDictionariesName();
-            }
-        }
-        return dictionariesName;
-    }
-
-    /**
-     * 以名称为key ,code 为值返回map
-     * @param pDicCode
-     * @return
-     */
-    @Override
-    public Map<String, String> getReverseDicMapByDicCode(String pDicCode) {
-        if(StringUtils.isBlank(pDicCode)){
-            return Collections.emptyMap();
-        }
-        List<RimsDictionaries> dics = listDictionariesByDicCode(pDicCode);
-        if(CollUtil.isEmpty(dics)){
-            return Collections.emptyMap();
-        }
-        Map<String,String> resultMap = new HashMap<>(16);
-        dics.forEach(dic ->resultMap.put(dic.getDictionariesName(),dic.getDicCode()));
-        return resultMap;
-    }
-}

+ 0 - 22
src/main/java/com/care/demo/vo/RimsNetworkAreaSelectResVO.java

@@ -1,22 +0,0 @@
-package com.care.demo.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-/**
- * @Author: lilt
- * @Date: 2021/1/7
- * @Desc:
- */
-@ApiModel(value = "网络区域下拉列表响应类", description = "网络区域下拉列表响应类")
-@Data
-public class RimsNetworkAreaSelectResVO {
-    @ApiModelProperty("唯一标识")
-    private Long id;
-    @ApiModelProperty("网络区域名称")
-    private String dicName;
-    @ApiModelProperty("网络区域编码")
-    private String dicCode;
-
-}

+ 14 - 10
src/main/java/com/care/outcall/controller/KoalaOutCallController.java

@@ -4,9 +4,7 @@ package com.care.outcall.controller;
 import cn.hutool.json.JSONUtil;
 import com.care.common.entity.CcCallResult;
 import com.care.common.service.CcCallResultService;
-import com.care.common.util.JsonUtil;
-import com.care.common.util.JwtUtils;
-import com.care.common.util.Result;
+import com.care.common.util.*;
 import com.care.common.vo.UserLogindConvertVO;
 import com.care.outcall.entity.CcKoalaLog;
 import com.care.outcall.service.KoalaOutCallService;
@@ -21,6 +19,7 @@ import org.apache.logging.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
 import java.util.Map;
 
@@ -70,16 +69,19 @@ public class KoalaOutCallController {
                 logger.debug(JsonUtil.toJson(ccKoalaLog));
             }
             koalaOutCallService.addOptLog(ccKoalaLog);
+            return Result.success();
         } catch (Exception e) {
             logger.error("记录日志接口异常,异常信息:" + e.getMessage());
+            return Result.error(e.getMessage());
         }
-        return Result.success();
+
     }
 
     @ApiOperation(value = "保存呼叫结果接口", notes = "保存呼叫结果接口")
     @PostMapping(value = "/koala/addCallResult", produces = "application/json;charset=UTF-8", consumes = "application/json;charset=UTF-8")
-    public Result addCallResult(@RequestBody CcCallResult ccCallResult) {
+    public Result<Object> addCallResult(HttpServletRequest request, @RequestBody CcCallResult ccCallResult) {
         try {
+            UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
             if (logger.isDebugEnabled()) {
                 logger.debug(JsonUtil.toJson(ccCallResult));
             }
@@ -88,24 +90,26 @@ public class KoalaOutCallController {
             ccKoalaLog.setOrgId(ccCallResult.getOrgId().toString());
             ccKoalaLog.setStationId(ccCallResult.getStationId().toString());
             ccKoalaLog.setHouseId(ccCallResult.getHouseId().toString());
-            ccKoalaLog.setOlderId(ccCallResult.getOlderId().toString());
+            //ccKoalaLog.setOlderId(ccCallResult.getOlderId().toString());
             ccKoalaLog.setOrderId(ccCallResult.getOrderId().toString());
             ccKoalaLog.setCalledId(ccCallResult.getCalledId().toString());
             ccKoalaLog.setCalledType(ccCallResult.getCalledType());
             ccKoalaLog.setPhone(ccCallResult.getPhone());
             String sessionId = koalaOutCallService.getSessionId(ccKoalaLog);
             if(sessionId == null){
-                throw new Exception("会话ID为空,不能保存");
+             //   throw new Exception("会话ID为空,不能保存");
             }
             ccCallResult.setSessionId(sessionId);
             Date now = new Date();
             ccCallResult.setCreateTime(now);
             ccCallResult.setUpdateTime(now);
-            ccCallResultService.saveCallResult(ccCallResult);
+            ccCallResultService.saveCallResult(ccCallResult,loginUser);
+            return Result.success();
         } catch (Exception e) {
-            logger.error("保存呼叫结果接口异常,异常信息:" + e.getMessage());
+            logger.error("保存呼叫结果接口异常,异常信息: {}",e);
+            return Result.error(e.getMessage());
         }
-        return Result.success();
+
     }
 
 

+ 1 - 1
src/main/resources/application.properties

@@ -56,6 +56,6 @@ spring.freemarker.template-loader-path=classpath:/template,classpath:/font
 wx.pinanbao.codeUrl=https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code
 wx.pinanbao.tokenUrl=https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}
 wx.pinanbao.appid=wxda02870032b8f928
-wx.pinanbao.secret=7cf405b453e3b99a491980e3abf901d9
+wx.pinanbao.secret=5984b6cf5dad4693eb60cbc494d9f385
 
 file.savePath=/data/rfcare-file

+ 2 - 2
src/main/resources/mybatis/BigSreenMapper.xml

@@ -247,7 +247,7 @@
           a.heart_rate,
           a.addr,
           a.phone,
-          (case when (select count(1) from care_device b where b.dev_type='2' and b.id in (select c.dev_id from care_older_device_rel c where c.older_id = a.id)) > 0 then 'Y' else 'N' end)  has_our_door_device,
+         <!-- (case when (select count(1) from care_device b where b.dev_type='2' and b.id in (select c.dev_id from care_older_device_rel c where c.older_id = a.id)) > 0 then 'Y' else 'N' end)  has_our_door_device,-->
           (select sdc.name from sys_dim_code sdc where sdc.dim_code = a.status and sdc.type_code='older_status') older_status,
           (select c.status from care_event_order c where c.older_id = a.id order by c.create_time desc limit 1) older_event_status,
            d.id contact_id,
@@ -344,7 +344,7 @@
         a.heart_rate,
         a.addr,
         a.phone,
-        (case when (select count(1) from care_device b where b.dev_type='2' and b.id in (select c.dev_id from care_older_device_rel c where c.older_id = a.id)) > 0 then 'Y' else 'N' end)  has_our_door_device,
+        <!--(case when (select count(1) from care_device b where b.dev_type='2' and b.id in (select c.dev_id from care_older_device_rel c where c.older_id = a.id)) > 0 then 'Y' else 'N' end)  has_our_door_device,-->
         (select sdc.name from sys_dim_code sdc where sdc.dim_code = a.status and sdc.type_code='older_status') olderStatus,
         (select c.status from care_event_order c where c.older_id = a.id order by c.create_time desc limit 1) olderEventStatus
         FROM care_older a

+ 8 - 1
src/main/resources/mybatis/CareDeviceMapper.xml

@@ -1,6 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.care.common.mapper.CareDeviceMapper">
-   
 
+    <select id="queryListByHouseId" resultType="com.care.common.vo.device.DeviceVO">
+        select
+            d.id as devId,
+            r.dev_alias_name as devAliasName
+        from care_device d
+                 left join care_house_device_rel r on r.dev_id = d.id
+        where r.house_id = #{houseId}
+    </select>
 </mapper>

+ 70 - 0
src/main/resources/mybatis/CareEventOrderMapper.xml

@@ -55,4 +55,74 @@
         </where>
     </select>
 
+    <select id="selectBigScreenStatistics" resultType="com.care.common.entity.CareEventOrder">
+        SELECT
+        sum(older_amount) olderAmount,
+        sum(older_60_80_amount) older6080Amount,
+        convert(sum(older_60_80_amount)/sum(older_amount),decimal(20,2)) older6080Rate,
+        sum(older_80_above_amount) older80AboveAmount,
+        convert(sum(older_80_above_amount)/sum(older_amount),decimal(20,2)) older80AboveRate,
+        sum(alone_living_amount) aloneLivingAmount,
+        convert(sum(alone_living_amount)/sum(older_amount),decimal(20,2)) aloneLivingRate,
+        sum(no_alone_living_amount) noAloneLivingAmount,
+        convert(sum(no_alone_living_amount)/sum(older_amount),decimal(20,2)) noAloneLivingRate,
+        sum(concentrate_living_amount) concentrateLivingAmount,
+        convert(sum(concentrate_living_amount)/sum(older_amount),decimal(20,2)) concentrateLivingRate,
+        sum(other_living_amount) otherLivingAmount,
+        convert(sum(other_living_amount)/sum(older_amount),decimal(20,2)) otherLivingRate,
+        sum(one_level_amount) oneLevelAmount,
+        sum(two_level_amount) twoLevelAmount,
+        sum(three_level_amount) threeLevelAmount,
+        sum(chamberlain_amount) chamberlainAmount,
+        convert(sum(older_amount)/sum(chamberlain_amount),decimal(20,2)) serveAmountAvg,
+        sum(serve_amount) serveAmount,
+        sum(device_amount) deviceAmount,
+        convert(sum(indoor_online_amount)/(sum(indoor_online_amount) + sum(indoor_offline_amount)),decimal(20,2)) indoorOnlineRate,
+        sum(indoor_online_amount) indoorOnlineAmount,
+        sum(indoor_offline_amount) indoorOfflineAmount,
+        convert(sum(outdoor_online_amount)/(sum(outdoor_online_amount) + sum(outdoor_offline_amount)),decimal(20,2)) outdoorOnlineRate,
+        sum(outdoor_online_amount) outdoorOnlineAmount,
+        sum(outdoor_offline_amount) outdoorOfflineAmount,
+        sum(rt_event_amount) rtEventAmount,
+        sum(rt_fall_amount) rtFallAmount,
+        sum(rt_stagnation_amount) rtStagnationAmount,
+        sum(rt_falling_bed_amount) rtFallingBedAmount,
+        sum(rt_active_call_amount) rtActiveCallAmount,
+        sum(rt_outdoors_call_amount) rtOutdoorsCallAmount,
+        sum(his_event_amount) hisEventAmount,
+        sum(his_fall_amount) hisFallAmount,
+        sum(his_stagnation_amount) hisStagnationAmount,
+        sum(his_falling_bed_amount) hisFallingBedAmount,
+        sum(his_active_call_amount) hisActiveCallAmount,
+        sum(his_outdoors_call_amount) hisOutdoorsCallAmount,
+        sum(seats_amount) seatsAmount,
+        convert(sum(seats_online_duration)/3600,decimal(20,2)) seatsOnlineDuration
+        FROM st_station t
+        <where>
+            1 = 1
+            <if test="stationId != null and stationId != ''">
+                AND t.station_id = #{stationId}
+            </if>
+            <if test="orgId != null and orgId != ''">
+                AND t.org_id = #{orgId}
+            </if>
+        </where>
+    </select>
+
+    <select id="statOrder" resultType="com.care.common.vo.event.EventStaVO">
+        select
+            count(1) as allCount,
+            count(if(status='0',1,null)) as notDoCount,
+            count(if(status='1',1,null)) as doingCount,
+            count(if(status='2',1,null))+count(if(status='3',1,null))+count(if(status='4',1,null)) as doneCount
+        from care_event_order
+        <where>
+            <if test="orgId != null ">
+                AND org_id = #{orgId}
+            </if>
+            <if test="stationId != null ">
+                AND station_id = #{stationId}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 0 - 44
src/main/resources/mybatis/RimsDictionariesMapper.xml

@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.care.demo.mapper.RimsDictionariesMapper">
-
-    <!--多条件分页查询-->
-    <select id="selectDictionariesByPage" resultType="com.care.demo.entity.RimsDictionaries">
-        SELECT * FROM RIMS_DICTIONARIES
-        <where>
-            <!--逻辑删除过滤-->
-            DELETED = 0
-            <!--字典名称模糊搜索-->
-            <if test="dictionaries.dictionariesName != null">
-                and DICTIONARIES_NAME like concat('%', #{dictionaries.dictionariesName}, '%')
-            </if>
-        </where>
-        ORDER BY ENABLE, MODIFY_TIME desc
-        LIMIT #{pageUtil.start}, #{pageUtil.pageSize}
-    </select>
-
-    <!--多条件查询总记录数-->
-    <select id="selectDictionariesByCount" resultType="int" >
-        SELECT count(1) FROM RIMS_DICTIONARIES
-        <where>
-            <!--逻辑删除过滤-->
-            DELETED = 0
-            <!--字典名称模糊搜索-->
-            <if test="dictionariesName != null">
-                and DICTIONARIES_NAME like concat('%', #{dictionariesName}, '%')
-            </if>
-        </where>
-    </select>
-
-    <!--字段查重-->
-    <select id="selectDictionaRepetitionCount" parameterType="com.care.demo.entity.RimsDictionaries"
-            resultType="java.lang.Integer">
-        SELECT COUNT(1) FROM RIMS_DICTIONARIES
-        where DELETED = 0 and DIC_CODE = #{dicCode}
-        <!--如果 id 不为空则代表是修改操作的查重-->
-        <if test="id != null">
-            and ID != #{id}
-        </if>
-    </select>
-
-</mapper>

+ 1 - 1
src/main/resources/mybatis/StStationMapper.xml

@@ -17,7 +17,7 @@
         (select count(1) from care_older a where a.station_id = t.id and a.safe_level = '1') oneLevelAmount,
         (select count(1) from care_older a where a.station_id = t.id and a.safe_level = '1') twoLevelAmount,
         (select count(1) from care_older a where a.station_id = t.id and a.safe_level = '1') threeLevelAmount,
-        (select count(distinct chamberlain_id) from care_chamberlain_older_rel b where b.older_id in (select a.id from care_older a where a.station_id = t.id ) ) chamberlainAmount,
+        (select count(1) from care_sys_user b where b.role = 'chanmb' ) chamberlainAmount,
         (select count(1) from care_event_order c where c.station_id = t.id ) serveAmount,
         (select count(1) from care_event_order c where c.station_id = t.id and c.create_time >= CURDATE()) serveTodayAmount,
         (select count(1) from care_device d where d.station_id = t.id ) deviceAmount,