forked from wuweidong/hzims-back-huoshan
Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
walton | c3f02c767b | 4 days ago |
walton | 356ff8d2c7 | 3 weeks ago |
walton | 20d6fa1eee | 3 weeks ago |
liangfan | ed6cae1da1 | 6 months ago |
liangfan | bb41cb569a | 6 months ago |
liangfan | a0205e6213 | 6 months ago |
liangfan | 72e3562fba | 6 months ago |
140 changed files with 6069 additions and 258 deletions
@ -0,0 +1,48 @@
|
||||
package com.hnac.hzims.baseinfo.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
|
||||
|
||||
@Data |
||||
@TableName("irrbdgate") |
||||
public class IrrBDGate extends BaseEntity { |
||||
private String strobeCode; |
||||
|
||||
private String stcd; |
||||
|
||||
private String watergateCode; |
||||
|
||||
private String producingArea; |
||||
|
||||
private String factory; |
||||
|
||||
private String strobeType; |
||||
|
||||
private String strobeMaterial; |
||||
|
||||
private Double height; |
||||
|
||||
private Double width; |
||||
|
||||
private Double thickness; |
||||
|
||||
private String motivity; |
||||
|
||||
private String type; |
||||
|
||||
private Short velocity; |
||||
|
||||
private String areaCode; |
||||
|
||||
private String lrcd; |
||||
|
||||
private String szhldm; |
||||
|
||||
private Float dongj; |
||||
|
||||
private Float beiw; |
||||
|
||||
private Float discharge; |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.hnac.hzims.baseinfo.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class IrrBDGateRefData { |
||||
private String strobeCode; |
||||
|
||||
private String refstcd; |
||||
|
||||
private String refqpoint; |
||||
|
||||
private String refzpoint; |
||||
} |
@ -0,0 +1,64 @@
|
||||
package com.hnac.hzims.baseinfo.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 水库信息表 |
||||
*/ |
||||
@Data |
||||
@TableName("st_rsr_bsin") |
||||
public class StRsrBsin extends BaseEntity { |
||||
@ApiModelProperty("水库代码") |
||||
private String rscd; |
||||
@ApiModelProperty("水库名称") |
||||
private String rtunm; |
||||
@ApiModelProperty("主管部门") |
||||
private String cmdp; |
||||
@ApiModelProperty("主管部门联系电话") |
||||
private String cmdptel; |
||||
@ApiModelProperty("河流名称") |
||||
private String rvcd; |
||||
@ApiModelProperty("水系名称") |
||||
private String hnnm; |
||||
@ApiModelProperty("流域名称") |
||||
private String ctcd; |
||||
@ApiModelProperty("东经") |
||||
private Double eslg; |
||||
@ApiModelProperty("北纬") |
||||
private Double nrlt; |
||||
@ApiModelProperty("站址") |
||||
private String stlc; |
||||
@ApiModelProperty("行政区划码") |
||||
private String addvcd; |
||||
@ApiModelProperty("基面名称") |
||||
private String dtmnm; |
||||
@ApiModelProperty("基面高程") |
||||
private Double dtmel; |
||||
@ApiModelProperty("基面修正值") |
||||
private Double dtpr; |
||||
@ApiModelProperty("报汛等级") |
||||
private String frgrd; |
||||
@ApiModelProperty("集水面积") |
||||
private Double drna; |
||||
@ApiModelProperty("拼音码") |
||||
private String phcd; |
||||
@ApiModelProperty("启用标志") |
||||
private String usfl; |
||||
@ApiModelProperty("备注") |
||||
private String comments; |
||||
@ApiModelProperty("建成时间") |
||||
private Date buildTime; |
||||
@ApiModelProperty("最大坝高") |
||||
private Double maxdmhg; |
||||
@ApiModelProperty("坝型") |
||||
private String dmtp; |
||||
@ApiModelProperty("库区GIS范围") |
||||
private String gisRange; |
||||
@ApiModelProperty("水库功能(可多选)") |
||||
private String rsfn; |
||||
} |
@ -0,0 +1,62 @@
|
||||
package com.hnac.hzims.baseinfo.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 水库防洪信息 |
||||
*/ |
||||
@Data |
||||
@TableName("st_rsr_hych") |
||||
public class StRsrHych implements Serializable { |
||||
@ApiModelProperty("水库代码") |
||||
@TableId(type = IdType.INPUT) |
||||
private String rscd; |
||||
@ApiModelProperty("水库类型") |
||||
private String rsvrtp; |
||||
@ApiModelProperty("坝顶高程") |
||||
private Double damel; |
||||
@ApiModelProperty("控制流域面积") |
||||
private Double cnctar; |
||||
@ApiModelProperty("校核洪水位") |
||||
private Double chfl; |
||||
@ApiModelProperty("设计洪水位") |
||||
private Double dsfl; |
||||
@ApiModelProperty("正常高水位") |
||||
private Double normz; |
||||
@ApiModelProperty("死水位") |
||||
private Double ddwz; |
||||
@ApiModelProperty("汛限水位") |
||||
private Double mjfl; |
||||
@ApiModelProperty("兴利水位") |
||||
private Double actz; |
||||
@ApiModelProperty("总库容") |
||||
private Double ttcp; |
||||
@ApiModelProperty("防洪库容") |
||||
private Double fldcp; |
||||
@ApiModelProperty("兴利库容") |
||||
private Double actcp; |
||||
@ApiModelProperty("死库容") |
||||
private Double ddcp; |
||||
@ApiModelProperty("历史最高库水位") |
||||
private Double hhrz; |
||||
@ApiModelProperty("历史最大蓄水量") |
||||
private Double hmxw; |
||||
@ApiModelProperty("历史最高库水位(蓄水量)时间") |
||||
private Date maxleveltime; |
||||
@ApiModelProperty("低水位告警值") |
||||
private Double laz; |
||||
@ApiModelProperty("启动预报流量标准") |
||||
private Double sfq; |
||||
@ApiModelProperty("时间戳") |
||||
private Date moditime; |
||||
@ApiModelProperty("更新时间") |
||||
private Date dtuptm; |
||||
|
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.hnac.hzims.baseinfo.vo; |
||||
|
||||
import com.hnac.hzims.baseinfo.entity.StRsrBsin; |
||||
|
||||
public class StRsrBsinVo extends StRsrBsin { |
||||
|
||||
//行政区划名称
|
||||
private String addvcdnm; |
||||
/*** 水位*/ |
||||
private String waterLevel; |
||||
|
||||
/*** 库容*/ |
||||
private String capacity; |
||||
|
||||
public String getAddvcdnm() { |
||||
return addvcdnm; |
||||
} |
||||
|
||||
public void setAddvcdnm(String addvcdnm) { |
||||
this.addvcdnm = addvcdnm; |
||||
} |
||||
|
||||
public String getWaterLevel() { |
||||
return waterLevel; |
||||
} |
||||
|
||||
public void setWaterLevel(String waterLevel) { |
||||
this.waterLevel = waterLevel; |
||||
} |
||||
|
||||
public String getCapacity() { |
||||
return capacity; |
||||
} |
||||
|
||||
public void setCapacity(String capacity) { |
||||
this.capacity = capacity; |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.hnac.hzims</groupId> |
||||
<artifactId>hzims-service-api</artifactId> |
||||
<version>4.0.0-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>suichang-api</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>8</maven.compiler.source> |
||||
<maven.compiler.target>8</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
|
||||
<dependency> |
||||
<groupId>com.alibaba</groupId> |
||||
<artifactId>easyexcel</artifactId> |
||||
<version>3.0.5</version> |
||||
</dependency> |
||||
|
||||
</dependencies> |
||||
|
||||
|
||||
</project> |
@ -0,0 +1,10 @@
|
||||
package com.hnac.hzims.suichang.entity; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-08 15:06 |
||||
* @Description: |
||||
*/ |
||||
|
||||
public class Demo { |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.hnac.hzims.suichang.feign; |
||||
|
||||
import com.hnac.hzims.suichang.vo.StationQueryReq; |
||||
import com.hnac.hzims.suichang.vo.StationVo; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
||||
import java.time.LocalDateTime; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@FeignClient( |
||||
value = "suichang" |
||||
) |
||||
public interface ISuichangClient { |
||||
String API_PREFIX = "/suichangClient"; |
||||
|
||||
String GET_STATION_BY_REQ = API_PREFIX + "/getStationListByReq"; |
||||
|
||||
String GET_DATA = API_PREFIX + "/getData"; |
||||
|
||||
@GetMapping(GET_STATION_BY_REQ) |
||||
List<StationVo> getStationListByReq(StationQueryReq req); |
||||
|
||||
@GetMapping(GET_DATA) |
||||
List<Map<String, Object>> getData(String stcd, Integer accessRules, Integer saveTimeType, Integer timeInterval, |
||||
LocalDateTime startTime, LocalDateTime endTime); |
||||
|
||||
} |
@ -0,0 +1,138 @@
|
||||
package com.hnac.hzims.suichang.util; |
||||
|
||||
import java.text.ParseException; |
||||
import java.text.SimpleDateFormat; |
||||
import java.time.LocalDate; |
||||
import java.time.LocalDateTime; |
||||
import java.time.LocalTime; |
||||
import java.time.Month; |
||||
import java.time.format.DateTimeFormatter; |
||||
import java.time.temporal.ChronoUnit; |
||||
import java.util.Calendar; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
public class DateUtil { |
||||
public static Map<String, Date> getStartEnd(String yearMonth) { |
||||
Map<String, Date> data = new HashMap<>(); |
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||
try { |
||||
Date begin = sdf.parse(yearMonth + "-01 00:00:00"); |
||||
// 最大天数
|
||||
Date endSt = sdf.parse(yearMonth + "-" + getMaxDayByYearMonth(begin) + " 23:59:59"); |
||||
data.put("start", begin); |
||||
data.put("end", endSt); |
||||
} catch (ParseException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return data; |
||||
} |
||||
|
||||
public static int getMaxDayByYearMonth(Date start) { |
||||
Calendar calendar = Calendar.getInstance(); |
||||
calendar.setTime(start); |
||||
return calendar.getActualMaximum(Calendar.DAY_OF_MONTH); |
||||
} |
||||
|
||||
public static LocalDateTime getStartOfLastQuarter(LocalDateTime dateTime) { |
||||
int currentMonth = dateTime.getMonthValue(); |
||||
int currentYear = dateTime.getYear(); |
||||
|
||||
// 计算上个季度的开始月份
|
||||
int startMonthOfLastQuarter = (currentMonth - 1) / 3 * 3 + 1; |
||||
if (startMonthOfLastQuarter > currentMonth) { |
||||
// 如果当前月份在上个季度之后,则回到上一年的相应季度
|
||||
startMonthOfLastQuarter -= 3; |
||||
currentYear--; |
||||
} |
||||
|
||||
// 获取上个季度的开始时间(该季度的第一个月的第一天午夜)
|
||||
return LocalDateTime.of(currentYear, startMonthOfLastQuarter, 1, 0, 0); |
||||
} |
||||
|
||||
public static LocalDateTime getEndOfLastQuarter(LocalDateTime dateTime) { |
||||
LocalDateTime startOfLastQuarter = getStartOfLastQuarter(dateTime); |
||||
|
||||
// 获取上个季度的结束时间(该季度的最后一个月的最后一天午夜)
|
||||
int endMonthOfLastQuarter = startOfLastQuarter.getMonthValue() + 2; |
||||
int endYearOfLastQuarter = startOfLastQuarter.getYear(); |
||||
if (endMonthOfLastQuarter > 12) { |
||||
// 如果结束月份超过12,则回到下一年的相应月份
|
||||
endMonthOfLastQuarter -= 12; |
||||
endYearOfLastQuarter++; |
||||
} |
||||
|
||||
return LocalDateTime.of(endYearOfLastQuarter, endMonthOfLastQuarter, 1, 0, 0); |
||||
} |
||||
|
||||
public static LocalDateTime getStartOfHalfYear(LocalDateTime dateTime) { |
||||
int month = dateTime.getMonthValue(); |
||||
int year = dateTime.getYear(); |
||||
if (month <= 6) { |
||||
// 如果是上半年,则获取去年下半年的开始时间(7月1日)
|
||||
year--; |
||||
return LocalDateTime.of(year, Month.JULY, 1, 0, 0); |
||||
} else { |
||||
return LocalDateTime.of(year, Month.JANUARY, 1, 0, 0); |
||||
} |
||||
} |
||||
|
||||
|
||||
public static LocalDateTime getEndOfHalfYear(LocalDateTime dateTime) { |
||||
int month = dateTime.getMonthValue(); |
||||
int year = dateTime.getYear(); |
||||
if (month <= 6) { |
||||
// 如果是上半年,则获取去年下半年的结束时间(1月1日)
|
||||
return LocalDateTime.of(year, Month.JANUARY, 1, 0, 0, 0); |
||||
} else { |
||||
return LocalDateTime.of(year, Month.JULY, 1, 0, 0, 0); |
||||
} |
||||
|
||||
} |
||||
|
||||
public static long getHoursPassedToday() { |
||||
// 获取当前时间
|
||||
LocalTime currentTime = LocalTime.now(); |
||||
// 获取今天的开始时间(午夜0点)
|
||||
LocalTime midnight = LocalTime.MIDNIGHT; |
||||
// 计算时间差,单位为小时
|
||||
return ChronoUnit.HOURS.between(midnight, currentTime); |
||||
} |
||||
|
||||
public static LocalDateTime getEndTime(String time) { |
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
java.time.LocalDate timeDate = java.time.LocalDate.parse(time, formatter); |
||||
LocalDateTime resultTime = LocalDateTime.of(timeDate, LocalTime.MIDNIGHT); |
||||
// 比较两个时间的大小
|
||||
LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0); |
||||
if (now.compareTo(resultTime) > 0) { |
||||
resultTime = LocalDateTime.of(timeDate, LocalTime.MAX); |
||||
} else { |
||||
resultTime = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0); |
||||
} |
||||
return resultTime; |
||||
} |
||||
|
||||
public static LocalDateTime getEndTimeByDay(String time) { |
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
java.time.LocalDate timeDate = java.time.LocalDate.parse(time, formatter); |
||||
return LocalDateTime.of(timeDate, LocalTime.MIDNIGHT).plusDays(1); |
||||
} |
||||
|
||||
public static LocalDateTime getStartTime(String time) { |
||||
// 创建一个 DateTimeFormatter 对象来解析日期字符串
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
java.time.LocalDate startDate = java.time.LocalDate.parse(time, formatter); |
||||
// 结合 LocalDate 和 LocalTime 创建 LocalDateTime 对象
|
||||
LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIDNIGHT); |
||||
return startTime; |
||||
} |
||||
|
||||
public static String getStringTime(LocalDateTime time) { |
||||
// 创建一个 DateTimeFormatter 对象,用于定义你想要的格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||
// 使用 formatter 将 LocalDateTime 转换为 String
|
||||
return time.format(formatter); |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.hnac.hzims.suichang.util; |
||||
|
||||
import org.springframework.util.CollectionUtils; |
||||
|
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @author tanghaihao |
||||
* @date 2023年07月12日 17:15 |
||||
*/ |
||||
public class MemoryPagination { |
||||
/** |
||||
* 内存分页 |
||||
* |
||||
* @param records 待分页的数据 |
||||
* @param pageNum 当前页码 |
||||
* @param pageSize 每页显示的条数 |
||||
* @return 分页之后的数据 |
||||
*/ |
||||
public static <T> List<T> pagination(List<T> records, int pageNum, int pageSize) { |
||||
if (CollectionUtils.isEmpty(records)) { |
||||
return Collections.emptyList(); |
||||
} |
||||
int totalCount = records.size() ; |
||||
int remainder = totalCount % pageSize; |
||||
int pageCount = (remainder > 0) ? totalCount / pageSize + 1 : totalCount / pageSize; |
||||
if (remainder == 0) { |
||||
return records.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
||||
} else { |
||||
if (pageNum == pageCount) { |
||||
return records.stream().skip((pageNum - 1) * pageSize).limit(totalCount).collect(Collectors.toList()); |
||||
} else { |
||||
return records.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,43 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class AvgMonitorCountVo { |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 核定下限流量 |
||||
*/ |
||||
private BigDecimal flowValue; |
||||
/** |
||||
* 考核天数 |
||||
*/ |
||||
private Long count; |
||||
/** |
||||
* 合格天数 |
||||
*/ |
||||
private Integer passCount; |
||||
/** |
||||
* 合格率 |
||||
*/ |
||||
private String passPre; |
||||
|
||||
|
||||
private List<RealMonitorSingleInfoVo> infos; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
import org.springblade.core.mp.support.Query; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class AvgMonitorReq extends Query { |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private String startTime; |
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private String endTime; |
||||
|
||||
|
||||
} |
@ -0,0 +1,54 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class AvgMonitorVo { |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 核定下限流量 |
||||
*/ |
||||
private BigDecimal flowValue; |
||||
/** |
||||
* 日均流量 |
||||
*/ |
||||
private String avgFlow; |
||||
/** |
||||
* 实时流量 |
||||
*/ |
||||
private String realFlow; |
||||
/** |
||||
* 现在的时间 |
||||
*/ |
||||
private String dateNow; |
||||
|
||||
/** |
||||
* 经度(东经) |
||||
*/ |
||||
private BigDecimal lgtd; |
||||
/** |
||||
* 纬度(北纬) |
||||
*/ |
||||
private BigDecimal lttd; |
||||
/** |
||||
* 类型 1无节制电站 2流量计电站 |
||||
*/ |
||||
private String stationType; |
||||
/** |
||||
* 上报率 |
||||
*/ |
||||
private String passPre; |
||||
|
||||
} |
@ -0,0 +1,80 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.math.RoundingMode; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class EcologicalFlowVo { |
||||
|
||||
/** |
||||
* 电站数 |
||||
*/ |
||||
private Integer allStationListSize; |
||||
/** |
||||
* 无节制电站 |
||||
*/ |
||||
private Integer noLimitStationListSize; |
||||
/** |
||||
* 流量计电站 |
||||
*/ |
||||
private Integer flowStationListSize; |
||||
/** |
||||
* 昨日达标率 |
||||
*/ |
||||
private String yesterdayFinishPer; |
||||
/** |
||||
* 昨日达标数量 |
||||
*/ |
||||
private Integer yesterdayFinishCount; |
||||
/** |
||||
* 上月达标数量 |
||||
*/ |
||||
private Integer monthFinishCount; |
||||
/** |
||||
* 上月达标率 |
||||
*/ |
||||
private String monthFinishPer; |
||||
|
||||
/** |
||||
* 周达标率 |
||||
*/ |
||||
private String weekFinishPer; |
||||
/** |
||||
* 季达标率 |
||||
*/ |
||||
private String quarterFinishPer; |
||||
/** |
||||
* 半年达标率 |
||||
*/ |
||||
private String halfYearFinishPer; |
||||
/** |
||||
* 年达标率 |
||||
*/ |
||||
private String yearFinishPer; |
||||
/** |
||||
* 今天上报率 |
||||
*/ |
||||
private String reportTodayPre; |
||||
/** |
||||
* 今天预警数 |
||||
*/ |
||||
private Integer warnTodayCount; |
||||
/** |
||||
* 昨天上报率 |
||||
*/ |
||||
private String reportYesTerdayPre; |
||||
/** |
||||
* 昨天预警数 |
||||
*/ |
||||
private Integer warnYesTerdayCount; |
||||
|
||||
|
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
import org.springblade.core.mp.support.Query; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class ExamStationFlowDataReq extends Query { |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private String startTime; |
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private String endTime; |
||||
|
||||
/** |
||||
* 1 无节制电站 2 流量计电站 |
||||
*/ |
||||
private String stationType; |
||||
/** |
||||
* 是否达标 |
||||
*/ |
||||
private String isPass; |
||||
|
||||
} |
@ -0,0 +1,60 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-15 18:33 |
||||
* @Description: |
||||
*/ |
||||
@Data |
||||
public class ExamStationFlowReportDayVo { |
||||
|
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 所属区域 |
||||
*/ |
||||
private String areaName; |
||||
|
||||
/** |
||||
* 状态 |
||||
*/ |
||||
private String status; |
||||
/** |
||||
* 日泄放比 |
||||
*/ |
||||
private String dayOutFlowPre; |
||||
/** |
||||
* 核定流量 |
||||
*/ |
||||
private BigDecimal flowValue; |
||||
/** |
||||
* 前日日均流量 |
||||
*/ |
||||
private BigDecimal yesTerDayAvgFlowValue; |
||||
/** |
||||
* 瞬时流量 |
||||
*/ |
||||
private BigDecimal realFlowValue; |
||||
|
||||
/** |
||||
* 今日平均流量 |
||||
*/ |
||||
private BigDecimal toDayAvgFlowValue; |
||||
|
||||
/** |
||||
* 实际下泄流量 |
||||
*/ |
||||
private BigDecimal realOutFlow; |
||||
/** |
||||
* 核定下泄流量 |
||||
*/ |
||||
private BigDecimal outFlow; |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-15 18:41 |
||||
* @Description: |
||||
*/ |
||||
@Data |
||||
public class ExamStationFlowReportDetailVo { |
||||
|
||||
/** |
||||
* 核定流量 |
||||
*/ |
||||
private BigDecimal ecologicalFlowValue; |
||||
/** |
||||
* 日均流量 |
||||
*/ |
||||
private BigDecimal flowValue; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
private String tm; |
||||
|
||||
/** |
||||
* 是否合格 |
||||
*/ |
||||
private String isPass; |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-15 18:33 |
||||
* @Description: |
||||
*/ |
||||
@Data |
||||
public class ExamStationFlowReportVo { |
||||
|
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 所属区域 |
||||
*/ |
||||
private String areaName; |
||||
/** |
||||
* 核定下限流量 |
||||
*/ |
||||
private BigDecimal flowValue; |
||||
/** |
||||
* 考核天数 |
||||
*/ |
||||
private Long count; |
||||
/** |
||||
* 合格天数 |
||||
*/ |
||||
private Integer passCount; |
||||
/** |
||||
* 合格率 |
||||
*/ |
||||
private String passPre; |
||||
|
||||
/** |
||||
* 是否合格 |
||||
*/ |
||||
private String isPass; |
||||
|
||||
|
||||
private List<ExamStationFlowReportDetailVo> infos; |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-20 17:23 |
||||
* @Description: |
||||
*/ |
||||
@Data |
||||
public class FlowWarnQueryDTO { |
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private String startTime; |
||||
|
||||
|
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private String endTime; |
||||
/** |
||||
* 站点id |
||||
*/ |
||||
private String objectCode; |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-19 10:00 |
||||
* @Description: |
||||
*/ |
||||
@Data |
||||
public class FlowWarnVo { |
||||
/** |
||||
* 站点名称 |
||||
*/ |
||||
String name; |
||||
/** |
||||
* 消息内容 |
||||
*/ |
||||
String content; |
||||
/** |
||||
* 发送时间 |
||||
*/ |
||||
String sendTime; |
||||
|
||||
/** |
||||
* 发送人id |
||||
*/ |
||||
String receiveUserId; |
||||
/** |
||||
* 发送人姓名 |
||||
*/ |
||||
String receiveUserName; |
||||
/** |
||||
* 业务对象来源(数据平台、水库等) |
||||
*/ |
||||
String objectSource; |
||||
|
||||
/** |
||||
* 业务对象编码 |
||||
*/ |
||||
String objectCode; |
||||
|
||||
String alarmLevel; |
||||
|
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-21 19:04 |
||||
* @Description: |
||||
*/ |
||||
|
||||
@Data |
||||
public class ImageReq { |
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private String startTime; |
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private String endTime; |
||||
/** |
||||
* 站点名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 设备编码 |
||||
*/ |
||||
private String deviceCode; |
||||
/** |
||||
* 正常 异常 |
||||
*/ |
||||
private String status; |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-21 19:04 |
||||
* @Description: |
||||
*/ |
||||
|
||||
@Data |
||||
public class ImageVo { |
||||
|
||||
private Long id; |
||||
|
||||
private String stcd; |
||||
|
||||
private String time; |
||||
|
||||
private String data; |
||||
|
||||
private String manualpath; |
||||
|
||||
private String name; |
||||
|
||||
private String status; |
||||
|
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-21 19:33 |
||||
* @Description: |
||||
*/ |
||||
@Data |
||||
public class MissingImagesRes { |
||||
|
||||
String deviceCode; |
||||
|
||||
String name; |
||||
|
||||
String area; |
||||
|
||||
String month; |
||||
|
||||
String monthMissingPre; |
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class RealMonitorExportDTO { |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
@ExcelProperty(value = "电站名称", index = 0) |
||||
private String name; |
||||
/** |
||||
* 核定下限流量 |
||||
*/ |
||||
@ExcelProperty(value = "核定流量(m³/s)", index = 1) |
||||
private BigDecimal flowValue; |
||||
/** |
||||
* 监测流量 |
||||
*/ |
||||
@ExcelProperty(value = "监测流量(m³/s)", index = 2) |
||||
private String realFlow; |
||||
|
||||
/** |
||||
* 上报个数 |
||||
*/ |
||||
@ExcelProperty(value = "上报数(个)", index = 3) |
||||
private Integer reportCount; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
@ExcelProperty(value = "时间", index = 4) |
||||
private String dateNow; |
||||
|
||||
|
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class RealMonitorRes { |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private List<RealMonitorVo> realMonitorVos; |
||||
/** |
||||
* 应上报条数 |
||||
*/ |
||||
private Long reportCount; |
||||
|
||||
|
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
import org.springblade.core.mp.support.Query; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-14 09:56 |
||||
* @Description: |
||||
*/ |
||||
@Data |
||||
public class RealMonitorSingleInfoReq extends Query { |
||||
|
||||
/** |
||||
* 设备编号 |
||||
*/ |
||||
private String deviceCode; |
||||
|
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private String startTime; |
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private String endTime; |
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-14 09:56 |
||||
* @Description: |
||||
*/ |
||||
@Data |
||||
public class RealMonitorSingleInfoVo { |
||||
/** |
||||
* 实时值 |
||||
*/ |
||||
@ExcelProperty(value = "流量值", index = 0) |
||||
private String value; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
@ExcelProperty(value = "监测时间", index = 1) |
||||
private String tm; |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class RealMonitorVo { |
||||
/** |
||||
* 设备编号 |
||||
*/ |
||||
private String deviceCode; |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 核定下限流量 |
||||
*/ |
||||
private BigDecimal flowValue; |
||||
/** |
||||
* 监测流量 |
||||
*/ |
||||
private String realFlow; |
||||
|
||||
/** |
||||
* 上报个数 |
||||
*/ |
||||
private Integer reportCount; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
private String dateNow; |
||||
|
||||
private String areaName; |
||||
|
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class StationQueryReq { |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
private String stationType; |
||||
|
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-25 17:21 |
||||
* @Description: |
||||
*/ |
||||
|
||||
@Data |
||||
public class StationTreeRes { |
||||
StationVo stationVo; |
||||
/** |
||||
* 数量 |
||||
*/ |
||||
int count; |
||||
/** |
||||
* 视频点位list |
||||
*/ |
||||
List<StationTypeVo> child; |
||||
|
||||
} |
@ -0,0 +1,70 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.SqlCondition; |
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||
import com.fasterxml.jackson.databind.ser.std.NullSerializer; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.support.QueryField; |
||||
|
||||
/** |
||||
* @Author: liangfan |
||||
* @Date: 2024-03-25 17:11 |
||||
* @Description: |
||||
*/ |
||||
|
||||
@Data |
||||
public class StationTypeVo { |
||||
|
||||
@ApiModelProperty("主键ID") |
||||
private Long id; |
||||
|
||||
@ApiModelProperty("视频源配置名称") |
||||
private String name; |
||||
|
||||
@ApiModelProperty("站点ID") |
||||
private String stationId; |
||||
|
||||
@ApiModelProperty("机构ID") |
||||
private Long deptId; |
||||
|
||||
@ApiModelProperty("是否平台接入") |
||||
private Integer isHikvideo; |
||||
|
||||
@ApiModelProperty("类型") |
||||
private String type; |
||||
|
||||
@ApiModelProperty("视频类型;暂只包括清污机类型") |
||||
private String videoType; |
||||
|
||||
@ApiModelProperty("数据源地址") |
||||
private String liveSourceAddress; |
||||
|
||||
@ApiModelProperty("视频源编码") |
||||
private String pointCode; |
||||
|
||||
@ApiModelProperty("代理API网关nginx服务器ip端口") |
||||
private String videoHost; |
||||
|
||||
@ApiModelProperty("秘钥appkey") |
||||
private String appKey; |
||||
|
||||
@ApiModelProperty("秘钥appSecret") |
||||
private String appSecret; |
||||
|
||||
@ApiModelProperty("排序") |
||||
private Integer sort; |
||||
|
||||
@ApiModelProperty("站點排序") |
||||
private Integer stationSort; |
||||
|
||||
@ApiModelProperty("萤石云地址") |
||||
private String ysyUrl; |
||||
|
||||
@ApiModelProperty("视频归属类型 1代表防汛安全,2代表运行安全,3生态流量监视") |
||||
private Integer videoOwerType; |
||||
|
||||
@ApiModelProperty("拼音") |
||||
private String pingyin; |
||||
|
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class StationVo { |
||||
|
||||
/** |
||||
* 名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 设备编号 |
||||
*/ |
||||
private String deviceCode; |
||||
|
||||
|
||||
/** |
||||
* 核定流量 |
||||
*/ |
||||
private BigDecimal flowValue; |
||||
|
||||
/** |
||||
* 电站类型 1 无节制电站 2流量计电站 |
||||
*/ |
||||
private String stationType; |
||||
|
||||
/** |
||||
* 经度(东经) |
||||
*/ |
||||
private BigDecimal lgtd; |
||||
/** |
||||
* 纬度(北纬) |
||||
*/ |
||||
private BigDecimal lttd; |
||||
|
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class StatisticsFlowDataDetailVo { |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 核定流量 |
||||
*/ |
||||
private String flowValue; |
||||
|
||||
/** |
||||
* 考核天数 |
||||
*/ |
||||
private Integer examDays; |
||||
/** |
||||
* 合格天数 |
||||
*/ |
||||
private Integer examPassDays = 0; |
||||
/** |
||||
* 合格率 |
||||
*/ |
||||
private String examPassDayPre = "0.00%"; |
||||
|
||||
|
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
import org.springblade.core.mp.support.Query; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class StatisticsFlowDataReq extends Query { |
||||
|
||||
/** |
||||
* 电站名称 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private String startTime; |
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private String endTime; |
||||
|
||||
|
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.hnac.hzims.suichang.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/8/31 9:37 |
||||
*/ |
||||
@Data |
||||
public class StatisticsFlowDataVo { |
||||
/** |
||||
* 区域名称 |
||||
*/ |
||||
private String areaName; |
||||
/** |
||||
* 考核电站个数 |
||||
*/ |
||||
private Integer examCount; |
||||
/** |
||||
* 达标电站个数 |
||||
*/ |
||||
private Integer passCount; |
||||
/** |
||||
* 达标率 |
||||
*/ |
||||
private String passPre; |
||||
/** |
||||
* 报表数据 |
||||
*/ |
||||
private List<StatisticsFlowDataDetailVo> detail; |
||||
|
||||
|
||||
} |
@ -0,0 +1,165 @@
|
||||
package com.hnac.hzims.baseinfo.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzims.baseinfo.entity.IrrBDGate; |
||||
import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData; |
||||
import com.hnac.hzims.baseinfo.service.IGateInfoService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.List; |
||||
|
||||
@RestController |
||||
@RequestMapping("/reservoirBaseInfo/gateInfo") |
||||
@AllArgsConstructor |
||||
@Api(value = "闸门信息", tags = "闸门信息接口") |
||||
public class GateInfoController { |
||||
private final IGateInfoService gateInfoService; |
||||
|
||||
|
||||
@RequestMapping(value = "save", method = {RequestMethod.POST}) |
||||
@ResponseBody |
||||
@ApiOperation("添加闸门") |
||||
public R addGate(@RequestBody IrrBDGate irrBDGate) { |
||||
String deptId = AuthUtil.getDeptId(); |
||||
IrrBDGate tmp = new IrrBDGate(); |
||||
tmp.setStrobeCode(irrBDGate.getStrobeCode()); |
||||
tmp.setStcd(irrBDGate.getStcd()); |
||||
List<IrrBDGate> page = gateInfoService.list(tmp); |
||||
if (page != null && !page.isEmpty()) { |
||||
return R.fail(500, "存在重复的闸门代码为:" + irrBDGate.getStrobeCode() + "的数据"); |
||||
} |
||||
return R.data(gateInfoService.addGate(irrBDGate)); |
||||
} |
||||
|
||||
@RequestMapping(value = "remove", method = {RequestMethod.POST}) |
||||
@ResponseBody |
||||
@ApiOperation("删除闸门") |
||||
public R deleteGate(@ApiParam(value = "闸门id") @RequestParam Long id) { |
||||
boolean i = gateInfoService.removeById(id); |
||||
if (i) { |
||||
return R.data(true, "删除成功"); |
||||
} |
||||
return R.fail(500, "不存在此记录"); |
||||
} |
||||
|
||||
@RequestMapping(value = "updateGate", method = {RequestMethod.POST}) |
||||
@ResponseBody |
||||
@ApiOperation("修改闸门") |
||||
public R updateGate(@RequestBody IrrBDGate irrBDGate) { |
||||
|
||||
irrBDGate.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
||||
int i = gateInfoService.updateGate(irrBDGate); |
||||
if (i>0) { |
||||
return R.data(true, "修改成功"); |
||||
} |
||||
return R.fail(500, "修改失败"); |
||||
} |
||||
|
||||
@RequestMapping(value = "pageList", method = {RequestMethod.GET}) |
||||
@ResponseBody |
||||
@ApiOperation("查询闸门") |
||||
public R pageList(@ModelAttribute IrrBDGate irrBDGate, HttpServletRequest request, Query query) { |
||||
String deptId=request.getHeader("dept-id"); |
||||
if(StringUtil.isEmpty(deptId)) { |
||||
deptId =AuthUtil.getDeptId(); |
||||
} |
||||
|
||||
if(StringUtil.isNotBlank(deptId)) { |
||||
irrBDGate.setCreateDept(Long.valueOf(deptId)); |
||||
} |
||||
|
||||
IPage<IrrBDGate> page = gateInfoService.selectGate(irrBDGate, Condition.getPage(query)); |
||||
return R.data(page, "查询成功"); |
||||
} |
||||
|
||||
@RequestMapping(value = "list", method = {RequestMethod.GET}) |
||||
@ResponseBody |
||||
@ApiOperation("查询闸门") |
||||
public R list(@ModelAttribute IrrBDGate irrBDGate) { |
||||
|
||||
irrBDGate.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
||||
List<IrrBDGate> list = gateInfoService.list(irrBDGate); |
||||
return R.data(list, "查询成功"); |
||||
|
||||
} |
||||
|
||||
|
||||
/** |
||||
* 修改闸门配置 |
||||
* |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "saveRef", method = {RequestMethod.POST}) |
||||
@ResponseBody |
||||
@ApiOperation("修改闸门配置") |
||||
public R saveRef(@RequestBody IrrBDGateRefData irrBDGateRef) { |
||||
int i = gateInfoService.addGateRef(irrBDGateRef); |
||||
if (i > 0) { |
||||
return R.data(true, "修改成功"); |
||||
} |
||||
return R.fail(500, "修改失败"); |
||||
} |
||||
|
||||
/** |
||||
* 删除闸门配置 |
||||
* |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "removeRef", method = {RequestMethod.POST}) |
||||
@ResponseBody |
||||
@ApiOperation("删除闸门配置") |
||||
public R deleteGateRef(@ApiParam(value = "闸门编码") @RequestParam String gateCode) { |
||||
int i = gateInfoService.deleteGateRef(gateCode); |
||||
if (i > 0) { |
||||
return R.data(true, "删除成功"); |
||||
} |
||||
return R.fail(500, "删除失败"); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 修改闸门配置 |
||||
* |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "updateRef", method = {RequestMethod.POST}) |
||||
@ResponseBody |
||||
@ApiOperation("修改闸门配置") |
||||
public R updateGateRef(@RequestBody IrrBDGateRefData irrBDGateRef) { |
||||
|
||||
|
||||
int i = gateInfoService.updateGateRef(irrBDGateRef); |
||||
if (i > 0) { |
||||
return R.data(true, "修改成功"); |
||||
} |
||||
return R.fail(500, "修改失败"); |
||||
|
||||
|
||||
} |
||||
|
||||
/** |
||||
* 查询闸门配置 |
||||
* |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "detailRef", method = {RequestMethod.GET}) |
||||
@ResponseBody |
||||
@ApiOperation("查询闸门配置") |
||||
public R listRef(@ApiParam(value = "闸门编码") @RequestParam String gateCode) { |
||||
|
||||
IrrBDGateRefData res = gateInfoService.detailRef(gateCode); |
||||
return R.data(res, "查询成功"); |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,165 @@
|
||||
package com.hnac.hzims.baseinfo.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.hnac.hzims.baseinfo.entity.StRsrBsin; |
||||
import com.hnac.hzims.baseinfo.entity.StRsrHych; |
||||
import com.hnac.hzims.baseinfo.service.IStRsrBsinService; |
||||
import com.hnac.hzims.baseinfo.service.IStRsrHychService; |
||||
import com.hnac.hzims.baseinfo.vo.StRsrBsinVo; |
||||
import com.hnac.hzims.baseinfo.wrapper.StRsrBsinWrapper; |
||||
import io.swagger.annotations.*; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.common.cache.CacheNames; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import springfox.documentation.annotations.ApiIgnore; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@RestController |
||||
@RequestMapping("/reservoir/stRsrBsin") |
||||
@AllArgsConstructor |
||||
@Api(value = "水库信息", tags = "水库信息接口") |
||||
public class StRsrBsinController extends BladeController implements CacheNames { |
||||
|
||||
private final IStRsrBsinService stRsrBsinService; |
||||
|
||||
|
||||
private final IStRsrHychService stRsrHychService; |
||||
|
||||
/** |
||||
* 分页 |
||||
*/ |
||||
@GetMapping("/pageList") |
||||
@ApiImplicitParams({ |
||||
@ApiImplicitParam(name = "rscd", value = "水库代码", paramType = "query", dataType = "string"), |
||||
@ApiImplicitParam(name = "rtunm", value = "水库名称", paramType = "query", dataType = "string") |
||||
}) |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "分页", notes = "传入stRsrBsin") |
||||
public R<IPage<StRsrBsinVo>> pageList(@ApiIgnore @RequestParam Map<String, Object> param, Query query, HttpServletRequest request) { |
||||
LambdaQueryWrapper<StRsrBsin> wrapper=new LambdaQueryWrapper(); |
||||
if(param.get("rscd")!=null) { |
||||
wrapper.like(StRsrBsin::getRscd,param.get("rscd")); |
||||
} |
||||
if(param.get("rtunm")!=null) { |
||||
wrapper.like(StRsrBsin::getRtunm,param.get("rtunm")); |
||||
} |
||||
String deptId=request.getHeader("dept-id"); |
||||
if(StringUtil.isEmpty(deptId)) { |
||||
deptId =AuthUtil.getDeptId(); |
||||
} |
||||
if(StringUtil.isNotBlank(deptId)) { |
||||
wrapper.like(StRsrBsin::getCreateDept,deptId); |
||||
} |
||||
IPage<StRsrBsin> pages = stRsrBsinService.page(Condition.getPage(query), wrapper); |
||||
return R.data(StRsrBsinWrapper.build().pageVO(pages)); |
||||
} |
||||
|
||||
/** |
||||
* 列表 |
||||
*/ |
||||
@GetMapping("/list") |
||||
@ApiImplicitParams({ |
||||
@ApiImplicitParam(name = "rscd", value = "水库代码", paramType = "query", dataType = "string"), |
||||
@ApiImplicitParam(name = "rtunm", value = "水库名称", paramType = "query", dataType = "string") |
||||
}) |
||||
@ApiOperationSupport(order = 2) |
||||
@ApiOperation(value = "列表", notes = "传入stRsrBsin") |
||||
public R<List<StRsrBsinVo>> list(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletRequest request) { |
||||
LambdaQueryWrapper<StRsrBsin> wrapper=new LambdaQueryWrapper(); |
||||
if(param.get("rscd")!=null) { |
||||
wrapper.like(StRsrBsin::getRscd,param.get("rscd")); |
||||
} |
||||
if(param.get("rtunm")!=null) { |
||||
wrapper.like(StRsrBsin::getRtunm,param.get("rtunm")); |
||||
} |
||||
String deptId = request.getHeader("dept-id"); |
||||
if (StringUtil.isEmpty(deptId)) { |
||||
deptId = AuthUtil.getDeptId(); |
||||
} |
||||
if (StringUtil.isNotBlank(deptId)) { |
||||
wrapper.like(StRsrBsin::getCreateDept, deptId); |
||||
} |
||||
List<StRsrBsin> list = stRsrBsinService.list(wrapper); |
||||
return R.data(StRsrBsinWrapper.build().listVO(list)); |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 详情 |
||||
*/ |
||||
@GetMapping("/detail") |
||||
@ApiOperationSupport(order = 3) |
||||
@ApiOperation(value = "详情", notes = "传入stRsrBsin") |
||||
public R<Map<String,Object>> detail(StRsrBsin stRsrBsin) { |
||||
Map<String,Object> data=new HashMap<>(); |
||||
StRsrBsin detail = stRsrBsinService.getOne(Condition.getQueryWrapper(stRsrBsin)); |
||||
data.put("stRsrBsin", StRsrBsinWrapper.build().entityVO(detail)); |
||||
//防洪信息
|
||||
StRsrHych param=new StRsrHych(); |
||||
param.setRscd(stRsrBsin.getRscd()); |
||||
StRsrHych stRsrHych=stRsrHychService.getOne(Condition.getQueryWrapper(param)); |
||||
data.put("stRsrHych",stRsrHych); |
||||
return R.data(data); |
||||
} |
||||
|
||||
/** |
||||
* 新增 |
||||
*/ |
||||
@PostMapping("/save") |
||||
@ApiOperationSupport(order = 4) |
||||
@ApiOperation(value = "新增", notes = "传入stRsrBsin") |
||||
public R save(@RequestBody StRsrBsin stRsrBsin) { |
||||
if(stRsrBsin==null){ |
||||
return R.fail("水库信息不能为空"); |
||||
} |
||||
LambdaQueryWrapper<StRsrBsin> wrapper=new LambdaQueryWrapper(); |
||||
wrapper.eq(StRsrBsin::getRscd,stRsrBsin.getRscd()); |
||||
List<StRsrBsin> list =stRsrBsinService.list(wrapper); |
||||
if(list!=null && !list.isEmpty()){ |
||||
return R.fail("水库编码已存在"); |
||||
} |
||||
|
||||
wrapper=new LambdaQueryWrapper(); |
||||
wrapper.eq(StRsrBsin::getRtunm,stRsrBsin.getRtunm()); |
||||
list =stRsrBsinService.list(wrapper); |
||||
if(list!=null && !list.isEmpty()){ |
||||
return R.fail("水库名称已存在"); |
||||
} |
||||
|
||||
return R.status(stRsrBsinService.save(stRsrBsin)); |
||||
} |
||||
|
||||
/** |
||||
* 修改 |
||||
*/ |
||||
@PostMapping("/update") |
||||
@ApiOperationSupport(order = 5) |
||||
@ApiOperation(value = "修改", notes = "传入stRsrBsin") |
||||
public R update(@RequestBody StRsrBsin stRsrBsin) { |
||||
return R.status(stRsrBsinService.updateById(stRsrBsin)); |
||||
} |
||||
|
||||
|
||||
@PostMapping("/remove") |
||||
@ApiOperationSupport(order = 6) |
||||
@ApiOperation(value = "逻辑删除", notes = "ids") |
||||
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { |
||||
boolean temp = stRsrBsinService.deleteLogic(Func.toLongList(ids)); |
||||
return R.status(temp); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.hnac.hzims.baseinfo.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzims.baseinfo.entity.IrrBDGate; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface IrrBDGateMapper extends BaseMapper<IrrBDGate> { |
||||
|
||||
IPage<IrrBDGate> selectByExample(@Param("example") IrrBDGate example, IPage<IrrBDGate> page); |
||||
|
||||
|
||||
List<IrrBDGate> selectByExample(@Param("example") IrrBDGate example); |
||||
} |
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.baseinfo.mapper.IrrBDGateMapper"> |
||||
<resultMap id="BaseResultMap" type="com.hnac.hzims.baseinfo.entity.IrrBDGate" > |
||||
<id column="ID" property="id" jdbcType="BIGINT" /> |
||||
<result column="STROBE_CODE" property="strobeCode" jdbcType="VARCHAR" /> |
||||
<result column="WATERGATE_CODE" property="watergateCode" jdbcType="CHAR" /> |
||||
<result column="PRODUCING_AREA" property="producingArea" jdbcType="VARCHAR" /> |
||||
<result column="FACTORY" property="factory" jdbcType="VARCHAR" /> |
||||
<result column="STROBE_TYPE" property="strobeType" jdbcType="CHAR" /> |
||||
<result column="STROBE_MATERIAL" property="strobeMaterial" jdbcType="CHAR" /> |
||||
<result column="HEIGHT" property="height" jdbcType="DECIMAL" /> |
||||
<result column="WIDTH" property="width" jdbcType="DECIMAL" /> |
||||
<result column="THICKNESS" property="thickness" jdbcType="DECIMAL" /> |
||||
<result column="MOTIVITY" property="motivity" jdbcType="CHAR" /> |
||||
<result column="TYPE" property="type" jdbcType="CHAR" /> |
||||
<result column="VELOCITY" property="velocity" jdbcType="DECIMAL" /> |
||||
<result column="AREA_CODE" property="areaCode" jdbcType="VARCHAR" /> |
||||
<result column="LRCD" property="lrcd" jdbcType="VARCHAR" /> |
||||
<result column="SZHLDM" property="szhldm" jdbcType="VARCHAR" /> |
||||
<result column="DONGJ" property="dongj" jdbcType="REAL" /> |
||||
<result column="BEIW" property="beiw" jdbcType="REAL" /> |
||||
<result column="DISCHARGE" property="discharge" jdbcType="REAL" /> |
||||
<result column="STCD" property="stcd" jdbcType="VARCHAR" /> |
||||
</resultMap> |
||||
|
||||
<sql id="Base_Column_List" > |
||||
ID,STROBE_CODE, WATERGATE_CODE, PRODUCING_AREA, FACTORY, STROBE_TYPE, STROBE_MATERIAL, |
||||
HEIGHT, WIDTH, THICKNESS, MOTIVITY, TYPE, VELOCITY, AREA_CODE, LRCD, SZHLDM, DONGJ, |
||||
BEIW, DISCHARGE,STCD |
||||
</sql> |
||||
|
||||
|
||||
<select id="selectByExample" resultMap="BaseResultMap"> |
||||
select <include refid="Base_Column_List"/> |
||||
from irrbdgate |
||||
where is_deleted = 0 |
||||
<if test="example.createDept!=null"> |
||||
and CREATE_DEPT like concat(#{example.createDept},'%') |
||||
</if> |
||||
<if test="example.strobeCode!=null"> |
||||
and STROBE_CODE = #{example.strobeCode} |
||||
</if> |
||||
<if test="example.stcd!=null"> |
||||
and STCD = #{example.stcd} |
||||
</if> |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@
|
||||
package com.hnac.hzims.baseinfo.mapper; |
||||
|
||||
import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData; |
||||
|
||||
|
||||
public interface IrrBDGateRefDataMapper { |
||||
int insertSelective(IrrBDGateRefData record); |
||||
|
||||
int updateByPrimaryKeySelective(IrrBDGateRefData record); |
||||
|
||||
IrrBDGateRefData selectByPrimaryKey(String strobeCode); |
||||
|
||||
int deleteByPrimaryKey(String strobeCode); |
||||
} |
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.baseinfo.mapper.IrrBDGateRefDataMapper"> |
||||
|
||||
<resultMap id="BaseResultMap" type="com.hnac.hzims.baseinfo.entity.IrrBDGateRefData" > |
||||
<id column="STROBE_CODE" property="strobeCode" jdbcType="CHAR" /> |
||||
<result column="REFSTCD" property="refstcd" jdbcType="CHAR" /> |
||||
<result column="REFQPOINT" property="refqpoint" jdbcType="VARCHAR" /> |
||||
<result column="REFZPOINT" property="refzpoint" jdbcType="CHAR" /> |
||||
</resultMap> |
||||
|
||||
<sql id="Base_Column_List" > |
||||
STROBE_CODE, REFSTCD, REFQPOINT, REFZPOINT |
||||
</sql> |
||||
|
||||
|
||||
<insert id="insertSelective" parameterType="com.hnac.hzims.baseinfo.entity.IrrBDGateRefData" > |
||||
insert into irrbdgate_refdata |
||||
<trim prefix="(" suffix=")" suffixOverrides="," > |
||||
<if test="strobeCode != null" > |
||||
STROBE_CODE, |
||||
</if> |
||||
<if test="refstcd != null" > |
||||
REFSTCD, |
||||
</if> |
||||
<if test="refqpoint != null" > |
||||
REFQPOINT, |
||||
</if> |
||||
<if test="refzpoint != null" > |
||||
REFZPOINT, |
||||
</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides="," > |
||||
<if test="strobeCode != null" > |
||||
#{strobeCode,jdbcType=CHAR}, |
||||
</if> |
||||
<if test="refstcd != null" > |
||||
#{refstcd,jdbcType=CHAR}, |
||||
</if> |
||||
<if test="refqpoint != null" > |
||||
#{refqpoint,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="refzpoint != null" > |
||||
#{refzpoint,jdbcType=CHAR}, |
||||
</if> |
||||
</trim> |
||||
</insert> |
||||
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.hnac.hzims.baseinfo.entity.IrrBDGateRefData" > |
||||
update irrbdgate_refdata |
||||
<set > |
||||
<if test="refstcd != null" > |
||||
REFSTCD = #{refstcd,jdbcType=CHAR}, |
||||
</if> |
||||
<if test="refqpoint != null" > |
||||
REFQPOINT = #{refqpoint,jdbcType=VARCHAR}, |
||||
</if> |
||||
<if test="refzpoint != null" > |
||||
REFZPOINT = #{refzpoint,jdbcType=CHAR}, |
||||
</if> |
||||
</set> |
||||
where STROBE_CODE = #{strobeCode,jdbcType=CHAR} |
||||
</update> |
||||
|
||||
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > |
||||
select |
||||
<include refid="Base_Column_List" /> |
||||
from irrbdgate_refdata |
||||
where STROBE_CODE = #{strobeCode,jdbcType=CHAR} |
||||
</select> |
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" > |
||||
delete from irrbdgate_refdata |
||||
where STROBE_CODE = #{strobeCode,jdbcType=CHAR} |
||||
</delete> |
||||
|
||||
</mapper> |
@ -0,0 +1,15 @@
|
||||
package com.hnac.hzims.baseinfo.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzims.baseinfo.entity.StRsrBsin; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface StRsrBsinMapper extends UserDataScopeBaseMapper<StRsrBsin> { |
||||
|
||||
IPage<Map<String,Object>> selectByParam(IPage page, @Param("param") Map<String,Object> param); |
||||
List<Map<String,Object>> selectByParam(@Param("param") Map<String,Object> param); |
||||
} |
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.baseinfo.mapper.StRsrBsinMapper"> |
||||
<select id="selectByParam" resultType="java.util.HashMap"> |
||||
select bsin.id,bsin.rscd,hych.rsvrtp,bsin.RTUNM,bsin.ESLG,bsin.NRLT, |
||||
bsin.GIS_RANGE as gisRange,bsin.rvcd,bsin.stlc,hych.mjfl from st_rsr_bsin bsin |
||||
left join st_rsr_hych hych on bsin.rscd=hych.RSCD |
||||
WHERE bsin.IS_DELETED = 0 |
||||
<if test=" param.deptId!=null and param.deptId!='' "> |
||||
and bsin.CREATE_DEPT like concat(#{param.deptId},'%') |
||||
</if> |
||||
<if test=" param.rtunm!=null and param.rtunm!='' "> |
||||
and bsin.RTUNM like concat('%',#{param.rtunm},'%') |
||||
</if> |
||||
<if test=" param.dmtp!=null and param.dmtp!='' "> |
||||
and bsin.DMTP=#{param.dmtp} |
||||
</if> |
||||
<if test=" param.rsfn!=null and param.rsfn!='' "> |
||||
and bsin.RSFN=#{param.rsfn} |
||||
</if> |
||||
<if test=" param.rsvrtp!=null"> |
||||
and hych.RSVRTP=#{param.rsvrtp} |
||||
</if> |
||||
<if test=" param.areaCode!=null"> |
||||
and bsin.ADDVCD like concat(#{param.areaCode},'%') |
||||
</if> |
||||
|
||||
</select> |
||||
</mapper> |
@ -0,0 +1,7 @@
|
||||
package com.hnac.hzims.baseinfo.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzims.baseinfo.entity.StRsrHych; |
||||
|
||||
public interface StRsrHychMapper extends BaseMapper<StRsrHych> { |
||||
} |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.baseinfo.mapper.StRsrHychMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,25 @@
|
||||
package com.hnac.hzims.baseinfo.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.hnac.hzims.baseinfo.entity.IrrBDGate; |
||||
import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface IGateInfoService extends IService<IrrBDGate> { |
||||
boolean addGate(IrrBDGate irrBDGate); |
||||
|
||||
int updateGate(IrrBDGate irrBDGate); |
||||
|
||||
IPage<IrrBDGate> selectGate(IrrBDGate irrBDGate, IPage<IrrBDGate> page); |
||||
|
||||
int addGateRef(IrrBDGateRefData irrBDGateRefdata); |
||||
|
||||
int deleteGateRef(String gateCode); |
||||
|
||||
int updateGateRef(IrrBDGateRefData irrBDGateRefdata); |
||||
|
||||
IrrBDGateRefData detailRef(String gateCode); |
||||
List<IrrBDGate> list(IrrBDGate irrBDGate); |
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.baseinfo.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzims.baseinfo.entity.StRsrBsin; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface IStRsrBsinService extends BaseService<StRsrBsin> { |
||||
} |
@ -0,0 +1,10 @@
|
||||
package com.hnac.hzims.baseinfo.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.hnac.hzims.baseinfo.entity.StRsrHych; |
||||
|
||||
public interface IStRsrHychService { |
||||
|
||||
StRsrHych getOne(QueryWrapper<StRsrHych> wrapper); |
||||
|
||||
} |
@ -0,0 +1,75 @@
|
||||
package com.hnac.hzims.baseinfo.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.hnac.hzims.baseinfo.entity.IrrBDGate; |
||||
import com.hnac.hzims.baseinfo.entity.IrrBDGateRefData; |
||||
import com.hnac.hzims.baseinfo.mapper.IrrBDGateMapper; |
||||
import com.hnac.hzims.baseinfo.mapper.IrrBDGateRefDataMapper; |
||||
import com.hnac.hzims.baseinfo.service.IGateInfoService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class GateInfoServiceImpl extends ServiceImpl<IrrBDGateMapper, IrrBDGate> implements IGateInfoService { |
||||
|
||||
@Autowired |
||||
IrrBDGateMapper irrBDGateMapper; |
||||
|
||||
@Autowired |
||||
IrrBDGateRefDataMapper irrBDGateRefDataMapper; |
||||
|
||||
@Override |
||||
public boolean addGate(IrrBDGate irrBDGate) { |
||||
return this.save(irrBDGate); |
||||
} |
||||
|
||||
@Override |
||||
public int updateGate(IrrBDGate irrBDGate) { |
||||
//编辑时如果站点更换清除之前数据配置
|
||||
IrrBDGate judgeGate = this.getById(irrBDGate.getId()); |
||||
this.updateById(irrBDGate); |
||||
if (!irrBDGate.getCreateDept().equals(judgeGate.getCreateDept())) { |
||||
irrBDGateRefDataMapper.deleteByPrimaryKey(irrBDGate.getStrobeCode()); |
||||
} |
||||
return 1; |
||||
} |
||||
|
||||
@Override |
||||
public IPage<IrrBDGate> selectGate(IrrBDGate irrBDGate, IPage<IrrBDGate> page) { |
||||
IPage<IrrBDGate> irrBDGates = irrBDGateMapper.selectByExample(irrBDGate, page); |
||||
return irrBDGates; |
||||
} |
||||
|
||||
@Override |
||||
public int addGateRef(IrrBDGateRefData irrBDGateRefdata) { |
||||
int i = irrBDGateRefDataMapper.insertSelective(irrBDGateRefdata); |
||||
return i; |
||||
} |
||||
|
||||
@Override |
||||
public int deleteGateRef(String gateCode) { |
||||
int i = irrBDGateRefDataMapper.deleteByPrimaryKey(gateCode); |
||||
return i; |
||||
} |
||||
|
||||
@Override |
||||
public int updateGateRef(IrrBDGateRefData irrBDGateRefdata) { |
||||
int i = irrBDGateRefDataMapper.updateByPrimaryKeySelective(irrBDGateRefdata); |
||||
return i; |
||||
} |
||||
|
||||
@Override |
||||
public IrrBDGateRefData detailRef(String gateCode) { |
||||
IrrBDGateRefData res = irrBDGateRefDataMapper.selectByPrimaryKey(gateCode); |
||||
return res; |
||||
} |
||||
|
||||
@Override |
||||
public List<IrrBDGate> list(IrrBDGate irrBDGate) { |
||||
List<IrrBDGate> irrBDGates = irrBDGateMapper.selectByExample(irrBDGate); |
||||
return irrBDGates; |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.hnac.hzims.baseinfo.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzims.baseinfo.entity.StRsrBsin; |
||||
import com.hnac.hzims.baseinfo.mapper.StRsrBsinMapper; |
||||
import com.hnac.hzims.baseinfo.service.IStRsrBsinService; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service |
||||
public class StRsrBsinServiceImpl extends BaseServiceImpl<StRsrBsinMapper, StRsrBsin> implements IStRsrBsinService { |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.hnac.hzims.baseinfo.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.hnac.hzims.baseinfo.entity.StRsrHych; |
||||
import com.hnac.hzims.baseinfo.mapper.StRsrHychMapper; |
||||
import com.hnac.hzims.baseinfo.service.IStRsrHychService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
@Service |
||||
public class StRsrHychServiceImpl implements IStRsrHychService { |
||||
|
||||
@Resource |
||||
StRsrHychMapper stRsrHychMapper; |
||||
|
||||
|
||||
@Override |
||||
public StRsrHych getOne(QueryWrapper<StRsrHych> wrapper) { |
||||
return stRsrHychMapper.selectOne(wrapper); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.hnac.hzims.baseinfo.wrapper; |
||||
|
||||
import com.hnac.hzims.baseinfo.entity.StRsrBsin; |
||||
import com.hnac.hzims.baseinfo.vo.StRsrBsinVo; |
||||
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||
import org.springblade.core.tool.utils.BeanUtil; |
||||
import org.springblade.system.cache.RegionCache; |
||||
import org.springblade.system.entity.Region; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
public class StRsrBsinWrapper extends BaseEntityWrapper<StRsrBsin, StRsrBsinVo> { |
||||
public StRsrBsinWrapper() { |
||||
} |
||||
|
||||
public static StRsrBsinWrapper build() { |
||||
return new StRsrBsinWrapper(); |
||||
} |
||||
|
||||
@Override |
||||
public StRsrBsinVo entityVO(StRsrBsin entity) { |
||||
if(entity == null){ |
||||
return null; |
||||
} |
||||
StRsrBsinVo stRsrBsinVo = Objects.requireNonNull(BeanUtil.copy(entity, StRsrBsinVo.class)); |
||||
Region region=RegionCache.getByCode(entity.getAddvcd()); |
||||
if(region!=null) { |
||||
stRsrBsinVo.setAddvcdnm(region.getName()); |
||||
} |
||||
return stRsrBsinVo; |
||||
} |
||||
} |
@ -1,4 +1,30 @@
|
||||
#服务器端口 |
||||
server: |
||||
port: 8203 |
||||
|
||||
##服务器端口 |
||||
#server: |
||||
# port: 8200 |
||||
# |
||||
##数据源配置 |
||||
##spring: |
||||
## datasource: |
||||
## url: ${blade.datasource.dev.url} |
||||
## username: ${blade.datasource.dev.username} |
||||
## password: ${blade.datasource.dev.password} |
||||
# |
||||
#spring: |
||||
# #排除DruidDataSourceAutoConfigure |
||||
# autoconfigure: |
||||
# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure |
||||
# datasource: |
||||
# dynamic: |
||||
# #设置默认的数据源或者数据源组,默认值即为master |
||||
# primary: master |
||||
# datasource: |
||||
# master: |
||||
# url: jdbc:mysql://127.0.0.1:3306/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true |
||||
# username: root |
||||
# password: 123456 |
||||
# slave: |
||||
# url: jdbc:mysql://127.0.0.1:3306/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true |
||||
# username: root |
||||
# password: 123456 |
||||
#demo: |
||||
# name: aaa |
||||
|
@ -1,28 +1,28 @@
|
||||
#服务器端口 |
||||
server: |
||||
port: 8200 |
||||
|
||||
#数据源配置 |
||||
##服务器端口 |
||||
#server: |
||||
# port: 8200 |
||||
# |
||||
##数据源配置 |
||||
##spring: |
||||
## datasource: |
||||
## url: ${blade.datasource.prod.url} |
||||
## username: ${blade.datasource.prod.username} |
||||
## password: ${blade.datasource.prod.password} |
||||
# |
||||
#spring: |
||||
# #排除DruidDataSourceAutoConfigure |
||||
# autoconfigure: |
||||
# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure |
||||
# datasource: |
||||
# url: ${blade.datasource.prod.url} |
||||
# username: ${blade.datasource.prod.username} |
||||
# password: ${blade.datasource.prod.password} |
||||
|
||||
spring: |
||||
#排除DruidDataSourceAutoConfigure |
||||
autoconfigure: |
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure |
||||
datasource: |
||||
dynamic: |
||||
#设置默认的数据源或者数据源组,默认值即为master |
||||
primary: master |
||||
datasource: |
||||
master: |
||||
url: ${blade.datasource.demo.master.url} |
||||
username: ${blade.datasource.demo.master.username} |
||||
password: ${blade.datasource.demo.master.password} |
||||
slave: |
||||
url: ${blade.datasource.demo.slave.url} |
||||
username: ${blade.datasource.demo.slave.username} |
||||
password: ${blade.datasource.demo.slave.password} |
||||
# dynamic: |
||||
# #设置默认的数据源或者数据源组,默认值即为master |
||||
# primary: master |
||||
# datasource: |
||||
# master: |
||||
# url: ${blade.datasource.demo.master.url} |
||||
# username: ${blade.datasource.demo.master.username} |
||||
# password: ${blade.datasource.demo.master.password} |
||||
# slave: |
||||
# url: ${blade.datasource.demo.slave.url} |
||||
# username: ${blade.datasource.demo.slave.username} |
||||
# password: ${blade.datasource.demo.slave.password} |
||||
|
@ -0,0 +1,194 @@
|
||||
package com.hnac.hzims.equipment.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
||||
import com.hnac.hzims.equipment.entity.EmTreeNode; |
||||
import com.hnac.hzims.equipment.service.IEmInfoService; |
||||
import io.swagger.annotations.*; |
||||
import lombok.AllArgsConstructor; |
||||
|
||||
import javax.validation.Valid; |
||||
|
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import com.hnac.hzims.common.constant.CommonConstant; |
||||
|
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.node.ForestNodeMerger; |
||||
import org.springblade.core.tool.node.INode; |
||||
import org.springblade.core.tool.node.TreeNode; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import springfox.documentation.annotations.ApiIgnore; |
||||
|
||||
import com.hnac.hzims.equipment.entity.EmOreanizationEntity; |
||||
import com.hnac.hzims.equipment.vo.EmOreanizationVO; |
||||
import com.hnac.hzims.equipment.wrapper.EmOreanizationWrapper; |
||||
import com.hnac.hzims.equipment.service.IEmOreanizationService; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 设备组织控制器 |
||||
* |
||||
* @author moze |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/em/oreanization") |
||||
@Api(value = "设备组织结构", tags = "设备组织结构") |
||||
public class EmOreanizationController extends BladeController { |
||||
|
||||
private final IEmOreanizationService em_oreanizationService; |
||||
|
||||
private final IEmInfoService emInfoService; |
||||
|
||||
/** |
||||
* 详情 |
||||
*/ |
||||
@GetMapping("/detail") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "详情", notes = "传入ID") |
||||
public R<EmOreanizationEntity> detail(@ApiParam(value = "主键", required = true) @RequestParam String id) { |
||||
EmOreanizationEntity detail = em_oreanizationService.getById(Func.toLong(id)); |
||||
return R.data(detail); |
||||
} |
||||
|
||||
/** |
||||
* 加载当前站点设备的组织结构 |
||||
*/ |
||||
/*@GetMapping("/initLoad") |
||||
@ApiOperationSupport(order = 2) |
||||
@ApiOperation(value = "初始化加载", notes = "加载当前站点设备的组织结构") |
||||
public R<List<TreeNode>> init() { |
||||
return R.data(em_oreanizationService.initLoad(AuthUtil.getTenantId())); |
||||
}*/ |
||||
@ApiOperation("获取目录树形结构") |
||||
@GetMapping("/initLoad") |
||||
public R<List<EmTreeNode>> getStructTree() { |
||||
return em_oreanizationService.groupTree(); |
||||
} |
||||
|
||||
/** |
||||
* 新增 |
||||
*/ |
||||
@PostMapping("/save") |
||||
@ApiOperationSupport(order = 3) |
||||
@ApiOperation(value = "新增", notes = "传入em_oreanization") |
||||
public R save(@Valid @RequestBody EmOreanizationEntity em_oreanization) { |
||||
if (StringUtil.isNotBlank(em_oreanization.getPid() + "")) { |
||||
List<EmOreanizationEntity> emOreanizationEntities = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ |
||||
//eq("PID", em_oreanization.getPid());
|
||||
eq("NAME", em_oreanization.getName()); |
||||
}}); |
||||
if (CollectionUtil.isNotEmpty(emOreanizationEntities)) { |
||||
return R.fail("名称已存在!"); |
||||
} |
||||
} |
||||
em_oreanization.setSort(em_oreanizationService.sort(em_oreanization.getPid())); |
||||
return R.status(em_oreanizationService.save(em_oreanization)); |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 修改 |
||||
*/ |
||||
@PostMapping("/update") |
||||
@ApiOperationSupport(order = 4) |
||||
@ApiOperation(value = "修改", notes = "传入em_oreanization") |
||||
public R update(@Valid @RequestBody EmOreanizationEntity em_oreanization) { |
||||
List<EmOreanizationEntity> list = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ |
||||
eq("ID", em_oreanization.getId()); |
||||
eq("NAME", em_oreanization.getName()); |
||||
}}); |
||||
if (CollectionUtil.isEmpty(list)) { |
||||
List<EmOreanizationEntity> emOreanizationEntities = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ |
||||
eq("PID", em_oreanization.getPid()); |
||||
eq("NAME", em_oreanization.getName()); |
||||
}}); |
||||
if (CollectionUtil.isNotEmpty(emOreanizationEntities)) { |
||||
return R.fail("同级名称已存在!"); |
||||
} |
||||
|
||||
} |
||||
return R.status(em_oreanizationService.updateOrg(em_oreanization)); |
||||
} |
||||
|
||||
/** |
||||
* 备用-新增或修改 |
||||
*/ |
||||
@PostMapping("/submit") |
||||
@ApiOperationSupport(order = 5) |
||||
@ApiOperation(value = "新增或修改", notes = "传入em_oreanization") |
||||
public R submit(@Valid @RequestBody EmOreanizationEntity em_oreanization) { |
||||
if (StringUtil.isNotBlank(em_oreanization.getPid() + "")) { |
||||
List<EmOreanizationEntity> emOreanizationEntities = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ |
||||
eq("NAME", em_oreanization.getName()); |
||||
eq("PID", em_oreanization.getPid()); |
||||
}}); |
||||
if (CollectionUtil.isNotEmpty(emOreanizationEntities)) { |
||||
return R.fail("同级名称已存在!"); |
||||
} |
||||
} |
||||
return R.status(em_oreanizationService.saveOrUpdate(em_oreanization)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@PostMapping("/remove") |
||||
@ApiOperationSupport(order = 6) |
||||
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
||||
String[] split = ids.split(","); |
||||
for (String id : split) { |
||||
List<EmOreanizationEntity> isThere = em_oreanizationService.list(new QueryWrapper<EmOreanizationEntity>() {{ |
||||
eq("PID", id); |
||||
}}); |
||||
if (CollectionUtil.isNotEmpty(isThere)) { |
||||
return R.fail("请先删除子组织"); |
||||
} |
||||
List<EmInfoEntity> refOreanization = emInfoService.list(new QueryWrapper<EmInfoEntity>() {{ |
||||
eq("REF_OREANIZATION", id); |
||||
}}); |
||||
if (CollectionUtil.isNotEmpty(refOreanization)) { |
||||
return R.fail("请先删除设备信息"); |
||||
} |
||||
|
||||
} |
||||
return R.status(em_oreanizationService.deleteLogic(Func.toLongList(ids))); |
||||
} |
||||
|
||||
/** |
||||
* 下移 |
||||
*/ |
||||
@PostMapping("/down") |
||||
@ApiOperationSupport(order = 7) |
||||
@ApiOperation(value = "下移", notes = "传入ID") |
||||
public R down(@ApiParam(value = "主键", required = true) @RequestParam String id1, @ApiParam(value = "主键", required = true) @RequestParam String id2) { |
||||
return R.status(em_oreanizationService.translocation(Func.toLong(id1), Func.toLong(id2))); |
||||
} |
||||
|
||||
/** |
||||
* 上移 |
||||
*/ |
||||
@PostMapping("/up") |
||||
@ApiOperationSupport(order = 8) |
||||
@ApiOperation(value = "上移", notes = "传入ID") |
||||
public R up(@ApiParam(value = "主键", required = true) @RequestParam String id1, @ApiParam(value = "主键", required = true) @RequestParam String id2) { |
||||
return R.status(em_oreanizationService.translocation(Func.toLong(id1), Func.toLong(id2))); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.hnac.hzims.equipment.mapper; |
||||
|
||||
import org.springblade.core.datascope.annotation.UserDataAuth; |
||||
import com.hnac.hzims.equipment.entity.EmOreanizationEntity; |
||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||
import org.springblade.core.tool.node.TreeNode; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Mapper 接口 |
||||
* |
||||
* @author Chill |
||||
*/ |
||||
public interface EmOreanizationMapper extends UserDataScopeBaseMapper<EmOreanizationEntity> { |
||||
|
||||
@UserDataAuth |
||||
List<TreeNode> selectTreeList(String tenantId); |
||||
|
||||
int selectMaxSort(Long pid); |
||||
} |
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.equipment.mapper.EmOreanizationMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="em_oreanizationResultMap" type="com.hnac.hzims.equipment.entity.EmOreanizationEntity"> |
||||
<result column="ID" property="id"/> |
||||
<result column="PID" property="pid"/> |
||||
<result column="STATUS" property="status"/> |
||||
<result column="NAME" property="name"/> |
||||
<result column="TYPE_CODE" property="typeCode"/> |
||||
<result column="SORT" property="sort"/> |
||||
<result column="REMARK" property="remark"/> |
||||
<result column="TENANT_ID" property="tenantId"/> |
||||
<result column="CREATE_TIME" property="createTime"/> |
||||
<result column="UPDATE_TIME" property="updateTime"/> |
||||
<result column="CREATE_USER" property="createUser"/> |
||||
<result column="UPDATE_USER" property="updateUser"/> |
||||
<result column="IS_DELETED" property="isDeleted"/> |
||||
<result column="CREATE_DEPT" property="createDept"/> |
||||
</resultMap> |
||||
|
||||
<select id="selectTreeList" resultType="org.springblade.core.tool.node.TreeNode" parameterType="string"> |
||||
SELECT |
||||
ID AS 'key', |
||||
PID AS parentId, |
||||
NAME AS title, |
||||
ID AS 'value', |
||||
Id, |
||||
CREATE_USER, |
||||
CREATE_DEPT |
||||
FROM |
||||
HZIMS_EM_OREANIZATION |
||||
WHERE IS_DELETED=0 |
||||
and TENANT_ID = #{tenantId} |
||||
ORDER BY |
||||
PID, |
||||
SORT |
||||
</select> |
||||
|
||||
<select id="selectMaxSort" resultType="integer"> |
||||
SELECT IFNULL(MAX(SORT),0) |
||||
FROM HZIMS_EM_OREANIZATION |
||||
WHERE PID=#{pid} |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,10 @@
|
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563307857514502', 0, 'equipment', 'em_attach', 'menu', '/equipment/em_attach', NULL, 1, 1, 0, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563307857514503', '1369563307857514502', 'em_attach_add', '新增', 'add', '/equipment/em_attach/add', 'plus', 1, 2, 1, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563307857514504', '1369563307857514502', 'em_attach_edit', '修改', 'edit', '/equipment/em_attach/edit', 'form', 2, 2, 2, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563307857514505', '1369563307857514502', 'em_attach_delete', '删除', 'delete', '/api/equipment/em_attach/remove', 'delete', 3, 2, 3, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563307857514506', '1369563307857514502', 'em_attach_view', '查看', 'view', '/equipment/em_attach/view', 'file-text', 4, 2, 2, 1, NULL, 0); |
@ -0,0 +1,10 @@
|
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306376925191', 0, 'equipment', 'em_info', 'menu', '/equipment/em_info', NULL, 1, 1, 0, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306376925192', '1369563306376925191', 'em_info_add', '新增', 'add', '/equipment/em_info/add', 'plus', 1, 2, 1, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306376925193', '1369563306376925191', 'em_info_edit', '修改', 'edit', '/equipment/em_info/edit', 'form', 2, 2, 2, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306376925194', '1369563306376925191', 'em_info_delete', '删除', 'delete', '/api/equipment/em_info/remove', 'delete', 3, 2, 3, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306376925195', '1369563306376925191', 'em_info_view', '查看', 'view', '/equipment/em_info/view', 'file-text', 4, 2, 2, 1, NULL, 0); |
@ -0,0 +1,10 @@
|
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369816257129451526', 0, 'equipment', 'em_model', 'menu', '/equipment/em_model', NULL, 1, 1, 0, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369816257129451527', '1369816257129451526', 'em_model_add', '新增', 'add', '/equipment/em_model/add', 'plus', 1, 2, 1, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369816257129451528', '1369816257129451526', 'em_model_edit', '修改', 'edit', '/equipment/em_model/edit', 'form', 2, 2, 2, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369816257129451529', '1369816257129451526', 'em_model_delete', '删除', 'delete', '/api/equipment/em_model/remove', 'delete', 3, 2, 3, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369816257129451530', '1369816257129451526', 'em_model_view', '查看', 'view', '/equipment/em_model/view', 'file-text', 4, 2, 2, 1, NULL, 0); |
@ -0,0 +1,10 @@
|
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563308268556289', 0, 'equipment', 'em_model_param', 'menu', '/equipment/em_model_param', NULL, 1, 1, 0, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563308268556290', '1369563308268556289', 'em_model_param_add', '新增', 'add', '/equipment/em_model_param/add', 'plus', 1, 2, 1, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563308268556291', '1369563308268556289', 'em_model_param_edit', '修改', 'edit', '/equipment/em_model_param/edit', 'form', 2, 2, 2, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563308268556292', '1369563308268556289', 'em_model_param_delete', '删除', 'delete', '/api/equipment/em_model_param/remove', 'delete', 3, 2, 3, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563308268556293', '1369563308268556289', 'em_model_param_view', '查看', 'view', '/equipment/em_model_param/view', 'file-text', 4, 2, 2, 1, NULL, 0); |
@ -0,0 +1,10 @@
|
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563305466761217', 0, 'equipment', 'em_oreanization', 'menu', '/equipment/em_oreanization', NULL, 1, 1, 0, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563305466761218', '1369563305466761217', 'em_oreanization_add', '新增', 'add', '/equipment/em_oreanization/add', 'plus', 1, 2, 1, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563305466761219', '1369563305466761217', 'em_oreanization_edit', '修改', 'edit', '/equipment/em_oreanization/edit', 'form', 2, 2, 2, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563305466761220', '1369563305466761217', 'em_oreanization_delete', '删除', 'delete', '/api/equipment/em_oreanization/remove', 'delete', 3, 2, 3, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563305466761221', '1369563305466761217', 'em_oreanization_view', '查看', 'view', '/equipment/em_oreanization/view', 'file-text', 4, 2, 2, 1, NULL, 0); |
@ -0,0 +1,10 @@
|
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306804744193', 0, 'equipment', 'em_param', 'menu', '/equipment/em_param', NULL, 1, 1, 0, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306804744194', '1369563306804744193', 'em_param_add', '新增', 'add', '/equipment/em_param/add', 'plus', 1, 2, 1, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306804744195', '1369563306804744193', 'em_param_edit', '修改', 'edit', '/equipment/em_param/edit', 'form', 2, 2, 2, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306804744196', '1369563306804744193', 'em_param_delete', '删除', 'delete', '/api/equipment/em_param/remove', 'delete', 3, 2, 3, 1, NULL, 0); |
||||
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||
VALUES ('1369563306804744197', '1369563306804744193', 'em_param_view', '查看', 'view', '/equipment/em_param/view', 'file-text', 4, 2, 2, 1, NULL, 0); |
@ -0,0 +1,32 @@
|
||||
package com.hnac.hzims.equipment.service; |
||||
|
||||
import com.hnac.hzims.equipment.entity.EmTreeNode; |
||||
import com.hnac.hzims.equipment.vo.EmOreanizationVO; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import com.hnac.hzims.equipment.entity.EmOreanizationEntity; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.node.INode; |
||||
import org.springblade.core.tool.node.TreeNode; |
||||
|
||||
import javax.validation.Valid; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 服务类 |
||||
* |
||||
* @author moze |
||||
*/ |
||||
public interface IEmOreanizationService extends BaseService<EmOreanizationEntity> { |
||||
|
||||
List<TreeNode> initLoad(String tenantId); |
||||
|
||||
boolean translocation(long id1, long id2); |
||||
|
||||
boolean updateOrg(@Valid EmOreanizationEntity em_oreanization); |
||||
|
||||
boolean saveOrg(@Valid EmOreanizationEntity em_oreanization); |
||||
|
||||
R<List<EmTreeNode>> groupTree(); |
||||
|
||||
Integer sort(Long id); |
||||
} |
@ -0,0 +1,162 @@
|
||||
package com.hnac.hzims.equipment.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.hnac.hzims.equipment.entity.EmTreeNode; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import com.hnac.hzims.equipment.entity.EmOreanizationEntity; |
||||
import com.hnac.hzims.equipment.mapper.EmOreanizationMapper; |
||||
import com.hnac.hzims.equipment.service.IEmOreanizationService; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.node.ForestNodeMerger; |
||||
import org.springblade.core.tool.node.TreeNode; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.validation.Valid; |
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* 服务实现类 |
||||
* |
||||
* @author Chill |
||||
*/ |
||||
@Service |
||||
public class EmOreanizationServiceImpl extends BaseServiceImpl<EmOreanizationMapper, EmOreanizationEntity> implements IEmOreanizationService { |
||||
|
||||
@Autowired |
||||
private EmOreanizationMapper oreanizationMapper; |
||||
@Override |
||||
public List<TreeNode> initLoad(String tenantId) { |
||||
List<TreeNode> treeList = oreanizationMapper.selectTreeList(tenantId); |
||||
return ForestNodeMerger.merge(treeList); |
||||
} |
||||
|
||||
@Override |
||||
public boolean translocation(long id1, long id2) { |
||||
EmOreanizationEntity org1 = this.getById(id1); |
||||
EmOreanizationEntity org2 = this.getById(id2); |
||||
boolean flag = false; |
||||
if(Func.isNotEmpty(org1) && Func.isNotEmpty(org2)){ |
||||
Integer sort = org1.getSort(); |
||||
org1.setSort(org2.getSort()); |
||||
org2.setSort(sort); |
||||
List<EmOreanizationEntity> rows = new ArrayList<EmOreanizationEntity>(); |
||||
rows.add(org1); |
||||
rows.add(org2); |
||||
flag = this.updateBatchById(rows); |
||||
}else { |
||||
flag = false; |
||||
} |
||||
return flag; |
||||
} |
||||
|
||||
@Override |
||||
public boolean updateOrg(@Valid EmOreanizationEntity em_oreanization) { |
||||
EmOreanizationEntity temp = this.getById(em_oreanization.getId()); |
||||
// 处理序号问题
|
||||
if(Func.isNotEmpty(temp) |
||||
&& temp.getPid() != null |
||||
&& em_oreanization.getPid() != null |
||||
&& temp.getPid().longValue() != em_oreanization.getPid().longValue()){ |
||||
int maxSort = oreanizationMapper.selectMaxSort(em_oreanization.getPid()) + 1; |
||||
em_oreanization.setSort(maxSort); |
||||
return this.updateById(em_oreanization); |
||||
}else { |
||||
return this.updateById(em_oreanization); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean saveOrg(EmOreanizationEntity em_oreanization) { |
||||
|
||||
int maxSort = oreanizationMapper.selectMaxSort(em_oreanization.getPid()) + 1; |
||||
em_oreanization.setSort(maxSort); |
||||
int cnt = oreanizationMapper.insert(em_oreanization); |
||||
return cnt > 0; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override |
||||
public R<List<EmTreeNode>> groupTree() { |
||||
|
||||
QueryWrapper<EmOreanizationEntity> queryWrapper = new QueryWrapper<EmOreanizationEntity>() {{ |
||||
eq("PID",0); |
||||
}}; |
||||
queryWrapper.orderByAsc("PID","SORT"); |
||||
//数据库里所有pid为空的为根节点组织
|
||||
List<EmOreanizationEntity> structs = oreanizationMapper.selectList(queryWrapper); |
||||
//查询所有数据 ListAll
|
||||
QueryWrapper<EmOreanizationEntity> queryWrapper2 = new QueryWrapper<EmOreanizationEntity>() {{ |
||||
}}; |
||||
queryWrapper2.orderByAsc("PID","SORT"); |
||||
List<EmOreanizationEntity> resultList = oreanizationMapper.selectList(queryWrapper2); |
||||
//把组织信息换成节点
|
||||
List<EmTreeNode> rootNodes = new ArrayList<>(); |
||||
for (EmOreanizationEntity struct : structs) { |
||||
EmTreeNode treeNode = new EmTreeNode(); |
||||
treeNode.setId(struct.getId()); |
||||
treeNode.setParentId(struct.getPid()); |
||||
treeNode.setTitle(struct.getName()); |
||||
treeNode.setLevel(1); |
||||
rootNodes.add(groupToNode(treeNode)); |
||||
} |
||||
//生成树
|
||||
List<EmTreeNode> nodeList = createGroupAndStationTree(resultList, rootNodes); |
||||
return R.data(nodeList); |
||||
} |
||||
|
||||
@Override |
||||
public Integer sort(Long id) { |
||||
return oreanizationMapper.selectMaxSort(id) + 1; |
||||
} |
||||
|
||||
private EmTreeNode groupToNode(EmTreeNode treeNode) { |
||||
if (Objects.isNull(treeNode)) { |
||||
return null; |
||||
} |
||||
return treeNode; |
||||
} |
||||
|
||||
public List<EmTreeNode> createGroupAndStationTree(List<EmOreanizationEntity> resultList, List<EmTreeNode> rootNodes) { |
||||
if (rootNodes == null || rootNodes.size() < 1) { |
||||
return null; |
||||
} |
||||
//遍历根节点
|
||||
for (EmTreeNode rootNode : rootNodes) { |
||||
//找到子节点
|
||||
List<EmTreeNode> childNodes = listGroupNodeByPid(resultList,rootNode.getId()+"",rootNode.getLevel()); |
||||
//如果没有数据了,就跳出循环
|
||||
if (childNodes == null || childNodes.size() == 0) { |
||||
continue; |
||||
} |
||||
//遍历子节点
|
||||
rootNode.setChildren(createGroupAndStationTree(resultList, childNodes)); |
||||
} |
||||
return rootNodes; |
||||
} |
||||
|
||||
public List<EmTreeNode> listGroupNodeByPid(List<EmOreanizationEntity> resultList, String id,Integer level){ |
||||
List<EmTreeNode> childNodes = new ArrayList<>(); |
||||
level = level+1; |
||||
for (EmOreanizationEntity struct : resultList) { |
||||
EmTreeNode treeNode = new EmTreeNode(); |
||||
|
||||
if(id.equals(struct.getPid()+"")){ |
||||
treeNode.setId(struct.getId()); |
||||
treeNode.setParentId(struct.getPid()); |
||||
treeNode.setTitle(struct.getName()); |
||||
treeNode.setLevel(level); |
||||
childNodes.add(treeNode); |
||||
} |
||||
} |
||||
return childNodes; |
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.hnac.hzims.message_alarm.mqtt; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hnac.hzims.message_alarm.entity.MessageResponseData; |
||||
import com.hnac.hzims.message_alarm.strategy.FactoryStrategy; |
||||
import com.hnac.hzims.message_alarm.strategy.Strategy; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.mqtt.customer.IMqttReceive; |
||||
import org.springblade.mqtt.customer.annotation.MqttReceive; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
//告警消费主题
|
||||
@Service |
||||
@MqttReceive(topicName = "message_alarm_center/handleFlowWarn") |
||||
@Slf4j |
||||
public class MessageFlowWranConsumer implements IMqttReceive {//消费(flowAlarm)json数据
|
||||
|
||||
@Autowired |
||||
FactoryStrategy factoryForStrategy; |
||||
|
||||
@Override |
||||
public void handlerMessage(String message) { |
||||
log.info("收到告警消息: "+message); |
||||
//解析消息 发送消息
|
||||
MessageResponseData responseData= JSONObject.parseObject(message,MessageResponseData.class); |
||||
//获取对应策略
|
||||
Strategy strategy=factoryForStrategy.getStrategy(responseData.getBodyType()); |
||||
if(strategy!=null) {//执行
|
||||
strategy.handleJson(responseData); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,191 @@
|
||||
package com.hnac.hzims.message_alarm.strategy; |
||||
|
||||
import com.alibaba.fastjson.JSON; |
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.hnac.hzims.common.logs.utils.StringUtils; |
||||
import com.hnac.hzims.message_alarm.dto.MessageDTO; |
||||
import com.hnac.hzims.message_alarm.entity.MessageMonitorObjAttr; |
||||
import com.hnac.hzims.message_alarm.entity.MessageResponseData; |
||||
import com.hnac.hzims.message_alarm.entity.MessageSendInfo; |
||||
import com.hnac.hzims.message_alarm.enums.PushTypeEnum; |
||||
import com.hnac.hzims.message_alarm.enums.TemplateTypeEnum; |
||||
import com.hnac.hzims.message_alarm.mapper.MessageMonitorObjAttrMapper; |
||||
import com.hnac.hzims.message_alarm.service.IMessageStrategyService; |
||||
import com.hnac.hzims.message_alarm.util.CheckDataRationalUtil; |
||||
import com.hnac.hzims.message_alarm.vo.MessageObjTemplateVo; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.flow.core.entity.BladeFlow; |
||||
import org.springblade.flow.core.feign.IFlowClient; |
||||
import org.springblade.system.user.entity.User; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
|
||||
//告警解析策略
|
||||
@Component("flowWarn") |
||||
@Slf4j |
||||
public class FlowWarnStrategy implements Strategy { |
||||
@Autowired |
||||
IMessageStrategyService messageStrategyService; |
||||
|
||||
@Autowired |
||||
IFlowClient flowClient; |
||||
|
||||
@Resource |
||||
private MessageMonitorObjAttrMapper messageMonitorObjAttrMapper; |
||||
|
||||
@Override |
||||
public void handleJson(MessageResponseData responseData) { |
||||
log.info("入参responseData:{}", responseData); |
||||
//可执行模板
|
||||
List<MessageObjTemplateVo> executableTemplate = null; |
||||
|
||||
//解析属性列表数据
|
||||
List<Map<String, Object>> attrListByObject = CheckDataRationalUtil.parseAttrListByObject(responseData.getData()); |
||||
if (attrListByObject == null || attrListByObject.isEmpty()) { |
||||
return; |
||||
} |
||||
|
||||
//查找符合条件的模板
|
||||
List<MessageObjTemplateVo> list = messageStrategyService.queryMessageObjTemplateVo(responseData.getSchemeId(), |
||||
responseData.getDeviceCode(), TemplateTypeEnum.FLOW_WARN.getCode()); |
||||
log.info("告警模板总个数:" + list.size()); |
||||
|
||||
//筛选出可执行的模板
|
||||
if (list != null && !list.isEmpty()) { |
||||
executableTemplate = new ArrayList<>(); |
||||
|
||||
//获取数据中的最高级
|
||||
int highLevel = CheckDataRationalUtil.getHighLevel(attrListByObject); |
||||
|
||||
for (MessageObjTemplateVo vo : list) { |
||||
//校验模板与数据属性吻合度
|
||||
boolean checkAttr = CheckDataRationalUtil.checkAttr(vo, responseData); |
||||
if (!checkAttr) { |
||||
continue; |
||||
} |
||||
//对象有属性的 针对自己的等级评价
|
||||
// 对象不包含属性的 已字段中的最高等级评价
|
||||
boolean checkObj = CheckDataRationalUtil.checkAlarmObj(vo, attrListByObject, highLevel); |
||||
if (!checkObj) {//筛选出可执行的模板
|
||||
continue; |
||||
} |
||||
// 替换模板content
|
||||
String templateContent = buildContent(responseData.getData(), vo.getTemplateContent()); |
||||
vo.setTemplateContent(templateContent); |
||||
executableTemplate.add(vo); |
||||
} |
||||
log.info("告警模板符合个数:" + executableTemplate.size()); |
||||
|
||||
//发送消息+存储消息
|
||||
for (MessageObjTemplateVo vo : executableTemplate) { |
||||
//解析模板内容
|
||||
String message = CheckDataRationalUtil.parseContent(vo.getTemplateContent(), responseData); |
||||
log.info("模板:" + vo.getTemplateTitle() + ",发送告警消息:" + message); |
||||
|
||||
//组装消息
|
||||
// // 造假数据
|
||||
// MessageSendInfo info = new MessageSendInfo();
|
||||
// HashMap<Long, String> map = new HashMap<>();
|
||||
// map.put(1710229795322830849L, "绿色小水电");
|
||||
// info.setPerson(map);
|
||||
// info.setTenantId("20000");
|
||||
// info.setObjectSource("111");
|
||||
// info.setPhones("13107280912");
|
||||
// info.setMessage(message);
|
||||
// info.setTitle("title");
|
||||
// info.setObjectCode("JSCZ001");
|
||||
// info.setSchemeId(1769602788549591042L);
|
||||
MessageSendInfo info = messageStrategyService.getSendMessageInfo(vo, message); |
||||
if (info == null) { |
||||
continue; |
||||
} |
||||
//发送消息
|
||||
if (PushTypeEnum.SMS.getCode().equals(info.getPushType())) { |
||||
// todo 短信配置
|
||||
// 高板岩一站 电站生态流量预警:核定流量0.02(m³/s),当前日均流量0.017(m³/s),建议生态流量后续9小时的实时流量值不低于0.054(m³/s)
|
||||
messageStrategyService.sendFlowWarnMessage(message, info.getPhones()); |
||||
} else { |
||||
// messageStrategyService.sendInfo(info);
|
||||
} |
||||
|
||||
|
||||
//启动流程实例
|
||||
if (vo.getProcessKey() != null && !"".equals(vo.getProcessKey().trim())) {//I II III IV 启动流程
|
||||
Map<String, Object> variables = new HashMap<>(); |
||||
variables.put("alarm_msg", message); |
||||
|
||||
String processInstanceId = null; |
||||
if (vo.getAutoStartProcess() != null && vo.getAutoStartProcess().intValue() == 1) {//自动触发
|
||||
R<BladeFlow> bladeFlowR = flowClient.startProcessInstanceByKey(vo.getProcessKey(), "message_alarm_center", variables); |
||||
processInstanceId = bladeFlowR.getData().getProcessInstanceId(); |
||||
} |
||||
//保存信息
|
||||
messageStrategyService.saveFlowWarnMessage(info, processInstanceId, vo.getProcessKey(), vo.getAlarmLevel(), JSON.toJSONString(responseData)); |
||||
} else {//V无需启动流程 需要相关人员确认一下
|
||||
messageStrategyService.saveFlowWarnMessage(info, null, null, vo.getAlarmLevel(), JSON.toJSONString(responseData)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private final static String JOIN_CODE = "、"; |
||||
|
||||
/** |
||||
* 组装消息模板 |
||||
* |
||||
* @param templateContent 模板 |
||||
* @param responseData 数据 |
||||
* @return |
||||
*/ |
||||
private MessageDTO messageMake(String phones, String templateContent, MessageResponseData responseData, List<Map<String, Object>> list) { |
||||
MessageDTO messageDto = new MessageDTO(); |
||||
messageDto.setStation(responseData.getObjectName()); |
||||
messageDto.setTime(responseData.getCreateDate()); |
||||
messageDto.setPhone(phones); |
||||
Map<String, String> keyToAttr = messageMonitorObjAttrMapper.selectList(new LambdaQueryWrapper<MessageMonitorObjAttr>() {{ |
||||
eq(MessageMonitorObjAttr::getInstanceCode, responseData.getDeviceCode()); |
||||
}}).stream().collect(Collectors.toMap(MessageMonitorObjAttr::getAttrCode, MessageMonitorObjAttr::getAttrName)); |
||||
//拼接所有属性key值
|
||||
List<String> keyList = CheckDataRationalUtil.getAttrList(templateContent); |
||||
//获取对应value值
|
||||
StringBuilder valueStr = new StringBuilder(); |
||||
StringBuilder keyStr = new StringBuilder(); |
||||
for (String key : keyList) { |
||||
String tmpKey = key.replaceAll("\\{", "").replaceAll("}", ""); |
||||
Object value = CheckDataRationalUtil.getDataByKey(tmpKey, list); |
||||
if (value != null) { |
||||
keyStr.append(getKeyName(keyToAttr, tmpKey)); |
||||
valueStr.append(value.toString()); |
||||
valueStr.append(JOIN_CODE); |
||||
keyStr.append(JOIN_CODE); |
||||
} |
||||
} |
||||
valueStr.deleteCharAt(valueStr.length() - 1); |
||||
keyStr.deleteCharAt(keyStr.length() - 1); |
||||
messageDto.setNum(valueStr.toString()); |
||||
messageDto.setType(keyStr.toString()); |
||||
log.info("messageMake {}", messageDto); |
||||
return messageDto; |
||||
} |
||||
|
||||
//获取当前key对应名称
|
||||
private String getKeyName(Map<String, String> objAttr, String key) { |
||||
return StringUtils.isEmpty(objAttr.get(key)) ? "-" : objAttr.get(key); |
||||
} |
||||
|
||||
private String buildContent(String data, String templateContent) { |
||||
JSONArray array = JSON.parseArray(data); |
||||
Map map = JSON.parseObject(array.get(0).toString(), Map.class); |
||||
return map.get("suggest").toString(); |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue