Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 5 years ago
parent
commit
28d6944073
20 changed files with 245 additions and 91 deletions
  1. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyAppDO.java
  2. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  3. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java
  4. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java
  5. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  6. 9 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java
  7. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/IotDeviceDictController.java
  8. 6 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceAuditController.java
  9. 26 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
  10. 7 3
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java
  11. 6 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java
  12. 3 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotPatientDeviceDao.java
  13. 83 63
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  14. 1 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceInventoryService.java
  15. 22 5
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java
  16. 9 7
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java
  17. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  18. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceAuditService.java
  19. 44 6
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotShareInterfaceService.java
  20. 1 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyAppDO.java

@ -25,6 +25,8 @@ public class IotCompanyAppDO extends UuidIdentityEntityWithOperator implements S
    private String companyName;//公司名称
    @Column(name = "address_ip")
    private String addressIp;//访问IP地址
    @Column(name = "status")
    private String status;//转态: 1:生效  0:为生效
    @Column(name = "del")
    private String del;//是否删除 0:删除  1:不删除
@ -66,4 +68,12 @@ public class IotCompanyAppDO extends UuidIdentityEntityWithOperator implements S
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
}

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -395,6 +395,7 @@ public class IotRequestMapping {
        public static final String delAppInterface ="delAppInterface";
        public static final String interfaceDoc ="interfaceDoc";
        public static final String addApp ="addApp";
        public static final String findCompanyShareInterface ="findCompanyShareInterface";
        public static final String message_success_add = "add success";
        public static final String message_success_edit = "edit success";

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java

@ -66,6 +66,8 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    private String accountType;
    @ApiModelProperty("应用")
    private List<IotCompanyAppVO> appList;
    @ApiModelProperty("审核不通过信息说明")
    private String auditMessage;
    public String getStatus() {
        return status;
@ -250,4 +252,12 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    public void setAppList(List<IotCompanyAppVO> appList) {
        this.appList = appList;
    }
    public String getAuditMessage() {
        return auditMessage;
    }
    public void setAuditMessage(String auditMessage) {
        this.auditMessage = auditMessage;
    }
}

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java

@ -142,6 +142,7 @@ public class FileUploadController extends EnvelopRestEndpoint {
        if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
            uploadVO.setFileName(file.getOriginalFilename());
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -632,7 +632,7 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
                "  user.id as id, " +
                "  user.name as realName, " +
                "  user.username as username, " +
                "  case user.locked when 0 then '已失效' when 1 then '生效中' end status, " +
                "  case user.enabled when 0 then '已失效' when 1 then '生效中' end status, " +
                "  user.mobile, " +
                "  saas.name as saasName, " +
                "  role.name as roleName " +

+ 9 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java

@ -193,11 +193,19 @@ public class IotDeviceController extends EnvelopRestEndpoint {
            if (size == null) {
                size = 10;
            }
            if (isBinding == null) {
                return iotDeviceService.queryPage(sn, hospital, hospitalName, orderId, purcharseId, productId, name, categoryCode, manufacturerId, page, size);
            } else {
                return iotDeviceService.queryPage(sn, hospital, orderId, purcharseId, isBinding, page, size);
    
                if(isBinding == 3){//去重取设备名称
                    return iotDeviceService.findDevice(page,size);
                }else{
                    return iotDeviceService.queryPage(sn, hospital, orderId, purcharseId, isBinding, page, size);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/IotDeviceDictController.java

@ -41,8 +41,8 @@ public class IotDeviceDictController extends EnvelopRestEndpoint {
        List<IotDeviceDictDO> list = iotDeviceDictService.search(fields,filters,sorts);
        //封装返回格式
        List<IotDeviceDictDO> iotDeviceDicts = convertToModels(list, new ArrayList<>(list.size()), IotDeviceDictDO.class, fields);
        Map<String,List<IotDeviceDictDO>> map = iotDeviceDicts.stream().collect(Collectors.groupingBy(IotDeviceDictDO :: getDeviceType));
        return MixEnvelop.getSuccess(IotRequestMapping.DeviceDict.message_success_find_functions,map);
//        Map<String,List<IotDeviceDictDO>> map = iotDeviceDicts.stream().collect(Collectors.groupingBy(IotDeviceDictDO :: getDeviceType));
        return MixEnvelop.getSuccess(IotRequestMapping.DeviceDict.message_success_find_functions,iotDeviceDicts);
    }
    @PostMapping(value = IotRequestMapping.DeviceDict.api_create)

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceAuditController.java

@ -153,6 +153,12 @@ public class IotInterfaceAuditController extends EnvelopRestEndpoint {
                                                                                    @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotInterfaceAuditService.queryCompanyAppPage(page,size);
        } catch (Exception e) {
            e.printStackTrace();

+ 26 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -157,6 +157,30 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.Platform.findCompanyShareInterface)
    @ApiOperation(value = "查询企业下的共享接口",notes = "查询企业下的共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> findCompanyShareInterface(
                                                                                  @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                                  @RequestParam(value = "page", required = false) Integer page,
                                                                                  @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                                  @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotShareInterfaceService.findCompanyShareInterface(page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Platform.findAllLog)
@ -376,4 +400,6 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
}

+ 7 - 3
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java

@ -22,10 +22,14 @@ public interface IotCompanyAppDao extends PagingAndSortingRepository<IotCompanyA
        @Query("from IotCompanyAppDO w where w.id =?1 and w.del=1")
        IotCompanyAppDO findById(String appId);
        @Query("from IotCompanyAppDO w where w.companyId =?1 and w.del=0")
        List<IotCompanyAppDO> findByCompanyIdAndDel(String companyId);
        @Query("from IotCompanyAppDO w where w.companyId =?1 and w.status=0 and w.del=1")
        List<IotCompanyAppDO> findByCompanyIdAndStatus(String companyId);
        @Query("from IotCompanyAppDO w where w.del=0")
        @Query("from IotCompanyAppDO w where w.del=1")
        List<IotCompanyAppDO> findAllByDel();
        @Query("from IotCompanyAppDO w where w.name=?1 and w.del=1")
        IotCompanyAppDO findByName(String name);
        }

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java

@ -36,4 +36,10 @@ public interface IotCompanyDao extends PagingAndSortingRepository<IotCompanyDO,
    @Query("from IotCompanyDO w where w.ehrUserId =?1 and w.del=1")
    IotCompanyDO findByEhrUserId(String uid);
    @Query("from IotCompanyDO w where w.businessLicense =?1 and w.accountType=?2 and w.del=1 and (w.status=1 or w.status=0 )")
    IotCompanyDO findByBusinessLicenseAndAccountType(String businessLicense,String accountType);
    @Query("from IotCompanyDO w where w.name =?1 and w.accountType=?2 and w.id<>?3 and w.del=1")
    IotCompanyDO findByNameAndAccountTypeAndId(String name,String accountType,String id);
}

+ 3 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotPatientDeviceDao.java

@ -51,4 +51,7 @@ public interface IotPatientDeviceDao extends PagingAndSortingRepository<IotPatie
    @Modifying
    @Query("update IotPatientDeviceDO t set t.del = ?2 where t.id = ?1")
    void updateDelById(String id, int del);
    @Query("from IotPatientDeviceDO a where a.deviceSn = ?1 ")
    List<IotPatientDeviceDO> findAllByDeviceSn(String deviceSn);
}

+ 83 - 63
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -144,10 +144,19 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        //DO转VO
        List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
//        //DO转VO
//        List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
        ArrayList<IotCompanyVO> listVO = new ArrayList<>();
        list.forEach(one->{
            IotCompanyVO companyVO = convertToModelVO(one);
            listVO.add(companyVO);
        });
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,listVO, page, size,count);
    }
    /**
@ -462,16 +471,27 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                //1、判断企业名称是否已经注册
                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                    //判断营业执照号是否被注册
                    if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
                            (iotCompanyDO.getStatus().equalsIgnoreCase("1") || iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                    }
                    if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())&&(!iotCompany.getId().equalsIgnoreCase(iotCompanyDO.getId()))){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                    }
//                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
//                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
//                    //判断营业执照号是否被注册
//                    if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
//                            (iotCompanyDO.getStatus().equalsIgnoreCase("1") || iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
//                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
//                    }
//                    if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())&&(!iotCompany.getId().equalsIgnoreCase(iotCompanyDO.getId()))){
//                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
//                    }
//                }
                IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
                if (businessLicense!=null){
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                IotCompanyDO name = iotCompanyDao.findByNameAndAccountTypeAndId(iotCompany.getName(), iotCompany.getAccountType(), iotCompany.getId());
                if (name!=null){
                    return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                }
@ -500,20 +520,16 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            //平台
            if (iotCompany.getAccountType().equalsIgnoreCase("0")) {
                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
                IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0);
                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                    //判断营业执照号是否被注册
                    if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
                            (iotCompanyDO.getStatus().equalsIgnoreCase("1")||iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                    }
                    if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())&&(!iotCompany.getId().equalsIgnoreCase(iotCompanyDO.getId()))){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                    }
                IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
                if (businessLicense!=null){
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                IotCompanyDO name = iotCompanyDao.findByNameAndAccountTypeAndId(iotCompany.getName(), iotCompany.getAccountType(), iotCompany.getId());
                if (name!=null){
                    return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                }
                List<IotCompanyAppDO> apps = iotCompanyAppDao.findAllByDel();
@ -521,11 +537,12 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                for (IotCompanyAppDO appDO : apps) {
                    if(companyAppDO.getName().equalsIgnoreCase(appDO.getName())&&(!appDO.getId().equalsIgnoreCase(companyAppDO.getId()))){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                        return MixEnvelop.getError("该应用名称已被注册,请使用其他企业");
                    }
                    if (appDO.getId().equalsIgnoreCase(companyAppDO.getId())) {
                        appDO.setDel("0");
                        appDO.setStatus("0");
                        appDO.setCompanyName(iotCompany.getName());
                        appDO.setCompanyId(iotCompany.getId());
                        appDO.setName(companyAppDO.getName());
@ -542,27 +559,23 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        IotCompanyDO companyDO = null;
        //id为空,新增企业
        if (StringUtils.isEmpty(iotCompany.getId())) {
            companyDO= iotCompanyDao.save(iotCompany);
            //厂商
            if (companyDO.getAccountType().equalsIgnoreCase("1")) {
            if (iotCompany.getAccountType().equalsIgnoreCase("1")) {
                IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
                if (businessLicense!=null){
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                //1、判断企业名称是否已经注册
                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(companyDO.getAccountType());
                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                    //判断营业执照号是否被注册
                    if (companyDO.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
                            (iotCompanyDO.getStatus().equalsIgnoreCase("1") || iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                    }
                    if(companyDO.getName().equalsIgnoreCase(iotCompanyDO.getName())){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                    }
                IotCompanyDO name = iotCompanyDao.findByNameAndAccountType(iotCompany.getName(), iotCompany.getAccountType());
                if (name!=null){
                    return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                }
                List<IotCompanyTypeDO> list = companyDO.getTypeList();
                String id = companyDO.getId();
                List<IotCompanyTypeDO> list = iotCompany.getTypeList();
                iotCompany= iotCompanyDao.save(iotCompany);
                String id = iotCompany.getId();
                //新增类型
                List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
                list.forEach(one->{
@ -578,37 +591,43 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            }
            //平台
            if (companyDO.getAccountType().equalsIgnoreCase("0")) {
                List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(companyDO.getAccountType());
            if (iotCompany.getAccountType().equalsIgnoreCase("0")) {
                IotCompanyAppDO companyAppDO = companyDO.getAppList().get(0);
                IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0);
                for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                    //判断营业执照号是否被注册
                    if (companyDO.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) &&
                            (iotCompanyDO.getStatus().equalsIgnoreCase("1")||iotCompanyDO.getStatus().equalsIgnoreCase("0"))) {
                        return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                    }
                    if(companyDO.getName().equalsIgnoreCase(iotCompanyDO.getName())){
                        return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                    }
                IotCompanyDO businessLicense = iotCompanyDao.findByBusinessLicenseAndAccountType(iotCompany.getBusinessLicense(), iotCompany.getAccountType());
                if (businessLicense!=null){
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                IotCompanyDO name = iotCompanyDao.findByNameAndAccountType(iotCompany.getName(), iotCompany.getAccountType());
                if (name!=null){
                    return MixEnvelop.getError("该企业名称已被注册,请使用其他企业");
                }
                List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAllByDel();
                for (IotCompanyAppDO one : appDOList) {
                    if (one.getName().equalsIgnoreCase(companyAppDO.getName())){
                        return MixEnvelop.getError("该应用已注册,请使用其他应用");
                    }
//                List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAllByDel();
//                for (IotCompanyAppDO one : appDOList) {
//                    if (one.getName().equalsIgnoreCase(companyAppDO.getName())){
//                        return MixEnvelop.getError("该应用已注册,请使用其他应用");
//                    }
//                }
                IotCompanyAppDO appDaoByName = iotCompanyAppDao.findByName(companyAppDO.getName());
                if (appDaoByName!=null){
                    return MixEnvelop.getError("该应用已注册,请使用其他应用");
                }
                //保存应用
                companyDO= iotCompanyDao.save(iotCompany);
                IotCompanyAppDO iotCompanyAppDO = new IotCompanyAppDO();
                iotCompanyAppDO.setSaasId(getCode());
                iotCompanyAppDO.setCompanyId(companyDO.getId());
                iotCompanyAppDO.setCompanyName(companyDO.getName());
                iotCompanyAppDO.setName(companyAppDO.getName());
                iotCompanyAppDO.setAddressIp(companyAppDO.getAddressIp());
                iotCompanyAppDO.setDel("0");
                iotCompanyAppDO.setDel("1");
                //新增应用 先设置应用无效  审核通过后更改为有效
                iotCompanyAppDO.setStatus("0");
                iotCompanyAppDao.save(iotCompanyAppDO);
            }
        }
@ -622,7 +641,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        companyDO.setEhrUserId(userAgent.getUID());
        iotCompanyDao.save(companyDO);
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, convertToModelVO(iotCompany));
        return MixEnvelop.getSuccess("注册成功", convertToModelVO(iotCompany));
    }
@ -658,6 +677,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        appDO.setCompanyName(iotCompany.getName());
        appDO.setDel("1");
        appDO.setSaasId(getCode());
        appDO.setStatus("1");
        iotCompanyAppDao.save(appDO);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_create);
    }
@ -954,9 +974,9 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        //审核通过 设置平台应用为有效
        if (companyDO.getAccountType().equalsIgnoreCase("0")){
            List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyIdAndDel(id);
            List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyIdAndStatus(id);
            appDOList.forEach(one->{
                one.setDel("1");
                one.setStatus("1");
                iotCompanyAppDao.save(one);
            });
        }
@ -965,7 +985,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        //根据注册类型配置相应角色菜单,注册类型(1:厂商注册  0:平台注册)
        String roleId = "";
        if(companyDO.getAccountType().equals("0")){
            roleId = "paltform";
            roleId = "platform";
        }else if(companyDO.getAccountType().equals("1")){
            roleId = "company";
        }

+ 1 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceInventoryService.java

@ -139,6 +139,7 @@ public class IotDeviceInventoryService extends BaseJpaService<IotDeviceInventory
                }
                deviceDO.setDel(1);
                deviceDO.setStatus("1");
                deviceDO.setIsGrant(0);
                deviceDO.setInventoryLogId(deviceInventoryLogDO.getId());
                deviceDO.setCreateTime(new Date());
                deviceDO.setUpdateTime(new Date());

+ 22 - 5
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java

@ -179,11 +179,11 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        deviceDO.setSimNo(sim);
        iotDeviceDao.save(deviceDO);
        //修改SIM卡管理列表
        IotDeviceSimDO simDO = iotDeviceSimDao.findBySim(sim);
        simDO.setDeviceSn(deviceDO.getDeviceSn());
        simDO.setDeviceName(deviceDO.getName());
        simDO.setDel("0");
        iotDeviceSimDao.save(simDO);
//        IotDeviceSimDO simDO = iotDeviceSimDao.findBySim(sim);
//        simDO.setDeviceSn(deviceDO.getDeviceSn());
//        simDO.setDeviceName(deviceDO.getName());
//        simDO.setDel("0");
//        iotDeviceSimDao.save(simDO);
        return Envelop.getSuccess("修改成功");
    }
@ -332,6 +332,23 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotDeviceVOList, page, size,count);
    }
    /**
     *
     * @return
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findDevice(Integer page, Integer size) {
        String sql ="SELECT DISTINCT c.* from iot_device c left join iot_patient_device t on t.del = 1 AND c.device_sn = t.device_sn  WHERE c.del=1 GROUP BY c.`name`";
        List<IotDeviceDO> list = jdbcTempalte.query(sql,new BeanPropertyRowMapper(IotDeviceDO.class));
        //DO转VO
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list,new ArrayList<>(list.size()),IotDeviceVO.class);
        translateDictForList(iotDeviceVOList);
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotDeviceVOList, page, size,count);
    }
    /**
     * 根据设备序列号判断设备是否存在
     * @param deviceSn

+ 9 - 7
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java

@ -124,14 +124,16 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> conditionQueryPage(Integer page, Integer size, String status, String sim, String sn){
//        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_sim c WHERE del=0 ");
        StringBuffer sql = new StringBuffer("SELECT c.*,d.patient_name,d.mobile,w.device_sn sn,w.name   FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim" +
                " LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
        StringBuffer sqlCount = new StringBuffer("SELECT  COUNT(c.id) count  FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim " +
                "LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
        StringBuffer sql = new StringBuffer("SELECT c.* FROM " +
                " (SELECT c.*,d.patient_name,d.mobile,w.device_sn sn,w.name   FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no) c" +
                " WHERE  c.del=0 ");
        StringBuffer sqlCount = new StringBuffer("SELECT  COUNT(c.id) count FROM " +
                " (SELECT c.*,d.patient_name,d.mobile,w.device_sn sn,w.name   FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no) c" +
                " WHERE  c.del=0 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=").append(status);
            sqlCount.append("and c.status='").append(status).append("' ");
            sqlCount.append(" and c.status='").append(status).append("' ");
            args.add(status);
        }
        if(StringUtils.isNotBlank(sim)){
@ -142,7 +144,7 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
            sql.append(" and (c.device_sn like '%").append(sn).append("%')");
            sqlCount.append(" and (c.device_sn like '%").append(sn).append("%')");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        sql.append(" order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
//        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql.toString());
@ -212,7 +214,7 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
        sim.setTime(time);
        iotSystemDictDao.save(sim);
        //触发JOB工程
        httpClientUtil.get(jobUrl,"UTF-8");
//        httpClientUtil.get(jobUrl,"UTF-8");
    }

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -368,7 +368,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
     * @return
     */
    public List<IotPatientDeviceVO> getDeviceInfoByDeviceSn(String deviceSn) {
        String sql = "SELECT p.id,p.device_sn,p.device_id,p.device_name, GROUP_CONCAT(p.patient_name) as patientName,p.idcard,p.mobile,d.manufacturer_id, c.`name` manufacturerName,c.contacts_name, c.contacts_mobile " +
        String sql = "SELECT p.id,p.device_sn,p.device_id,p.device_name, GROUP_CONCAT(p.patient_name) as patientName,p.idcard,p.mobile,p.status,d.manufacturer_id, c.`name` manufacturerName,c.contacts_name, c.contacts_mobile " +
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "where p.device_sn = '" + deviceSn + "' and p.del =  1 and p.device_id= d.id GROUP BY p.device_sn ";
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
@ -412,7 +412,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
    }
    public void deleteRepairDevice(String deviceSn) {
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findByDeviceSn(deviceSn);
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findAllByDeviceSn(deviceSn);
        for(IotPatientDeviceDO patientDeviceDO : patientDeviceDOList){
            patientDeviceDO.setStatus(0);
            patientDeviceDO.setUpdateTime(new Date());

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceAuditService.java

@ -233,7 +233,7 @@ public class IotInterfaceAuditService  extends BaseJpaService<IotInterfaceAuditD
        IotCompanyDO account = iotCompanyDao.findByEhrUserId(userAgent.getUID());
        StringBuffer sql = new StringBuffer("SELECT DISTINCT * from iot_interface_audit ");
        sql.append("WHERE company_name = '").append(account.getName()).append("'");
        sql.append("WHERE company_id = '").append(account.getId()).append("'");
        sql.append(" order by time desc  limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceAuditDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotInterfaceAuditDO.class));

+ 44 - 6
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotShareInterfaceService.java

@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.company.IotCompanyDao;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.dao.platform.IotShareInterfaceDao;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -46,6 +49,8 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    @Autowired
    private UserAgent userAgent;
    /**
     * 增加接口
     * @param jsonData
@ -179,16 +184,19 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
        List<IotCompanyAppDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotCompanyAppDO.class));
        ArrayList<IotCompanyAppVO> resultList = new ArrayList<>();
        list.forEach(one->{
        
        for (IotCompanyAppDO iotCompanyAppDO : list){
            IotCompanyAppVO target = new IotCompanyAppVO();
            BeanUtils.copyProperties(one,target);
            IotCompanyDO companyDO = iotCompanyDao.findById(one.getCompanyId());
            BeanUtils.copyProperties(iotCompanyAppDO,target);
            IotCompanyDO companyDO = iotCompanyDao.findById(iotCompanyAppDO.getCompanyId());
            if(companyDO == null){
                continue;
            }
            target.setContactsMobile(companyDO.getContactsMobile());
            target.setContactsName(companyDO.getContactsName());
            target.setId(one.getId());
            target.setId(iotCompanyAppDO.getId());
            resultList.add(target);
        });
        }
        long count =list.size();
@ -196,4 +204,34 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
    }
    /**
     * 查询企业下的共享接口
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotShareInterfaceDO, IotShareInterfaceDO> findCompanyShareInterface(Integer page, Integer size) {
        IotCompanyDO account = iotCompanyDao.findByEhrUserId(userAgent.getUID());
        StringBuffer sql = new StringBuffer("SELECT DISTINCT * from iot_company_app_interface ");
        sql.append("WHERE company_id = '").append(account.getId()).append("'");
        sql.append(" order by update_time desc  limit ").append((page-1)*size).append(",").append(size);
        List<IotCompanyAppInterfaceDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotCompanyAppInterfaceDO.class));
        List<IotShareInterfaceDO> interfaceDOS = new ArrayList<>();
        list.forEach(one->{
            IotShareInterfaceDO shareInterfaceDO = iotShareInterfaceDao.findById(one.getShareInterfaceId());
            interfaceDOS.add(shareInterfaceDO);
        });
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,interfaceDOS,page, size,count);
    }
}

+ 1 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java

@ -143,4 +143,5 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,list, page, size,count);
    }
}