|
@@ -193,6 +193,7 @@ public class PersonDeviceLogController {
|
|
|
|
|
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
|
HSSFSheet sheet = workbook.createSheet();
|
|
HSSFSheet sheet = workbook.createSheet();
|
|
|
|
+
|
|
//表头
|
|
//表头
|
|
HSSFRow rowTitle = sheet.createRow(0);
|
|
HSSFRow rowTitle = sheet.createRow(0);
|
|
HSSFCell cellTitle1 = rowTitle.createCell(0);
|
|
HSSFCell cellTitle1 = rowTitle.createCell(0);
|
|
@@ -216,7 +217,7 @@ public class PersonDeviceLogController {
|
|
//CompanyInfo companyInfo = companyInfoService.get(companyId);
|
|
//CompanyInfo companyInfo = companyInfoService.get(companyId);
|
|
List<CompanyPosition> companyPositionList = companyPositionService.findByCompanyId(companyId);
|
|
List<CompanyPosition> companyPositionList = companyPositionService.findByCompanyId(companyId);
|
|
CompanyPosition companyPosition = null;
|
|
CompanyPosition companyPosition = null;
|
|
- if(companyPositionList.size() > 0){
|
|
|
|
|
|
+ if (companyPositionList.size() > 0) {
|
|
companyPosition = companyPositionList.get(0);
|
|
companyPosition = companyPositionList.get(0);
|
|
HSSFCell cellTitle8 = rowTitle.createCell(7);
|
|
HSSFCell cellTitle8 = rowTitle.createCell(7);
|
|
cellTitle8.setCellValue(companyPosition.getPosition1Name());
|
|
cellTitle8.setCellValue(companyPosition.getPosition1Name());
|
|
@@ -230,88 +231,84 @@ public class PersonDeviceLogController {
|
|
cellTitle12.setCellValue(companyPosition.getPosition5Name());
|
|
cellTitle12.setCellValue(companyPosition.getPosition5Name());
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//表内容
|
|
//表内容
|
|
- Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
|
|
|
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"));
|
|
|
|
|
|
//为公司管理员
|
|
//为公司管理员
|
|
- boolean is_admin = userService.hasRole(subject,"ADMIN");
|
|
|
|
- if(is_admin){
|
|
|
|
|
|
+ boolean is_admin = userService.hasRole(subject, "ADMIN");
|
|
|
|
+ if (is_admin) {
|
|
List<DeviceInfo> deviceInfoList = deviceInfoService.findByCompanyId(companyId);
|
|
List<DeviceInfo> deviceInfoList = deviceInfoService.findByCompanyId(companyId);
|
|
List<String> deviceIdList = new ArrayList<String>();
|
|
List<String> deviceIdList = new ArrayList<String>();
|
|
- if(deviceInfoList.size() > 0) {
|
|
|
|
|
|
+ if (deviceInfoList.size() > 0) {
|
|
for (DeviceInfo deviceInfo : deviceInfoList) {
|
|
for (DeviceInfo deviceInfo : deviceInfoList) {
|
|
deviceIdList.add(deviceInfo.getId());
|
|
deviceIdList.add(deviceInfo.getId());
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
deviceIdList.add("-1");
|
|
deviceIdList.add("-1");
|
|
}
|
|
}
|
|
|
|
|
|
- searchParams.put("deviceIdList",deviceIdList);
|
|
|
|
|
|
+ searchParams.put("deviceIdList", deviceIdList);
|
|
}
|
|
}
|
|
|
|
|
|
- if(StringUtil.isNotEmpty(deviceNo)){
|
|
|
|
- searchParams.put("deviceNo","%"+deviceNo+"%");
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(deviceNo)) {
|
|
|
|
+ searchParams.put("deviceNo", "%" + deviceNo + "%");
|
|
}
|
|
}
|
|
- if(StringUtil.isNotEmpty(aliasName)){
|
|
|
|
- searchParams.put("aliasName","%"+aliasName+"%");
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(aliasName)) {
|
|
|
|
+ searchParams.put("aliasName", "%" + aliasName + "%");
|
|
}
|
|
}
|
|
- if(StringUtil.isNotEmpty(personName)){
|
|
|
|
- searchParams.put("personName","%"+personName+"%");
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(personName)) {
|
|
|
|
+ searchParams.put("personName", "%" + personName + "%");
|
|
}
|
|
}
|
|
|
|
|
|
- if(StringUtil.isNotEmpty(timeRanges)){
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(timeRanges)) {
|
|
String[] timeRangeArray = timeRanges.split(",");
|
|
String[] timeRangeArray = timeRanges.split(",");
|
|
String beginTime = "";
|
|
String beginTime = "";
|
|
String endTime = "";
|
|
String endTime = "";
|
|
- if(timeRangeArray.length==1){
|
|
|
|
|
|
+ if (timeRangeArray.length == 1) {
|
|
beginTime = timeRangeArray[0];
|
|
beginTime = timeRangeArray[0];
|
|
- }
|
|
|
|
- else if(timeRangeArray.length==2){
|
|
|
|
|
|
+ } else if (timeRangeArray.length == 2) {
|
|
beginTime = timeRangeArray[0];
|
|
beginTime = timeRangeArray[0];
|
|
endTime = timeRangeArray[1];
|
|
endTime = timeRangeArray[1];
|
|
}
|
|
}
|
|
|
|
|
|
- searchParams.put("beginTime",beginTime);
|
|
|
|
- searchParams.put("endTime",endTime);
|
|
|
|
|
|
+ searchParams.put("beginTime", beginTime);
|
|
|
|
+ searchParams.put("endTime", endTime);
|
|
}
|
|
}
|
|
|
|
|
|
- if(StringUtil.isNotEmpty(temperatureRanges)){
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(temperatureRanges)) {
|
|
String[] temperatureRangeArray = temperatureRanges.split(",");
|
|
String[] temperatureRangeArray = temperatureRanges.split(",");
|
|
|
|
|
|
String minTemperature = "";
|
|
String minTemperature = "";
|
|
String maxTemperature = "";
|
|
String maxTemperature = "";
|
|
- if(temperatureRangeArray.length==1){
|
|
|
|
|
|
+ if (temperatureRangeArray.length == 1) {
|
|
minTemperature = temperatureRangeArray[0];
|
|
minTemperature = temperatureRangeArray[0];
|
|
- }
|
|
|
|
- else if(temperatureRangeArray.length==2){
|
|
|
|
|
|
+ } else if (temperatureRangeArray.length == 2) {
|
|
minTemperature = temperatureRangeArray[0];
|
|
minTemperature = temperatureRangeArray[0];
|
|
maxTemperature = temperatureRangeArray[1];
|
|
maxTemperature = temperatureRangeArray[1];
|
|
}
|
|
}
|
|
|
|
|
|
- searchParams.put("minTemperature",minTemperature);
|
|
|
|
- searchParams.put("maxTemperature",maxTemperature);
|
|
|
|
|
|
+ searchParams.put("minTemperature", minTemperature);
|
|
|
|
+ searchParams.put("maxTemperature", maxTemperature);
|
|
}
|
|
}
|
|
|
|
|
|
- Page<PersonDeviceLog> page = personDeviceLogService.pageSearch(searchParams,1,10000,false,sortList);
|
|
|
|
|
|
+ Page<PersonDeviceLog> page = personDeviceLogService.pageSearch(searchParams, 1, 10000, false, sortList);
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
- for(int i=0; i<page.size(); i++){
|
|
|
|
|
|
+ for (int i = 0; i < page.size(); i++) {
|
|
|
|
|
|
PersonDeviceLog personDeviceLog = page.get(i);
|
|
PersonDeviceLog personDeviceLog = page.get(i);
|
|
|
|
|
|
- HSSFRow rowContent = sheet.createRow(i+1);
|
|
|
|
|
|
+ HSSFRow rowContent = sheet.createRow(i + 1);
|
|
|
|
|
|
HSSFCell cellContent1 = rowContent.createCell(0);
|
|
HSSFCell cellContent1 = rowContent.createCell(0);
|
|
- cellContent1.setCellValue(i+1);
|
|
|
|
|
|
+ cellContent1.setCellValue(i + 1);
|
|
|
|
|
|
- String recordTime ="";
|
|
|
|
- if(personDeviceLog.getRecordTime()!=null){
|
|
|
|
|
|
+ String recordTime = "";
|
|
|
|
+ if (personDeviceLog.getRecordTime() != null) {
|
|
recordTime = sdf.format(personDeviceLog.getRecordTime());
|
|
recordTime = sdf.format(personDeviceLog.getRecordTime());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -319,10 +316,9 @@ public class PersonDeviceLogController {
|
|
cellContent2.setCellValue(recordTime);
|
|
cellContent2.setCellValue(recordTime);
|
|
|
|
|
|
String name = "";
|
|
String name = "";
|
|
- if(personDeviceLog.getPerson()!=null){
|
|
|
|
|
|
+ if (personDeviceLog.getPerson() != null) {
|
|
name = personDeviceLog.getPerson().getName();
|
|
name = personDeviceLog.getPerson().getName();
|
|
- }
|
|
|
|
- else{
|
|
|
|
|
|
+ } else {
|
|
name = "匿名用户";
|
|
name = "匿名用户";
|
|
}
|
|
}
|
|
HSSFCell cellContent3 = rowContent.createCell(2);
|
|
HSSFCell cellContent3 = rowContent.createCell(2);
|
|
@@ -338,20 +334,33 @@ public class PersonDeviceLogController {
|
|
|
|
|
|
//五级位置
|
|
//五级位置
|
|
//判断 如果公司没有五级位置 就不做展示
|
|
//判断 如果公司没有五级位置 就不做展示
|
|
- if(companyPositionList.size() > 0) {
|
|
|
|
|
|
+ if (companyPositionList.size() > 0) {
|
|
PersonInfo person = personDeviceLog.getPerson();
|
|
PersonInfo person = personDeviceLog.getPerson();
|
|
- HSSFCell cellContent8 = rowContent.createCell(7);
|
|
|
|
- cellContent8.setCellValue(person.getPosition1());
|
|
|
|
- HSSFCell cellContent9 = rowContent.createCell(8);
|
|
|
|
- cellContent9.setCellValue(person.getPosition2());
|
|
|
|
- HSSFCell cellContent10 = rowContent.createCell(9);
|
|
|
|
- cellContent10.setCellValue(person.getPosition3());
|
|
|
|
- HSSFCell cellContent11 = rowContent.createCell(10);
|
|
|
|
- cellContent11.setCellValue(person.getPosition4());
|
|
|
|
- HSSFCell cellContent12 = rowContent.createCell(11);
|
|
|
|
- cellContent12.setCellValue(person.getPosition5());
|
|
|
|
|
|
+ if(person != null){
|
|
|
|
+ HSSFCell cellContent8 = rowContent.createCell(7);
|
|
|
|
+ if (person.getPosition1() != null) {
|
|
|
|
+ cellContent8.setCellValue(person.getPosition1());
|
|
|
|
+ }
|
|
|
|
+ HSSFCell cellContent9 = rowContent.createCell(8);
|
|
|
|
+ if (person.getPosition1() != null) {
|
|
|
|
+ cellContent9.setCellValue(person.getPosition2());
|
|
|
|
+ }
|
|
|
|
+ HSSFCell cellContent10 = rowContent.createCell(9);
|
|
|
|
+ if (person.getPosition1() != null) {
|
|
|
|
+ cellContent10.setCellValue(person.getPosition3());
|
|
|
|
+ }
|
|
|
|
+ HSSFCell cellContent11 = rowContent.createCell(10);
|
|
|
|
+ if (person.getPosition1() != null) {
|
|
|
|
+ cellContent11.setCellValue(person.getPosition4());
|
|
|
|
+ }
|
|
|
|
+ HSSFCell cellContent12 = rowContent.createCell(11);
|
|
|
|
+ if (person.getPosition1() != null) {
|
|
|
|
+ cellContent12.setCellValue(person.getPosition5());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
sheet.autoSizeColumn(i);
|
|
sheet.autoSizeColumn(i);
|
|
}
|
|
}
|
|
|
|
|