|
@@ -4,12 +4,18 @@ package com.jpsoft.smart.modules.base.controller;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.util.StringUtil;
|
|
import com.github.pagehelper.util.StringUtil;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
|
|
+import com.jpsoft.smart.modules.base.entity.DeviceInfo;
|
|
import com.jpsoft.smart.modules.base.entity.PersonDeviceLog;
|
|
import com.jpsoft.smart.modules.base.entity.PersonDeviceLog;
|
|
|
|
+import com.jpsoft.smart.modules.base.service.DeviceInfoService;
|
|
import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
|
|
import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
import com.jpsoft.smart.modules.common.utils.PojoUtils;
|
|
import com.jpsoft.smart.modules.common.utils.PojoUtils;
|
|
|
|
+import com.jpsoft.smart.modules.sys.entity.Role;
|
|
|
|
+import com.jpsoft.smart.modules.sys.entity.User;
|
|
|
|
+import com.jpsoft.smart.modules.sys.service.RoleService;
|
|
|
|
+import com.jpsoft.smart.modules.sys.service.UserService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -43,10 +49,15 @@ public class PersonDeviceLogController {
|
|
@Autowired
|
|
@Autowired
|
|
private OSSConfig ossConfig;
|
|
private OSSConfig ossConfig;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserService userService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private DeviceInfoService deviceInfoService;
|
|
|
|
+
|
|
@ApiOperation(value="列表")
|
|
@ApiOperation(value="列表")
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
@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"),
|
|
@@ -55,7 +66,6 @@ public class PersonDeviceLogController {
|
|
|
|
|
|
})
|
|
})
|
|
public MessageResult<Map> pageList(
|
|
public MessageResult<Map> pageList(
|
|
- String companyId,
|
|
|
|
String deviceNo,String aliasName,String personName,
|
|
String deviceNo,String aliasName,String personName,
|
|
String timeRanges,String temperatureRanges,
|
|
String timeRanges,String temperatureRanges,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@@ -72,8 +82,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);
|
|
|
|
+ String deviceIds ="";
|
|
|
|
+ for (DeviceInfo deviceInfo:deviceInfoList) {
|
|
|
|
+ deviceIds += deviceInfo.getId()+",";
|
|
|
|
+ }
|
|
|
|
+ if(StringUtil.isNotEmpty(deviceIds)){
|
|
|
|
+ deviceIds = deviceIds.substring(0,deviceIds.lastIndexOf(","));
|
|
|
|
+ searchParams.put("deviceIds","("+deviceIds+")");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if(StringUtil.isNotEmpty(deviceNo)){
|
|
if(StringUtil.isNotEmpty(deviceNo)){
|
|
searchParams.put("deviceNo","%"+deviceNo+"%");
|
|
searchParams.put("deviceNo","%"+deviceNo+"%");
|