|
@@ -4,11 +4,17 @@ package com.ruoyi.gas.controller;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.gas.domain.GNetworkRelation;
|
|
|
import com.ruoyi.gas.domain.GRegulatorBoxRelation;
|
|
|
+import com.ruoyi.gas.domain.GValveWellPosition;
|
|
|
+import com.ruoyi.gas.domain.bo.GAreaBo;
|
|
|
+import com.ruoyi.gas.domain.bo.GNetworkRelationBo;
|
|
|
import com.ruoyi.gas.domain.bo.GPressureRegulatingBoxBo;
|
|
|
+import com.ruoyi.gas.domain.bo.GValveWellPositionBo;
|
|
|
+import com.ruoyi.gas.domain.vo.GAreaVo;
|
|
|
import com.ruoyi.gas.domain.vo.GPressureRegulatingBoxVo;
|
|
|
-import com.ruoyi.gas.service.IGPressureRegulatingBoxService;
|
|
|
-import com.ruoyi.gas.service.IGRegulatorBoxRelationService;
|
|
|
+import com.ruoyi.gas.domain.vo.GValveWellPositionVo;
|
|
|
+import com.ruoyi.gas.service.*;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -34,14 +40,18 @@ public class GCommonController extends BaseController {
|
|
|
private IGPressureRegulatingBoxService pressureRegulatingBoxService;
|
|
|
@Autowired
|
|
|
private IGRegulatorBoxRelationService regulatorBoxRelationService;
|
|
|
+ @Autowired
|
|
|
+ private IGNetworkRelationService networkRelationService;
|
|
|
+ @Autowired
|
|
|
+ private IGAreaService areaService;
|
|
|
|
|
|
/**
|
|
|
* 洗数据
|
|
|
*/
|
|
|
- @GetMapping("/refresh")
|
|
|
+ @GetMapping("/refreshA")
|
|
|
public AjaxResult refresh() {
|
|
|
GPressureRegulatingBoxBo gPressureRegulatingBoxBo = new GPressureRegulatingBoxBo();
|
|
|
- //查询所有
|
|
|
+ //查询所有调压箱
|
|
|
List<GPressureRegulatingBoxVo> list = pressureRegulatingBoxService.queryList(gPressureRegulatingBoxBo);
|
|
|
List<GRegulatorBoxRelation> relations = new ArrayList<>();
|
|
|
list.forEach(item->{
|
|
@@ -68,12 +78,70 @@ public class GCommonController extends BaseController {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 我的
|
|
|
- */
|
|
|
- @GetMapping("/myData")
|
|
|
- public AjaxResult myData() {
|
|
|
- Function<Map<String,Object>, AjaxResult<List<Object>>> function;
|
|
|
+ @GetMapping("/refreshB")
|
|
|
+ public AjaxResult refreshB() {
|
|
|
+ GAreaBo gPressureRegulatingBoxBo = new GAreaBo();
|
|
|
+ //查询所有调压箱
|
|
|
+ List<GAreaVo> list = areaService.queryList(gPressureRegulatingBoxBo);
|
|
|
+ List<GNetworkRelation> relations = new ArrayList<>();
|
|
|
+ list.forEach(item->{
|
|
|
+ if (StringUtils.isNotBlank(item.getUserId())){
|
|
|
+ List<String> inspectors = Arrays.asList(item.getUserId().split(","));
|
|
|
+ Long boxId = item.getId();
|
|
|
+ String createBy = item.getCreateBy();
|
|
|
+ Date createTime = item.getCreateTime();
|
|
|
+ if (!ObjectUtils.isEmpty(inspectors)){
|
|
|
+ inspectors.forEach(o->{
|
|
|
+ GNetworkRelation entity = new GNetworkRelation();
|
|
|
+ entity.setRegulatorBoxId(boxId);
|
|
|
+ entity.setUserId(o);
|
|
|
+ entity.setCreateBy(o);
|
|
|
+ entity.setCreateTime(createTime);
|
|
|
+ relations.add(entity);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!ObjectUtils.isEmpty(relations)){
|
|
|
+ networkRelationService.saveBatch(relations);
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
+ @Autowired
|
|
|
+ private IGValveWellPositionService valveWellPositionService;
|
|
|
+ @Autowired
|
|
|
+ private IGUserService igUserService;
|
|
|
+
|
|
|
+ @GetMapping("/refreshC")
|
|
|
+ public AjaxResult refreshC() {
|
|
|
+ GValveWellPositionBo valveWellPositionBo = new GValveWellPositionBo();
|
|
|
+ //查询所有调压箱
|
|
|
+ List<GValveWellPositionVo> list = valveWellPositionService.queryList(valveWellPositionBo);
|
|
|
+ List<GNetworkRelation> relations = new ArrayList<>();
|
|
|
+ list.forEach(item->{
|
|
|
+ if (StringUtils.isNotBlank(item.getTeam())){
|
|
|
+ //该队的所有人员
|
|
|
+ List<Long> inspectors = new ArrayList<>();
|
|
|
+ inspectors = igUserService.getByRanks(item.getTeam());
|
|
|
+ Long boxId = item.getId();
|
|
|
+ String createBy = item.getCreateBy();
|
|
|
+ Date createTime = item.getCreateTime();
|
|
|
+ if (!ObjectUtils.isEmpty(inspectors)){
|
|
|
+ inspectors.forEach(o->{
|
|
|
+ GNetworkRelation entity = new GNetworkRelation();
|
|
|
+ entity.setRegulatorBoxId(boxId);
|
|
|
+ entity.setUserId(String.valueOf(o));
|
|
|
+ entity.setCreateBy(String.valueOf(o));
|
|
|
+ entity.setCreateTime(createTime);
|
|
|
+ relations.add(entity);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!ObjectUtils.isEmpty(relations)){
|
|
|
+ networkRelationService.saveBatch(relations);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|