Commit e6a47e8a authored by zhengjiangtao's avatar zhengjiangtao

新增站端维护页面

parent f984b873
package com.yeejoin.amos.fas.dao.entity;
import javax.persistence.*;
import java.util.Date;
/**
* The persistent class for the alarm database table.
*/
@Entity
@Table(name = "f_station_info")
@NamedQuery(name = "StationInfo.findAll", query = "SELECT a FROM StationInfo a")
public class StationInfo extends BasicEntity{
private static final long serialVersionUID = 1L;
/**
* 名称
*/
private String name;
/**
* 环流站编码
*/
@Column(name="station_code")
private String stationCode;
/**
* 后三位编码
*/
private String code;
/**
* 换流站类型:1-发电类型;2-收电类型
*/
@Column(name="elec_type")
private Integer elecType;
/**
* 用途类型:1-电厂升压变电站;2-公用普通变电站;3-公用换流变电站;4-企业自备变电站;5-其他
*/
@Column(name="use_type")
private Integer useType;
/**
* 省份编码
*/
@Column(name="province_code")
private String provinceCode;
/**
* 市区编码
*/
@Column(name="city_code")
private String cityCode;
/**
* 区县编码
*/
@Column(name="district_code")
private String districtCode;
/**
* 省份编码
*/
private String regionCode;
/**
* 详细地址
*/
private String address;
/**
* '0-启用;1-停用
*/
private Integer status;
/**
* 经度
*/
private Double longitude;
/**
* 纬度
*/
private Double latitude;
/**
* 换流站负责人
*/
@Column(name="station_charge_user_id")
private String stationChargeUserId;
/**
* 安全负责人
*/
@Column(name="safety_charge_user_id")
private String safetyChargeUserId;
/**
* 创建人
*/
@Column(name="create_by")
private String createBy;
/**
* 创建日期
*/
@Column(name="create_date")
private Date createDate;
/**
* 备注
*/
private String remark;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStationCode() {
return stationCode;
}
public void setStationCode(String stationCode) {
this.stationCode = stationCode;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getElecType() {
return elecType;
}
public void setElecType(Integer elecType) {
this.elecType = elecType;
}
public Integer getUseType() {
return useType;
}
public void setUseType(Integer useType) {
this.useType = useType;
}
public String getProvinceCode() {
return provinceCode;
}
public void setProvinceCode(String provinceCode) {
this.provinceCode = provinceCode;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getDistrictCode() {
return districtCode;
}
public void setDistrictCode(String districtCode) {
this.districtCode = districtCode;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public String getStationChargeUserId() {
return stationChargeUserId;
}
public void setStationChargeUserId(String stationChargeUserId) {
this.stationChargeUserId = stationChargeUserId;
}
public String getSafetyChargeUserId() {
return safetyChargeUserId;
}
public void setSafetyChargeUserId(String safetyChargeUserId) {
this.safetyChargeUserId = safetyChargeUserId;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public Date getCreateDate() {
return createDate;
}
@Override
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
@Transient
public String getRegionCode() {
return regionCode;
}
public void setRegionCode(String regionCode) {
this.regionCode = regionCode;
}
}
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IStationMaintenService;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.dao.entity.StationInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@RestController
@RequestMapping(value = "/api/stationMainten")
@Api(tags="站端api")
public class StationMaintenController extends BaseController{
@Autowired
private IStationMaintenService stationMaintenService;
/**
* 保存站端信息
*/
@Permission
@ApiOperation(value = "保存录入站端信息", notes = "保存录入站端信息")
@PostMapping(value = "/save")
public CommonResponse saveStation(@RequestBody StationInfo stationParams) {
stationParams.setCreateBy(getUserId());
stationParams.setCreateDate(new Date());
stationMaintenService.save(stationParams);
return CommonResponseUtil.success();
}
/**
* 获取站端信息
*/
@Permission
@ApiOperation(value = "获取站端信息", notes = "获取站端信息")
@PostMapping(value = "/detail")
public CommonResponse detail() {
StationInfo stationInfo = stationMaintenService.detail();
return CommonResponseUtil.success(stationInfo);
}
}
package com.yeejoin.amos.fas.business.dao.mapper;
public interface StationMaintenMapper extends BaseMapper {
}
package com.yeejoin.amos.fas.business.dao.repository;
import com.yeejoin.amos.fas.dao.entity.StationInfo;
import org.springframework.stereotype.Repository;
@Repository("iStationMaintenDao")
public interface IStationMaintenDao extends BaseDao<StationInfo, Long>{
}
......@@ -122,7 +122,7 @@ public class FireEquipServiceImpl implements IFireEquipService {
public Page queryForEquipmentList(String name, String code,String equipClassify,CommonPageable commonPageable,String bindStation) {
long total = fireEquipMapper.queryForEquipmentPageCount( name, code,equipClassify,bindStation);
List<Map> content = this.fireEquipMapper.queryForEquipmentPage(name, code,equipClassify,commonPageable.getOffset(),commonPageable.getPageSize(),bindStation);
Page result = new CommonPage(content, commonPageable, total);
Page result = new CommonPage(content, commonPageable, total);
return result;
}
......
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.repository.IStationMaintenDao;
import com.yeejoin.amos.fas.business.service.intfc.IStationMaintenService;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.StationInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.List;
@Service("stationMaintenService")
public class StationMaintenServiceImp implements IStationMaintenService {
@Autowired
private IStationMaintenDao iStationMaintenDao;
@Override
public void save(StationInfo stationInfo){
// 状态为启用(0)下只能修改换流站名称
if(stationInfo.getId() == 0){
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(stationInfo.getUseType());
stringBuilder.append(stationInfo.getRegionCode());
stringBuilder.append(stationInfo.getCode());
stationInfo.setStationCode(stringBuilder.toString());
}else{
StationInfo station = detail();
// 判断状态是否切换
if(!station.getStatus().equals(stationInfo.getStatus())){
StringBuilder stringBuilder = new StringBuilder();
if(StringUtils.isEmpty(stationInfo.getRegionCode())){
stringBuilder.append(station.getStationCode());
}else{
stringBuilder.append(stationInfo.getUseType());
stringBuilder.append(stationInfo.getRegionCode());
stringBuilder.append(stationInfo.getCode());
}
stationInfo.setStationCode(stringBuilder.toString());
}
}
//保存
iStationMaintenDao.save(stationInfo);
}
@Override
public StationInfo detail(){
List<StationInfo> list = iStationMaintenDao.findAll();
if(list != null && !ObjectUtils.isEmpty(list)) {
return list.get(0);
}else{
return new StationInfo();
}
}
}
package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.StationInfo;
public interface IStationMaintenService {
void save(StationInfo stationInfo);
StationInfo detail();
}
......@@ -267,6 +267,37 @@
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='报警信息表';
</sql>
</changeSet>
<changeSet author="zhouyi" id="1589444792916-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="f_station_info"/>
</preConditions>
<comment>create table f_station_info</comment>
<sql>
DROP TABLE IF EXISTS f_station_info;
CREATE TABLE `f_station_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(20) DEFAULT NULL COMMENT '名称',
`station_code` varchar(32) NOT NULL COMMENT '环流站编码',
`code` varchar(10) DEFAULT NULL COMMENT '后三位编码',
`elec_type` tinyint(4) DEFAULT NULL COMMENT '换流站类型:1-发电类型;2-收电类型',
`use_type` tinyint(4) NOT NULL COMMENT '用途类型:1-电厂升压变电站;2-公用普通变电站;3-公用换流变电站;4-企业自备变电站;5-其他',
`province_code` varchar(32) DEFAULT NULL COMMENT '省份编码',
`city_code` varchar(32) DEFAULT NULL COMMENT '市区编码',
`district_code` varchar(32) DEFAULT NULL COMMENT '区县编码',
`address` varchar(255) DEFAULT NULL COMMENT '详细地址',
`status` bit(1) NOT NULL DEFAULT b'0' COMMENT '0-启用;1-停用',
`longitude` double DEFAULT NULL COMMENT '经度',
`latitude` double DEFAULT NULL COMMENT '纬度',
`station_charge_user_id` varchar(50) DEFAULT NULL COMMENT '换流站负责人',
`safety_charge_user_id` varchar(50) DEFAULT NULL COMMENT '安全负责人',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`),
UNIQUE KEY `f_station_info_uniq` (`station_code`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COMMENT='站端信息表';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1589769364577-1">
<preConditions onFail="MARK_RAN">
<columnExists tableName="f_risk_level " columnName="manage_level"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment