Browse Source

Merge branch 'dev' of suhaiwen/wlyy2.0 into dev

huangwenjie 5 năm trước cách đây
mục cha
commit
b2578ac1f5

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

@ -75,6 +75,7 @@ public class IotRequestMapping {
    public static class Company{
        public static final String findCompanyPage = "findCompanyPage";
        public static final String addCompany = "addCompany";
        public static final String rootAddCompany = "rootAddCompany";
        public static final String findCompanyById = "findCompanyById";
        public static final String findByBusinessLicense = "findByBusinessLicense";
        public static final String updCompany = "updCompany";

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

@ -19,6 +19,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@ -357,4 +358,28 @@ public class IotCompanyController extends EnvelopRestEndpoint {
           return iotCompanyService.findCompanyApp();
    }
    @PostMapping(value = IotRequestMapping.Company.rootAddCompany)
    @ApiOperation(value = "管理员新增厂商", notes = "管理员新增厂商")
    public MixEnvelop rootAddCompany( @ApiParam(name = "jsonData", value = "jsonData", defaultValue = "")
                                  @RequestParam(value = "jsonData") String jsonData){
        try {
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            return iotCompanyService.addCompany(iotCompany);
        } catch (IOException e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 4 - 15
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -165,8 +165,8 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
                                                                            @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){
                                                                      @ApiParam(name = "interfaceName", value = "接口名或方法名称", defaultValue = "")
                                                                          @RequestParam(value = "interfaceName", required = false) String interfaceName){
        try {
            if(page == null|| page < 0){
@ -175,7 +175,7 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
            if(size == null){
                size = 10;
            }
            return iotInterfaceLogService.findAll(page,size,name);
            return iotInterfaceLogService.findAll(page,size,interfaceName);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -313,7 +313,7 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
                                                                             @ApiParam(name = "interfaceName", value = "接口名称", defaultValue = "")
                                                                                 @RequestParam(value = "interfaceName") String interfaceName,
                                                                             @ApiParam(name = "addresssIp", value = "IP地址", defaultValue = "")
                                                                                 @RequestParam(value = "addresssIp") String addresssIp) {
                                                                                 @RequestParam(value = "addresssIp",required = false) String addresssIp) {
        try {
            if(page == null|| page < 0){
@ -358,16 +358,6 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
//    @GetMapping(value = IotRequestMapping.Platform.interfaceDoc)
//    @ApiOperation(value = "接口文档说明", notes = "接口文档说明")
//    public MixEnvelop interfaceDoc( @ApiParam(name = "dictName", value = "字典名称", defaultValue = "")
//                                        @RequestParam(value = "dictName") String dictName){
//
//       String url =  iotShareInterfaceService.interfaceDoc(dictName);
//       return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,url);
//
//    }
    @PostMapping(value = IotRequestMapping.Platform.addApp)
    @ApiOperation(value = "新增平台应用", notes = "新增平台应用")
@ -386,5 +376,4 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
}

+ 39 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -1066,4 +1066,43 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,appDOS);
    }
    /**
     * 新增厂商
     * @param iotCompany
     * @return
     */
    public MixEnvelop addCompany(IotCompanyDO iotCompany) {
        IotCompanyDO platform = iotCompanyDao.findByNameAndAccountType(iotCompany.getName(), "1");
        if (platform!=null){
            return MixEnvelop.getError("企业已经注册");
        }
        iotCompany.setStatus("1");//默认审核通过
        iotCompany.setSaasId(getCode());
        iotCompany.setDel(1);
        iotCompany.setAccount(iotCompany.getContactsMobile());
        iotCompany.setEhrUserId(getCode());
        iotCompany.setAccountType("1");
        iotCompanyDao.save(iotCompany);
        //保存企业类型
        List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
        iotCompany.getTypeList().forEach(one->{
            IotCompanyTypeDO companyType = new IotCompanyTypeDO();
            companyType.setSaasId(getCode());
            companyType.setCompanyId(iotCompany.getId());
            companyType.setType(one.getType());
            companyType.setTypeName(one.getTypeName());
            companyType.setDel("0");
            companyTypes.add(companyType);
        });
        iotCompanyTypeDao.save(companyTypes);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_create);
    }
}

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

@ -67,9 +67,9 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
     */
    public MixEnvelop<IotInterfaceLogVO,IotInterfaceLogVO> findAll(Integer page, Integer size,String name) throws ParseException {
        StringBuffer sql = new StringBuffer("SELECT * FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b where  ");
        StringBuffer sql = new StringBuffer("SELECT * FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b   ");
        if (StringUtils.isNotBlank(name)){
            sql.append("b.method LIKE '%").append(name).append("%'OR b.interface_name LIKE '%").append(name).append("%'");
            sql.append(" where b.method LIKE '%").append(name).append("%'OR b.interface_name LIKE '%").append(name).append("%'");
        }
        sql.append(" GROUP BY b.interface_name limit ").append((page-1)*size).append(",").append(size);
@ -99,13 +99,13 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
    public MixEnvelop<IotInterfaceLogVO, IotInterfaceLogVO> findInterfaceLog(Integer page, Integer size, String interfaceName,String addressIP) {
        StringBuffer sql =new StringBuffer("SELECT c.* FROM iot_interface_log c WHERE ");
        StringBuffer sql =new StringBuffer("SELECT c.* FROM iot_interface_log c WHERE 1=1 ");
        if (StringUtils.isNotBlank(interfaceName)){
            sql.append(" c.interface_name like'%").append(interfaceName).append("%'");
            sql.append(" and c.interface_name like'%").append(interfaceName).append("%'");
        }
        if (StringUtils.isNotBlank(addressIP)){
            sql.append(" c.address_ip like'%").append(addressIP).append("%'");
            sql.append(" and c.address_ip='").append(addressIP).append("'");
        }
        sql.append(" order by c.time desc limit ").append((page-1)*size).append(",").append(size);