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