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
9ccc5edd
Commit
9ccc5edd
authored
Aug 11, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2806c3a3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
22 deletions
+32
-22
DcBaseStockMapper.java
...src/main/java/com/bailuntec/mapper/DcBaseStockMapper.java
+3
-1
DcBaseStockMapper.xml
.../src/main/java/com/bailuntec/mapper/DcBaseStockMapper.xml
+9
-0
CalculateWeekJob.java
...les/src/main/java/com/bailuntec/job/CalculateWeekJob.java
+19
-20
AutoTurnoverJob.java
...over/src/main/java/com/bailuntec/job/AutoTurnoverJob.java
+1
-1
No files found.
data-common/src/main/java/com/bailuntec/mapper/DcBaseStockMapper.java
View file @
9ccc5edd
...
...
@@ -132,7 +132,9 @@ public interface DcBaseStockMapper {
void
insertDailyStock
();
List
<
DcBaseStock
>
listStockById
(
ShardingContext
shardingContext
,
@Param
(
"v1"
)
int
v1
,
@Param
(
"v2"
)
int
v2
);
List
<
DcBaseStock
>
listStockById
(
@Param
(
"v1"
)
int
v1
,
@Param
(
"v2"
)
int
v2
);
List
<
DcBaseStock
>
listStockByIdPart
(
@Param
(
"shardingContext"
)
ShardingContext
shardingContext
,
@Param
(
"v1"
)
int
v1
,
@Param
(
"v2"
)
int
v2
);
List
<
DcBaseStock
>
listStockWarehouseById
(
@Param
(
"v1"
)
int
v1
,
@Param
(
"v2"
)
int
v2
,
@Param
(
"warehouseCode"
)
String
warehouseCode
);
...
...
data-common/src/main/java/com/bailuntec/mapper/DcBaseStockMapper.xml
View file @
9ccc5edd
...
...
@@ -1269,6 +1269,13 @@
limit #{v1}, #{v2}
</select>
<select
id=
"listStockByIdPart"
resultType=
"com.bailuntec.domain.entity.DcBaseStock"
>
SELECT *
FROM dc_base_stock tb1
where tb1.id % #{shardingContext.shardingTotalCount} = #{shardingContext.shardingItem}
limit #{v1}, #{v2}
</select>
<select
id=
"listStockWarehouseById"
resultType=
"com.bailuntec.domain.entity.DcBaseStock"
>
SELECT *
FROM dc_base_stock
...
...
@@ -1301,6 +1308,7 @@
limit #{v1}, #{v2}
</select>
<select
id=
"listWarehouseStockById"
resultType=
"com.bailuntec.domain.entity.DcBaseStock"
>
select *
from dc_base_stock tb1
...
...
@@ -1407,4 +1415,5 @@
limit #{pageStart}, #{pageOffset};
</select>
</mapper>
data-mid/mid-calculate-sales/src/main/java/com/bailuntec/job/CalculateWeekJob.java
View file @
9ccc5edd
...
...
@@ -14,7 +14,6 @@ import com.bailuntec.support.PointJob;
import
com.bailuntec.utils.ExceptionUtil
;
import
com.bailuntec.utils.SessionUtil
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -26,7 +25,7 @@ public class CalculateWeekJob extends PointJob {
@Override
public
void
executeJob
(
ShardingContext
shardingContext
,
JobPointLog
jobPointLog
)
{
try
{
try
{
long
count
=
0
;
DcBaseStockMapper
baseStockMapper
=
SessionUtil
.
getSession
().
getMapper
(
DcBaseStockMapper
.
class
);
if
(
StringUtils
.
isBlank
(
shardingContext
.
getJobParameter
()))
{
...
...
@@ -34,8 +33,8 @@ public class CalculateWeekJob extends PointJob {
}
else
{
count
=
baseStockMapper
.
countByExample
(
DcBaseStockExample
.
newAndCreateCriteria
().
andWarehouseCodeEqualTo
(
shardingContext
.
getJobParameter
()).
example
());
}
int
totalPage
=
(
int
)
(
count
%
jobPointLog
.
getPageSize
()
==
0
?
count
/
jobPointLog
.
getPageSize
()
:
count
/
jobPointLog
.
getPageSize
()
+
1
);
do
{
int
totalPage
=
(
int
)
(
count
%
jobPointLog
.
getPageSize
()
==
0
?
count
/
jobPointLog
.
getPageSize
()
:
count
/
jobPointLog
.
getPageSize
()
+
1
);
do
{
List
<
DcBaseStock
>
dcBaseStockList
=
null
;
//分页查SKU_仓库
if
(
jobPointLog
.
getPageIndex
().
equals
(
0
))
{
jobPointLog
.
setPageIndex
(
totalPage
);
...
...
@@ -43,23 +42,23 @@ public class CalculateWeekJob extends PointJob {
try
{
DcBaseStockMapper
baseStockMapperFor
=
SessionUtil
.
getSession
().
getMapper
(
DcBaseStockMapper
.
class
);
if
(
StringUtils
.
isBlank
(
shardingContext
.
getJobParameter
()))
{
dcBaseStockList
=
baseStockMapperFor
.
listStockById
(
jobPointLog
.
getPageIndex
()
*
jobPointLog
.
getPageSize
(),
jobPointLog
.
getPageSize
());
}
else
{
dcBaseStockList
=
baseStockMapperFor
.
listStockWarehouseById
((
jobPointLog
.
getPageIndex
()
-
1
)
*
jobPointLog
.
getPageSize
(),
jobPointLog
.
getPageSize
(),
shardingContext
.
getJobParameter
());
dcBaseStockList
=
baseStockMapperFor
.
listStockById
(
jobPointLog
.
getPageIndex
()
*
jobPointLog
.
getPageSize
(),
jobPointLog
.
getPageSize
());
}
else
{
dcBaseStockList
=
baseStockMapperFor
.
listStockWarehouseById
((
jobPointLog
.
getPageIndex
()
-
1
)
*
jobPointLog
.
getPageSize
(),
jobPointLog
.
getPageSize
(),
shardingContext
.
getJobParameter
());
}
DcAutoSalesMapper
autoSalesMapper
=
null
;
if
(
dcBaseStockList
!=
null
&&
dcBaseStockList
.
size
()
>
0
)
{
for
(
DcBaseStock
dcBaseStock
:
dcBaseStockList
)
{
autoSalesMapper
=
SessionUtil
.
getSession
().
getMapper
(
DcAutoSalesMapper
.
class
);
SalesVolumeWeekDTO
salesVolumeWeekDTO
=
autoSalesMapper
.
getSalesVolumeWeekDTO
(
dcBaseStock
.
getBailunSku
(),
dcBaseStock
.
getWarehouseCode
());
if
(
StringUtils
.
isNotEmpty
(
salesVolumeWeekDTO
.
getSalesDetail
().
trim
()))
{
if
(
StringUtils
.
isNotEmpty
(
salesVolumeWeekDTO
.
getSalesDetail
().
trim
()))
{
calculateWeekRate
(
salesVolumeWeekDTO
);
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
SessionUtil
.
closeSession
();
}
if
(
jobPointLog
.
getPageIndex
()
%
10
==
0
)
{
...
...
@@ -74,39 +73,39 @@ public class CalculateWeekJob extends PointJob {
}
}
jobPointLog
.
setPageIndex
(
jobPointLog
.
getPageIndex
()
-
1
);
}
while
(
0
<
jobPointLog
.
getPageIndex
());
}
while
(
0
<
jobPointLog
.
getPageIndex
());
jobPointLog
.
setPageIndex
(
0
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
SessionUtil
.
closeSession
();
}
}
public
void
calculateWeekRate
(
SalesVolumeWeekDTO
salesVolumeWeekDTO
)
{
try
{
try
{
DcAutoWeekSales
dcAutoWeekSales
=
new
DcAutoWeekSales
();
DcAutoWeekSalesMapper
dcAutoWeekSalesMapper
=
SessionUtil
.
getSession
().
getMapper
(
DcAutoWeekSalesMapper
.
class
);
BeanUtils
.
copyProperties
(
dcAutoWeekSales
,
salesVolumeWeekDTO
);
dcAutoWeekSales
.
setSaleDetail
(
salesVolumeWeekDTO
.
getSalesDetail
());
// dcAutoWeekSales.setRateDetail(salesVolumeWeekDTO.getSalesDetail());
// dcAutoWeekSales.setRateDetail(salesVolumeWeekDTO.getSalesDetail());
dcAutoWeekSalesMapper
.
upsertSelective
(
dcAutoWeekSales
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
SessionUtil
.
closeSession
();
}
}
private
Calendar
getCalendarFormYear
(
int
year
){
private
Calendar
getCalendarFormYear
(
int
year
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
set
(
Calendar
.
DAY_OF_WEEK
,
Calendar
.
MONDAY
);
cal
.
set
(
Calendar
.
YEAR
,
year
);
return
cal
;
}
public
String
getEndDayOfWeekNo
(
int
year
,
int
weekNo
)
{
public
String
getEndDayOfWeekNo
(
int
year
,
int
weekNo
)
{
Calendar
cal
=
getCalendarFormYear
(
year
);
cal
.
set
(
Calendar
.
WEEK_OF_YEAR
,
weekNo
);
cal
.
add
(
Calendar
.
DAY_OF_WEEK
,
6
);
...
...
@@ -114,7 +113,7 @@ public class CalculateWeekJob extends PointJob {
cal
.
get
(
Calendar
.
DAY_OF_MONTH
);
}
public
String
getStartDayOfWeekNo
(
int
year
,
int
weekNo
)
{
public
String
getStartDayOfWeekNo
(
int
year
,
int
weekNo
)
{
Calendar
cal
=
getCalendarFormYear
(
year
);
cal
.
set
(
Calendar
.
WEEK_OF_YEAR
,
weekNo
);
return
cal
.
get
(
Calendar
.
YEAR
)
+
"-"
+
(
cal
.
get
(
Calendar
.
MONTH
)
+
1
)
+
"-"
+
...
...
data-show/show-auto-turnover/src/main/java/com/bailuntec/job/AutoTurnoverJob.java
View file @
9ccc5edd
...
...
@@ -72,7 +72,7 @@ public class AutoTurnoverJob extends PointJob {
DcBaseStockMapper
baseStockMapperFor
=
SessionUtil
.
getSession
().
getMapper
(
DcBaseStockMapper
.
class
);
//这里是根据id排序,方法名没改了
if
(
StringUtils
.
isBlank
(
shardingContext
.
getJobParameter
()))
{
dcBaseStockList
=
baseStockMapperFor
.
listStockById
(
shardingContext
,
(
page
-
1
)
*
jobPointLog
.
getPageSize
(),
jobPointLog
.
getPageSize
());
dcBaseStockList
=
baseStockMapperFor
.
listStockById
Part
(
shardingContext
,
(
page
-
1
)
*
jobPointLog
.
getPageSize
(),
jobPointLog
.
getPageSize
());
}
else
{
switch
(
shardingContext
.
getJobParameter
())
{
case
"国内仓"
:
...
...
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