初始化提交
This commit is contained in:
commit
b6b525e827
|
@ -0,0 +1,123 @@
|
||||||
|
[globe]
|
||||||
|
plats=025
|
||||||
|
;005,006,011,014,017,020,021
|
||||||
|
;001,002,003,004,005,006,009,010,014,015,017,018,019
|
||||||
|
[002]
|
||||||
|
api_url=http://gw.api.taobao.com/router/rest
|
||||||
|
tmc_url=ws://mc.api.taobao.com
|
||||||
|
|
||||||
|
[004]
|
||||||
|
api_url=http://192.168.1.180:8020/
|
||||||
|
|
||||||
|
[006]
|
||||||
|
;api_url=http://gw.gome.com.cn/router
|
||||||
|
api_url=http://192.168.1.180:8020/
|
||||||
|
|
||||||
|
[005]
|
||||||
|
;api_url=http://api.open.dangdang.com/openapi/rest
|
||||||
|
api_url=http://192.168.1.180:8020/
|
||||||
|
|
||||||
|
[003]
|
||||||
|
api_url=https://api.jd.com/routerjson
|
||||||
|
agent_api_ip=http://114.67.230.107:30003
|
||||||
|
|
||||||
|
[009]
|
||||||
|
api_url=http://open.feiniu.com/call.do?
|
||||||
|
|
||||||
|
;[010]
|
||||||
|
api_url=116.62.209.78
|
||||||
|
|
||||||
|
[011]
|
||||||
|
api_url=http://192.168.1.180:8020/
|
||||||
|
|
||||||
|
[014]
|
||||||
|
;api_url=http://gw-api.pinduoduo.com/api/router
|
||||||
|
api_url=http://192.168.1.179:8020/
|
||||||
|
|
||||||
|
[015]
|
||||||
|
api_url=https://gw.vipapis.com
|
||||||
|
|
||||||
|
[017]
|
||||||
|
;api_url=https://dopen.weimob.com
|
||||||
|
api_url=http://192.168.1.180:8020/
|
||||||
|
|
||||||
|
[018]
|
||||||
|
api_url=https://openapi.jk.cn/api/v1
|
||||||
|
|
||||||
|
[019]
|
||||||
|
api_url=http://gw.api.miyabaobei.com/openapi/app
|
||||||
|
|
||||||
|
[020]
|
||||||
|
;api_url=https://open.yit.com/apigw/m.api
|
||||||
|
api_url=http://192.168.1.180:8020/
|
||||||
|
|
||||||
|
[021]
|
||||||
|
#api_url=http://flssandbox.xiaohongshu.com/ark/open_api/v0/packages/latest_packages?
|
||||||
|
;api_url=https://ark.xiaohongshu.com/ark/open_api/v0/packages
|
||||||
|
api_url=https://ark.xiaohongshu.com/ark/open_api/v3/common_controller
|
||||||
|
|
||||||
|
[022]
|
||||||
|
api_url=
|
||||||
|
|
||||||
|
[023]
|
||||||
|
api_url=https://openapi-fxg.jinritemai.com
|
||||||
|
|
||||||
|
[024]
|
||||||
|
api_url=
|
||||||
|
|
||||||
|
[025]
|
||||||
|
api_url=
|
||||||
|
#订单列表查询的时间间隔,快手在大促期间可能修改订单列表的查询时间间隔,单位小时
|
||||||
|
orderListInteval=24
|
||||||
|
|
||||||
|
[026]
|
||||||
|
api_url=https://openapi.qunjielong.com/open/api/order
|
||||||
|
[parameter]
|
||||||
|
platformCode=
|
||||||
|
;店铺编码
|
||||||
|
shopCode=20180329221
|
||||||
|
;指定下单时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||||
|
starTime=2019-12-09 12:00:00
|
||||||
|
endTime=2019-12-09 18:00:00
|
||||||
|
|
||||||
|
[027]
|
||||||
|
api_url=https://api.vdian.com/api
|
||||||
|
|
||||||
|
;指定系统单号
|
||||||
|
orderId=
|
||||||
|
|
||||||
|
[memcache]
|
||||||
|
url=
|
||||||
|
#192.168.1.172:11211
|
||||||
|
|
||||||
|
;库存同步,单位为分钟
|
||||||
|
[storageUpdateTime]
|
||||||
|
interval=5
|
||||||
|
stopStartTime=2018-11-10 00:00:00
|
||||||
|
stopEndTime=
|
||||||
|
|
||||||
|
;统一回退抓单时间,单位小时
|
||||||
|
[coverTime]
|
||||||
|
coverage=10
|
||||||
|
|
||||||
|
[sttest]
|
||||||
|
;订单总数量
|
||||||
|
orderCount=1000
|
||||||
|
;订单起始订单号
|
||||||
|
platform_code=200002
|
||||||
|
|
||||||
|
|
||||||
|
[path]
|
||||||
|
;import_file_path=/var/www/html/emp3/public/uploads/order/
|
||||||
|
import_file_path=
|
||||||
|
plg_url=
|
||||||
|
;plg_url=http://47.98.162.96:8088/servlet/login
|
||||||
|
|
||||||
|
[problem_time]
|
||||||
|
time=2018-12-12 00:00:00
|
||||||
|
|
||||||
|
[hufu]
|
||||||
|
accessKeyId=E995C8167080BD5ED26B3573D8B08FFF
|
||||||
|
secretKey=17E8CFECA6B49E406D0ED6C6E81021DC
|
||||||
|
endpoint=hufu.cn-north-1.jdcloud-api.net
|
||||||
|
customerId=888
|
|
@ -0,0 +1,47 @@
|
||||||
|
[master]=
|
||||||
|
master.DriverClassName=com.mysql.jdbc.Driver
|
||||||
|
#url=jdbc:mysql://121.41.174.100:30001/EMP_20180531?characterEncoding=utf-8
|
||||||
|
#username=test
|
||||||
|
#password=000000
|
||||||
|
#url=jdbc:mysql://192.168.1.172:3306/EMP3?characterEncoding=utf-8
|
||||||
|
master.url=jdbc:mysql://192.168.1.172:3307/EMP3?characterEncoding=utf-8
|
||||||
|
#master.url=jdbc:mysql://192.168.1.179:3306/emp3?characterEncoding=utf-8&allowPublicKeyRetrieval=true
|
||||||
|
#master.url=jdbc:mysql://localhost:3306/emp3?characterEncoding=utf-8&allowPublicKeyRetrieval=true
|
||||||
|
master.username=root
|
||||||
|
master.password=123456
|
||||||
|
master.filters=stat
|
||||||
|
master.initialSize=1
|
||||||
|
master.maxActive=10
|
||||||
|
master.maxWait=600000
|
||||||
|
master.timeBetweenEvictionRunsMillis=5000
|
||||||
|
master.minEvictableIdleTimeMillis=300000
|
||||||
|
master.validationQuery=SELECT 1
|
||||||
|
master.testWhileIdle=true
|
||||||
|
master.testOnBorrow=false
|
||||||
|
master.testOnReturn=false
|
||||||
|
master.poolPreparedStatements=false
|
||||||
|
master.maxPoolPreparedStatementPerConnectionSize=200
|
||||||
|
[mihe]=
|
||||||
|
mihe.DriverClassName=com.mysql.jdbc.Driver
|
||||||
|
#url=jdbc:mysql://121.41.174.100:30001/EMP_20180531?characterEncoding=utf-8
|
||||||
|
#username=test
|
||||||
|
#password=000000
|
||||||
|
#mihe.url=jdbc:mysql://121.199.10.140:3306/mihe_db_dev?characterEncoding=utf-8&useSSL=false
|
||||||
|
#mihe.username=malluser
|
||||||
|
#mihe.password=Vmalldb124see!
|
||||||
|
mihe.url=jdbc:mysql://192.168.1.179:3306/mihe_db_dev?characterEncoding=utf-8&allowPublicKeyRetrieval=true
|
||||||
|
#mihe.url=jdbc:mysql://192.168.1.172:3307/EMP3_SALT?characterEncoding=utf-8&allowPublicKeyRetrieval=true
|
||||||
|
mihe.username=root
|
||||||
|
mihe.password=123456
|
||||||
|
mihe.filters=stat
|
||||||
|
mihe.initialSize=1
|
||||||
|
mihe.maxActive=10
|
||||||
|
mihe.maxWait=600000
|
||||||
|
mihe.timeBetweenEvictionRunsMillis=60000
|
||||||
|
mihe.minEvictableIdleTimeMillis=300000
|
||||||
|
mihe.validationQuery=SELECT 1
|
||||||
|
mihe.testWhileIdle=true
|
||||||
|
mihe.testOnBorrow=false
|
||||||
|
mihe.testOnReturn=false
|
||||||
|
mihe.poolPreparedStatements=false
|
||||||
|
mihe.maxPoolPreparedStatementPerConnectionSize=200
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,64 @@
|
||||||
|
status = error
|
||||||
|
name = PropertiesConfig
|
||||||
|
|
||||||
|
property.filename = logs/rollingtest.log
|
||||||
|
|
||||||
|
filters = threshold
|
||||||
|
|
||||||
|
filter.threshold.type = ThresholdFilter
|
||||||
|
filter.threshold.level = debug
|
||||||
|
|
||||||
|
#appenders = console, I, W
|
||||||
|
#\u4E0D\u8981\u8F93\u51FA\u5230console\uFF0C\u8981\u517B\u6210\u770B\u65E5\u5FD7\u6587\u4EF6\u7684\u4E60\u60EF
|
||||||
|
appenders =I, W
|
||||||
|
|
||||||
|
#appender.console.type = Console
|
||||||
|
#appender.console.name = STDOUT
|
||||||
|
#appender.console.target = SYSTEM_OUT
|
||||||
|
#appender.console.layout.type = PatternLayout
|
||||||
|
#appender.console.layout.pattern = %-d{yyyy-MM-dd HH:mm:ss} [%t] [ %c ] [ %L ] [ %p ] %m%n
|
||||||
|
|
||||||
|
appender.I.type = RollingFile
|
||||||
|
appender.I.name = InfoRollingFile
|
||||||
|
appender.I.fileName = logs/info/info.log
|
||||||
|
appender.I.filePattern = logs/info/info_%d{yyyy-MM-dd}.log.%i
|
||||||
|
appender.I.layout.type = PatternLayout
|
||||||
|
appender.I.layout.pattern = %-d{yyyy-MM-dd HH:mm:ss} [%t] [ %c ] [ %L ] [ %p ] %m%n
|
||||||
|
appender.I.policies.type = Policies
|
||||||
|
appender.I.policies.time.type = TimeBasedTriggeringPolicy
|
||||||
|
appender.I.policies.time.interval = 1
|
||||||
|
appender.I.policies.time.modulate = true
|
||||||
|
appender.I.policies.size.type = SizeBasedTriggeringPolicy
|
||||||
|
appender.I.policies.size.size=10M
|
||||||
|
appender.I.strategy.type = DefaultRolloverStrategy
|
||||||
|
appender.I.strategy.max = 10000
|
||||||
|
appender.I.filter.threshold.type = ThresholdFilter
|
||||||
|
appender.I.filter.threshold.level = WARN
|
||||||
|
appender.I.filter.threshold.onMatch = DENY
|
||||||
|
appender.I.filter.threshold.onMisMatch=NEUTRAL
|
||||||
|
|
||||||
|
|
||||||
|
appender.W.type = RollingFile
|
||||||
|
appender.W.name = ErrorRollingFile
|
||||||
|
appender.W.fileName = logs/error/error.log
|
||||||
|
appender.W.filePattern = logs/error/error_%d{yyyy-MM-dd}.log.%i
|
||||||
|
appender.W.layout.type = PatternLayout
|
||||||
|
appender.W.layout.pattern = %-d{yyyy-MM-dd HH:mm:ss} [%t] [ %c ] [ %L ] [ %p ] %m%n
|
||||||
|
appender.W.policies.type = Policies
|
||||||
|
appender.W.policies.time.type = TimeBasedTriggeringPolicy
|
||||||
|
appender.W.policies.time.interval = 1
|
||||||
|
appender.W.policies.time.modulate = true
|
||||||
|
appender.W.policies.size.type = SizeBasedTriggeringPolicy
|
||||||
|
appender.W.policies.size.size=10M
|
||||||
|
appender.W.strategy.type = DefaultRolloverStrategy
|
||||||
|
appender.W.strategy.max = 10000
|
||||||
|
|
||||||
|
|
||||||
|
rootLogger.level = info
|
||||||
|
#rootLogger.appenderRefs = stdout,I,W
|
||||||
|
rootLogger.appenderRefs =I, W
|
||||||
|
#rootLogger.appenderRef.stdout.ref = STDOUT
|
||||||
|
rootLogger.appenderRef.I.ref = InfoRollingFile
|
||||||
|
rootLogger.appenderRef.I.level = info
|
||||||
|
rootLogger.appenderRef.W.ref = ErrorRollingFile
|
||||||
|
rootLogger.appenderRef.W.level = error
|
|
@ -0,0 +1,64 @@
|
||||||
|
status = error
|
||||||
|
name = PropertiesConfig
|
||||||
|
|
||||||
|
property.filename = logs/rollingtest.log
|
||||||
|
|
||||||
|
filters = threshold
|
||||||
|
|
||||||
|
filter.threshold.type = ThresholdFilter
|
||||||
|
filter.threshold.level = debug
|
||||||
|
|
||||||
|
appenders = console, I, W
|
||||||
|
#\u4E0D\u8981\u8F93\u51FA\u5230console\uFF0C\u8981\u517B\u6210\u770B\u65E5\u5FD7\u6587\u4EF6\u7684\u4E60\u60EF
|
||||||
|
#appenders =I, W
|
||||||
|
|
||||||
|
appender.console.type = Console
|
||||||
|
appender.console.name = STDOUT
|
||||||
|
appender.console.target = SYSTEM_OUT
|
||||||
|
appender.console.layout.type = PatternLayout
|
||||||
|
appender.console.layout.pattern = %-d{yyyy-MM-dd HH:mm:ss} [%t] [ %c ] [ %L ] [ %p ] %m%n
|
||||||
|
|
||||||
|
appender.I.type = RollingFile
|
||||||
|
appender.I.name = InfoRollingFile
|
||||||
|
appender.I.fileName = logs/info/info.log
|
||||||
|
appender.I.filePattern = logs/info/info_%d{yyyy-MM-dd}.log.%i
|
||||||
|
appender.I.layout.type = PatternLayout
|
||||||
|
appender.I.layout.pattern = %-d{yyyy-MM-dd HH:mm:ss} [%t] [ %c ] [ %L ] [ %p ] %m%n
|
||||||
|
appender.I.policies.type = Policies
|
||||||
|
appender.I.policies.time.type = TimeBasedTriggeringPolicy
|
||||||
|
appender.I.policies.time.interval = 1
|
||||||
|
appender.I.policies.time.modulate = true
|
||||||
|
appender.I.policies.size.type = SizeBasedTriggeringPolicy
|
||||||
|
appender.I.policies.size.size=10M
|
||||||
|
appender.I.strategy.type = DefaultRolloverStrategy
|
||||||
|
appender.I.strategy.max = 10000
|
||||||
|
appender.I.filter.threshold.type = ThresholdFilter
|
||||||
|
appender.I.filter.threshold.level = WARN
|
||||||
|
appender.I.filter.threshold.onMatch = DENY
|
||||||
|
appender.I.filter.threshold.onMisMatch=NEUTRAL
|
||||||
|
|
||||||
|
|
||||||
|
appender.W.type = RollingFile
|
||||||
|
appender.W.name = ErrorRollingFile
|
||||||
|
appender.W.fileName = logs/error/error.log
|
||||||
|
appender.W.filePattern = logs/error/error_%d{yyyy-MM-dd}.log.%i
|
||||||
|
appender.W.layout.type = PatternLayout
|
||||||
|
appender.W.layout.pattern = %-d{yyyy-MM-dd HH:mm:ss} [%t] [ %c ] [ %L ] [ %p ] %m%n
|
||||||
|
appender.W.policies.type = Policies
|
||||||
|
appender.W.policies.time.type = TimeBasedTriggeringPolicy
|
||||||
|
appender.W.policies.time.interval = 1
|
||||||
|
appender.W.policies.time.modulate = true
|
||||||
|
appender.W.policies.size.type = SizeBasedTriggeringPolicy
|
||||||
|
appender.W.policies.size.size=10M
|
||||||
|
appender.W.strategy.type = DefaultRolloverStrategy
|
||||||
|
appender.W.strategy.max = 10000
|
||||||
|
|
||||||
|
|
||||||
|
rootLogger.level = info
|
||||||
|
rootLogger.appenderRefs = stdout,I,W
|
||||||
|
#rootLogger.appenderRefs =I, W
|
||||||
|
rootLogger.appenderRef.stdout.ref = STDOUT
|
||||||
|
rootLogger.appenderRef.I.ref = InfoRollingFile
|
||||||
|
rootLogger.appenderRef.I.level = info
|
||||||
|
rootLogger.appenderRef.W.ref = ErrorRollingFile
|
||||||
|
rootLogger.appenderRef.W.level = error
|
|
@ -0,0 +1,76 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
os_8.40.3(2020-04-23)
|
||||||
|
1.JDK从oracle 8升级为open JDK11
|
||||||
|
2.优化淘宝有活动的商品的库存更新策略
|
||||||
|
|
||||||
|
os_8.40.2(2020-04-29)
|
||||||
|
1.淘宝更新判断sync_lock_end_time的判断有误
|
||||||
|
|
||||||
|
os_8.40.1(2020-04-21)
|
||||||
|
1.引入淘宝新的jar,他们修改了正常返回的订单详情的errorcode,之前是null,现在是空字符串
|
||||||
|
|
||||||
|
os_8.40.0(2020-04-21)
|
||||||
|
1.新增抖店的抓单和延长授权(未启用)
|
||||||
|
2.将拼多多的抓单和售后从南天门转到多多云内部服务
|
||||||
|
3.更新了淘宝的jar
|
||||||
|
|
||||||
|
os_8.39.2(2020-04-21)
|
||||||
|
1.新增抖店的抓单和延长授权(未启用)
|
||||||
|
2.将拼多多的抓单和售后从南天门转到多多云内部服务
|
||||||
|
3.更新了淘宝的jar
|
||||||
|
|
||||||
|
os_8.39.0(2020-12-10)
|
||||||
|
1.售后订单还库存阶段,原来是统一还给发货的货架。现在的处理逻辑修改为:配货前需要还库存的,还给原货架,配货后还库存的,还到默认货架
|
||||||
|
|
||||||
|
os_8.38.0(2020-12-08)
|
||||||
|
1.订单写入,对于直播订单标题中有指定关键字的,直接锁定
|
||||||
|
2.售后订单,在tb_sale_order的del_flag=1的按照之前的处理,新增处理:del_falg!=1时,在店铺开启了可以售后的前提下,可以直接登记和完成售后
|
||||||
|
|
||||||
|
os_8.37.0(忘记提交了)
|
||||||
|
1.补录订单中的省份,校验必须填写完整且正确
|
||||||
|
|
||||||
|
os_8.36.4(2020-11-12)
|
||||||
|
1.修复售后单写入的问题,在还库存的地方没有区分经销商自己发货和品牌商发货
|
||||||
|
|
||||||
|
os_8.36.0
|
||||||
|
1.加入京东虎符的业务逻辑
|
||||||
|
|
||||||
|
os_8.35.1
|
||||||
|
1.修复os_8.35.0中修改出的问题,将orderStatus>=3的情况改为orderStatus>3
|
||||||
|
|
||||||
|
os_8.35.0
|
||||||
|
1.修改售后写入的方法,在查询售后单状态由case when then改为直接使用出库单状态
|
||||||
|
|
||||||
|
os_8.34.2
|
||||||
|
1.修复商品的memcached的key值中包含空格时java和php处理不一致的问题。解决方案为存在空格的key值整体进行base64加密存储。
|
||||||
|
|
||||||
|
os_8.30.1
|
||||||
|
1.修复已知bug
|
||||||
|
2.修改淘宝御城河订单提交策略,只要有就提交,不再等待满五分钟或者满100单
|
||||||
|
3.修改淘宝及供销平台单个订单详情获取失败的异常捕获机制
|
||||||
|
|
||||||
|
os_8.31.0
|
||||||
|
1.启用新版PLG拦截接口
|
||||||
|
|
||||||
|
os_8.31.1
|
||||||
|
1.修改启用新版PLG拦截接口bug
|
||||||
|
|
||||||
|
os_8.31.2
|
||||||
|
1.修改启用新版PLG拦截接口bug
|
||||||
|
|
||||||
|
os_8.31.3
|
||||||
|
1.修改御城河提交的问题
|
||||||
|
|
||||||
|
os_8.32.0
|
||||||
|
1.对于小红书的预售订单识别并丢弃
|
||||||
|
|
||||||
|
os_8.32.3
|
||||||
|
1.修复补录订单文件补录单元格为blank的问题
|
||||||
|
|
||||||
|
os_8.32.5
|
||||||
|
1.修复京东电子发票订单解析异常的问题
|
||||||
|
|
||||||
|
os_8.32.6
|
||||||
|
1.修复京东订单解析中商品查询接口失效的问题
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,394 @@
|
||||||
|
package com.since.emp.analysis;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Vector;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.since.emp.base.DbPoolConnection;
|
||||||
|
import com.since.emp.base.thread.ScheduledThreadPool;
|
||||||
|
import com.since.emp.base.thread.ThreadPool;
|
||||||
|
|
||||||
|
import jxl.Sheet;
|
||||||
|
import jxl.Workbook;
|
||||||
|
import jxl.write.Label;
|
||||||
|
import jxl.write.WritableSheet;
|
||||||
|
import jxl.write.WritableWorkbook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className: RecordTOExcel
|
||||||
|
* @description: 将数据写到excel表中
|
||||||
|
* @author: Sunshine
|
||||||
|
* @date: 2019/9/24 14:30
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public class HandlerRecord {
|
||||||
|
|
||||||
|
private static final Logger logger = LogManager.getLogger(HandlerRecord.class);
|
||||||
|
public Vector<ProjectRecord> projectRecordVector;
|
||||||
|
private ThreadPoolExecutor threadPool;
|
||||||
|
private ScheduledThreadPoolExecutor scheduledThreadPool;
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
projectRecordVector = new Vector<>();
|
||||||
|
threadPool = ThreadPool.getInstance();
|
||||||
|
scheduledThreadPool = ScheduledThreadPool.getInstance();
|
||||||
|
scheduledThreadPool.scheduleAtFixedRate(new RecordParseThread(), 0, 50, TimeUnit.MILLISECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className: RecordActivityToExcelThread
|
||||||
|
* @description: 单个线程写入
|
||||||
|
* @author: Sunshine
|
||||||
|
* @date: 2019/9/27 11:14
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
class RecordActivityToExcelThread implements Runnable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
while (projectRecordVector.size() > 0) {
|
||||||
|
//将记录写入excel
|
||||||
|
//区分出不同的项目名称分别写入不同的表格
|
||||||
|
ProjectRecord projectRecord = projectRecordVector.get(0);
|
||||||
|
if (myRecordToDataBase(projectRecord)) {
|
||||||
|
logger.info("记录写入数据库成功-{}", new GsonBuilder().disableHtmlEscaping().create().toJson(projectRecord));
|
||||||
|
projectRecordVector.remove(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className: RecordParseThread
|
||||||
|
* @description: 20个线程并发处理
|
||||||
|
* @author: Sunshine
|
||||||
|
* @date: 2019/9/27 11:14
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
class RecordParseThread implements Runnable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
if (projectRecordVector.size() > 0) {
|
||||||
|
int count = projectRecordVector.size();
|
||||||
|
if (count > 20) {
|
||||||
|
count = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, ProjectRecord> projectRecordMap = new ConcurrentHashMap<>(20);
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
ProjectRecord projectRecord = projectRecordVector.get(0);
|
||||||
|
String key = projectRecord.getTradeInfoId();
|
||||||
|
projectRecordMap.put(key, projectRecord);
|
||||||
|
projectRecordVector.remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<String, ProjectRecord> entry : projectRecordMap.entrySet()) {
|
||||||
|
ProjectRecord projectRecord = entry.getValue();
|
||||||
|
logger.info("订单 [ {} ] 已添加至耗时统计处理线程!", entry.getKey());
|
||||||
|
threadPool.execute(() -> myRecordToDataBase(projectRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("待写入订单处理耗时总数 [ {} ]", projectRecordVector.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(this, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param: projectRecord
|
||||||
|
* @return: boolean
|
||||||
|
* @description: 写入记录到Excel表
|
||||||
|
* @date: 2019/9/24 15:05
|
||||||
|
*/
|
||||||
|
public boolean recordToExcel(ProjectRecord projectRecord) {
|
||||||
|
File file = null;
|
||||||
|
int count = 0;
|
||||||
|
String orderTotal = "100000单-1";
|
||||||
|
try {
|
||||||
|
file = new File("C:\\Users\\sunshine\\Desktop\\订单同步程序各项耗时统计\\" + orderTotal + "订单处理各项耗时统计表.xls");
|
||||||
|
if (file.exists()) {
|
||||||
|
Workbook readwb = null;
|
||||||
|
InputStream instream = new FileInputStream(file);
|
||||||
|
readwb = Workbook.getWorkbook(instream);
|
||||||
|
Sheet readsheet = readwb.getSheet(0);
|
||||||
|
count = readsheet.getRows();
|
||||||
|
} else {
|
||||||
|
WritableWorkbook wwb = Workbook.createWorkbook(new FileOutputStream(file));
|
||||||
|
// 创建新的一页
|
||||||
|
WritableSheet sheet = wwb.createSheet("TradeCheck", 0);
|
||||||
|
// 创建要显示的内容,创建一个单元格,第一个参数为列坐标,第二个参数为行坐标,第三个参数为内容
|
||||||
|
Label xuhao = new Label(0, 0, "序号");
|
||||||
|
sheet.addCell(xuhao);
|
||||||
|
//程序处理开始时间戳
|
||||||
|
Label tradeInfoId = new Label(1, 0, "订单号");
|
||||||
|
sheet.addCell(tradeInfoId);
|
||||||
|
|
||||||
|
Label allBeginTime = new Label(2, 0, "程序处理开始时间");
|
||||||
|
sheet.addCell(allBeginTime);
|
||||||
|
Label allEndTime = new Label(3, 0, "程序处理结束时间");
|
||||||
|
sheet.addCell(allEndTime);
|
||||||
|
Label allOnceUseTime = new Label(4, 0, "程序处理单次总耗时");
|
||||||
|
sheet.addCell(allOnceUseTime);
|
||||||
|
|
||||||
|
Label activityBeginTime = new Label(5, 0, "活动判断开始时间");
|
||||||
|
sheet.addCell(activityBeginTime);
|
||||||
|
Label activityEndTime = new Label(6, 0, "活动判断结束时间");
|
||||||
|
sheet.addCell(activityEndTime);
|
||||||
|
Label activityUseTime = new Label(7, 0, "活动判断总耗时");
|
||||||
|
sheet.addCell(activityUseTime);
|
||||||
|
|
||||||
|
Label obmBeginTime = new Label(8, 0, "代发判断开始时间");
|
||||||
|
sheet.addCell(obmBeginTime);
|
||||||
|
Label obmEndTime = new Label(9, 0, "代发判断结束时间");
|
||||||
|
sheet.addCell(obmEndTime);
|
||||||
|
Label obmUseTime = new Label(10, 0, "代发判断总耗时");
|
||||||
|
sheet.addCell(obmUseTime);
|
||||||
|
|
||||||
|
Label storageBeginTime = new Label(11, 0, "分仓判断开始时间");
|
||||||
|
sheet.addCell(storageBeginTime);
|
||||||
|
Label storageEndTime = new Label(12, 0, "分仓判断结束时间");
|
||||||
|
sheet.addCell(storageEndTime);
|
||||||
|
Label storageUseTime = new Label(13, 0, "分仓判断总耗时");
|
||||||
|
sheet.addCell(storageUseTime);
|
||||||
|
|
||||||
|
Label basketBeginTime = new Label(14, 0, "货篮判断开始时间");
|
||||||
|
sheet.addCell(basketBeginTime);
|
||||||
|
Label basketEndTime = new Label(15, 0, "货篮判断结束时间");
|
||||||
|
sheet.addCell(basketEndTime);
|
||||||
|
Label basketUseTime = new Label(16, 0, "货篮判断总耗时");
|
||||||
|
sheet.addCell(basketUseTime);
|
||||||
|
|
||||||
|
Label insertBeginTime = new Label(17, 0, "写入开始时间");
|
||||||
|
sheet.addCell(insertBeginTime);
|
||||||
|
Label insertEndTime = new Label(18, 0, "写入结束时间");
|
||||||
|
sheet.addCell(insertEndTime);
|
||||||
|
Label insertUseTime = new Label(19, 0, "写入总耗时");
|
||||||
|
sheet.addCell(insertUseTime);
|
||||||
|
|
||||||
|
wwb.write();
|
||||||
|
wwb.close();
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Workbook readwb = Workbook.getWorkbook(file);
|
||||||
|
WritableWorkbook wwb = Workbook.createWorkbook(file, readwb);
|
||||||
|
// 读取第一张工作表
|
||||||
|
WritableSheet sheet = wwb.getSheet(0);
|
||||||
|
|
||||||
|
sheet.addCell(new Label(0, count, String.valueOf(count)));
|
||||||
|
sheet.addCell(new Label(1, count, String.valueOf(projectRecord.getTradeInfoId())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(2, count, String.valueOf(projectRecord.getAllBeginTime())));
|
||||||
|
sheet.addCell(new Label(3, count, String.valueOf(projectRecord.getAllEndTime())));
|
||||||
|
sheet.addCell(new Label(4, count, String.valueOf(projectRecord.getAllOnceUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(5, count, String.valueOf(projectRecord.getActivityBeginTime())));
|
||||||
|
sheet.addCell(new Label(6, count, String.valueOf(projectRecord.getActivityEndTime())));
|
||||||
|
sheet.addCell(new Label(7, count, String.valueOf(projectRecord.getActivityUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(8, count, String.valueOf(projectRecord.getObmBeginTime())));
|
||||||
|
sheet.addCell(new Label(9, count, String.valueOf(projectRecord.getObmEndTime())));
|
||||||
|
sheet.addCell(new Label(10, count, String.valueOf(projectRecord.getObmUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(11, count, String.valueOf(projectRecord.getStorageBeginTime())));
|
||||||
|
sheet.addCell(new Label(12, count, String.valueOf(projectRecord.getStorageEndTime())));
|
||||||
|
sheet.addCell(new Label(13, count, String.valueOf(projectRecord.getStorageUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(14, count, String.valueOf(projectRecord.getBasketBeginTime())));
|
||||||
|
sheet.addCell(new Label(15, count, String.valueOf(projectRecord.getBasketEndTime())));
|
||||||
|
sheet.addCell(new Label(16, count, String.valueOf(projectRecord.getBasketUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(17, count, String.valueOf(projectRecord.getInsertBeginTime())));
|
||||||
|
sheet.addCell(new Label(18, count, String.valueOf(projectRecord.getInsertEndTime())));
|
||||||
|
sheet.addCell(new Label(19, count, String.valueOf(projectRecord.getInsertUseTime())));
|
||||||
|
wwb.write();
|
||||||
|
wwb.close();
|
||||||
|
readwb.close();
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(this, e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param: projectRecord
|
||||||
|
* @return: boolean
|
||||||
|
* @description: 写入记录到Excel表
|
||||||
|
* @date: 2019/9/24 15:05
|
||||||
|
*/
|
||||||
|
public boolean myRecordToExcel(ProjectRecord projectRecord) {
|
||||||
|
File file = null;
|
||||||
|
int count = 0;
|
||||||
|
String orderTotal = "10000单-1";
|
||||||
|
try {
|
||||||
|
file = new File("C:\\Users\\sunshine\\Desktop\\订单同步程序各项耗时统计\\" + orderTotal + "订单处理各项耗时统计表.xls");
|
||||||
|
if (file.exists()) {
|
||||||
|
Workbook readwb = null;
|
||||||
|
InputStream instream = new FileInputStream(file);
|
||||||
|
readwb = Workbook.getWorkbook(instream);
|
||||||
|
Sheet readsheet = readwb.getSheet(0);
|
||||||
|
count = readsheet.getRows();
|
||||||
|
} else {
|
||||||
|
WritableWorkbook wwb = Workbook.createWorkbook(new FileOutputStream(file));
|
||||||
|
// 创建新的一页
|
||||||
|
WritableSheet sheet = wwb.createSheet("TradeCheck", 0);
|
||||||
|
// 创建要显示的内容,创建一个单元格,第一个参数为列坐标,第二个参数为行坐标,第三个参数为内容
|
||||||
|
Label xuhao = new Label(0, 0, "序号");
|
||||||
|
sheet.addCell(xuhao);
|
||||||
|
//程序处理开始时间戳
|
||||||
|
Label tradeInfoId = new Label(1, 0, "订单号");
|
||||||
|
sheet.addCell(tradeInfoId);
|
||||||
|
|
||||||
|
Label allOnceUseTime = new Label(2, 0, "程序处理单次总耗时");
|
||||||
|
sheet.addCell(allOnceUseTime);
|
||||||
|
|
||||||
|
Label activityUseTime = new Label(3, 0, "活动判断总耗时");
|
||||||
|
sheet.addCell(activityUseTime);
|
||||||
|
|
||||||
|
Label obmUseTime = new Label(4, 0, "代发判断总耗时");
|
||||||
|
sheet.addCell(obmUseTime);
|
||||||
|
|
||||||
|
Label storageUseTime = new Label(5, 0, "分仓判断总耗时");
|
||||||
|
sheet.addCell(storageUseTime);
|
||||||
|
|
||||||
|
Label basketUseTime = new Label(6, 0, "货篮判断总耗时");
|
||||||
|
sheet.addCell(basketUseTime);
|
||||||
|
|
||||||
|
Label insertUseTime = new Label(7, 0, "写入总耗时");
|
||||||
|
sheet.addCell(insertUseTime);
|
||||||
|
Label sumUseTime = new Label(8, 0, "sum");
|
||||||
|
sheet.addCell(sumUseTime);
|
||||||
|
wwb.write();
|
||||||
|
wwb.close();
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Workbook readwb = Workbook.getWorkbook(file);
|
||||||
|
WritableWorkbook wwb = Workbook.createWorkbook(file, readwb);
|
||||||
|
// 读取第一张工作表
|
||||||
|
WritableSheet sheet = wwb.getSheet(0);
|
||||||
|
|
||||||
|
sheet.addCell(new Label(0, count, String.valueOf(count)));
|
||||||
|
sheet.addCell(new Label(1, count, String.valueOf(projectRecord.getTradeInfoId())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(2, count, String.valueOf(projectRecord.getAllOnceUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(3, count, String.valueOf(projectRecord.getActivityUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(4, count, String.valueOf(projectRecord.getObmUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(5, count, String.valueOf(projectRecord.getStorageUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(6, count, String.valueOf(projectRecord.getBasketUseTime())));
|
||||||
|
|
||||||
|
sheet.addCell(new Label(7, count, String.valueOf(projectRecord.getInsertUseTime())));
|
||||||
|
long sum = projectRecord.getActivityUseTime() +
|
||||||
|
projectRecord.getObmUseTime() +
|
||||||
|
projectRecord.getBasketUseTime() +
|
||||||
|
projectRecord.getStorageUseTime() +
|
||||||
|
projectRecord.getInsertUseTime();
|
||||||
|
sheet.addCell(new Label(8, count, String.valueOf(sum)));
|
||||||
|
wwb.write();
|
||||||
|
wwb.close();
|
||||||
|
readwb.close();
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(this, e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param: projectRecord
|
||||||
|
* @return: boolean
|
||||||
|
* @description: 写入记录到Excel表
|
||||||
|
* @date: 2019/9/24 15:05
|
||||||
|
*/
|
||||||
|
public boolean myRecordToDataBase(ProjectRecord projectRecord) {
|
||||||
|
DbPoolConnection dbPoolConnection = DbPoolConnection.getInstance();
|
||||||
|
DruidPooledConnection conn = null;
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
try {
|
||||||
|
conn = dbPoolConnection.getConnection();
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
String sql = "insert into tb_ordersync_analysis (order_code,handler_use_time,activity_use_time,obm_use_time,storage_use_time,basket_use_time,write_order_use_time,sum_handler,unsend_quantity_use_time,saleable_quantity_use_time) values(?,?,?,?,?,?,?,?,?,?)";
|
||||||
|
ps = conn.prepareStatement(sql);
|
||||||
|
ps.setString(1, projectRecord.getTradeInfoId());
|
||||||
|
ps.setLong(2, projectRecord.getAllOnceUseTime());
|
||||||
|
ps.setLong(3, projectRecord.getActivityUseTime());
|
||||||
|
ps.setLong(4, projectRecord.getObmUseTime());
|
||||||
|
ps.setLong(5, projectRecord.getStorageUseTime());
|
||||||
|
ps.setLong(6, projectRecord.getBasketUseTime());
|
||||||
|
ps.setLong(7, projectRecord.getInsertUseTime());
|
||||||
|
long sum = projectRecord.getActivityUseTime() +
|
||||||
|
projectRecord.getObmUseTime() +
|
||||||
|
projectRecord.getBasketUseTime() +
|
||||||
|
projectRecord.getStorageUseTime() +
|
||||||
|
projectRecord.getInsertUseTime();
|
||||||
|
ps.setLong(8, sum);
|
||||||
|
ps.setLong(9, projectRecord.getExecuteUnsendSqlUseTime());
|
||||||
|
ps.setLong(10, projectRecord.getExecuteSaleableSqlUseTime());
|
||||||
|
if (ps.executeUpdate() == 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
logger.error(this, e);
|
||||||
|
if (conn != null) {
|
||||||
|
conn.rollback();
|
||||||
|
}
|
||||||
|
} catch (Exception e1) {
|
||||||
|
logger.error(this, e1);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (conn != null) {
|
||||||
|
conn.setAutoCommit(true);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
logger.error(this, e);
|
||||||
|
}
|
||||||
|
if (ps != null) {
|
||||||
|
try {
|
||||||
|
ps.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(this, e);
|
||||||
|
}
|
||||||
|
ps = null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (conn != null) {
|
||||||
|
conn.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(this, e);
|
||||||
|
}
|
||||||
|
conn = null;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,277 @@
|
||||||
|
package com.since.emp.analysis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className: CountProgramUseTime
|
||||||
|
* @description: 统计程序运行使用时间
|
||||||
|
* @author: Sunshine
|
||||||
|
* @date: 2019/9/24 14:03
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public class ProjectRecord {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private String tradeInfoId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每单处理开始时间
|
||||||
|
*/
|
||||||
|
private long allBeginTime;
|
||||||
|
private long allEndTime;
|
||||||
|
private long allOnceUseTime;
|
||||||
|
|
||||||
|
private long activityBeginTime;
|
||||||
|
private long activityEndTime;
|
||||||
|
private long activityUseTime;
|
||||||
|
|
||||||
|
private long obmBeginTime;
|
||||||
|
private long obmEndTime;
|
||||||
|
private long obmUseTime;
|
||||||
|
|
||||||
|
private long storageBeginTime;
|
||||||
|
private long storageEndTime;
|
||||||
|
private long storageUseTime;
|
||||||
|
|
||||||
|
private long basketBeginTime;
|
||||||
|
private long basketEndTime;
|
||||||
|
private long basketUseTime;
|
||||||
|
|
||||||
|
private long insertBeginTime;
|
||||||
|
private long insertEndTime;
|
||||||
|
private long insertUseTime;
|
||||||
|
|
||||||
|
private long executeUnsendSqlBeginTime;
|
||||||
|
private long executeUnsendSqlEndTime;
|
||||||
|
private long executeUnsendSqlUseTime;
|
||||||
|
|
||||||
|
private long executeSaleableSqlBeginTime;
|
||||||
|
private long executeSaleableSqlEndTime;
|
||||||
|
private long executeSaleableSqlUseTime;
|
||||||
|
|
||||||
|
public long getExecuteUnsendSqlBeginTime() {
|
||||||
|
return executeUnsendSqlBeginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setExecuteUnsendSqlBeginTime(long executeUnsendSqlBeginTime) {
|
||||||
|
this.executeUnsendSqlBeginTime = executeUnsendSqlBeginTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getExecuteUnsendSqlEndTime() {
|
||||||
|
return executeUnsendSqlEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setExecuteUnsendSqlEndTime(long executeUnsendSqlEndTime) {
|
||||||
|
this.executeUnsendSqlEndTime = executeUnsendSqlEndTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getExecuteUnsendSqlUseTime() {
|
||||||
|
return executeUnsendSqlUseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setExecuteUnsendSqlUseTime(long executeUnsendSqlUseTime) {
|
||||||
|
this.executeUnsendSqlUseTime = executeUnsendSqlUseTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getExecuteSaleableSqlBeginTime() {
|
||||||
|
return executeSaleableSqlBeginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setExecuteSaleableSqlBeginTime(long executeSaleableSqlBeginTime) {
|
||||||
|
this.executeSaleableSqlBeginTime = executeSaleableSqlBeginTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getExecuteSaleableSqlEndTime() {
|
||||||
|
return executeSaleableSqlEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setExecuteSaleableSqlEndTime(long executeSaleableSqlEndTime) {
|
||||||
|
this.executeSaleableSqlEndTime = executeSaleableSqlEndTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getExecuteSaleableSqlUseTime() {
|
||||||
|
return executeSaleableSqlUseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setExecuteSaleableSqlUseTime(long executeSaleableSqlUseTime) {
|
||||||
|
this.executeSaleableSqlUseTime = executeSaleableSqlUseTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTradeInfoId() {
|
||||||
|
return tradeInfoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setTradeInfoId(String tradeInfoId) {
|
||||||
|
this.tradeInfoId = tradeInfoId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getAllBeginTime() {
|
||||||
|
return allBeginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setAllBeginTime(long allBeginTime) {
|
||||||
|
this.allBeginTime = allBeginTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getAllEndTime() {
|
||||||
|
return allEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setAllEndTime(long allEndTime) {
|
||||||
|
this.allEndTime = allEndTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getAllOnceUseTime() {
|
||||||
|
return allOnceUseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setAllOnceUseTime(long allOnceUseTime) {
|
||||||
|
this.allOnceUseTime = allOnceUseTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getActivityBeginTime() {
|
||||||
|
return activityBeginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setActivityBeginTime(long activityBeginTime) {
|
||||||
|
this.activityBeginTime = activityBeginTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getActivityEndTime() {
|
||||||
|
return activityEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setActivityEndTime(long activityEndTime) {
|
||||||
|
this.activityEndTime = activityEndTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getActivityUseTime() {
|
||||||
|
return activityUseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setActivityUseTime(long activityUseTime) {
|
||||||
|
this.activityUseTime = activityUseTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getObmBeginTime() {
|
||||||
|
return obmBeginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setObmBeginTime(long obmBeginTime) {
|
||||||
|
this.obmBeginTime = obmBeginTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getObmEndTime() {
|
||||||
|
return obmEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setObmEndTime(long obmEndTime) {
|
||||||
|
this.obmEndTime = obmEndTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getObmUseTime() {
|
||||||
|
return obmUseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setObmUseTime(long obmUseTime) {
|
||||||
|
this.obmUseTime = obmUseTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getStorageBeginTime() {
|
||||||
|
return storageBeginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setStorageBeginTime(long storageBeginTime) {
|
||||||
|
this.storageBeginTime = storageBeginTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getStorageEndTime() {
|
||||||
|
return storageEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setStorageEndTime(long storageEndTime) {
|
||||||
|
this.storageEndTime = storageEndTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getStorageUseTime() {
|
||||||
|
return storageUseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setStorageUseTime(long storageUseTime) {
|
||||||
|
this.storageUseTime = storageUseTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getBasketBeginTime() {
|
||||||
|
return basketBeginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setBasketBeginTime(long basketBeginTime) {
|
||||||
|
this.basketBeginTime = basketBeginTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getBasketEndTime() {
|
||||||
|
return basketEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setBasketEndTime(long basketEndTime) {
|
||||||
|
this.basketEndTime = basketEndTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getBasketUseTime() {
|
||||||
|
return basketUseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setBasketUseTime(long basketUseTime) {
|
||||||
|
this.basketUseTime = basketUseTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getInsertBeginTime() {
|
||||||
|
return insertBeginTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setInsertBeginTime(long insertBeginTime) {
|
||||||
|
this.insertBeginTime = insertBeginTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getInsertEndTime() {
|
||||||
|
return insertEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setInsertEndTime(long insertEndTime) {
|
||||||
|
this.insertEndTime = insertEndTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getInsertUseTime() {
|
||||||
|
return insertUseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectRecord setInsertUseTime(long insertUseTime) {
|
||||||
|
this.insertUseTime = insertUseTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,415 @@
|
||||||
|
package com.since.emp.analysis;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||||
|
import com.since.emp.base.Config;
|
||||||
|
import com.since.emp.base.DbPoolConnection;
|
||||||
|
import com.since.emp.base.IniReader;
|
||||||
|
import com.since.emp.base.OrderInfo;
|
||||||
|
import com.since.emp.base.TradeInfo;
|
||||||
|
import com.since.emp.service.OrderSyncs;
|
||||||
|
import com.since.emp.service.StorageUpdate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @className:StOrderSync_lxy
|
||||||
|
* @description:性能测试
|
||||||
|
* @author:Sunshine
|
||||||
|
* @date:2019年10月15日 上午9:39:23
|
||||||
|
*/
|
||||||
|
public class StOrderSync_lxy extends OrderSyncs {
|
||||||
|
|
||||||
|
private static final Logger logger = LogManager.getLogger(StOrderSync_lxy.class);
|
||||||
|
private static String config_filename = "config_all.ini";
|
||||||
|
private static String[][] items;
|
||||||
|
private static String storageUpdateTime;
|
||||||
|
public static int order_count;
|
||||||
|
public static int platform_code;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// 读取文件配置
|
||||||
|
if (!initFileConfig()) {
|
||||||
|
logger.info("【初始化】文件读取配置失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logger.info("【初始化】文件读取配置成功");
|
||||||
|
|
||||||
|
// 从数据库读取各app及店铺参数
|
||||||
|
try {
|
||||||
|
getConfigFromDB();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("【初始化】数据库读取配置失败");
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logger.info("【初始化】数据库读取配置成功");
|
||||||
|
|
||||||
|
// 数据处理类启动
|
||||||
|
analysisDataParse = new AnalysisDataParse();
|
||||||
|
analysisDataParse.start();
|
||||||
|
|
||||||
|
//统计处理类启动
|
||||||
|
handlerRecord = new HandlerRecord();
|
||||||
|
handlerRecord.start();
|
||||||
|
|
||||||
|
|
||||||
|
storageUpdate = new StorageUpdate(config.plats, storageUpdateTime, "1970-01-01 00:00:00",
|
||||||
|
"1970-01-01 00:00:00");
|
||||||
|
storageUpdate.start();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
* 1.活动判断
|
||||||
|
* 1.1 商品只满足一个活动 商品数量为一个
|
||||||
|
* 1.2 商品满足多个活动 商品数量为多个
|
||||||
|
* 2.代发判断
|
||||||
|
*
|
||||||
|
* 3.分仓判断
|
||||||
|
*
|
||||||
|
* 4.货篮判断
|
||||||
|
*
|
||||||
|
* 5.订单写入
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// 平台订单号
|
||||||
|
long count2 = platform_code;
|
||||||
|
int num = order_count;
|
||||||
|
boolean myFlag = true;
|
||||||
|
while (num > 0) {
|
||||||
|
num--;
|
||||||
|
|
||||||
|
TradeInfo tradeInfo = new TradeInfo();
|
||||||
|
tradeInfo.orders = new OrderInfo[1];
|
||||||
|
|
||||||
|
String money = "190";
|
||||||
|
// 仓库编码
|
||||||
|
tradeInfo.storage_code = "201709251";
|
||||||
|
// 公司编码
|
||||||
|
tradeInfo.company_code = "122";
|
||||||
|
// 店铺编码
|
||||||
|
tradeInfo.shop_code = "20180205210";
|
||||||
|
// 2:普通商家,3:品牌商
|
||||||
|
tradeInfo.company_type = 2;
|
||||||
|
|
||||||
|
tradeInfo.type = "fixed";
|
||||||
|
|
||||||
|
tradeInfo.trade_type = "taobao_trade_TradeBuyerPay";
|
||||||
|
// tradeInfo.trade_type = "taobao_trade_TradeBuyerStepPay";
|
||||||
|
tradeInfo.tid = String.valueOf(count2);
|
||||||
|
tradeInfo.brand = "";
|
||||||
|
tradeInfo.adjust_fee = "0";
|
||||||
|
tradeInfo.alipay_id = "3434";
|
||||||
|
tradeInfo.alipay_no = "5435";
|
||||||
|
// tradeInfo.buyer_memo = "买家备注";
|
||||||
|
tradeInfo.seller_memo = "";
|
||||||
|
tradeInfo.buyer_message = "";
|
||||||
|
// 0:无发票,1:有发票
|
||||||
|
tradeInfo.invoice_type = 0;
|
||||||
|
tradeInfo.invoice_money = "100";
|
||||||
|
tradeInfo.delivery_mode_id = 2;
|
||||||
|
|
||||||
|
tradeInfo.buyer_nick = "test20190925";
|
||||||
|
tradeInfo.buyer_obtain_point_fee = 20;
|
||||||
|
tradeInfo.buyer_rate = false;
|
||||||
|
tradeInfo.cod_fee = "dfaf";
|
||||||
|
tradeInfo.cod_status = "NEW_CREATED";
|
||||||
|
// tradeInfo.company_code = "31201608100018";
|
||||||
|
|
||||||
|
tradeInfo.discount_fee = "0";
|
||||||
|
tradeInfo.has_post_fee = true;
|
||||||
|
tradeInfo.money = money;
|
||||||
|
tradeInfo.num = 2;
|
||||||
|
|
||||||
|
tradeInfo.status = "WAIT_SELLER_SEND_GOODS";
|
||||||
|
|
||||||
|
// 设置日期格式
|
||||||
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
Date now = new Date(time);
|
||||||
|
tradeInfo.pay_time = df.format(now);
|
||||||
|
tradeInfo.created = "2019-10-27 10:27:28";
|
||||||
|
tradeInfo.pay_mode_id = 2;
|
||||||
|
|
||||||
|
tradeInfo.receiver_country = "";
|
||||||
|
tradeInfo.receiver_country = "中国";
|
||||||
|
|
||||||
|
tradeInfo.receiver_state = "上海";
|
||||||
|
tradeInfo.receiver_city = "上海市";
|
||||||
|
tradeInfo.receiver_district = "浦东新区";
|
||||||
|
|
||||||
|
tradeInfo.receiver_zip = "110000";
|
||||||
|
tradeInfo.receiver_name = "秋雨凉凉";
|
||||||
|
tradeInfo.receiver_address = "克东路22弄";
|
||||||
|
|
||||||
|
tradeInfo.receiver_mobile = "13112314565";
|
||||||
|
tradeInfo.platform_code = "003";
|
||||||
|
|
||||||
|
tradeInfo.pay_money = money;
|
||||||
|
tradeInfo.product_fee = "190";
|
||||||
|
tradeInfo.post_fee = "8";
|
||||||
|
|
||||||
|
//只有一件商品
|
||||||
|
tradeInfo.orders[0] = new OrderInfo();
|
||||||
|
tradeInfo.orders[0].buyer_rate = true;
|
||||||
|
// "632.008";//平台商家编码
|
||||||
|
tradeInfo.orders[0].platform_seller_code = "008";
|
||||||
|
tradeInfo.orders[0].cid = "2";
|
||||||
|
tradeInfo.orders[0].num = 1;
|
||||||
|
tradeInfo.orders[0].discount_fee = "0";
|
||||||
|
tradeInfo.orders[0].price = "190";
|
||||||
|
tradeInfo.orders[0].payment = "190";
|
||||||
|
tradeInfo.orders[0].sku_properties_name = "8";
|
||||||
|
tradeInfo.orders[0].total_fee = "190";
|
||||||
|
tradeInfo.orders[0].adjust_fee = "0";
|
||||||
|
tradeInfo.orders[0].status = "1111";
|
||||||
|
tradeInfo.orders[0].title = "空气凤梨";
|
||||||
|
tradeInfo.orders[0].gift_type = 1;
|
||||||
|
tradeInfo.orders[0].divide_order_fee = "150";
|
||||||
|
tradeInfo.orders[0].order_buyer_payment = "150";
|
||||||
|
//多件商品
|
||||||
|
|
||||||
|
// if (platform_code > 5999 && platform_code < 6999) {
|
||||||
|
// tradeInfo.orders[0] = new OrderInfo();
|
||||||
|
// tradeInfo.orders[0].buyer_rate = true;
|
||||||
|
//
|
||||||
|
// // "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "015";
|
||||||
|
//
|
||||||
|
// tradeInfo.orders[0].cid = "2";
|
||||||
|
// tradeInfo.orders[0].num = 1;
|
||||||
|
// tradeInfo.orders[0].discount_fee = "0";
|
||||||
|
// tradeInfo.orders[0].price = "287";
|
||||||
|
// tradeInfo.orders[0].payment = "287";
|
||||||
|
// tradeInfo.orders[0].sku_properties_name = "8";
|
||||||
|
// tradeInfo.orders[0].total_fee = "287";
|
||||||
|
// tradeInfo.orders[0].adjust_fee = "0";
|
||||||
|
// tradeInfo.orders[0].status = "1111";
|
||||||
|
// tradeInfo.orders[0].title = "买一送一";
|
||||||
|
// tradeInfo.orders[0].gift_type = 1;
|
||||||
|
// tradeInfo.orders[0].divide_order_fee = "150";
|
||||||
|
// tradeInfo.orders[0].order_buyer_payment = "150";
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// tradeInfo.orders[0] = new OrderInfo();
|
||||||
|
// tradeInfo.orders[1] = new OrderInfo();
|
||||||
|
// tradeInfo.orders[0].buyer_rate = true;
|
||||||
|
// if (platform_code > 6999 && platform_code < 7999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "011";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "012";// "632.008";//平台商家编码
|
||||||
|
// } else if (platform_code > 7999 && platform_code < 8999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "015";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "016";// "632.008";//平台商家编码
|
||||||
|
// } else if (platform_code > 8999 && platform_code < 9999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "018";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "022";// "632.008";//平台商家编码
|
||||||
|
// } else if (platform_code > 9999 && platform_code < 10999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "021";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "016";// "632.008";//平台商家编码
|
||||||
|
// } else if (platform_code > 10999 && platform_code < 11999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "017";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "021";// "632.008";//平台商家编码
|
||||||
|
// } else if (platform_code > 11999 && platform_code < 12999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "017";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "016";// "632.008";//平台商家编码
|
||||||
|
// } else if (platform_code > 12999 && platform_code < 13999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "016";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "020";// "632.008";//平台商家编码
|
||||||
|
// } else if (platform_code > 13999 && platform_code < 14999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "015";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "020";// "632.008";//平台商家编码
|
||||||
|
// } else if (platform_code > 14999 && platform_code < 15999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "017";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "021";// "632.008";//平台商家编码
|
||||||
|
// } else if (platform_code > 15999 && platform_code < 16999) {
|
||||||
|
// tradeInfo.orders[0].platform_seller_code = "020";// "632.008";//平台商家编码
|
||||||
|
// tradeInfo.orders[1].platform_seller_code = "030";// "632.008";//平台商家编码
|
||||||
|
// }
|
||||||
|
// tradeInfo.orders[0].cid = "2";
|
||||||
|
// tradeInfo.orders[0].num = 1;
|
||||||
|
// tradeInfo.orders[0].discount_fee = "0";
|
||||||
|
// tradeInfo.orders[0].price = "287";
|
||||||
|
// tradeInfo.orders[0].payment = "287";
|
||||||
|
// tradeInfo.orders[0].sku_properties_name = "8";
|
||||||
|
// tradeInfo.orders[0].total_fee = "287";
|
||||||
|
// tradeInfo.orders[0].adjust_fee = "0";
|
||||||
|
// tradeInfo.orders[0].status = "1111";
|
||||||
|
// tradeInfo.orders[0].title = "买一送一";
|
||||||
|
// tradeInfo.orders[0].gift_type = 1;
|
||||||
|
// tradeInfo.orders[0].divide_order_fee = "150";
|
||||||
|
// tradeInfo.orders[0].order_buyer_payment = "150";
|
||||||
|
//
|
||||||
|
// tradeInfo.orders[1].buyer_rate = true;
|
||||||
|
// tradeInfo.orders[1].cid = "2";
|
||||||
|
// tradeInfo.orders[1].num = 1;
|
||||||
|
// tradeInfo.orders[1].discount_fee = "0";
|
||||||
|
// tradeInfo.orders[1].price = "180";
|
||||||
|
// tradeInfo.orders[1].payment = "200.07";
|
||||||
|
// tradeInfo.orders[1].sku_properties_name = "8";
|
||||||
|
// tradeInfo.orders[1].total_fee = "60";
|
||||||
|
// tradeInfo.orders[1].adjust_fee = "2";
|
||||||
|
// tradeInfo.orders[1].status = "1111";
|
||||||
|
// tradeInfo.orders[1].title = "不送不送";
|
||||||
|
// tradeInfo.orders[1].gift_type = 1;
|
||||||
|
// tradeInfo.orders[1].divide_order_fee = "180";
|
||||||
|
// tradeInfo.orders[1].order_buyer_payment = "180";
|
||||||
|
// tradeInfo.fenxiaoInfo = new FenxiaoInfo();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// OrderSyncs.dataParse.tradeQueue_Success.add(tradeInfo);
|
||||||
|
|
||||||
|
if (myFlag) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(10 * 1000);
|
||||||
|
// Thread.yield();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(StOrderSync_lxy.class, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myFlag = false;
|
||||||
|
OrderSyncs.analysisDataParse.tradeQueue.add(tradeInfo);
|
||||||
|
//预售
|
||||||
|
// OrderSyncs.dataParse.pretradeQueue.add(tradeInfo);
|
||||||
|
count2++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initConfig 初始化配置
|
||||||
|
*/
|
||||||
|
private static boolean initFileConfig() {
|
||||||
|
boolean res = false;
|
||||||
|
try {
|
||||||
|
IniReader iniReader = new IniReader(config_filename);
|
||||||
|
order_count = Integer.valueOf(iniReader.getValue("sttest", "orderCount"));
|
||||||
|
platform_code = Integer.valueOf(iniReader.getValue("sttest", "platform_code"));
|
||||||
|
storageUpdateTime = iniReader.getValue("storageUpdateTime", "interval");
|
||||||
|
config = new Config();
|
||||||
|
config.db_host = iniReader.getValue("mysql", "host");
|
||||||
|
config.db_port = iniReader.getValue("mysql", "port");
|
||||||
|
config.db_name = iniReader.getValue("mysql", "name");
|
||||||
|
config.db_user = iniReader.getValue("mysql", "user");
|
||||||
|
config.db_password = iniReader.getValue("mysql", "password");
|
||||||
|
// 读入所有平台参数
|
||||||
|
config.globe_plats = iniReader.getValue("globe", "plats");
|
||||||
|
String[] plat_array = config.globe_plats.split(",");
|
||||||
|
config.plats = new ArrayList<PlatConfig>();
|
||||||
|
for (int i = 0; i < plat_array.length; i++) {
|
||||||
|
PlatConfig pc = new PlatConfig();
|
||||||
|
pc.plat_name = plat_array[i];
|
||||||
|
pc.plat_code = iniReader.getValue(plat_array[i], "plat_code");
|
||||||
|
pc.api_url = iniReader.getValue(plat_array[i], "api_url");
|
||||||
|
pc.tmc_url = iniReader.getValue(plat_array[i], "tmc_url");
|
||||||
|
pc.init_time = iniReader.getValue(plat_array[i], "init_time");
|
||||||
|
pc.apps = new ArrayList<AppConfig>();
|
||||||
|
config.plats.add(pc);
|
||||||
|
}
|
||||||
|
res = true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(StOrderSync_lxy.class, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(StOrderSync_lxy.class, e);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getConfigFromDB 从数据库读取配置
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private static boolean getConfigFromDB() {
|
||||||
|
boolean res = false;
|
||||||
|
// Druid连接池管理数据库连接
|
||||||
|
DbPoolConnection dbpc = DbPoolConnection.getInstance();
|
||||||
|
DruidPooledConnection conn = null;
|
||||||
|
Statement statement = null;
|
||||||
|
try {
|
||||||
|
conn = dbpc.getConnection();
|
||||||
|
statement = conn.createStatement();
|
||||||
|
|
||||||
|
String sql = "select " + "c.platform_code," + "c.code as app_code," + "c.key as app_key,"
|
||||||
|
+ "c.secret as app_secret," + "a.company_code as shop_company_code," + "a.code as shop_code,"
|
||||||
|
+ "a.name as shop_name," + "a.session_key as shop_session_key," + "b.name as shop_brand" + " from "
|
||||||
|
+ "tb_shop a," + "tb_brand_dic b," + "tb_platform_app c" + " where " + "a.brand_code = b.code"
|
||||||
|
+ " and a.del_flag = 1" + " and a.app_code = c.code" + " and c.del_flag = 1"
|
||||||
|
+ " and a.company_code = b.company_code";
|
||||||
|
ResultSet rs = statement.executeQuery(sql);
|
||||||
|
while (rs.next()) {
|
||||||
|
// 先判断app是否存在
|
||||||
|
String plat_code = rs.getString("platform_code");
|
||||||
|
String app_code = rs.getString("app_code");
|
||||||
|
Boolean found = false;
|
||||||
|
for (int i = 0; i < config.plats.size(); i++) {
|
||||||
|
PlatConfig plat_config = config.plats.get(i);
|
||||||
|
if (plat_code.equals(plat_config.plat_code)) {
|
||||||
|
// 构造店铺
|
||||||
|
shopConfig = new ShopConfig();
|
||||||
|
shopConfig.code = rs.getString("shop_code");
|
||||||
|
shopConfig.name = rs.getString("shop_name");
|
||||||
|
shopConfig.session_key = rs.getString("shop_session_key");
|
||||||
|
shopConfig.company_code = rs.getString("shop_company_code");
|
||||||
|
shopConfig.brand = rs.getString("shop_brand");
|
||||||
|
for (int j = 0; j < plat_config.apps.size(); j++) {
|
||||||
|
AppConfig app_config = plat_config.apps.get(j);
|
||||||
|
if (app_code.equals(app_config.code)) {
|
||||||
|
// 找到app可以直接添加店铺
|
||||||
|
app_config.shops.add(shopConfig);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
// 未找到app,需要同步添加app和店铺
|
||||||
|
AppConfig appConfig = new AppConfig();
|
||||||
|
appConfig.code = rs.getString("app_code");
|
||||||
|
appConfig.key = rs.getString("app_key");
|
||||||
|
appConfig.secret = rs.getString("app_secret");
|
||||||
|
appConfig.shops = new ArrayList<ShopConfig>();
|
||||||
|
appConfig.shops.add(shopConfig);
|
||||||
|
plat_config.apps.add(appConfig);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(StOrderSync_lxy.class, e);
|
||||||
|
} finally {
|
||||||
|
if (statement != null) {
|
||||||
|
try {
|
||||||
|
statement.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
logger.error(StOrderSync_lxy.class, e);
|
||||||
|
}
|
||||||
|
statement = null;
|
||||||
|
}
|
||||||
|
if (conn != null) {
|
||||||
|
try {
|
||||||
|
conn.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
logger.error(StOrderSync_lxy.class, e);
|
||||||
|
}
|
||||||
|
conn = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库龄排序参数类,在查询最长库龄时记录
|
||||||
|
* @author Lewis
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AgentStorage implements Serializable{
|
||||||
|
private static final long serialVersionUID = -1007249945464422289L;
|
||||||
|
public String storageCode;//仓库编码
|
||||||
|
public String create_time;//库龄
|
||||||
|
public int count;//统计与订单中商品匹配的次数
|
||||||
|
public int smart_allot_storage_join;//仓库是否开启智能分仓
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 篮子内容- 货篮编号 货篮子条目的商品数量之和 企业编号 货篮内容 --
|
||||||
|
***/
|
||||||
|
|
||||||
|
public class Basket implements Serializable {
|
||||||
|
private static final long serialVersionUID = -449126785790936824L;
|
||||||
|
public String code;// 货篮编号
|
||||||
|
public int b_num;// 货篮子条目的商品数量之和
|
||||||
|
public String company_code;// 企业编号
|
||||||
|
public Item[] items = {};// 货篮内容
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分仓订单中商品查重
|
||||||
|
*/
|
||||||
|
public class Commodity implements Serializable {
|
||||||
|
static final long serialVersionUID = -8084210473720589252L;
|
||||||
|
public String commodity_code;// 商品的编码
|
||||||
|
public int order_commodity_quantity;// 商品目前出现的总数量
|
||||||
|
public boolean flag;// 这个商品编码目前的仓库是否可发货
|
||||||
|
public int storage_commodity_quantity;// 仓库中该商品在不同货架不同货位的总库存数量
|
||||||
|
public int smart_allot_storage_join;// 是否参加智能分仓,1:不参加,2:参加
|
||||||
|
|
||||||
|
public Object deepClone() throws Exception {
|
||||||
|
// save the object to a byte array
|
||||||
|
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(bout);
|
||||||
|
out.writeObject(this);
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
// read a clone of the object from byte array
|
||||||
|
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
|
||||||
|
ObjectInputStream in = new ObjectInputStream(bin);
|
||||||
|
Object ret = in.readObject();
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.since.emp.service.OrderSyncs.PlatConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合参数类
|
||||||
|
*/
|
||||||
|
public class Config {
|
||||||
|
|
||||||
|
public String db_host;
|
||||||
|
public String db_port;
|
||||||
|
public String db_name;
|
||||||
|
public String db_user;
|
||||||
|
public String db_password;
|
||||||
|
|
||||||
|
public String globe_plats;
|
||||||
|
public List<PlatConfig> plats;
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import com.alibaba.druid.pool.DruidDataSourceFactory;
|
||||||
|
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 要实现单例模式,保证全局只有一个数据库连接池
|
||||||
|
*/
|
||||||
|
public class DbPoolConnection {
|
||||||
|
private static final Logger logger = LogManager.getLogger(DbPoolConnection.class);
|
||||||
|
private static DruidDataSource druidDataSource = null;
|
||||||
|
|
||||||
|
static {
|
||||||
|
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Init() {
|
||||||
|
try {
|
||||||
|
Properties properties = loadPropertiesFile();
|
||||||
|
logger.info("读取数据库配置文件成功");
|
||||||
|
Properties masterProperties = new Properties();
|
||||||
|
masterProperties.setProperty("DriverClassName", properties.getProperty("master.DriverClassName"));
|
||||||
|
masterProperties.setProperty("url", properties.getProperty("master.url"));
|
||||||
|
masterProperties.setProperty("username", properties.getProperty("master.username"));
|
||||||
|
masterProperties.setProperty("password", properties.getProperty("master.password"));
|
||||||
|
masterProperties.setProperty("filters", properties.getProperty("master.filters"));
|
||||||
|
masterProperties.setProperty("initialSize", properties.getProperty("master.initialSize"));
|
||||||
|
masterProperties.setProperty("maxActive", properties.getProperty("master.maxActive"));
|
||||||
|
masterProperties.setProperty("maxWait", properties.getProperty("master.maxWait"));
|
||||||
|
masterProperties.setProperty("timeBetweenEvictionRunsMillis",
|
||||||
|
properties.getProperty("master.timeBetweenEvictionRunsMillis"));
|
||||||
|
masterProperties.setProperty("minEvictableIdleTimeMillis",
|
||||||
|
properties.getProperty("master.minEvictableIdleTimeMillis"));
|
||||||
|
masterProperties.setProperty("validationQuery", properties.getProperty("master.validationQuery"));
|
||||||
|
masterProperties.setProperty("testWhileIdle", properties.getProperty("master.testWhileIdle"));
|
||||||
|
masterProperties.setProperty("testOnBorrow", properties.getProperty("master.testOnBorrow"));
|
||||||
|
masterProperties.setProperty("testOnReturn", properties.getProperty("master.testOnReturn"));
|
||||||
|
masterProperties.setProperty("poolPreparedStatements",
|
||||||
|
properties.getProperty("master.poolPreparedStatements"));
|
||||||
|
masterProperties.setProperty("maxPoolPreparedStatementPerConnectionSize",
|
||||||
|
properties.getProperty("master.maxPoolPreparedStatementPerConnectionSize"));
|
||||||
|
druidDataSource = (DruidDataSource) DruidDataSourceFactory.createDataSource(masterProperties); // DruidDataSrouce工厂模式
|
||||||
|
// TODO 调试配置,用完删除
|
||||||
|
druidDataSource.setRemoveAbandoned(true);
|
||||||
|
druidDataSource.setRemoveAbandonedTimeout(600);
|
||||||
|
druidDataSource.setLogAbandoned(true);
|
||||||
|
druidDataSource.setTimeBetweenConnectErrorMillis(60000);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("读取数据库配置文件失败");
|
||||||
|
logger.error(DbPoolConnection.class, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用静态内部类实现数据库连接池单例
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
private static class DbPoolInner {
|
||||||
|
private final static DbPoolConnection dbPoolConnection = new DbPoolConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DbPoolConnection getInstance() {
|
||||||
|
return DbPoolInner.dbPoolConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回druid数据库连接
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public DruidPooledConnection getConnection() throws Exception {
|
||||||
|
// logger.info("数据库连接情况:{}", druidDataSource.dump());
|
||||||
|
// logger.info("【" + logTitle + "】" +"活跃的数据库连接:" +
|
||||||
|
// druidDataSource.getActiveConnectionStackTrace());
|
||||||
|
return druidDataSource.getConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Properties对象
|
||||||
|
*/
|
||||||
|
private static Properties loadPropertiesFile() {
|
||||||
|
InputStream inputStream = null;
|
||||||
|
Properties p = null;
|
||||||
|
try {
|
||||||
|
inputStream = new FileInputStream(new File("db.properties"));// 原来是决定路径,现在用相对路径
|
||||||
|
p = new Properties();
|
||||||
|
p.load(inputStream);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(DbPoolConnection.class, e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (null != inputStream) {
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(DbPoolConnection.class, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import com.alibaba.druid.pool.DruidDataSourceFactory;
|
||||||
|
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 要实现单例模式,保证全局只有一个数据库连接池
|
||||||
|
*/
|
||||||
|
public class DbPoolConnection_MiHe {
|
||||||
|
private static Logger logger;
|
||||||
|
private static DruidDataSource druidDataSource = null;
|
||||||
|
|
||||||
|
static {
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Init() {
|
||||||
|
try {
|
||||||
|
logger = LogManager.getLogger(DbPoolConnection_MiHe.class.getName());
|
||||||
|
Properties properties = loadPropertiesFile("db.properties");
|
||||||
|
Properties miheProperties = new Properties();
|
||||||
|
miheProperties.setProperty("DriverClassName", properties.getProperty("mihe.DriverClassName"));
|
||||||
|
miheProperties.setProperty("url", properties.getProperty("mihe.url"));
|
||||||
|
miheProperties.setProperty("username", properties.getProperty("mihe.username"));
|
||||||
|
miheProperties.setProperty("password", properties.getProperty("mihe.password"));
|
||||||
|
miheProperties.setProperty("filters", properties.getProperty("mihe.filters"));
|
||||||
|
miheProperties.setProperty("initialSize", properties.getProperty("mihe.initialSize"));
|
||||||
|
miheProperties.setProperty("maxActive", properties.getProperty("mihe.maxActive"));
|
||||||
|
miheProperties.setProperty("maxWait", properties.getProperty("mihe.maxWait"));
|
||||||
|
miheProperties.setProperty("timeBetweenEvictionRunsMillis",
|
||||||
|
properties.getProperty("mihe.timeBetweenEvictionRunsMillis"));
|
||||||
|
miheProperties.setProperty("minEvictableIdleTimeMillis",
|
||||||
|
properties.getProperty("mihe.minEvictableIdleTimeMillis"));
|
||||||
|
miheProperties.setProperty("validationQuery", properties.getProperty("mihe.validationQuery"));
|
||||||
|
miheProperties.setProperty("testWhileIdle", properties.getProperty("mihe.testWhileIdle"));
|
||||||
|
miheProperties.setProperty("testOnBorrow", properties.getProperty("mihe.testOnBorrow"));
|
||||||
|
miheProperties.setProperty("testOnReturn", properties.getProperty("mihe.testOnReturn"));
|
||||||
|
miheProperties.setProperty("poolPreparedStatements", properties.getProperty("mihe.poolPreparedStatements"));
|
||||||
|
miheProperties.setProperty("maxPoolPreparedStatementPerConnectionSize",
|
||||||
|
properties.getProperty("mihe.maxPoolPreparedStatementPerConnectionSize"));
|
||||||
|
logger.info("读取数据库配置文件成功");
|
||||||
|
druidDataSource = (DruidDataSource) DruidDataSourceFactory.createDataSource(miheProperties); // DruidDataSrouce工厂模式
|
||||||
|
// TODO 调试配置,用完删除
|
||||||
|
druidDataSource.setRemoveAbandoned(true);
|
||||||
|
druidDataSource.setRemoveAbandonedTimeout(600);
|
||||||
|
druidDataSource.setLogAbandoned(true);
|
||||||
|
// druidDataSource.setBreakAfterAcquireFailure(true);
|
||||||
|
druidDataSource.setTimeBetweenConnectErrorMillis(60000);
|
||||||
|
// druidDataSource.setConnectionErrorRetryAttempts(0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("读取数据库配置文件失败");
|
||||||
|
logger.error(DbPoolConnection_MiHe.class, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用静态内部类实现数据库连接池单例
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
private static class DbPoolInner {
|
||||||
|
private final static DbPoolConnection_MiHe dbPoolConnection = new DbPoolConnection_MiHe();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DbPoolConnection_MiHe getInstance() {
|
||||||
|
return DbPoolInner.dbPoolConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回druid数据库连接
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public DruidPooledConnection getConnection() throws Exception {
|
||||||
|
// logger.info("数据库连接情况:{}", druidDataSource.dump());
|
||||||
|
// logger.info("【" + logTitle + "】" +"活跃的数据库连接:" +
|
||||||
|
// druidDataSource.getActiveConnectionStackTrace());
|
||||||
|
return druidDataSource.getConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string 配置文件名
|
||||||
|
* @return Properties对象
|
||||||
|
*/
|
||||||
|
private static Properties loadPropertiesFile(String fullFile) {
|
||||||
|
if (null == fullFile || fullFile.equals("")) {
|
||||||
|
throw new IllegalArgumentException("Properties file path can not be null" + fullFile);
|
||||||
|
}
|
||||||
|
InputStream inputStream = null;
|
||||||
|
Properties p = null;
|
||||||
|
try {
|
||||||
|
inputStream = new FileInputStream(new File(fullFile));// 原来是决定路径,现在用相对路径
|
||||||
|
p = new Properties();
|
||||||
|
p.load(inputStream);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(DbPoolConnection_MiHe.class, e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (null != inputStream) {
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(DbPoolConnection_MiHe.class, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DbUtil 数据库通用类
|
||||||
|
*
|
||||||
|
* @author jue
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DbUtil {
|
||||||
|
private Logger logger;
|
||||||
|
private String db_host, db_port, db_name, db_user, db_password;
|
||||||
|
|
||||||
|
public DbUtil(String db_host, String db_port, String db_name, String db_user, String db_password) {
|
||||||
|
this.db_host = db_host;
|
||||||
|
this.db_port = db_port;
|
||||||
|
this.db_name = db_name;
|
||||||
|
this.db_user = db_user;
|
||||||
|
this.db_password = db_password;
|
||||||
|
logger = LogManager.getLogger(DbUtil.class.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getDbConn 获取数据库连接 用完需要关闭
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Connection getDbConn() {
|
||||||
|
Connection conn = null;
|
||||||
|
try {
|
||||||
|
String url = "jdbc:mysql://" + db_host + ":" + db_port + "/" + db_name
|
||||||
|
+ "?useUnicode=true&characterEncoding=UTF-8";
|
||||||
|
String user = db_user;
|
||||||
|
String password = db_password;
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
conn = DriverManager.getConnection(url, user, password);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("数据库连接失败|{}", e.toString());
|
||||||
|
logger.error(this, e);
|
||||||
|
}
|
||||||
|
return conn;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class DeliveryArea implements Serializable {
|
||||||
|
private static final long serialVersionUID = -6702265238965579823L;
|
||||||
|
public int delivery_mode_id;// 快递公司在erp内部编码
|
||||||
|
public String areas;// 快递公司对应的配送区域
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class DrpOrderInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = -3843027481664917685L;
|
||||||
|
public int docseq;// 序号
|
||||||
|
public String part;// 商品代号
|
||||||
|
public int txqty;// 10(数量)
|
||||||
|
public String buyremark;// 买家备注
|
||||||
|
public String saleremark;// 卖家留言
|
||||||
|
public double orgprc;// 单价
|
||||||
|
public String cpartno;// 商品组合编号
|
||||||
|
public double cprice;// 商品供货价
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* ---------------------------------tb_drp_sale_order推送订单参数------------------------------------
|
||||||
|
* --
|
||||||
|
***/
|
||||||
|
public class DrpParams implements Serializable{
|
||||||
|
private static final long serialVersionUID = -6126136768506706187L;
|
||||||
|
public String code;// 系统订单号
|
||||||
|
public int bill_type;// 订单类型
|
||||||
|
public int user_id;// 创建人
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class DrpTradeInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = -624181808141645785L;
|
||||||
|
public String prloc;//仓库
|
||||||
|
public String taono;//淘宝单号
|
||||||
|
public String cust_desc;//店家
|
||||||
|
public String docdate;//发货日期
|
||||||
|
public String csales;//业务员
|
||||||
|
public String tranfer;//物流公司
|
||||||
|
public int tranferno;//物流公司代号
|
||||||
|
public String tranferdocno;//物流单号
|
||||||
|
public double transfees;//运费
|
||||||
|
public double packfees;//包材费
|
||||||
|
public String omstype;//OMS出货单类型
|
||||||
|
public String omscust;//DRP客户编号
|
||||||
|
public DrpOrderInfo[] details;//详单
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class EntrustOrder implements Serializable{
|
||||||
|
private static final long serialVersionUID = -15076564274272566L;
|
||||||
|
public int commodity_quantity;//商品数量
|
||||||
|
public String commodity_code;
|
||||||
|
public double commodity_price;//商品价格
|
||||||
|
public double adjust_price;//调整单价
|
||||||
|
public String adjust_begin_time;//调整开始时间
|
||||||
|
public String adjust_end_time;//调整结束时间
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 该类用来记录分销订单中客户的购买信息,主要区别于淘宝订单中没有涉及的信息
|
||||||
|
* @author Lewis
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class FenxiaoInfo implements Serializable{
|
||||||
|
static final long serialVersionUID = -8084210473720589252L;
|
||||||
|
public String status;//订单在平台的状态
|
||||||
|
public int trade_type;//分为经销和代销
|
||||||
|
public String distributor_username; // 例如:zhangsan分销商在来源网站的帐号名
|
||||||
|
public String tc_order_id; // 例如:112233主订单ID (经销不显示
|
||||||
|
public String buyer_payment; //例如:买家支付给分销商的总金额。注意买家购买的商品可能不是全部来自同一供货商,请同时参考子单上的相关金额。(精确到2位小数;单位:元。如:200.07,表示:200元7分)
|
||||||
|
public String order_fenxiao_id; //例如:子订单分销账号,主键
|
||||||
|
|
||||||
|
public Object deepClone() throws Exception {
|
||||||
|
//save the object to a byte array
|
||||||
|
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(bout);
|
||||||
|
out.writeObject(this);
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
//read a clone of the object from byte array
|
||||||
|
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
|
||||||
|
ObjectInputStream in = new ObjectInputStream(bin);
|
||||||
|
Object ret = in.readObject();
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class GiftNum implements Serializable{
|
||||||
|
private static final long serialVersionUID = 1237656858983900625L;
|
||||||
|
public String rule_code;
|
||||||
|
public int gift_current;// 已送商品的数量
|
||||||
|
public int order_current;// 已送订单的数量
|
||||||
|
public int type;// 1.根据订单更新,2.根据商品更新3.两种一起更新
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GiftNum [rule_code=" + rule_code + ", gift_current=" + gift_current + ", order_current=" + order_current
|
||||||
|
+ ", type=" + type + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Http请求的常量池
|
||||||
|
* @author Lewis
|
||||||
|
*2018年10月31日
|
||||||
|
*HttpRequestCode
|
||||||
|
*/
|
||||||
|
public class HttpRequestCode implements Serializable {
|
||||||
|
/**
|
||||||
|
* @fields serialVersionUID :TODO(用一句话描述这个变量表示什么)
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 5030435243641686764L;
|
||||||
|
|
||||||
|
/** content-Type:text/plain */
|
||||||
|
public static final int CONTENT_TEXT = 1;
|
||||||
|
|
||||||
|
/** content-Type:application/json */
|
||||||
|
public static final int CONTENT_JSON = 2;
|
||||||
|
|
||||||
|
/** application/x-www-form-urlencoded; charset=utf-8 */
|
||||||
|
public static final int URLENCODED = 3;
|
||||||
|
|
||||||
|
public static final Map<Integer, String> REQUEST_INFO = new HashMap<Integer, String>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
REQUEST_INFO.put(CONTENT_TEXT, "text/plain;charset=utf-8");
|
||||||
|
REQUEST_INFO.put(CONTENT_JSON, "application/json;charset=utf-8");
|
||||||
|
REQUEST_INFO.put(URLENCODED, "application/x-www-form-urlencoded; charset=utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class ImportExcelDataInfo {
|
||||||
|
private String errorTitle;
|
||||||
|
private int errorRow;
|
||||||
|
private ArrayList<ReplenishInfo> list;
|
||||||
|
private ArrayList<TradeInfo> tradeList;
|
||||||
|
public String getErrorTitle() {
|
||||||
|
return errorTitle;
|
||||||
|
}
|
||||||
|
public void setErrorTitle(String errorTitle) {
|
||||||
|
this.errorTitle = errorTitle;
|
||||||
|
}
|
||||||
|
public int getErrorRow() {
|
||||||
|
return errorRow;
|
||||||
|
}
|
||||||
|
public void setErrorRow(int errorRow) {
|
||||||
|
this.errorRow = errorRow;
|
||||||
|
}
|
||||||
|
public ArrayList<ReplenishInfo> getList() {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
public void setList(ArrayList<ReplenishInfo> list) {
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
public ArrayList<TradeInfo> getTradeList() {
|
||||||
|
return tradeList;
|
||||||
|
}
|
||||||
|
public void setTradeList(ArrayList<TradeInfo> tradeList) {
|
||||||
|
this.tradeList = tradeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class ImportParams implements Serializable {
|
||||||
|
private static final long serialVersionUID = -5528454389199169662L;
|
||||||
|
public String code;// 编码
|
||||||
|
public String shop_code;// 店铺编码
|
||||||
|
public String platform_num;// 平台单号
|
||||||
|
public String begin_time;// 补抓开始时间
|
||||||
|
public String end_time;// 补抓结束时间
|
||||||
|
public String in_path;// xlsx保存路径
|
||||||
|
public String platform_code;// erp内平台编码
|
||||||
|
public String company_code;
|
||||||
|
public String obm_company_code;
|
||||||
|
public int once_max_replenish_order_count;
|
||||||
|
public int type;
|
||||||
|
}
|
|
@ -0,0 +1,148 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
/*
|
||||||
|
* IniReader.java
|
||||||
|
* 用Java读取INI文件(带section的)
|
||||||
|
* 示例:
|
||||||
|
* tmp.IniReader reader = new tmp.IniReader("E:\\james\\win.ini");
|
||||||
|
* out.println(reader.getValue("TestSect3", "kkk 6"));
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.core.Logger;
|
||||||
|
|
||||||
|
public class IniReader {
|
||||||
|
private Logger logger;
|
||||||
|
protected HashMap sections = new HashMap();
|
||||||
|
private transient String currentSecion;
|
||||||
|
private transient Properties current;
|
||||||
|
private String filename;
|
||||||
|
|
||||||
|
public IniReader(String filename) throws Exception {
|
||||||
|
logger = (Logger) LogManager.getLogger(IniReader.class.getName());
|
||||||
|
this.filename = filename;
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader(filename));
|
||||||
|
read(reader);
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void read(BufferedReader reader) throws Exception {
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
parseLine(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void parseLine(String line) {
|
||||||
|
line = line.trim();
|
||||||
|
if (line.matches("\\[.*\\]")) {
|
||||||
|
currentSecion = line.replaceFirst("\\[(.*)\\]", "$1");
|
||||||
|
current = new Properties();
|
||||||
|
sections.put(currentSecion, current);
|
||||||
|
} else if (line.matches(".*=.*")) {
|
||||||
|
if (current != null) {
|
||||||
|
int i = line.indexOf('=');
|
||||||
|
String name = line.substring(0, i);
|
||||||
|
String value = line.substring(i + 1);
|
||||||
|
current.setProperty(name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue(String section, String name) {
|
||||||
|
Properties p = (Properties) sections.get(section);
|
||||||
|
|
||||||
|
if (p == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String value = p.getProperty(name);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改ini配置文档中变量的值
|
||||||
|
*
|
||||||
|
* @param file 配置文档的路径
|
||||||
|
* @param section 要修改的变量所在段名称
|
||||||
|
* @param variable 要修改的变量名称
|
||||||
|
* @param value 变量的新值
|
||||||
|
* @throws Exception 抛出文档操作可能出现的io异常
|
||||||
|
*/
|
||||||
|
public boolean setValue(String section, String name, String value) throws IOException {
|
||||||
|
String fileContent, allLine, strLine, newLine, remarkStr;
|
||||||
|
String getValue;
|
||||||
|
BufferedReader bufferedReader = new BufferedReader(
|
||||||
|
new InputStreamReader(new FileInputStream(new File(this.filename)), "UTF-8"));
|
||||||
|
boolean isInSection = false;
|
||||||
|
fileContent = "";
|
||||||
|
try {
|
||||||
|
while ((allLine = bufferedReader.readLine()) != null) {
|
||||||
|
allLine = allLine.trim();
|
||||||
|
// System.out.println("allLine == "+allLine);
|
||||||
|
strLine = allLine;
|
||||||
|
Pattern p;
|
||||||
|
Matcher m;
|
||||||
|
p = Pattern.compile("\\[" + section + "\\]");
|
||||||
|
m = p.matcher((strLine));
|
||||||
|
// System.out.println("+++++++ ");
|
||||||
|
if (m.matches()) {
|
||||||
|
// System.out.println("+++++++ ");
|
||||||
|
p = Pattern.compile("\\[" + section + "\\]");
|
||||||
|
m = p.matcher(strLine);
|
||||||
|
if (m.matches()) {
|
||||||
|
// System.out.println("true ");
|
||||||
|
isInSection = true;
|
||||||
|
} else {
|
||||||
|
isInSection = false;
|
||||||
|
// System.out.println("+++++++ ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isInSection == true) {
|
||||||
|
strLine = strLine.trim();
|
||||||
|
String[] strArray = strLine.split("=");
|
||||||
|
getValue = strArray[0].trim();
|
||||||
|
if (getValue.equalsIgnoreCase(name)) {
|
||||||
|
// newLine = getValue + " = " + value + " " + remarkStr;
|
||||||
|
newLine = getValue + " = " + value + " ";
|
||||||
|
fileContent += newLine + "\r\n";
|
||||||
|
while ((allLine = bufferedReader.readLine()) != null) {
|
||||||
|
fileContent += allLine + "\r\n";
|
||||||
|
}
|
||||||
|
bufferedReader.close();
|
||||||
|
BufferedWriter bufferedWriter = new BufferedWriter(
|
||||||
|
new OutputStreamWriter(new FileOutputStream(this.filename, false), "UTF-8"));// new
|
||||||
|
// BufferedWriter(new
|
||||||
|
// FileWriter(this.filename,
|
||||||
|
// false));
|
||||||
|
bufferedWriter.write(fileContent);
|
||||||
|
bufferedWriter.flush();
|
||||||
|
bufferedWriter.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileContent += allLine + "\r\n";
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(this, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(this, e);
|
||||||
|
} finally {
|
||||||
|
bufferedReader.close();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 篮子内容 货篮编号 商品编号 商品数量 订单中每个商品的数目之和 --
|
||||||
|
***/
|
||||||
|
public class Item implements Serializable {
|
||||||
|
private static final long serialVersionUID = -8734910537221017378L;
|
||||||
|
public String basket_code;// 货篮编号
|
||||||
|
public String commodity_code;// 商品编号
|
||||||
|
public int quantity;// 商品数量
|
||||||
|
public int t_num;// 订单中每个商品的数目之和
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class MsgInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = -93302054824300373L;
|
||||||
|
public String topic;
|
||||||
|
public long tid;
|
||||||
|
public String seller_nick;
|
||||||
|
public int exception_record;
|
||||||
|
|
||||||
|
public MsgInfo(String topic, long tid, String seller_nick, int exception_record) {
|
||||||
|
this.topic = topic;
|
||||||
|
this.tid = tid;
|
||||||
|
this.seller_nick = seller_nick;
|
||||||
|
this.exception_record = exception_record;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
/**
|
||||||
|
* Copyright @ 2014 ChinaPcd Co. Ltd.
|
||||||
|
* All rights reserved.
|
||||||
|
* @author: Carl
|
||||||
|
* date: 2014-09-11
|
||||||
|
*/
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OrderInfo 淘宝订单信息类
|
||||||
|
*/
|
||||||
|
public class OrderInfo implements Serializable {
|
||||||
|
static final long serialVersionUID = -8084210473720589252L;
|
||||||
|
public String commodity_code = "";// 软维平台生成的商品编码
|
||||||
|
public String platform_seller_code = "";// 用户录入商品编码
|
||||||
|
|
||||||
|
public String cid;// 交易商品对应的类目ID
|
||||||
|
public String adjust_fee;// 手工调整金额.格式为:1.01;单位:元;精确到小数点后两位
|
||||||
|
public boolean buyer_rate;// 买家是否已评价。可选值:true(已评价),false(未评价)
|
||||||
|
public String discount_fee;// 子订单级订单优惠金额。精确到2位小数;单位:元。如:200.07,表示:200元7分
|
||||||
|
public int num;// 购买数量。取值范围:大于零的整数
|
||||||
|
public String num_iid;// 商品数字ID
|
||||||
|
public String oid;// 子订单编号
|
||||||
|
public String outer_iid;// 商家外部编码(可与商家外部系统对接)。外部商家自己定义的商品Item的id,可以通过taobao.items.custom.get获取商品的Item的信息
|
||||||
|
public String outer_sku_id;// 外部网店自己定义的Sku编号
|
||||||
|
public String payment;// 子订单实付金额。精确到2位小数,单位:元。如:200.07,表示:200元7分。对于多子订单的交易,计算公式如下:payment
|
||||||
|
// = price * num + adjust_fee - discount_fee
|
||||||
|
// ;单子订单交易,payment与主订单的payment一致,对于退款成功的子订单,由于主订单的优惠分摊金额,会造成该字段可能不为0.00元。建议使用退款前的实付金额减去退款单中的实际退款金额计算。
|
||||||
|
public String pic_path;// 商品图片的绝对路径
|
||||||
|
public String price;// 商品价格。精确到2位小数;单位:元。如:200.07,表示:200元7分
|
||||||
|
public String refund_status;// 退款状态。退款状态。可选值
|
||||||
|
// WAIT_SELLER_AGREE(买家已经申请退款,等待卖家同意)
|
||||||
|
// WAIT_BUYER_RETURN_GOODS(卖家已经同意退款,等待买家退货)
|
||||||
|
// WAIT_SELLER_CONFIRM_GOODS(买家已经退货,等待卖家确认收货)
|
||||||
|
// SELLER_REFUSE_BUYER(卖家拒绝退款) CLOSED(退款关闭)
|
||||||
|
// SUCCESS(退款成功)
|
||||||
|
public boolean seller_rate;// 卖家是否已评价。可选值:true(已评价),false(未评价)
|
||||||
|
public String seller_type;// 卖家类型,可选值为:B(商城商家),C(普通卖家)
|
||||||
|
// public String sku_id;// 商品的最小库存单位Sku的id.可以通过taobao.item.sku.get获取详细的Sku信息
|
||||||
|
public String sku_properties_name;// SKU的值。如:机身颜色:黑色;手机套餐:官方标配
|
||||||
|
|
||||||
|
public String productItemID_dd;// 商品明细编码(只用于当当)
|
||||||
|
public String sku_id;// 商品标识码
|
||||||
|
/*
|
||||||
|
* 订单状态(请关注此状态,如果为TRADE_CLOSED_BY_TAOBAO状态,则不要对此订单进行发货,切记啊!)。可选值:
|
||||||
|
* TRADE_NO_CREATE_PAY(没有创建支付宝交易) WAIT_BUYER_PAY(等待买家付款)
|
||||||
|
* WAIT_SELLER_SEND_GOODS(等待卖家发货,即:买家已付款)
|
||||||
|
* WAIT_BUYER_CONFIRM_GOODS(等待买家确认收货,即:卖家已发货) TRADE_BUYER_SIGNED(买家已签收,货到付款专用)
|
||||||
|
* TRADE_FINISHED(交易成功) TRADE_CLOSED(付款以后用户退款成功,交易自动关闭)
|
||||||
|
* TRADE_CLOSED_BY_TAOBAO(付款以前,卖家或买家主动关闭交易) PAY_PENDING(国际信用卡支付付款确认中)
|
||||||
|
*/
|
||||||
|
public int gift_type;// 1为商品,2为赠品
|
||||||
|
public int commodity_class;// 种类(1:单品 2:组合 3:配件)
|
||||||
|
public String status;
|
||||||
|
public String title;// 商品标题
|
||||||
|
public String total_fee;// 应付金额(商品价格 * 商品数量 + 手工调整金额 -
|
||||||
|
// 子订单级订单优惠金额)。精确到2位小数;单位:元。如:200.07,表示:200元7分,<只计算商品级的优惠,不计算订单级的优惠>
|
||||||
|
|
||||||
|
public String divide_order_fee = "0.0";// 分摊之后的实付金额
|
||||||
|
public String part_mjz_discount = "0.0";// 优惠分摊
|
||||||
|
|
||||||
|
// 赠品相关字段
|
||||||
|
/*
|
||||||
|
* public Boolean f; public String seq_fit_rules; public String o1g1_fit_rules;
|
||||||
|
* public String order_limit_fit_rules; public String booleanContinue; public
|
||||||
|
* int delivery_type_id; public int gift_num; public int n;
|
||||||
|
*/
|
||||||
|
// 天猫供销平台中的子订单中客户订单信息
|
||||||
|
public String order_200_status; // 例如:PAID_SEND_GOODS代销采购单对应下游200订单状态。可选值:WAIT_SELLER_SEND_GOODS(已付款,待发货)WAIT_BUYER_CONFIRM_GOODS(已付款,已发货)TRADE_CLOSED(已退款成功)TRADE_REFUNDING(退款中)TRADE_FINISHED(交易成功)TRADE_CLOSED_BY_TAOBAO(交易关闭)
|
||||||
|
public String order_buyer_payment; // 例如:200.07买家订单上对应的子单零售金额,除以num(数量)后等于最终宝贝的零售价格(精确到2位小数;单位:元。如:200.07,表示:200元7分)
|
||||||
|
public String order_tc_discount_fee; // 例如:1000优惠金额,始终为正数,单位是分,不带小数
|
||||||
|
public String order_tc_adjust_fee; // 例如:1000商品的卖出金额调整,金额增加时为正数,金额减少时为负数,单位是分,不带小数
|
||||||
|
public String order_discount_fee; // 例如:11.11优惠活动的折扣金额
|
||||||
|
|
||||||
|
public String obm_commodity_code;// 经销商商品对应的品牌商商品编码
|
||||||
|
public int agent_type;// 商品代发类型,1为自发,2为代发
|
||||||
|
public String obm_company_code;// 代发商品查询到的代发品牌商公司编码
|
||||||
|
// public String obm_storage_code;//代发商品查询到的代发品牌商公司默认代发发货仓库
|
||||||
|
public String storage_code;// 自发商品查询到经销商发货仓库
|
||||||
|
public int order_type;// 1:经销商自发商品,2:品牌商自发商品,3:品牌商全部代发的商品,4:混合订单中经销商自发的商品,5:混合订单中品牌商代发的商品
|
||||||
|
public String delivery_area_setting;// 分区配送设置
|
||||||
|
|
||||||
|
public int smart_allot_storage_flag;// 是否参与智能分仓,1:参与,2:不参与
|
||||||
|
public int zongshuliang;// 可用数量
|
||||||
|
public String rule_code;// 满足的规则编码
|
||||||
|
public String gift_activity_code;// 满足的活动编码
|
||||||
|
public int gift_copies;//赠品份数
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 串行化为了实现对于tradeInfo的深拷贝,对于object的clone()方式对于tradeInfo下面的orderInfo为浅拷贝,因此选用串行化方式实现深拷贝
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public Object deepClone() throws Exception {
|
||||||
|
// save the object to a byte array
|
||||||
|
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(bout);
|
||||||
|
out.writeObject(this);
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
// read a clone of the object from byte array
|
||||||
|
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
|
||||||
|
ObjectInputStream in = new ObjectInputStream(bin);
|
||||||
|
Object ret = in.readObject();
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台补抓单参数类 天猫,一号店,国美,当当
|
||||||
|
*/
|
||||||
|
public class RecatchConfig implements Serializable {
|
||||||
|
private static final long serialVersionUID = 7522341143484535471L;
|
||||||
|
public String starTime;// 开始时间
|
||||||
|
public String endTime;// 结束时间
|
||||||
|
public String orderId;// 订单id
|
||||||
|
public String shop_code;// 店铺编码
|
||||||
|
public String platform_code;// 平台编码
|
||||||
|
// public String real_platform_code;
|
||||||
|
public String shopCodes;
|
||||||
|
public String hour;
|
||||||
|
public String minute;
|
||||||
|
public String platform_account;
|
||||||
|
public int type;// 默认值0:抓单程序或者后台补抓单,1:按单号补抓,2:导入文件,3:按时间段补抓 4:用户时间段
|
||||||
|
public int once_max_replenish_order_count;
|
||||||
|
public String replenish_code;// 补抓条目编号
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RecatchConfig [starTime=" + starTime + ", endTime=" + endTime + ", orderId=" + orderId + ", shop_code="
|
||||||
|
+ shop_code + ", platform_code=" + platform_code
|
||||||
|
+ ", shopCodes=" + shopCodes + ", hour=" + hour + ", minute=" + minute + ", platform_account="
|
||||||
|
+ platform_account + ", type=" + type + ", once_max_replenish_order_count="
|
||||||
|
+ once_max_replenish_order_count + ", replenish_code=" + replenish_code + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动登记售后参数类
|
||||||
|
*
|
||||||
|
* @author Lewis
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RefundInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = -8794022937042793540L;
|
||||||
|
public String tid;// 退款单对应的销售单订单编码
|
||||||
|
public String refund_id;// 退款单编码
|
||||||
|
public int bill_type;// 退款类型:可用值为:1:退款2:退货3:换货
|
||||||
|
public String reason;// 退款原因
|
||||||
|
public String shop_code;// 店铺编码
|
||||||
|
public String company_code;// 企业编码
|
||||||
|
public int company_type;// 企业类型1:后台管理公司,2:经销商,3:供应商
|
||||||
|
public String desc;// 用户退货描述
|
||||||
|
public String return_delivery_code;// 退货的快递单号
|
||||||
|
public int after_sales_status;//售后状态 1:全部 2:买家申请退款,待商家处理 3:退货退款,待商家处理 ,仅适用于拼多多
|
||||||
|
public String platform_code;
|
||||||
|
public long create_time;
|
||||||
|
public double refund_fee;//退还金额(退还给买家的金额)。
|
||||||
|
public int sub_refund_type;//子订单退款或者全单退款,1:全单退款,2:子订单退款
|
||||||
|
|
||||||
|
public String toJsonString(){
|
||||||
|
String jsonString = JSON.toJSONString(this);
|
||||||
|
return jsonString;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class RefundMsgInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = -954000108417789022L;
|
||||||
|
public String topic;
|
||||||
|
public long tid;
|
||||||
|
public String seller_nick;
|
||||||
|
public long refund_id;
|
||||||
|
public String bill_type;
|
||||||
|
|
||||||
|
public RefundMsgInfo(String topic, long tid, String seller_nick, long refund_id, String bill_type) {
|
||||||
|
this.topic = topic;
|
||||||
|
this.tid = tid;
|
||||||
|
this.seller_nick = seller_nick;
|
||||||
|
this.refund_id = refund_id;
|
||||||
|
this.bill_type = bill_type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class RefundOrder implements Serializable {
|
||||||
|
private static final long serialVersionUID = 763843280098046389L;
|
||||||
|
public String saleOrderCode;//系统订单号
|
||||||
|
public int orderStatus;//订单状态
|
||||||
|
public int aftersaleSeq;//售后次序,每次售后累加
|
||||||
|
public int entrustType;//委外类型
|
||||||
|
public String obmCompanyCode;//品牌商企业编码
|
||||||
|
public String companyCode;//经销商品牌编码
|
||||||
|
public String storageCode;//仓库编码
|
||||||
|
public int checkFlag;// 是否检测 1:未检测 2:已检测
|
||||||
|
public int autoRefundFlag;// 是否开启自动退款 1:不是 2:是
|
||||||
|
public int aftersaleNumber;//售后订单数量
|
||||||
|
public String lastAftersaleOrderCode;//销售单-最后一次有效售后单号
|
||||||
|
public double pay_money;//订单实付总金额
|
||||||
|
public String storageOutOrderCode;//出库单编码
|
||||||
|
public String lockNote;//订单锁定原因
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class ReplenishInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 9208877117316339188L;
|
||||||
|
public boolean original_trade;// 是否为订单行(对比只有商品的子条目行)
|
||||||
|
public String error_msg;// 错误信息
|
||||||
|
public boolean error_flag;// 改行或该单的上面某行有错误
|
||||||
|
public int row_num;// 行号
|
||||||
|
public int location;
|
||||||
|
public int shopid;
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* ---------------------------------活动规则------------------------------------ --
|
||||||
|
***/
|
||||||
|
public class Rule implements Serializable {
|
||||||
|
private static final long serialVersionUID = -6560085675638948402L;
|
||||||
|
public String activity_name;// 活动名称
|
||||||
|
public String activity_shop_code;// 活动店铺编码
|
||||||
|
public String activity_company_code;// 活动企业编码
|
||||||
|
public String activity_begin_time;// 活动开始时间
|
||||||
|
public String activity_end_time;// 活动结束时间
|
||||||
|
public String gift_activity_code;// 活动编码
|
||||||
|
public String rule_code;// 规则编码
|
||||||
|
public String rule_name;// 规则名称
|
||||||
|
public int rule_seq;// 排序
|
||||||
|
public String rule_apply_object;// 适用对象,1:订单(默认) 2:商品
|
||||||
|
public int rule_pre_sale_flag;// 预售标志,1:全部(默认) 2:非预售 3:预售
|
||||||
|
public String rule_pay_money;// 订单金额
|
||||||
|
// TODO 新添加字段
|
||||||
|
public String rule_promotion_mode;// 促销方式:1:任意多件 2:指定搭配,0:无(默认)new
|
||||||
|
public String rule_any_commodity;// 任意多件_商品范围new
|
||||||
|
public String rule_any_number;// 任意多件_购买件数new
|
||||||
|
public String rule_appoint_commodity;// 指定搭配_商品范围及数量new
|
||||||
|
public String rule_gift_mode;// 赠送方式,0:无(默认) 1:快递 2:商品
|
||||||
|
public int rule_delivery_type_id;// 快递公司编码
|
||||||
|
public String rule_superposition_mode;// 叠加方式:1:否(默认),2:是new
|
||||||
|
public String rule_gift_limit_condition;// 限额条件:1:不限(默认) 2:订单,3:赠品 new
|
||||||
|
// public String rule_check_mode;// 判断模式?
|
||||||
|
// public String rule_commodity_code;// 商品编码?
|
||||||
|
// public String rule_gift_code;// 赠品编码?
|
||||||
|
// public String rule_gift_limit;// 礼品总数?
|
||||||
|
// public String rule_order_limit;// 订单总数?
|
||||||
|
public String rule_limit_number;// 限额总数new
|
||||||
|
public int rule_gift_current;// 已送礼品数
|
||||||
|
public int rule_order_current;// 当前订单数
|
||||||
|
public int rule_presell_sort;// 预售排序:1:付定金时间,2:付尾款时间 new
|
||||||
|
public String rule_gift_commodity;// 赠送商品
|
||||||
|
public String rule_presell_begin_time;// 预售开始时间
|
||||||
|
public String rule_presell_end_time;// 预售结束时间
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步策略信息类
|
||||||
|
*
|
||||||
|
* @author Lewis
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ShopCommodityConfig implements Serializable {
|
||||||
|
private static final long serialVersionUID = 6894961805863876040L;
|
||||||
|
public int quantity;
|
||||||
|
public float percent;
|
||||||
|
public int formula;
|
||||||
|
public int onpassage_flag;
|
||||||
|
public int min_syn_quantity;// 人工设置的最小同步数量
|
||||||
|
public String storageCodes;
|
||||||
|
public String app_key;
|
||||||
|
public String app_secret;
|
||||||
|
public String session_key;
|
||||||
|
public String shop_name;
|
||||||
|
public String platform_code;
|
||||||
|
public String platform_seller_code;
|
||||||
|
public String sync_lock_end_time;//库存同步锁定截止时间
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺信息汇总类
|
||||||
|
*
|
||||||
|
* @author Lewis
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ShopMessage implements Serializable {
|
||||||
|
private static final long serialVersionUID = -2177033669251125170L;
|
||||||
|
private int order_sync_lock_flag;//抓单锁定 1:关,2:开
|
||||||
|
private String order_sync_lock_keyword;//抓单锁定商品标题关键字
|
||||||
|
public int getOrder_sync_lock_flag() {
|
||||||
|
return order_sync_lock_flag;
|
||||||
|
}
|
||||||
|
public void setOrder_sync_lock_flag(int order_sync_lock_flag) {
|
||||||
|
this.order_sync_lock_flag = order_sync_lock_flag;
|
||||||
|
}
|
||||||
|
public String getOrder_sync_lock_keyword() {
|
||||||
|
return order_sync_lock_keyword;
|
||||||
|
}
|
||||||
|
public void setOrder_sync_lock_keyword(String order_sync_lock_keyword) {
|
||||||
|
this.order_sync_lock_keyword = order_sync_lock_keyword;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.since.emp.service.OrderSyncs.ShopConfig;
|
||||||
|
|
||||||
|
public class ShopOrderInfo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 658110795213931035L;
|
||||||
|
public String tid;
|
||||||
|
public String app_key;
|
||||||
|
public String app_secret;
|
||||||
|
public ShopConfig shopConfig;
|
||||||
|
public String refundId;
|
||||||
|
|
||||||
|
public ShopOrderInfo(String tid, ShopConfig shopConfig, String app_key, String app_secret) {
|
||||||
|
this.tid = tid;
|
||||||
|
this.shopConfig = shopConfig;
|
||||||
|
this.app_key = app_key;
|
||||||
|
this.app_secret = app_secret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ShopOrderInfo [tid=" + tid + ", app_key=" + app_key + ", app_secret=" + app_secret + ", shopConfig="
|
||||||
|
+ shopConfig + ", refundId=" + refundId + "]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,197 @@
|
||||||
|
/**
|
||||||
|
* Copyright @ 2014 ChinaPcd Co. Ltd.
|
||||||
|
* All rights reserved.
|
||||||
|
* @author: Carl
|
||||||
|
* date: 2014-09-11
|
||||||
|
*/
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TradeInfo 淘宝交易信息类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TradeInfo implements Serializable {
|
||||||
|
static final long serialVersionUID = -8084210473720589252L;
|
||||||
|
public int retry_times = 0; // 重试次数
|
||||||
|
public int pay_mode_id = 14; // 支付方式
|
||||||
|
public String platform_modify_time;
|
||||||
|
public String invoice_title;
|
||||||
|
public String invoice_content;
|
||||||
|
public String invoice_taxmsg = "";
|
||||||
|
public String invoice_money = "0";
|
||||||
|
public int invoice_type = 0;// 0:无票,1:旧版普票,2:新版普票,3:增票,4:电子发票
|
||||||
|
public String invoice_email;
|
||||||
|
public String invoice_phone;
|
||||||
|
public String tax_id;// 纳税人识别号
|
||||||
|
public String bank_of_deposit_account_number;// 开户行及账号(增票)
|
||||||
|
public String address_telephone;// 地址及电话(增票)
|
||||||
|
|
||||||
|
public String money;// 商家实收金额
|
||||||
|
public String pay_money;// 买家实付金额
|
||||||
|
public String product_fee;// 商品金额
|
||||||
|
public String discount_fee;// 系统优惠金额(如打折,VIP,满就送等),精确到2位小数,单位:元。如:200.07,表示:200元7分。建议使用trade.promotion_details查询系统优惠
|
||||||
|
public String post_fee;// 邮费。精确到2位小数;单位:元。如:200.07,表示:200元7分
|
||||||
|
|
||||||
|
public String adjust_fee;// 卖家手工调整金额,精确到2位小数,单位:元。如:200.07,表示:200元7分。来源于订单价格修改,如果有多笔子订单的时候,这个为0,单笔的话则跟[order].adjust_fee一样
|
||||||
|
public String buyer_nick;// 买家昵称
|
||||||
|
public int buyer_obtain_point_fee;// 买家获得积分,返点的积分。格式:100;单位:个。返点的积分要交易成功之后才能获得。
|
||||||
|
public boolean buyer_rate;// 买家是否已评价。可选值:true(已评价),false(未评价)。如买家只评价未打分,此字段仍返回false
|
||||||
|
public String cod_fee;// 货到付款服务费。精确到2位小数;单位:元。如:12.07,表示:12元7分。
|
||||||
|
public String cod_status;// 货到付款物流状态。 初始状态 NEW_CREATED, 接单成功
|
||||||
|
// ACCEPTED_BY_COMPANY, 接单失败
|
||||||
|
// REJECTED_BY_COMPANY, 接单超时 RECIEVE_TIMEOUT,
|
||||||
|
// 揽收成功 TAKEN_IN_SUCCESS, 揽收失败 TAKEN_IN_FAILED,
|
||||||
|
// 揽收超时 TAKEN_TIMEOUT, 签收成功 SIGN_IN, 签收失败
|
||||||
|
// REJECTED_BY_OTHER_SIDE, 订单等待发送给物流公司
|
||||||
|
// WAITING_TO_BE_SENT, 用户取消物流订单 CANCELED
|
||||||
|
public String created;// 交易创建时间。格式:yyyy-MM-dd HH:mm:ss
|
||||||
|
public String modified;// 交易修改时间(用户对订单的任何修改都会更新此字段)。格式:yyyy-MM-dd HH:mm:ss
|
||||||
|
public OrderInfo[] orders;// 订单,所购商品集合,是一个OrderInfo对象的数组。
|
||||||
|
//public String preOrders;// 定金预售阶段单,所购商品集合,是一个OrderInfo对象的数组。
|
||||||
|
public String pay_time;// 付款时间。格式:yyyy-MM-dd HH:mm:ss。订单的付款时间即为物流订单的创建时间。
|
||||||
|
public int point_fee;// 买家使用积分,下单时生成,且一直不变。格式:100;单位:个.
|
||||||
|
public int real_point_fee;// 买家实际使用积分(扣除部分退款使用的积分),交易完成后生成(交易成功或关闭),交易未完成时该字段值为0。格式:100;单位:个
|
||||||
|
public String received_payment;// 卖家实际收到的支付宝打款金额(由于子订单可以部分确认收货,这个金额会随着子订单的确认收货而不断增加,交易成功后等于买家实付款减去退款金额)。精确到2位小数;单位:元。如:200.07,表示:200元7分
|
||||||
|
public String receiver_address;// 收货人的详细地址
|
||||||
|
public String receiver_city;// 收货人的所在城市
|
||||||
|
public String receiver_district;// 收货人的所在地区
|
||||||
|
/*
|
||||||
|
* 注:因为国家对于城市和地区的划分的有:省直辖市和省直辖县级行政区(区级别的)划分的, 淘宝这边根据这个差异保存在不同字段里面
|
||||||
|
* 比如:广东广州:广州属于一个直辖市是放在的receiver_city的字段里面;
|
||||||
|
* 而河南济源:济源属于省直辖县级行政区划分,是区级别的,放在了receiver_district里面
|
||||||
|
* 建议:程序依赖于城市字段做物流等判断的操作,最好加一个判断逻辑: 如果返回值里面只有receiver_district参数,该参数作为城市
|
||||||
|
*/
|
||||||
|
public String receiver_mobile;// 收货人的手机号码
|
||||||
|
public String receiver_name;// 收货人的姓名
|
||||||
|
public String receiver_phone;// 收货人的电话号码
|
||||||
|
public String receiver_state;// 收货人的所在省份
|
||||||
|
public String receiver_country;// 收货人的所在国家
|
||||||
|
public String receiver_zip;// 收货人的邮编
|
||||||
|
public String seller_nick;// 卖家昵称
|
||||||
|
public boolean seller_rate;// 卖家是否已评价。可选值:true(已评价),false(未评价)
|
||||||
|
public String shipping_type;// 创建交易时的物流方式(交易完成前,物流方式有可能改变,但系统里的这个字段一直不变)。可选值:free(卖家包邮),post(平邮),express(快递),ems(EMS),virtual(虚拟发货),25(次日必达),26(预约配送)。
|
||||||
|
public String sid;// 未知,大概与tid交易编号一致。
|
||||||
|
public String status;// 交易状态。可选值:
|
||||||
|
public String orderStatusName;// 订单状态名称(微盟专用)
|
||||||
|
|
||||||
|
public String tid;// 交易编号 (父订单的交易编号)
|
||||||
|
public String title;// 交易标题,以店铺名作为此标题的值。注:taobao.trades.get接口返回的Trade中的title是商品名称
|
||||||
|
public String type;// 交易类型列表,同时查询多种交易类型可用逗号分隔。默认同时查询guarantee_trade,
|
||||||
|
|
||||||
|
public int num;// 商品购买数量。取值范围:大于零的整数,对于一个trade对应多个order的时候(一笔主订单,对应多笔子订单),num=0,num是一个跟商品关联的属性,一笔订单对应多比子订单的时候,主订单上的num无意义。
|
||||||
|
public String alipay_no;// 平台流水号,如:2009112081173831
|
||||||
|
public String alipay_id;// 支付宝交易账号,如:2009112081173831
|
||||||
|
public boolean has_post_fee;// 是否包含邮费。与available_confirm_fee同时使用。可选值:true(包含),false(不包含)
|
||||||
|
public boolean has_buyer_message;// 是否有买家留言
|
||||||
|
public String buyer_message = "";// 买家留言
|
||||||
|
public String seller_memo = "";// 商家备注
|
||||||
|
public String buyer_memo;// 买家备注(与淘宝网上订单的买家备注对应,只有买家才能查看该字段)
|
||||||
|
|
||||||
|
public String trade_type;// 天猫推送消息的topic类型
|
||||||
|
public double pay_percent;// 计提应付百分比`
|
||||||
|
|
||||||
|
public String company_code;// 企业编号
|
||||||
|
public String shop_code;// 店铺编号
|
||||||
|
public String brand = "";// 默认品牌名称中文
|
||||||
|
public String platform_code;// 平台编号(001:淘宝,002:天猫,003:京东,004:一号店,005:当当,006:国美,007:苏宁,008:亚马逊)
|
||||||
|
|
||||||
|
public String step_trade_status;// 分阶段付款状态
|
||||||
|
public int delivery_mode_id;// 默认快递发货方式
|
||||||
|
public String storage_code;// 默认发货仓库
|
||||||
|
|
||||||
|
public String encrpy_buyer_nick_name;// 加密的昵称
|
||||||
|
public String encrpy_name;// 加密的名字
|
||||||
|
public String encrpy_mobile;// 加密的手机
|
||||||
|
public String encrpy_telephone;// 加密的电话
|
||||||
|
public String encrpy_address;// 加密的地址
|
||||||
|
|
||||||
|
|
||||||
|
public String encrypt_invoice_title;//加密的发票抬头
|
||||||
|
public String encrypt_invoice_email;//加密的发票接收邮箱
|
||||||
|
public String encrypt_invoice_phone;//加密的发票接收电话
|
||||||
|
public String bank_of_deposit;//开户行
|
||||||
|
public String encrypt_bank_account;//银行账号
|
||||||
|
|
||||||
|
|
||||||
|
public int seller_flag;// 商家插旗标志
|
||||||
|
public int entrust_type;// oms订单类型1:正常订单,2:oms订单
|
||||||
|
public String entrust_time;// oms订单抓单时间
|
||||||
|
|
||||||
|
public int obm_flag;// 订单是否为代发,0为自发,1为代发,2为混合
|
||||||
|
public String obm_company_code;// 品牌商公司编码,只有代发订单有值
|
||||||
|
public int company_type;// 企业类型,1:平台管理公司,2:普通用户公司 3:品牌商公司
|
||||||
|
public HashMap<String, String> obm_company_code_map;// 代发品牌商公司编码map集合
|
||||||
|
|
||||||
|
public boolean omsOwnFlag;// 是否为品牌商自有店铺
|
||||||
|
public FenxiaoInfo fenxiaoInfo;// 针对于天猫供销平台的参数类
|
||||||
|
public boolean null_code;// 如果订单中有商品编码为空,则为true,表明订单只能走标准模式,而不考虑用户的设置
|
||||||
|
public String trade_key;// 拆单用于记录是否是同一单,原单此字段写“原订单”,拆分订单写公司编码(品牌商,经销商)+"_ts"+仓库编码
|
||||||
|
public HashMap<String, ArrayList<Commodity>> storage_map;// 拆分订单用来存储仓库可以发货哪些商品,key是公司编码(品牌商或经销商),value是商品信息
|
||||||
|
|
||||||
|
public String test_flag = "";// 是否是测试订单(导入订单有值)
|
||||||
|
public int row_num;// 导入订单在Excel表的行号
|
||||||
|
public int trade_type2;// 订单写入的类型,默认0为正常抓单,1:按照单号写入,2:导入文件,3:按照时间段抓取
|
||||||
|
public String replenish_code;// 补录单单号
|
||||||
|
public String out_path;// 文件路径
|
||||||
|
public String export_file_path;
|
||||||
|
|
||||||
|
public int smart_allot_storage_flag;// 是否参与智能分仓,1:参与,2:不参与
|
||||||
|
public int zongshuliang;// 可用数量
|
||||||
|
public ShopMessage shopMessage;//订单需要用到的店铺信息,之前的店铺直接卸载TradeInfo里面的,暂时不动
|
||||||
|
|
||||||
|
public boolean delFlag;//订单写入库的时候是否标记为删除状态,true为删除
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 该单是否做正常,true为正常,false为异常,只有该字段和tid字段可用,需根据tid字段重新查询订单信息
|
||||||
|
*/
|
||||||
|
public Boolean is_success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入文件的模式
|
||||||
|
* 1:简易模式
|
||||||
|
* 2:标准模式
|
||||||
|
* 3:滴滴订单
|
||||||
|
*/
|
||||||
|
public int templateStatus;
|
||||||
|
|
||||||
|
//解码OAID(Open Addressee ID),收件人信息(淘宝平台)
|
||||||
|
public String oaid;
|
||||||
|
|
||||||
|
public String csvOrderNumber;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 串行化为了实现对于tradeInfo的深拷贝,对于object的clone()方式对于tradeInfo下面的orderInfo为浅拷贝,因此选用串行化方式实现深拷贝
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public Object deepClone() throws Exception {
|
||||||
|
// save the object to a byte array
|
||||||
|
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(bout);
|
||||||
|
out.writeObject(this);
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
// read a clone of the object from byte array
|
||||||
|
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
|
||||||
|
ObjectInputStream in = new ObjectInputStream(bin);
|
||||||
|
Object ret = in.readObject();
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负面评价实体类
|
||||||
|
*
|
||||||
|
* @author Lewis
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TraderateInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = -4850169061434893651L;
|
||||||
|
public String tid;
|
||||||
|
public String shop_code;
|
||||||
|
public String buyer_nick;
|
||||||
|
public String rate_type;// 评价的类型
|
||||||
|
public int add_flag;// 1:初次评价,2:追评
|
||||||
|
public long num_iid;
|
||||||
|
public String item_title;
|
||||||
|
public String rate_content;
|
||||||
|
public String key_word;
|
||||||
|
public String company_code;
|
||||||
|
public String rate_time;
|
||||||
|
}
|
|
@ -0,0 +1,249 @@
|
||||||
|
package com.since.emp.base;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.cert.CertificateException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import javax.net.ssl.HostnameVerifier;
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSession;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import com.since.emp.service.OrderSyncs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @className:YchClient
|
||||||
|
* @description:御城河客户端
|
||||||
|
* @author:Sunshine
|
||||||
|
* @date:2019年10月16日 上午10:01:33
|
||||||
|
*/
|
||||||
|
public class YchClient {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(YchClient.class);
|
||||||
|
|
||||||
|
private String appkey;
|
||||||
|
|
||||||
|
private String secret;
|
||||||
|
|
||||||
|
private class TrustAllTrustManager implements X509TrustManager {
|
||||||
|
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public YchClient(String appkey, String secret) {
|
||||||
|
this.appkey = appkey;
|
||||||
|
this.secret = secret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String send(String url, TreeMap<String, String> params) {
|
||||||
|
if (appkey == null || appkey.length() == 0
|
||||||
|
|| secret == null || secret.length() == 0
|
||||||
|
|| url == null || url.length() == 0
|
||||||
|
|| params == null || params.size() == 0) {
|
||||||
|
return "Parameter error.";
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> keys = params.keySet();
|
||||||
|
|
||||||
|
for (String key : keys) {
|
||||||
|
String value = params.get(key);
|
||||||
|
|
||||||
|
if (value == null || value.equalsIgnoreCase("null")) {
|
||||||
|
return key + " is null.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
params.put("appKey", appkey);
|
||||||
|
|
||||||
|
return doPost(url, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String doPost(String url, TreeMap<String, String> params) {
|
||||||
|
|
||||||
|
String queryString = getSignedUrl(secret, params);
|
||||||
|
|
||||||
|
if (queryString == null || queryString.length() == 0) {
|
||||||
|
return "getSignedUrl error.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return sendRequest(url, queryString);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSignedUrl(String appSecret, TreeMap<String, String> paramMap) {
|
||||||
|
String sign = getSignature(appSecret, paramMap);
|
||||||
|
StringBuilder query = new StringBuilder();
|
||||||
|
|
||||||
|
for (Entry<String, String> en : paramMap.entrySet()) {
|
||||||
|
query.append(en.getKey());
|
||||||
|
query.append("=");
|
||||||
|
try {
|
||||||
|
if (en.getValue() != null && en.getValue().length() > 0) {
|
||||||
|
query.append(URLEncoder.encode(en.getValue(), "UTF-8"));
|
||||||
|
}
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
LOGGER.info("御城河订单日志提交|getSignedUrl throw error:{}", e.getMessage());
|
||||||
|
}
|
||||||
|
query.append("&");
|
||||||
|
}
|
||||||
|
|
||||||
|
query.append("sign=");
|
||||||
|
query.append(sign);
|
||||||
|
|
||||||
|
return query.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSignature(String appSecret, TreeMap<String, String> paramMap) {
|
||||||
|
try {
|
||||||
|
if (paramMap == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder combineString = new StringBuilder();
|
||||||
|
combineString.append(appSecret);
|
||||||
|
Set<Entry<String, String>> entrySet = paramMap.entrySet();
|
||||||
|
|
||||||
|
for (Entry<String, String> entry : entrySet) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
|
||||||
|
if (key != null && key.length() > 0) {
|
||||||
|
combineString.append(key);
|
||||||
|
String vaule = entry.getValue();
|
||||||
|
|
||||||
|
if (vaule != null && vaule.length() > 0) {
|
||||||
|
combineString.append(vaule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
combineString.append(appSecret);
|
||||||
|
|
||||||
|
byte[] bytesOfMessage = combineString.toString().getBytes("UTF-8");
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
byte[] thedigest = md.digest(bytesOfMessage);
|
||||||
|
String signature = bytesToHexString(thedigest);
|
||||||
|
|
||||||
|
return signature;
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.info(String.format("御城河订单日志提交|generate sign exception:{}",e.getMessage()));
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String bytesToHexString(byte[] src) {
|
||||||
|
try {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder("");
|
||||||
|
|
||||||
|
if (src == null || src.length <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < src.length; i++) {
|
||||||
|
int v = src[i] & 0xFF;
|
||||||
|
String hv = Integer.toHexString(v);
|
||||||
|
|
||||||
|
if (hv.length() < 2) {
|
||||||
|
stringBuilder.append(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(hv);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stringBuilder.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sendRequest(String path, String query) {
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
URL url;
|
||||||
|
HttpURLConnection conn;
|
||||||
|
OutputStreamWriter out = null;
|
||||||
|
BufferedReader rd;
|
||||||
|
String line;
|
||||||
|
|
||||||
|
final int connectTimeout = 5000;
|
||||||
|
final int readTimeout = 15000;
|
||||||
|
|
||||||
|
try {
|
||||||
|
url = new URL(path);
|
||||||
|
conn = (HttpURLConnection) url.openConnection();
|
||||||
|
|
||||||
|
if (conn instanceof HttpsURLConnection) {
|
||||||
|
HttpsURLConnection connHttps = (HttpsURLConnection) conn;
|
||||||
|
SSLContext ctx = SSLContext.getInstance("TLSV1.2");
|
||||||
|
ctx.init(null, new TrustManager[] { new TrustAllTrustManager() }, new java.security.SecureRandom());
|
||||||
|
connHttps.setSSLSocketFactory(ctx.getSocketFactory());
|
||||||
|
connHttps.setHostnameVerifier(new HostnameVerifier() {
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
conn = connHttps;
|
||||||
|
}
|
||||||
|
|
||||||
|
conn.setConnectTimeout(connectTimeout);
|
||||||
|
conn.setReadTimeout(readTimeout);
|
||||||
|
conn.setRequestProperty("User-Agent", "ych-sdk-java");
|
||||||
|
conn.setRequestMethod("POST");
|
||||||
|
conn.setDoOutput(true);
|
||||||
|
out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
|
||||||
|
out.write(query);
|
||||||
|
out.flush();
|
||||||
|
|
||||||
|
InputStream urlStream = conn.getInputStream();
|
||||||
|
rd = new BufferedReader(new InputStreamReader(urlStream));
|
||||||
|
|
||||||
|
while ((line = rd.readLine()) != null) {
|
||||||
|
result.append(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
urlStream.close();
|
||||||
|
rd.close();
|
||||||
|
}
|
||||||
|
catch (NoSuchAlgorithmException e) {
|
||||||
|
return "NoSuchAlgorithmException";
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
return e.getMessage();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
if (out != null) {
|
||||||
|
try {
|
||||||
|
out.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue