fix: 优化代码处理

This commit is contained in:
tangwei 2026-04-07 08:38:36 +08:00
parent 58b1c9d663
commit a5ec718bcf
36 changed files with 67098 additions and 1 deletions

63388
QGC.sql Normal file

File diff suppressed because one or more lines are too long

View File

@ -308,6 +308,25 @@
<artifactId>nashorn-core</artifactId> <artifactId>nashorn-core</artifactId>
<version>15.4</version> <version>15.4</version>
</dependency> </dependency>
<dependency>
<groupId>com.zny.platform</groupId>
<artifactId>dec-framework-kendo</artifactId>
<version>0.4.0.5-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>dm.jdbc.driver</groupId>
<artifactId>18</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 显式添加 Jackson 依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -11,6 +11,8 @@ import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.web.server.servlet.context.ServletComponentScan; import org.springframework.boot.web.server.servlet.context.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -19,8 +21,10 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@EnableTransactionManagement @EnableTransactionManagement
@ServletComponentScan("com.yfd.platform.config") @ServletComponentScan("com.yfd.platform.config")
@MapperScan(basePackages = "com.yfd.platform.*.mapper") @MapperScan(basePackages = {"com.yfd.platform.*.mapper", "com.yfd.platform.common"})
//@ComponentScan("com.zny.dec")
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class, DataRedisAutoConfiguration.class}) @SpringBootApplication(exclude= {DataSourceAutoConfiguration.class, DataRedisAutoConfiguration.class})
//@SpringBootApplication
@Import({DynamicDataSourceConfig.class}) @Import({DynamicDataSourceConfig.class})
@EnableCaching @EnableCaching
public class PlatformApplication { public class PlatformApplication {

View File

@ -0,0 +1,554 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.yfd.platform.common;
import cn.hutool.json.JSONArray;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class DataSourceLoadOptionsBase {
@Schema(description = "string 是否是默认小写")
private Boolean stringToLowerDefault = false;
@Schema(description = "是否需要返回总数")
private Boolean requireTotalCount = false;
@Schema(description = "当前查询是否是分组数查询")
public Boolean requireGroupCount = false;
@Schema(description = "分组结果是否平铺")
public Boolean groupResultFlat = false;
@Schema(description = "当前查询是否是总数查询")
public Boolean isCountQuery = false;
@Schema(description = "从结果集开始跳过的数目")
private Integer skip = 0;
@Schema(description = "需要加载的对象个数")
private Integer take = 0;
@Schema(description = "排序表达式")
public SortingInfo[] sort;
@Schema(description = "分组表达式")
public GroupingInfo[] group;
@Schema(description = "过滤表达式")
public JSONArray filter;
@Schema(description = "总数表达式")
public SummaryInfo[] totalSummary;
@Schema(description = "分组总数表达式")
public SummaryInfo[] groupSummary;
@Schema(description = "选择表达式,需要去重查询的字段")
public String[] distinctSelect;
@Schema(description = "选择表达式,需要查询的字段")
public String[] select;
@Schema(description = "限制选择表达式")
public String[] preSelect;
@Schema(description = "")
public Boolean remoteSelect = false;
@Schema(description = "")
public Boolean remoteGrouping;
@Schema(description = "")
public Boolean expandLinqSumType;
@Schema(description = "主键数组")
public String[] primaryKey;
@Schema(description = "默认排序")
public String defaultSort;
@Schema(description = "是否 filter 表达式应该被转化为小写")
public Boolean stringToLower = false;
@Schema(description = "")
public Boolean paginateViaPrimaryKey = false;
@Schema(description = "根据主键 key 排序")
public Boolean sortByPrimaryKey = false;
@Schema(description = "")
public Boolean allowAsyncOverSync = false;
@Schema(hidden = true)
private Map<String, Object> extMap = new HashMap();
public DataSourceLoadOptionsBase() {
}
public Boolean getStringToLowerDefault() {
return this.stringToLowerDefault;
}
public Boolean getRequireTotalCount() {
return this.requireTotalCount;
}
public Boolean getRequireGroupCount() {
return this.requireGroupCount;
}
public Boolean getGroupResultFlat() {
return this.groupResultFlat;
}
public Boolean getIsCountQuery() {
return this.isCountQuery;
}
public Integer getSkip() {
return this.skip;
}
public Integer getTake() {
return this.take;
}
public SortingInfo[] getSort() {
return this.sort;
}
public GroupingInfo[] getGroup() {
return this.group;
}
public JSONArray getFilter() {
return this.filter;
}
public SummaryInfo[] getTotalSummary() {
return this.totalSummary;
}
public SummaryInfo[] getGroupSummary() {
return this.groupSummary;
}
public String[] getDistinctSelect() {
return this.distinctSelect;
}
public String[] getSelect() {
return this.select;
}
public String[] getPreSelect() {
return this.preSelect;
}
public Boolean getRemoteSelect() {
return this.remoteSelect;
}
public Boolean getRemoteGrouping() {
return this.remoteGrouping;
}
public Boolean getExpandLinqSumType() {
return this.expandLinqSumType;
}
public String[] getPrimaryKey() {
return this.primaryKey;
}
public String getDefaultSort() {
return this.defaultSort;
}
public Boolean getStringToLower() {
return this.stringToLower;
}
public Boolean getPaginateViaPrimaryKey() {
return this.paginateViaPrimaryKey;
}
public Boolean getSortByPrimaryKey() {
return this.sortByPrimaryKey;
}
public Boolean getAllowAsyncOverSync() {
return this.allowAsyncOverSync;
}
public Map<String, Object> getExtMap() {
return this.extMap;
}
public void setStringToLowerDefault(final Boolean stringToLowerDefault) {
this.stringToLowerDefault = stringToLowerDefault;
}
public void setRequireTotalCount(final Boolean requireTotalCount) {
this.requireTotalCount = requireTotalCount;
}
public void setRequireGroupCount(final Boolean requireGroupCount) {
this.requireGroupCount = requireGroupCount;
}
public void setGroupResultFlat(final Boolean groupResultFlat) {
this.groupResultFlat = groupResultFlat;
}
public void setIsCountQuery(final Boolean isCountQuery) {
this.isCountQuery = isCountQuery;
}
public void setSkip(final Integer skip) {
this.skip = skip;
}
public void setTake(final Integer take) {
this.take = take;
}
public void setSort(final SortingInfo[] sort) {
this.sort = sort;
}
public void setGroup(final GroupingInfo[] group) {
this.group = group;
}
public void setFilter(final JSONArray filter) {
this.filter = filter;
}
public void setTotalSummary(final SummaryInfo[] totalSummary) {
this.totalSummary = totalSummary;
}
public void setGroupSummary(final SummaryInfo[] groupSummary) {
this.groupSummary = groupSummary;
}
public void setDistinctSelect(final String[] distinctSelect) {
this.distinctSelect = distinctSelect;
}
public void setSelect(final String[] select) {
this.select = select;
}
public void setPreSelect(final String[] preSelect) {
this.preSelect = preSelect;
}
public void setRemoteSelect(final Boolean remoteSelect) {
this.remoteSelect = remoteSelect;
}
public void setRemoteGrouping(final Boolean remoteGrouping) {
this.remoteGrouping = remoteGrouping;
}
public void setExpandLinqSumType(final Boolean expandLinqSumType) {
this.expandLinqSumType = expandLinqSumType;
}
public void setPrimaryKey(final String[] primaryKey) {
this.primaryKey = primaryKey;
}
public void setDefaultSort(final String defaultSort) {
this.defaultSort = defaultSort;
}
public void setStringToLower(final Boolean stringToLower) {
this.stringToLower = stringToLower;
}
public void setPaginateViaPrimaryKey(final Boolean paginateViaPrimaryKey) {
this.paginateViaPrimaryKey = paginateViaPrimaryKey;
}
public void setSortByPrimaryKey(final Boolean sortByPrimaryKey) {
this.sortByPrimaryKey = sortByPrimaryKey;
}
public void setAllowAsyncOverSync(final Boolean allowAsyncOverSync) {
this.allowAsyncOverSync = allowAsyncOverSync;
}
public void setExtMap(final Map<String, Object> extMap) {
this.extMap = extMap;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof DataSourceLoadOptionsBase)) {
return false;
} else {
DataSourceLoadOptionsBase other = (DataSourceLoadOptionsBase)o;
if (!other.canEqual(this)) {
return false;
} else {
Object this$stringToLowerDefault = this.getStringToLowerDefault();
Object other$stringToLowerDefault = other.getStringToLowerDefault();
if (this$stringToLowerDefault == null) {
if (other$stringToLowerDefault != null) {
return false;
}
} else if (!this$stringToLowerDefault.equals(other$stringToLowerDefault)) {
return false;
}
Object this$requireTotalCount = this.getRequireTotalCount();
Object other$requireTotalCount = other.getRequireTotalCount();
if (this$requireTotalCount == null) {
if (other$requireTotalCount != null) {
return false;
}
} else if (!this$requireTotalCount.equals(other$requireTotalCount)) {
return false;
}
Object this$requireGroupCount = this.getRequireGroupCount();
Object other$requireGroupCount = other.getRequireGroupCount();
if (this$requireGroupCount == null) {
if (other$requireGroupCount != null) {
return false;
}
} else if (!this$requireGroupCount.equals(other$requireGroupCount)) {
return false;
}
Object this$groupResultFlat = this.getGroupResultFlat();
Object other$groupResultFlat = other.getGroupResultFlat();
if (this$groupResultFlat == null) {
if (other$groupResultFlat != null) {
return false;
}
} else if (!this$groupResultFlat.equals(other$groupResultFlat)) {
return false;
}
Object this$isCountQuery = this.getIsCountQuery();
Object other$isCountQuery = other.getIsCountQuery();
if (this$isCountQuery == null) {
if (other$isCountQuery != null) {
return false;
}
} else if (!this$isCountQuery.equals(other$isCountQuery)) {
return false;
}
Object this$skip = this.getSkip();
Object other$skip = other.getSkip();
if (this$skip == null) {
if (other$skip != null) {
return false;
}
} else if (!this$skip.equals(other$skip)) {
return false;
}
Object this$take = this.getTake();
Object other$take = other.getTake();
if (this$take == null) {
if (other$take != null) {
return false;
}
} else if (!this$take.equals(other$take)) {
return false;
}
Object this$remoteSelect = this.getRemoteSelect();
Object other$remoteSelect = other.getRemoteSelect();
if (this$remoteSelect == null) {
if (other$remoteSelect != null) {
return false;
}
} else if (!this$remoteSelect.equals(other$remoteSelect)) {
return false;
}
Object this$remoteGrouping = this.getRemoteGrouping();
Object other$remoteGrouping = other.getRemoteGrouping();
if (this$remoteGrouping == null) {
if (other$remoteGrouping != null) {
return false;
}
} else if (!this$remoteGrouping.equals(other$remoteGrouping)) {
return false;
}
Object this$expandLinqSumType = this.getExpandLinqSumType();
Object other$expandLinqSumType = other.getExpandLinqSumType();
if (this$expandLinqSumType == null) {
if (other$expandLinqSumType != null) {
return false;
}
} else if (!this$expandLinqSumType.equals(other$expandLinqSumType)) {
return false;
}
Object this$stringToLower = this.getStringToLower();
Object other$stringToLower = other.getStringToLower();
if (this$stringToLower == null) {
if (other$stringToLower != null) {
return false;
}
} else if (!this$stringToLower.equals(other$stringToLower)) {
return false;
}
Object this$paginateViaPrimaryKey = this.getPaginateViaPrimaryKey();
Object other$paginateViaPrimaryKey = other.getPaginateViaPrimaryKey();
if (this$paginateViaPrimaryKey == null) {
if (other$paginateViaPrimaryKey != null) {
return false;
}
} else if (!this$paginateViaPrimaryKey.equals(other$paginateViaPrimaryKey)) {
return false;
}
Object this$sortByPrimaryKey = this.getSortByPrimaryKey();
Object other$sortByPrimaryKey = other.getSortByPrimaryKey();
if (this$sortByPrimaryKey == null) {
if (other$sortByPrimaryKey != null) {
return false;
}
} else if (!this$sortByPrimaryKey.equals(other$sortByPrimaryKey)) {
return false;
}
Object this$allowAsyncOverSync = this.getAllowAsyncOverSync();
Object other$allowAsyncOverSync = other.getAllowAsyncOverSync();
if (this$allowAsyncOverSync == null) {
if (other$allowAsyncOverSync != null) {
return false;
}
} else if (!this$allowAsyncOverSync.equals(other$allowAsyncOverSync)) {
return false;
}
if (!Arrays.deepEquals(this.getSort(), other.getSort())) {
return false;
} else if (!Arrays.deepEquals(this.getGroup(), other.getGroup())) {
return false;
} else {
Object this$filter = this.getFilter();
Object other$filter = other.getFilter();
if (this$filter == null) {
if (other$filter != null) {
return false;
}
} else if (!this$filter.equals(other$filter)) {
return false;
}
if (!Arrays.deepEquals(this.getTotalSummary(), other.getTotalSummary())) {
return false;
} else if (!Arrays.deepEquals(this.getGroupSummary(), other.getGroupSummary())) {
return false;
} else if (!Arrays.deepEquals(this.getDistinctSelect(), other.getDistinctSelect())) {
return false;
} else if (!Arrays.deepEquals(this.getSelect(), other.getSelect())) {
return false;
} else if (!Arrays.deepEquals(this.getPreSelect(), other.getPreSelect())) {
return false;
} else if (!Arrays.deepEquals(this.getPrimaryKey(), other.getPrimaryKey())) {
return false;
} else {
Object this$defaultSort = this.getDefaultSort();
Object other$defaultSort = other.getDefaultSort();
if (this$defaultSort == null) {
if (other$defaultSort != null) {
return false;
}
} else if (!this$defaultSort.equals(other$defaultSort)) {
return false;
}
Object this$extMap = this.getExtMap();
Object other$extMap = other.getExtMap();
if (this$extMap == null) {
if (other$extMap != null) {
return false;
}
} else if (!this$extMap.equals(other$extMap)) {
return false;
}
return true;
}
}
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof DataSourceLoadOptionsBase;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
Object $stringToLowerDefault = this.getStringToLowerDefault();
result = result * 59 + ($stringToLowerDefault == null ? 43 : $stringToLowerDefault.hashCode());
Object $requireTotalCount = this.getRequireTotalCount();
result = result * 59 + ($requireTotalCount == null ? 43 : $requireTotalCount.hashCode());
Object $requireGroupCount = this.getRequireGroupCount();
result = result * 59 + ($requireGroupCount == null ? 43 : $requireGroupCount.hashCode());
Object $groupResultFlat = this.getGroupResultFlat();
result = result * 59 + ($groupResultFlat == null ? 43 : $groupResultFlat.hashCode());
Object $isCountQuery = this.getIsCountQuery();
result = result * 59 + ($isCountQuery == null ? 43 : $isCountQuery.hashCode());
Object $skip = this.getSkip();
result = result * 59 + ($skip == null ? 43 : $skip.hashCode());
Object $take = this.getTake();
result = result * 59 + ($take == null ? 43 : $take.hashCode());
Object $remoteSelect = this.getRemoteSelect();
result = result * 59 + ($remoteSelect == null ? 43 : $remoteSelect.hashCode());
Object $remoteGrouping = this.getRemoteGrouping();
result = result * 59 + ($remoteGrouping == null ? 43 : $remoteGrouping.hashCode());
Object $expandLinqSumType = this.getExpandLinqSumType();
result = result * 59 + ($expandLinqSumType == null ? 43 : $expandLinqSumType.hashCode());
Object $stringToLower = this.getStringToLower();
result = result * 59 + ($stringToLower == null ? 43 : $stringToLower.hashCode());
Object $paginateViaPrimaryKey = this.getPaginateViaPrimaryKey();
result = result * 59 + ($paginateViaPrimaryKey == null ? 43 : $paginateViaPrimaryKey.hashCode());
Object $sortByPrimaryKey = this.getSortByPrimaryKey();
result = result * 59 + ($sortByPrimaryKey == null ? 43 : $sortByPrimaryKey.hashCode());
Object $allowAsyncOverSync = this.getAllowAsyncOverSync();
result = result * 59 + ($allowAsyncOverSync == null ? 43 : $allowAsyncOverSync.hashCode());
result = result * 59 + Arrays.deepHashCode(this.getSort());
result = result * 59 + Arrays.deepHashCode(this.getGroup());
Object $filter = this.getFilter();
result = result * 59 + ($filter == null ? 43 : $filter.hashCode());
result = result * 59 + Arrays.deepHashCode(this.getTotalSummary());
result = result * 59 + Arrays.deepHashCode(this.getGroupSummary());
result = result * 59 + Arrays.deepHashCode(this.getDistinctSelect());
result = result * 59 + Arrays.deepHashCode(this.getSelect());
result = result * 59 + Arrays.deepHashCode(this.getPreSelect());
result = result * 59 + Arrays.deepHashCode(this.getPrimaryKey());
Object $defaultSort = this.getDefaultSort();
result = result * 59 + ($defaultSort == null ? 43 : $defaultSort.hashCode());
Object $extMap = this.getExtMap();
result = result * 59 + ($extMap == null ? 43 : $extMap.hashCode());
return result;
}
public String toString() {
return "DataSourceLoadOptionsBase(stringToLowerDefault=" + this.getStringToLowerDefault() + ", requireTotalCount=" + this.getRequireTotalCount() + ", requireGroupCount=" + this.getRequireGroupCount() + ", groupResultFlat=" + this.getGroupResultFlat() + ", isCountQuery=" + this.getIsCountQuery() + ", skip=" + this.getSkip() + ", take=" + this.getTake() + ", sort=" + Arrays.deepToString(this.getSort()) + ", group=" + Arrays.deepToString(this.getGroup()) + ", filter=" + this.getFilter() + ", totalSummary=" + Arrays.deepToString(this.getTotalSummary()) + ", groupSummary=" + Arrays.deepToString(this.getGroupSummary()) + ", distinctSelect=" + Arrays.deepToString(this.getDistinctSelect()) + ", select=" + Arrays.deepToString(this.getSelect()) + ", preSelect=" + Arrays.deepToString(this.getPreSelect()) + ", remoteSelect=" + this.getRemoteSelect() + ", remoteGrouping=" + this.getRemoteGrouping() + ", expandLinqSumType=" + this.getExpandLinqSumType() + ", primaryKey=" + Arrays.deepToString(this.getPrimaryKey()) + ", defaultSort=" + this.getDefaultSort() + ", stringToLower=" + this.getStringToLower() + ", paginateViaPrimaryKey=" + this.getPaginateViaPrimaryKey() + ", sortByPrimaryKey=" + this.getSortByPrimaryKey() + ", allowAsyncOverSync=" + this.getAllowAsyncOverSync() + ", extMap=" + this.getExtMap() + ")";
}
}

View File

@ -0,0 +1,691 @@
package com.yfd.platform.common;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import org.jsoup.helper.StringUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class DataSourceRequest {
private int page;
private int pageSize;
private int take;
private int skip;
private List<String> distinctSelect;
private List<String> select;
private List<SortDescriptor> sort;
private List<GroupDescriptor> group;
private List<AggregateDescriptor> aggregate;
private HashMap<String, Object> data = new HashMap();
private Boolean groupResultFlat = false;
private FilterDescriptor filter = new FilterDescriptor();
public DataSourceRequest() {
}
public List<String> getDistinctSelect() {
return this.distinctSelect;
}
public void setDistinctSelect(List<String> distinctSelect) {
this.distinctSelect = distinctSelect;
}
public HashMap<String, Object> getData() {
return this.data;
}
public void handleUnknown(String key, Object value) {
this.data.put(key, value);
}
public int getPage() {
return this.page;
}
public void setPage(int page) {
this.page = page;
}
public int getPageSize() {
return this.pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTake() {
return this.take;
}
public void setTake(int take) {
this.take = take;
}
public int getSkip() {
return this.skip;
}
public void setSkip(int skip) {
this.skip = skip;
}
public List<SortDescriptor> getSort() {
return this.sort;
}
public void setSort(List<SortDescriptor> sort) {
this.sort = sort;
}
public FilterDescriptor getFilter() {
return this.filter;
}
public void setFilter(FilterDescriptor filter) {
this.filter = filter;
}
public List<String> getSelect() {
return this.select;
}
public void setSelect(List<String> select) {
this.select = select;
}
public Boolean getGroupResultFlat() {
return this.groupResultFlat;
}
public void setGroupResultFlat(Boolean groupResultFlat) {
this.groupResultFlat = groupResultFlat;
}
public static JSONArray toDevextremeFilter(FilterDescriptor filter) {
JSONArray jsonArray = new JSONArray();
filter(jsonArray, filter);
return jsonArray;
}
private static void restrict(JSONArray jsonArray, FilterDescriptor filter) {
String operator = filter.getOperator();
String field = filter.getField();
String dataType = filter.getDataType();
jsonArray.put(field);
Object value = filter.getValue();
boolean ignoreCase = filter.isIgnoreCase();
String devCondition = null;
String[] var10000 = new String[]{"isnull", "isnotnull", "isempty", "isnotempty"};
switch (operator) {
case "eq":
devCondition = "=";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "neq":
devCondition = "<>";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "gt":
devCondition = ">";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "gte":
devCondition = ">=";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "lt":
devCondition = "<";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "lte":
devCondition = "<=";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "startswith":
devCondition = "startswith";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "endswith":
devCondition = "endswith";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "contains":
devCondition = "contains";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "doesnotcontain":
devCondition = "notcontains";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "isnull":
devCondition = "isnull";
jsonArray.put(devCondition);
jsonArray.put((Object)null);
break;
case "isnotnull":
devCondition = "isnotnull";
jsonArray.put(devCondition);
jsonArray.put((Object)null);
break;
case "isempty":
devCondition = "=";
jsonArray.put(devCondition);
jsonArray.put("");
break;
case "isnotempty":
devCondition = "!=";
jsonArray.put(devCondition);
jsonArray.put("");
break;
case "in":
devCondition = "in";
jsonArray.put(devCondition);
jsonArray.put(value);
break;
case "ni":
devCondition = "ni";
jsonArray.put(devCondition);
jsonArray.put(value);
}
jsonArray.put(dataType);
}
private static void filter(JSONArray jsonArray, FilterDescriptor filter) {
if (filter != null) {
List<FilterDescriptor> filters = filter.filters;
int size = filters.size();
String logic = null;
if (!filters.isEmpty()) {
if (!filter.getFilters().isEmpty() && filter.getFilters().size() > 1 && filter.getLogic().toString().equals("or")) {
logic = "or";
}
if (!filter.getFilters().isEmpty() && filter.getFilters().size() > 1 && filter.getLogic().toString().equals("and")) {
logic = "and";
}
int index = 0;
for(FilterDescriptor entry : filters) {
if (!entry.getFilters().isEmpty()) {
JSONArray filterJsonArray = new JSONArray();
filter(filterJsonArray, entry);
jsonArray.put(filterJsonArray);
if (index != size - 1) {
jsonArray.put(logic);
}
} else {
JSONArray restrictJsonArray = new JSONArray();
restrict(restrictJsonArray, entry);
jsonArray.put(restrictJsonArray);
if (index != size - 1) {
jsonArray.put(logic);
}
}
++index;
}
}
}
}
private static void sort(DataSourceLoadOptionsBase dataSourceLoadOptionsBase, List<SortDescriptor> sort) {
if (sort != null && !sort.isEmpty()) {
SortingInfo[] decSort = new SortingInfo[sort.size()];
int i = 0;
for(SortDescriptor entry : sort) {
String field = entry.getField();
String dir = entry.getDir();
SortingInfo sortingInfo = new SortingInfo();
sortingInfo.setSelector(field);
if (StringUtil.isBlank(dir)) {
sortingInfo.setDesc(false);
} else if (dir.equals("asc")) {
sortingInfo.setDesc(false);
} else if (dir.equals("desc")) {
sortingInfo.setDesc(true);
}
decSort[i] = sortingInfo;
++i;
}
dataSourceLoadOptionsBase.setSort(decSort);
}
}
private static void calculateAggregates(DataSourceLoadOptionsBase dataSourceLoadOptionsBase, List<AggregateDescriptor> aggregates) {
if (aggregates != null && !aggregates.isEmpty()) {
SummaryInfo[] totalSummary = new SummaryInfo[aggregates.size()];
int i = 0;
for(AggregateDescriptor aggregateDescriptor : aggregates) {
SummaryInfo summaryInfo = new SummaryInfo();
summaryInfo.setSelector(aggregateDescriptor.getField());
summaryInfo.setSummaryType(aggregateDescriptor.getAggregate());
totalSummary[i] = summaryInfo;
++i;
}
dataSourceLoadOptionsBase.setTotalSummary(totalSummary);
}
}
public void group(DataSourceLoadOptionsBase dataSourceLoadOptionsBase) {
new ArrayList();
List<GroupDescriptor> group = this.getGroup();
if (group != null && !group.isEmpty()) {
GroupingInfo[] devGroup = new GroupingInfo[group.size()];
int i = 0;
for(GroupDescriptor groupDescriptor : group) {
GroupingInfo groupingInfo = new GroupingInfo();
groupingInfo.setSelector(groupDescriptor.getField());
String dir = groupDescriptor.getDir();
if (StringUtil.isBlank(dir)) {
groupingInfo.setDesc(false);
} else if (dir.equals("asc")) {
groupingInfo.setDesc(false);
} else if (dir.equals("desc")) {
groupingInfo.setDesc(true);
}
groupingInfo.setNeedSortFlag(groupDescriptor.getNeedSortFlag());
List<AggregateDescriptor> aggregateDescriptors = groupDescriptor.getAggregates();
if (CollectionUtil.isNotEmpty(aggregateDescriptors)) {
for(AggregateDescriptor aggregateDescriptor : aggregateDescriptors) {
SummaryInfo summaryInfo = new SummaryInfo();
summaryInfo.setSelector(aggregateDescriptor.getField());
summaryInfo.setSummaryType(aggregateDescriptor.getAggregate());
groupingInfo.getSummaryInfos().add(summaryInfo);
}
}
devGroup[i] = groupingInfo;
++i;
}
dataSourceLoadOptionsBase.setGroup(devGroup);
}
}
private static void page(DataSourceLoadOptionsBase dataSourceLoadOptionsBase, int take, int skip) {
dataSourceLoadOptionsBase.setTake(take);
dataSourceLoadOptionsBase.setSkip(skip);
}
public DataSourceLoadOptionsBase toDevRequest() {
DataSourceLoadOptionsBase dataSourceLoadOptionsBase = new DataSourceLoadOptionsBase();
JSONArray filter = toDevextremeFilter(this.getFilter());
dataSourceLoadOptionsBase.setFilter(filter);
dataSourceLoadOptionsBase.setGroupResultFlat(this.getGroupResultFlat());
dataSourceLoadOptionsBase.setRequireTotalCount(true);
if (CollectionUtil.isNotEmpty(this.getSelect())) {
String[] res = new String[this.getSelect().size()];
dataSourceLoadOptionsBase.setSelect((String[])this.getSelect().toArray(res));
}
sort(dataSourceLoadOptionsBase, this.sortDescriptors());
page(dataSourceLoadOptionsBase, this.getTake(), this.getSkip());
List<GroupDescriptor> groups = this.getGroup();
if (groups != null && !groups.isEmpty()) {
this.group(dataSourceLoadOptionsBase);
}
List<AggregateDescriptor> aggregates = this.getAggregate();
if (aggregates != null && !aggregates.isEmpty()) {
calculateAggregates(dataSourceLoadOptionsBase, aggregates);
}
return dataSourceLoadOptionsBase;
}
public DataSourceResult toDataSourceResult(LoadResult loadResult) {
DataSourceResult dataSourceResult = new DataSourceResult();
if (null != loadResult.getData()) {
List results = (List)loadResult.getData();
dataSourceResult.setData(results);
if (null == loadResult.getTotalCount()) {
loadResult.setTotalCount(results.size());
}
}
dataSourceResult.setTotal((long)loadResult.getTotalCount());
dataSourceResult.setAggregates(loadResult.getAggregates());
return dataSourceResult;
}
private List<SortDescriptor> sortDescriptors() {
List<SortDescriptor> sort = new ArrayList();
List<GroupDescriptor> groups = this.getGroup();
List<SortDescriptor> sorts = this.getSort();
if (groups != null) {
sort.addAll(groups);
}
if (sorts != null) {
sort.addAll(sorts);
}
return sort;
}
public List<GroupDescriptor> getGroup() {
return this.group;
}
public void setGroup(List<GroupDescriptor> group) {
this.group = group;
}
public List<AggregateDescriptor> getAggregate() {
return this.aggregate;
}
public void setAggregate(List<AggregateDescriptor> aggregate) {
this.aggregate = aggregate;
}
public static void main(String[] args) {
DataSourceRequest dataSourceRequest = new DataSourceRequest();
dataSourceRequest.setPage(1);
dataSourceRequest.setPageSize(20);
dataSourceRequest.setSkip(0);
dataSourceRequest.setTake(20);
FilterDescriptor filter = new FilterDescriptor();
filter.setLogic("and");
List<FilterDescriptor> andFilters = new ArrayList();
FilterDescriptor filter1 = new FilterDescriptor();
filter1.setField("freight");
filter1.setValue(12);
filter1.setOperator("eq");
andFilters.add(filter1);
FilterDescriptor filter2 = new FilterDescriptor();
filter2.setField("freight");
filter2.setValue(23);
filter2.setOperator("eq");
andFilters.add(filter2);
FilterDescriptor filter3 = new FilterDescriptor();
filter3.setLogic("or");
FilterDescriptor filter4 = new FilterDescriptor();
filter4.setField("freight");
filter4.setValue("23");
filter4.setOperator("startswith");
List<FilterDescriptor> orFilters = new ArrayList();
orFilters.add(filter4);
FilterDescriptor filter5 = new FilterDescriptor();
filter5.setField("freight");
filter5.setValue("23");
filter5.setOperator("eq");
orFilters.add(filter5);
filter3.setFilters(orFilters);
andFilters.add(filter3);
filter.setFilters(andFilters);
dataSourceRequest.setFilter(filter);
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
System.out.println(JSONUtil.toJsonStr(loadOptions));
}
public static class SortDescriptor {
private String field;
private String dir;
private Boolean needSortFlag = true;
public SortDescriptor() {
}
public String getField() {
return this.field;
}
public void setField(String field) {
this.field = field;
}
public String getDir() {
return this.dir;
}
public void setDir(String dir) {
this.dir = dir;
}
public Boolean getNeedSortFlag() {
return this.needSortFlag;
}
public void setNeedSortFlag(Boolean needSortFlag) {
this.needSortFlag = needSortFlag;
}
}
public static class GroupDescriptor extends SortDescriptor {
private List<AggregateDescriptor> aggregates = new ArrayList();
public GroupDescriptor() {
}
public List<AggregateDescriptor> getAggregates() {
return this.aggregates;
}
}
public static class AggregateDescriptor {
private String field;
private String aggregate;
public AggregateDescriptor() {
}
public String getField() {
return this.field;
}
public void setField(String field) {
this.field = field;
}
public String getAggregate() {
return this.aggregate;
}
public void setAggregate(String aggregate) {
this.aggregate = aggregate;
}
}
public static class FilterDescriptor {
private String logic;
private List<FilterDescriptor> filters = new ArrayList();
private String field;
private Object value;
private String operator;
private String dataType = "";
private boolean ignoreCase = true;
public FilterDescriptor() {
}
public String getField() {
return this.field;
}
public void setField(String field) {
this.field = field;
}
public Object getValue() {
return this.value;
}
public void setValue(Object value) {
this.value = value;
}
public String getOperator() {
return this.operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getLogic() {
return this.logic;
}
public void setLogic(String logic) {
this.logic = logic;
}
public boolean isIgnoreCase() {
return this.ignoreCase;
}
public void setIgnoreCase(boolean ignoreCase) {
this.ignoreCase = ignoreCase;
}
public String getDataType() {
return this.dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public List<FilterDescriptor> getFilters() {
return this.filters;
}
public void setFilters(final List<FilterDescriptor> filters) {
this.filters = filters;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof FilterDescriptor)) {
return false;
} else {
FilterDescriptor other = (FilterDescriptor)o;
if (!other.canEqual(this)) {
return false;
} else if (this.isIgnoreCase() != other.isIgnoreCase()) {
return false;
} else {
Object this$logic = this.getLogic();
Object other$logic = other.getLogic();
if (this$logic == null) {
if (other$logic != null) {
return false;
}
} else if (!this$logic.equals(other$logic)) {
return false;
}
Object this$filters = this.getFilters();
Object other$filters = other.getFilters();
if (this$filters == null) {
if (other$filters != null) {
return false;
}
} else if (!this$filters.equals(other$filters)) {
return false;
}
Object this$field = this.getField();
Object other$field = other.getField();
if (this$field == null) {
if (other$field != null) {
return false;
}
} else if (!this$field.equals(other$field)) {
return false;
}
Object this$value = this.getValue();
Object other$value = other.getValue();
if (this$value == null) {
if (other$value != null) {
return false;
}
} else if (!this$value.equals(other$value)) {
return false;
}
Object this$operator = this.getOperator();
Object other$operator = other.getOperator();
if (this$operator == null) {
if (other$operator != null) {
return false;
}
} else if (!this$operator.equals(other$operator)) {
return false;
}
Object this$dataType = this.getDataType();
Object other$dataType = other.getDataType();
if (this$dataType == null) {
if (other$dataType != null) {
return false;
}
} else if (!this$dataType.equals(other$dataType)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof FilterDescriptor;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
result = result * 59 + (this.isIgnoreCase() ? 79 : 97);
Object $logic = this.getLogic();
result = result * 59 + ($logic == null ? 43 : $logic.hashCode());
Object $filters = this.getFilters();
result = result * 59 + ($filters == null ? 43 : $filters.hashCode());
Object $field = this.getField();
result = result * 59 + ($field == null ? 43 : $field.hashCode());
Object $value = this.getValue();
result = result * 59 + ($value == null ? 43 : $value.hashCode());
Object $operator = this.getOperator();
result = result * 59 + ($operator == null ? 43 : $operator.hashCode());
Object $dataType = this.getDataType();
result = result * 59 + ($dataType == null ? 43 : $dataType.hashCode());
return result;
}
public String toString() {
return "DataSourceRequest.FilterDescriptor(logic=" + this.getLogic() + ", filters=" + this.getFilters() + ", field=" + this.getField() + ", value=" + this.getValue() + ", operator=" + this.getOperator() + ", dataType=" + this.getDataType() + ", ignoreCase=" + this.isIgnoreCase() + ")";
}
}
}

View File

@ -0,0 +1,99 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.yfd.platform.common;
import java.util.List;
import java.util.Map;
public class DataSourceResult<T> {
private Long total;
private List<T> data;
private Map<String, Object> aggregates;
public long getTotal() {
return this.total;
}
public void setTotal(long total) {
this.total = total;
}
public List<T> getData() {
return this.data;
}
public void setData(List<T> data) {
this.data = data;
}
public Map<String, Object> getAggregates() {
return this.aggregates;
}
public void setAggregates(Map<String, Object> aggregates) {
this.aggregates = aggregates;
}
public DataSourceResult() {
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof DataSourceResult)) {
return false;
} else {
DataSourceResult<?> other = (DataSourceResult)o;
if (!other.canEqual(this)) {
return false;
} else if (this.getTotal() != other.getTotal()) {
return false;
} else {
Object this$data = this.getData();
Object other$data = other.getData();
if (this$data == null) {
if (other$data != null) {
return false;
}
} else if (!this$data.equals(other$data)) {
return false;
}
Object this$aggregates = this.getAggregates();
Object other$aggregates = other.getAggregates();
if (this$aggregates == null) {
if (other$aggregates != null) {
return false;
}
} else if (!this$aggregates.equals(other$aggregates)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof DataSourceResult;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
long $total = this.getTotal();
result = result * 59 + (int)($total >>> 32 ^ $total);
Object $data = this.getData();
result = result * 59 + ($data == null ? 43 : $data.hashCode());
Object $aggregates = this.getAggregates();
result = result * 59 + ($aggregates == null ? 43 : $aggregates.hashCode());
return result;
}
public String toString() {
return "DataSourceResult(total=" + this.getTotal() + ", data=" + this.getData() + ", aggregates=" + this.getAggregates() + ")";
}
}

View File

@ -0,0 +1,72 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.yfd.platform.common;
import java.util.HashMap;
import java.util.Map;
public class GroupResult {
private String selectSql;
private String groupSql;
private String summaryInfoSql;
private String groupBySql;
private String orderBySql;
private Map<String, Object> paramMap = new HashMap();
public GroupResult(String groupSql, String orderBySql, Map<String, Object> paramMap) {
this.groupSql = groupSql;
this.orderBySql = orderBySql;
this.paramMap = paramMap;
}
public String getGroupSql() {
return this.groupSql;
}
public void setGroupSql(String groupSql) {
this.groupSql = groupSql;
}
public Map<String, Object> getParamMap() {
return this.paramMap;
}
public void setParamMap(Map<String, Object> paramMap) {
this.paramMap = paramMap;
}
public String getOrderBySql() {
return this.orderBySql;
}
public void setOrderBySql(String orderBySql) {
this.orderBySql = orderBySql;
}
public String getSelectSql() {
return this.selectSql;
}
public void setSelectSql(String selectSql) {
this.selectSql = selectSql;
}
public String getGroupBySql() {
return this.groupBySql;
}
public void setGroupBySql(String groupBySql) {
this.groupBySql = groupBySql;
}
public String getSummaryInfoSql() {
return this.summaryInfoSql;
}
public void setSummaryInfoSql(String summaryInfoSql) {
this.summaryInfoSql = summaryInfoSql;
}
}

View File

@ -0,0 +1,118 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.yfd.platform.common;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.ArrayList;
import java.util.List;
//@Data
//@EqualsAndHashCode(callSuper = true)
public class GroupingInfo extends SortingInfo {
private List<SummaryInfo> summaryInfos = new ArrayList();
@Schema(description = "分组时间间隔")
private String groupInterval;
@Schema(description = "分组数据是否应该返回")
private Boolean isExpanded = false;
public GroupingInfo() {
this.summaryInfos = new ArrayList();
}
public List<SummaryInfo> getSummaryInfos() {
return this.summaryInfos;
}
public String getGroupInterval() {
return this.groupInterval;
}
public Boolean getIsExpanded() {
return this.isExpanded;
}
public void setSummaryInfos(final List<SummaryInfo> summaryInfos) {
this.summaryInfos = summaryInfos;
}
public void setGroupInterval(final String groupInterval) {
this.groupInterval = groupInterval;
}
public void setIsExpanded(final Boolean isExpanded) {
this.isExpanded = isExpanded;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof GroupingInfo)) {
return false;
} else {
GroupingInfo other = (GroupingInfo)o;
if (!other.canEqual(this)) {
return false;
} else {
Object this$isExpanded = this.getIsExpanded();
Object other$isExpanded = other.getIsExpanded();
if (this$isExpanded == null) {
if (other$isExpanded != null) {
return false;
}
} else if (!this$isExpanded.equals(other$isExpanded)) {
return false;
}
Object this$summaryInfos = this.getSummaryInfos();
Object other$summaryInfos = other.getSummaryInfos();
if (this$summaryInfos == null) {
if (other$summaryInfos != null) {
return false;
}
} else if (!this$summaryInfos.equals(other$summaryInfos)) {
return false;
}
Object this$groupInterval = this.getGroupInterval();
Object other$groupInterval = other.getGroupInterval();
if (this$groupInterval == null) {
if (other$groupInterval != null) {
return false;
}
} else if (!this$groupInterval.equals(other$groupInterval)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof GroupingInfo;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
Object $isExpanded = this.getIsExpanded();
result = result * 59 + ($isExpanded == null ? 43 : $isExpanded.hashCode());
Object $summaryInfos = this.getSummaryInfos();
result = result * 59 + ($summaryInfos == null ? 43 : $summaryInfos.hashCode());
Object $groupInterval = this.getGroupInterval();
result = result * 59 + ($groupInterval == null ? 43 : $groupInterval.hashCode());
return result;
}
public String toString() {
return "GroupingInfo(summaryInfos=" + this.getSummaryInfos() + ", groupInterval=" + this.getGroupInterval() + ", isExpanded=" + this.getIsExpanded() + ")";
}
}

View File

@ -0,0 +1,150 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.yfd.platform.common;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Arrays;
import java.util.Map;
public class LoadResult<T> {
private T data;
private Integer totalCount;
private Integer groupCount;
@Schema(
hidden = true
)
private Object[] summary;
@JsonIgnore
private Map<String, Object> aggregates;
public LoadResult() {
}
public T getData() {
return this.data;
}
public Integer getTotalCount() {
return this.totalCount;
}
public Integer getGroupCount() {
return this.groupCount;
}
public Object[] getSummary() {
return this.summary;
}
public Map<String, Object> getAggregates() {
return this.aggregates;
}
public void setData(final T data) {
this.data = data;
}
public void setTotalCount(final Integer totalCount) {
this.totalCount = totalCount;
}
public void setGroupCount(final Integer groupCount) {
this.groupCount = groupCount;
}
public void setSummary(final Object[] summary) {
this.summary = summary;
}
@JsonIgnore
public void setAggregates(final Map<String, Object> aggregates) {
this.aggregates = aggregates;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof LoadResult)) {
return false;
} else {
LoadResult<?> other = (LoadResult)o;
if (!other.canEqual(this)) {
return false;
} else {
Object this$totalCount = this.getTotalCount();
Object other$totalCount = other.getTotalCount();
if (this$totalCount == null) {
if (other$totalCount != null) {
return false;
}
} else if (!this$totalCount.equals(other$totalCount)) {
return false;
}
Object this$groupCount = this.getGroupCount();
Object other$groupCount = other.getGroupCount();
if (this$groupCount == null) {
if (other$groupCount != null) {
return false;
}
} else if (!this$groupCount.equals(other$groupCount)) {
return false;
}
Object this$data = this.getData();
Object other$data = other.getData();
if (this$data == null) {
if (other$data != null) {
return false;
}
} else if (!this$data.equals(other$data)) {
return false;
}
if (!Arrays.deepEquals(this.getSummary(), other.getSummary())) {
return false;
} else {
Object this$aggregates = this.getAggregates();
Object other$aggregates = other.getAggregates();
if (this$aggregates == null) {
if (other$aggregates != null) {
return false;
}
} else if (!this$aggregates.equals(other$aggregates)) {
return false;
}
return true;
}
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof LoadResult;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
Object $totalCount = this.getTotalCount();
result = result * 59 + ($totalCount == null ? 43 : $totalCount.hashCode());
Object $groupCount = this.getGroupCount();
result = result * 59 + ($groupCount == null ? 43 : $groupCount.hashCode());
Object $data = this.getData();
result = result * 59 + ($data == null ? 43 : $data.hashCode());
result = result * 59 + Arrays.deepHashCode(this.getSummary());
Object $aggregates = this.getAggregates();
result = result * 59 + ($aggregates == null ? 43 : $aggregates.hashCode());
return result;
}
public String toString() {
return "LoadResult(data=" + this.getData() + ", totalCount=" + this.getTotalCount() + ", groupCount=" + this.getGroupCount() + ", summary=" + Arrays.deepToString(this.getSummary()) + ", aggregates=" + this.getAggregates() + ")";
}
}

View File

@ -0,0 +1,80 @@
package com.yfd.platform.common;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface MicroservicDynamicSQLMapper<T> {
@Select({"${sql}"})
List<Map<String, Object>> pageAllList(Page page, String sql, @Param("map") Map<String, Object> map);
@Select({"${sql}"})
<resultType> List<resultType> pageAllListWithResultType(Page page, @Param("sql") String sql, @Param("map") Map<String, Object> map, @Param("resultType") Class<resultType> resultType);
@Select({"${sql}"})
List<Map> getAllList(String sql, @Param("map") Map<String, Object> map);
@Select({"${sql}"})
<resultType> List<resultType> getAllListWithResultType(@Param("sql") String sql, @Param("map") Map<String, Object> map, @Param("resultType") Class<resultType> resultType);
@Select({"select count(1) count from ${sql} and ${ew.sqlSegment}"})
Integer count(@Param("select") String select, @Param("sql") String sql, @Param("ew") QueryWrapper queryWrapper);
@Select({"select count(1) count from ${sql}"})
Integer countNoWrapper(@Param("select") String select, @Param("sql") String sql);
@Select({"select ${select} from ${sql} and ${ew.sqlSegment}"})
List<Map> pageList(Page page, @Param("select") String select, @Param("sql") String sql, @Param("ew") QueryWrapper queryWrapper);
@Select({"select ${select} from ${sql} and ${ew.sqlSegment}"})
<resultType> List<resultType> pageListWithResultType(Page page, @Param("select") String select, @Param("sql") String sql, @Param("ew") QueryWrapper queryWrapper, @Param("resultType") Class<resultType> resultType);
@Select({"select ${select} from ${sql} ${ew.sqlSegment}"})
List<Map> pageNoFilterList(Page page, @Param("select") String select, @Param("sql") String sql, @Param("ew") QueryWrapper queryWrapper);
@Select({"select ${select} from ${sql}"})
List<Map> pageListNoWrapper(Page page, @Param("select") String select, @Param("sql") String sql);
@Select({"select ${select} from ${sql} and ${ew.sqlSegment}"})
List<Map> getList(@Param("select") String select, @Param("sql") String sql, @Param("ew") QueryWrapper queryWrapper);
@Select({"select ${select} from ${sql} and ${ew.sqlSegment}"})
List<Map> getListWithResultType(@Param("select") String select, @Param("sql") String sql, @Param("ew") QueryWrapper queryWrapper);
@Select({"select ${select} from ${table} where ${condition}"})
List<Map> getSingleTableList(@Param("select") String select, @Param("table") String table, @Param("condition") String condition);
@Select({"select ${select} from ${sql} ${ew.sqlSegment}"})
List<Map> getNoFilterList(@Param("select") String select, @Param("sql") String sql, @Param("ew") QueryWrapper queryWrapper);
@Select({"select ${select} from ${sql}"})
List<Map> getListNoWrapper(@Param("select") String select, @Param("sql") String sql);
@Select({"select ${select} from ${sql} and ${ew.sqlSegment}"})
Map totalSummary(@Param("select") String select, @Param("sql") String sql, @Param("ew") QueryWrapper queryWrapper);
@Select({"select ${select} from ${sql}"})
Map totalSummaryNoWrapper(@Param("select") String select, @Param("sql") String sql);
@Select({"select ${select} from ${tableName} where ${ew.sqlSegment}"})
Map totalSummarySingleTable(@Param("select") String select, @Param("tableName") String tableName, @Param("ew") QueryWrapper queryWrapper);
@Select({"select ${select} from ${tableName}"})
Map totalSummaryNoWrapperSingleTable(@Param("select") String select, @Param("tableName") String tableName);
@Select({"select max(order_index) from ${tableName}"})
Integer getOrderIndexMax(@Param("tableName") String tableName);
@Select({"select max(order_index) from ${tableName} where ${ew.sqlSegment}"})
Integer getOrderIndexMaxByParentId(@Param("tableName") String tableName, @Param("ew") QueryWrapper queryWrapper);
@Select({"select ${info} from ${joinsql} group by ${info}"})
List<Object> getGroup(@Param("info") String info, @Param("joinsql") String joinsql);
}

View File

@ -0,0 +1,111 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.yfd.platform.common;
import io.swagger.v3.oas.annotations.media.Schema;
public class SortingInfo {
@Schema(description = "排序字段")
public String selector;
@Schema(description = "是否是降序")
public Boolean desc = true;
@Schema(description = "是否需要排序标记")
public Boolean needSortFlag = true;
public SortingInfo() {
}
public String getSelector() {
return this.selector;
}
public Boolean getDesc() {
return this.desc;
}
public Boolean getNeedSortFlag() {
return this.needSortFlag;
}
public void setSelector(final String selector) {
this.selector = selector;
}
public void setDesc(final Boolean desc) {
this.desc = desc;
}
public void setNeedSortFlag(final Boolean needSortFlag) {
this.needSortFlag = needSortFlag;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof SortingInfo)) {
return false;
} else {
SortingInfo other = (SortingInfo)o;
if (!other.canEqual(this)) {
return false;
} else {
Object this$desc = this.getDesc();
Object other$desc = other.getDesc();
if (this$desc == null) {
if (other$desc != null) {
return false;
}
} else if (!this$desc.equals(other$desc)) {
return false;
}
Object this$needSortFlag = this.getNeedSortFlag();
Object other$needSortFlag = other.getNeedSortFlag();
if (this$needSortFlag == null) {
if (other$needSortFlag != null) {
return false;
}
} else if (!this$needSortFlag.equals(other$needSortFlag)) {
return false;
}
Object this$selector = this.getSelector();
Object other$selector = other.getSelector();
if (this$selector == null) {
if (other$selector != null) {
return false;
}
} else if (!this$selector.equals(other$selector)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof SortingInfo;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
Object $desc = this.getDesc();
result = result * 59 + ($desc == null ? 43 : $desc.hashCode());
Object $needSortFlag = this.getNeedSortFlag();
result = result * 59 + ($needSortFlag == null ? 43 : $needSortFlag.hashCode());
Object $selector = this.getSelector();
result = result * 59 + ($selector == null ? 43 : $selector.hashCode());
return result;
}
public String toString() {
return "SortingInfo(selector=" + this.getSelector() + ", desc=" + this.getDesc() + ", needSortFlag=" + this.getNeedSortFlag() + ")";
}
}

View File

@ -0,0 +1,93 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.yfd.platform.common;
import io.swagger.v3.oas.annotations.media.Schema;
public class SummaryInfo {
@Schema(description = "计算总数的字段")
public String selector;
@Schema(description = "计算总数的类型")
public String summaryType;
public SummaryInfo() {
}
public SummaryInfo(String selector, String summaryType) {
this.selector = selector;
this.summaryType = summaryType;
}
public String getSelector() {
return this.selector;
}
public String getSummaryType() {
return this.summaryType;
}
public void setSelector(final String selector) {
this.selector = selector;
}
public void setSummaryType(final String summaryType) {
this.summaryType = summaryType;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof SummaryInfo)) {
return false;
} else {
SummaryInfo other = (SummaryInfo)o;
if (!other.canEqual(this)) {
return false;
} else {
Object this$selector = this.getSelector();
Object other$selector = other.getSelector();
if (this$selector == null) {
if (other$selector != null) {
return false;
}
} else if (!this$selector.equals(other$selector)) {
return false;
}
Object this$summaryType = this.getSummaryType();
Object other$summaryType = other.getSummaryType();
if (this$summaryType == null) {
if (other$summaryType != null) {
return false;
}
} else if (!this$summaryType.equals(other$summaryType)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(final Object other) {
return other instanceof SummaryInfo;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
Object $selector = this.getSelector();
result = result * 59 + ($selector == null ? 43 : $selector.hashCode());
Object $summaryType = this.getSummaryType();
result = result * 59 + ($summaryType == null ? 43 : $summaryType.hashCode());
return result;
}
public String toString() {
return "SummaryInfo(selector=" + this.getSelector() + ", summaryType=" + this.getSummaryType() + ")";
}
}

View File

@ -53,6 +53,7 @@ public class SecurityConfig {
.authorizeHttpRequests(auth -> auth .authorizeHttpRequests(auth -> auth
.requestMatchers("/user/login").anonymous() .requestMatchers("/user/login").anonymous()
.requestMatchers("/user/code").permitAll() .requestMatchers("/user/code").permitAll()
.requestMatchers("/eng/**").permitAll()
.requestMatchers(HttpMethod.GET, "/").permitAll() .requestMatchers(HttpMethod.GET, "/").permitAll()
.requestMatchers(HttpMethod.GET, .requestMatchers(HttpMethod.GET,
"/*.html", "/*.html",

View File

@ -0,0 +1,54 @@
package com.yfd.platform.eng.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.eng.entity.vo.AlarmStcdCountVo;
import com.yfd.platform.eng.service.AlarmPointService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.util.Map;
/**
* 运行告警锚点控制器
*/
@RestController
@RequestMapping("/eng/alarmPoint")
@Tag(name = "运行告警锚点控制器")
public class AlarmPointController {
/**
* 服务对象
*/
@Resource
private AlarmPointService alarmPointService;
@PostMapping({"/GetKendoListCust"})
@Operation(summary = "条件过滤数据列表定制")
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, Object> filterResult = null; // 实际应该根据业务需求处理筛选
DataSourceResult<AlarmStcdCountVo> dataSourceResult = alarmPointService.processKendoList(dataSourceRequest, filterResult, page);
alarmPointService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
/**
* 获取警报统计数据
* @param stcd 电站ID
* @return 响应结果
*/
@PostMapping({"/getAlarmCount"})
@Operation(summary = "获取警报统计数据")
public ResponseResult getAlarmCount(String stcd) {
AlarmStcdCountVo vo = alarmPointService.getAlarmCount(stcd);
return ResponseResult.successData(vo);
}
}

View File

@ -0,0 +1,124 @@
package com.yfd.platform.eng.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
//import com.yfd.platform.common.GroupResult;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.eng.service.EngEqService;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import com.zny.dec.framework.kendo.entity.mapping.GroupResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* 电站生态流量统计查询
*/
@RestController
@RequestMapping("/eng/eq/")
@Tag(name = "电站生态流量统计查询")
public class EngEqController {
/**
* 服务对象
*/
@Resource
private EngEqService msEngEqService;
@PostMapping({"/GetKendoListCust"})
@Operation(summary = "条件过滤数据列表定制")
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, GroupResult> filterResult = null; // 实际应该根据业务需求处理筛选
DataSourceResult dataSourceResult = msEngEqService.processKendoList(dataSourceRequest, filterResult, page);
msEngEqService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
/**
* 导出
* @param dataSourceRequest 数据源请求
* @param response 响应
*/
@PostMapping({"/export"})
@Operation(summary = "导出")
public void export(@RequestBody DataSourceRequest dataSourceRequest, HttpServletResponse response) {
// 实际应该实现导出逻辑
}
/**
* 月统计数据有数据的电站
* @param dataSourceRequest 数据源请求
* @return 响应结果
*/
@PostMapping("/lastEngDataSite")
@Operation(summary = "查询指定时间有数据的站点")
public ResponseResult lastEngDataSite(@RequestBody DataSourceRequest dataSourceRequest) {
DataSourceResult result = msEngEqService.lastEngDataSite(dataSourceRequest);
return ResponseResult.successData(result);
}
@PostMapping("/default/stcd")
@Operation(summary = "获取生态流量默认有数据的电站")
public ResponseResult getDefaultStcd(@RequestBody DataSourceRequest dataSourceRequest) {
DataSourceResult result = msEngEqService.getDefaultStcd(dataSourceRequest);
return ResponseResult.successData(result);
}
@PostMapping("/getSfdbInfo")
@Operation(summary = "获取不达标详情数据")
public ResponseResult getSfdbInfo(@RequestBody DataSourceRequest dataSourceRequest) {
DataSourceResult result = msEngEqService.getSfdbInfo(dataSourceRequest);
return ResponseResult.successData(result);
}
@PostMapping({"/qecSfdbCountByStcd"})
@Operation(summary = "生态流量不达标测站数")
public ResponseResult qecSfdbCountByStcd(@RequestBody DataSourceRequest dataSourceRequest) {
DataSourceResult result = msEngEqService.qecSfdbCountByStcd(dataSourceRequest);
return ResponseResult.successData(result);
}
/**
* 生态流量达标率计算基地维度不达标原因维度
* @param dataSourceRequest 数据源请求
* @return 响应结果
*/
@PostMapping({"/qecRateCount"})
@Operation(summary = "生态流量达标率计算(基地维度、不达标原因维度)")
public ResponseResult qecRateCount(@RequestBody DataSourceRequest dataSourceRequest) {
DataSourceResult result = msEngEqService.qecRateCount(dataSourceRequest);
return ResponseResult.successData(result);
}
/**
* 生态流量不达标数量计算电站维度不达标原因维度
* @param dataSourceRequest 数据源请求
* @return 响应结果
*/
@PostMapping({"/qecSfdbCount"})
@Operation(summary = "生态流量不达标数量计算(电站维度、不达标原因维度)")
public ResponseResult qecSfdbCount(@RequestBody DataSourceRequest dataSourceRequest) {
DataSourceResult result = msEngEqService.qecSfdbCount(dataSourceRequest);
return ResponseResult.successData(result);
}
@PostMapping({"/group/GetKendoListCust"})
public ResponseResult getGroupKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, GroupResult> filterResult = null; // 实际应该根据业务需求处理筛选
DataSourceResult dataSourceResult = msEngEqService.processKendoList(dataSourceRequest, filterResult, page);
msEngEqService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
}

View File

@ -0,0 +1,112 @@
package com.yfd.platform.eng.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
//import com.yfd.platform.config.ResponseResult;
//import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.eng.service.EngEqDataService;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* 电站实时数据查询
*/
@RestController
@RequestMapping("/eng/eq/data")
@Tag(name = "电站实时数据查询")
public class EngEqDataController {
/**
* 服务对象
*/
@Resource
private EngEqDataService engEqDataService;
@PostMapping({"/GetKendoListCust"})
@Operation(summary = "生态流量沿程变化-小时")
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, Object> filterResult = null; // 实际应该根据业务需求处理筛选
DataSourceResult dataSourceResult = engEqDataService.processKendoList(dataSourceRequest, filterResult, page);
engEqDataService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
/**
* 导出
* @param dataSourceRequest 数据源请求
* @param response 响应
*/
@PostMapping({"/export"})
@Operation(summary = "导出")
public void export(@RequestBody DataSourceRequest dataSourceRequest, HttpServletResponse response) {
// 实际应该实现导出逻辑
}
@PostMapping({"/day/GetKendoListCust"})
@Operation(summary = "查询生态流量 日 数据")
public ResponseResult getKendoDayListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, Object> filterResult = null; // 实际应该根据业务需求处理筛选
String groupBy = ""; // 实际应该根据业务需求处理分组
DataSourceResult dataSourceResult = engEqDataService.processDayKendoList(dataSourceRequest, filterResult, page, groupBy);
engEqDataService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
@PostMapping({"/drtp/GetKendoListCust"})
@Operation(summary = "查询生态流量 周旬月季年 数据")
public ResponseResult getKendoDrtpListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, Object> filterResult = null; // 实际应该根据业务需求处理筛选
String groupBy = ""; // 实际应该根据业务需求处理分组
DataSourceResult dataSourceResult = engEqDataService.processKendoDrtpList(dataSourceRequest, filterResult, page, groupBy);
engEqDataService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
@PostMapping({"/fastSiteLastData/GetKendoListCust"})
@Operation(summary = "查询沿程第一个电站的生态流量数据时间")
public ResponseResult getFastSiteLastData(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, Object> filterResult = null; // 实际应该根据业务需求处理筛选
String groupBy = ""; // 实际应该根据业务需求处理分组
DataSourceResult dataSourceResult = engEqDataService.getFastSiteLastData(dataSourceRequest, filterResult, page, groupBy);
engEqDataService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
/**
* 生态流量沿程变化面板
* @param dataSourceRequest 数据源请求
* @return 响应结果
*/
@PostMapping({"/along/GetKendoListCust"})
@Operation(summary = "查询生态流量(沿程数据)")
public ResponseResult getKendoAlongListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, Object> filterResult = null; // 实际应该根据业务需求处理筛选
DataSourceResult dataSourceResult = engEqDataService.processKendoList(dataSourceRequest, filterResult, page);
engEqDataService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
@PostMapping({"/getEngLimit"})
@Operation(summary = "根据时间范围查询电站生态流量限值及来源")
public ResponseResult getEngLimit(@RequestBody DataSourceRequest dataSourceRequest) {
Object result = engEqDataService.getEngLimit(dataSourceRequest);
return ResponseResult.successData(result);
}
}

View File

@ -0,0 +1,140 @@
package com.yfd.platform.eng.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yfd.platform.annotation.Log;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
//import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.eng.domain.MsEngEq;
import com.yfd.platform.eng.service.EngEqIntervalService;
import com.yfd.platform.eng.service.EngEqService;
import com.zny.dec.core.common.util.SpringContextHolder;
import com.zny.dec.core.tenant.TenantContextHolder;
import com.zny.dec.framework.kendo.api.KendoParamGroupServiceApi;
import com.zny.dec.framework.kendo.entity.dto.devextreme.DataSourceLoadOptionsBase;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import com.zny.dec.framework.kendo.entity.mapping.GroupResult;
import com.zny.dec.framework.kendo.util.KendoUtil;
import com.zny.dec.framework.kendo.util.QueryWrapperUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* 生态流量区间统计控制器
*/
@RestController
@RequestMapping("/eng/eq/interval")
@Tag(name = "电站生态流量区间统计查询")
public class EngEqIntervalController {
/**
* 服务对象
*/
@Resource
private EngEqIntervalService eqIntervalService;
@Resource
private EngEqService engEqService;
/**
* 生态流量达标情况
* @param dataSourceRequest 数据源请求
* @return 响应结果
*/
@PostMapping({"/GetKendoListCust"})
@Operation(summary = "生态流量达标情况")
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page<MsEngEq> page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, Object> filterResult = null; // 实际应该根据业务需求处理筛选
DataSourceResult result = eqIntervalService.processKendoList(dataSourceRequest, filterResult, page);
eqIntervalService.processKendoGetListLoadResult(dataSourceRequest, result);
return ResponseResult.successData(result);
}
/**
* 导出
* @param dataSourceRequest 数据源请求
* @param response 响应
*/
@PostMapping({"/export"})
@Operation(summary = "导出")
@Log(module = "生态流量", value = "导出生态流量数据")
public void export(@RequestBody DataSourceRequest dataSourceRequest, HttpServletResponse response) {
// 实际应该实现导出逻辑
}
/**
* 生态流量达标率 小时统计(二级页面)
* @param dataSourceRequest 数据源请求
* @return 响应结果
*/
@PostMapping({"/qgc/hour/GetKendoListCust"})
@Operation(summary = "生态流量达标率 小时统计(二级页面)")
public ResponseResult getQgcHourKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
String kendoGroupCode = "EngEqHour";
// KendoParamGroupServiceApi serviceApi = SpringContextHolder.getBean(KendoParamGroupServiceApi.class);
// String filter = serviceApi.getParamGroupConfigByCode(TenantContextHolder.getPlatformId(), kendoGroupCode);
Map<String, GroupResult> filterResult = KendoUtil.getGroupResultMap(dataSourceRequest, null, EngEqIntervalController.class);
String groupBy = KendoUtil.getGroupBy(dataSourceRequest);
Page page = KendoUtil.getPage(dataSourceRequest);
DataSourceResult result = eqIntervalService.getQgcHourKendoListCust(dataSourceRequest, filterResult, page, groupBy);
eqIntervalService.processKendoGetListLoadResult(dataSourceRequest, result);
return ResponseResult.successData(result);
}
/**
* 生态流量达标率 日统计(二级页面)
* @param dataSourceRequest 数据源请求
* @return 响应结果
*/
@PostMapping({"/qgc/day/GetKendoListCust"})
@Operation(summary = "生态流量达标率 日统计(二级页面)")
public ResponseResult getQgcDayKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page<MsEngEq> page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, Object> filterResult = null; // 实际应该根据业务需求处理筛选
String groupBy = ""; // 实际应该根据业务需求处理分组
DataSourceResult result = eqIntervalService.getQgcDayKendoListCust(dataSourceRequest, filterResult, page, groupBy);
eqIntervalService.processKendoGetListLoadResult(dataSourceRequest, result);
return ResponseResult.successData(result);
}
/**
* 生态流量达标率 区间范围统计(一级页面)
* @param dataSourceRequest 数据源请求
* @return 响应结果
*/
@PostMapping({"/qgc/getQgcStaticData"})
@Operation(summary = "生态流量达标率 区间范围统计(一级页面)")
@Log(module = "生态流量", value = "生态流量达标率统计")
public ResponseResult getQgcStaticData(@RequestBody DataSourceRequest dataSourceRequest) {
DataSourceLoadOptionsBase loadOptionsBase = dataSourceRequest.toDevRequest();
String type = QueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "type");
ResponseResult r;
if("hour".equals(type)){
r = this.getQgcHourKendoListCust(dataSourceRequest);
}else if("day".equals(type)){
r = this.getQgcDayKendoListCust(dataSourceRequest);
}else{
return ResponseResult.error("请选择生态流量达标率统计类型(小时还是天统计)");
}
if(r != null && r.get("code").equals("0") && r.get("data") != null){
DataSourceResult dataSourceResult = (DataSourceResult) r.get("data");
if(dataSourceResult != null && dataSourceResult.getData() != null){
Map<String, Object> staticData = eqIntervalService.getQgcQecStaticData(dataSourceResult.getData(), type);
return ResponseResult.successData(staticData);
}
}
return ResponseResult.success();
}
}

View File

@ -0,0 +1,56 @@
package com.yfd.platform.eng.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.eng.service.EngEqService;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import com.zny.dec.framework.kendo.entity.mapping.GroupResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* 电站生态流量统计结果查询
*/
@RestController
@RequestMapping("/eng/eq/stat")
@Tag(name = "电站生态流量统计结果查询")
public class EngEqStatController {
/**
* 服务对象
*/
@Resource
private EngEqService msEngEqService;
@PostMapping({"/GetKendoListCust"})
@Operation(summary = "条件过滤数据列表定制")
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, GroupResult> filterResult = null; // 实际应该根据业务需求处理筛选
DataSourceResult dataSourceResult = msEngEqService.processKendoList(dataSourceRequest, filterResult, page);
msEngEqService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
/**
* 导出
* @param dataSourceRequest 数据源请求
* @param response 响应
*/
@PostMapping({"/export"})
@Operation(summary = "导出")
public void export(@RequestBody DataSourceRequest dataSourceRequest, HttpServletResponse response) {
// 实际应该实现导出逻辑
}
}

View File

@ -0,0 +1,45 @@
package com.yfd.platform.eng.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
//import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.eng.entity.EqSpecial;
import com.yfd.platform.eng.service.EngSpecialService;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.util.Map;
/**
* 电站专题-环保设施运行情况
*/
@RestController
@RequestMapping("/eng/special")
@Tag(name = "电站专题-环保设施运行情况")
public class EngSpecialController {
/**
* 服务对象
*/
@Resource
private EngSpecialService engSpecialService;
@PostMapping({"/GetKendoListCust"})
@Operation(summary = "条件过滤数据列表定制")
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
Page page = new Page<>(dataSourceRequest.getPage(), dataSourceRequest.getPageSize());
Map<String, Object> filterResult = null; // 实际应该根据业务需求处理筛选
DataSourceResult<EqSpecial> dataSourceResult = engSpecialService.processKendoList(dataSourceRequest, filterResult, page);
engSpecialService.processKendoGetListLoadResult(dataSourceRequest, dataSourceResult);
return ResponseResult.successData(dataSourceResult);
}
}

View File

@ -0,0 +1,61 @@
package com.yfd.platform.eng.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 生态流量实体类
*/
@Data
@TableName("ms_eng_eq")
public class MsEngEq implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 电站ID
*/
private String stationId;
/**
* 电站名称
*/
private String stationName;
/**
* 时间
*/
private Date time;
/**
* 生态流量值
*/
private Double eqValue;
/**
* 达标状态
*/
private String status;
/**
* 统计类型hour/day
*/
private String type;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}

View File

@ -0,0 +1,54 @@
package com.yfd.platform.eng.entity;
import lombok.Data;
/**
* 电站专题-环保设施运行情况
*/
@Data
public class EqSpecial {
/**
* 主键
*/
private String id;
/**
* 电站ID
*/
private String stcd;
/**
* 电站名称
*/
private String stnm;
/**
* 环保设施类型
*/
private String eqType;
/**
* 设施名称
*/
private String eqName;
/**
* 运行状态
*/
private String status;
/**
* 检查时间
*/
private String checkTime;
/**
* 检查人
*/
private String checker;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,39 @@
package com.yfd.platform.eng.entity.vo;
import lombok.Data;
/**
* 警报锚点统计VO
*/
@Data
public class AlarmStcdCountVo {
/**
* 电站ID
*/
private String stcd;
/**
* 电站名称
*/
private String stnm;
/**
* 警报数量
*/
private Integer alarmCount;
/**
* 未处理数量
*/
private Integer unhandledCount;
/**
* 处理中数量
*/
private Integer handlingCount;
/**
* 已处理数量
*/
private Integer handledCount;
}

View File

@ -0,0 +1,54 @@
package com.yfd.platform.eng.entity.vo;
import lombok.Data;
/**
* 生态流量小时数据VO
*/
@Data
public class EngEqDataVo {
/**
* 电站ID
*/
private String stcd;
/**
* 电站名称
*/
private String stnm;
/**
* 时间
*/
private String tm;
/**
* 生态流量值
*/
private Double eqValue;
/**
* 状态
*/
private String status;
/**
* 不达标原因
*/
private String reason;
/**
* 限值
*/
private Double limitValue;
/**
* 限值来源
*/
private String limitSource;
/**
* 是否左边界
*/
private Integer isLeft;
}

View File

@ -0,0 +1,59 @@
package com.yfd.platform.eng.entity.vo;
import lombok.Data;
/**
* 生态流量日数据VO
*/
@Data
public class EngEqDayDataVo {
/**
* 电站ID
*/
private String stcd;
/**
* 电站名称
*/
private String stnm;
/**
* 日期
*/
private String tm;
/**
* 日平均生态流量
*/
private Double avgValue;
/**
* 日最小生态流量
*/
private Double minValue;
/**
* 日最大生态流量
*/
private Double maxValue;
/**
* 状态
*/
private String status;
/**
* 不达标原因
*/
private String reason;
/**
* 限值
*/
private Double limitValue;
/**
* 限值来源
*/
private String limitSource;
}

View File

@ -0,0 +1,59 @@
package com.yfd.platform.eng.entity.vo;
import lombok.Data;
/**
* 生态流量周旬月季年数据VO
*/
@Data
public class EngEqDrtpDataVo {
/**
* 电站ID
*/
private String stcd;
/**
* 电站名称
*/
private String stnm;
/**
* 时间
*/
private String tm;
/**
* 平均生态流量
*/
private Double avgValue;
/**
* 最小生态流量
*/
private Double minValue;
/**
* 最大生态流量
*/
private Double maxValue;
/**
* 状态
*/
private String status;
/**
* 不达标原因
*/
private String reason;
/**
* 限值
*/
private Double limitValue;
/**
* 限值来源
*/
private String limitSource;
}

View File

@ -0,0 +1,21 @@
package com.yfd.platform.eng.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.eng.domain.MsEngEq;
import org.apache.ibatis.annotations.Select;
import java.util.Map;
/**
* 生态流量Mapper
*/
public interface EngEqMapper extends BaseMapper<MsEngEq> {
/**
* 根据条件查询生态流量数据
* @param params 查询参数
* @return 生态流量列表
*/
@Select("select * from ms_eng_eq where 1=1")
Object queryList(Map<String, Object> params);
}

View File

@ -0,0 +1,37 @@
package com.yfd.platform.eng.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.eng.entity.vo.AlarmStcdCountVo;
import java.util.Map;
/**
* 警报锚点服务
*/
public interface AlarmPointService {
/**
* 处理kendo列表
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @return 数据源结果
*/
DataSourceResult<AlarmStcdCountVo> processKendoList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page);
/**
* 处理kendo返回列表字典匹配
* @param dataSourceRequest 数据源请求
* @param dataSourceResult 数据源结果
*/
void processKendoGetListLoadResult(DataSourceRequest dataSourceRequest, DataSourceResult<AlarmStcdCountVo> dataSourceResult);
/**
* 获取警报统计数据
* @param stcd 电站ID
* @return 统计结果
*/
AlarmStcdCountVo getAlarmCount(String stcd);
}

View File

@ -0,0 +1,76 @@
package com.yfd.platform.eng.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
import java.util.Map;
/**
* 生态流量数据服务
*/
public interface EngEqDataService {
/**
* 处理kendo列表
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @return 数据源结果
*/
DataSourceResult processKendoList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page);
/**
* 处理kendo返回列表字典匹配
* @param dataSourceRequest 数据源请求
* @param dataSourceResult 数据源结果
*/
void processKendoGetListLoadResult(DataSourceRequest dataSourceRequest, DataSourceResult dataSourceResult);
/**
* 处理分组条件SQL
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @return SQL条件
*/
String processGroupConditionSql(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult);
/**
* 处理日数据kendo列表
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @param groupBy 分组
* @return 数据源结果
*/
DataSourceResult processDayKendoList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page, String groupBy);
/**
* 处理周旬月季年数据kendo列表
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @param groupBy 分组
* @return 数据源结果
*/
DataSourceResult processKendoDrtpList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page, String groupBy);
/**
* 查询沿程第一个电站的生态流量数据时间
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @param groupBy 分组
* @return 数据源结果
*/
DataSourceResult getFastSiteLastData(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page, String groupBy);
/**
* 根据时间范围查询电站生态流量限值及来源
* @param dataSourceRequest 数据源请求
* @return 生态流量限值VO
*/
Object getEngLimit(DataSourceRequest dataSourceRequest);
}

View File

@ -0,0 +1,61 @@
package com.yfd.platform.eng.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.eng.domain.MsEngEq;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import com.zny.dec.framework.kendo.entity.mapping.GroupResult;
import java.util.Map;
/**
* 生态流量区间统计服务
*/
public interface EngEqIntervalService {
/**
* 处理kendo列表
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @return 数据源结果
*/
DataSourceResult processKendoList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page<MsEngEq> page);
/**
* 处理kendo返回列表字典匹配
* @param dataSourceRequest 数据源请求
* @param dataSourceResult 数据源结果
*/
void processKendoGetListLoadResult(DataSourceRequest dataSourceRequest, DataSourceResult dataSourceResult);
/**
* 生态流量达标率 小时统计
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @param groupBy 分组
* @return 数据源结果
*/
DataSourceResult getQgcHourKendoListCust(DataSourceRequest dataSourceRequest, Map<String, GroupResult> filterResult, Page<MsEngEq> page, String groupBy);
/**
* 生态流量达标率 日统计
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @param groupBy 分组
* @return 数据源结果
*/
DataSourceResult getQgcDayKendoListCust(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page<MsEngEq> page, String groupBy);
/**
* 生态流量达标率 区间范围统计
* @param dataList 数据列表
* @param type 类型hour/day
* @return 统计结果
*/
Map<String, Object> getQgcQecStaticData(Object dataList, String type);
}

View File

@ -0,0 +1,85 @@
package com.yfd.platform.eng.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
//import com.yfd.platform.common.GroupResult;
import com.yfd.platform.eng.domain.MsEngEq;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import com.zny.dec.framework.kendo.entity.mapping.GroupResult;
import java.util.Map;
/**
* 生态流量服务
*/
public interface EngEqService extends IService<MsEngEq> {
/**
* 处理kendo列表
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @return 数据源结果
*/
DataSourceResult processKendoList(DataSourceRequest dataSourceRequest, Map<String, GroupResult> filterResult, Page page);
/**
* 处理kendo返回列表字典匹配
* @param dataSourceRequest 数据源请求
* @param dataSourceResult 数据源结果
*/
void processKendoGetListLoadResult(DataSourceRequest dataSourceRequest, DataSourceResult dataSourceResult);
/**
* 处理分组条件SQL
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @return SQL条件
*/
String processGroupConditionSql(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult);
/**
* 月统计数据有数据的电站
* @param dataSourceRequest 数据源请求
* @return 数据源结果
*/
DataSourceResult lastEngDataSite(DataSourceRequest dataSourceRequest);
/**
* 获取生态流量默认有数据的电站
* @param dataSourceRequest 数据源请求
* @return 数据源结果
*/
DataSourceResult getDefaultStcd(DataSourceRequest dataSourceRequest);
/**
* 获取不达标详情数据
* @param dataSourceRequest 数据源请求
* @return 数据源结果
*/
DataSourceResult getSfdbInfo(DataSourceRequest dataSourceRequest);
/**
* 生态流量不达标测站数
* @param dataSourceRequest 数据源请求
* @return 数据源结果
*/
DataSourceResult qecSfdbCountByStcd(DataSourceRequest dataSourceRequest);
/**
* 生态流量达标率计算基地维度不达标原因维度
* @param dataSourceRequest 数据源请求
* @return 数据源结果
*/
DataSourceResult qecRateCount(DataSourceRequest dataSourceRequest);
/**
* 生态流量不达标数量计算电站维度不达标原因维度
* @param dataSourceRequest 数据源请求
* @return 数据源结果
*/
DataSourceResult qecSfdbCount(DataSourceRequest dataSourceRequest);
}

View File

@ -0,0 +1,32 @@
package com.yfd.platform.eng.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.eng.entity.EqSpecial;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import java.util.Map;
/**
* 电站专题-环保设施运行情况服务
*/
public interface EngSpecialService {
/**
* 处理kendo列表
* @param dataSourceRequest 数据源请求
* @param filterResult 筛选结果
* @param page 分页
* @return 数据源结果
*/
DataSourceResult<EqSpecial> processKendoList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page);
/**
* 处理kendo返回列表字典匹配
* @param dataSourceRequest 数据源请求
* @param dataSourceResult 数据源结果
*/
void processKendoGetListLoadResult(DataSourceRequest dataSourceRequest, DataSourceResult<EqSpecial> dataSourceResult);
}

View File

@ -0,0 +1,66 @@
package com.yfd.platform.eng.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.eng.entity.vo.AlarmStcdCountVo;
import com.yfd.platform.eng.service.AlarmPointService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 警报锚点服务实现
*/
@Service
public class AlarmPointServiceImpl implements AlarmPointService {
@Override
public DataSourceResult<AlarmStcdCountVo> processKendoList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page) {
// 模拟数据实际应该从数据库查询
List<AlarmStcdCountVo> dataList = new ArrayList<>();
// 模拟添加一些数据
AlarmStcdCountVo vo1 = new AlarmStcdCountVo();
vo1.setStcd("ST001");
vo1.setStnm("电站1");
vo1.setAlarmCount(10);
vo1.setUnhandledCount(3);
vo1.setHandlingCount(2);
vo1.setHandledCount(5);
dataList.add(vo1);
AlarmStcdCountVo vo2 = new AlarmStcdCountVo();
vo2.setStcd("ST002");
vo2.setStnm("电站2");
vo2.setAlarmCount(8);
vo2.setUnhandledCount(2);
vo2.setHandlingCount(1);
vo2.setHandledCount(5);
dataList.add(vo2);
DataSourceResult<AlarmStcdCountVo> result = new DataSourceResult<>();
result.setData(dataList);
result.setTotal(dataList.size());
return result;
}
@Override
public void processKendoGetListLoadResult(DataSourceRequest dataSourceRequest, DataSourceResult<AlarmStcdCountVo> dataSourceResult) {
// 处理字典匹配实际应该根据业务需求实现
}
@Override
public AlarmStcdCountVo getAlarmCount(String stcd) {
// 模拟数据实际应该从数据库查询
AlarmStcdCountVo vo = new AlarmStcdCountVo();
vo.setStcd(stcd);
vo.setStnm("电站" + stcd);
vo.setAlarmCount(5);
vo.setUnhandledCount(1);
vo.setHandlingCount(1);
vo.setHandledCount(3);
return vo;
}
}

View File

@ -0,0 +1,72 @@
package com.yfd.platform.eng.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.eng.service.EngEqDataService;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Map;
/**
* 生态流量数据服务实现
*/
@Service
public class EngEqDataServiceImpl implements EngEqDataService {
@Override
public DataSourceResult processKendoList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
@Override
public void processKendoGetListLoadResult(DataSourceRequest dataSourceRequest, DataSourceResult dataSourceResult) {
// 处理字典匹配实际应该根据业务需求实现
}
@Override
public String processGroupConditionSql(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult) {
// 模拟SQL条件实际应该根据业务需求实现
return "1=1";
}
@Override
public DataSourceResult processDayKendoList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page, String groupBy) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
@Override
public DataSourceResult processKendoDrtpList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page, String groupBy) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
@Override
public DataSourceResult getFastSiteLastData(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page, String groupBy) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
@Override
public Object getEngLimit(DataSourceRequest dataSourceRequest) {
// 模拟数据实际应该从数据库查询
return null;
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,166 @@
package com.yfd.platform.eng.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.*;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
import com.yfd.platform.eng.domain.MsEngEq;
import com.yfd.platform.eng.mapper.EngEqMapper;
import com.yfd.platform.eng.service.EngEqService;
import com.zny.dec.framework.kendo.entity.dto.devextreme.GroupingInfo;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import com.zny.dec.framework.kendo.entity.mapping.GroupResult;
import com.zny.dec.framework.kendo.mybatis.devExtreme.helper.GroupHelper;
import com.zny.dec.framework.kendo.util.KendoUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* 生态流量服务实现
*/
@Service
public class EngEqServiceImpl extends ServiceImpl<EngEqMapper, MsEngEq> implements EngEqService {
@Resource
MicroservicDynamicSQLMapper microservicDynamicSQLMapper;
@Override
public DataSourceResult processKendoList(DataSourceRequest dataSourceRequest, Map<String, GroupResult> filterResult, Page page) {
DataSourceResult dataSourceResult = new DataSourceResult<>();
StringBuilder sql = new StringBuilder();
String kendoGroupCode = "default";
String kendoGroupCode2 = "TM";
if (filterResult.get(kendoGroupCode) !=null && StrUtil.isNotBlank(filterResult.get(kendoGroupCode).getSelectSql())) {
sql.append(filterResult.get("default").getSelectSql());
if (filterResult.get(kendoGroupCode2) !=null && StrUtil.isNotBlank(filterResult.get(kendoGroupCode2).getSelectSql())) {
sql.append(StrUtil.replace(filterResult.get(kendoGroupCode2).getSelectSql(),"select",","));
}
sql.append(",MET1.QEC beforeQec FROM ");
sql.append(" MS_ENG_T MET left join MS_ENG_T MET1 on MET1.stcd=MET.stcd and MET1.TYPE=met.type and add_months(MET1.TM,12)=met.tm inner join V_MS_STBPRP_T MSB on MSB.STCD=MET.STCD where MSB.STTP_CODE = 'ENG' and MSB.BLDSTT_CCODE = 2 ");//去掉大中型电站过滤条件
}
if (filterResult.get(kendoGroupCode) !=null && StrUtil.isNotBlank(filterResult.get(kendoGroupCode).getGroupSql())) {
sql.append(" and ").append(filterResult.get(kendoGroupCode).getGroupSql());
}
if (filterResult.get(kendoGroupCode2) != null && StrUtil.isNotBlank(filterResult.get(kendoGroupCode2).getGroupSql())) {
sql.append(" and ").append(filterResult.get(kendoGroupCode2).getGroupSql());
}
if (filterResult.get(kendoGroupCode2) !=null && StrUtil.isNotBlank(filterResult.get(kendoGroupCode2).getOrderBySql())) {
sql.append(" ").append(filterResult.get(kendoGroupCode2).getOrderBySql());
}
//组装分组条件
String groupBy = KendoUtil.getGroupBy(dataSourceRequest);
GroupingInfo[] group = dataSourceRequest.toDevRequest().getGroup();
if (StrUtil.isNotBlank(groupBy)) {
StringBuilder temp = new StringBuilder("select ");
List<String> groupFields = new ArrayList<>();
for (GroupingInfo item : group) {
groupFields.add(item.getSelector());
}
temp.append(StrUtil.join(",",groupFields));
for (GroupingInfo item : group) {
groupFields.add(item.getSelector());
temp.append(",").append("count(*) as count_").append(item.getSelector());
}
sql = temp.append(" from ( ").append(sql).append(" ) ").append(groupBy);
}
if (filterResult.get(kendoGroupCode) !=null && StrUtil.isNotBlank(filterResult.get(kendoGroupCode).getOrderBySql())) {
sql.append(" ").append(filterResult.get(kendoGroupCode).getOrderBySql());
}
//组装map参数
Map<String, Object> map = new HashMap<>();
for (String key : filterResult.keySet()) {
map.putAll(filterResult.get(key).getParamMap());
}
if (StrUtil.isNotBlank(groupBy)) {
List<Map<String, Object>> list = microservicDynamicSQLMapper.pageAllList(page, sql.toString(), map);
//是否扁平化分组
if (null != dataSourceRequest.getGroupResultFlat() && dataSourceRequest.getGroupResultFlat()) {
dataSourceResult.setData((new GroupHelper()).faltGroup(list, Arrays.asList(group)));
} else {
dataSourceResult.setData((new GroupHelper()).group(list, Arrays.asList(group)));
}
dataSourceResult.setTotal(0);
return dataSourceResult;
}
List<MsEngEq> list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), map,MsEngEq.class);
dataSourceResult.setData(list);
dataSourceResult.setTotal(ObjectUtil.isNotEmpty(page) ? page.getTotal() : (long) list.size());
return dataSourceResult;
}
@Override
public void processKendoGetListLoadResult(DataSourceRequest dataSourceRequest, DataSourceResult dataSourceResult) {
// 处理字典匹配实际应该根据业务需求实现
}
@Override
public String processGroupConditionSql(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult) {
// 模拟SQL条件实际应该根据业务需求实现
return "1=1";
}
@Override
public DataSourceResult lastEngDataSite(DataSourceRequest dataSourceRequest) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
@Override
public DataSourceResult getDefaultStcd(DataSourceRequest dataSourceRequest) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
@Override
public DataSourceResult getSfdbInfo(DataSourceRequest dataSourceRequest) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
@Override
public DataSourceResult qecSfdbCountByStcd(DataSourceRequest dataSourceRequest) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
@Override
public DataSourceResult qecRateCount(DataSourceRequest dataSourceRequest) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
@Override
public DataSourceResult qecSfdbCount(DataSourceRequest dataSourceRequest) {
// 模拟数据实际应该从数据库查询
DataSourceResult result = new DataSourceResult();
result.setData(new ArrayList<>());
result.setTotal(0L);
return result;
}
}

View File

@ -0,0 +1,61 @@
package com.yfd.platform.eng.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yfd.platform.common.DataSourceRequest;
//import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.eng.entity.EqSpecial;
import com.yfd.platform.eng.service.EngSpecialService;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceResult;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 电站专题-环保设施运行情况服务实现
*/
@Service
public class EngSpecialServiceImpl implements EngSpecialService {
@Override
public DataSourceResult<EqSpecial> processKendoList(DataSourceRequest dataSourceRequest, Map<String, Object> filterResult, Page page) {
// 模拟数据实际应该从数据库查询
List<EqSpecial> dataList = new ArrayList<>();
// 模拟添加一些数据
EqSpecial special1 = new EqSpecial();
special1.setId("1");
special1.setStcd("ST001");
special1.setStnm("电站1");
special1.setEqType("生态流量监测设施");
special1.setEqName("流量监测仪");
special1.setStatus("正常运行");
special1.setCheckTime("2023-04-14");
special1.setChecker("张三");
special1.setRemark("");
dataList.add(special1);
EqSpecial special2 = new EqSpecial();
special2.setId("2");
special2.setStcd("ST002");
special2.setStnm("电站2");
special2.setEqType("水质监测设施");
special2.setEqName("水质分析仪");
special2.setStatus("正常运行");
special2.setCheckTime("2023-04-15");
special2.setChecker("李四");
special2.setRemark("");
dataList.add(special2);
DataSourceResult<EqSpecial> result = new DataSourceResult<>();
result.setData(dataList);
result.setTotal(dataList.size());
return result;
}
@Override
public void processKendoGetListLoadResult(DataSourceRequest dataSourceRequest, DataSourceResult<EqSpecial> dataSourceResult) {
// 处理字典匹配实际应该根据业务需求实现
}
}