Commit a2cf2408 authored by guoyu's avatar guoyu

magic-api基于Java的接口快速开发框架

parents
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
2023-01-18 00:02:52.730 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=39m58s448ms).
2023-01-18 00:34:24.500 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=31m1s53ms).
2023-01-18 01:06:00.890 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=31m6s382ms).
2023-01-18 01:40:18.961 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=34m18s71ms).
2023-01-18 02:16:46.051 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=35m57s80ms).
2023-01-18 02:54:05.138 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=36m49s79ms).
2023-01-18 03:24:47.008 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=30m41s870ms).
2023-01-18 04:02:09.125 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=36m52s115ms).
2023-01-18 04:39:03.216 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=36m24s77ms).
2023-01-18 05:10:08.298 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=30m35s70ms).
2023-01-18 05:49:12.385 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=39m4s87ms).
2023-01-18 06:22:57.465 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=33m15s68ms).
2023-01-18 07:00:48.571 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=37m21s101ms).
2023-01-18 07:38:39.636 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=37m51s65ms).
2023-01-18 08:10:58.711 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=31m49s70ms).
2023-01-18 08:42:28.797 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=31m74ms).
2023-01-18 09:04:52.834 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=22m24s37ms).
2023-01-18 09:32:11.884 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=9m47s234ms).
2023-01-18 09:41:58.138 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=9m46s254ms).
2023-01-18 09:43:37.644 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=1m9s493ms).
2023-01-18 11:29:25.587 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=9m47s245ms).
2023-01-18 11:39:42.657 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=9m47s58ms).
2023-01-18 11:48:55.213 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=8m42s547ms).
2023-01-18 13:03:13.079 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=9m46s701ms).
2023-01-18 13:08:57.132 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=5m14s35ms).
2023-01-18 13:39:45.004 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=9m47s677ms).
2023-01-18 13:50:02.050 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=9m47s32ms).
2023-01-18 13:51:20.094 [HikariPool-1 housekeeper] WARN com.zaxxer.hikari.pool.HikariPool-HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=47s974ms).
2023-01-18 15:46:21.281 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource-HikariPool-1 - Shutdown initiated...
2023-01-18 15:46:21.311 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource-HikariPool-1 - Shutdown completed.
{
"properties" : { },
"id" : "504dbc7823444f7a8df13edb6b189120",
"name" : "MFG",
"type" : "api",
"parentId" : "0",
"path" : "mfg",
"createTime" : 1673423474376,
"updateTime" : 1673489201097,
"createBy" : null,
"updateBy" : null,
"paths" : [ ],
"options" : [ ]
}
\ No newline at end of file
This diff is collapsed.
{
{
"properties" : { },
"id" : "51bf348bfc4d4a95855d7df3d8be277a",
"script" : null,
"groupId" : "504dbc7823444f7a8df13edb6b189120",
"name" : "获取商品库存",
"createTime" : null,
"updateTime" : 1673849005063,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
"path" : "productStock",
"method" : "POST",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "{\n \"client_no\": \"Client-FIRST\",\n \"details\": [{\n \"external_sku_id\": \"6956445461880\"\n }, {\n \"external_sku_id\": \"3130190151310\"\n }]\n}",
"headers" : [ ],
"paths" : [ ],
"responseBody" : "{\n \"code\": -1,\n \"message\": \"系统内部出现错误\",\n \"data\": null,\n \"timestamp\": 1673516872009,\n \"executeTime\": 46\n}",
"description" : null,
"requestBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "client_no",
"value" : "Client-FIRST",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "details",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Array",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "external_sku_id",
"value" : "6956445461880",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
} ]
} ]
} ]
},
"responseBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "code",
"value" : "-1",
"description" : "",
"required" : false,
"dataType" : "Integer",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "message",
"value" : "系统内部出现错误",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "data",
"value" : "null",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "timestamp",
"value" : "1673516872009",
"description" : "",
"required" : false,
"dataType" : "Long",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "executeTime",
"value" : "46",
"description" : "",
"required" : false,
"dataType" : "Integer",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
} ]
}
}
================================
import response;
import 'com.mushiny.wms.mfg.dto.ProductStockResult' as ProductStock;
var sql = """
select
CASE WHEN COALESCE(a.availableQuantity,0) - COALESCE(b.noAllocatedQuantity,0) < 0 THEN 0
ELSE COALESCE(a.availableQuantity,0) - COALESCE(b.noAllocatedQuantity,0)
END AS stockQuantity
from md_product mp
left join (select
su.product_id as productId,
sum(su.quantity-su.reserved_quantity) as availableQuantity
from inv_stock_unit su
inner join inv_unit_load ul on ul.id = su.unit_load_id
inner join md_storage_bin sb on sb.id = ul.storage_bin_id
inner join md_rack mr on mr.id = sb.rack_id
where su.del_flag = 0
and su.quantity > 0
and su.warehouse_id = #{product.warehouse_id}
and su.status = 300
and mr.type ='POD'
group by productId
) a on mp.id = a.productId
left join (
select odl.product_id as productId, sum(odl.quantity-odl.allocated_quantity) as noAllocatedQuantity from
ob_delivery_order_line odl
inner join ob_delivery_order od on od.id = odl.delivery_order_id
where od.del_flag = 0
and od.warehouse_id = #{product.warehouse_id}
and od.client_id = #{client.id}
and od.status < 600
and odl.del_flag = 0
and odl.status < 600
group by productId
) b on a.productId = b.productId
where mp.id = #{product.id}"""
ProductStock result = new ProductStock();
var client = db.selectOne("select * from sys_client where code = #{body.client_no} ");
if(is_null(client)){
return response.json({status : 'ERROR', message : 'Client does not exist', datetime : date_format(new Date())});
}
if(body.details.size()>100){
return response.json({status : 'ERROR', message : 'Not more than 100 sku', datetime : date_format(new Date())});
}
val list = new ArrayList();
for(val in body.details){
var product = db.selectOne("select * from md_product where code = #{val.external_sku_id} and client_id = #{client.id}");
if (is_null(product)) {
return response.json({status : 'ERROR', message : 'Product does not exist, wrong product is '+ val.external_sku_id, datetime : date_format(new Date())});
}
Integer quantity = db.selectInt(sql);
ProductStock productStock = new ProductStock();
productStock.setExternal_sku_id(val.external_sku_id);
productStock.setQuantity(quantity);
list.add(productStock);
}
return response.json({
status : 'OK',
message : 'Success',
datetime : date_format(new Date()),
details : list
});
{
{
"properties" : { },
"id" : "9b1f7afb104241dc9964a7be93135e19",
"script" : null,
"groupId" : "504dbc7823444f7a8df13edb6b189120",
"name" : "获取结果处理",
"createTime" : null,
"updateTime" : 1673949363712,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
"path" : "receiveData",
"method" : "POST",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "{\"name\":\"gy\"}",
"headers" : [ ],
"paths" : [ ],
"responseBody" : "{\n \"name\": \"gy\"\n}",
"description" : null,
"requestBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "name",
"value" : "gy",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
} ]
},
"responseBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "name",
"value" : "gy",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
} ]
}
}
================================
import response;
import log;
log.info("返回header:{}", header);
log.info("返回body:{}", body);
return response.json({
success : true,
message : '执行成功'
});
\ No newline at end of file
{
{
"properties" : { },
"id" : "99b88ae13eb34fccad3c58390639e158",
"name" : "函数",
"type" : "function",
"parentId" : "0",
"path" : "function",
"createTime" : null,
"updateTime" : 1673938947281,
"createBy" : null,
"updateBy" : "admin",
"paths" : [ ],
"options" : [ ]
}
\ No newline at end of file
{
"properties" : { },
"id" : "d0f77f73a23b4374beb298d66a0dd923",
"name" : "MFG",
"type" : "task",
"parentId" : "0",
"path" : "mfg",
"createTime" : null,
"updateTime" : 1673837992834,
"createBy" : null,
"updateBy" : null,
"paths" : [ ],
"options" : [ ]
}
\ No newline at end of file
{
{
"properties" : { },
"id" : "7f4795103fa9469b940676f3c2a05237",
"script" : null,
"groupId" : "d0f77f73a23b4374beb298d66a0dd923",
"name" : "反馈库存数据",
"createTime" : null,
"updateTime" : 1673949461914,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
"path" : "inventoryFeedbackJobHandler",
"cron" : "0 * * * * ?",
"enabled" : false,
"description" : ""
}
================================
import response;
import env;
import http;
import log;
import 'com.mushiny.wms.mfg.dto.InventoryFeedbackResult' as InventoryFeedbackResult;
import 'com.mushiny.wms.mfg.utils.DateTimeUtil' as DateTimeUtils;
var url = 'http://127.0.0.1:8088/mfg/receiveData';
//mfg本地环境
var DWMSCONNECTIONKEY = "c84b8e4c297269d70205c5450cd278a4fdfc2ee0";
var MAX_LIMIT_SEND_DATA_SIZE = 200;
var callInterface = (result, url, connectionId)=>{
String param = result::stringify;
// log.info("调用的url:{},发送的数据:{}", url, param);
var json = http.connect(url)
.header({
'Content-Type' : 'application/json',
'DWMSCONNECTIONKEY' : DWMSCONNECTIONKEY,
'DWMSCONNECTIONID' : connectionId,
})
.body(result).post().getBody();
log.info("json:{}", json);
}
var feedback = (list, url, pageNo, totalPage)=>{
InventoryFeedbackResult result = new InventoryFeedbackResult();
result.setPage_no(pageNo);
result.setTotal_page(totalPage);
list.forEach(InventoryDTO => {
InventoryFeedbackDetailResult detail = new InventoryFeedbackResult.InventoryFeedbackDetailResult();
detail.setClient_no(InventoryDTO.clientNo);
detail.setExternal_sku_id(InventoryDTO.externalSkuId);
detail.setQuantity(InventoryDTO.quantity::int);
detail.setExp_date(DateTimeUtils.dateFormat(InventoryDTO.expDate,'yyyy-MM-dd'));
result.getDetails().add(detail);
});
callInterface(result, url, "2116");
}
var sql = """
select sum(su.quantity) as quantity,
p.code as externalSkuId,
sc.code as clientNo,
case p.best_before_mandatory when 1 then su.strategy_date else null end as expDate
from inv_stock_unit su
inner join md_product p on su.product_id = p.id
inner join sys_client sc on su.client_id = sc.id
where su.del_flag = 0
and su.quantity > 0
group by externalSkuId, clientNo, expDate""";
var inventoryList = db.select(sql);
if (is_null(inventoryList)) {
return
}
Integer size = inventoryList.size();
if (MAX_LIMIT_SEND_DATA_SIZE < size) {
int part = size % MAX_LIMIT_SEND_DATA_SIZE == 0? size/MAX_LIMIT_SEND_DATA_SIZE:size/MAX_LIMIT_SEND_DATA_SIZE+1;
Integer subSize = MAX_LIMIT_SEND_DATA_SIZE; //截取数据长度:默认值为 最大发送数据长度
Integer lastSize = size; //剩余数据长度:默认值为 库存数据总数量
log.info("反馈库存数据开始 共: {} 条,分: {} 次反馈", size, part);
for(val in range(1,part)){
var list = inventoryList.subList(0, subSize);
feedback(list, url, String.valueOf(val), String.valueOf(part));
inventoryList.subList(0, subSize).clear();
lastSize = lastSize - MAX_LIMIT_SEND_DATA_SIZE;
if (lastSize < MAX_LIMIT_SEND_DATA_SIZE) {
subSize = lastSize;
}
}
} else {
feedback(inventoryList, url, "1" , "1");
}
This diff is collapsed.
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mushiny</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.ssssssss</groupId>
<artifactId>magic-api-spring-boot-starter</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.27</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.75</version>
</dependency>
<dependency>
<groupId>org.ssssssss</groupId>
<artifactId>magic-api-plugin-swagger</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.ssssssss</groupId>
<artifactId>magic-api-plugin-task</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>5.8.11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.mushiny.wms;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package com.mushiny.wms.mfg.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 公共字段,自动填充值
*
* @author Elen elen.shen@mushiny.comn
* @since 2.1.0
*/
@Component
public class FieldMetaObjectHandler implements MetaObjectHandler {
private final static String CREATE_DATE = "createDate";
private final static String CREATOR = "creator";
private final static String UPDATE_DATE = "updateDate";
private final static String UPDATER = "updater";
private final static String DEL_FLAG = "delFlag";
private final static String DEPT_ID = "deptId";
@Value("${mushiny.user}")
private Long userId;
@Override
public void insertFill(MetaObject metaObject) {
Date date = new Date();
//更新时间
strictInsertFill(metaObject, UPDATE_DATE, Date.class, date);
strictInsertFill(metaObject, CREATE_DATE, Date.class, date);
//删除标识
strictInsertFill(metaObject, DEL_FLAG, Integer.class, 0);
//创建者
strictInsertFill(metaObject, CREATOR, Long.class, userId);
//创建时间
//创建者所属部门
// strictInsertFill(metaObject, DEPT_ID, Long.class, user.getDeptId());
//更新者
strictInsertFill(metaObject, UPDATER, Long.class, userId);
}
@Override
public void updateFill(MetaObject metaObject) {
//更新时间
setFieldValByName(UPDATE_DATE, new Date(), metaObject);
//更新者
setFieldValByName(UPDATER, userId, metaObject);
}
}
\ No newline at end of file
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package com.mushiny.wms.mfg.constant;
/**
* 日期格式常量
*
* @author Gy
* @since 4.0.0
*/
public class DateFormatPattern {
/**
* 日期格式:yyyy-MM-dd
*/
public static final String yyyy_MM_dd = "yyyy-MM-dd";
/**
* 日期格式:dd-MM-yyyy
*/
public static final String dd_MM_yyyy = "dd-MM-yyyy";
/**
* 日期格式:dd-MM-yyyy HH:mm
*/
public static final String dd_MM_yyyy_HH_mm = "dd-MM-yyyy HH:mm";
/**
* 日期格式:dd-MM-yyyy HH:mm:ss
*/
public static final String dd_MM_yyyy_HH_mm_ss = "dd-MM-yyyy HH:mm:ss";
/**
* 日期格式:yyyy-MM-dd HH:mm:ss
*/
public static final String yyyy_MM_dd_HH_mm_ss = "yyyy-MM-dd HH:mm:ss";
/**
* 日期格式:yyyy-MM-dd HH:mm
*/
public static final String yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm";
/**
* 日期格式:yyyy-MM-dd hh:mm:ss
*/
public static final String yyyy_MM_dd_hh_mm_ss = "yyyy-MM-dd hh:mm:ss";
/**
* 日期格式:yyyy-MM-dd hh:mm
*/
public static final String yyyy_MM_dd_hh_mm = "yyyy-MM-dd hh:mm";
/**
* 日期格式:dd-MM-yyyy HH:mm:ss.SSS
*/
public static final String dd_MM_yyyy_HH_mm_ss_SSS = "dd-MM-yyyy HH:mm:ss.SSS";
}
package com.mushiny.wms.mfg.constant;
/**
* @author Gy
* @since 4.0.0
*/
public class ResultStatus {
public static String ok = "OK";
public static String error = "ERROR";
public static String success = "Success";
}
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package com.mushiny.wms.mfg.constant;
/**
* 时区
*
* @author Gy
* @since 4.0.0
*/
public class TimeZoneConstant {
/**
* 中国时区
*/
public static String CH_TIME_ZONE = "GMT+8";
/**
* 澳洲时区
*/
public static String AU_TIME_ZONE = "Australia/Sydney";
/**
* 美国时区
*/
public static String US_TIME_ZONE = "UTC+8";
}
package com.mushiny.wms.mfg.dto;
import com.mushiny.wms.mfg.constant.DateFormatPattern;
import com.mushiny.wms.mfg.constant.ResultStatus;
import com.mushiny.wms.mfg.constant.TimeZoneConstant;
import com.mushiny.wms.mfg.utils.DateTimeUtil;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @author gy
* @since 4.0.0
*/
@Data
@Accessors(chain = true)
public class BaseResult {
private String status = ResultStatus.ok;
private String message = "Success";
private String datetime = DateTimeUtil.dateFormat(new Date(), DateFormatPattern.dd_MM_yyyy_HH_mm_ss, TimeZoneConstant.AU_TIME_ZONE);
}
package com.mushiny.wms.mfg.dto;
import com.mushiny.wms.mfg.constant.DateFormatPattern;
import com.mushiny.wms.mfg.constant.TimeZoneConstant;
import com.mushiny.wms.mfg.utils.DateTimeUtil;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author Gy
* @since 4.0.0
*/
@ApiModel(value = "同步库存")
@Data
public class InventoryFeedbackResult implements Serializable {
private static final long serialVersionUID = 1L;
private String page_no;
private String total_page;
private String operation_datetime = DateTimeUtil.dateFormat(new Date(), DateFormatPattern.dd_MM_yyyy_HH_mm_ss_SSS, TimeZoneConstant.AU_TIME_ZONE);
private List<InventoryFeedbackDetailResult> details = new ArrayList<>();
@Data
public static class InventoryFeedbackDetailResult implements Serializable {
private String client_no;
private String external_sku_id;
private Integer quantity;
private String exp_date;
}
}
package com.mushiny.wms.mfg.dto;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author Gy
* @since 4.0.0
*/
@Data
@Accessors(chain = true)
public class ProductResult extends BaseResult {
private String client_no;
private String external_sku_id;
}
package com.mushiny.wms.mfg.dto;
import lombok.Data;
/**
* @author Gy
* @since 4.0.0
*/
@Data
public class ProductStockResult{
private String external_sku_id;
private Integer quantity;
}
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package com.mushiny.wms.mfg.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 货主基础实体类,所有货主实体都需要继承
*
* @author Elen elen.shen@mushiny.comn
* @since 2.1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
public abstract class BaseClient extends BaseWarehouse {
/**
* 货主ID
*/
@TableField(fill = FieldFill.INSERT)
private Long clientId;
}
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package com.mushiny.wms.mfg.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.beans.Transient;
import java.io.Serializable;
import java.util.Date;
/**
* 基础实体类,所有实体都需要继承
*
* @author Elen elen.shen@mushiny.comn
* @since 2.1.0
*/
@Data
public abstract class BaseEntitys implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 备注
*/
private String remark;
/**
* 状态 0:停用 1:正常
*/
private Integer status;
/**
* 删除标识 0:未删除 1:删除
*/
@TableLogic
private Integer delFlag;
/**
* 版本
*/
@Version
private Integer version;
/**
* 更新者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 锁定
*/
private Integer entityLock = 0;
@Transient
public Integer getLock() {
return entityLock;
}
@Transient
public void setLock(Integer entityLock) {
this.entityLock = entityLock;
}
public boolean isLocked() {
return entityLock != 0;
}
@Override
public String toString() {
return toUniqueString();
}
public String toUniqueString() {
return (getId() == null ? "" : getId().toString());
}
}
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package com.mushiny.wms.mfg.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 仓库基础实体类,所有仓库实体都需要继承
*
* @author Elen elen.shen@mushiny.comn
* @since 2.1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
public abstract class BaseWarehouse extends BaseEntitys {
/**
* 仓库ID
*/
@TableField(fill = FieldFill.INSERT)
private Long warehouseId;
}
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package com.mushiny.wms.mfg.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 商品分组
*
* @author Gy
* @since 2.1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class ProductGroup extends BaseWarehouse {
private static final long serialVersionUID = 1L;
/**
* 产品分组编码
*/
private String code;
/**
* 产品分组名称
*/
private String name;
}
\ No newline at end of file
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package com.mushiny.wms.mfg.utils;
import com.mushiny.wms.mfg.constant.DateFormatPattern;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
/**
* 时间工具类
*
* @author Gy
* @since 4.0.0
*/
@Slf4j
public class DateTimeUtil {
/**
* 默认日期格式
*/
private final static SimpleDateFormat defaultSimpleDateFormat = new SimpleDateFormat(DateFormatPattern.yyyy_MM_dd_HH_mm_ss);
/**
* 将日期字符串转化为日期类型
* 格式:yyyy-MM-dd HH:mm:ss
*
* @param dateStr 日期字符串
* @return
*/
public static Date conventToDate(String dateStr) {
try {
if (StringUtils.isNotEmpty(dateStr)) {
return defaultSimpleDateFormat.parse(dateStr + " 00:00:00");
}
} catch (ParseException e) {
log.error("时间转化异常", e);
throw new IllegalArgumentException("【时间转换失败】时间:" + dateStr);
}
return new Date();
}
/**
* 将日期字符串转化为日期类型
* 格式:yyyy-MM-dd HH:mm:ss
*
* @param dateStr 日期字符串
* @return
*/
public static Date conventToDate(String dateStr, String pattern) {
try {
if (StringUtils.isNotEmpty(dateStr)) {
if (pattern.equals(DateFormatPattern.dd_MM_yyyy)) {
pattern = DateFormatPattern.yyyy_MM_dd;
String[] date = dateStr.split("-");
dateStr = date[2] + "-" + date[1] + "-" + date[0];
}
// 03-12-2022 12:00
if (pattern.equals(DateFormatPattern.dd_MM_yyyy_HH_mm)) {
pattern = DateFormatPattern.yyyy_MM_dd_HH_mm;
String[] datetime = dateStr.split(" ");
String[] date = datetime[0].split("-");
dateStr = date[2] + "-" + date[1] + "-" + date[0] + " " + datetime[1];
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
Calendar calendar = new GregorianCalendar();
calendar.setTime(simpleDateFormat.parse(dateStr));
//calendar.add(Calendar.DATE, 1);
return calendar.getTime();
}
} catch (Exception e) {
log.error("时间转化异常", e);
throw new IllegalArgumentException("Time conversion failed,the time:" + dateStr);
}
return null;
}
/**
* 格式化日期类型
*
* @param date 日期
* @param pattern 日期格式
* @return
*/
public static String dateFormat(Date date, String pattern) {
try {
if (ObjectUtils.isNotEmpty(date)) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
return simpleDateFormat.format(date);
}
} catch (Exception e) {
log.error("时间转化异常", e);
throw new IllegalArgumentException("Time conversion failed,the time:" + e.getMessage());
}
return "";
}
/**
* 格式化日期类型
*
* @param date 日期
* @param pattern 日期格式
* @param timeZone 时区
* @return
*/
public static String dateFormat(Date date, String pattern, String timeZone) {
try {
defaultSimpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
if (ObjectUtils.isNotEmpty(date)) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
if (StringUtils.isNotBlank(timeZone)) {
simpleDateFormat.setTimeZone(TimeZone.getTimeZone(timeZone));
} else {
simpleDateFormat.setTimeZone(TimeZone.getDefault());
}
return simpleDateFormat.format(date);
}
} catch (Exception e) {
log.error("时间转化异常", e);
throw new IllegalArgumentException("Time conversion failed,the time:" + e.getMessage());
}
return "";
}
/**
* 格式化日期类型
*
* @param date 日期
* @param pattern 日期格式
* @return
*/
public static String dateFormat(String date, String pattern) {
try {
if (StringUtils.isNotBlank(date)) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
return simpleDateFormat.format(defaultSimpleDateFormat.parse(date));
}
} catch (Exception e) {
log.error("时间转化异常", e);
throw new IllegalArgumentException("Time conversion failed,the time:" + e.getMessage());
}
return "";
}
/**
* 格式化日期类型
*
* @param date 日期
* @param pattern 日期格式
* @param timeZone 时区
* @return
*/
public static String dateFormat(String date, String pattern, String timeZone) {
try {
defaultSimpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
if (StringUtils.isNotBlank(date)) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
if (StringUtils.isNotBlank(timeZone)) {
simpleDateFormat.setTimeZone(TimeZone.getTimeZone(timeZone));
} else {
simpleDateFormat.setTimeZone(TimeZone.getDefault());
}
return simpleDateFormat.format(defaultSimpleDateFormat.parse(date));
}
} catch (Exception e) {
log.error("时间转化异常", e);
throw new IllegalArgumentException("Time conversion failed,the time:" + e.getMessage());
}
return "";
}
public static String dateFormat(LocalDateTime date, String pattern) {
try {
if (ObjectUtils.isNotEmpty(date)) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
return formatter.format(date);
}
} catch (Exception e) {
log.error("时间转化异常", e);
throw new IllegalArgumentException("Time conversion failed,the time:" + e.getMessage());
}
return "";
}
}
server:
port: 8088
magic-api:
#配置web页面入口
web: /magic/web
resource:
#配置文件存储位置。当以classpath开头时,为只读模式
#mac用户请改为可读写的目录
#如果不想存到文件中,可以参考配置将接口信息存到数据库、Redis中(或自定义)
location: mushiny/magic-api
page:
size: size # 页大小的请求参数名称 缺省时为size
page: page # 页码的请求参数名称 缺省时为page
default-page: 1 # 自定义默认首页 缺省时为1
default-size: 10 # 自定义为默认页大小 缺省时为10
backup: #备份相关配置
enable: true #是否启用
max-history: 3 #备份保留天数,-1为永久保留
table-name: magic_api_backup #使用数据库存储备份时的表名
security: # 安全配置
username: admin # 登录用的用户名
password: 123456 # 登录用的密码
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ft_test?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
username: root
password: 123456789
mvc:
pathmatch:
matching-strategy: ant_path_matcher
mushiny:
user: 1067246875800000001
warehouse: 1303927529038716929
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
<property name="LOG_HOME" value="./logs" />
<property name="AppName" value="/" />
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}-%msg %n</pattern>
</encoder>
</appender>
<!-- 设置分割 -->
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 设置按尺寸和时间(同时满足)分割 -->
<rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<!-- each file should be at most 10MB, keep 30 days worth of history,
but at most 3GB -->
<maxFileSize>100MB</maxFileSize>
<maxHistory>15</maxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}-%msg%n</pattern>
</encoder>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
package com.mushiny.wms;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment