diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java index 22a4998..93810fc 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/OperationalConstants.java +++ b/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"; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/dto/StationPushConfigDTO.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/dto/StationPushConfigDTO.java new file mode 100644 index 0000000..18e4568 --- /dev/null +++ b/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 { + +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java index fe0fd23..1707a43 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java +++ b/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("所属领域(来源于字典表如水电)") diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationPushConfigEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationPushConfigEntity.java new file mode 100644 index 0000000..1a12028 --- /dev/null +++ b/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; + +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/StationPushConfigVO.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/StationPushConfigVO.java new file mode 100644 index 0000000..32b958f --- /dev/null +++ b/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 { + +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/wrapper/StationPushConfigWrapper.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/wrapper/StationPushConfigWrapper.java new file mode 100644 index 0000000..1eeb1fe --- /dev/null +++ b/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 { + + public static StationPushConfigWrapper build() { + return new StationPushConfigWrapper(); + } + + @Override + public StationPushConfigVO entityVO(StationPushConfigEntity entity) { + StationPushConfigVO stationPushConfigVO = BeanUtil.copy(entity,StationPushConfigVO.class); + return stationPushConfigVO; + } +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationPushConfigController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationPushConfigController.java new file mode 100644 index 0000000..91e91ac --- /dev/null +++ b/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 detail(@PathVariable String id) { + return R.data(StationPushConfigWrapper.build().entityVO(configService.getById(id))); + } + + @GetMapping("/list") + @ApiOperation("查询列表") + @ApiOperationSupport(order = 2) + public R> 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> listPage(Query query, StationPushConfigDTO request) { + return R.data(configService.listPage(query,request)); + } + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationPushConfigMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationPushConfigMapper.java new file mode 100644 index 0000000..8e13013 --- /dev/null +++ b/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 { + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationPushConfigServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationPushConfigServiceImpl.java new file mode 100644 index 0000000..853c729 --- /dev/null +++ b/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 implements IStationPushConfigService { + + @Override + public List list(StationPushConfigDTO request) { + LambdaQueryWrapper 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 listPage(Query query, StationPushConfigDTO request) { + LambdaQueryWrapper 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; + } + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index d0e1d0a..ea1d65f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/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 { throw new ServiceException("创建/修改站点信息失败!"); }); + this.update(Wrappers.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(); diff --git a/hzims-service/operational/src/main/resources/db/1.0.1.sql b/hzims-service/operational/src/main/resources/db/1.0.1.sql index 6204f7b..910b768 100644 --- a/hzims-service/operational/src/main/resources/db/1.0.1.sql +++ b/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:否'; \ No newline at end of file +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;