Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-java
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
dc-java
Commits
2413092d
Commit
2413092d
authored
Oct 29, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
listen ge jb
parent
e9b89000
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
87 deletions
+84
-87
db-prod.properties
data-common/src/main/resources/db-prod.properties
+0
-5
mybatis-config.xml
data-common/src/main/resources/mybatis-config.xml
+2
-2
xxx.sql
data-common/src/main/resources/xxx.sql
+0
-0
BalanceSheetServiceTest.java
...iluntec/balancesheet/service/BalanceSheetServiceTest.java
+16
-16
AutoTurnoverJobListener.java
.../java/com/bailuntec/listener/AutoTurnoverJobListener.java
+63
-62
job.properties
...show/show-auto-turnover/src/main/resources/job.properties
+2
-1
AutoTurnoverJobTest.java
.../src/test/java/com/bailuntec/job/AutoTurnoverJobTest.java
+1
-1
No files found.
data-common/src/main/resources/db-prod.properties
View file @
2413092d
...
...
@@ -3,8 +3,3 @@ url=jdbc:mysql://10.0.8.15:3306/bailun_datacenter?useUnicode=true&characterEncod
username
=
root
password
=
#7kfnymAM$Y9-Ntf
readonly-url
=
jdbc:mysql://10.0.8.21:3306/bailun_datacenter?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
readonly-username
=
root
readonly-password
=
#7kfnymAM$Y9-Ntf
data-common/src/main/resources/mybatis-config.xml
View file @
2413092d
...
...
@@ -5,8 +5,8 @@
<configuration>
<!--<properties resource="db-tj.properties"/>-->
<properties
resource=
"db-dev.properties"
/>
<!-- <properties resource="db-prod.properties"/>-->
<properties
resource=
"db-dev.properties"
/>
<!-- <properties resource="db-prod.properties"/>-->
<settings>
<setting
name=
"mapUnderscoreToCamelCase"
value=
"true"
/>
</settings>
...
...
data-common/src/main/resources/xxx.sql
0 → 100644
View file @
2413092d
data-finance/finance-balance-sheet/src/test/java/com/bailuntec/balancesheet/service/BalanceSheetServiceTest.java
View file @
2413092d
...
...
@@ -99,8 +99,8 @@ public class BalanceSheetServiceTest {
@Test
public
void
generateBalanceSheet
()
{
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
19-01-28
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
19-02-26
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-20
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-28
"
,
DateTimeUtil
.
DATE_FORMAT
);
while
(
startDate
.
compareTo
(
endDate
)
==
-
1
)
{
balanceSheetService
.
generateBalanceSheet
(
0
,
"百伦供应链"
,
startDate
);
startDate
=
DateTimeUtil
.
addDays
(
startDate
,
1
);
// 日期增加一天
...
...
@@ -109,8 +109,8 @@ public class BalanceSheetServiceTest {
@Test
public
void
updatePlatformBalance
()
{
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
19-03-15
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
19-03-16
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-20
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-28
"
,
DateTimeUtil
.
DATE_FORMAT
);
while
(
startDate
.
compareTo
(
endDate
)
==
-
1
)
{
// 银行账号
BigDecimal
bankAccountBalanceSum
=
dcBankAccountBalanceMapper
.
getBalanceSum
(
startDate
);
...
...
@@ -139,8 +139,8 @@ public class BalanceSheetServiceTest {
@Test
public
void
getSupplierTransactionBatch
()
{
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
19-04-25
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
19-05-0
8"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-20
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-2
8"
,
DateTimeUtil
.
DATE_FORMAT
);
while
(
startDate
.
compareTo
(
endDate
)
==
-
1
)
{
balanceSheetService
.
getSupplierTransaction
(
startDate
);
// balanceSheetService.getLogisticsSupplierTransaction(startDate);
...
...
@@ -167,8 +167,8 @@ public class BalanceSheetServiceTest {
@Test
public
void
getInventoryBalance
()
{
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
19-05-01
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
19-07-19
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-20
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-28
"
,
DateTimeUtil
.
DATE_FORMAT
);
while
(
startDate
.
compareTo
(
endDate
)
==
-
1
)
{
// balanceSheetService.getInventoryBalance(startDate);
balanceSheetService
.
updateInventoryBalance
(
startDate
);
...
...
@@ -181,8 +181,8 @@ public class BalanceSheetServiceTest {
/*Date startDate = DateTimeUtil.stringToDate("2014-04-25", DateTimeUtil.DATE_FORMAT);
Date endDate = DateTimeUtil.stringToDate("2018-08-06", DateTimeUtil.DATE_FORMAT);
balanceSheetService.getSemiInventoryBalance(startDate,endDate);*/
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"2020-
09-28
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"2020-
09-29
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"2020-
10-20
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"2020-
10-28
"
,
DateTimeUtil
.
DATE_FORMAT
);
assert
endDate
!=
null
;
assert
startDate
!=
null
;
while
(
startDate
.
compareTo
(
endDate
)
<
0
)
{
...
...
@@ -194,8 +194,8 @@ public class BalanceSheetServiceTest {
@Test
public
void
getSemiTransferAmount
()
{
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"2020-
09-25
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"2020-
09-29
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"2020-
10-20
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"2020-
10-28
"
,
DateTimeUtil
.
DATE_FORMAT
);
assert
endDate
!=
null
;
assert
startDate
!=
null
;
while
(
startDate
.
compareTo
(
endDate
)
<
0
)
{
...
...
@@ -248,8 +248,8 @@ public class BalanceSheetServiceTest {
@Test
public
void
getFixedAssets
()
{
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
19-03-01
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
19-03-07
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-20
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-28
"
,
DateTimeUtil
.
DATE_FORMAT
);
while
(
startDate
.
compareTo
(
endDate
)
==
-
1
)
{
// 固定资产
balanceSheetService
.
getFixedAssets
(
DateTimeUtil
.
addDays
(
startDate
,
-
1
),
startDate
,
DateTimeUtil
.
addDays
(
startDate
,
1
));
...
...
@@ -272,8 +272,8 @@ public class BalanceSheetServiceTest {
@Test
public
void
updateFund
()
{
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
19-05-01
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
19-06-11
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
startDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-20
"
,
DateTimeUtil
.
DATE_FORMAT
);
Date
endDate
=
DateTimeUtil
.
stringToDate
(
"20
20-10-28
"
,
DateTimeUtil
.
DATE_FORMAT
);
while
(
startDate
.
compareTo
(
endDate
)
==
-
1
)
{
DcBalanceSheet
dcBalanceSheet
=
new
DcBalanceSheet
();
// 银行账户余额汇总
...
...
data-show/show-auto-turnover/src/main/java/com/bailuntec/listener/AutoTurnoverJobListener.java
View file @
2413092d
package
com
.
bailuntec
.
listener
;
import
com.bailuntec.domain.constant.CommonConstant
;
import
com.bailuntec.domain.entity.DcAutoException
;
import
com.bailuntec.domain.entity.DcBaseStock
;
import
com.bailuntec.domain.example.DcAutoExceptionExample
;
import
com.bailuntec.domain.example.DcBaseStockExample
;
import
com.bailuntec.job.AutoTurnoverJob
;
import
com.bailuntec.mapper.DcAutoExceptionMapper
;
import
com.bailuntec.mapper.DcBaseStockMapper
;
import
com.bailuntec.utils.SessionUtil
;
import
com.dangdang.ddframe.job.executor.ShardingContexts
;
import
com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.session.SqlSession
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
@Slf4j
public
class
AutoTurnoverJobListener
implements
ElasticJobListener
{
@Override
public
void
beforeJobExecuted
(
ShardingContexts
shardingContexts
)
{
}
@Override
public
void
afterJobExecuted
(
ShardingContexts
shardingContexts
)
{
String
queryTime
=
DateTimeFormatter
.
ofPattern
(
CommonConstant
.
DATE_FORMAT
).
format
(
LocalDate
.
now
());
int
pageIndex
=
0
;
int
pageSize
=
1000
;
AutoTurnoverJob
autoTurnoverJob
=
new
AutoTurnoverJob
();
List
<
DcAutoException
>
dcAutoExceptions
=
null
;
SqlSession
sqlSession
=
SessionUtil
.
getFactory
().
openSession
(
true
);
try
{
DcAutoExceptionMapper
mapper
=
sqlSession
.
getMapper
(
DcAutoExceptionMapper
.
class
);
DcBaseStockMapper
dcBaseStockMapper
=
sqlSession
.
getMapper
(
DcBaseStockMapper
.
class
);
do
{
dcAutoExceptions
=
mapper
.
selectByExample
(
DcAutoExceptionExample
.
newAndCreateCriteria
().
example
().
limit
(
pageIndex
*
pageSize
,
pageSize
));
if
(
dcAutoExceptions
!=
null
&&
dcAutoExceptions
.
size
()
>
0
)
{
for
(
DcAutoException
dcAutoException
:
dcAutoExceptions
)
{
DcBaseStock
dcBaseStock
=
dcBaseStockMapper
.
selectOneByExample
(
DcBaseStockExample
.
newAndCreateCriteria
().
andBailunSkuEqualTo
(
dcAutoException
.
getBailunSku
()).
andWarehouseCodeEqualTo
(
dcAutoException
.
getWarehouseCode
()).
example
());
try
{
autoTurnoverJob
.
autoTurnoverFromStock
(
queryTime
,
dcBaseStock
);
mapper
.
deleteByPrimaryKey
(
dcAutoException
.
getId
());
}
catch
(
Exception
e
)
{
log
.
error
(
"Mybatis操作自动周转异常数据再次计算失败SKU="
+
dcAutoException
.
getBailunSku
()
+
",仓库编码="
+
dcAutoException
.
getWarehouseCode
());
}
}
}
pageIndex
++;
}
while
(
dcAutoExceptions
!=
null
&&
dcAutoExceptions
.
size
()
==
pageSize
);
}
catch
(
RuntimeException
e
)
{
throw
new
RuntimeException
(
"Mybatis操作自动周转异常数据再次计算失败"
);
}
finally
{
if
(
sqlSession
!=
null
)
{
sqlSession
.
close
();
}
}
}
}
//package com.bailuntec.listener;
//
//import com.bailuntec.domain.constant.CommonConstant;
//import com.bailuntec.domain.entity.DcAutoException;
//import com.bailuntec.domain.entity.DcBaseStock;
//import com.bailuntec.domain.example.DcAutoExceptionExample;
//import com.bailuntec.domain.example.DcBaseStockExample;
//import com.bailuntec.job.AutoTurnoverJob;
//import com.bailuntec.mapper.DcAutoExceptionMapper;
//import com.bailuntec.mapper.DcBaseStockMapper;
//import com.bailuntec.utils.SessionUtil;
//import com.dangdang.ddframe.job.executor.ShardingContexts;
//import com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.ibatis.session.SqlSession;
//
//import java.time.LocalDate;
//import java.time.format.DateTimeFormatter;
//import java.util.List;
//
//@Slf4j
//public class AutoTurnoverJobListener implements ElasticJobListener {
// @Override
// public void beforeJobExecuted(ShardingContexts shardingContexts) {
//
// }
//
// @Override
// public void afterJobExecuted(ShardingContexts shardingContexts) {
// String queryTime = DateTimeFormatter.ofPattern(CommonConstant.DATE_FORMAT).format(LocalDate.now());
// int pageIndex = 0;
// int pageSize = 1000;
// AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
// List<DcAutoException> dcAutoExceptions;
//
// SqlSession sqlSession = SessionUtil.getFactory().openSession(true);
// try {
// DcAutoExceptionMapper mapper = sqlSession.getMapper(DcAutoExceptionMapper.class);
// DcBaseStockMapper dcBaseStockMapper = sqlSession.getMapper(DcBaseStockMapper.class);
// do {
// dcAutoExceptions = mapper.selectByExample(DcAutoExceptionExample.newAndCreateCriteria().example().limit(pageIndex * pageSize, pageSize));
// if (dcAutoExceptions != null && dcAutoExceptions.size() > 0) {
// for (DcAutoException dcAutoException : dcAutoExceptions) {
// DcBaseStock dcBaseStock = dcBaseStockMapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo(dcAutoException.getBailunSku()).andWarehouseCodeEqualTo(dcAutoException.getWarehouseCode()).example());
// try {
// autoTurnoverJob.autoTurnoverFromStock(queryTime, dcBaseStock);
// mapper.deleteByPrimaryKey(dcAutoException.getId());
// } catch (Exception e) {
// log.error("Mybatis操作自动周转异常数据再次计算失败SKU=" + dcAutoException.getBailunSku() + ",仓库编码=" + dcAutoException.getWarehouseCode());
// }
// }
// }
// pageIndex++;
// } while (dcAutoExceptions != null && dcAutoExceptions.size() == pageSize);
// } catch (RuntimeException e) {
// throw new RuntimeException("Mybatis操作自动周转异常数据再次计算失败");
// } finally {
// if (sqlSession != null) {
// sqlSession.close();
// }
// }
// }
//}
data-show/show-auto-turnover/src/main/resources/job.properties
View file @
2413092d
...
...
@@ -20,5 +20,6 @@ JOB_CRON_NE_NORMAL=0 0 1 ? * MON
JOB_NAME_INCREMENT
=
show-auto-turnover-increment
JOB_CRON_INCREMENT
=
0 40 14 * * ?
JOB_CRON_INCREMENT
=
0 20 14 * * ?
SHARDING_TOTAL_COUNT_INCREMENT
=
8
data-show/show-auto-turnover/src/test/java/com/bailuntec/job/AutoTurnoverJobTest.java
View file @
2413092d
...
...
@@ -325,7 +325,7 @@ public class AutoTurnoverJobTest {
DcBaseStockMapper
dcBaseStockMapper
=
sqlSession
.
getMapper
(
DcBaseStockMapper
.
class
);
DcBaseStock
dcBaseStock
=
dcBaseStockMapper
.
selectOneByExample
(
DcBaseStockExample
.
newAndCreateCriteria
()
.
andBailunSkuEqualTo
(
"
28547253
1"
)
.
andBailunSkuEqualTo
(
"
94936140
1"
)
.
andWarehouseCodeEqualTo
(
"GZBLWH"
)
.
example
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment