|
@@ -89,14 +89,12 @@ public class PersonDeviceLogController {
|
|
String companyId = user.getCompanyId();
|
|
String companyId = user.getCompanyId();
|
|
|
|
|
|
List<DeviceInfo> deviceInfoList = deviceInfoService.findByCompanyId(companyId);
|
|
List<DeviceInfo> deviceInfoList = deviceInfoService.findByCompanyId(companyId);
|
|
- String deviceIds ="";
|
|
|
|
|
|
+ List<String> deviceIdList = new ArrayList<String>();
|
|
for (DeviceInfo deviceInfo:deviceInfoList) {
|
|
for (DeviceInfo deviceInfo:deviceInfoList) {
|
|
- deviceIds += deviceInfo.getId()+",";
|
|
|
|
- }
|
|
|
|
- if(StringUtil.isNotEmpty(deviceIds)){
|
|
|
|
- deviceIds = deviceIds.substring(0,deviceIds.lastIndexOf(","));
|
|
|
|
- searchParams.put("deviceIds","("+deviceIds+")");
|
|
|
|
|
|
+ deviceIdList.add(deviceInfo.getId());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ searchParams.put("deviceIdList",deviceIdList);
|
|
}
|
|
}
|
|
if(StringUtil.isNotEmpty(deviceNo)){
|
|
if(StringUtil.isNotEmpty(deviceNo)){
|
|
searchParams.put("deviceNo","%"+deviceNo+"%");
|
|
searchParams.put("deviceNo","%"+deviceNo+"%");
|
|
@@ -159,7 +157,6 @@ public class PersonDeviceLogController {
|
|
@ApiOperation(value="导出日志台账")
|
|
@ApiOperation(value="导出日志台账")
|
|
@PostMapping("exportXls")
|
|
@PostMapping("exportXls")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
- @ApiImplicitParam(name = "companyId",value = "企业ID", paramType = "query"),
|
|
|
|
@ApiImplicitParam(name = "deviceNo",value = "设备编号", paramType = "query"),
|
|
@ApiImplicitParam(name = "deviceNo",value = "设备编号", paramType = "query"),
|
|
@ApiImplicitParam(name = "aliasName",value = "设备别名", paramType = "query"),
|
|
@ApiImplicitParam(name = "aliasName",value = "设备别名", paramType = "query"),
|
|
@ApiImplicitParam(name = "personName",value = "人员姓名", paramType = "query"),
|
|
@ApiImplicitParam(name = "personName",value = "人员姓名", paramType = "query"),
|
|
@@ -167,7 +164,6 @@ public class PersonDeviceLogController {
|
|
@ApiImplicitParam(name = "temperatureRanges",value = "温度范围", paramType = "query")
|
|
@ApiImplicitParam(name = "temperatureRanges",value = "温度范围", paramType = "query")
|
|
})
|
|
})
|
|
public MessageResult<String> exportXls(
|
|
public MessageResult<String> exportXls(
|
|
- String companyId,
|
|
|
|
String deviceNo,String aliasName,String personName,
|
|
String deviceNo,String aliasName,String personName,
|
|
String timeRanges,String temperatureRanges,
|
|
String timeRanges,String temperatureRanges,
|
|
@RequestAttribute String subject) {
|
|
@RequestAttribute String subject) {
|
|
@@ -201,9 +197,21 @@ public class PersonDeviceLogController {
|
|
List<Sort> sortList = new ArrayList<>();
|
|
List<Sort> sortList = new ArrayList<>();
|
|
sortList.add(new Sort("a.record_time","desc"));
|
|
sortList.add(new Sort("a.record_time","desc"));
|
|
|
|
|
|
- if(StringUtil.isNotEmpty(companyId)){
|
|
|
|
- searchParams.put("companyId",companyId);
|
|
|
|
|
|
+ //为公司管理员
|
|
|
|
+ boolean is_admin = userService.hasRole(subject,"ADMIN");
|
|
|
|
+ if(is_admin){
|
|
|
|
+ User user = userService.get(subject);
|
|
|
|
+ String companyId = user.getCompanyId();
|
|
|
|
+
|
|
|
|
+ List<DeviceInfo> deviceInfoList = deviceInfoService.findByCompanyId(companyId);
|
|
|
|
+ List<String> deviceIdList = new ArrayList<String>();
|
|
|
|
+ for (DeviceInfo deviceInfo:deviceInfoList) {
|
|
|
|
+ deviceIdList.add(deviceInfo.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ searchParams.put("deviceIdList",deviceIdList);
|
|
}
|
|
}
|
|
|
|
+
|
|
if(StringUtil.isNotEmpty(deviceNo)){
|
|
if(StringUtil.isNotEmpty(deviceNo)){
|
|
searchParams.put("deviceNo","%"+deviceNo+"%");
|
|
searchParams.put("deviceNo","%"+deviceNo+"%");
|
|
}
|
|
}
|