|
|
@@ -2,13 +2,18 @@ package com.energy.manage.service.controller.windfield;
|
|
|
|
|
|
|
|
|
import com.energy.manage.common.base.Page;
|
|
|
+import com.energy.manage.common.po.anemometertower.AnemometerTowerPO;
|
|
|
+import com.energy.manage.common.po.windfield.WindFieldPO;
|
|
|
import com.energy.manage.common.reponse.ResultResp;
|
|
|
import com.energy.manage.service.config.annotations.UserLoginToken;
|
|
|
import com.energy.manage.service.domain.dto.windfield.*;
|
|
|
import com.energy.manage.service.domain.vo.company.WindCompanyPageVo;
|
|
|
+import com.energy.manage.service.domain.vo.windfield.WindFieldNameVo;
|
|
|
import com.energy.manage.service.domain.vo.windfield.WindFieldPageVo;
|
|
|
import com.energy.manage.service.domain.vo.windfield.WindFieldVo;
|
|
|
import com.energy.manage.service.domain.vo.windrelation.WindRelationVo;
|
|
|
+import com.energy.manage.service.service.windenginegroup.WindEngineGroupService;
|
|
|
+import com.energy.manage.service.service.windfield.WindFieldResourceService;
|
|
|
import com.energy.manage.service.service.windfield.WindFieldService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -17,7 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Slf4j
|
|
|
@RestController
|
|
|
@@ -29,11 +36,24 @@ public class WindFieldController {
|
|
|
@Autowired
|
|
|
private WindFieldService windFieldService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WindEngineGroupService windEngineGroupService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WindFieldResourceService windFieldResourceService;
|
|
|
+
|
|
|
|
|
|
@UserLoginToken
|
|
|
@PostMapping(value = "/createWindField")
|
|
|
@ApiOperation(value = "创建风场信息")
|
|
|
- public ResultResp createWindField(@RequestBody WindFieldDto windFieldDto) {
|
|
|
+ public ResultResp createWindField(@RequestBody @Valid WindFieldDto windFieldDto) {
|
|
|
+
|
|
|
+ // 校验风场名称是否存在
|
|
|
+ WindFieldPO po = windFieldService.getWindFieldPOByFieldName(windFieldDto.getFieldName());
|
|
|
+ if (po != null) {
|
|
|
+ return ResultResp.FAIL("风场名称已经存在!");
|
|
|
+ }
|
|
|
+
|
|
|
boolean flg = windFieldService.createWindField(windFieldDto);
|
|
|
return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
|
|
|
}
|
|
|
@@ -43,46 +63,22 @@ public class WindFieldController {
|
|
|
@PostMapping(value = "/windFieldImportData")
|
|
|
@ApiOperation(value = "导入风场信息")
|
|
|
public ResultResp windFieldImportData(@RequestPart MultipartFile file,
|
|
|
- @RequestParam(required = true) String companyCode,
|
|
|
- @RequestParam(required = true) Integer provinceId,
|
|
|
- @RequestParam(required = true) String provinceName,
|
|
|
- @RequestParam(required = true) Integer cityId,
|
|
|
- @RequestParam(required = true) String cityName,
|
|
|
- @RequestParam(required = true) String areaCode) {
|
|
|
+ @RequestParam(required = true) String companyCode) {
|
|
|
|
|
|
WindFieldImportDataDto windFieldImportDataDto = new WindFieldImportDataDto();
|
|
|
windFieldImportDataDto.setCompanyCode(companyCode);
|
|
|
- windFieldImportDataDto.setProvinceId(provinceId);
|
|
|
- windFieldImportDataDto.setProvinceName(provinceName);
|
|
|
- windFieldImportDataDto.setCityId(cityId);
|
|
|
- windFieldImportDataDto.setCityName(cityName);
|
|
|
- windFieldImportDataDto.setAreaCode(areaCode);
|
|
|
|
|
|
- boolean flg = windFieldService.windFieldImportData(file, windFieldImportDataDto);
|
|
|
- return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
|
|
|
+ return windFieldService.windFieldImportData(file, windFieldImportDataDto);
|
|
|
}
|
|
|
|
|
|
+ @Deprecated
|
|
|
@UserLoginToken
|
|
|
@PostMapping(value = "/afreshWindFieldImportData")
|
|
|
@ApiOperation(value = "重新导入风场信息")
|
|
|
public ResultResp afreshWindFieldImportData(@RequestPart MultipartFile file,
|
|
|
- @RequestParam(required = true) String companyCode,
|
|
|
- @RequestParam(required = true) Integer provinceId,
|
|
|
- @RequestParam(required = true) String provinceName,
|
|
|
- @RequestParam(required = true) Integer cityId,
|
|
|
- @RequestParam(required = true) String cityName,
|
|
|
- @RequestParam(required = true) String areaCode) {
|
|
|
-
|
|
|
- WindFieldImportDataDto windFieldImportDataDto = new WindFieldImportDataDto();
|
|
|
- windFieldImportDataDto.setCompanyCode(companyCode);
|
|
|
- windFieldImportDataDto.setProvinceId(provinceId);
|
|
|
- windFieldImportDataDto.setProvinceName(provinceName);
|
|
|
- windFieldImportDataDto.setCityId(cityId);
|
|
|
- windFieldImportDataDto.setCityName(cityName);
|
|
|
- windFieldImportDataDto.setAreaCode(areaCode);
|
|
|
+ @RequestParam(required = true) String companyCode) {
|
|
|
|
|
|
- boolean flg = windFieldService.afreshWindFieldImportData(file, windFieldImportDataDto);
|
|
|
- return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
|
|
|
+ return ResultResp.FAIL("此接口已作废!");
|
|
|
}
|
|
|
|
|
|
@UserLoginToken
|
|
|
@@ -96,17 +92,28 @@ public class WindFieldController {
|
|
|
|
|
|
@UserLoginToken
|
|
|
@PostMapping(value = "/delWindFieldById")
|
|
|
- @ApiOperation(value = "通过风场编号删除风场")
|
|
|
- public ResultResp delWindFieldById(@RequestParam(required = true) String fieldCode) {
|
|
|
-
|
|
|
- boolean flg = windFieldService.delWindFieldById(fieldCode);
|
|
|
+ @ApiOperation(value = "删除风场")
|
|
|
+ public ResultResp delWindFieldById(@RequestBody @Valid WindFieldCodeDto windFieldCodeDto) {
|
|
|
+ if (windEngineGroupService.getWindEngineGroupCountByField(windFieldCodeDto.getFieldCode()) <= 0) {
|
|
|
+ return ResultResp.FAIL("风场下有绑定风机,不可删除!");
|
|
|
+ }
|
|
|
+ boolean flg = windFieldService.delWindFieldById(windFieldCodeDto.getFieldCode());
|
|
|
return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
|
|
|
}
|
|
|
|
|
|
@UserLoginToken
|
|
|
+ @PostMapping(value = "/getWindFieldVos")
|
|
|
+ @ApiOperation(value = "通过企业编号查询关联风场")
|
|
|
+ public ResultResp<List<WindFieldVo>> getWindFieldVos(@RequestParam(required = true) String companyCode) {
|
|
|
+
|
|
|
+ List<WindFieldVo> list = windFieldService.getWindFieldVos(companyCode);
|
|
|
+ return ResultResp.SUCCESS(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @UserLoginToken
|
|
|
@PostMapping(value = "/updateWindFieldStateById")
|
|
|
@ApiOperation(value = "修改状态")
|
|
|
- public ResultResp updateWindFieldStateById(@RequestBody WindFieldUpdateStateDto windFieldUpdateStateDto) {
|
|
|
+ public ResultResp updateWindFieldStateById(@RequestBody @Valid WindFieldUpdateStateDto windFieldUpdateStateDto) {
|
|
|
|
|
|
boolean flg = windFieldService.updateWindFieldStateById(windFieldUpdateStateDto);
|
|
|
return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
|
|
|
@@ -115,7 +122,7 @@ public class WindFieldController {
|
|
|
@UserLoginToken
|
|
|
@PostMapping(value = "/getWindFieldVo")
|
|
|
@ApiOperation(value = "查询风场对象")
|
|
|
- public ResultResp getWindFieldVo(@RequestBody WindFieldCodeDto windFieldCodeDto) {
|
|
|
+ public ResultResp<WindFieldVo> getWindFieldVo(@RequestBody @Valid WindFieldCodeDto windFieldCodeDto) {
|
|
|
WindFieldVo vo = windFieldService.getWindFieldVo(windFieldCodeDto);
|
|
|
return ResultResp.SUCCESS(vo);
|
|
|
}
|
|
|
@@ -123,7 +130,7 @@ public class WindFieldController {
|
|
|
@UserLoginToken
|
|
|
@PostMapping(value = "/WindFieldDto")
|
|
|
@ApiOperation(value = "更新风场信息")
|
|
|
- public ResultResp updateWindField(@RequestBody WindFieldUpdateDto windFieldUpdateDto) {
|
|
|
+ public ResultResp updateWindField(@RequestBody @Valid WindFieldUpdateDto windFieldUpdateDto) {
|
|
|
boolean flg = windFieldService.updateWindField(windFieldUpdateDto);
|
|
|
return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
|
|
|
}
|
|
|
@@ -131,8 +138,35 @@ public class WindFieldController {
|
|
|
@UserLoginToken
|
|
|
@PostMapping(value = "/getWindFieldTree")
|
|
|
@ApiOperation(value = "查询风场树")
|
|
|
- public ResultResp<List<WindRelationVo>> getWindFieldTree() {
|
|
|
- List<WindRelationVo> list = windFieldService.getWindFieldTree();
|
|
|
+ public ResultResp<List<Map<String, Object>>> getWindFieldTree() {
|
|
|
+ List<Map<String, Object>> list = windFieldService.getWindFieldTree();
|
|
|
+ return ResultResp.SUCCESS(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @UserLoginToken
|
|
|
+ @PostMapping(value = "/saveWindFieldResource")
|
|
|
+ @ApiOperation(value = "保存上传风场资源文件")
|
|
|
+ public ResultResp saveWindFieldResource(@RequestBody @Valid WindFieldResourceCreateDto windFieldResourceCreateDto) {
|
|
|
+ boolean flg = windFieldResourceService.saveWindFieldResource(windFieldResourceCreateDto);
|
|
|
+ return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @UserLoginToken
|
|
|
+ @PostMapping(value = "/delWindFieldResource")
|
|
|
+ @ApiOperation(value = "删除风场资源文件")
|
|
|
+ public ResultResp delWindFieldResource(@RequestBody @Valid WindFieldResourceDelDto windFieldResourceDelDto) {
|
|
|
+ boolean flg = windFieldResourceService.delWindFieldResource(windFieldResourceDelDto);
|
|
|
+ return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @UserLoginToken
|
|
|
+ @PostMapping(value = "/getWindFieldNames")
|
|
|
+ @ApiOperation(value = "查询风场集合")
|
|
|
+ public ResultResp<List<WindFieldNameVo>> getWindFieldNames() {
|
|
|
+ List<WindFieldNameVo> list = windFieldService.getWindFieldNames();
|
|
|
return ResultResp.SUCCESS(list);
|
|
|
}
|
|
|
|