增加区域管理

This commit is contained in:
pengjie 2024-10-11 19:03:06 +08:00
parent 5b8d1d0091
commit e4c5f753db
4 changed files with 13 additions and 11 deletions

View File

@ -123,7 +123,7 @@ public class QualityRegionController {
@ApiOperation(value = "查询区域人数", notes = "查询区域人数", httpMethod = "POST")
@PostMapping(value = "/queryRegionWorker")
public Result<Object> queryRegionWorker(QualityRegion qualityRegion) {
return Result.success(qualityRegionService.queryRegionWorker(qualityRegion));
return Result.success(qualityRegionService.queryRegionWorker(qualityRegion.getId().toString()).size());
}
}

View File

@ -65,5 +65,5 @@ public interface IQualityRegionService extends IService<QualityRegion> {
*/
QualityRegion queryBindRegion();
int queryRegionWorker(QualityRegion qualityRegion);
List<Long> queryRegionWorker(String id);
}

View File

@ -301,10 +301,10 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
}
@Override
public int queryRegionWorker(QualityRegion qualityRegion) {
QualityRegion byId = this.getById(qualityRegion.getId());
public List<Long> queryRegionWorker(String id) {
QualityRegion byId = this.getById(id);
List<SafetyHatData> dataList = safetyHatDataMapper.getNewestDataGroupByProjectSn(byId.getProjectSn());
int workerNum = 0;
List<Long> workerIds = new ArrayList<>();
if (CollUtil.isNotEmpty(dataList)) {
for (SafetyHatData d : dataList) {
boolean inFence = false;
@ -322,11 +322,11 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
inFence = RegionUtil.isInPolygon(d.getLongitude(), d.getLatitude(), lon, lat);
}
if (inFence) {
workerNum++;
workerIds.add(d.getWorkerInfoId());
}
}
}
return workerNum;
return workerIds;
}
private void deleteRegion(Long id) {

View File

@ -55,6 +55,7 @@ import com.zhgd.xmgl.modules.project.entity.bo.ProjectStatisticsCountBo;
import com.zhgd.xmgl.modules.project.mapper.ProjectEnterpriseMapper;
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
import com.zhgd.xmgl.modules.project.service.IProjectUfaceConfigService;
import com.zhgd.xmgl.modules.quality.service.IQualityRegionService;
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatFence;
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatFenceMapper;
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatFenceService;
@ -269,7 +270,7 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
@Autowired
private IExamTrainRecordService examTrainRecordService;
@Autowired
private ISafetyHatFenceService safetyHatFenceService;
private IQualityRegionService qualityRegionService;
/**
* 人员管理分页
*
@ -281,9 +282,10 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
// 区域人员
String qualityRegionId = MapUtils.getString(map, "qualityRegionId");
if (StringUtils.isNotEmpty(qualityRegionId)) {
String workerInFence = safetyHatFenceService.getWorkerInFence(qualityRegionId);
if (StringUtils.isNotEmpty(workerInFence)) {
map.put("workerInfos", workerInFence);
List<Long> workerIds = qualityRegionService.queryRegionWorker(qualityRegionId);
if (workerIds.size() > 0) {
String collect = workerIds.stream().map(String::valueOf).collect(Collectors.joining(","));
map.put("workerInfos", collect);
}
}
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());