Browse Source

# 站点类型推送FDP配置接口

zhongwei
haungxing 1 year ago
parent
commit
418c1c1023
  1. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java
  2. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/dto/StationPushConfigDTO.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java
  4. 41
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationPushConfigEntity.java
  5. 23
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/StationPushConfigVO.java
  6. 26
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/wrapper/StationPushConfigWrapper.java
  7. 73
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationPushConfigController.java
  8. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationPushConfigMapper.java
  9. 50
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationPushConfigServiceImpl.java
  10. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  11. 19
      hzims-service/operational/src/main/resources/db/1.0.1.sql

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java

@ -4,7 +4,7 @@ import lombok.Getter;
public class OperationalConstants {
public final static String APP_NAME = "hzims-operational-hx";
public final static String APP_NAME = "hzims-operational";

22
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/dto/StationPushConfigDTO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.operational.station.dto;
import com.hnac.hzims.operational.station.entity.StationPushConfigEntity;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @ClassName StationPushConfigDTO
* @description:
* @author: hx
* @create: 2023-07-04 17:11
* @Version 4.0
**/
@Data
@EqualsAndHashCode
@ApiModel("StationPushConfigEntity VO对象")
public class StationPushConfigDTO extends StationPushConfigEntity implements Serializable {
}

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java

@ -24,8 +24,6 @@ import java.time.LocalDateTime;
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("HZIMS_STATION")
@AllArgsConstructor
@NoArgsConstructor
public class StationEntity extends TenantEntity implements Serializable {
private static final long serialVersionUID = -4381363806216436570L;
@ApiModelProperty("所属领域(来源于字典表如水电)")

41
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationPushConfigEntity.java

@ -0,0 +1,41 @@
package com.hnac.hzims.operational.station.entity;
/**
* @ClassName StationPushConfiguration
* @description:
* @author: hx
* @create: 2023-07-04 16:15
* @Version 4.0
**/
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.tenant.mp.TenantEntity;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
@ApiModel("站点类型推送FDP配置")
@TableName("hzims_station_push_configuration")
@EqualsAndHashCode
public class StationPushConfigEntity extends TenantEntity implements Serializable {
@ApiModelProperty("站点类型")
@QueryField(condition = SqlCondition.EQUAL)
@NotNull(message = "站点类型不能为空")
private Integer stationType;
@ApiModelProperty("站点类型名称")
private String stationTypeName;
@ApiModelProperty("是否推送至FDP")
@QueryField(condition = SqlCondition.EQUAL)
@NotNull(message = "是否推送不能为空")
private Boolean isPush;
}

23
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/StationPushConfigVO.java

@ -0,0 +1,23 @@
package com.hnac.hzims.operational.station.vo;
import com.hnac.hzims.operational.station.entity.StationPushConfigEntity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @ClassName StationPushConfigVO
* @description:
* @author: hx
* @create: 2023-07-04 17:08
* @Version 4.0
**/
@Data
@EqualsAndHashCode
@ApiModel("StationPushConfigEntity VO对象")
public class StationPushConfigVO extends StationPushConfigEntity implements Serializable {
}

26
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/wrapper/StationPushConfigWrapper.java

@ -0,0 +1,26 @@
package com.hnac.hzims.operational.station.wrapper;
import com.hnac.hzims.operational.station.entity.StationPushConfigEntity;
import com.hnac.hzims.operational.station.vo.StationPushConfigVO;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
/**
* @ClassName StationPushConfigWrapper
* @description:
* @author: hx
* @create: 2023-07-04 17:12
* @Version 4.0
**/
public class StationPushConfigWrapper extends BaseEntityWrapper<StationPushConfigEntity, StationPushConfigVO> {
public static StationPushConfigWrapper build() {
return new StationPushConfigWrapper();
}
@Override
public StationPushConfigVO entityVO(StationPushConfigEntity entity) {
StationPushConfigVO stationPushConfigVO = BeanUtil.copy(entity,StationPushConfigVO.class);
return stationPushConfigVO;
}
}

73
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationPushConfigController.java

@ -0,0 +1,73 @@
package com.hnac.hzims.operational.station.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.station.dto.StationPushConfigDTO;
import com.hnac.hzims.operational.station.entity.StationPushConfigEntity;
import com.hnac.hzims.operational.station.service.IStationPushConfigService;
import com.hnac.hzims.operational.station.vo.StationPushConfigVO;
import com.hnac.hzims.operational.station.wrapper.StationPushConfigWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* @ClassName StationPushConfigController
* @description:
* @author: hx
* @create: 2023-07-04 17:02
* @Version 4.0
**/
@Api(value = "站点类型推送FDP配置管理",tags = "站点类型推送FDP配置管理")
@RestController
@RequestMapping("/station/push/config")
@AllArgsConstructor
public class StationPushConfigController extends BladeController {
private final IStationPushConfigService configService;
@GetMapping("/detail/{id}")
@ApiOperation("查询详情")
@ApiOperationSupport(order = 1)
public R<StationPushConfigVO> detail(@PathVariable String id) {
return R.data(StationPushConfigWrapper.build().entityVO(configService.getById(id)));
}
@GetMapping("/list")
@ApiOperation("查询列表")
@ApiOperationSupport(order = 2)
public R<List<StationPushConfigVO>> list(StationPushConfigDTO request) {
return R.data(configService.list(request));
}
@PostMapping("/save")
@ApiOperation("保存站点推送配置")
@ApiOperationSupport(order = 3)
public R save(@RequestBody @Valid StationPushConfigDTO request) {
return R.status(configService.save(BeanUtil.copy(request, StationPushConfigEntity.class)));
}
@DeleteMapping("/detail/{ids}")
@ApiOperation("删除配置,按逗号分割")
@ApiOperationSupport(order = 4)
public R remove(@PathVariable String ids) {
return R.status(configService.removeByIds(Func.toLongList(",",ids)));
}
@GetMapping("listPage")
@ApiOperation("分页查询")
@ApiOperationSupport(order = 5)
public R<IPage<StationPushConfigVO>> listPage(Query query, StationPushConfigDTO request) {
return R.data(configService.listPage(query,request));
}
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationPushConfigMapper.java

@ -0,0 +1,8 @@
package com.hnac.hzims.operational.station.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.operational.station.entity.StationPushConfigEntity;
public interface StationPushConfigMapper extends BaseMapper<StationPushConfigEntity> {
}

50
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationPushConfigServiceImpl.java

@ -0,0 +1,50 @@
package com.hnac.hzims.operational.station.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.station.dto.StationPushConfigDTO;
import com.hnac.hzims.operational.station.entity.StationPushConfigEntity;
import com.hnac.hzims.operational.station.mapper.StationPushConfigMapper;
import com.hnac.hzims.operational.station.service.IStationPushConfigService;
import com.hnac.hzims.operational.station.vo.StationPushConfigVO;
import com.hnac.hzims.operational.station.wrapper.StationPushConfigWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName StationPushConfigServiceImpl
* @description:
* @author: hx
* @create: 2023-07-04 16:24
* @Version 4.0
**/
@Service
@AllArgsConstructor
@Slf4j
public class StationPushConfigServiceImpl extends BaseServiceImpl<StationPushConfigMapper, StationPushConfigEntity> implements IStationPushConfigService {
@Override
public List<StationPushConfigVO> list(StationPushConfigDTO request) {
LambdaQueryWrapper<StationPushConfigEntity> lambda = Condition.getQueryWrapper(BeanUtil.copy(request, StationPushConfigEntity.class)).lambda();
lambda.eq(Func.isNotEmpty(request.getStatus()),StationPushConfigEntity::getStatus,request.getStatus());
return StationPushConfigWrapper.build().listVO(this.list(lambda));
}
@Override
public IPage<StationPushConfigVO> listPage(Query query, StationPushConfigDTO request) {
LambdaQueryWrapper<StationPushConfigEntity> lambda = Condition.getQueryWrapper(BeanUtil.copy(request, StationPushConfigEntity.class)).lambda();
lambda.eq(Func.isNotEmpty(request.getStatus()),StationPushConfigEntity::getStatus,request.getStatus());
IPage page = this.page(Condition.getPage(query), lambda);
page.setRecords(StationPushConfigWrapper.build().listVO(page.getRecords()));
return page;
}
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -16,6 +16,7 @@ import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.mapper.ControlUsersMapper;
import com.hnac.hzims.operational.station.mapper.StationMapper;
import com.hnac.hzims.operational.station.service.IStationAttributeService;
import com.hnac.hzims.operational.station.service.IStationPushConfigService;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.HzimsStationCountVo;
import com.hnac.hzims.operational.station.vo.StationAndDeptVo;
@ -71,6 +72,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
private final BladeLogger logger;
private final IQuestionClient questionClient;
private final IStationAttributeService stationAttributeService;
private final IStationPushConfigService stationPushConfigService;
@Override
public void buildStation(StationEntity req) {
@ -96,6 +98,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
Assert.isTrue(this.saveOrUpdate(req), () -> {
throw new ServiceException("创建/修改站点信息失败!");
});
this.update(Wrappers.<StationEntity>lambdaUpdate().set(Func.isNotEmpty(req.getIsAbroad()),StationEntity::getIsAbroad, req.getIsAbroad()).eq(StationEntity::getId, req.getId()));
// 如果设备数据来源未选定其他 则进行站点初始化操作
if (!(StationConstants.FILL.equals(req.getDataOrigin()) || StationConstants.HZ3000_OTHER.equals(req.getDataSource()))) {
new Thread(() -> questionClient.submitStationInfo(req.getCode(), ""), "智能诊断站点推送").start();

19
hzims-service/operational/src/main/resources/db/1.0.1.sql

@ -1,2 +1,19 @@
-- 站点表添加是否为国外
alter table `hzims_station` add column `is_abroad` TINYINT NULL comment '站点是否为国外 1:是;0:否';
alter table `hzims_station` add column `is_abroad` TINYINT(1) NULL comment '站点是否为国外 1:是;0:否';
-- 添加站点推送FDP配置表
CREATE TABLE IF NOT EXISTS `hzims_station_push_configuration` (
`ID` bigint(20) NOT NULL COMMENT '主键ID',
`station_type` TINYINT(2) NULL DEFAULT NULL COMMENT '站点类型',
`station_type_name` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点类型名称',
`is_push` TINYINT(2) NULL DEFAULT NULL COMMENT '是否推送至FDP',
`TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
`CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间',
`CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
`UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
`IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
`STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ',
`CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic comment='站点类型推送FDP配置表';
SET FOREIGN_KEY_CHECKS = 1;

Loading…
Cancel
Save