|
@@ -7,10 +7,15 @@ import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
|
|
|
import com.jiayue.ipfcst.common.data.entity.ElectricField;
|
|
|
import com.jiayue.ipfcst.common.data.entity.EquipmentAttribute;
|
|
|
import com.jiayue.ipfcst.common.data.entity.ProtocolGatherDataPoint;
|
|
|
+import com.jiayue.ipfcst.common.data.strategy.ApiMyResponse;
|
|
|
import com.jiayue.ipfcst.console.service.ElectricFieldService;
|
|
|
import com.jiayue.ipfcst.dataexchange.service.EquipmentAttributeService;
|
|
|
import com.jiayue.ipfcst.dataexchange.service.ProtocolGatherDataPointService;
|
|
|
import com.jiayue.ipfcst.dataexchange.service.equipmentstatusdata.EquipmentInfoService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -30,6 +35,7 @@ import java.util.Map;
|
|
|
@Slf4j
|
|
|
@RequestMapping("dataExchange")
|
|
|
@RestController
|
|
|
+@Api(value = "EquipmentAttributeController", tags = "设备属性类的对外http接口controller")
|
|
|
public class EquipmentAttributeController {
|
|
|
|
|
|
/**
|
|
@@ -53,6 +59,13 @@ public class EquipmentAttributeController {
|
|
|
* @return ResponseVO 统一返回值
|
|
|
*/
|
|
|
@GetMapping(value = "equipmentAttribute")
|
|
|
+ @ApiOperation(value = "根据条件查询设备属性", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入List<EquipmentAttribute></p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "equipmentAttribute",value = "EquipmentAttribute实体",dataType="EquipmentAttribute")
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO get(@RequestBody EquipmentAttribute equipmentAttribute) {
|
|
|
return ResponseVO.success(equipmentAttributeService.get(equipmentAttribute));
|
|
|
}
|
|
@@ -64,6 +77,13 @@ public class EquipmentAttributeController {
|
|
|
* @return ResponseVO 统一返回值
|
|
|
*/
|
|
|
@GetMapping(value = "getByEquipmentType/{equipmentType}")
|
|
|
+ @ApiOperation(value = "根据设备类型查设备属性", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入List<EquipmentAttribute></p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "equipmentType",value = "设备类型",dataType="String")
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getByEquipmentType(@PathVariable String equipmentType) throws BusinessException {
|
|
|
if (!StringUtils.isNotBlank(equipmentType)) {
|
|
|
throw new BusinessException("必须传入设备类型");
|
|
@@ -84,6 +104,10 @@ public class EquipmentAttributeController {
|
|
|
* @return ResponseVO 统一返回值
|
|
|
*/
|
|
|
@GetMapping(value = "equipmentInfo")
|
|
|
+ @ApiOperation(value = "获取到所有的设备信息", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入设备信息集合</p>"
|
|
|
+ )
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getAllEquipmentInfo() {
|
|
|
List list = new ArrayList();
|
|
|
List<AbstractEquipmentInfo> info = equipmentInfoService.getAllEquipmentInfo();
|
|
@@ -106,6 +130,10 @@ public class EquipmentAttributeController {
|
|
|
* @return {@link ResponseVO}
|
|
|
*/
|
|
|
@GetMapping(value = "getAll")
|
|
|
+ @ApiOperation(value = "获取到所有的设备属性", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入设备属性集合</p>"
|
|
|
+ )
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getAll() {
|
|
|
try {
|
|
|
return ResponseVO.success(this.equipmentAttributeService.getAll());
|
|
@@ -122,6 +150,14 @@ public class EquipmentAttributeController {
|
|
|
* @return {@link ResponseVO}
|
|
|
*/
|
|
|
@GetMapping(value = "getAllByPage/{page}/{size}")
|
|
|
+ @ApiOperation(value = "分页所有设备属性", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入Page<EquipmentAttribute></p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "page",value = "页码",dataType="Integer"),
|
|
|
+ @ApiImplicitParam(name= "size",value = "条数",dataType="Integer")
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getAllByPage(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
|
|
|
try {
|
|
|
return ResponseVO.success(this.equipmentAttributeService.getAllByPage(page,size));
|
|
@@ -141,6 +177,13 @@ public class EquipmentAttributeController {
|
|
|
* @throws BusinessException 业务异常
|
|
|
*/
|
|
|
@GetMapping(value = "equipmentInfo/{equipmentType}")
|
|
|
+ @ApiOperation(value = "根据设备类型找设备获取设备信息", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入List<AbstractEquipmentInfo></p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "equipmentType",value = "设备类型",dataType="String"),
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getEquipmentInfo(@PathVariable String equipmentType) throws BusinessException {
|
|
|
if (!StringUtils.isNotBlank(equipmentType)) {
|
|
|
throw new BusinessException("必须传入设备类型");
|
|
@@ -166,6 +209,10 @@ public class EquipmentAttributeController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/getEquipmentTypeEnum")
|
|
|
+ @ApiOperation(value = "获取设备类型状态枚举", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入EquipmentTypeEnum枚举</p>"
|
|
|
+ )
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getEquipmentTypeEnum(){
|
|
|
List list = new ArrayList<>();
|
|
|
for (EquipmentTypeEnum equipmentTypeEnum : EquipmentTypeEnum.values()) {
|
|
@@ -186,6 +233,10 @@ public class EquipmentAttributeController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/getSubsidiaryEquipmentTypeEnum")
|
|
|
+ @ApiOperation(value = "获取设备类型状态枚举", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入EquipmentTypeEnum枚举</p>"
|
|
|
+ )
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getSubsidiaryEquipmentTypeEnum(){
|
|
|
List list = new ArrayList<>();
|
|
|
for (EquipmentTypeEnum equipmentTypeEnum : EquipmentTypeEnum.SUBSIDIARY_EQUIPMENT_TYPE) {
|
|
@@ -207,11 +258,27 @@ public class EquipmentAttributeController {
|
|
|
* @return ResponseVO 统一返回值
|
|
|
*/
|
|
|
@GetMapping(value = "/{equipmentType}/{page}/{size}")
|
|
|
+ @ApiOperation(value = "分页根据设备类型查设备属性", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入Page<EquipmentAttribute></p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "equipmentType",value = "设备类型",dataType="String"),
|
|
|
+ @ApiImplicitParam(name= "page",value = "页码",dataType="Integer"),
|
|
|
+ @ApiImplicitParam(name= "size",value = "条数",dataType="Integer")
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO findByEquipmentType(@PathVariable String equipmentType,@PathVariable Integer page,@PathVariable Integer size) {
|
|
|
return ResponseVO.success(equipmentAttributeService.findByEquipmentType(equipmentType,page,size));
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/dataPointById/{id}")
|
|
|
+ @ApiOperation(value = "根据ID获取点表", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入List<ProtocolGatherDataPoint></p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "id",value = "主键ID",dataType="Integer"),
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO dataPointById(@PathVariable Integer id) {
|
|
|
ProtocolGatherDataPoint protocolGatherDataPoint = new ProtocolGatherDataPoint();
|
|
|
EquipmentAttribute equipmentAttribute = new EquipmentAttribute();
|
|
@@ -222,11 +289,25 @@ public class EquipmentAttributeController {
|
|
|
}
|
|
|
|
|
|
@PostMapping
|
|
|
+ @ApiOperation(value = "保存设备属性", httpMethod = "POST",
|
|
|
+ notes = "<p>返回ResponseVO对象</p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "equipmentAttribute",value = "EquipmentAttribute实体",dataType="EquipmentAttribute"),
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO saveEquipmentAttribute(@RequestBody EquipmentAttribute equipmentAttribute){
|
|
|
equipmentAttributeService.saveOrUpdateEquipmentAttribute(equipmentAttribute);
|
|
|
return ResponseVO.success(1);
|
|
|
}
|
|
|
@PutMapping
|
|
|
+ @ApiOperation(value = "更新设备属性", httpMethod = "PUT",
|
|
|
+ notes = "<p>返回ResponseVO对象</p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "equipmentAttribute",value = "EquipmentAttribute实体",dataType="EquipmentAttribute"),
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO UpdateEquipmentAttribute(@RequestBody EquipmentAttribute equipmentAttribute){
|
|
|
equipmentAttributeService.saveOrUpdateEquipmentAttribute(equipmentAttribute);
|
|
|
return ResponseVO.success(1);
|
|
@@ -235,6 +316,13 @@ public class EquipmentAttributeController {
|
|
|
* 删除
|
|
|
* */
|
|
|
@DeleteMapping("/{id}")
|
|
|
+ @ApiOperation(value = "删除设备属性", httpMethod = "DELETE",
|
|
|
+ notes = "<p>返回ResponseVO对象</p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "id",value = "主键ID",dataType="String"),
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO delete(@PathVariable String id) throws BusinessException {
|
|
|
equipmentAttributeService.delete(Integer.parseInt(id));
|
|
|
return ResponseVO.success(1);
|