Compare commits
No commits in common. "main" and "main_hzz" have entirely different histories.
@ -40,7 +40,7 @@
|
|||||||
<ip2region.version>1.7.2</ip2region.version>
|
<ip2region.version>1.7.2</ip2region.version>
|
||||||
<easy.captcha.version>1.6.2</easy.captcha.version>
|
<easy.captcha.version>1.6.2</easy.captcha.version>
|
||||||
<useragentutils.version>1.21</useragentutils.version>
|
<useragentutils.version>1.21</useragentutils.version>
|
||||||
<gson.version>2.10.1</gson.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 统一管理 MyBatis 相关版本,解决依赖收敛冲突 -->
|
<!-- 统一管理 MyBatis 相关版本,解决依赖收敛冲突 -->
|
||||||
@ -309,23 +309,17 @@
|
|||||||
<version>15.4</version>
|
<version>15.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- gson -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.zny.platform</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>dec-framework-kendo</artifactId>
|
||||||
<version>${gson.version}</version>
|
<version>0.4.0.5-SNAPSHOT</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>dm.jdbc.driver</groupId>
|
||||||
|
<artifactId>18</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</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 依赖 -->
|
<!-- 显式添加 Jackson 依赖 -->
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
//
|
|
||||||
// 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 FilterFieldMeta {
|
|
||||||
private DataSourceRequest.FilterDescriptor filterDescriptor;
|
|
||||||
private Map<String, ItemEntity> fieldMeta;
|
|
||||||
private List<OrderBy> orderByList;
|
|
||||||
|
|
||||||
public FilterFieldMeta(DataSourceRequest.FilterDescriptor filterDescriptor, Map<String, ItemEntity> fieldMeta) {
|
|
||||||
this.filterDescriptor = filterDescriptor;
|
|
||||||
this.fieldMeta = fieldMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataSourceRequest.FilterDescriptor getFilterDescriptor() {
|
|
||||||
return this.filterDescriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFilterDescriptor(DataSourceRequest.FilterDescriptor filterDescriptor) {
|
|
||||||
this.filterDescriptor = filterDescriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, ItemEntity> getFieldMeta() {
|
|
||||||
return this.fieldMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFieldMeta(Map<String, ItemEntity> fieldMeta) {
|
|
||||||
this.fieldMeta = fieldMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<OrderBy> getOrderByList() {
|
|
||||||
return this.orderByList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderByList(List<OrderBy> orderByList) {
|
|
||||||
this.orderByList = orderByList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,200 +0,0 @@
|
|||||||
//
|
|
||||||
// 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 java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class Group {
|
|
||||||
private Object key;
|
|
||||||
private String keyName;
|
|
||||||
private Map<String, Object> keyExt;
|
|
||||||
@JsonIgnore
|
|
||||||
private Object field;
|
|
||||||
private List items;
|
|
||||||
private int count = 0;
|
|
||||||
private Object[] summary;
|
|
||||||
private Map<String, Object> aggregates;
|
|
||||||
|
|
||||||
public Group() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getKey() {
|
|
||||||
return this.key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKeyName() {
|
|
||||||
return this.keyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> getKeyExt() {
|
|
||||||
return this.keyExt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getField() {
|
|
||||||
return this.field;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List getItems() {
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
return this.count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object[] getSummary() {
|
|
||||||
return this.summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> getAggregates() {
|
|
||||||
return this.aggregates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKey(final Object key) {
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeyName(final String keyName) {
|
|
||||||
this.keyName = keyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeyExt(final Map<String, Object> keyExt) {
|
|
||||||
this.keyExt = keyExt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
public void setField(final Object field) {
|
|
||||||
this.field = field;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItems(final List items) {
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCount(final int count) {
|
|
||||||
this.count = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSummary(final Object[] summary) {
|
|
||||||
this.summary = summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 Group)) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
Group other = (Group)o;
|
|
||||||
if (!other.canEqual(this)) {
|
|
||||||
return false;
|
|
||||||
} else if (this.getCount() != other.getCount()) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
Object this$key = this.getKey();
|
|
||||||
Object other$key = other.getKey();
|
|
||||||
if (this$key == null) {
|
|
||||||
if (other$key != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!this$key.equals(other$key)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object this$keyName = this.getKeyName();
|
|
||||||
Object other$keyName = other.getKeyName();
|
|
||||||
if (this$keyName == null) {
|
|
||||||
if (other$keyName != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!this$keyName.equals(other$keyName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object this$keyExt = this.getKeyExt();
|
|
||||||
Object other$keyExt = other.getKeyExt();
|
|
||||||
if (this$keyExt == null) {
|
|
||||||
if (other$keyExt != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!this$keyExt.equals(other$keyExt)) {
|
|
||||||
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$items = this.getItems();
|
|
||||||
Object other$items = other.getItems();
|
|
||||||
if (this$items == null) {
|
|
||||||
if (other$items != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!this$items.equals(other$items)) {
|
|
||||||
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 Group;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode() {
|
|
||||||
int PRIME = 59;
|
|
||||||
int result = 1;
|
|
||||||
result = result * 59 + this.getCount();
|
|
||||||
Object $key = this.getKey();
|
|
||||||
result = result * 59 + ($key == null ? 43 : $key.hashCode());
|
|
||||||
Object $keyName = this.getKeyName();
|
|
||||||
result = result * 59 + ($keyName == null ? 43 : $keyName.hashCode());
|
|
||||||
Object $keyExt = this.getKeyExt();
|
|
||||||
result = result * 59 + ($keyExt == null ? 43 : $keyExt.hashCode());
|
|
||||||
Object $field = this.getField();
|
|
||||||
result = result * 59 + ($field == null ? 43 : $field.hashCode());
|
|
||||||
Object $items = this.getItems();
|
|
||||||
result = result * 59 + ($items == null ? 43 : $items.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 "Group(key=" + this.getKey() + ", keyName=" + this.getKeyName() + ", keyExt=" + this.getKeyExt() + ", field=" + this.getField() + ", items=" + this.getItems() + ", count=" + this.getCount() + ", summary=" + Arrays.deepToString(this.getSummary()) + ", aggregates=" + this.getAggregates() + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,189 +0,0 @@
|
|||||||
//
|
|
||||||
// Source code recreated from a .class file by IntelliJ IDEA
|
|
||||||
// (powered by FernFlower decompiler)
|
|
||||||
//
|
|
||||||
|
|
||||||
package com.yfd.platform.common;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class GroupHelper {
|
|
||||||
public GroupHelper() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Group> group(List<Map<String, Object>> data, List<GroupingInfo> groupInfo) {
|
|
||||||
List<Group> groups = this.group(data, (GroupingInfo)groupInfo.get(0));
|
|
||||||
if (groupInfo.size() > 1 && CollectionUtil.isNotEmpty(groups)) {
|
|
||||||
for(Group group : groups) {
|
|
||||||
group.setItems(this.group(group.getItems(), groupInfo.subList(1, groupInfo.size())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Map> faltGroup(List<Map<String, Object>> data, List<GroupingInfo> groupInfo) {
|
|
||||||
List<Map> result = new ArrayList();
|
|
||||||
|
|
||||||
for(Map<String, Object> item : data) {
|
|
||||||
result.add(this.flatGroupResult(item, groupInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map flatGroupResult(Map<String, Object> item, List<GroupingInfo> groupInfos) {
|
|
||||||
Map<String, Object> group = new HashMap();
|
|
||||||
|
|
||||||
for(GroupingInfo groupInfo : groupInfos) {
|
|
||||||
Object groupKey = this.getKey(item, groupInfo);
|
|
||||||
if (CollectionUtil.isNotEmpty(groupInfo.getSummaryInfos())) {
|
|
||||||
for(SummaryInfo summaryInfo : groupInfo.getSummaryInfos()) {
|
|
||||||
String summaryType = summaryInfo.getSummaryType();
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
stringBuilder.append(summaryType).append("_").append(summaryInfo.getSelector());
|
|
||||||
String key = stringBuilder.toString();
|
|
||||||
Object tempCount = item.get(key);
|
|
||||||
if (tempCount == null) {
|
|
||||||
tempCount = item.get(key.toUpperCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tempCount != null) {
|
|
||||||
if (tempCount instanceof Number) {
|
|
||||||
group.put(key, tempCount);
|
|
||||||
} else {
|
|
||||||
Integer count = NumberUtil.parseInt(tempCount.toString());
|
|
||||||
group.put(key, count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object tempCount = item.get("count_" + groupInfo.getSelector());
|
|
||||||
if (tempCount == null) {
|
|
||||||
tempCount = item.get("COUNT_" + groupInfo.getSelector().toUpperCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tempCount != null) {
|
|
||||||
Integer count = NumberUtil.parseInt(tempCount.toString());
|
|
||||||
group.put("count_" + groupInfo.getSelector(), count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
group.put(groupInfo.getSelector(), groupKey);
|
|
||||||
group.put(groupInfo.getSelector() + "_value", groupKey);
|
|
||||||
group.put(groupInfo.getSelector() + "_ext", (Object)null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Group> group(List<Map<String, Object>> data, GroupingInfo groupInfo) {
|
|
||||||
Map<Object, Group> groupsIndex = new HashMap();
|
|
||||||
List<Group> groups = new ArrayList();
|
|
||||||
|
|
||||||
for(Map<String, Object> item : data) {
|
|
||||||
Object groupKey = this.getKey(item, groupInfo);
|
|
||||||
Object groupIndexKey = groupKey != null ? groupKey : null;
|
|
||||||
Object tempCount = item.get("count_" + groupInfo.getSelector());
|
|
||||||
if (tempCount == null) {
|
|
||||||
tempCount = item.get("COUNT_" + groupInfo.getSelector().toUpperCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!groupsIndex.containsKey(groupIndexKey)) {
|
|
||||||
Group newGroup = new Group();
|
|
||||||
newGroup.setKey(groupKey);
|
|
||||||
newGroup.setField(groupInfo.getSelector());
|
|
||||||
if (tempCount != null) {
|
|
||||||
newGroup.setCount(NumberUtil.parseInt(tempCount.toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(groupInfo.getSummaryInfos())) {
|
|
||||||
Map<String, Object> groupSummarys = new HashMap();
|
|
||||||
|
|
||||||
for(SummaryInfo summaryInfo : groupInfo.getSummaryInfos()) {
|
|
||||||
String summaryType = summaryInfo.getSummaryType();
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
stringBuilder.append(summaryType).append("_").append(summaryInfo.getSelector());
|
|
||||||
String key = stringBuilder.toString();
|
|
||||||
Object summaryValue = item.get(key);
|
|
||||||
if (summaryValue == null) {
|
|
||||||
summaryValue = item.get(key.toUpperCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
groupSummarys.put(key, summaryValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
newGroup.setAggregates(groupSummarys);
|
|
||||||
}
|
|
||||||
|
|
||||||
groupsIndex.put(groupIndexKey, newGroup);
|
|
||||||
groups.add(newGroup);
|
|
||||||
} else {
|
|
||||||
Group newGroup = (Group)groupsIndex.get(groupIndexKey);
|
|
||||||
if (tempCount != null) {
|
|
||||||
newGroup.setCount(newGroup.getCount() + NumberUtil.parseInt(tempCount.toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Group group = (Group)groupsIndex.get(groupIndexKey);
|
|
||||||
if (group.getItems() == null) {
|
|
||||||
group.setItems(new ArrayList());
|
|
||||||
group.getItems().add(item);
|
|
||||||
} else {
|
|
||||||
group.getItems().add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object getKey(Map<String, Object> obj, GroupingInfo groupInfo) {
|
|
||||||
Object memberValue = obj.get(groupInfo.getSelector());
|
|
||||||
if (memberValue == null) {
|
|
||||||
memberValue = obj.get(groupInfo.getSelector().toUpperCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
String intervalString = groupInfo.getGroupInterval();
|
|
||||||
if (!StrUtil.isEmpty(intervalString) && memberValue != null) {
|
|
||||||
if (NumberUtil.isNumber(intervalString)) {
|
|
||||||
BigDecimal number = NumberUtil.toBigDecimal((Number)memberValue);
|
|
||||||
BigDecimal interval = NumberUtil.toBigDecimal(intervalString);
|
|
||||||
return number.subtract(number.divideAndRemainder(interval)[1]);
|
|
||||||
} else {
|
|
||||||
switch (intervalString) {
|
|
||||||
case "year":
|
|
||||||
return toDateTime(memberValue).getYear();
|
|
||||||
case "month":
|
|
||||||
return toDateTime(memberValue).getMonth();
|
|
||||||
case "day":
|
|
||||||
return toDateTime(memberValue).getDayOfYear();
|
|
||||||
case "dayOfWeek":
|
|
||||||
return toDateTime(memberValue).getDayOfWeek();
|
|
||||||
case "hour":
|
|
||||||
return toDateTime(memberValue).getHour();
|
|
||||||
case "minute":
|
|
||||||
return toDateTime(memberValue).getMinute();
|
|
||||||
case "second":
|
|
||||||
return toDateTime(memberValue).getSecond();
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("memberValue字段解析失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return memberValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static LocalDateTime toDateTime(Object value) {
|
|
||||||
return value instanceof LocalDateTime ? (LocalDateTime)value : LocalDateTime.parse(value.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
//
|
|
||||||
// Source code recreated from a .class file by IntelliJ IDEA
|
|
||||||
// (powered by FernFlower decompiler)
|
|
||||||
//
|
|
||||||
|
|
||||||
package com.yfd.platform.common;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class GuidStringSerialize extends JsonSerializer<String> {
|
|
||||||
private final String GUID_EMPTY = "00000000-0000-0000-0000-000000000000";
|
|
||||||
|
|
||||||
public GuidStringSerialize() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void serialize(String value, JsonGenerator jGen, SerializerProvider sProvider) throws IOException {
|
|
||||||
if ("00000000-0000-0000-0000-000000000000".equals(value) || StrUtil.isBlank(value)) {
|
|
||||||
value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
jGen.writeString(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
//
|
|
||||||
// Source code recreated from a .class file by IntelliJ IDEA
|
|
||||||
// (powered by FernFlower decompiler)
|
|
||||||
//
|
|
||||||
|
|
||||||
package com.yfd.platform.common;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
public class ItemEntity {
|
|
||||||
private String filterItem;
|
|
||||||
private String itemMap;
|
|
||||||
private String alias;
|
|
||||||
private String fieldSql;
|
|
||||||
|
|
||||||
public ItemEntity(String filterItem, String itemMap, String alias) {
|
|
||||||
this.filterItem = filterItem;
|
|
||||||
this.itemMap = itemMap;
|
|
||||||
this.alias = alias;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFieldSql() {
|
|
||||||
if (StrUtil.isNotBlank(this.fieldSql)) {
|
|
||||||
return this.fieldSql;
|
|
||||||
} else {
|
|
||||||
if (StrUtil.isNotBlank(this.alias)) {
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
stringBuilder.append(this.alias);
|
|
||||||
stringBuilder.append(".");
|
|
||||||
stringBuilder.append(this.itemMap);
|
|
||||||
this.fieldSql = stringBuilder.toString();
|
|
||||||
} else {
|
|
||||||
this.fieldSql = this.itemMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.fieldSql;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFilterItem() {
|
|
||||||
return this.filterItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFilterItem(String filterItem) {
|
|
||||||
this.filterItem = filterItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getItemMap() {
|
|
||||||
return this.itemMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemMap(String itemMap) {
|
|
||||||
this.itemMap = itemMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAlias() {
|
|
||||||
return this.alias;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAlias(String alias) {
|
|
||||||
this.alias = alias;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
//
|
|
||||||
// Source code recreated from a .class file by IntelliJ IDEA
|
|
||||||
// (powered by FernFlower decompiler)
|
|
||||||
//
|
|
||||||
|
|
||||||
package com.yfd.platform.common;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
public class OrderBy {
|
|
||||||
public static final String ORDER_ASC = "asc";
|
|
||||||
public static final String ORDER_DESC = "desc";
|
|
||||||
private final String sort;
|
|
||||||
private final String order;
|
|
||||||
|
|
||||||
public OrderBy(String sort, String order) {
|
|
||||||
this.sort = sort;
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSort() {
|
|
||||||
return this.sort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrder() {
|
|
||||||
return this.order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid(Set<String> fieldSet) {
|
|
||||||
return fieldSet.contains(this.sort) && (StringUtils.isBlank(this.order) || "asc".equalsIgnoreCase(this.order) || "desc".equalsIgnoreCase(this.order));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
//
|
|
||||||
// Source code recreated from a .class file by IntelliJ IDEA
|
|
||||||
// (powered by FernFlower decompiler)
|
|
||||||
//
|
|
||||||
|
|
||||||
package com.yfd.platform.common;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
|
|
||||||
public class PageInfo {
|
|
||||||
private Boolean hasPageInfo;
|
|
||||||
private Page page;
|
|
||||||
|
|
||||||
public PageInfo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getHasPageInfo() {
|
|
||||||
return this.hasPageInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Page getPage() {
|
|
||||||
return this.page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasPageInfo(final Boolean hasPageInfo) {
|
|
||||||
this.hasPageInfo = hasPageInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(final Page page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(final Object o) {
|
|
||||||
if (o == this) {
|
|
||||||
return true;
|
|
||||||
} else if (!(o instanceof PageInfo)) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
PageInfo other = (PageInfo)o;
|
|
||||||
if (!other.canEqual(this)) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
Object this$hasPageInfo = this.getHasPageInfo();
|
|
||||||
Object other$hasPageInfo = other.getHasPageInfo();
|
|
||||||
if (this$hasPageInfo == null) {
|
|
||||||
if (other$hasPageInfo != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!this$hasPageInfo.equals(other$hasPageInfo)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object this$page = this.getPage();
|
|
||||||
Object other$page = other.getPage();
|
|
||||||
if (this$page == null) {
|
|
||||||
if (other$page != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!this$page.equals(other$page)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
|
||||||
return other instanceof PageInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode() {
|
|
||||||
int PRIME = 59;
|
|
||||||
int result = 1;
|
|
||||||
Object $hasPageInfo = this.getHasPageInfo();
|
|
||||||
result = result * 59 + ($hasPageInfo == null ? 43 : $hasPageInfo.hashCode());
|
|
||||||
Object $page = this.getPage();
|
|
||||||
result = result * 59 + ($page == null ? 43 : $page.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return "PageInfo(hasPageInfo=" + this.getHasPageInfo() + ", page=" + this.getPage() + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +1,14 @@
|
|||||||
package com.yfd.platform.eng.controller;
|
package com.yfd.platform.eng.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
//import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.common.GroupResult;
|
//import com.yfd.platform.common.GroupResult;
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
import com.yfd.platform.eng.service.EngEqService;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|||||||
@ -1,19 +1,23 @@
|
|||||||
package com.yfd.platform.eng.controller;
|
package com.yfd.platform.eng.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
//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.common.DataSourceResult;
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
import com.yfd.platform.eng.service.EngEqDataService;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,25 +2,32 @@ package com.yfd.platform.eng.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.annotation.Log;
|
import com.yfd.platform.annotation.Log;
|
||||||
import com.yfd.platform.common.DataSourceLoadOptionsBase;
|
//import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
import com.yfd.platform.eng.domain.MsEngEq;
|
import com.yfd.platform.eng.domain.MsEngEq;
|
||||||
import com.yfd.platform.eng.service.EngEqIntervalService;
|
import com.yfd.platform.eng.service.EngEqIntervalService;
|
||||||
import com.yfd.platform.eng.service.EngEqService;
|
import com.yfd.platform.eng.service.EngEqService;
|
||||||
import com.yfd.platform.utils.KendoUtil;
|
import com.zny.dec.core.common.util.SpringContextHolder;
|
||||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
import com.zny.dec.core.tenant.TenantContextHolder;
|
||||||
import com.yfd.platform.utils.QueryWrapperUtil;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,9 +84,9 @@ public class EngEqIntervalController {
|
|||||||
public ResponseResult getQgcHourKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult getQgcHourKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
String kendoGroupCode = "EngEqHour";
|
String kendoGroupCode = "EngEqHour";
|
||||||
// Map<String, GroupResult> filterResult = KendoUtil.getGroupResultMap(dataSourceRequest, null, EngEqIntervalController.class);
|
// Map<String, GroupResult> filterResult = KendoUtil.getGroupResultMap(dataSourceRequest, null, EngEqIntervalController.class);
|
||||||
// String groupBy = KendoUtil.getGroupBy(dataSourceRequest);
|
String groupBy = KendoUtil.getGroupBy(dataSourceRequest);
|
||||||
Page page = KendoUtil.getPage(dataSourceRequest);
|
Page page = KendoUtil.getPage(dataSourceRequest);
|
||||||
DataSourceResult result = eqIntervalService.getQgcHourKendoListCust(dataSourceRequest, null, page, null);
|
DataSourceResult result = eqIntervalService.getQgcHourKendoListCust(dataSourceRequest, null, page, groupBy);
|
||||||
// eqIntervalService.processKendoGetListLoadResult(dataSourceRequest, result);
|
// eqIntervalService.processKendoGetListLoadResult(dataSourceRequest, result);
|
||||||
return ResponseResult.successData(result);
|
return ResponseResult.successData(result);
|
||||||
}
|
}
|
||||||
@ -110,7 +117,7 @@ public class EngEqIntervalController {
|
|||||||
// @Log(module = "生态流量", value = "生态流量达标率统计")
|
// @Log(module = "生态流量", value = "生态流量达标率统计")
|
||||||
public ResponseResult getQgcStaticData(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult getQgcStaticData(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
DataSourceLoadOptionsBase loadOptionsBase = dataSourceRequest.toDevRequest();
|
DataSourceLoadOptionsBase loadOptionsBase = dataSourceRequest.toDevRequest();
|
||||||
String type = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "type");
|
String type = QueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "type");
|
||||||
ResponseResult r;
|
ResponseResult r;
|
||||||
if("hour".equals(type)){
|
if("hour".equals(type)){
|
||||||
r = this.getQgcHourKendoListCust(dataSourceRequest);
|
r = this.getQgcHourKendoListCust(dataSourceRequest);
|
||||||
|
|||||||
@ -1,20 +1,22 @@
|
|||||||
package com.yfd.platform.eng.controller;
|
package com.yfd.platform.eng.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
//import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.common.GroupResult;
|
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
import com.yfd.platform.eng.service.EngEqService;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,19 +1,22 @@
|
|||||||
package com.yfd.platform.eng.controller;
|
package com.yfd.platform.eng.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
//import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
import com.yfd.platform.eng.entity.EqSpecial;
|
import com.yfd.platform.eng.entity.EqSpecial;
|
||||||
import com.yfd.platform.eng.service.EngSpecialService;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
package com.yfd.platform.eng.service;
|
package com.yfd.platform.eng.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
import com.zny.dec.framework.kendo.entity.dto.kendo.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
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;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
package com.yfd.platform.eng.service;
|
package com.yfd.platform.eng.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
//import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.common.GroupResult;
|
|
||||||
import com.yfd.platform.eng.domain.MsEngEq;
|
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;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
package com.yfd.platform.eng.service;
|
package com.yfd.platform.eng.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
//import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.GroupResult;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
|
//import com.yfd.platform.common.GroupResult;
|
||||||
import com.yfd.platform.eng.domain.MsEngEq;
|
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;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package com.yfd.platform.eng.service;
|
package com.yfd.platform.eng.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
//import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.eng.entity.EqSpecial;
|
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;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.yfd.platform.eng.service.impl;
|
package com.yfd.platform.eng.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
//import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.eng.service.EngEqDataService;
|
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 org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -2,13 +2,21 @@ package com.yfd.platform.eng.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.yfd.platform.common.*;
|
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.domain.MsEngEq;
|
||||||
import com.yfd.platform.eng.mapper.EngEqMapper;
|
import com.yfd.platform.eng.mapper.EngEqMapper;
|
||||||
import com.yfd.platform.eng.service.EngEqService;
|
import com.yfd.platform.eng.service.EngEqService;
|
||||||
import com.yfd.platform.utils.KendoUtil;
|
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 jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
package com.yfd.platform.eng.service.impl;
|
package com.yfd.platform.eng.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
//import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
//import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.eng.entity.EqSpecial;
|
import com.yfd.platform.eng.entity.EqSpecial;
|
||||||
import com.yfd.platform.eng.service.EngSpecialService;
|
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 org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@ -1,104 +0,0 @@
|
|||||||
//
|
|
||||||
// Source code recreated from a .class file by IntelliJ IDEA
|
|
||||||
// (powered by FernFlower decompiler)
|
|
||||||
//
|
|
||||||
|
|
||||||
package com.yfd.platform.utils;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class KendoUtil extends ReflectUtil {
|
|
||||||
public KendoUtil() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static Map<String, GroupResult> getGroupResultMap(DataSourceRequest dataSourceRequest, String filter, Class clas) {
|
|
||||||
// SearcherBuilder.BeanSearcherBuilder beanSearcher = SearcherBuilder.beanSearcher();
|
|
||||||
// GroupViewModel groupViewModel = null;
|
|
||||||
// if (filter == null) {
|
|
||||||
// groupViewModel = new GroupViewModel(clas, (String)null);
|
|
||||||
// } else {
|
|
||||||
// groupViewModel = new GroupViewModel(GroupViewModel.class, filter);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return beanSearcher.build().constructGroupSql(groupViewModel, dataSourceRequest);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static String getGroupBy(DataSourceRequest dataSourceRequest) {
|
|
||||||
String groupBy = null;
|
|
||||||
List<DataSourceRequest.GroupDescriptor> groupDescriptorList = dataSourceRequest.getGroup();
|
|
||||||
if (CollectionUtil.isNotEmpty(groupDescriptorList)) {
|
|
||||||
StringBuilder groupByBuilder = new StringBuilder();
|
|
||||||
StringBuilder orderByBuilder = new StringBuilder();
|
|
||||||
int groupInfoCount = groupDescriptorList.size();
|
|
||||||
|
|
||||||
for(int i = 0; i < groupInfoCount; ++i) {
|
|
||||||
DataSourceRequest.GroupDescriptor groupingInfo = (DataSourceRequest.GroupDescriptor)groupDescriptorList.get(i);
|
|
||||||
String selector = groupingInfo.getField();
|
|
||||||
String dir = groupingInfo.getDir();
|
|
||||||
groupByBuilder.append(selector);
|
|
||||||
if (groupingInfo.getNeedSortFlag()) {
|
|
||||||
if ("desc".equals(dir)) {
|
|
||||||
orderByBuilder.append(selector).append(" desc");
|
|
||||||
} else {
|
|
||||||
orderByBuilder.append(selector).append(" asc");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i < groupInfoCount - 1) {
|
|
||||||
groupByBuilder.append(", ");
|
|
||||||
orderByBuilder.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (groupInfoCount > 0) {
|
|
||||||
StringBuilder groupResult = new StringBuilder();
|
|
||||||
groupResult.append(" group by ").append(groupByBuilder.toString());
|
|
||||||
if (StrUtil.isNotBlank(orderByBuilder.toString())) {
|
|
||||||
groupResult.append(" order by ").append(orderByBuilder.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
groupBy = groupResult.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return groupBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Page getPage(DataSourceRequest dataSourceRequest) {
|
|
||||||
if (dataSourceRequest.getTake() != 0) {
|
|
||||||
Page page = new Page();
|
|
||||||
page.setSize((long)dataSourceRequest.getTake());
|
|
||||||
page.setCurrent((long)(dataSourceRequest.getSkip() / dataSourceRequest.getTake() + 1));
|
|
||||||
return page;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<String, Object> getFieldValues(Object obj) {
|
|
||||||
if (null != obj) {
|
|
||||||
Field[] fields = getFields(obj instanceof Class ? (Class)obj : obj.getClass());
|
|
||||||
if (null != fields) {
|
|
||||||
Map<String, Object> valueMap = new HashMap();
|
|
||||||
|
|
||||||
for(int i = 0; i < fields.length; ++i) {
|
|
||||||
Object value = getFieldValue(obj, fields[i]);
|
|
||||||
valueMap.put(fields[i].getName(), value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return valueMap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,679 +0,0 @@
|
|||||||
//
|
|
||||||
// Source code recreated from a .class file by IntelliJ IDEA
|
|
||||||
// (powered by FernFlower decompiler)
|
|
||||||
//
|
|
||||||
|
|
||||||
package com.yfd.platform.utils;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.google.gson.*;
|
|
||||||
import com.yfd.platform.common.*;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class QgcQueryWrapperUtil {
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(QgcQueryWrapperUtil.class);
|
|
||||||
public static final List<String> FIELDNULL = new ArrayList();
|
|
||||||
|
|
||||||
public QgcQueryWrapperUtil() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getJsonFieldNull(String columName) {
|
|
||||||
return FIELDNULL.contains(columName) ? "00000000-0000-0000-0000-000000000000" : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getFilterFieldValue(DataSourceLoadOptionsBase loadOptions, String fieldName) {
|
|
||||||
try {
|
|
||||||
JsonElement jsonElement = (new JsonParser()).parse(JSONUtil.toJsonStr(loadOptions.getFilter()));
|
|
||||||
if (jsonElement instanceof JsonNull) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonArray jArray = (JsonArray)jsonElement;
|
|
||||||
StringBuffer fieldValue = new StringBuffer();
|
|
||||||
parseJArrayConditions(jArray, fieldName, fieldValue);
|
|
||||||
if (fieldValue != null && StrUtil.isNotBlank(fieldValue.toString())) {
|
|
||||||
return fieldValue.toString();
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
log.error("获取值异常", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PageInfo getPageInfo(DataSourceLoadOptionsBase loadOptions) {
|
|
||||||
PageInfo pageInfo = new PageInfo();
|
|
||||||
if (loadOptions.getTake() != null && loadOptions.getTake() != 0) {
|
|
||||||
Page page = null;
|
|
||||||
if (loadOptions.getSkip() != null && loadOptions.getSkip() != 0) {
|
|
||||||
page = new Page((long)(loadOptions.getSkip() / loadOptions.getTake() + 1), (long)loadOptions.getTake());
|
|
||||||
} else {
|
|
||||||
loadOptions.setSkip(0);
|
|
||||||
page = new Page(1L, (long)loadOptions.getTake());
|
|
||||||
}
|
|
||||||
|
|
||||||
pageInfo.setHasPageInfo(true);
|
|
||||||
pageInfo.setPage(page);
|
|
||||||
return pageInfo;
|
|
||||||
} else {
|
|
||||||
pageInfo.setHasPageInfo(false);
|
|
||||||
return pageInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void parseJArrayConditions(JsonArray jsonArray, String fieldName, StringBuffer fieldValue) {
|
|
||||||
if (jsonArray != null && jsonArray.size() != 0) {
|
|
||||||
if (jsonArray.get(0).isJsonPrimitive()) {
|
|
||||||
String columnName = jsonArray.get(0).getAsString();
|
|
||||||
String condition = jsonArray.get(1).getAsString();
|
|
||||||
Object value = null;
|
|
||||||
Object tempValue = jsonArray.get(2);
|
|
||||||
if (((JsonElement)tempValue).isJsonPrimitive()) {
|
|
||||||
JsonPrimitive jsonPrimitive = ((JsonElement)tempValue).getAsJsonPrimitive();
|
|
||||||
if (jsonPrimitive.isBoolean()) {
|
|
||||||
value = jsonPrimitive.getAsBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isNumber()) {
|
|
||||||
Object var10 = jsonPrimitive.getAsNumber();
|
|
||||||
if (var10.toString().contains(".")) {
|
|
||||||
value = ((Number)var10).doubleValue();
|
|
||||||
} else {
|
|
||||||
value = ((Number)var10).longValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isString()) {
|
|
||||||
value = jsonPrimitive.getAsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isJsonNull()) {
|
|
||||||
value = getJsonFieldNull(columnName);
|
|
||||||
}
|
|
||||||
} else if (tempValue instanceof JsonNull) {
|
|
||||||
value = null;
|
|
||||||
} else {
|
|
||||||
value = ((JsonElement)tempValue).getAsJsonArray();
|
|
||||||
if (value != null) {
|
|
||||||
value = value.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (columnName != null && columnName.equals(fieldName)) {
|
|
||||||
if (StrUtil.isEmpty((CharSequence) value)) {
|
|
||||||
StringBuffer var9 = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrUtil.isBlank(fieldValue)) {
|
|
||||||
fieldValue.append(value);
|
|
||||||
} else {
|
|
||||||
fieldValue.append(",").append(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!jsonArray.get(0).isJsonArray()) {
|
|
||||||
throw new RuntimeException("Unknown data type in json array.");
|
|
||||||
}
|
|
||||||
|
|
||||||
parseArrayConditions(jsonArray, fieldName, fieldValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
StringBuffer var8 = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void parseArrayConditions(JsonArray jsonArray, String fieldName, StringBuffer fieldValue) {
|
|
||||||
if (jsonArray != null && jsonArray.size() != 0) {
|
|
||||||
if (jsonArray.size() == 1) {
|
|
||||||
parseJArrayConditions(jsonArray.get(0).getAsJsonArray(), fieldName, fieldValue);
|
|
||||||
} else {
|
|
||||||
for(int i = 0; i <= jsonArray.size(); i += 2) {
|
|
||||||
JsonElement jsonItem = jsonArray.get(i);
|
|
||||||
if (i == 0) {
|
|
||||||
parseJArrayConditions(jsonArray.get(0).getAsJsonArray(), fieldName, fieldValue);
|
|
||||||
} else {
|
|
||||||
String condition = jsonArray.get(i - 1).getAsString();
|
|
||||||
if (condition.equals("and")) {
|
|
||||||
if (jsonItem.getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
parseJArrayConditions(jsonItem.getAsJsonArray(), fieldName, fieldValue);
|
|
||||||
} else {
|
|
||||||
parseJArrayConditions(jsonItem.getAsJsonArray(), fieldName, fieldValue);
|
|
||||||
}
|
|
||||||
} else if (condition.equals("or")) {
|
|
||||||
if (jsonItem.getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
parseJArrayConditions(jsonItem.getAsJsonArray(), fieldName, fieldValue);
|
|
||||||
} else {
|
|
||||||
parseJArrayConditions(jsonItem.getAsJsonArray(), fieldName, fieldValue);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throwIfUnknownCondition(condition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
StringBuffer var6 = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> void parseJArrayConditions(JsonArray jsonArray, QueryWrapper<T> queryWrapper, Map<String, String> fieldsMap, List<String> removeFields, Class modelClass, Boolean validateColumn) {
|
|
||||||
if (jsonArray.get(0).isJsonPrimitive()) {
|
|
||||||
String columnName = jsonArray.get(0).getAsString();
|
|
||||||
String condition = jsonArray.get(1).getAsString();
|
|
||||||
Object value = null;
|
|
||||||
Object tempValue = jsonArray.get(2);
|
|
||||||
if (((JsonElement)tempValue).isJsonPrimitive()) {
|
|
||||||
JsonPrimitive jsonPrimitive = ((JsonElement)tempValue).getAsJsonPrimitive();
|
|
||||||
if (jsonPrimitive.isBoolean()) {
|
|
||||||
value = jsonPrimitive.getAsBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isNumber()) {
|
|
||||||
Object var15 = jsonPrimitive.getAsNumber();
|
|
||||||
if (var15.toString().contains(".")) {
|
|
||||||
value = ((Number)var15).doubleValue();
|
|
||||||
} else {
|
|
||||||
value = ((Number)var15).longValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isString()) {
|
|
||||||
value = jsonPrimitive.getAsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isJsonNull()) {
|
|
||||||
value = getJsonFieldNull(columnName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (removeFields != null && CollectionUtil.contains((Collection<?>) removeFields.iterator(), columnName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String databaseColumnName = (String)fieldsMap.get(columnName);
|
|
||||||
if (databaseColumnName == null) {
|
|
||||||
if (validateColumn) {
|
|
||||||
throw new RuntimeException(columnName + "字段不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
databaseColumnName = columnName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value == null) {
|
|
||||||
Field field = ReflectUtil.getField(modelClass, columnName);
|
|
||||||
if (null != field) {
|
|
||||||
Annotation[] annotations = field.getDeclaredAnnotations();
|
|
||||||
if (ArrayUtil.isNotEmpty(annotations)) {
|
|
||||||
for(Annotation annotation : Arrays.asList(annotations)) {
|
|
||||||
if (annotation.annotationType().equals(JsonSerialize.class) && ((JsonSerialize)annotation).using().equals(GuidStringSerialize.class)) {
|
|
||||||
value = "00000000-0000-0000-0000-000000000000";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value instanceof Boolean) {
|
|
||||||
Boolean var17 = (Boolean)value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (condition.equals("contains")) {
|
|
||||||
queryWrapper.like(databaseColumnName, value);
|
|
||||||
} else if (condition.equals("notcontains")) {
|
|
||||||
queryWrapper.notLike(databaseColumnName, value);
|
|
||||||
} else if (condition.equals("startswith")) {
|
|
||||||
queryWrapper.likeRight(databaseColumnName, value);
|
|
||||||
} else if (condition.equals("endswith")) {
|
|
||||||
queryWrapper.likeLeft(databaseColumnName, value);
|
|
||||||
} else if (condition.equals("=")) {
|
|
||||||
if (value == null) {
|
|
||||||
queryWrapper.isNull(databaseColumnName);
|
|
||||||
} else {
|
|
||||||
queryWrapper.eq(databaseColumnName, value);
|
|
||||||
}
|
|
||||||
} else if (condition.equals("!=")) {
|
|
||||||
queryWrapper.ne(databaseColumnName, value);
|
|
||||||
} else if (condition.equals("<>")) {
|
|
||||||
queryWrapper.ne(databaseColumnName, value);
|
|
||||||
} else if (condition.equals("<")) {
|
|
||||||
queryWrapper.lt(databaseColumnName, value);
|
|
||||||
} else if (condition.equals("<=")) {
|
|
||||||
queryWrapper.le(databaseColumnName, value);
|
|
||||||
} else if (condition.equals(">")) {
|
|
||||||
queryWrapper.gt(databaseColumnName, value);
|
|
||||||
} else if (condition.equals(">=")) {
|
|
||||||
queryWrapper.ge(databaseColumnName, value);
|
|
||||||
} else {
|
|
||||||
throwIfUnknownCondition(condition);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!jsonArray.get(0).isJsonArray()) {
|
|
||||||
throw new RuntimeException("Unknown data type in json array.");
|
|
||||||
}
|
|
||||||
|
|
||||||
parseArrayConditions(jsonArray, queryWrapper, fieldsMap, removeFields, modelClass, validateColumn);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> void getJArrayFilterFields(JsonArray jsonArray, List<String> filterFieldEmptyValueList, List<String> filterFieldList, Class modelClass) {
|
|
||||||
if (jsonArray.get(0).isJsonPrimitive()) {
|
|
||||||
String columnName = jsonArray.get(0).getAsString();
|
|
||||||
Object value = null;
|
|
||||||
Object tempValue = jsonArray.get(2);
|
|
||||||
if (((JsonElement)tempValue).isJsonPrimitive()) {
|
|
||||||
JsonPrimitive jsonPrimitive = ((JsonElement)tempValue).getAsJsonPrimitive();
|
|
||||||
if (jsonPrimitive.isBoolean()) {
|
|
||||||
Object var8 = jsonPrimitive.getAsBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isNumber()) {
|
|
||||||
Object var9 = jsonPrimitive.getAsNumber();
|
|
||||||
if (var9.toString().contains(".")) {
|
|
||||||
Object var10 = ((Number)var9).doubleValue();
|
|
||||||
} else {
|
|
||||||
Object var11 = ((Number)var9).longValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isString()) {
|
|
||||||
Object var12 = jsonPrimitive.getAsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isJsonNull()) {
|
|
||||||
Object var13 = getJsonFieldNull(columnName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filterFieldList.add(columnName);
|
|
||||||
} else {
|
|
||||||
if (!jsonArray.get(0).isJsonArray()) {
|
|
||||||
throw new RuntimeException("Unknown data type in json array.");
|
|
||||||
}
|
|
||||||
|
|
||||||
getArrayFilterFields(jsonArray, filterFieldEmptyValueList, filterFieldList, modelClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void getArrayFilterFields(JsonArray jsonArray, List<String> filterFieldEmptyValueList, List<String> filterFieldList, Class modelClass) {
|
|
||||||
if (jsonArray.size() == 1) {
|
|
||||||
getJArrayFilterFields(jsonArray.get(0).getAsJsonArray(), filterFieldEmptyValueList, filterFieldList, modelClass);
|
|
||||||
} else {
|
|
||||||
for(int i = 0; i <= jsonArray.size(); i += 2) {
|
|
||||||
JsonElement jsonItem = jsonArray.get(i);
|
|
||||||
if (i == 0) {
|
|
||||||
getJArrayFilterFields(jsonArray.get(0).getAsJsonArray(), filterFieldEmptyValueList, filterFieldList, modelClass);
|
|
||||||
} else {
|
|
||||||
String condition = jsonArray.get(i - 1).getAsString();
|
|
||||||
if (condition.equals("and")) {
|
|
||||||
if (jsonItem.getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
getJArrayFilterFields(jsonItem.getAsJsonArray(), filterFieldEmptyValueList, filterFieldList, modelClass);
|
|
||||||
} else {
|
|
||||||
getJArrayFilterFields(jsonItem.getAsJsonArray(), filterFieldEmptyValueList, filterFieldList, modelClass);
|
|
||||||
}
|
|
||||||
} else if (condition.equals("or")) {
|
|
||||||
if (jsonItem.getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
getJArrayFilterFields(jsonItem.getAsJsonArray(), filterFieldEmptyValueList, filterFieldList, modelClass);
|
|
||||||
} else {
|
|
||||||
getJArrayFilterFields(jsonItem.getAsJsonArray(), filterFieldEmptyValueList, filterFieldList, modelClass);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throwIfUnknownCondition(condition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> void parseJArrayConditions(JsonArray jsonArray, QueryWrapper<T> queryWrapper, Class modelClass, Boolean validateColumn) {
|
|
||||||
if (jsonArray.get(0).isJsonPrimitive()) {
|
|
||||||
String columnName = jsonArray.get(0).getAsString();
|
|
||||||
String condition = jsonArray.get(1).getAsString();
|
|
||||||
Object value = null;
|
|
||||||
Object tempValue = jsonArray.get(2);
|
|
||||||
if (((JsonElement)tempValue).isJsonPrimitive()) {
|
|
||||||
JsonPrimitive jsonPrimitive = ((JsonElement)tempValue).getAsJsonPrimitive();
|
|
||||||
if (jsonPrimitive.isBoolean()) {
|
|
||||||
value = jsonPrimitive.getAsBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isNumber()) {
|
|
||||||
Object var12 = jsonPrimitive.getAsNumber();
|
|
||||||
if (var12.toString().contains(".")) {
|
|
||||||
value = ((Number)var12).doubleValue();
|
|
||||||
} else {
|
|
||||||
value = ((Number)var12).longValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isString()) {
|
|
||||||
value = jsonPrimitive.getAsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jsonPrimitive.isJsonNull()) {
|
|
||||||
value = getJsonFieldNull(columnName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String databaseColumnName = getDBColumnName(modelClass, columnName, validateColumn);
|
|
||||||
if (value == null) {
|
|
||||||
Annotation[] annotations = ReflectUtil.getField(modelClass, columnName).getDeclaredAnnotations();
|
|
||||||
if (ArrayUtil.isNotEmpty(annotations)) {
|
|
||||||
for(Annotation annotation : Arrays.asList(annotations)) {
|
|
||||||
if (annotation.annotationType().equals(JsonSerialize.class) && ((JsonSerialize)annotation).using().equals(GuidStringSerialize.class)) {
|
|
||||||
value = "00000000-0000-0000-0000-000000000000";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (condition.equalsIgnoreCase("contains")) {
|
|
||||||
queryWrapper.like(databaseColumnName, value);
|
|
||||||
} else if (condition.equalsIgnoreCase("notcontains")) {
|
|
||||||
queryWrapper.notLike(databaseColumnName, value);
|
|
||||||
} else if (condition.equalsIgnoreCase("startswith")) {
|
|
||||||
queryWrapper.likeRight(databaseColumnName, value);
|
|
||||||
} else if (condition.equalsIgnoreCase("endswith")) {
|
|
||||||
queryWrapper.likeLeft(databaseColumnName, value);
|
|
||||||
} else if (condition.equalsIgnoreCase("=")) {
|
|
||||||
if (value == null) {
|
|
||||||
queryWrapper.isNull(databaseColumnName);
|
|
||||||
} else {
|
|
||||||
queryWrapper.eq(databaseColumnName, value);
|
|
||||||
}
|
|
||||||
} else if (condition.equalsIgnoreCase("!=")) {
|
|
||||||
queryWrapper.ne(databaseColumnName, value);
|
|
||||||
} else if (condition.equalsIgnoreCase("<>")) {
|
|
||||||
queryWrapper.ne(databaseColumnName, value);
|
|
||||||
} else if (condition.equalsIgnoreCase("<")) {
|
|
||||||
queryWrapper.lt(databaseColumnName, value);
|
|
||||||
} else if (condition.equalsIgnoreCase("<=")) {
|
|
||||||
queryWrapper.le(databaseColumnName, value);
|
|
||||||
} else if (condition.equalsIgnoreCase(">")) {
|
|
||||||
queryWrapper.gt(databaseColumnName, value);
|
|
||||||
} else if (condition.equalsIgnoreCase(">=")) {
|
|
||||||
queryWrapper.ge(databaseColumnName, value);
|
|
||||||
} else {
|
|
||||||
throwIfUnknownCondition(condition);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!jsonArray.get(0).isJsonArray()) {
|
|
||||||
throw new RuntimeException("Unknown data type in json array.");
|
|
||||||
}
|
|
||||||
|
|
||||||
parseArrayConditions(jsonArray, queryWrapper, modelClass, validateColumn);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> void parseArrayConditions(JsonArray jsonArray, QueryWrapper<T> queryWrapper, Map<String, String> fieldsMap, List<String> removeFields, Class modelClass, Boolean validateColumn) {
|
|
||||||
if (jsonArray.size() == 1) {
|
|
||||||
parseJArrayConditions(jsonArray.get(0).getAsJsonArray(), queryWrapper, fieldsMap, removeFields, modelClass, validateColumn);
|
|
||||||
} else {
|
|
||||||
for(int i = 0; i <= jsonArray.size(); i += 2) {
|
|
||||||
JsonElement jsonItem = jsonArray.get(i);
|
|
||||||
if (i == 0) {
|
|
||||||
if (jsonArray.get(0).getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
parseJArrayConditions(jsonArray.get(0).getAsJsonArray(), queryWrapper, fieldsMap, removeFields, modelClass, validateColumn);
|
|
||||||
} else if (jsonArray.get(0).getAsJsonArray().size() == 1) {
|
|
||||||
parseJArrayConditions(jsonArray.get(0).getAsJsonArray().get(0).getAsJsonArray(), queryWrapper, fieldsMap, removeFields, modelClass, validateColumn);
|
|
||||||
} else {
|
|
||||||
queryWrapper.and((wrapper) -> parseJArrayConditions(jsonArray.get(0).getAsJsonArray(), wrapper, fieldsMap, removeFields, modelClass, validateColumn));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
String condition = jsonArray.get(i - 1).getAsString();
|
|
||||||
if (condition.equals("and")) {
|
|
||||||
if (jsonItem.getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
parseJArrayConditions(jsonItem.getAsJsonArray(), queryWrapper, fieldsMap, removeFields, modelClass, validateColumn);
|
|
||||||
} else if (jsonArray.get(0).getAsJsonArray().size() == 1) {
|
|
||||||
parseJArrayConditions(jsonArray.get(0).getAsJsonArray().get(0).getAsJsonArray(), queryWrapper, fieldsMap, removeFields, modelClass, validateColumn);
|
|
||||||
} else {
|
|
||||||
queryWrapper.and((wrapper) -> parseJArrayConditions(jsonItem.getAsJsonArray(), wrapper, fieldsMap, removeFields, modelClass, validateColumn));
|
|
||||||
}
|
|
||||||
} else if (condition.equals("or")) {
|
|
||||||
if (jsonItem.getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
queryWrapper.or();
|
|
||||||
parseJArrayConditions(jsonItem.getAsJsonArray(), queryWrapper, fieldsMap, removeFields, modelClass, validateColumn);
|
|
||||||
} else if (jsonArray.get(0).getAsJsonArray().size() == 1) {
|
|
||||||
parseJArrayConditions(jsonArray.get(0).getAsJsonArray().get(0).getAsJsonArray(), queryWrapper, fieldsMap, removeFields, modelClass, validateColumn);
|
|
||||||
} else {
|
|
||||||
queryWrapper.or((wrapper) -> parseJArrayConditions(jsonItem.getAsJsonArray(), wrapper, fieldsMap, removeFields, modelClass, validateColumn));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throwIfUnknownCondition(condition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> void parseArrayConditions(JsonArray jsonArray, QueryWrapper<T> queryWrapper, Class modelClass, Boolean validateColumn) {
|
|
||||||
if (jsonArray.size() == 1) {
|
|
||||||
parseJArrayConditions(jsonArray.get(0).getAsJsonArray(), queryWrapper, modelClass, validateColumn);
|
|
||||||
} else {
|
|
||||||
for(int i = 0; i <= jsonArray.size(); i += 2) {
|
|
||||||
JsonElement jsonItem = jsonArray.get(i);
|
|
||||||
if (i == 0) {
|
|
||||||
if (jsonArray.get(0).getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
parseJArrayConditions(jsonArray.get(0).getAsJsonArray(), queryWrapper, modelClass, validateColumn);
|
|
||||||
} else {
|
|
||||||
queryWrapper.and((wrapper) -> parseJArrayConditions(jsonArray.get(0).getAsJsonArray(), wrapper, modelClass, validateColumn));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
String condition = jsonArray.get(i - 1).getAsString();
|
|
||||||
if (condition.equals("and")) {
|
|
||||||
if (jsonItem.getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
parseJArrayConditions(jsonItem.getAsJsonArray(), queryWrapper, modelClass, validateColumn);
|
|
||||||
} else {
|
|
||||||
queryWrapper.and((wrapper) -> parseJArrayConditions(jsonItem.getAsJsonArray(), wrapper, modelClass, validateColumn));
|
|
||||||
}
|
|
||||||
} else if (condition.equals("or")) {
|
|
||||||
if (jsonItem.getAsJsonArray().get(0).isJsonPrimitive()) {
|
|
||||||
queryWrapper.or();
|
|
||||||
parseJArrayConditions(jsonItem.getAsJsonArray(), queryWrapper, modelClass, validateColumn);
|
|
||||||
} else {
|
|
||||||
queryWrapper.or((wrapper) -> parseJArrayConditions(jsonItem.getAsJsonArray(), wrapper, modelClass, validateColumn));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throwIfUnknownCondition(condition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void throwIfUnknownCondition(String condition) {
|
|
||||||
switch (condition) {
|
|
||||||
case "=":
|
|
||||||
case "<>":
|
|
||||||
case "!=":
|
|
||||||
case "<":
|
|
||||||
case ">":
|
|
||||||
case "<=":
|
|
||||||
case ">=":
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException(String.format("Unknown condition %s", condition));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDBColumnName(Class modelClass, String cloumn) {
|
|
||||||
TableInfo tableInfo = TableInfoHelper.getTableInfo(modelClass);
|
|
||||||
if (cloumn.equals(tableInfo.getKeyProperty())) {
|
|
||||||
return tableInfo.getKeyColumn();
|
|
||||||
} else {
|
|
||||||
List<TableFieldInfo> fieldInfos = (List)tableInfo.getFieldList().stream().filter((tableFieldInfo) -> cloumn.equals(tableFieldInfo.getProperty())).collect(Collectors.toList());
|
|
||||||
if (CollectionUtil.isNotEmpty(fieldInfos)) {
|
|
||||||
return ((TableFieldInfo)fieldInfos.get(0)).getColumn();
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException(cloumn + "列找不到");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDBColumnName(Class modelClass, String cloumn, Boolean validateColumn) {
|
|
||||||
TableInfo tableInfo = TableInfoHelper.getTableInfo(modelClass);
|
|
||||||
if (cloumn.equals(tableInfo.getKeyProperty())) {
|
|
||||||
return tableInfo.getKeyColumn();
|
|
||||||
} else {
|
|
||||||
List<TableFieldInfo> fieldInfos = (List)tableInfo.getFieldList().stream().filter((tableFieldInfo) -> cloumn.equals(tableFieldInfo.getProperty())).collect(Collectors.toList());
|
|
||||||
if (CollectionUtil.isNotEmpty(fieldInfos)) {
|
|
||||||
return ((TableFieldInfo)fieldInfos.get(0)).getColumn();
|
|
||||||
} else if (validateColumn) {
|
|
||||||
throw new RuntimeException(cloumn + "列找不到");
|
|
||||||
} else {
|
|
||||||
return cloumn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDBTableName(Class modelClass) {
|
|
||||||
TableInfo tableInfo = TableInfoHelper.getTableInfo(modelClass);
|
|
||||||
return tableInfo.getTableName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toHyphenation(String src, String hyphenation) {
|
|
||||||
StringBuilder sb = new StringBuilder(src);
|
|
||||||
int cnt = 0;
|
|
||||||
|
|
||||||
for(int i = 1; i < src.length(); ++i) {
|
|
||||||
if (Character.isUpperCase(src.charAt(i))) {
|
|
||||||
sb.insert(i + cnt, hyphenation);
|
|
||||||
cnt += hyphenation.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString().toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toUnderline(String src) {
|
|
||||||
return toHyphenation(src, "_");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<String, FilterFieldMeta> groupConvertByFieldMeta(DataSourceRequest dataSourceRequest, Map<String, Map<String, ItemEntity>> groupItemMapping) {
|
|
||||||
if (dataSourceRequest.getFilter() != null) {
|
|
||||||
Map<String, FilterFieldMeta> result = new HashMap();
|
|
||||||
if (groupItemMapping.size() == 1) {
|
|
||||||
String group = (String)groupItemMapping.keySet().toArray()[0];
|
|
||||||
FilterFieldMeta filterFieldMeta = new FilterFieldMeta(dataSourceRequest.getFilter(), (Map)groupItemMapping.get(group));
|
|
||||||
constructOrderByFieldMeta(dataSourceRequest.getSort(), filterFieldMeta);
|
|
||||||
result.put(group, filterFieldMeta);
|
|
||||||
} else {
|
|
||||||
groupItemMapping.forEach((key, value) -> {
|
|
||||||
FilterFieldMeta filterFieldMeta = constructFilterFieldMeta(dataSourceRequest.getFilter(), value);
|
|
||||||
constructOrderByFieldMeta(dataSourceRequest.getSort(), filterFieldMeta);
|
|
||||||
result.put(key, filterFieldMeta);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static FilterFieldMeta constructOrderByFieldMeta(List<DataSourceRequest.SortDescriptor> sortDescriptors, FilterFieldMeta filterFieldMeta) {
|
|
||||||
if (CollectionUtil.isNotEmpty(sortDescriptors)) {
|
|
||||||
List<OrderBy> orderByList = new ArrayList();
|
|
||||||
|
|
||||||
for(DataSourceRequest.SortDescriptor sortDescriptor : sortDescriptors) {
|
|
||||||
if (filterFieldMeta.getFieldMeta().containsKey(sortDescriptor.getField())) {
|
|
||||||
OrderBy orderBy = new OrderBy(sortDescriptor.getField(), sortDescriptor.getDir());
|
|
||||||
orderByList.add(orderBy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(orderByList)) {
|
|
||||||
filterFieldMeta.setOrderByList(orderByList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return filterFieldMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static FilterFieldMeta constructFilterFieldMeta(DataSourceRequest.FilterDescriptor filter, Map<String, ItemEntity> fieldMeta) {
|
|
||||||
DataSourceRequest.FilterDescriptor groupFilter = new DataSourceRequest.FilterDescriptor();
|
|
||||||
constructGroupFilter(filter, groupFilter, fieldMeta);
|
|
||||||
deleteEmptyNode(groupFilter);
|
|
||||||
FilterFieldMeta result = new FilterFieldMeta(groupFilter, fieldMeta);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Boolean deleteEmptyNode(DataSourceRequest.FilterDescriptor groupFilter) {
|
|
||||||
if (groupFilter != null) {
|
|
||||||
List<DataSourceRequest.FilterDescriptor> filterDescriptors = groupFilter.getFilters();
|
|
||||||
if (StrUtil.isEmpty(groupFilter.getField()) && StrUtil.isEmpty(groupFilter.getOperator()) && CollectionUtil.isNotEmpty(filterDescriptors)) {
|
|
||||||
Iterator<DataSourceRequest.FilterDescriptor> iterator = filterDescriptors.iterator();
|
|
||||||
|
|
||||||
while(iterator.hasNext()) {
|
|
||||||
if (deleteEmptyNode((DataSourceRequest.FilterDescriptor)iterator.next())) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrUtil.isEmpty(groupFilter.getField()) && StrUtil.isEmpty(groupFilter.getOperator()) && CollectionUtil.isEmpty(filterDescriptors)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void constructGroupFilter(DataSourceRequest.FilterDescriptor filter, DataSourceRequest.FilterDescriptor groupFilter, Map<String, ItemEntity> fieldMeta) {
|
|
||||||
if (filter != null) {
|
|
||||||
List<DataSourceRequest.FilterDescriptor> filters = filter.getFilters();
|
|
||||||
if (CollectionUtil.isNotEmpty(filters)) {
|
|
||||||
groupFilter.setLogic(filter.getLogic());
|
|
||||||
|
|
||||||
for(DataSourceRequest.FilterDescriptor entry : filters) {
|
|
||||||
if (CollectionUtil.isNotEmpty(entry.getFilters())) {
|
|
||||||
DataSourceRequest.FilterDescriptor nodeFilter = new DataSourceRequest.FilterDescriptor();
|
|
||||||
nodeFilter.setLogic(entry.getLogic());
|
|
||||||
groupFilter.getFilters().add(nodeFilter);
|
|
||||||
constructGroupFilter(entry, nodeFilter, fieldMeta);
|
|
||||||
} else if (null != fieldMeta.get(entry.getField())) {
|
|
||||||
DataSourceRequest.FilterDescriptor nodeFilter = new DataSourceRequest.FilterDescriptor();
|
|
||||||
nodeFilter.setLogic(entry.getLogic());
|
|
||||||
nodeFilter.setField(entry.getField());
|
|
||||||
nodeFilter.setOperator(entry.getOperator());
|
|
||||||
nodeFilter.setValue(entry.getValue());
|
|
||||||
nodeFilter.setDataType(entry.getDataType());
|
|
||||||
groupFilter.getFilters().add(nodeFilter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static {
|
|
||||||
FIELDNULL.add("parentId");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.yfd.platform.common.DataSourceLoadOptionsBase;
|
import com.zny.dec.framework.kendo.entity.dto.devextreme.DataSourceLoadOptionsBase;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
|||||||
@ -40,7 +40,7 @@ swagger-ui:
|
|||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
# mapper-locations: classpath*:**/mapper/*Mapper.xml,classpath*:**/mapping/*Mapper.xml
|
mapper-locations: classpath*:**/mapper/*Mapper.xml,classpath*:**/mapping/*Mapper.xml
|
||||||
global-config:
|
global-config:
|
||||||
banner: false
|
banner: false
|
||||||
db-config:
|
db-config:
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<SidePanelItem title="典型设施介绍">
|
<SidePanelItem title="典型设施介绍">
|
||||||
<div v-if="carouselData.length > 0" class="carousel-wrapper">
|
<div v-if="carouselData.length > 0" class="carousel-wrapper">
|
||||||
<a-carousel v-model:current="currentIndex" autoplay class="tech-carousel" :dot-style="{ bottom: '0px' }">
|
<a-carousel v-model:current="currentIndex" class="tech-carousel" :dot-style="{ bottom: '0px' }">
|
||||||
<!-- -->
|
<!-- autoplay -->
|
||||||
<div v-for="(item, index) in carouselData" :key="index" class="carousel-item">
|
<div v-for="(item, index) in carouselData" :key="index" class="carousel-item">
|
||||||
<div class="image-container">
|
<div class="image-container">
|
||||||
<img :src="item.image" :alt="item.title" class="carousel-image" />
|
<img :src="item.image" :alt="item.title" class="carousel-image" />
|
||||||
@ -66,9 +66,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.carousel-wrapper {
|
.carousel-wrapper {
|
||||||
width: 414px;
|
|
||||||
:deep(.slick-slide) {
|
:deep(.slick-slide) {
|
||||||
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
height: 250px;
|
height: 250px;
|
||||||
line-height: 160px;
|
line-height: 160px;
|
||||||
|
|||||||
@ -1,163 +0,0 @@
|
|||||||
<!-- SidePanelItem.vue -->
|
|
||||||
<template>
|
|
||||||
<SidePanelItem title="设施类型及接入情况">
|
|
||||||
<div class="card-container">
|
|
||||||
<div v-for="(item, index) in dataJson" class="facility-card">
|
|
||||||
<div class="img_icon">
|
|
||||||
<i class="icon iconfont" :class="item?.icon" />
|
|
||||||
</div>
|
|
||||||
<div class="img_text">
|
|
||||||
<div>{{ item.nameString }}</div>
|
|
||||||
<div class="text_num">{{ item.total + item.zj }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <a-card v-for="(item, index) in dataJson" :key="index" class="facility-card" type="inner" size="small"
|
|
||||||
@click="handleCardClick(item)">
|
|
||||||
<template #title>
|
|
||||||
<i class="icon iconfont" :class="item?.icon" style="
|
|
||||||
display: block;
|
|
||||||
margin: 0 auto;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border-radius: 40px;
|
|
||||||
background-color: #5389B5;
|
|
||||||
line-height: 40px;
|
|
||||||
color: #FFFFFF;
|
|
||||||
" />
|
|
||||||
</template>
|
|
||||||
<a-tooltip>
|
|
||||||
<div style="font-size: 14px; color: #333">{{ item.nameString }}</div>
|
|
||||||
<div style="padding: 4px 0" class="showNum">
|
|
||||||
<span>{{ item.total + item.zj }}</span>
|
|
||||||
</div>
|
|
||||||
</a-tooltip>
|
|
||||||
</a-card> -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div v-else>
|
|
||||||
<a-empty />
|
|
||||||
</div> -->
|
|
||||||
</SidePanelItem>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, onMounted } from 'vue';
|
|
||||||
import SidePanelItem from '@/components/SidePanelItem/index.vue';
|
|
||||||
|
|
||||||
// 定义组件名(便于调试和递归)
|
|
||||||
defineOptions({
|
|
||||||
name: 'diwenshuijianhuansheshileixingzuchengjijieruqingkuang'
|
|
||||||
});
|
|
||||||
|
|
||||||
// 数据类型定义
|
|
||||||
interface DataString {
|
|
||||||
icon?: string;
|
|
||||||
nameString: string;
|
|
||||||
num?: number;
|
|
||||||
total: number;
|
|
||||||
zj: number;
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 响应式数据
|
|
||||||
const dataJson = ref<DataString[]>([
|
|
||||||
{
|
|
||||||
icon: 'icon-dwsjhDieliangmen',
|
|
||||||
nameString: '叠梁门',
|
|
||||||
num: 18,
|
|
||||||
total: 18,
|
|
||||||
zj: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: 'icon-dwsjhQianzhidangqiang',
|
|
||||||
nameString: '前置挡墙',
|
|
||||||
num: 4,
|
|
||||||
total: 4,
|
|
||||||
zj: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: 'icon-dwsjhGeshuimuqiang',
|
|
||||||
nameString: '隔水幕墙',
|
|
||||||
num: 1,
|
|
||||||
total: 1,
|
|
||||||
zj: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: 'icon-dwsjhQita',
|
|
||||||
nameString: '其他',
|
|
||||||
num: 1,
|
|
||||||
total: 1,
|
|
||||||
zj: 0
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
const clickList = ref<DataString | null>(null);
|
|
||||||
const res = ref({
|
|
||||||
bldstt: '',
|
|
||||||
hydrodtin: ''
|
|
||||||
});
|
|
||||||
|
|
||||||
// 卡片点击事件处理
|
|
||||||
const handleCardClick = (item: DataString) => {
|
|
||||||
clickList.value = item;
|
|
||||||
// dialog.current?.open() - 需要根据实际的对话框实现调整
|
|
||||||
res.value = {
|
|
||||||
bldstt: '',
|
|
||||||
hydrodtin: ''
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// 页面加载时执行的逻辑
|
|
||||||
onMounted(() => {
|
|
||||||
// 可以在这里加载实际的图片数据
|
|
||||||
// loadData();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.card-container {
|
|
||||||
width: 406px;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
overflow-x: auto;
|
|
||||||
justify-content: space-between;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
.facility-card {
|
|
||||||
width: 95.5px;
|
|
||||||
height: 158px;
|
|
||||||
border: 1px solid rgb(229, 236, 245);
|
|
||||||
border-radius: 2px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.img_icon {
|
|
||||||
margin-top: 25px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border-radius: 40px;
|
|
||||||
background-color: rgb(83, 137, 181);
|
|
||||||
line-height: 40px;
|
|
||||||
color: rgb(255, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
.img_text {
|
|
||||||
margin-top: 20px;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #333;
|
|
||||||
.text_num{
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 3px;
|
|
||||||
text-align: center;
|
|
||||||
// font-size: 16px;
|
|
||||||
color: #2f6b98;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,237 +0,0 @@
|
|||||||
<!-- NEW_FILE_CODE -->
|
|
||||||
<template>
|
|
||||||
<SidePanelItem title="月平均水温历史对比">
|
|
||||||
<div>
|
|
||||||
<div class="water-temp-compare-chart" ref="chartRef"></div>
|
|
||||||
</div>
|
|
||||||
<!-- <div v-else>
|
|
||||||
<a-empty />
|
|
||||||
</div> -->
|
|
||||||
</SidePanelItem>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
|
||||||
import * as echarts from 'echarts'
|
|
||||||
import SidePanelItem from '@/components/SidePanelItem/index.vue';
|
|
||||||
defineOptions({
|
|
||||||
name: 'monthlyAvgWaterTemCompareHistory'
|
|
||||||
});
|
|
||||||
const chartRef = ref<HTMLElement | null>(null)
|
|
||||||
let chartInstance: echarts.ECharts | null = null
|
|
||||||
|
|
||||||
const unit = '°C'
|
|
||||||
|
|
||||||
const initChart = () => {
|
|
||||||
if (!chartRef.value) return
|
|
||||||
|
|
||||||
chartInstance = echarts.init(chartRef.value)
|
|
||||||
|
|
||||||
const legendData = ['实测值', '去年同期', '天然']
|
|
||||||
|
|
||||||
// x轴数据 - 保持与原始配置一致的结构 { value, stnm }
|
|
||||||
const xData = [
|
|
||||||
{ value: '两河口', stnm: '两河口' },
|
|
||||||
{ value: '锦屏一级', stnm: '锦屏一级' },
|
|
||||||
{ value: '桐子林', stnm: '桐子林' }
|
|
||||||
]
|
|
||||||
|
|
||||||
// 根据图片数据提取的静态数据
|
|
||||||
const actualData = [9, 11.5, 14] // 实测值(蓝色线)
|
|
||||||
const lastData = [8.8, 10.5, 13.2] // 去年同期(紫色线)
|
|
||||||
const naturalData = [9.2, 12, 15.5] // 天然(绿色线)
|
|
||||||
|
|
||||||
// 计算Y轴范围:最小值向下取整,最大值向上取整
|
|
||||||
const allData = [...actualData, ...lastData, ...naturalData].filter(val => val !== null && val !== undefined)
|
|
||||||
const dataMin = Math.min(...allData)
|
|
||||||
const dataMax = Math.max(...allData)
|
|
||||||
const yAxisMin = Math.floor(dataMin)
|
|
||||||
const yAxisMax = Math.ceil(dataMax)
|
|
||||||
|
|
||||||
// 完全按照原始React代码中的options配置
|
|
||||||
const options: any = {
|
|
||||||
noShowToolbox: true,
|
|
||||||
yAxisSplit: 5,
|
|
||||||
xData,
|
|
||||||
dataZoom: [
|
|
||||||
{
|
|
||||||
type: 'inside',
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'slider',
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
tooltip: {
|
|
||||||
show: true,
|
|
||||||
trigger: 'axis',
|
|
||||||
confine: true,
|
|
||||||
formatter: (params: any) => {
|
|
||||||
const label = xData.filter((item: any) => item.value === params[0].axisValueLabel)?.[0]?.stnm
|
|
||||||
let elm = ``
|
|
||||||
for (const item of params) {
|
|
||||||
elm += `
|
|
||||||
<div>
|
|
||||||
${item.marker}
|
|
||||||
<span>${item.seriesName}:</span>
|
|
||||||
<span>${item.value === null || item.value === undefined ? '-' : item.value}${unit}</span>
|
|
||||||
</div>
|
|
||||||
`
|
|
||||||
}
|
|
||||||
return `<div>${label}</div>` + elm
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: legendData
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
top: 30,
|
|
||||||
bottom: 50,
|
|
||||||
right: 15,
|
|
||||||
left: 30
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
axisPointer: {
|
|
||||||
type: 'shadow',
|
|
||||||
lineStyle: {
|
|
||||||
color: '#007aff1a',
|
|
||||||
width: 1,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#8f8f8f'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
axisLabel: {
|
|
||||||
color: '#000000',
|
|
||||||
fontSize: 12,
|
|
||||||
interval: xData.length < 5 ? 0 : 2,
|
|
||||||
rotate: 0,
|
|
||||||
formatter: (value: any) => {
|
|
||||||
const label = xData.filter((item: any) => item.value === value)?.[0]?.stnm
|
|
||||||
return `{a|${label.substring(0, 6)}}` + (label.length > 6 ? '...\n{b|}' : '\n{b|}')
|
|
||||||
},
|
|
||||||
rich: {
|
|
||||||
a: {
|
|
||||||
height: 30,
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
b: {
|
|
||||||
height: 30,
|
|
||||||
align: 'center'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: xData,
|
|
||||||
splitLine: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
yAxis: [
|
|
||||||
{
|
|
||||||
type: 'value',
|
|
||||||
name: `水温(${unit})`,
|
|
||||||
min: yAxisMin,
|
|
||||||
max: yAxisMax,
|
|
||||||
nameTextStyle: {
|
|
||||||
fontSize: 12,
|
|
||||||
color: '#000000'
|
|
||||||
},
|
|
||||||
lineStyle: {
|
|
||||||
color: '#6ca4f7',
|
|
||||||
width: 2
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#bfbfbf'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: true,
|
|
||||||
length: 3,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#8f8f8f'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisLabel: {
|
|
||||||
color: '#333',
|
|
||||||
fontSize: 12
|
|
||||||
},
|
|
||||||
splitLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#bfbfbf',
|
|
||||||
type: 'solid'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: legendData[0],
|
|
||||||
data: actualData,
|
|
||||||
type: 'line',
|
|
||||||
connectNulls: true,
|
|
||||||
smooth: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: legendData[1],
|
|
||||||
data: lastData,
|
|
||||||
type: 'line',
|
|
||||||
connectNulls: true,
|
|
||||||
smooth: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: legendData[2],
|
|
||||||
data: naturalData,
|
|
||||||
type: 'line',
|
|
||||||
connectNulls: true,
|
|
||||||
smooth: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
// 颜色配置 - 对应 getColorByCodeAndType(['Other'], ['ACTUALTEMP', 'LASTTEMP', 'NATURALTEMP'])
|
|
||||||
// 根据图片:实测值(蓝)、去年同期(紫)、天然(绿)
|
|
||||||
options.color = ['#5470c6', '#9b59b6', '#91cc75']
|
|
||||||
|
|
||||||
chartInstance.setOption(options)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
// 延迟初始化,确保容器尺寸已就绪
|
|
||||||
setTimeout(() => {
|
|
||||||
initChart()
|
|
||||||
// 初始化完成后再次调用 resize 确保尺寸正确
|
|
||||||
chartInstance?.resize()
|
|
||||||
}, 100)
|
|
||||||
|
|
||||||
window.addEventListener('resize', () => {
|
|
||||||
chartInstance?.resize()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
|
||||||
chartInstance?.dispose()
|
|
||||||
window.removeEventListener('resize', () => {
|
|
||||||
chartInstance?.resize()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.water-temp-compare-chart {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
height: 260px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,130 +0,0 @@
|
|||||||
<!-- SidePanelItem.vue -->
|
|
||||||
<template>
|
|
||||||
<SidePanelItem title="设施类型介绍">
|
|
||||||
<div v-if="carouselData.length > 0" class="carousel-wrapper">
|
|
||||||
<a-carousel v-model:current="currentIndex" autoplay class="tech-carousel" :dot-style="{ bottom: '0px' }">
|
|
||||||
<!-- -->
|
|
||||||
<div v-for="(item, index) in carouselData" :key="index" class="carousel-item">
|
|
||||||
<div class="image-container">
|
|
||||||
<img :src="item.image" :alt="item.title" class="carousel-image" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a-carousel>
|
|
||||||
|
|
||||||
<!-- 文字描述区域 -->
|
|
||||||
<div v-if="carouselData[currentIndex]" class="description-container">
|
|
||||||
<p class="item-description">{{ carouselData[currentIndex].description }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<a-empty />
|
|
||||||
</div>
|
|
||||||
</SidePanelItem>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, onMounted } from 'vue';
|
|
||||||
import SidePanelItem from '@/components/SidePanelItem/index.vue';
|
|
||||||
|
|
||||||
// 定义组件名(便于调试和递归)
|
|
||||||
defineOptions({
|
|
||||||
name: 'diwenshuijianhuansheshileixingzuchengjijieruqingkuang'
|
|
||||||
});
|
|
||||||
|
|
||||||
// 当前轮播索引
|
|
||||||
const currentIndex = ref(0);
|
|
||||||
|
|
||||||
// 轮播图数据
|
|
||||||
const carouselData = ref([
|
|
||||||
{
|
|
||||||
title: '叠梁门',
|
|
||||||
description: '叠梁门是一种用于调节水库流量和控制水位的设施。在低温季节,可以通过控制叠梁门的开闭程度来调节流量,减少低温水体的进...',
|
|
||||||
image: 'https://img.shetu66.com/2024/02/19/170835076078361368.png' // 替换为实际图片路径
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '环保设施',
|
|
||||||
description: '现代化环保设施,采用先进技术,有效处理工业废水废气,实现达标排放,保护生态环境...',
|
|
||||||
image: 'https://img.shetu66.com/2024/02/19/170835076078361368.png'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '智能监控',
|
|
||||||
description: '24 小时智能监控系统,实时监测设备运行状态,确保设施安全稳定运行...',
|
|
||||||
image: 'https://img.shetu66.com/2024/02/19/170835076078361368.png'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '水处理系统',
|
|
||||||
description: '高效水处理系统,通过多级过滤和生物处理,实现水资源循环利用...',
|
|
||||||
image: 'https://img.shetu66.com/2024/02/19/170835076078361368.png'
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
// 页面加载时执行的逻辑
|
|
||||||
onMounted(() => {
|
|
||||||
// 可以在这里加载实际的图片数据
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.carousel-wrapper {
|
|
||||||
width: 414px;
|
|
||||||
:deep(.slick-slide) {
|
|
||||||
|
|
||||||
text-align: center;
|
|
||||||
height: 250px;
|
|
||||||
line-height: 160px;
|
|
||||||
background: #364d79;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep() {
|
|
||||||
.ant-carousel .slick-dots li {
|
|
||||||
width: 5px !important;
|
|
||||||
height: 5px !important;
|
|
||||||
border-radius: 50% !important;
|
|
||||||
background-color: #888e95;
|
|
||||||
|
|
||||||
}
|
|
||||||
.ant-carousel .slick-dots li button{
|
|
||||||
width: 5px !important;
|
|
||||||
height: 5px !important;
|
|
||||||
border-radius: 50% !important;
|
|
||||||
background-color: #888e95;
|
|
||||||
}
|
|
||||||
.ant-carousel .slick-dots li.slick-active{
|
|
||||||
background-color: #005293 !important;
|
|
||||||
}
|
|
||||||
.ant-carousel .slick-dots li.slick-active button{
|
|
||||||
background-color: #005293 !important;
|
|
||||||
}
|
|
||||||
.ant-carousel .slick-dots li :hover {
|
|
||||||
width: 5px !important;
|
|
||||||
height: 5px !important;
|
|
||||||
border-radius: 50% !important;
|
|
||||||
background-color: #ffffffcc;
|
|
||||||
|
|
||||||
}
|
|
||||||
.ant-carousel .slick-dots li button :hover{
|
|
||||||
width: 5px !important;
|
|
||||||
height: 5px !important;
|
|
||||||
border-radius: 50% !important;
|
|
||||||
background-color: #ffffffcc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.description-container {
|
|
||||||
height: 44px;
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 6px;
|
|
||||||
line-height: 22px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
word-break: break-all;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
text-indent: 0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,249 +0,0 @@
|
|||||||
<template>
|
|
||||||
<SidePanelItem title="水温年内分布">
|
|
||||||
<div class="water-temp-chart-container">
|
|
||||||
<div ref="chartRef" class="chart-wrapper"></div>
|
|
||||||
</div>
|
|
||||||
<!-- <div v-else>
|
|
||||||
<a-empty />
|
|
||||||
</div> -->
|
|
||||||
</SidePanelItem>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
|
|
||||||
import * as echarts from 'echarts'
|
|
||||||
import SidePanelItem from '@/components/SidePanelItem/index.vue';
|
|
||||||
const data = [
|
|
||||||
{ monthInt: 1, actualTemp: 0.9, naturalTemp: 0 },
|
|
||||||
{ monthInt: 2, actualTemp: 0.9, naturalTemp: 0.1 },
|
|
||||||
{ monthInt: 3, actualTemp: 1.0, naturalTemp: 2.0 }
|
|
||||||
]
|
|
||||||
|
|
||||||
const chartRef = ref<HTMLElement | null>(null)
|
|
||||||
let chartInstance: echarts.ECharts | null = null
|
|
||||||
|
|
||||||
const transUnit = (value: number | null, code: string, type: string) => {
|
|
||||||
if (value === null) return null
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
const getUnitConfigByCode = (code: string, type: string) => {
|
|
||||||
return {
|
|
||||||
unit: '℃'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getColorByCodeAndType = (code: string[], typeKey: string[]) => {
|
|
||||||
return ['#4b79ab', '#78c300']
|
|
||||||
}
|
|
||||||
|
|
||||||
const getChartOption = () => {
|
|
||||||
const { unit } = getUnitConfigByCode('Other', 'ACTUALTEMP')
|
|
||||||
const legendData = ['实测值', '天然']
|
|
||||||
const xData: string[] = []
|
|
||||||
const actualData: (number | null)[] = []
|
|
||||||
const naturalData: (number | null)[] = []
|
|
||||||
|
|
||||||
data.forEach((item: any) => {
|
|
||||||
xData.push(`${item.monthInt}月`)
|
|
||||||
actualData.push(item.actualTemp === null ? null : transUnit(item.actualTemp, 'Other', 'ACTUALTEMP'))
|
|
||||||
naturalData.push(item.naturalTemp === null ? null : transUnit(item.naturalTemp, 'Other', 'NATURALTEMP'))
|
|
||||||
})
|
|
||||||
|
|
||||||
const code = ['Other']
|
|
||||||
const typeKey = ['ACTUALTEMP', 'NATURALTEMP']
|
|
||||||
const colors = getColorByCodeAndType(code, typeKey)
|
|
||||||
|
|
||||||
const options: any = {
|
|
||||||
color: colors,
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
backgroundColor: 'rgba(51, 51, 51, 0.9)',
|
|
||||||
borderColor: 'transparent',
|
|
||||||
textStyle: {
|
|
||||||
color: '#ffffff',
|
|
||||||
fontSize: 14
|
|
||||||
},
|
|
||||||
formatter: function(params) {
|
|
||||||
if (!params || params.length === 0) return '';
|
|
||||||
let result = `<div style="font-weight: bold; margin-bottom: 8px;">${params[0].axisValue}</div>`;
|
|
||||||
params.forEach(item => {
|
|
||||||
result += `<div style="display: flex; align-items: center; margin: 4px 0;">`;
|
|
||||||
result += `<span style="display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: ${item.color}; margin-right: 8px;"></span>`;
|
|
||||||
result += `<span>${item.seriesName} ${item.value}${unit}</span>`;
|
|
||||||
result += `</div>`;
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
boundaryGap: true,
|
|
||||||
axisPointer: {
|
|
||||||
type: 'shadow',
|
|
||||||
shadowStyle: {
|
|
||||||
color: '#007aff1a'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#8f8f8f'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
splitLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#bfbfbf',
|
|
||||||
type: 'solid'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisLabel: {
|
|
||||||
interval: 0,
|
|
||||||
color: '#000000',
|
|
||||||
fontSize: 12,
|
|
||||||
rotate: 0,
|
|
||||||
margin: 8,
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
data: xData
|
|
||||||
},
|
|
||||||
yAxis: [
|
|
||||||
{
|
|
||||||
name: '水温(℃)',
|
|
||||||
type: 'value',
|
|
||||||
splitNumber: 5,
|
|
||||||
nameTextStyle: {
|
|
||||||
fontSize: 12,
|
|
||||||
color: '#000000'
|
|
||||||
},
|
|
||||||
lineStyle: {
|
|
||||||
color: '#6ca4f7',
|
|
||||||
width: 2
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000000'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: true,
|
|
||||||
length: 3,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000000'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisLabel: {
|
|
||||||
color: '#333',
|
|
||||||
fontSize: 12
|
|
||||||
},
|
|
||||||
splitLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#bfbfbf',
|
|
||||||
type: 'solid'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
legend: {
|
|
||||||
data: legendData
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
top: 30,
|
|
||||||
bottom: 50,
|
|
||||||
right: 15,
|
|
||||||
left: 30
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: legendData[0],
|
|
||||||
data: actualData,
|
|
||||||
connectNulls: true,
|
|
||||||
smooth: true,
|
|
||||||
type: 'line',
|
|
||||||
itemStyle: {
|
|
||||||
color: colors[0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: legendData[1],
|
|
||||||
data: naturalData,
|
|
||||||
connectNulls: true,
|
|
||||||
smooth: true,
|
|
||||||
type: 'line',
|
|
||||||
itemStyle: {
|
|
||||||
color: colors[1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
return options
|
|
||||||
}
|
|
||||||
|
|
||||||
const initChart = async () => {
|
|
||||||
// 延迟初始化,确保容器已完成渲染
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 100))
|
|
||||||
|
|
||||||
if (!chartRef.value) {
|
|
||||||
console.error('图表容器未找到')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (!chartInstance) {
|
|
||||||
chartInstance = echarts.init(chartRef.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
const option = getChartOption()
|
|
||||||
chartInstance.setOption(option, false)
|
|
||||||
|
|
||||||
// 强制重绘,确保图表尺寸正确
|
|
||||||
setTimeout(() => {
|
|
||||||
chartInstance?.resize()
|
|
||||||
}, 100)
|
|
||||||
|
|
||||||
window.addEventListener('resize', handleResize)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('图表初始化失败:', error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleResize = () => {
|
|
||||||
if (chartInstance) {
|
|
||||||
chartInstance.resize()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
initChart()
|
|
||||||
})
|
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
|
||||||
window.removeEventListener('resize', handleResize)
|
|
||||||
if (chartInstance) {
|
|
||||||
chartInstance.dispose()
|
|
||||||
chartInstance = null
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.water-temp-chart-container {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
min-height: 290px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart-wrapper {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
min-height: 290px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,112 +0,0 @@
|
|||||||
<!-- SidePanelItem.vue -->
|
|
||||||
<template>
|
|
||||||
<SidePanelItem title="环保设施情况">
|
|
||||||
<div class="facility-grid" >
|
|
||||||
<div v-for="facility in facilities" :key="facility.name" class="facility-card">
|
|
||||||
<div style="width: 60px;height: 62px;display: flex;align-items: center;justify-content: center;">
|
|
||||||
<div class="facility-icon">
|
|
||||||
<i style="color: #fff;" :class="facility.icon" type="icon-shengtailiuliang2"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="facility-info">
|
|
||||||
<div class="facility-name">{{ facility.name }}</div>
|
|
||||||
<div style="font-size: 16px;"> <span class="facility-count">{{ facility.count }}</span><span>个</span></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</SidePanelItem>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, onMounted } from 'vue';
|
|
||||||
import SidePanelItem from '@/components/SidePanelItem/index.vue';
|
|
||||||
|
|
||||||
// 定义组件名(便于调试和递归)
|
|
||||||
defineOptions({
|
|
||||||
name: 'shuizhijiancegongzuoQK'
|
|
||||||
});
|
|
||||||
|
|
||||||
// 设施数据
|
|
||||||
const facilities = ref([
|
|
||||||
{
|
|
||||||
name: '自建水质站',
|
|
||||||
count: 56,
|
|
||||||
icon: 'icon iconfont icon-qixidi'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '国家水质站',
|
|
||||||
count: 1722,
|
|
||||||
icon: 'icon iconfont icon-diwenshuijianhuan'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '人工水质监测断面',
|
|
||||||
count: 135,
|
|
||||||
icon: 'icon iconfont icon-shuiwen-line'
|
|
||||||
},
|
|
||||||
|
|
||||||
]);
|
|
||||||
|
|
||||||
// 页面加载时执行的逻辑
|
|
||||||
onMounted(() => {
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.facility-grid {
|
|
||||||
width: 406px;
|
|
||||||
flex-flow: wrap;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
|
|
||||||
}
|
|
||||||
|
|
||||||
.facility-card {
|
|
||||||
width: 200px;
|
|
||||||
height: 70px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin: 4px 0px;
|
|
||||||
background: #fff;
|
|
||||||
border: 1px solid #e8e8e8;
|
|
||||||
border-radius: 2px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
cursor: pointer;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.facility-icon {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
// margin-right: 8px;
|
|
||||||
background: #5389b5;
|
|
||||||
border-radius: 50%;
|
|
||||||
|
|
||||||
.anticon {
|
|
||||||
font-size: 24px;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.facility-info {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.facility-name {
|
|
||||||
font-size: 16px;
|
|
||||||
color: #333;
|
|
||||||
// margin-bottom: 4px;
|
|
||||||
// font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.facility-count {
|
|
||||||
font-size: 18px;
|
|
||||||
color: #2f6b98;
|
|
||||||
// font-weight: 600;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,21 +1,5 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import JidiSelectorMod from "@/modules/jidiSelectorMod.vue";
|
|
||||||
import RightDrawer from "@/components/RightDrawer/index.vue";
|
|
||||||
import DiWenSJHSSLXZCJJRQK from "@/modules/diwenshuijianhuansheshileixingzuchengjijieruqingkuang/index.vue"
|
|
||||||
import SheShiLeiXingJieShao from "@/modules/sheshileixingjieshao/index.vue"
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="moduleContent">
|
<div>
|
||||||
<div class="leftContent">
|
<h2>低温水减缓设施</h2>
|
||||||
<JidiSelectorMod />
|
|
||||||
</div>
|
|
||||||
<div class="rightContent">
|
|
||||||
<RightDrawer>
|
|
||||||
<SheShiLeiXingJieShao />
|
|
||||||
<DiWenSJHSSLXZCJJRQK />
|
|
||||||
</RightDrawer>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style scoped lang="scss"></style>
|
|
||||||
|
|||||||
@ -1,21 +1,5 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import JidiSelectorMod from "@/modules/jidiSelectorMod.vue";
|
|
||||||
import RightDrawer from "@/components/RightDrawer/index.vue";
|
|
||||||
import MonthlyAvgWaterTemCompareHistory from "@/modules/monthlyAvgWaterTemCompareHistory/index.vue"; // 月平均水温历史对比
|
|
||||||
import ShuiWenNianNeiFenBu from "@/modules/shuiWenNianNeiFenBu/index.vue"; // 水温年内分布
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="moduleContent">
|
<div>
|
||||||
<div class="leftContent">
|
<h2>水温分析</h2>
|
||||||
<JidiSelectorMod />
|
|
||||||
</div>
|
|
||||||
<div class="rightContent">
|
|
||||||
<RightDrawer>
|
|
||||||
<MonthlyAvgWaterTemCompareHistory />
|
|
||||||
<ShuiWenNianNeiFenBu />
|
|
||||||
</RightDrawer>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style scoped lang="scss"></style>
|
|
||||||
|
|||||||
@ -1,21 +1,5 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import JidiSelectorMod from "@/modules/jidiSelectorMod.vue";
|
|
||||||
import RightDrawer from "@/components/RightDrawer/index.vue";
|
|
||||||
import ShuiZhiJianCeGongZuoQingKuang from "@/modules/shuizhijiancegongzuoQK/index.vue"
|
|
||||||
// import EnvironmentalQuality from "@/modules/environmentalQuality/index.vue" // 环境质量满足度
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="moduleContent">
|
<div>
|
||||||
<div class="leftContent">
|
<h1>水质监测</h1>
|
||||||
<JidiSelectorMod />
|
|
||||||
</div>
|
|
||||||
<div class="rightContent">
|
|
||||||
<RightDrawer>
|
|
||||||
<ShuiZhiJianCeGongZuoQingKuang />
|
|
||||||
<!-- <EnvironmentalQuality /> -->
|
|
||||||
</RightDrawer>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style scoped lang="scss"></style>
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user