Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
1cfccccf
Commit
1cfccccf
authored
May 10, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开发 每天下单门店 需求
parent
467cb1f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
144 additions
and
0 deletions
+144
-0
order-application-service/src/main/java/cn/freemud/constant/RedisKeyConstant.java
+5
-0
order-application-service/src/main/java/cn/freemud/controller/OrderReportJobHandler.java
+72
-0
order-application-service/src/main/java/cn/freemud/entities/dto/openplatform/PushOrderStoreDto.java
+20
-0
order-application-service/src/main/java/cn/freemud/entities/dto/openplatform/ReportStoreIdsRequestVo.java
+23
-0
order-application-service/src/main/java/cn/freemud/service/thirdparty/StoreBackstageClient.java
+24
-0
No files found.
order-application-service/src/main/java/cn/freemud/constant/RedisKeyConstant.java
View file @
1cfccccf
...
...
@@ -84,6 +84,11 @@ public class RedisKeyConstant {
/**
* 记录当日下单的门店
*/
public
final
static
String
KGD_NO_ORDER_STORE_DATE
=
"obs:no:order:store:date:"
;
/**
* cocoNotMadeGoods:商户号:门店号:yyyy-MM-dd
*
* @param partnerId
...
...
order-application-service/src/main/java/cn/freemud/controller/OrderReportJobHandler.java
0 → 100644
View file @
1cfccccf
package
cn
.
freemud
.
controller
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.constant.RedisKeyConstant
;
import
cn.freemud.entities.dto.openplatform.PushOrderStoreDto
;
import
cn.freemud.entities.dto.openplatform.ReportStoreIdsRequestVo
;
import
cn.freemud.redis.RedisCache
;
import
cn.freemud.service.thirdparty.StoreBackstageClient
;
import
cn.freemud.utils.LogUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.BoundHashOperations
;
import
org.springframework.stereotype.Component
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/5/10 下午4:18
* @description : 【ID1027442】 下单门店记录并每天推送门店
* 第二天凌晨4点 报上 上一天的门店支付情况
* 暂时放在这个位置, 等28版本上线, 需要使用xxl-job 定时器跑
*/
@Component
public
class
OrderReportJobHandler
{
@Autowired
private
RedisCache
redisCache
;
@Autowired
private
StoreBackstageClient
storeBackstageClient
;
public
void
execute
(
String
param
)
{
String
date
=
getYesterdayString
();
BoundHashOperations
<
String
,
String
,
Set
<
String
>>
boundHashOperations
=
redisCache
.
getRedisTemplate
().
boundHashOps
(
RedisKeyConstant
.
KGD_NO_ORDER_STORE_DATE
+
date
);
Map
<
String
,
Set
<
String
>>
entries
=
boundHashOperations
.
entries
();
LogUtil
.
info
(
"下单门店记录推送 entries"
,
entries
,
null
);
if
(
entries
!=
null
&&
!
entries
.
isEmpty
())
{
// 推送门店 服务
List
<
ReportStoreIdsRequestVo
>
requestDto
=
new
ArrayList
<>(
entries
.
size
());
entries
.
forEach
((
partnerId
,
storeIds
)
->
{
ReportStoreIdsRequestVo
build
=
ReportStoreIdsRequestVo
.
builder
().
partnerCode
(
partnerId
).
storeCodeList
(
storeIds
).
build
();
requestDto
.
add
(
build
);
});
// 发送服务
PushOrderStoreDto
pushOrderStoreDto
=
PushOrderStoreDto
.
builder
().
pushDate
(
date
)
.
partnerList
(
requestDto
)
.
build
();
BaseResponse
baseResponse
=
storeBackstageClient
.
pushOrderStore
(
pushOrderStoreDto
);
LogUtil
.
info
(
"上报门店支付情况"
,
pushOrderStoreDto
,
baseResponse
);
}
}
/**
* 需要获取 昨天的 yyyy-MM-dd
*
* @return
*/
private
String
getYesterdayString
()
{
Calendar
start
=
Calendar
.
getInstance
();
// 取昨天时间
start
.
add
(
5
,
-
1
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
//注意月份是MM
return
simpleDateFormat
.
format
(
start
.
getTime
());
}
}
order-application-service/src/main/java/cn/freemud/entities/dto/openplatform/PushOrderStoreDto.java
0 → 100644
View file @
1cfccccf
package
cn
.
freemud
.
entities
.
dto
.
openplatform
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/5/10 下午5:50
* @description :
*/
@Data
@Builder
public
class
PushOrderStoreDto
{
private
String
pushDate
;
private
List
<
ReportStoreIdsRequestVo
>
partnerList
;
}
order-application-service/src/main/java/cn/freemud/entities/dto/openplatform/ReportStoreIdsRequestVo.java
0 → 100644
View file @
1cfccccf
package
cn
.
freemud
.
entities
.
dto
.
openplatform
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Set
;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/5/10 下午5:02
* @description :
*/
@Data
@Builder
public
class
ReportStoreIdsRequestVo
{
String
partnerCode
;
Set
<
String
>
storeCodeList
;
}
order-application-service/src/main/java/cn/freemud/service/thirdparty/StoreBackstageClient.java
0 → 100644
View file @
1cfccccf
package
cn
.
freemud
.
service
.
thirdparty
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.entities.dto.openplatform.PushOrderStoreDto
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/5/10 下午5:45
* @description :
*/
@FeignClient
(
name
=
"STORE-BACKSTAGE"
)
@RequestMapping
(
consumes
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
interface
StoreBackstageClient
{
@PostMapping
(
"/orderStore/pushOrderStore"
)
BaseResponse
pushOrderStore
(
@RequestBody
PushOrderStoreDto
request
);
}
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