opt:增加主从同步功能1
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.sch.service;
|
||||
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -18,7 +19,7 @@ public interface TaskService {
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
TableDataInfo queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 任务操作
|
||||
|
||||
@@ -8,9 +8,12 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -52,7 +55,7 @@ public class TaskServiceImpl implements TaskService {
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map form, Pageable page) {
|
||||
public TableDataInfo queryAll(Map form, Pageable page) {
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
@@ -104,18 +107,12 @@ public class TaskServiceImpl implements TaskService {
|
||||
if (ObjectUtil.isNotEmpty(in_area_id)) {
|
||||
map.put("in_area_id", in_area_id);
|
||||
}
|
||||
JSONObject json = WQL.getWO("QSCH_TASK_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
|
||||
JSONArray content = json.getJSONArray("content");
|
||||
JSONArray res = new JSONArray();
|
||||
|
||||
//点位基础表【SCH_BASE_Point】
|
||||
WQLObject schBasePointService = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject taskObj = content.getJSONObject(i);
|
||||
res.add(taskObj);
|
||||
}
|
||||
json.put("content", res);
|
||||
return json;
|
||||
Page<Object> startPage = PageHelper.startPage(page.getPageNumber(), page.getPageSize());
|
||||
PageHelper.orderBy("update_time desc");
|
||||
JSONArray content = WQL.getWO("QSCH_TASK_01").addParamMap(map).process().getResultJSONArray(0);
|
||||
TableDataInfo<Object> build = TableDataInfo.build(content);
|
||||
build.setTotalElements(startPage.getTotal());
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,14 +50,13 @@
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
QUERY
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
task.*,
|
||||
md.class_name task_type_name,
|
||||
user.person_name AS create_name1,
|
||||
dict.label task_status_name,
|
||||
case when task.task_type like '0105%' then 'LK' when task.task_type like '0107%' then 'LK' ELSE task.product_area end AS final_product_area
|
||||
dict.label task_status_name
|
||||
FROM
|
||||
sch_base_task task
|
||||
LEFT JOIN md_pb_classstandard md ON task.task_type = md.class_code
|
||||
@@ -104,8 +103,8 @@
|
||||
) a
|
||||
WHERE 1=1
|
||||
OPTION 输入.in_area_id <> ""
|
||||
a.final_product_area IN 输入.in_area_id
|
||||
a.product_area IN 输入.in_area_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -1,64 +1,107 @@
|
||||
server:
|
||||
port: 8011
|
||||
port: 8013
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_tb_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# username: ${DB_USER:root}
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# password: ${DB_PWD:root}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
min-idle: 15
|
||||
socket-timeout: 10
|
||||
# 最大连接数
|
||||
query-time-out: 5
|
||||
transaction-query-timeout: 20
|
||||
max-active: 220
|
||||
# 获取连接超时时间
|
||||
max-wait: 2000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
# stat:
|
||||
# enabled: true
|
||||
# # 记录慢SQL
|
||||
# log-slow-sql: true
|
||||
# slow-sql-millis: 1000
|
||||
# merge-sql: true
|
||||
# wall:
|
||||
# config:
|
||||
# multi-statement-allow: true
|
||||
shardingsphere:
|
||||
datasource:
|
||||
names: master,slave
|
||||
master:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 初始连接数
|
||||
initial-size: 20
|
||||
# 最小连接数
|
||||
min-idle: 30
|
||||
# 最大连接数
|
||||
max-active: 300
|
||||
# 是否自动回收超时连接
|
||||
socket-timeout: 10
|
||||
query-time-out: 7
|
||||
transaction-query-timeout: 30
|
||||
# 获取连接超时时间
|
||||
max-wait: 4000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
url: jdbc:mysql://10.1.3.87:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: root
|
||||
password: NLABC&hl123
|
||||
slave:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 初始连接数
|
||||
initial-size: 20
|
||||
# 最小连接数
|
||||
min-idle: 30
|
||||
# 最大连接数
|
||||
max-active: 300
|
||||
|
||||
socket-timeout: 10
|
||||
query-time-out: 7
|
||||
transaction-query-timeout: 30
|
||||
# 获取连接超时时间
|
||||
max-wait: 4000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
url: jdbc:mysql://10.1.3.89:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: root
|
||||
password: NLABC&hl123
|
||||
rules:
|
||||
readwrite-splitting:
|
||||
data-sources:
|
||||
db:
|
||||
type: Static
|
||||
props:
|
||||
#接口有事务,读写分离不生效,默认全部使用主库
|
||||
write-data-source-name: master
|
||||
read-data-source-names: slave
|
||||
#负载均衡算法名称
|
||||
load-balancer-name: round-robin
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:11}
|
||||
host: ${REDIS_HOST:10.1.3.93}
|
||||
host: ${REDIS_HOST:10.1.3.91}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
redisson:
|
||||
@@ -69,7 +112,7 @@ spring:
|
||||
connectionMinimumIdleSize: 8
|
||||
connectionPoolSize: 8
|
||||
database: 11
|
||||
address: redis://10.1.3.93:6379
|
||||
address: redis://10.1.3.91:6379
|
||||
idleConnectionTimeout: 10000
|
||||
timeout: 3000
|
||||
# 登录相关配置
|
||||
@@ -161,6 +204,3 @@ sa-token:
|
||||
cookie:
|
||||
# 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com
|
||||
domain:
|
||||
lucene:
|
||||
index:
|
||||
path: D:\log\lms\lucene\index
|
||||
|
||||
Reference in New Issue
Block a user