|
@@ -10,6 +10,7 @@ import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.lapi.service.ILapiService;
|
|
import com.jpsoft.smart.modules.lapi.service.ILapiService;
|
|
import com.jpsoft.smart.modules.lapi.vo.LapiResult;
|
|
import com.jpsoft.smart.modules.lapi.vo.LapiResult;
|
|
import com.jpsoft.smart.modules.sys.entity.User;
|
|
import com.jpsoft.smart.modules.sys.entity.User;
|
|
|
|
+import com.jpsoft.smart.modules.sys.service.DataDictionaryService;
|
|
import com.jpsoft.smart.modules.sys.service.UserService;
|
|
import com.jpsoft.smart.modules.sys.service.UserService;
|
|
import com.rabbitmq.client.AMQP;
|
|
import com.rabbitmq.client.AMQP;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -57,6 +58,9 @@ public class CompanyInfoController {
|
|
@Autowired
|
|
@Autowired
|
|
private ILapiService lapiService;
|
|
private ILapiService lapiService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
|
+
|
|
@ApiOperation(value="创建空记录")
|
|
@ApiOperation(value="创建空记录")
|
|
@GetMapping("create")
|
|
@GetMapping("create")
|
|
public MessageResult<CompanyInfoDTO> create(){
|
|
public MessageResult<CompanyInfoDTO> create(){
|
|
@@ -386,6 +390,11 @@ public class CompanyInfoController {
|
|
li.setPosition4Name(page1.get(0).getPosition4Name());
|
|
li.setPosition4Name(page1.get(0).getPosition4Name());
|
|
li.setPosition5Name(page1.get(0).getPosition5Name());
|
|
li.setPosition5Name(page1.get(0).getPosition5Name());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String typeN = dataDictionaryService.findNameByCatalogNameAndValue("单位性质",li.getType());
|
|
|
|
+ li.setTypeN(typeN);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
msgResult.setResult(true);
|
|
msgResult.setResult(true);
|
|
@@ -422,9 +431,11 @@ public class CompanyInfoController {
|
|
|
|
|
|
@GetMapping("queryBindDeviceList")
|
|
@GetMapping("queryBindDeviceList")
|
|
public MessageResult<Map> queryBindDeviceList(String companyId,
|
|
public MessageResult<Map> queryBindDeviceList(String companyId,
|
|
- @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
|
- @RequestAttribute String subject){
|
|
|
|
|
|
+ @RequestParam(value="deviceNo",defaultValue="") String deviceNo,
|
|
|
|
+ @RequestParam(value="deviceName",defaultValue="") String deviceName,
|
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
|
+ @RequestAttribute String subject){
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -436,39 +447,55 @@ public class CompanyInfoController {
|
|
searchParams.put("bindCompanyId",user.getCompanyId());
|
|
searchParams.put("bindCompanyId",user.getCompanyId());
|
|
}
|
|
}
|
|
|
|
|
|
- List<Sort> sorts = new ArrayList<>();
|
|
|
|
- sorts.add(new Sort("create_time","asc"));
|
|
|
|
|
|
|
|
- //设备列表
|
|
|
|
- Page<DeviceInfo> deviceInfoPage = deviceInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sorts);
|
|
|
|
|
|
|
|
- //查询已绑定设备
|
|
|
|
- List<DeviceInfo> bindDeviceList = companyDeviceRelationService.findDeviceByCompanyId(companyId);
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(deviceNo)){
|
|
|
|
+ searchParams.put("deviceNo","%" + deviceNo + "%");
|
|
|
|
+ }
|
|
|
|
|
|
- List<Map> mapList = new ArrayList<>();
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(deviceName)){
|
|
|
|
+ searchParams.put("aliasName","%" + deviceName + "%");
|
|
|
|
+ }
|
|
|
|
|
|
- for (DeviceInfo deviceInfo : deviceInfoPage) {
|
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
|
|
|
+ List<Sort> sorts = new ArrayList<>();
|
|
|
|
|
|
- map.put("device",deviceInfo);
|
|
|
|
|
|
|
|
- long count = bindDeviceList.stream().filter((d)->d.getId().equals(deviceInfo.getId())).count();
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(companyId)){
|
|
|
|
+ searchParams.put("isBoundCompanyId",companyId);
|
|
|
|
+ sorts.add(new Sort("is_bind","desc"));
|
|
|
|
+ }
|
|
|
|
+ sorts.add(new Sort("create_time","asc"));
|
|
|
|
|
|
- if (count>0){
|
|
|
|
- map.put("bound",true);
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- map.put("bound",false);
|
|
|
|
- }
|
|
|
|
|
|
+ //设备列表
|
|
|
|
+ Page<DeviceInfo> deviceInfoPage = deviceInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sorts);
|
|
|
|
|
|
- mapList.add(map);
|
|
|
|
- }
|
|
|
|
|
|
+// //查询已绑定设备
|
|
|
|
+// List<DeviceInfo> bindDeviceList = companyDeviceRelationService.findDeviceByCompanyId(companyId);
|
|
|
|
+//
|
|
|
|
+// List<Map> mapList = new ArrayList<>();
|
|
|
|
+//
|
|
|
|
+// for (DeviceInfo deviceInfo : deviceInfoPage) {
|
|
|
|
+// Map<String,Object> map = new HashMap<>();
|
|
|
|
+//
|
|
|
|
+// map.put("device",deviceInfo);
|
|
|
|
+//
|
|
|
|
+// long count = bindDeviceList.stream().filter((d)->d.getId().equals(deviceInfo.getId())).count();
|
|
|
|
+//
|
|
|
|
+// if (count>0){
|
|
|
|
+// map.put("bound",true);
|
|
|
|
+// }
|
|
|
|
+// else{
|
|
|
|
+// map.put("bound",false);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// mapList.add(map);
|
|
|
|
+// }
|
|
|
|
|
|
- Map<String,Object> dataMap = PojoUtils.pageWrapper(deviceInfoPage);
|
|
|
|
|
|
+ //Map<String,Object> dataMap = PojoUtils.pageWrapper(deviceInfoPage);
|
|
|
|
|
|
- dataMap.put("data",mapList);
|
|
|
|
|
|
+ //dataMap.put("data",mapList);
|
|
|
|
|
|
- messageResult.setData(dataMap);
|
|
|
|
|
|
+ messageResult.setData(PojoUtils.pageWrapper(deviceInfoPage));
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
}
|
|
}
|
|
catch (Exception ex){
|
|
catch (Exception ex){
|