Просмотр исходного кода

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

# Conflicts:
#	svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
mengkang 5 лет назад
Родитель
Сommit
96206039a6

+ 4 - 5
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -47,6 +47,8 @@ public class IotCompanyController extends EnvelopRestEndpoint {
                                       @RequestParam(value = "status", required = false) String status,
                                       @RequestParam(value = "status", required = false) String status,
                                                    @ApiParam(name = "enterType", value = "入驻类型", defaultValue = "")
                                                    @ApiParam(name = "enterType", value = "入驻类型", defaultValue = "")
                                       @RequestParam(value = "enterType", required = false) String enterType,
                                       @RequestParam(value = "enterType", required = false) String enterType,
                                                    @ApiParam(name = "companyName",value = "产商名称或平台名称")
                                       @RequestParam(value = "companyName",required = false) String companyName,
                                                    @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                    @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                       @RequestParam(value = "page", required = false) Integer page,
                                       @RequestParam(value = "page", required = false) Integer page,
                                                    @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                    @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
@ -58,11 +60,8 @@ public class IotCompanyController extends EnvelopRestEndpoint {
            if(size == null){
            if(size == null){
                size = 10;
                size = 10;
            }
            }
            if(StringUtils.isBlank(status)){
                return iotCompanyService.queryPage(page,size,accountType,enterType);
            }else {
                return iotCompanyService.queryPage(page,size,status,accountType,enterType);
            }
            return iotCompanyService.queryPage(page,size,companyName,status,accountType,enterType);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();

+ 52 - 44
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -46,49 +46,53 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    private IotCompanyAppInterfaceDao iotCompanyAppInterfaceDao;
    private IotCompanyAppInterfaceDao iotCompanyAppInterfaceDao;
    /**
     *分页查找
     * @param page
     * @param size
     * @param accountType
     * @param enterType
     * @return
     * @throws ParseException
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String accountType, String enterType) throws ParseException {
        String filters = "del=1;";
        String semicolon = "";
        if(StringUtils.isNotBlank(accountType)){
            filters += "accountType?"+accountType;
            semicolon = ";";
        }
        if(StringUtils.isNotBlank(enterType)){
            filters += semicolon +"enterType="+enterType;
            semicolon = ";";
        }
        String sorts = "-updateTime";//按更新时间降序
        List<IotCompanyDO> list = search(null, filters, sorts, page, size);
        if(accountType.equalsIgnoreCase("1")){
            //得到list数据
            list.forEach(one->{
                findType(one);
            });
        }
        if(accountType.equalsIgnoreCase("0")){
            list.forEach(one->{
                findAppType(one);
            });
        }
        //获取总数
        long count = getCount(filters);
        //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 page
//     * @param size
//     * @param accountType
//     * @param enterType
//     * @return
//     * @throws ParseException
//     */
//    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size,String companyName, String accountType, String enterType) throws ParseException {
//        String filters = "del=1;";
//        String semicolon = "";
//        if(StringUtils.isNotBlank(accountType)){
//            filters += "accountType?"+accountType;
//            semicolon = ";";
//        }
//        if (StringUtils.isNotBlank(companyName)){
//            filters+="name?"+companyName;
//            semicolon = ";";
//        }
//        if(StringUtils.isNotBlank(enterType)){
//            filters += semicolon +"enterType="+enterType;
//            semicolon = ";";
//        }
//        String sorts = "-updateTime";//按更新时间降序
//        List<IotCompanyDO> list = search(null, filters, sorts, page, size);
//
//        if(accountType.equalsIgnoreCase("1")){
//            //得到list数据
//            list.forEach(one->{
//                findType(one);
//            });
//        }
//        if(accountType.equalsIgnoreCase("0")){
//            list.forEach(one->{
//                findAppType(one);
//            });
//        }
//
//        //获取总数
//        long count = getCount(filters);
//
//        //DO转VO
//        List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
//
//        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
//    }
    /**
    /**
@ -100,7 +104,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @param enterType
     * @param enterType
     * @return
     * @return
     */
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String accountType, String enterType){
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size,String companyName, String status, String accountType, String enterType){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_company c WHERE c.del=1 ");
        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 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_company c  WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        List<Object> args = new ArrayList<>();
@ -114,6 +118,10 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            sqlCount.append(" and c.account_type='").append(accountType).append("' ");
            sqlCount.append(" and c.account_type='").append(accountType).append("' ");
            args.add(accountType);
            args.add(accountType);
        }
        }
        if(StringUtils.isNotBlank(companyName)){
            sql.append(" and (c.name like '%").append(companyName).append("%')");
            sqlCount.append(" and (c.name like '%").append(companyName).append("%')");
        }
        if(StringUtils.isNotBlank(enterType)){
        if(StringUtils.isNotBlank(enterType)){
            sql.append(" and c.enter_type=? ");
            sql.append(" and c.enter_type=? ");
            sqlCount.append(" and c.enter_type='").append(enterType).append("' ");
            sqlCount.append(" and c.enter_type='").append(enterType).append("' ");