|
@@ -7,6 +7,7 @@ import com.zoniot.ccrc.commom.model.DeviceData;
|
|
|
import com.zoniot.ccrc.commom.model.Pagination;
|
|
|
import com.zoniot.ccrc.commom.utils.ExcelUtil;
|
|
|
import com.zoniot.ccrc.commom.utils.UserUtil;
|
|
|
+import com.zoniot.ccrc.dao.OrganizationMapper;
|
|
|
import com.zoniot.ccrc.dto.BuildingSelectDto;
|
|
|
import com.zoniot.ccrc.dto.BuildingSelectInfoDto;
|
|
|
import com.zoniot.ccrc.dto.DeviceDto;
|
|
@@ -33,6 +34,10 @@ public class DeviceServiceImpl implements DeviceService{
|
|
|
private DeviceMapper deviceMapper;
|
|
|
@Autowired
|
|
|
private BuildingService buildingService;
|
|
|
+ @Resource
|
|
|
+ private OrganizationMapper organizationMapper;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public int insertSelective(Device record) {
|
|
@@ -56,17 +61,28 @@ public class DeviceServiceImpl implements DeviceService{
|
|
|
|
|
|
@Override
|
|
|
public Pagination<DeviceDto> pageList(Integer sysId, Integer deviceTypeId, Integer orgId, Integer province, Integer city, Integer region, Integer communityId, Integer buildingId, String deviceNo, String clientName, String locDesc, Integer status, Integer valveStatus, String sortColumn, String sortOrder, int pageNum, int pageSize) {
|
|
|
+
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ Integer userId = null;
|
|
|
+ List<Integer> communityIds = null;
|
|
|
+ if (loginUser.getType() == 4) userId = loginUser.getId();
|
|
|
+ if (orgId != null) communityIds = organizationMapper.findCommunityIds(orgId);
|
|
|
+
|
|
|
+
|
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
|
- List<DeviceDto> list = deviceMapper.getList(loginUser.getSiteId(),null,sysId,deviceTypeId,orgId,province,city,region,communityId,buildingId,deviceNo,clientName,locDesc,status,valveStatus,null,sortColumn,sortOrder);
|
|
|
+ List<DeviceDto> list = deviceMapper.getList(loginUser.getSiteId(),userId,sysId,deviceTypeId,orgId,province,city,region,communityId,buildingId,deviceNo,clientName,locDesc,status,valveStatus,communityIds,sortColumn,sortOrder);
|
|
|
return new Pagination<>(list);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void getDeviceListExcel(Integer sysId, Integer deviceTypeId, Integer orgId, Integer province, Integer city, Integer region, Integer communityId, Integer buildingId, String deviceNo, String clientName, String locDesc, Integer status, Integer valveStatus, String sortColumn, String sortOrder, HttpServletResponse httpServletResponse) {
|
|
|
- String title = "历史数据";
|
|
|
+ String title = "设备列表";
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
- List<DeviceDto> list = deviceMapper.getList(loginUser.getSiteId(),null,sysId,deviceTypeId,orgId,province,city,region,communityId,buildingId,deviceNo,clientName,locDesc,status,valveStatus,null,sortColumn,sortOrder);
|
|
|
+ Integer userId = null;
|
|
|
+ List<Integer> communityIds = null;
|
|
|
+ if (loginUser.getType() == 4) userId = loginUser.getId();
|
|
|
+ if (orgId != null) communityIds = organizationMapper.findCommunityIds(orgId);
|
|
|
+ List<DeviceDto> list = deviceMapper.getList(loginUser.getSiteId(),userId,sysId,deviceTypeId,orgId,province,city,region,communityId,buildingId,deviceNo,clientName,locDesc,status,valveStatus,communityIds,sortColumn,sortOrder);
|
|
|
|
|
|
//水表档案号、水表电子号、设备状态、当前读数、机构、客户编号、客户名称、手机号、标签、建筑、安装地址、网格员
|
|
|
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
@@ -116,15 +132,19 @@ public class DeviceServiceImpl implements DeviceService{
|
|
|
@Override
|
|
|
public List<BuildingSelectDto> deviceAreaList(Integer sysId, Integer deviceTypeId, Integer orgId, Integer province, Integer city, Integer region, Integer communityId, Integer buildingId, String deviceNo, String clientName, String locDesc, Integer status, Integer valveStatus) {
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
- //查询用户数据项下的建筑列表
|
|
|
- List<BuildingSelectInfoDto> list = deviceMapper.deviceAreaList(loginUser.getSiteId(),null,sysId,deviceTypeId,orgId,province,city,region,communityId,buildingId,deviceNo,clientName,locDesc,status,valveStatus,null);
|
|
|
+ Integer userId = null;
|
|
|
+ List<Integer> communityIds = null;
|
|
|
+ if (loginUser.getType() == 4) userId = loginUser.getId();
|
|
|
+ if (orgId != null) communityIds = organizationMapper.findCommunityIds(orgId);
|
|
|
+ List<BuildingSelectInfoDto> list = deviceMapper.deviceAreaList(loginUser.getSiteId(),userId,sysId,deviceTypeId,orgId,province,city,region,communityId,buildingId,deviceNo,clientName,locDesc,status,valveStatus,communityIds);
|
|
|
return buildingService.areaList(list);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void syncDevice(DeviceData deviceData) {
|
|
|
- // TODO: 2021/3/18 查询站点
|
|
|
- Integer siteId = 1;
|
|
|
+
|
|
|
+ Integer siteId = organizationMapper.findSiteId(deviceData.getCustomerId());
|
|
|
+ //Integer siteId = 1;
|
|
|
|
|
|
Device device = new Device();
|
|
|
device.setId(deviceData.getId());
|
|
@@ -148,7 +168,7 @@ public class DeviceServiceImpl implements DeviceService{
|
|
|
device.setDateCreate(deviceData.getDateCreate());
|
|
|
device.setUpdateBy("system");
|
|
|
device.setDateUpdate(deviceData.getDateUpdate());
|
|
|
- log.info("device {}", JSON.toJSONString(device));
|
|
|
+ log.info("syncDevice device {}", JSON.toJSONString(device));
|
|
|
deviceMapper.replaceSelective(device);
|
|
|
}
|
|
|
}
|