|
@ -46,49 +46,53 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
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
|
|
|
* @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 sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_company c WHERE c.del=1 ");
|
|
|
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("' ");
|
|
|
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)){
|
|
|
sql.append(" and c.enter_type=? ");
|
|
|
sqlCount.append(" and c.enter_type='").append(enterType).append("' ");
|
|
@ -515,10 +523,14 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
if(accountType.equalsIgnoreCase("1")){
|
|
|
//更新类型
|
|
|
List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId());
|
|
|
typeList.forEach(one->{
|
|
|
one.setDel("1");
|
|
|
iotCompanyTypeDao.save(one);
|
|
|
});
|
|
|
|
|
|
if (typeList!=null&&typeList.size()>0){
|
|
|
typeList.forEach(one->{
|
|
|
one.setDel("1");
|
|
|
iotCompanyTypeDao.save(one);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
|
|
|
|
|
|
iotCompany.getTypeList().forEach(one->{
|
|
@ -538,13 +550,23 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
|
|
|
if(accountType.equalsIgnoreCase("0")){
|
|
|
IotCompanyAppDO newApp = iotCompany.getAppList().get(0);
|
|
|
IotCompanyAppDO oldApp = iotCompanyAppDao.findOne(newApp.getId());
|
|
|
oldApp.setAddressIp(newApp.getAddressIp());
|
|
|
oldApp.setName(newApp.getName());
|
|
|
oldApp.setId(newApp.getId());
|
|
|
oldApp.setCompanyId(iotCompany.getId());
|
|
|
oldApp.setCompanyName(iotCompany.getName());
|
|
|
oldApp.setSaasId(getCode());
|
|
|
iotCompanyAppDao.save(oldApp);
|
|
|
//无应用
|
|
|
if (oldApp!=null){
|
|
|
oldApp.setAddressIp(newApp.getAddressIp());
|
|
|
oldApp.setName(newApp.getName());
|
|
|
oldApp.setId(newApp.getId());
|
|
|
oldApp.setCompanyId(iotCompany.getId());
|
|
|
oldApp.setCompanyName(iotCompany.getName());
|
|
|
oldApp.setSaasId(getCode());
|
|
|
iotCompanyAppDao.save(oldApp);
|
|
|
}else {
|
|
|
newApp.setDel("1");
|
|
|
newApp.setCompanyName(iotCompany.getName());
|
|
|
newApp.setCompanyId(iotCompany.getId());
|
|
|
newApp.setSaasId(getCode());
|
|
|
iotCompanyAppDao.save(newApp);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|