Browse Source

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

wangzhinan 5 years ago
parent
commit
ea9c7402f0
19 changed files with 401 additions and 84 deletions
  1. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyAppDO.java
  2. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyTypeDO.java
  3. 3 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  4. 44 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyAppVO.java
  5. 48 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotAppInterfacesVO.java
  6. 0 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java
  7. 59 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
  8. 0 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java
  9. 2 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java
  10. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyTypeDao.java
  11. 1 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotCompanyAppInterfaceDao.java
  12. 109 62
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  13. 8 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java
  14. 0 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java
  15. 4 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java
  16. 22 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotCompanyAppInterfaceService.java
  17. 4 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceAuditService.java
  18. 20 7
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceLogService.java
  19. 63 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotShareInterfaceService.java

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyAppDO.java

@ -22,11 +22,12 @@ public class IotCompanyAppDO extends UuidIdentityEntityWithOperator implements S
    @Column(name = "company_id")
    private String companyId;//公司ID
    @Column(name = "company_name")
    private String companyName;
    private String companyName;//公司名称
    @Column(name = "address_ip")
    private String addressIp;//访问IP地址
    @Column(name = "del")
    private String del;//是否删除 0:删除  1:不删除
    public IotCompanyAppDO() {
    }
    public String getSaasId() {

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyTypeDO.java

@ -24,6 +24,9 @@ public class IotCompanyTypeDO extends UuidIdentityEntityWithOperator implements
    @Column(name = "type_name")
    private String typeName;//企业类型名称
    @Column(name = "del")
    private String del;//删除标识 1:删除 0:不删除',
    public String getSaasId() {
        return saasId;
    }
@ -55,4 +58,12 @@ public class IotCompanyTypeDO extends UuidIdentityEntityWithOperator implements
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

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

@ -376,6 +376,7 @@ public class IotRequestMapping {
        public static final String editInterface ="editInterface";
        public static final String findInterfaceById ="findInterfaceById";
        public static final String findAll ="findAll";
        public static final String findAllApp ="findAllApp";
        public static final String findAllLog ="findAllLog";
        public static final String findInterfaceLog ="findInterfaceLog";
        public static final String conditionQueryPage ="conditionQueryPage";
@ -386,6 +387,8 @@ public class IotRequestMapping {
        public static final String delCompanyById ="delCompanyById";
        public static final String allotInterface ="allotInterface";
        public static final String findAppInterface ="findAppInterface";
        public static final String delAppInterface ="delAppInterface";
        public static final String interfaceDoc ="interfaceDoc";
        public static final String message_success_add = "add success";
        public static final String message_success_edit = "edit success";

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

@ -21,6 +21,18 @@ public class IotCompanyAppVO implements Serializable {
    @ApiModelProperty("访问IP地址")
    private String addressIp;
    @ApiModelProperty("公司名称")
    private String companyName;
    @ApiModelProperty("公司ID")
    private String companyId;
    @ApiModelProperty("联系人电话")
    private String contactsMobile;
    @ApiModelProperty("联系人姓名")
    private String contactsName;
    public String getName() {
        return name;
    }
@ -44,4 +56,36 @@ public class IotCompanyAppVO implements Serializable {
    public void setId(String id) {
        this.id = id;
    }
    public String getCompanyName() {
        return companyName;
    }
    public String getCompanyId() {
        return companyId;
    }
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
    public String getContactsMobile() {
        return contactsMobile;
    }
    public void setContactsMobile(String contactsMobile) {
        this.contactsMobile = contactsMobile;
    }
    public String getContactsName() {
        return contactsName;
    }
    public void setContactsName(String contactsName) {
        this.contactsName = contactsName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
}

+ 48 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotAppInterfacesVO.java

@ -18,9 +18,22 @@ import java.io.Serializable;
@ApiModel(value = "应用接口集合信息", description = "应用接口集合信息")
public class IotAppInterfacesVO  extends BaseVO implements Serializable {
    @ApiModelProperty("id")
    private String id;
    @ApiModelProperty("应用id")
    private String appId;
    @ApiModelProperty("应用名称")
    private String appName;
    @ApiModelProperty("公司名称")
    private String companyName;
    @ApiModelProperty("公司ID")
    private String companyId;
    @ApiModelProperty("共享接口信息")
    private IotShareInterfaceDO iotShareInterfaceDO;
@ -39,4 +52,39 @@ public class IotAppInterfacesVO  extends BaseVO implements Serializable {
    public void setIotShareInterfaceDO(IotShareInterfaceDO iotShareInterfaceDO) {
        this.iotShareInterfaceDO = iotShareInterfaceDO;
    }
    @Override
    public String getId() {
        return id;
    }
    @Override
    public void setId(String id) {
        this.id = id;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getCompanyId() {
        return companyId;
    }
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
}

+ 0 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -349,5 +349,4 @@ public class IotCompanyController extends EnvelopRestEndpoint {
        }
    }
}

+ 59 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -18,7 +18,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @author HZY
@ -89,7 +89,7 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.Platform.findAll)
    @ApiOperation(value = "分页查询所有",notes = "分页查询所有")
    @ApiOperation(value = "分页查询所有共享接口",notes = "分页查询所有共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> findAll(@ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                           @RequestParam(value = "page", required = false) Integer page,
                                                                       @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
@ -266,6 +266,24 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.Platform.delAppInterface)
    @ApiOperation(value = "删除应用接口", notes = "删除应用接口")
    public MixEnvelop<IotCompanyAppInterfaceDO, IotCompanyAppInterfaceDO> delAppInterface(@ApiParam(name = "id", value = "id", defaultValue = "")
                                                                                         @RequestParam(value = "id", required = true)String id) {
        try {
            return iotCompanyAppInterfaceService.delAppInterface(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.findAppInterface)
    @ApiOperation(value = "查看应用接口", notes = "查看应用接口")
    public MixEnvelop<IotAppInterfacesVO, IotAppInterfacesVO> findAppInterface(@ApiParam(name = "appId", value = "应用id", defaultValue = "")
@ -306,4 +324,43 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = IotRequestMapping.Platform.findAllApp)
    @ApiOperation(value = "分页查询应用信息", notes = "分页查询应用信息")
    public MixEnvelop<IotAppInterfacesVO, IotAppInterfacesVO> findAllApp(@ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                             @RequestParam(value = "page", required = false) Integer page,
                                                                             @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                             @RequestParam(value = "size", required = false) Integer size,
                                                                             @ApiParam(name = "name", value = "应用名称或公司名称", defaultValue = "")
                                                                             @RequestParam(value = "name",required = false) String name) {
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, iotShareInterfaceService.findAllApp(page,size,name));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Platform.interfaceDoc)
    @ApiOperation(value = "接口文档说明", notes = "接口文档说明")
    public MixEnvelop interfaceDoc( @ApiParam(name = "interfaceName", value = "接口名称", defaultValue = "")
                                        @RequestParam(value = "interfaceName") String interfaceName){
       String url =  iotShareInterfaceService.interfaceDoc(interfaceName);
       return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,url);
    }
}

+ 0 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java

@ -23,5 +23,4 @@ public interface IotCompanyAppDao extends PagingAndSortingRepository<IotCompanyA
        IotCompanyAppDO findById(String appId);
        }

+ 2 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java

@ -23,9 +23,10 @@ public interface IotCompanyDao extends PagingAndSortingRepository<IotCompanyDO,
    @Query("from IotCompanyDO w where w.accountType =?1 and w.del=1")
    List<IotCompanyDO> findByAccountType(String accountType);
    @Query("from IotCompanyDO w where w.enterType =?1 and w.status=1 and w.del=1")
    @Query("from IotCompanyDO w where w.enterType =?1 and w.del=1")
    List<IotCompanyDO> findByEnterType(String entryType);
    @Query("from IotCompanyDO w where w.account =?1 and w.del=1")
    IotCompanyDO findByAccount(String account);
}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyTypeDao.java

@ -14,6 +14,6 @@ import java.util.List;
public interface IotCompanyTypeDao extends PagingAndSortingRepository<IotCompanyTypeDO, String>,
        JpaSpecificationExecutor<IotCompanyTypeDO> {
    @Query("select s from IotCompanyTypeDO s where s.companyId = ?1 ")
    @Query("select s from IotCompanyTypeDO s where s.companyId = ?1 and s.del=0 ")
    List<IotCompanyTypeDO> findByCompanyId(String companyId);
}

+ 1 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotCompanyAppInterfaceDao.java

@ -17,5 +17,6 @@ public interface IotCompanyAppInterfaceDao extends PagingAndSortingRepository<Io
    @Query("from IotCompanyAppInterfaceDO w where w.appId=?1 and w.del=0")
    List<IotCompanyAppInterfaceDO> findByAppId(String appId);
}

+ 109 - 62
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -1,8 +1,10 @@
package com.yihu.iot.service.company;
import com.yihu.iot.dao.company.*;
import com.yihu.iot.dao.platform.IotCompanyAppInterfaceDao;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.company.*;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
@ -40,11 +42,12 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    private IotCompanyAppDao iotCompanyAppDao;
    @Autowired
    private UserAgent userAgent;
    @Autowired
    private IotCompanyAppInterfaceDao iotCompanyAppInterfaceDao;
    /**
     * 审核通过 分页查找
     *分页查找
     * @param page
     * @param size
     * @param accountType
@ -87,6 +90,58 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
    }
    /**
     * 按类型分页查找
     * @param page
     * @param size
     * @param status
     * @param accountType
     * @param enterType
     * @return
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String accountType, String enterType){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_company c WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_company c  WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=? ");
            sqlCount.append(" and c.status='").append(status).append("' ");
            args.add(status);
        }
        if(StringUtils.isNotBlank(accountType)){
            sql.append(" and c.account_type=? ");
            sqlCount.append(" and c.account_type='").append(accountType).append("' ");
            args.add(accountType);
        }
        if(StringUtils.isNotBlank(enterType)){
            sql.append(" and c.enter_type=? ");
            sqlCount.append(" and c.enter_type='").append(enterType).append("' ");
            args.add(enterType);
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotCompanyDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotCompanyDO.class));
        if(accountType.equalsIgnoreCase("1")){
            //得到list数据
            list.forEach(one->{
                findType(one);
            });
        }
        if(accountType.equalsIgnoreCase("0")){
            list.forEach(one->{
                findAppType(one);
            });
        }
        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()));
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
    }
    /**
     * 转换
     * @param sources
@ -162,56 +217,6 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        return target;
    }
    /**
     * 按类型分页查找
     * @param page
     * @param size
     * @param status
     * @param accountType
     * @param enterType
     * @return
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String accountType, String enterType){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_company c WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_company c  WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=? ");
            sqlCount.append(" and c.status='").append(status).append("' ");
            args.add(status);
        }
        if(StringUtils.isNotBlank(accountType)){
            sql.append(" and c.account_type=? ");
            sqlCount.append(" and c.account_type='").append(accountType).append("' ");
            args.add(accountType);
        }
        if(StringUtils.isNotBlank(enterType)){
            sql.append(" and c.enter_type=? ");
            sqlCount.append(" and c.enter_type='").append(enterType).append("' ");
            args.add(enterType);
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotCompanyDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotCompanyDO.class));
        if(accountType.equalsIgnoreCase("1")){
            //得到list数据
            list.forEach(one->{
                findType(one);
            });
        }
        if(accountType.equalsIgnoreCase("0")){
            list.forEach(one->{
                findAppType(one);
            });
        }
        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()));
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
    }
    /**
     * 条件分页查找
@ -307,6 +312,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                companyType.setCompanyId(id);
                companyType.setType(one.getType());
                companyType.setTypeName(one.getTypeName());
                companyType.setDel("0");
                companyTypes.add(companyType);
            });
            iotCompanyTypeDao.save(companyTypes);
@ -326,7 +332,6 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0);
            //查找所有应用名称
            Iterable<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAll();
            IotCompanyDO companyTemp = new IotCompanyDO();
            for (IotCompanyAppDO app : appDOList) {
                if(app.getName().equalsIgnoreCase(companyAppDO.getName())){
                    String companyId = app.getCompanyId();
@ -336,7 +341,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                        //查找该企业下的app
                        List<IotCompanyAppDO> apps = iotCompanyAppDao.findByCompanyId(companyDO.getId());
                        //保存注册信息获取CompangId
                         companyTemp = iotCompanyDao.save(iotCompany);
                       iotCompany.setId(getCode());
                        //遍历apps找出与注册相同的app
                        for (IotCompanyAppDO appDO : apps) {
                            if (appDO.getName().equalsIgnoreCase(companyAppDO.getName())){
@ -344,17 +349,17 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                                iotCompanyAppDao.save(appDO);
                            }
                            //更改公司ID
                            appDO.setCompanyId(companyTemp.getId());
                            appDO.setCompanyId(iotCompany.getId());
                        }
                    }
                    return MixEnvelop.getError("该应用已经注册,请使用注册账号登录");
                }
            }
            //平台接入
            companyTemp.setStatus("0");//待审核
            companyTemp.setSaasId(getCode());
            companyTemp.setDel(1);
            iotCompany = iotCompanyDao.save(companyTemp);
            iotCompany.setStatus("0");//待审核
            iotCompany.setSaasId(getCode());
            iotCompany.setDel(1);
            iotCompany = iotCompanyDao.save(iotCompany);
            //保存应用
            String id = iotCompany.getId();
            IotCompanyAppDO iotCompanyAppDO = new IotCompanyAppDO();
@ -370,7 +375,8 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        iotCompany.setAccount(userAgent.getUNAME());
        iotCompany.setEhrUserId(userAgent.getUID());
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,iotCompany);
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,convertToModelVO(iotCompany));
    }
    /**
@ -460,6 +466,42 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        return   MixEnvelop.getError("该企业已删除,请勿重复操作");
        }
        company.setDel(0);
        //删除企业下的信息  平台信息
        if(company.getAccountType().equalsIgnoreCase("0")){
            List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyId(company.getId());
            if (appDOList!=null&&appDOList.size()>0){
                //删除应用信息
                appDOList.forEach(one->{
                    one.setDel("0");
                    //删除接口信息
                    List<IotCompanyAppInterfaceDO> interfaceDOList = iotCompanyAppInterfaceDao.findByAppId(one.getId());
                    if (interfaceDOList!=null&&interfaceDOList.size()>0){
                        interfaceDOList.forEach(tow->{
                            tow.setDel("1");
                            iotCompanyAppInterfaceDao.save(tow);
                        });
                    }
                    iotCompanyAppDao.save(one);
                });
            }
        }
        //删除产商信息
        if (company.getAccountType().equalsIgnoreCase("1")){
            List<IotCompanyTypeDO> typeDOList = iotCompanyTypeDao.findByCompanyId(company.getId());
            //删除产商类型
            if (typeDOList!=null&&typeDOList.size()>0){
                typeDOList.forEach(one->{
                    one.setDel("1");
                    iotCompanyTypeDao.save(one);
                });
            }
        }
        iotCompanyDao.save(company);
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
    }
@ -473,7 +515,10 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        if(accountType.equalsIgnoreCase("1")){
            //更新类型
            List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId());
            iotCompanyTypeDao.delete(typeList);
           typeList.forEach(one->{
               one.setDel("1");
               iotCompanyTypeDao.save(one);
           });
            List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
            iotCompany.getTypeList().forEach(one->{
@ -482,10 +527,12 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                companyType.setCompanyId(iotCompany.getId());
                companyType.setType(one.getType());
                companyType.setTypeName(one.getTypeName());
                companyType.setDel("0");
                companyTypes.add(companyType);
            });
            iotCompanyTypeDao.save(companyTypes);
        }
        //更新应用
        if(accountType.equalsIgnoreCase("0")){
@ -676,7 +723,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        IotCompanyDO companyDO = iotCompanyDao.findByAccount(userAgent.getUNAME());
        if (companyDO==null){
            return MixEnvelop.getError("未入驻企业",-1);
            return MixEnvelop.getSuccess("未入驻企业",-1);
        }
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,companyDO.getStatus());
    }

+ 8 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java

@ -450,7 +450,14 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
     */
    public MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO>  findAllOrderBySupplierName(Integer page, Integer size,String supplierName) {
        List<IotDeviceOrderDO> listDO = iotDeviceOrderDao.findAllBySupplierName(supplierName);
        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_order c  WHERE c.del=1 ");
        sql.append("and c.supplier_name like '%").append(supplierName).append("%'");
        sql.append(" order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceOrderDO> listDO = jdbcTempalte.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceOrderDO.class));
        //DO转VO
        List<IotDeviceOrderVO> iotDeviceOrderVOList = new ArrayList<>();

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

@ -56,7 +56,6 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        IotOrderPurchaseDO purchaseDO = iotOrderPurchaseDao.findByOrderNo(iotDeviceQualityInspectionPlan.getOrderNo());
        iotDeviceQualityInspectionPlan.setPurchaseId(purchaseDO.getId());
        iotDeviceQualityInspectionPlan.setDeviceId(purchaseDO.getProductId());
        iotDeviceQualityInspectionPlan.setOrderNo(purchaseDO.getOrderNo());
        iotDeviceQualityInspectionPlan.setDeviceId(purchaseDO.getProductId());

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

@ -154,9 +154,11 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
     */
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> findAllSim(Integer page, Integer size) {
        String sql="SELECT DISTINCT * FROM iot_device_sim ;";
        StringBuffer sql= new StringBuffer("SELECT DISTINCT * FROM iot_device_sim ");
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotDeviceSimDO.class));
        sql.append(" limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        //获取总数

+ 22 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotCompanyAppInterfaceService.java

@ -7,6 +7,8 @@ import com.yihu.iot.dao.platform.IotShareInterfaceDao;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.platform.IotAppInterfacesVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -67,6 +69,10 @@ public class IotCompanyAppInterfaceService extends BaseJpaService<IotCompanyAppI
            IotShareInterfaceDO shareInterfaceDO = iotShareInterfaceDao.findOne(shareInterfaceId);
            appInterfacesVO.setAppName(one.getAppName());
            appInterfacesVO.setAppId(one.getAppId());
            appInterfacesVO.setId(one.getId());
            appInterfacesVO.setCompanyId(one.getCompanyId());
            appInterfacesVO.setCompanyName(one.getCompanyName());
            appInterfacesVO.setIotShareInterfaceDO(shareInterfaceDO);
            list.add(appInterfacesVO);
@ -75,4 +81,20 @@ public class IotCompanyAppInterfaceService extends BaseJpaService<IotCompanyAppI
        return list;
    }
    /**
     * 删除应用接口
     * @param id
     */
    public MixEnvelop<IotCompanyAppInterfaceDO, IotCompanyAppInterfaceDO> delAppInterface(String id) {
        IotCompanyAppInterfaceDO appInterfaceDO = iotCompanyAppInterfaceDao.findOne(id);
        if (appInterfaceDO.getDel().equalsIgnoreCase("1")){
            return MixEnvelop.getError("该接口已删除",-1);
        }
        appInterfaceDO.setDel("1");
        iotCompanyAppInterfaceDao.save(appInterfaceDO);
        return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_delete);
    }
}

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

@ -112,9 +112,11 @@ public class IotInterfaceAuditService  extends BaseJpaService<IotInterfaceAuditD
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> findAllApplyFor(Integer page, Integer size) {
        String sql="SELECT DISTINCT * FROM iot_interface_audit ORDER BY time DESC;";
        StringBuffer sql= new StringBuffer("SELECT DISTINCT * FROM iot_interface_audit ORDER BY time DESC");
        List<IotInterfaceAuditDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotInterfaceAuditDO.class));
        sql.append(" limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceAuditDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotInterfaceAuditDO.class));
        list.forEach(one->{
            IotCompanyDO company = iotCompanyDao.findOne(one.getCompanyId());

+ 20 - 7
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceLogService.java

@ -6,8 +6,11 @@ import com.yihu.iot.dao.platform.IotInterfaceLogDao;
import com.yihu.iot.dao.workType.IotWorkTypeDao;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceLogDO;
import com.yihu.jw.entity.iot.workType.IotWorkTypeDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
import com.yihu.jw.restmodel.iot.platform.IotAppInterfacesVO;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceLogVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -64,10 +67,11 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
     */
    public MixEnvelop<IotInterfaceLogVO,IotInterfaceLogVO> findAll(Integer page, Integer size) throws ParseException {
        String sql = "SELECT * FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b GROUP BY b.interface_name;";
        StringBuffer sql = new StringBuffer("SELECT * FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b GROUP BY b.interface_name ");
        sql.append(" limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotInterfaceLogDO.class));
        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotInterfaceLogDO.class));
        ArrayList<IotInterfaceLogVO> resultList = new ArrayList<>();
@ -93,8 +97,15 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
    public MixEnvelop<IotInterfaceLogVO, IotInterfaceLogVO> findInterfaceLog(Integer page, Integer size, String interfaceName) {
        List<IotInterfaceLogDO> list = iotInterfaceLogDao.findAllByInterfaceName(interfaceName);
        StringBuffer sql =new StringBuffer("SELECT c.* FROM iot_interface_log c WHERE ");
        if (StringUtils.isNotBlank(interfaceName)){
            sql.append(" c.interface_name like'%").append(interfaceName).append("%'");
        }
        sql.append("order by c.time desc limit ").append((page-1)*size).append(",").append(size);
//        List<IotInterfaceLogDO> list = iotInterfaceLogDao.findAllByInterfaceName(interfaceName);
        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(IotInterfaceLogDO.class));
        ArrayList<IotInterfaceLogVO> resultList = new ArrayList<>();
@ -166,12 +177,14 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,list,page, size,totalCount);*/
        String sql ="SELECT  COALESCE(c.fali,0),b.count,b.app_name,b.interface_name,b.work_type FROM " +
                "                                        (SELECT COUNT(id) fali,app_name,interface_name FROM iot_interface_log  WHERE state=0 GROUP BY app_name,interface_name) c " +
        StringBuffer sql =new StringBuffer( "SELECT  COALESCE(c.fali,0),b.count,b.app_name,b.interface_name,b.work_type FROM " +
                " (SELECT COUNT(id) fali,app_name,interface_name FROM iot_interface_log  WHERE state=0 GROUP BY app_name,interface_name) c " +
                                                         "RIGHT JOIN (SELECT count(id) count,app_name,interface_name,work_type FROM iot_interface_log " +
                                                         " GROUP BY app_name,interface_name) b ON c.app_name=b.app_name AND c.interface_name=b.interface_name;";
                                                         " GROUP BY app_name,interface_name) b ON c.app_name=b.app_name AND c.interface_name=b.interface_name ");
        sql.append(" limit ").append((page-1)*size).append(",").append(size);
        List<Map<String, Object>> listSql = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> listSql = jdbcTemplate.queryForList(sql.toString());
        List<IotInterfaceLogVO> list = new ArrayList<>();
        listSql.forEach(one->{
            IotInterfaceLogVO iotInterfaceLogVO = new IotInterfaceLogVO();

+ 63 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotShareInterfaceService.java

@ -1,13 +1,19 @@
package com.yihu.iot.service.platform;
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.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.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -34,6 +40,12 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private IotCompanyDao iotCompanyDao;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    /**
     * 增加接口
     * @param jsonData
@ -112,8 +124,8 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
            args.add(type);
        }
        if(StringUtils.isNotBlank(name)){
            sql.append(" and c.method_name like '%").append(name).append("%'");
            sqlCount.append(" and c.method_name like '%").append(name).append("%'");
            sql.append(" and c.interface_name like '%").append(name).append("%'");
            sqlCount.append(" and c.interface_name like '%").append(name).append("%'");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
@ -135,4 +147,53 @@ public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO
        shareInterfaceDO.setDel("1");
        iotShareInterfaceDao.save(shareInterfaceDO);
    }
    /**
     * 接口文档说明
     * @param interfaceName
     * @return
     */
    public String interfaceDoc(String interfaceName) {
        IotSystemDictDO systemDictDO = iotSystemDictDao.findByDictName(interfaceName).get(0);
        return systemDictDO.getCode();
    }
    /**
     * 分页查询所有应用信息
     * @param page
     * @param size
     * @param name
     * @return
     */
    public  MixEnvelop<IotCompanyAppVO,IotCompanyAppVO> findAllApp(Integer page, Integer size, String name) {
        StringBuffer sql = new StringBuffer("select c.* FROM iot_company_app c WHERE c.del=1 ");
        if(StringUtils.isNotBlank(name)){
            sql.append("and c.`name` like '%").append(name).append("%' OR c.company_name  LIKE  '%").append(name).append("%'");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotCompanyAppDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotCompanyAppDO.class));
        ArrayList<IotCompanyAppVO> resultList = new ArrayList<>();
        list.forEach(one->{
            IotCompanyAppVO target = new IotCompanyAppVO();
            BeanUtils.copyProperties(one,target);
            IotCompanyDO companyDO = iotCompanyDao.findById(one.getCompanyId());
            target.setContactsMobile(companyDO.getContactsMobile());
            target.setContactsName(companyDO.getContactsName());
            target.setId(one.getId());
            resultList.add(target);
        });
        long count =list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,resultList,page, size,count);
    }
}