commit:同步2.3版本

This commit is contained in:
Jerry
2022-02-20 13:40:36 +08:00
parent c7cc3f5354
commit cbe0f7947d
668 changed files with 172592 additions and 821 deletions

View File

@@ -1,7 +1,8 @@
package com.orangeforms.operationlogconsumer;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
/**
@@ -10,8 +11,9 @@ import org.springframework.context.annotation.ComponentScan;
* @author Jerry
* @date 2020-08-08
*/
@SpringCloudApplication
@ComponentScan("com.orangeforms")
@EnableDiscoveryClient
@SpringBootApplication
public class OperationLogConsumerApplication {
public static void main(String[] args) {

View File

@@ -1,7 +1,8 @@
package com.orangeforms.courseclassservice;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
@@ -11,9 +12,9 @@ import org.springframework.context.annotation.ComponentScan;
* @author Jerry
* @date 2020-08-08
*/
@SpringCloudApplication
@EnableFeignClients(basePackages = "com.orangeforms")
@ComponentScan("com.orangeforms")
@EnableFeignClients(basePackages = "com.orangeforms")
@SpringBootApplication
public class CourseClassApplication {
public static void main(String[] args) {

View File

@@ -97,7 +97,7 @@
</if>
<if test="studentFilter.searchString != null and studentFilter.searchString != ''">
<bind name = "safeStudentSearchString" value = "'%' + studentFilter.searchString + '%'" />
AND CONCAT(COALESCE(zz_student.login_mobile,''), COALESCE(zz_student.student_name,'')) LIKE #{safeStudentSearchString}
AND CONCAT(IFNULL(zz_student.login_mobile,''), IFNULL(zz_student.student_name,'')) LIKE #{safeStudentSearchString}
</if>
</if>
</sql>

View File

@@ -5,9 +5,9 @@ import com.orangeforms.gateway.filter.AuthenticationPostFilter;
import com.orangeforms.gateway.filter.AuthenticationPreFilter;
import com.orangeforms.gateway.filter.RequestLogFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,8 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
* @author Jerry
* @date 2020-08-08
*/
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
@SpringCloudApplication
@EnableDiscoveryClient
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class GatewayApplication {
@RestController

View File

@@ -22,10 +22,14 @@ public class CorsConfig {
UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource(new PathPatternParser());
CorsConfiguration config = new CorsConfiguration();
if (StringUtils.isNotBlank(appConfig.getCredentialIpList())) {
String[] credentialIpList = StringUtils.split(appConfig.getCredentialIpList(), ",");
if (credentialIpList.length > 0) {
for (String ip : credentialIpList) {
config.addAllowedOrigin(ip);
if ("*".equals(appConfig.getCredentialIpList())) {
config.addAllowedOriginPattern("*");
} else {
String[] credentialIpList = StringUtils.split(appConfig.getCredentialIpList(), ",");
if (credentialIpList.length > 0) {
for (String ip : credentialIpList) {
config.addAllowedOrigin(ip);
}
}
}
config.addAllowedHeader("*");

View File

@@ -1,7 +1,8 @@
package com.orangeforms.statsservice;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
@@ -11,9 +12,9 @@ import org.springframework.context.annotation.ComponentScan;
* @author Jerry
* @date 2020-08-08
*/
@SpringCloudApplication
@EnableFeignClients(basePackages = "com.orangeforms")
@ComponentScan("com.orangeforms")
@EnableFeignClients(basePackages = "com.orangeforms")
@SpringBootApplication
public class StatsApplication {
public static void main(String[] args) {

View File

@@ -1,9 +1,9 @@
package com.orangeforms.upmsservice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
@@ -13,10 +13,10 @@ import org.springframework.context.annotation.ComponentScan;
* @author Jerry
* @date 2020-08-08
*/
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
@SpringCloudApplication
@EnableFeignClients(basePackages = "com.orangeforms")
@ComponentScan("com.orangeforms")
@EnableFeignClients(basePackages = "com.orangeforms")
@EnableDiscoveryClient
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class UpmsApplication {
public static void main(String[] args) {

View File

@@ -26,7 +26,7 @@ public interface SysDeptRelationMapper extends BaseDaoMapper<SysDeptRelation> {
/**
* 批量插入部门关联数据。
* 由于目前版本(3.4.1)的Mybatis Plus没有提供真正的批量插入为了保证效率需要自己实现。
* 目前我们仅仅给出MySQL的insert list实现作为参考其他数据库需要自行修改。
* 目前我们仅仅给出MySQL和PostgresSQL的insert list实现作为参考其他数据库需要自行修改。
*
* @param deptRelationList 部门关联关系数据列表。
*/

View File

@@ -2,8 +2,8 @@ package com.orangeforms.common.core.base.client;
import com.orangeforms.common.core.constant.ErrorCodeEnum;
import com.orangeforms.common.core.object.*;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.*;

View File

@@ -3,9 +3,11 @@ package com.orangeforms.common.core.base.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.*;
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
import com.orangeforms.common.core.base.service.IBaseService;
import com.orangeforms.common.core.config.CoreProperties;
import com.orangeforms.common.core.constant.AggregationKind;
import com.orangeforms.common.core.constant.AggregationType;
import com.orangeforms.common.core.constant.ErrorCodeEnum;
@@ -19,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.Serializable;
import java.lang.reflect.Field;
@@ -42,6 +45,8 @@ import java.util.stream.Collectors;
@Slf4j
public abstract class BaseController<M, V, K extends Serializable> {
@Autowired
private CoreProperties coreProperties;
/**
* 当前Service关联的主Model实体对象的Class。
*/
@@ -245,7 +250,42 @@ public abstract class BaseController<M, V, K extends Serializable> {
}
}
M filter = queryParam.getFilterDto(modelClass);
if (StrUtil.isNotBlank(queryParam.getInFilterField())
&& CollUtil.isNotEmpty(queryParam.getInFilterValues())) {
if (queryParam.getCriteriaList() == null) {
queryParam.setCriteriaList(new LinkedList<>());
}
MyWhereCriteria whereCriteria = new MyWhereCriteria();
whereCriteria.setFieldName(queryParam.getInFilterField());
whereCriteria.setOperatorType(MyWhereCriteria.OPERATOR_IN);
whereCriteria.setValue(queryParam.getInFilterValues());
queryParam.getCriteriaList().add(whereCriteria);
}
String whereClause = MyWhereCriteria.makeCriteriaString(queryParam.getCriteriaList(), modelClass);
if (CollUtil.isNotEmpty(queryParam.getSearchStringFieldList())
&& StrUtil.isNotBlank(queryParam.getSearchStringValue())) {
String tableName = MyModelUtil.mapToTableName(modelClass);
StringBuilder sb = new StringBuilder(128);
if (StrUtil.isNotBlank(whereClause)) {
sb.append(" AND ");
}
sb.append(" CONCAT(");
for (int i = 0; i < queryParam.getSearchStringFieldList().size(); i++) {
String fieldName = queryParam.getSearchStringFieldList().get(i);
String columnName = MyModelUtil.mapToColumnInfo(fieldName, modelClass).getFirst();
if (coreProperties.isMySql()) {
sb.append("IFNULL(");
} else if (coreProperties.isPostgresql()) {
sb.append("COALESCE(");
}
sb.append(tableName).append(".").append(columnName).append(", '')");
if (i != queryParam.getSearchStringFieldList().size() - 1) {
sb.append(", ");
}
}
sb.append(") LIKE ").append("'").append(queryParam.getSearchStringValue()).append("'");
whereClause = whereClause + sb.toString();
}
String orderBy = MyOrderParam.buildOrderBy(queryParam.getOrderParam(), modelClass);
MyPageParam pageParam = queryParam.getPageParam();
if (pageParam != null) {
@@ -364,9 +404,9 @@ public abstract class BaseController<M, V, K extends Serializable> {
for (Map.Entry<Object, Set<Object>> entry : param.getGroupedInFilterValues().entrySet()) {
StringBuilder groupedSelectList = new StringBuilder(64);
if (stringKey) {
groupedSelectList.append("'").append(entry.getKey()).append("' ");
groupedSelectList.append("'").append(entry.getKey()).append("' as ");
} else {
groupedSelectList.append(entry.getKey()).append(" ");
groupedSelectList.append(entry.getKey()).append(" as ");
}
groupedSelectList.append(MyAggregationParam.KEY_NAME).append(", ").append(selectList);
MyWhereCriteria criteria = new MyWhereCriteria();

View File

@@ -5,6 +5,7 @@ import com.orangeforms.common.core.object.TokenData;
import com.orangeforms.common.core.util.ContextUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Configuration;
@@ -17,6 +18,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class FeignConfig implements RequestInterceptor {
@SneakyThrows
@Override
public void apply(RequestTemplate requestTemplate) {
// 对于非servlet请求发起的远程调用由于无法获取到标识用户身份的TokenData因此需要略过下面的HEADER注入。

View File

@@ -19,13 +19,13 @@ public class MyAggregationParam {
* 聚合返回数据中,聚合键的常量字段名。
* 如select groupColumn groupedKey, max(aggregationColumn) aggregatedValue。
*/
public static final String KEY_NAME = "groupedKey";
public static final String KEY_NAME = "grouped_key";
/**
* 聚合返回数据中,聚合值的常量字段名。
* 如select groupColumn groupedKey, max(aggregationColumn) aggregatedValue。
*/
public static final String VALUE_NAME = "aggregatedValue";
public static final String VALUE_NAME = "aggregated_value";
/**
* 聚合计算是否使用数据权限进行过滤。true表示数据过滤将产生作用否则SQL中不会包含数据过滤。

View File

@@ -61,6 +61,16 @@ public class MyQueryParam {
*/
private Boolean withDict = false;
/**
* 参与模糊搜索的Java字段列表。
*/
private List<String> searchStringFieldList;
/**
* 模糊搜索的字符串值,该值要包含百分号,这样可以精确控制搜索参数中百分号的配置。
*/
private String searchStringValue;
/**
* 缺省构造函数。
*/

View File

@@ -43,6 +43,12 @@ public class MyDateUtil {
private static final DateTimeFormatter DATETIME_PARSE_FORMATTER =
DateTimeFormat.forPattern(MyDateUtil.COMMON_DATETIME_FORMAT);
/**
* 缺省短日期时间格式化器,提前获取提升运行时效率。
*/
private static final DateTimeFormatter DATETIME_SHORT_PARSE_FORMATTER =
DateTimeFormat.forPattern(MyDateUtil.COMMON_SHORT_DATETIME_FORMAT);
/**
* 获取一天的开始时间的字符串格式如2019-08-03 00:00:00.000。
*
@@ -144,6 +150,16 @@ public class MyDateUtil {
return DATETIME_PARSE_FORMATTER.parseDateTime(dateTimeString);
}
/**
* 将缺省格式的(不包含毫秒的)日期时间字符串解析为日期对象。
*
* @param dateTimeString 待解析的字符串。
* @return 解析后的日期对象。
*/
public static DateTime toDateTimeWithoutMs(String dateTimeString) {
return DATETIME_SHORT_PARSE_FORMATTER.parseDateTime(dateTimeString);
}
/**
* 截取时间到天。如2019-10-03 01:20:30 转换为 2019-10-03 00:00:00。
* 由于没有字符串的中间转换,因此效率更高。

View File

@@ -16,7 +16,7 @@
<result column="request_arguments" jdbcType="VARCHAR" property="requestArguments"/>
<result column="response_result" jdbcType="VARCHAR" property="responseResult"/>
<result column="request_ip" jdbcType="VARCHAR" property="requestIp"/>
<result column="success" jdbcType="BIT" property="success"/>
<result column="success" jdbcType="BOOLEAN" property="success"/>
<result column="error_msg" jdbcType="VARCHAR" property="errorMsg"/>
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
<result column="operator_id" jdbcType="BIGINT" property="operatorId"/>

View File

@@ -10,10 +10,10 @@
<packaging>pom</packaging>
<properties>
<spring-cloud.version>Hoxton.SR9</spring-cloud.version>
<spring-cloud-alibaba.version>2.2.5.RELEASE</spring-cloud-alibaba.version>
<spring-boot.version>2.3.10.RELEASE</spring-boot.version>
<spring-boot-admin.version>2.3.1</spring-boot-admin.version>
<spring-cloud.version>2020.0.4</spring-cloud.version>
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
<spring-boot.version>2.5.8</spring-boot.version>
<spring-boot-admin.version>2.5.5</spring-boot-admin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
@@ -59,6 +59,10 @@
</modules>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<!-- freemarker 模板引擎模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -180,14 +184,9 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
</dependency>
<!--断路器依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<!-- api参数验证 -->
<dependency>

View File

@@ -42,7 +42,7 @@ spring:
# feign 配置
feign:
hystrix:
sentinel:
enabled: true
httpclient:
enabled: true
@@ -66,22 +66,9 @@ feign:
response:
enabled: true
hystrix:
command:
default:
execution:
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 30000
shareSecurityContext: true
#请求处理的超时时间
ribbon:
ReadTimeout: 7000
ConnectTimeout: 3000
MaxAutoRetries: 1
MaxAutoRetriesNextServer: 1
common-core:
# 可选值为 mysql / postgresql
databaseType: mysql
swagger:
# 当enabled为false的时候则可禁用swagger。
@@ -116,8 +103,7 @@ management:
# keys-to-sanitize:
keys-to-sanitize: password
server:
servlet:
context-path: "/"
base-path: "/"
# 存储session数据的Redis所有服务均需要因此放到公共配置中。
# 根据实际情况该Redis也可以用于存储其他数据。

View File

@@ -33,27 +33,15 @@ spring:
- Path=/admin/upms/**
filters:
- StripPrefix=2
- name: Hystrix
args:
name: default
fallbackUri: forward:/fallback
- id: course-class
uri: lb://course-class
predicates:
- Path=/admin/CourseClass/**
filters:
- StripPrefix=2
- name: Hystrix
args:
name: default
fallbackUri: forward:/fallback
- id: stats
uri: lb://stats
predicates:
- Path=/admin/stats/**
filters:
- StripPrefix=2
- name: Hystrix
args:
name: default
fallbackUri: forward:/fallback

View File

@@ -11,19 +11,6 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
BEGIN;
INSERT INTO `zz_data_sync_producer_update_mark` VALUES (1,0,CURDATE());
COMMIT;
-- ----------------------------
-- 管理员账号数据
-- ----------------------------
BEGIN;
INSERT INTO `zz_sys_dept` VALUES(1293376634891538435,NULL,'公司总部',1,1293376634887344128,CURDATE(),1293376634887344128,CURDATE(),1);
INSERT INTO `zz_sys_user` VALUES(1293376634887344128,'admin','$2a$10$vBEU0Zgx2X0crltvKEoxnOWF3O1eKIuVI9EJngv/dn5BGKMi6SH3.','管理员',1293376634891538435,NULL,0,0,1293376634887344128,CURDATE(),1293376634887344128,CURDATE(),1);
INSERT INTO `zz_sys_dept_relation` VALUES(1293376634891538435,1293376634891538435);
COMMIT;
-- ----------------------------
-- 全部菜单数据

View File

@@ -13,9 +13,6 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
DELETE FROM `zz_data_sync_producer_update_mark` WHERE id = 1;
-- ----------------------------
-- 全部菜单数据
-- ----------------------------

View File

@@ -315,4 +315,17 @@ CREATE TABLE `zz_data_sync_producer_update_mark` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='数据同步生产者消息流水表的高水标记表';
BEGIN;
INSERT INTO `zz_data_sync_producer_update_mark` VALUES (1,0,CURDATE());
COMMIT;
-- ----------------------------
-- 管理员账号数据
-- ----------------------------
BEGIN;
INSERT INTO `zz_sys_dept` VALUES(1293376634891538435,NULL,'公司总部',1,1293376634887344128,CURDATE(),1293376634887344128,CURDATE(),1);
INSERT INTO `zz_sys_user` VALUES(1293376634887344128,'admin','$2a$10$CDcvRR6vbruoSPkiorYaEueAwdLKNhBfPdj0dypAHot21SWDlFx8m','管理员',1293376634891538435,NULL,0,0,1293376634887344128,CURDATE(),1293376634887344128,CURDATE(),1);
INSERT INTO `zz_sys_dept_relation` VALUES(1293376634891538435,1293376634891538435);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;