Skip to content

Commit 53dab2d

Browse files
authored
Merge pull request #221 from erupts/develop
1.12.8
2 parents fd074e5 + 0ce32fc commit 53dab2d

File tree

61 files changed

+176
-161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+176
-161
lines changed

erupt-admin/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<parent>
1010
<groupId>xyz.erupt</groupId>
1111
<artifactId>erupt</artifactId>
12-
<version>1.12.7</version>
12+
<version>1.12.8</version>
1313
<relativePath>../pom.xml</relativePath>
1414
</parent>
1515

erupt-annotation/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<groupId>xyz.erupt</groupId>
1313
<artifactId>erupt</artifactId>
14-
<version>1.12.7</version>
14+
<version>1.12.8</version>
1515
<relativePath>../pom.xml</relativePath>
1616
</parent>
1717
</project>

erupt-cloud/erupt-cloud-common/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<parent>
1010
<groupId>xyz.erupt</groupId>
1111
<artifactId>erupt</artifactId>
12-
<version>1.12.7</version>
12+
<version>1.12.8</version>
1313
<relativePath>../../pom.xml</relativePath>
1414
</parent>
1515

erupt-cloud/erupt-cloud-node-jpa/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<parent>
1010
<groupId>xyz.erupt</groupId>
1111
<artifactId>erupt</artifactId>
12-
<version>1.12.7</version>
12+
<version>1.12.8</version>
1313
<relativePath>../../pom.xml</relativePath>
1414
</parent>
1515

erupt-cloud/erupt-cloud-node/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<parent>
1010
<groupId>xyz.erupt</groupId>
1111
<artifactId>erupt</artifactId>
12-
<version>1.12.7</version>
12+
<version>1.12.8</version>
1313
<relativePath>../../pom.xml</relativePath>
1414
</parent>
1515

erupt-cloud/erupt-cloud-server/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<parent>
1010
<groupId>xyz.erupt</groupId>
1111
<artifactId>erupt</artifactId>
12-
<version>1.12.7</version>
12+
<version>1.12.8</version>
1313
<relativePath>../../pom.xml</relativePath>
1414
</parent>
1515

erupt-cloud/erupt-cloud-server/src/main/java/xyz/erupt/cloud/server/model/CloudNode.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.Getter;
44
import lombok.Setter;
5+
import lombok.extern.slf4j.Slf4j;
56
import org.hibernate.annotations.Type;
67
import org.springframework.stereotype.Component;
78
import xyz.erupt.annotation.Erupt;
@@ -43,10 +44,11 @@
4344
* @author YuePeng
4445
* date 2021/12/16 00:28
4546
*/
47+
@Slf4j
4648
@Getter
4749
@Setter
4850
@Entity
49-
@Table(name = "e_cloud_node", uniqueConstraints = @UniqueConstraint(columnNames = CloudNode.NODE_NAME))
51+
@Table(name = "e_cloud_node")
5052
@Erupt(
5153
name = "节点配置", dataProxy = CloudNode.class,
5254
rowOperation = @RowOperation(
@@ -67,6 +69,7 @@ public class CloudNode extends MetaModelUpdateVo implements DataProxy<CloudNode>
6769

6870
public static final String ACCESS_TOKEN = "accessToken";
6971

72+
@Column(unique = true)
7073
@EruptField(
7174
views = @View(title = "节点名", sortable = true),
7275
edit = @Edit(title = "节点名", desc = "NodeName", notNull = true, search = @Search(vague = true))
@@ -198,7 +201,7 @@ public void afterFetch(Collection<Map<String, Object>> list) {
198201
});
199202
} catch (Exception e) {
200203
map.put(version, String.format("<span style='color:#f00'>%s</span>", e.getMessage()));
201-
e.printStackTrace();
204+
log.warn("node warn → " + map.get(NODE_NAME), e);
202205
}
203206
}
204207
}

erupt-cloud/erupt-cloud-server/src/main/java/xyz/erupt/cloud/server/model/CloudNodeGroup.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
import xyz.erupt.annotation.sub_field.sub_edit.Search;
1515
import xyz.erupt.jpa.model.MetaModel;
1616

17-
import javax.persistence.*;
17+
import javax.persistence.Column;
18+
import javax.persistence.Entity;
19+
import javax.persistence.Lob;
20+
import javax.persistence.Table;
1821

1922
/**
2023
* @author YuePeng
@@ -23,11 +26,12 @@
2326
@Getter
2427
@Setter
2528
@Entity
26-
@Table(name = "e_cloud_node_group", uniqueConstraints = @UniqueConstraint(columnNames = "code"))
29+
@Table(name = "e_cloud_node_group")
2730
@Erupt(name = "分组配置")
2831
@EruptI18n
2932
public class CloudNodeGroup extends MetaModel {
3033

34+
@Column(unique = true)
3135
@EruptField(
3236
views = @View(title = "编码", sortable = true),
3337
edit = @Edit(title = "编码", notNull = true, search = @Search(vague = true))

erupt-core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<parent>
1111
<groupId>xyz.erupt</groupId>
1212
<artifactId>erupt</artifactId>
13-
<version>1.12.7</version>
13+
<version>1.12.8</version>
1414
<relativePath>../pom.xml</relativePath>
1515
</parent>
1616

erupt-core/src/main/java/xyz/erupt/core/config/GsonFactory.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.google.gson.*;
44
import xyz.erupt.core.util.DateUtil;
55

6+
import java.math.BigDecimal;
67
import java.time.LocalDate;
78
import java.time.LocalDateTime;
89
import java.time.format.DateTimeFormatter;
@@ -22,7 +23,9 @@ public class GsonFactory {
2223
-> LocalDateTime.parse(json.getAsJsonPrimitive().getAsString(), DateTimeFormatter.ofPattern(DateUtil.DATE_TIME)))
2324
.registerTypeAdapter(LocalDate.class, (JsonDeserializer<LocalDate>) (json, type, jsonDeserializationContext)
2425
-> LocalDate.parse(json.getAsJsonPrimitive().getAsString(), DateTimeFormatter.ofPattern(DateUtil.DATE)))
25-
.setLongSerializationPolicy(LongSerializationPolicy.STRING)
26+
.registerTypeAdapter(Long.class, (JsonSerializer<Long>) (src, type, jsonSerializationContext) -> new JsonPrimitive(src.toString()))
27+
.registerTypeAdapter(Double.class, (JsonSerializer<Double>) (src, type, jsonSerializationContext) -> new JsonPrimitive(src.toString()))
28+
.registerTypeAdapter(BigDecimal.class, (JsonSerializer<BigDecimal>) (src, type, jsonSerializationContext) -> new JsonPrimitive(src.toString()))
2629
.serializeNulls().setExclusionStrategies(new EruptGsonExclusionStrategies());
2730

2831
private static final Gson gson = gsonBuilder.create();

erupt-core/src/main/java/xyz/erupt/core/controller/EruptComponentController.java

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public List<Object> findAutoCompleteValue(@PathVariable("erupt") String eruptNam
4848
try {
4949
return EruptSpringUtil.getBean(autoCompleteType.handler()).completeHandler(formData, val, autoCompleteType.param());
5050
} catch (Exception e) {
51-
e.printStackTrace();
5251
throw new EruptApiErrorTip(e.getMessage(), EruptApiModel.PromptWay.MESSAGE);
5352
}
5453
}

erupt-core/src/main/java/xyz/erupt/core/controller/EruptFileController.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import lombok.Cleanup;
55
import lombok.RequiredArgsConstructor;
66
import lombok.SneakyThrows;
7+
import lombok.extern.slf4j.Slf4j;
78
import org.apache.commons.lang3.RandomStringUtils;
89
import org.springframework.http.HttpStatus;
910
import org.springframework.http.MediaType;
@@ -44,6 +45,7 @@
4445
* @author YuePeng
4546
* date 10/15/18.
4647
*/
48+
@Slf4j
4749
@RestController
4850
@RequestMapping(EruptRestPath.ERUPT_FILE)
4951
@RequiredArgsConstructor
@@ -134,7 +136,7 @@ public EruptApiModel upload(@PathVariable("erupt") String eruptName, @PathVariab
134136
}
135137
return EruptApiModel.successApi(path.replace("\\", "/"));
136138
} catch (Exception e) {
137-
e.printStackTrace();
139+
log.error("erupt upload error", e);
138140
return EruptApiModel.errorApi(I18nTranslate.$translate("erupt.upload_error") + " " + e.getMessage());
139141
}
140142
}

erupt-core/src/main/java/xyz/erupt/core/util/EruptInformation.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package xyz.erupt.core.util;
22

3+
import lombok.extern.slf4j.Slf4j;
4+
35
import java.io.IOException;
46
import java.io.InputStream;
57
import java.util.Properties;
@@ -8,6 +10,7 @@
810
* @author YuePeng
911
* date 2021/3/28 17:45
1012
*/
13+
@Slf4j
1114
public class EruptInformation {
1215

1316
private static Properties props;
@@ -19,7 +22,7 @@ public class EruptInformation {
1922
props.load(stream);
2023
EruptInformation.props = props;
2124
} catch (IOException e) {
22-
e.printStackTrace();
25+
log.warn("erupt-core.properties load error", e);
2326
}
2427
}
2528

erupt-core/src/main/java/xyz/erupt/core/util/EruptUtil.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.google.gson.JsonElement;
55
import com.google.gson.JsonObject;
66
import lombok.SneakyThrows;
7+
import lombok.extern.slf4j.Slf4j;
78
import org.apache.commons.lang3.StringUtils;
89
import org.apache.commons.lang3.math.NumberUtils;
910
import xyz.erupt.annotation.EruptField;
@@ -34,6 +35,7 @@
3435
import xyz.erupt.core.view.EruptModel;
3536

3637
import java.lang.reflect.Field;
38+
import java.math.BigDecimal;
3739
import java.time.LocalDate;
3840
import java.time.LocalDateTime;
3941
import java.util.*;
@@ -45,6 +47,7 @@
4547
* @author YuePeng
4648
* date 11/1/18.
4749
*/
50+
@Slf4j
4851
public class EruptUtil {
4952

5053
//将object中erupt标识的字段抽取出来放到map中
@@ -117,7 +120,13 @@ public static Map<String, Object> generateEruptDataMap(EruptModel eruptModel, Ob
117120
map.put(field.getName(), list);
118121
break;
119122
default:
120-
map.put(field.getName(), value);
123+
if (fieldModel.getField().getType() == Long.class ||
124+
fieldModel.getField().getType() == Double.class ||
125+
fieldModel.getField().getType() == BigDecimal.class) {
126+
map.put(field.getName(), value.toString());
127+
} else {
128+
map.put(field.getName(), value);
129+
}
121130
break;
122131
}
123132
}
@@ -344,7 +353,7 @@ public static Object dataTarget(EruptModel eruptModel, Object data, Object targe
344353
f.set(target, f.get(data));
345354
}
346355
} catch (IllegalAccessException e) {
347-
e.printStackTrace();
356+
log.error("erupt data copy error", e);
348357
}
349358
}
350359
}
@@ -362,7 +371,7 @@ public static void clearObjectDefaultValueByJson(Object obj, JsonObject data) {
362371
}
363372
}
364373
} catch (IllegalAccessException e) {
365-
e.printStackTrace();
374+
log.error("erupt clear error", e);
366375
}
367376
});
368377
}

erupt-core/src/main/java/xyz/erupt/core/util/MimeUtil.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package xyz.erupt.core.util;
22

3+
import lombok.extern.slf4j.Slf4j;
34
import org.apache.commons.lang3.StringUtils;
45
import org.springframework.http.MediaType;
56

@@ -11,6 +12,7 @@
1112
* @author YuePeng
1213
* date 2019-07-11.
1314
*/
15+
@Slf4j
1416
public class MimeUtil {
1517

1618
private static final Properties mimes = new Properties();
@@ -19,7 +21,7 @@ public class MimeUtil {
1921
try (InputStream in = MimeUtil.class.getClassLoader().getResourceAsStream("mime.properties")) {
2022
mimes.load(in);
2123
} catch (IOException e) {
22-
e.printStackTrace();
24+
log.warn("mime file load error", e);
2325
}
2426
}
2527

erupt-core/src/main/java/xyz/erupt/core/util/SecurityUtil.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package xyz.erupt.core.util;
22

3+
import lombok.extern.slf4j.Slf4j;
34
import org.apache.commons.lang3.StringUtils;
45
import xyz.erupt.core.exception.EruptWebApiRuntimeException;
56

@@ -14,6 +15,7 @@
1415
* @author YuePeng
1516
* date 2019-10-30.
1617
*/
18+
@Slf4j
1719
public class SecurityUtil {
1820

1921
// xss跨站脚本检测
@@ -99,7 +101,7 @@ public static boolean csrfInspect(HttpServletRequest request, HttpServletRespons
99101
out.append(text);
100102
throw new EruptWebApiRuntimeException(text);
101103
} catch (IOException e) {
102-
e.printStackTrace();
104+
log.error("csrf inspect error", e);
103105
}
104106
return true;
105107
}

erupt-core/src/main/java/xyz/erupt/core/util/TypeUtil.java

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import lombok.SneakyThrows;
44
import org.apache.commons.lang3.math.NumberUtils;
55

6+
import java.math.BigDecimal;
67
import java.util.Arrays;
78
import java.util.function.Consumer;
89

@@ -39,6 +40,8 @@ public static Object typeStrConvertObject(Object obj, Class<?> targetType) {
3940
return Float.valueOf(str);
4041
} else if (double.class == targetType || Double.class == targetType) {
4142
return Double.valueOf(str);
43+
} else if (BigDecimal.class == targetType) {
44+
return new BigDecimal(str);
4245
} else if (boolean.class == targetType || Boolean.class == targetType) {
4346
return Boolean.valueOf(str);
4447
} else if (targetType.isEnum()) {

erupt-core/src/main/java/xyz/erupt/core/view/EruptApiModel.java

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public static EruptApiModel errorNoInterceptMessage(String message) {
6363
}
6464

6565
public static EruptApiModel errorApi(Exception e) {
66-
e.printStackTrace();
6766
return new EruptApiModel(Status.ERROR, e.getMessage(), null, PromptWay.DIALOG);
6867
}
6968

erupt-data/erupt-jpa/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>xyz.erupt</groupId>
77
<artifactId>erupt</artifactId>
8-
<version>1.12.7</version>
8+
<version>1.12.8</version>
99
<relativePath>../../pom.xml</relativePath>
1010
</parent>
1111

erupt-data/erupt-jpa/src/main/java/xyz/erupt/jpa/service/EruptDataServiceDbImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package xyz.erupt.jpa.service;
22

3+
import lombok.extern.slf4j.Slf4j;
34
import org.apache.commons.lang3.StringUtils;
45
import org.hibernate.exception.ConstraintViolationException;
56
import org.springframework.dao.DataIntegrityViolationException;
@@ -36,6 +37,7 @@
3637
* @author YuePeng
3738
* date 2019-03-06.
3839
*/
40+
@Slf4j
3941
@Service
4042
public class EruptDataServiceDbImpl implements IEruptDataService {
4143

@@ -112,7 +114,6 @@ private void loadSupport(Object jpaEntity) {
112114

113115
//优化异常提示类
114116
private void handlerException(Exception e, EruptModel eruptModel) {
115-
e.printStackTrace();
116117
if (e instanceof DataIntegrityViolationException) {
117118
if (e.getMessage().contains("ConstraintViolationException")) {
118119
throw new EruptWebApiRuntimeException(gcRepeatHint(eruptModel));
@@ -132,7 +133,6 @@ public void deleteData(EruptModel eruptModel, Object object) {
132133
try {
133134
eruptJpaDao.removeEntity(eruptModel.getClazz(), object);
134135
} catch (DataIntegrityViolationException | ConstraintViolationException e) {
135-
e.printStackTrace();
136136
throw new EruptWebApiRuntimeException(I18nTranslate.$translate("erupt.data.delete_fail_may_be_associated_data"));
137137
} catch (Exception e) {
138138
throw new EruptWebApiRuntimeException(e.getMessage());

erupt-data/erupt-mongodb/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<parent>
1010
<groupId>xyz.erupt</groupId>
1111
<artifactId>erupt</artifactId>
12-
<version>1.12.7</version>
12+
<version>1.12.8</version>
1313
<relativePath>../../pom.xml</relativePath>
1414
</parent>
1515

erupt-excel/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<parent>
1111
<groupId>xyz.erupt</groupId>
1212
<artifactId>erupt</artifactId>
13-
<version>1.12.7</version>
13+
<version>1.12.8</version>
1414
<relativePath>../pom.xml</relativePath>
1515
</parent>
1616

0 commit comments

Comments
 (0)