Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
promotion-service
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
promotion
promotion-service
Commits
14b1b661
提交
14b1b661
authored
1月 03, 2025
作者:
李秋林
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、删除部分单元测试;
2、修改本地连接xxljob配置; 3、重新拉取经销商、终端门店; 4、终端门店目前无用信息删除,门店绑定经销商信息由qc_id改为编码;
上级
7bafa9b9
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
82 行增加
和
136 行删除
+82
-136
QinCeDataTaskController.java
...motion/controller/user/qince/QinCeDataTaskController.java
+0
-76
QinCeClienteleStoreDaoImpl.java
...tion/domain/user/dao/impl/QinCeClienteleStoreDaoImpl.java
+3
-2
QinceDealerDaoImpl.java
...lu/promotion/domain/user/dao/impl/QinceDealerDaoImpl.java
+1
-1
QinCeClienteleStoreDO.java
...tion/domain/user/mapper/entity/QinCeClienteleStoreDO.java
+0
-0
QinCeClienteleStoreDto.java
...iaolu/promotion/pojo/user/dto/QinCeClienteleStoreDto.java
+1
-0
ActivityPlanRecordCoreServiceImpl.java
...tivity/manage/impl/ActivityPlanRecordCoreServiceImpl.java
+27
-34
QinCeDataTaskServiceImpl.java
...promotion/service/user/impl/QinCeDataTaskServiceImpl.java
+7
-6
QinCeUtils.java
src/main/java/com/wangxiaolu/promotion/utils/QinCeUtils.java
+5
-5
XxlJobHandler.java
...va/com/wangxiaolu/promotion/xxljobtask/XxlJobHandler.java
+2
-1
application-dev.yml
src/main/resources/application-dev.yml
+4
-3
QinceDealerMapper.xml
src/main/resources/mapper/QinceDealerMapper.xml
+3
-0
QinCeDataTaskServiceImplTest.java
...otion/service/user/impl/QinCeDataTaskServiceImplTest.java
+29
-0
ActivityTypeXxlJobHandlerTest.java
...u/promotion/xxljobtask/ActivityTypeXxlJobHandlerTest.java
+0
-8
没有找到文件。
src/main/java/com/wangxiaolu/promotion/controller/user/qince/QinCeDataTaskController.java
deleted
100644 → 0
浏览文件 @
7bafa9b9
package
com
.
wangxiaolu
.
promotion
.
controller
.
user
.
qince
;
import
com.wangxiaolu.promotion.result.basedata.R
;
import
com.wangxiaolu.promotion.service.user.QinCeDataTaskService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author : liqiulin
* @date : 2024-03-29 16
* @describe : 勤策同步数据接口
*/
@RestController
@RequestMapping
(
"/user/qince/task"
)
public
class
QinCeDataTaskController
{
@Autowired
QinCeDataTaskService
qinCeDataTaskService
;
/**
* 同步组织架构/部门数据
*/
@GetMapping
(
"/department"
)
public
R
departmentTask
(){
qinCeDataTaskService
.
departmentSyncTask
();
return
R
.
success
();
}
/**
* 同步员工数据
*/
@GetMapping
(
"/employee"
)
public
R
employeeTask
(){
qinCeDataTaskService
.
employeeSyncTask
();
return
R
.
success
();
}
/**
* 同步[终端数据]
*/
@GetMapping
(
"/shops"
)
public
R
shopDetailAllTask
(){
qinCeDataTaskService
.
shopDetailAllTask
();
return
R
.
success
();
}
/**
* 同步商品类型
*/
@GetMapping
(
"/product/type"
)
public
R
productQueryPdTypeAllTask
(){
qinCeDataTaskService
.
productQueryPdTypeAllTask
();
return
R
.
success
();
}
/**
* 同步商品数据
*/
@GetMapping
(
"/product"
)
public
R
productAllTask
(){
qinCeDataTaskService
.
productAllTask
();
return
R
.
success
();
}
/**
* 同步经销商数据
*/
@GetMapping
(
"/dealers"
)
public
R
productDealers
(){
qinCeDataTaskService
.
productDealers
();
return
R
.
success
();
}
}
src/main/java/com/wangxiaolu/promotion/domain/user/dao/impl/QinCeClienteleStoreDaoImpl.java
浏览文件 @
14b1b661
...
...
@@ -50,7 +50,7 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
List
<
JSONObject
>
dealers
=
qinCeShopDO
.
getDealers
();
if
(!
CollectionUtils
.
isEmpty
(
dealers
)){
qinCeShopDO
.
setDealersName
(
dealers
.
get
(
0
).
getString
(
"dealer_name"
));
qinCeShopDO
.
set
Waiqin365DealersId
(
dealers
.
get
(
0
).
getString
(
"waiqin365_dealer_id
"
));
qinCeShopDO
.
set
DealerId
(
dealers
.
get
(
0
).
getString
(
"dealer_code
"
));
}
qw
.
eq
(
QinCeClienteleStoreDO:
:
getQcId
,
qinCeShopDO
.
getQcId
());
...
...
@@ -97,7 +97,8 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
qw
.
select
(
QinCeClienteleStoreDO:
:
getQcId
,
QinCeClienteleStoreDO:
:
getStoreName
,
QinCeClienteleStoreDO:
:
getStoreAddr
,
QinCeClienteleStoreDO:
:
getDealersName
);
QinCeClienteleStoreDO:
:
getDealersName
,
QinCeClienteleStoreDO:
:
getDealerId
);
QinCeClienteleStoreDO
qinCeClienteleStoreDO
=
qinCeClienteleStoreMapper
.
selectOne
(
qw
);
return
transitionDto
(
qinCeClienteleStoreDO
);
...
...
src/main/java/com/wangxiaolu/promotion/domain/user/dao/impl/QinceDealerDaoImpl.java
浏览文件 @
14b1b661
...
...
@@ -31,7 +31,7 @@ public class QinceDealerDaoImpl implements QinceDealerDao {
@Override
public
void
saveList
(
List
<
Object
>
dealerJsons
)
{
// 目前没有查重逻辑,只在前边判断逻辑中
进行
新增
// 目前没有查重逻辑,只在前边判断逻辑中
判断是否
新增
qinceDealerMapper
.
saveList
(
dealerJsons
);
log
.
info
(
"勤策同步经销商,新增数量:{}"
,
dealerJsons
.
size
());
}
...
...
src/main/java/com/wangxiaolu/promotion/domain/user/mapper/entity/QinCeClienteleStoreDO.java
浏览文件 @
14b1b661
差异被折叠。
点击展开。
src/main/java/com/wangxiaolu/promotion/pojo/user/dto/QinCeClienteleStoreDto.java
浏览文件 @
14b1b661
...
...
@@ -25,4 +25,5 @@ public class QinCeClienteleStoreDto {
private
String
storeAddr
;
private
String
dealersName
;
private
String
dealerId
;
}
src/main/java/com/wangxiaolu/promotion/service/activity/manage/impl/ActivityPlanRecordCoreServiceImpl.java
浏览文件 @
14b1b661
...
...
@@ -282,31 +282,29 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
sb
.
append
(
"系统名称不可为空;"
);
}
String
dealerId
=
((
String
)
value
.
get
(
1
)).
trim
();
if
(
StringUtils
.
isBlank
(
dealerId
))
{
sb
.
append
(
"经销商编码不可为空;"
);
dealerId
=
""
;
}
String
qinceStoreCode
=
(
String
)
value
.
get
(
3
);
String
storeName
=
(
String
)
value
.
get
(
4
);
if
(
StringUtils
.
isBlank
(
qinceStoreCode
))
{
sb
.
append
(
"勤策店铺编码不可为空;"
);
if
(
StringUtils
.
isBlank
(
storeName
))
{
sb
.
append
(
"店铺名称不可为空;"
);
}
if
(
StringUtils
.
isBlank
(
storeName
)
||
StringUtils
.
isBlank
(
qinceStoreCode
))
{
sb
.
append
(
"店铺编码/名称不可为空;"
);
}
else
{
// 验证店铺code是否存在
StoreWrapper
storeWrap
=
new
StoreWrapper
()
.
setStoreCode
(
qinceStoreCode
);
StoreWrapper
storeWrap
=
new
StoreWrapper
().
setStoreCode
(
qinceStoreCode
);
QinCeClienteleStoreDto
oneStore
=
qinCeClienteleStoreDao
.
getOneStore
(
storeWrap
);
if
(
ObjectUtil
.
isEmpty
(
oneStore
))
{
sb
.
append
(
"勤策店铺编码不正确;"
);
}
else
{
if
(
StringUtils
.
isBlank
(
storeName
))
{
sb
.
append
(
"勤策店铺名称不可为空;"
);
}
else
if
(!
storeName
.
equals
(
oneStore
.
getStoreName
()))
{
sb
.
append
(
"勤策店铺编码/名称不正确;"
);
if
(!
storeName
.
equals
(
oneStore
.
getStoreName
()))
{
sb
.
append
(
"店铺名称不正确;"
);
}
String
dealersName
=
oneStore
.
getDealersName
();
String
dealerId
=
((
String
)
value
.
get
(
1
)).
trim
();
if
(!
dealers
.
containsKey
(
dealerId
)
||
!
dealers
.
get
(
dealerId
).
equals
(
dealersName
))
{
sb
.
append
(
"店铺不归属此经销商;"
);
if
(!
dealerId
.
equals
(
oneStore
.
getDealerId
()))
{
sb
.
append
(
"经销商编码不正确;"
);
}
}
}
...
...
@@ -362,43 +360,38 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
employeeNos
.
add
((
String
)
value
.
get
(
1
));
}
// if (!dealers.containsKey(((String) value.get(2)).trim())) {
// sb.append("经销商编码错误;");
// }
if
(
StringUtils
.
isBlank
((
String
)
value
.
get
(
3
)))
{
sb
.
append
(
"系统名称不可为空;"
);
}
String
dealerId
=
((
String
)
value
.
get
(
2
)).
trim
();
if
(
StringUtils
.
isBlank
(
dealerId
))
{
sb
.
append
(
"经销商编码不可为空;"
);
dealerId
=
""
;
}
String
qinceStoreCode
=
(
String
)
value
.
get
(
4
);
String
storeName
=
(
String
)
value
.
get
(
5
);
if
(
StringUtils
.
isBlank
(
qinceStoreCode
))
{
sb
.
append
(
"勤策店铺编码不可为空;"
);
if
(
StringUtils
.
isBlank
(
storeName
))
{
sb
.
append
(
"店铺名称不可为空;"
);
}
if
(
StringUtils
.
isBlank
(
storeName
)
||
StringUtils
.
isBlank
(
qinceStoreCode
))
{
sb
.
append
(
"店铺编码/名称不可为空;"
);
}
else
{
// 验证店铺code是否存在
StoreWrapper
storeWrap
=
new
StoreWrapper
()
.
setStoreCode
(
qinceStoreCode
);
StoreWrapper
storeWrap
=
new
StoreWrapper
().
setStoreCode
(
qinceStoreCode
);
QinCeClienteleStoreDto
oneStore
=
qinCeClienteleStoreDao
.
getOneStore
(
storeWrap
);
if
(
ObjectUtil
.
isEmpty
(
oneStore
))
{
sb
.
append
(
"勤策店铺编码不正确;"
);
}
else
{
if
(
StringUtils
.
isBlank
(
storeName
))
{
sb
.
append
(
"勤策店铺名称不可为空;"
);
}
else
if
(!
storeName
.
equals
(
oneStore
.
getStoreName
()))
{
sb
.
append
(
"勤策店铺编码/名称不正确;"
);
if
(!
storeName
.
equals
(
oneStore
.
getStoreName
()))
{
sb
.
append
(
"店铺名称不正确;"
);
}
String
dealersName
=
oneStore
.
getDealersName
();
String
dealerId
=
((
String
)
value
.
get
(
2
)).
trim
();
if
(!
dealers
.
containsKey
(
dealerId
)
||
!
dealers
.
get
(
dealerId
).
equals
(
dealersName
))
{
sb
.
append
(
"店铺不归属此经销商;"
);
if
(!
dealerId
.
equals
(
oneStore
.
getDealerId
()))
{
sb
.
append
(
"经销商编码不正确;"
);
}
}
}
String
pattern
=
(
String
)
value
.
get
(
6
);
if
(
StringUtils
.
isBlank
(
pattern
))
{
sb
.
append
(
"活动模式不可为空;"
);
...
...
src/main/java/com/wangxiaolu/promotion/service/user/impl/QinCeDataTaskServiceImpl.java
浏览文件 @
14b1b661
...
...
@@ -69,7 +69,6 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
// 查询组织架构参数、创建url
Map
<
String
,
Object
>
params
=
qinCeUtils
.
queryEmployeeParam
(
false
);
String
url
=
qinCeUtils
.
builderUrl
(
QinCeUtils
.
QUERY_EMPLOYEE
,
params
);
System
.
out
.
println
(
url
);
// 发起请求、接收结果
JSONObject
resultJson
=
OkHttp
.
postQC
(
url
,
params
);
JSONArray
responseDatas
=
resultJson
.
getJSONArray
(
"response_data"
);
...
...
@@ -145,7 +144,6 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
JSONObject
resultJson
=
OkHttp
.
postQC
(
url
,
params
);
JSONArray
responseDatas
=
resultJson
.
getJSONArray
(
"response_data"
);
log
.
info
(
"勤策-查询一周内修改过的经销商,第{}页数据「{}」条"
,
pageNum
,
responseDatas
.
size
());
if
(
responseDatas
.
size
()
<=
0
)
{
return
false
;
}
...
...
@@ -156,7 +154,11 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
for
(
int
index
=
0
;
index
<
responseDatas
.
size
();
index
++)
{
JSONObject
jsonObject
=
responseDatas
.
getJSONObject
(
index
);
String
dealerId
=
jsonObject
.
getString
(
"dealer_id"
);
if
(
StringUtils
.
isBlank
(
dealerId
)||
(
dealerId
.
length
()
!=
6
)
||
dealerIdsR
.
contains
(
dealerId
)){
if
(
Objects
.
isNull
(
dealerId
)){
dealerId
=
jsonObject
.
getString
(
"dealer_code"
);
jsonObject
.
put
(
"dealer_id"
,
dealerId
);
}
if
(
StringUtils
.
isBlank
(
dealerId
)||
dealerIdsR
.
contains
(
dealerId
)){
continue
;
}
dealerJsons
.
add
(
jsonObject
);
...
...
@@ -167,7 +169,7 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
if
(
CollectionUtils
.
isEmpty
(
dealerJsons
)){
return
true
;
}
log
.
info
(
"勤策-
同步一周内修改过的经销商
,第{}页数据「{}」条"
,
pageNum
,
dealerJsons
.
size
());
log
.
info
(
"勤策-
经销商新增
,第{}页数据「{}」条"
,
pageNum
,
dealerJsons
.
size
());
qinceDealerDao
.
saveList
(
dealerJsons
);
redisCache
.
putAllHash
(
RedisKeys
.
UserKeys
.
DEALER_HAVE_LIST
.
getKey
(),
dealers
);
return
true
;
...
...
@@ -177,7 +179,6 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
private
boolean
booleanshopDetailPage
(
Integer
pageNum
)
{
// 查找一周内修改或新增的数据
Map
<
String
,
Object
>
params
=
qinCeUtils
.
queryShopParam
(
pageNum
);
String
url
=
qinCeUtils
.
builderUrl
(
QinCeUtils
.
QUERY_SHORE
,
params
);
...
...
@@ -191,7 +192,7 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
log
.
info
(
"勤策-同步一周内修改过的终端store数据,第{}页数据「{}」条"
,
pageNum
,
responseDatas
.
size
());
qinCeClienteleShopDao
.
shopDetailAllTask
(
responseDatas
);
promotionStoreDao
.
qinceShopDetailAllTask
(
responseDatas
);
//
promotionStoreDao.qinceShopDetailAllTask(responseDatas);
return
true
;
}
}
src/main/java/com/wangxiaolu/promotion/utils/QinCeUtils.java
浏览文件 @
14b1b661
...
...
@@ -110,10 +110,9 @@ public class QinCeUtils {
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
// 分页页码,默认1
params
.
put
(
"page_number"
,
pageNum
);
// 记录状态。0:已删除(客户回收站中的终端数据),1:正常
// params.put("status", "1");
// after_modify_date:更新时间之后,查询更新时间之后的门店数据。格式:yyyy-MM-dd HH:mm:SS
DateTime
dateTime
=
DateUtil
.
offsetDay
(
new
Date
(),
-
7
);
// after_modify_date:更新时间之后,查询更新时间之后的门店数据。格式:yyyy-MM-dd HH:mm:SS
DateTime
dateTime
=
DateUtil
.
offsetDay
(
new
Date
(),
-
2
);
params
.
put
(
"after_modify_date"
,
DateUtil
.
format
(
dateTime
,
DatePattern
.
NORM_DATETIME_PATTERN
));
return
params
;
}
...
...
@@ -158,10 +157,11 @@ public class QinCeUtils {
public
Map
<
String
,
Object
>
queryDealerParam
(
Integer
pageNum
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"page_number"
,
pageNum
);
// 记录状态。0:已删除,1:正常
params
.
put
(
"status"
,
"1"
);
// 全量数据同步后,再开启指定日期同步
DateTime
dateTime
=
DateUtil
.
offsetDay
(
new
Date
(),
-
7
);
DateTime
dateTime
=
DateUtil
.
offsetDay
(
new
Date
(),
-
2
);
params
.
put
(
"after_create_date"
,
DateUtil
.
format
(
dateTime
,
DatePattern
.
NORM_DATETIME_PATTERN
));
return
params
;
}
...
...
src/main/java/com/wangxiaolu/promotion/xxljobtask/XxlJobHandler.java
浏览文件 @
14b1b661
...
...
@@ -51,7 +51,7 @@ public class XxlJobHandler {
/**
* 同步[终端数据]
*
7
日内有更新的终端
*
近2
日内有更新的终端
* 0 0 0
*/
@XxlJob
(
"qince_shop_task"
)
...
...
@@ -87,6 +87,7 @@ public class XxlJobHandler {
/**
* 同步[经销商列表]
* 近2日内更新的经销商
* 0 0 2
*/
@XxlJob
(
"qince_dealers"
)
...
...
src/main/resources/application-dev.yml
浏览文件 @
14b1b661
...
...
@@ -85,11 +85,11 @@ xxl:
job
:
accessToken
:
default_token
admin
:
addresses
:
http://
42.193.103.153
:9001/xxl-job-admin
addresses
:
http://
192.168.100.38
:9001/xxl-job-admin
executor
:
appname
:
promotion-dev
port
:
999
9
port
:
999
6
logretentiondays
:
30
address
:
ip
:
logpath
:
/
var/logs
/xxl_job
# 执行器日志路径
logpath
:
/
Users/a02200059/Desktop/wangxiaolu-sfa/log
/xxl_job
# 执行器日志路径
\ No newline at end of file
src/main/resources/mapper/QinceDealerMapper.xml
浏览文件 @
14b1b661
...
...
@@ -24,6 +24,9 @@
(#{item.dealer_id}, #{item.dealer_name},
#{item.dealer_cooperate_status},#{item.create_time})
</foreach>
ON DUPLICATE KEY UPDATE
dealer_name = values(dealer_name),
dealer_cooperate_status = values(dealer_cooperate_status);
</insert>
</mapper>
src/test/java/com/wangxiaolu/promotion/service/user/impl/QinCeDataTaskServiceImplTest.java
0 → 100644
浏览文件 @
14b1b661
package
com
.
wangxiaolu
.
promotion
.
service
.
user
.
impl
;
import
com.wangxiaolu.promotion.service.user.QinCeDataTaskService
;
import
org.junit.jupiter.api.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
/**
* @author : liqiulin
* @date : 2025-01-02 14
* @describe :
*/
@SpringBootTest
@RunWith
(
SpringRunner
.
class
)
class
QinCeDataTaskServiceImplTest
{
@Autowired
private
QinCeDataTaskService
qinCeDataTaskService
;
@Test
void
productDealers
()
{
qinCeDataTaskService
.
productDealers
();
}
}
\ No newline at end of file
src/test/java/com/wangxiaolu/promotion/xxljobtask/ActivityTypeXxlJobHandlerTest.java
浏览文件 @
14b1b661
...
...
@@ -17,11 +17,4 @@ import static org.junit.jupiter.api.Assertions.*;
@RunWith
(
SpringRunner
.
class
)
class
ActivityTypeXxlJobHandlerTest
{
@Autowired
ActivityTypeXxlJobHandler
activityTypeXxlJobHandler
;
@Test
void
activityTypePattern
()
{
activityTypeXxlJobHandler
.
activityTypePattern
();
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论