Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
a6758082
Commit
a6758082
authored
Jun 27, 2023
by
jinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用订单购买接口
parent
290918de
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
294 additions
and
27 deletions
+294
-27
AppOrderApiService.java
...haoban/manage/api/service/licence/AppOrderApiService.java
+9
-0
TabHaobanAppOrderMapper.java
...an/manage/service/dao/mapper/TabHaobanAppOrderMapper.java
+6
-0
TabHaobanAppOrderService.java
...oban/manage/service/service/TabHaobanAppOrderService.java
+15
-0
TabHaobanAppOrderServiceImpl.java
...ge/service/service/impl/TabHaobanAppOrderServiceImpl.java
+10
-0
AppOrderApiServiceImpl.java
...vice/service/out/impl/licence/AppOrderApiServiceImpl.java
+223
-15
TabHaobanAppOrderMapper.xml
...ice/src/main/resources/mapper/TabHaobanAppOrderMapper.xml
+8
-0
AppOrderController.java
...ban/manage/web/controller/licence/AppOrderController.java
+8
-8
LicenceOrderController.java
...manage/web/controller/licence/LicenceOrderController.java
+14
-2
AppOrderCheckVO.java
...com/gic/haoban/manage/web/vo/licence/AppOrderCheckVO.java
+0
-1
AppOrderNoticeVO.java
...om/gic/haoban/manage/web/vo/licence/AppOrderNoticeVO.java
+1
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/licence/AppOrderApiService.java
View file @
a6758082
...
@@ -58,5 +58,14 @@ public interface AppOrderApiService {
...
@@ -58,5 +58,14 @@ public interface AppOrderApiService {
*/
*/
ServiceResponse
<
Boolean
>
qywxCallBack
(
String
param
);
ServiceResponse
<
Boolean
>
qywxCallBack
(
String
param
);
/**
* 定时获取好办付费应用订单列表
* @param param {"start_time" : 1542091572,"end_time" : 1542177972,"test_mode" : 1}
* @return
*/
ServiceResponse
<
Boolean
>
getAppOrderList
(
String
param
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanAppOrderMapper.java
View file @
a6758082
...
@@ -82,5 +82,11 @@ public interface TabHaobanAppOrderMapper {
...
@@ -82,5 +82,11 @@ public interface TabHaobanAppOrderMapper {
List
<
TabHaobanAppOrder
>
getAppOrderPage
(
AppOrderPageQDTO
qdto
);
List
<
TabHaobanAppOrder
>
getAppOrderPage
(
AppOrderPageQDTO
qdto
);
/**
* @param orderId 企业微信订单id
* @return 实例对象
*/
TabHaobanAppOrder
queryByOrderId
(
@Param
(
"orderId"
)
String
orderId
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/TabHaobanAppOrderService.java
View file @
a6758082
...
@@ -5,6 +5,8 @@ import com.gic.haoban.manage.api.dto.licence.AppOrderPageDTO;
...
@@ -5,6 +5,8 @@ import com.gic.haoban.manage.api.dto.licence.AppOrderPageDTO;
import
com.gic.haoban.manage.api.dto.qdto.licence.AppOrderPageQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.AppOrderPageQDTO
;
import
com.gic.haoban.manage.service.entity.TabHaobanAppOrder
;
import
com.gic.haoban.manage.service.entity.TabHaobanAppOrder
;
import
java.util.List
;
/**
/**
* (TabHaobanAppOrder)表服务接口
* (TabHaobanAppOrder)表服务接口
*
*
...
@@ -30,6 +32,12 @@ public interface TabHaobanAppOrderService {
...
@@ -30,6 +32,12 @@ public interface TabHaobanAppOrderService {
TabHaobanAppOrder
insert
(
TabHaobanAppOrder
tabHaobanAppOrder
);
TabHaobanAppOrder
insert
(
TabHaobanAppOrder
tabHaobanAppOrder
);
/**
/**
* 批量新增数据
* @param entities
*/
void
insertBatch
(
List
<
TabHaobanAppOrder
>
entities
);
/**
* 修改数据
* 修改数据
*
*
* @param tabHaobanAppOrder 实例对象
* @param tabHaobanAppOrder 实例对象
...
@@ -47,4 +55,11 @@ public interface TabHaobanAppOrderService {
...
@@ -47,4 +55,11 @@ public interface TabHaobanAppOrderService {
Page
<
AppOrderPageDTO
>
getAppOrderPage
(
AppOrderPageQDTO
qdto
);
Page
<
AppOrderPageDTO
>
getAppOrderPage
(
AppOrderPageQDTO
qdto
);
/**
* 根据企业微信订单id查询
* @param orderId
* @return
*/
TabHaobanAppOrder
queryByOrderId
(
String
orderId
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/TabHaobanAppOrderServiceImpl.java
View file @
a6758082
...
@@ -51,6 +51,11 @@ public class TabHaobanAppOrderServiceImpl implements TabHaobanAppOrderService {
...
@@ -51,6 +51,11 @@ public class TabHaobanAppOrderServiceImpl implements TabHaobanAppOrderService {
return
tabHaobanAppOrder
;
return
tabHaobanAppOrder
;
}
}
@Override
public
void
insertBatch
(
List
<
TabHaobanAppOrder
>
entities
)
{
this
.
tabHaobanAppOrderMapper
.
insertBatch
(
entities
);
}
/**
/**
* 修改数据
* 修改数据
*
*
...
@@ -83,4 +88,9 @@ public class TabHaobanAppOrderServiceImpl implements TabHaobanAppOrderService {
...
@@ -83,4 +88,9 @@ public class TabHaobanAppOrderServiceImpl implements TabHaobanAppOrderService {
List
<
TabHaobanAppOrder
>
page
=
tabHaobanAppOrderMapper
.
getAppOrderPage
(
qdto
);
List
<
TabHaobanAppOrder
>
page
=
tabHaobanAppOrderMapper
.
getAppOrderPage
(
qdto
);
return
PageHelperUtils
.
changePageHelperToCurrentPage
(
page
,
AppOrderPageDTO
.
class
);
return
PageHelperUtils
.
changePageHelperToCurrentPage
(
page
,
AppOrderPageDTO
.
class
);
}
}
@Override
public
TabHaobanAppOrder
queryByOrderId
(
String
orderId
)
{
return
tabHaobanAppOrderMapper
.
queryByOrderId
(
orderId
);
}
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/licence/AppOrderApiServiceImpl.java
View file @
a6758082
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
.
licence
;
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
.
licence
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.enterprise.api.constant.EnterpriseServiceEnum
;
import
com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto
;
import
com.gic.enterprise.api.service.EnterpriseUseForbidService
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.licence.AppOrderCheckDTO
;
import
com.gic.haoban.manage.api.dto.licence.AppOrderCheckDTO
;
import
com.gic.haoban.manage.api.dto.licence.AppOrderNoticeDTO
;
import
com.gic.haoban.manage.api.dto.licence.AppOrderNoticeDTO
;
...
@@ -16,9 +20,15 @@ import com.gic.haoban.manage.api.dto.qdto.licence.AppOrderQDTO;
...
@@ -16,9 +20,15 @@ import com.gic.haoban.manage.api.dto.qdto.licence.AppOrderQDTO;
import
com.gic.haoban.manage.api.service.licence.AppOrderApiService
;
import
com.gic.haoban.manage.api.service.licence.AppOrderApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.entity.TabHaobanAppOrder
;
import
com.gic.haoban.manage.service.entity.TabHaobanAppOrder
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated
;
import
com.gic.haoban.manage.service.service.TabHaobanAppOrderService
;
import
com.gic.haoban.manage.service.service.TabHaobanAppOrderService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseRelatedService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.util.SignatureGetterUtil
;
import
com.gic.haoban.manage.service.util.SignatureGetterUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.wechat.api.dto.qywx.fee.AppOrderInfoResponseDTO
;
import
com.gic.wechat.api.dto.qywx.fee.AppOrderResponseListDTO
;
import
com.gic.wechat.api.dto.qywx.fee.OpenOrderResponseDTO
;
import
com.gic.wechat.api.dto.qywx.fee.OpenOrderResponseDTO
;
import
com.gic.wechat.api.dto.qywx.response.QywxResponseDTO
;
import
com.gic.wechat.api.dto.qywx.response.QywxResponseDTO
;
import
com.gic.wechat.api.service.qywx.QywxOrderApiService
;
import
com.gic.wechat.api.service.qywx.QywxOrderApiService
;
...
@@ -27,6 +37,7 @@ import org.apache.logging.log4j.Logger;
...
@@ -27,6 +37,7 @@ import org.apache.logging.log4j.Logger;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -50,16 +61,20 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
...
@@ -50,16 +61,20 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
private
Config
config
;
private
Config
config
;
@Autowired
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
private
EnterpriseUseForbidService
enterpriseUseForbidService
;
@Autowired
private
WxEnterpriseRelatedService
wxEnterpriseRelatedService
;
@Override
@Override
public
ServiceResponse
<
Page
<
AppOrderPageDTO
>>
getAppOrderPage
(
AppOrderPageQDTO
qdto
)
{
public
ServiceResponse
<
Page
<
AppOrderPageDTO
>>
getAppOrderPage
(
AppOrderPageQDTO
qdto
)
{
Page
<
AppOrderPageDTO
>
orderPage
=
tabHaobanAppOrderService
.
getAppOrderPage
(
qdto
);
Page
<
AppOrderPageDTO
>
orderPage
=
tabHaobanAppOrderService
.
getAppOrderPage
(
qdto
);
List
<
AppOrderPageDTO
>
list
=
orderPage
.
getResult
();
List
<
AppOrderPageDTO
>
list
=
orderPage
.
getResult
();
if
(
CollUtil
.
isNotEmpty
(
list
)){
if
(
CollUtil
.
isNotEmpty
(
list
))
{
Date
now
=
new
Date
();
Date
now
=
new
Date
();
//判断支付时间是否过期,需要更改订单状态,已过期的订单默认取消
//判断支付时间是否过期,需要更改订单状态,已过期的订单默认取消
for
(
AppOrderPageDTO
dto
:
list
){
for
(
AppOrderPageDTO
dto
:
list
)
{
if
(
dto
.
getOrderStatus
()
==
1
&&
now
.
after
(
dto
.
getExpireTime
())){
if
(
dto
.
getOrderStatus
()
==
1
&&
now
.
after
(
dto
.
getExpireTime
()))
{
dto
.
setOrderStatus
(
3
);
dto
.
setOrderStatus
(
3
);
//需要取消订单
//需要取消订单
cancelAppOrder
(
dto
.
getId
());
cancelAppOrder
(
dto
.
getId
());
...
@@ -140,7 +155,7 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
...
@@ -140,7 +155,7 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
json
.
put
(
"nonce_str"
,
nonceStr
);
json
.
put
(
"nonce_str"
,
nonceStr
);
json
.
put
(
"ts"
,
timeStamp
);
json
.
put
(
"ts"
,
timeStamp
);
try
{
try
{
logger
.
info
(
"签名算法参数校验:{}"
,
JSON
.
toJSONString
(
json
));
logger
.
info
(
"签名算法参数校验:{}"
,
JSON
.
toJSONString
(
json
));
sig
=
signatureGetterUtil
.
get
(
JSON
.
toJSONString
(
json
));
sig
=
signatureGetterUtil
.
get
(
JSON
.
toJSONString
(
json
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
info
(
"签名算法异常!"
);
logger
.
info
(
"签名算法异常!"
);
...
@@ -164,7 +179,7 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
...
@@ -164,7 +179,7 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
appOrder
.
setUpdateTime
(
now
);
appOrder
.
setUpdateTime
(
now
);
appOrder
.
setDeleteFlag
(
0
);
appOrder
.
setDeleteFlag
(
0
);
//默认6天支付有效期
//默认6天支付有效期
appOrder
.
setExpireTime
(
DateUtil
.
addDay
(
now
,
6
));
appOrder
.
setExpireTime
(
DateUtil
.
addDay
(
now
,
6
));
tabHaobanAppOrderService
.
insert
(
appOrder
);
tabHaobanAppOrderService
.
insert
(
appOrder
);
return
ServiceResponse
.
success
(
true
);
return
ServiceResponse
.
success
(
true
);
}
}
...
@@ -174,7 +189,7 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
...
@@ -174,7 +189,7 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
@Override
@Override
public
ServiceResponse
<
Boolean
>
cancelAppOrder
(
Long
orderId
)
{
public
ServiceResponse
<
Boolean
>
cancelAppOrder
(
Long
orderId
)
{
TabHaobanAppOrder
appOrder
=
tabHaobanAppOrderService
.
queryById
(
orderId
);
TabHaobanAppOrder
appOrder
=
tabHaobanAppOrderService
.
queryById
(
orderId
);
if
(
null
==
appOrder
){
if
(
null
==
appOrder
)
{
return
ServiceResponse
.
failure
(
"-9999"
,
"无效的orderId!"
);
return
ServiceResponse
.
failure
(
"-9999"
,
"无效的orderId!"
);
}
}
String
wxEnterpriseId
=
appOrder
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
appOrder
.
getWxEnterpriseId
();
...
@@ -189,11 +204,11 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
...
@@ -189,11 +204,11 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
String
nonceStr
=
signatureGetterUtil
.
genNonce
();
String
nonceStr
=
signatureGetterUtil
.
genNonce
();
String
sig
=
null
;
String
sig
=
null
;
JSONObject
json
=
new
JSONObject
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"order_id"
,
appOrder
.
getOrderId
());
json
.
put
(
"order_id"
,
appOrder
.
getOrderId
());
json
.
put
(
"nonce_str"
,
nonceStr
);
json
.
put
(
"nonce_str"
,
nonceStr
);
json
.
put
(
"ts"
,
timeStamp
);
json
.
put
(
"ts"
,
timeStamp
);
try
{
try
{
logger
.
info
(
"签名算法参数校验:{}"
,
JSON
.
toJSONString
(
json
));
logger
.
info
(
"签名算法参数校验:{}"
,
JSON
.
toJSONString
(
json
));
sig
=
signatureGetterUtil
.
get
(
JSON
.
toJSONString
(
json
));
sig
=
signatureGetterUtil
.
get
(
JSON
.
toJSONString
(
json
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
info
(
"签名算法异常!"
);
logger
.
info
(
"签名算法异常!"
);
...
@@ -203,7 +218,7 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
...
@@ -203,7 +218,7 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
//调用企业微信创建收款订单接口
//调用企业微信创建收款订单接口
ServiceResponse
<
QywxResponseDTO
>
response
=
qywxOrderApiService
.
cancelOpenOrder
(
serviceCorpid
,
openCorpid
,
JSON
.
toJSONString
(
json
));
ServiceResponse
<
QywxResponseDTO
>
response
=
qywxOrderApiService
.
cancelOpenOrder
(
serviceCorpid
,
openCorpid
,
JSON
.
toJSONString
(
json
));
logger
.
info
(
"调用企业微信创建收款订单返回信息:{}"
,
JSON
.
toJSONString
(
response
));
logger
.
info
(
"调用企业微信创建收款订单返回信息:{}"
,
JSON
.
toJSONString
(
response
));
if
(
response
.
isSuccess
()){
if
(
response
.
isSuccess
())
{
TabHaobanAppOrder
newAppOrder
=
new
TabHaobanAppOrder
();
TabHaobanAppOrder
newAppOrder
=
new
TabHaobanAppOrder
();
newAppOrder
.
setId
(
appOrder
.
getId
());
newAppOrder
.
setId
(
appOrder
.
getId
());
newAppOrder
.
setOrderStatus
(
3
);
newAppOrder
.
setOrderStatus
(
3
);
...
@@ -216,19 +231,212 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
...
@@ -216,19 +231,212 @@ public class AppOrderApiServiceImpl implements AppOrderApiService {
@Override
@Override
public
ServiceResponse
<
AppOrderCheckDTO
>
checkAppOrder
(
String
wxEnterpriseId
)
{
public
ServiceResponse
<
AppOrderCheckDTO
>
checkAppOrder
(
String
wxEnterpriseId
)
{
AppOrderPageQDTO
qdto
=
new
AppOrderPageQDTO
();
return
null
;
AppOrderCheckDTO
result
=
new
AppOrderCheckDTO
();
Date
now
=
new
Date
();
Date
endTime
=
DateUtil
.
addDay
(
now
,
-
1
);
result
.
setNow
(
now
);
List
<
TabHaobanWxEnterpriseRelated
>
enterpriseIdList
=
wxEnterpriseRelatedService
.
getByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollUtil
.
isNotEmpty
(
enterpriseIdList
))
{
for
(
TabHaobanWxEnterpriseRelated
a
:
enterpriseIdList
)
{
//查询好办企业到期时间
ServiceResponse
<
EnterpriseUsingPermissionDto
>
resp
=
this
.
enterpriseUseForbidService
.
getPermisssionByCode
(
a
.
getEnterpriseId
(),
EnterpriseServiceEnum
.
HAO_BAN
.
getRightMenuCode
());
if
(
resp
.
isSuccess
())
{
EnterpriseUsingPermissionDto
dto
=
resp
.
getResult
();
Date
endDate
=
dto
.
getServiceEndDate
();
if
(
endTime
.
before
(
endDate
))
{
endTime
=
endDate
;
}
}
}
if
(
endTime
.
after
(
now
)){
int
i
=
DateUtil
.
daysBetween
(
now
,
endTime
);
result
.
setContractDay
(
i
);
}
}
qdto
.
setWxEnterpriseId
(
wxEnterpriseId
);
qdto
.
setPageNum
(
1
);
qdto
.
setPageSize
(
Integer
.
MAX_VALUE
);
Page
<
AppOrderPageDTO
>
page
=
getAppOrderPage
(
qdto
).
getResult
();
List
<
AppOrderPageDTO
>
list
=
page
.
getResult
();
if
(
CollUtil
.
isNotEmpty
(
list
))
{
endTime
=
DateUtil
.
addDay
(
now
,
-
1
);
Integer
num
=
0
;
for
(
AppOrderPageDTO
dto
:
list
)
{
if
(
dto
.
getOrderStatus
()
==
2
&&
endTime
.
before
(
dto
.
getEndTime
())){
endTime
=
dto
.
getEndTime
();
num
+=
dto
.
getUserNum
();
}
}
if
(
num
>=
1000000
){
result
.
setUserNum
(
1000000
);
}
else
{
result
.
setUserNum
(
num
);
}
if
(
now
.
before
(
endTime
)){
result
.
setType
(
2
);
}
else
{
result
.
setType
(
1
);
}
}
else
{
result
.
setType
(
0
);
}
return
ServiceResponse
.
success
(
result
);
}
}
@Override
@Override
public
ServiceResponse
<
AppOrderNoticeDTO
>
noticeAppOrder
(
String
wxEnterpriseId
)
{
public
ServiceResponse
<
AppOrderNoticeDTO
>
noticeAppOrder
(
String
wxEnterpriseId
)
{
AppOrderPageQDTO
qdto
=
new
AppOrderPageQDTO
();
return
null
;
AppOrderNoticeDTO
result
=
new
AppOrderNoticeDTO
();
qdto
.
setWxEnterpriseId
(
wxEnterpriseId
);
qdto
.
setPageNum
(
1
);
qdto
.
setPageSize
(
Integer
.
MAX_VALUE
);
Page
<
AppOrderPageDTO
>
page
=
getAppOrderPage
(
qdto
).
getResult
();
List
<
AppOrderPageDTO
>
list
=
page
.
getResult
();
Date
now
=
new
Date
();
Date
endTime
=
DateUtil
.
addDay
(
now
,
-
1
);
boolean
flag
=
false
;
if
(
CollUtil
.
isNotEmpty
(
list
))
{
for
(
AppOrderPageDTO
dto
:
list
)
{
if
(
dto
.
getOrderStatus
()
==
1
){
result
.
setPayFlag
(
0
);
result
.
setOrderUrl
(
dto
.
getOrderUrl
());
}
if
(
dto
.
getOrderStatus
()
==
2
&&
endTime
.
before
(
dto
.
getEndTime
())){
endTime
=
dto
.
getEndTime
();
flag
=
true
;
}
}
if
(
DateUtil
.
addDay
(
now
,
30
).
before
(
endTime
)){
result
.
setType
(
0
);
result
.
setEndTime
(
endTime
);
}
else
if
(
now
.
before
(
endTime
)){
result
.
setType
(
4
);
result
.
setEndTime
(
endTime
);
}
else
if
(
now
.
after
(
endTime
)){
if
(
flag
){
result
.
setType
(
2
);
result
.
setEndTime
(
endTime
);
}
else
{
result
.
setType
(
1
);
}
}
}
else
{
result
.
setType
(
1
);
}
return
ServiceResponse
.
success
(
result
);
}
}
@Override
@Override
public
ServiceResponse
<
Boolean
>
qywxCallBack
(
String
param
)
{
public
ServiceResponse
<
Boolean
>
qywxCallBack
(
String
param
)
{
logger
.
info
(
"接收企业微信回调参数:{}"
,
JSON
.
toJSONString
(
param
));
if
(
StrUtil
.
isBlank
(
param
))
{
return
ServiceResponse
.
success
(
false
);
}
JSONObject
object
=
JSONObject
.
parseObject
(
param
,
JSONObject
.
class
);
String
infoType
=
object
.
getString
(
"infoType"
);
String
orderId
=
object
.
getString
(
"orderId"
);
String
timeStamp
=
object
.
getString
(
"timeStamp"
);
//将秒级时间戳转换位Date类型
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
DateUtil
.
FORMAT_DATETIME_19
);
String
date_time
=
formatter
.
format
(
new
Date
(
Long
.
valueOf
(
timeStamp
)
*
1000L
));
Date
date
=
DateUtil
.
strToDate
(
date_time
,
DateUtil
.
FORMAT_DATETIME_19
);
TabHaobanAppOrder
orderInfo
=
tabHaobanAppOrderService
.
queryByOrderId
(
orderId
);
if
(
"open_order"
.
equals
(
infoType
)){
if
(
orderInfo
!=
null
){
logger
.
info
(
"已经存在收款订单:{}"
,
orderId
);
return
ServiceResponse
.
success
(
true
);
}
//不存在的需要根据订单id获取订单详情,并保存进数据库
String
suiteid
=
config
.
getSuiteid
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"orderid"
,
orderId
);
ServiceResponse
<
AppOrderInfoResponseDTO
>
response
=
qywxOrderApiService
.
getAppOrderInfo
(
suiteid
,
null
,
JSON
.
toJSONString
(
json
));
logger
.
info
(
"查询订单详情返回信息:{}"
,
JSON
.
toJSONString
(
response
));
if
(
response
.
isSuccess
()){
AppOrderInfoResponseDTO
result
=
response
.
getResult
();
String
paidCorpid
=
result
.
getPaidCorpid
();
TabHaobanWxEnterprise
wxEnterpriseInfo
=
wxEnterpriseService
.
getEnterpriseBycorpId
(
paidCorpid
);
if
(
wxEnterpriseInfo
==
null
){
logger
.
info
(
"客户企业的corpid:{}无效!"
,
paidCorpid
);
return
ServiceResponse
.
success
(
false
);
}
TabHaobanAppOrder
order
=
toTabHaobanAppOrder
(
result
,
wxEnterpriseInfo
.
getWxEnterpriseId
());
tabHaobanAppOrderService
.
insert
(
order
);
}
else
{
return
ServiceResponse
.
failure
(
response
.
getCode
(),
response
.
getMessage
());
}
}
if
(
"pay_for_app_success"
.
equals
(
infoType
)){
if
(
orderInfo
==
null
){
logger
.
info
(
"不存在收款订单:{}"
,
orderId
);
return
ServiceResponse
.
success
(
true
);
}
if
(
orderInfo
.
getPayTime
()
!=
null
){
//该笔订单已处理
logger
.
info
(
"该笔订单已处理!"
);
return
ServiceResponse
.
success
(
false
);
}
orderInfo
.
setOrderStatus
(
2
);
orderInfo
.
setPayTime
(
date
);
tabHaobanAppOrderService
.
update
(
orderInfo
);
}
if
(
"refund"
.
equals
(
infoType
)){
if
(
orderInfo
==
null
){
logger
.
info
(
"不存在收款订单:{}"
,
orderId
);
return
ServiceResponse
.
success
(
true
);
}
if
(
orderInfo
.
getOrderStatus
()
==
2
){
orderInfo
.
setOrderStatus
(
6
);
tabHaobanAppOrderService
.
update
(
orderInfo
);
}
}
return
ServiceResponse
.
success
(
true
);
}
return
null
;
@Override
public
ServiceResponse
<
Boolean
>
getAppOrderList
(
String
param
)
{
if
(
StrUtil
.
isBlank
(
param
)){
return
ServiceResponse
.
failure
(
"-9999"
,
"参数不能为空"
);
}
logger
.
info
(
"定时获取好办付费应用订单列表参数:{}"
,
param
);
String
suiteid
=
config
.
getSuiteid
();
ServiceResponse
<
AppOrderResponseListDTO
>
response
=
qywxOrderApiService
.
getAppOrderInfoList
(
suiteid
,
null
,
JSON
.
toJSONString
(
param
));
if
(
response
.
isSuccess
()){
AppOrderResponseListDTO
result
=
response
.
getResult
();
List
<
AppOrderInfoResponseDTO
>
orderList
=
result
.
getOrderList
();
if
(
CollUtil
.
isNotEmpty
(
orderList
)){
List
<
TabHaobanAppOrder
>
appOrderList
=
new
ArrayList
<>();
for
(
AppOrderInfoResponseDTO
dto
:
orderList
){
String
paidCorpid
=
dto
.
getPaidCorpid
();
TabHaobanWxEnterprise
wxEnterpriseInfo
=
wxEnterpriseService
.
getEnterpriseBycorpId
(
paidCorpid
);
if
(
wxEnterpriseInfo
==
null
){
logger
.
info
(
"客户企业的corpid:{}无效!"
,
paidCorpid
);
continue
;
}
TabHaobanAppOrder
order
=
toTabHaobanAppOrder
(
dto
,
wxEnterpriseInfo
.
getWxEnterpriseId
());
appOrderList
.
add
(
order
);
}
//批量插入
tabHaobanAppOrderService
.
insertBatch
(
appOrderList
);
}
}
return
ServiceResponse
.
failure
(
response
.
getCode
(),
response
.
getMessage
());
}
private
TabHaobanAppOrder
toTabHaobanAppOrder
(
AppOrderInfoResponseDTO
dto
,
String
wxEnterpriseId
){
TabHaobanAppOrder
appOrder
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
dto
),
TabHaobanAppOrder
.
class
);
Date
now
=
new
Date
();
appOrder
.
setOriginPrice
(
dto
.
getPrice
());
appOrder
.
setPaidPrice
(
dto
.
getPrice
());
appOrder
.
setUserNum
(
dto
.
getUserCount
());
appOrder
.
setDuration
(
dto
.
getOrderPeriod
());
appOrder
.
setCreatorId
(
dto
.
getOperatorId
());
appOrder
.
setId
(
UniqueIdUtils
.
uniqueLong
());
appOrder
.
setWxEnterpriseId
(
wxEnterpriseId
);
appOrder
.
setCreateTime
(
now
);
appOrder
.
setUpdateTime
(
now
);
appOrder
.
setDeleteFlag
(
0
);
//默认6天支付有效期
appOrder
.
setExpireTime
(
DateUtil
.
addDay
(
now
,
6
));
return
appOrder
;
}
}
}
}
haoban-manage3-service/src/main/resources/mapper/TabHaobanAppOrderMapper.xml
View file @
a6758082
...
@@ -265,5 +265,13 @@
...
@@ -265,5 +265,13 @@
</if>
</if>
</select>
</select>
<select
id=
"queryByOrderId"
resultMap=
"TabHaobanAppOrderMap"
>
select
id, wx_enterprise_id, order_id, order_status, order_type, user_num, duration, begin_time, end_time, pay_time, origin_price, paid_price, order_url, delete_flag, create_time, update_time, creator_id, creator_name,expire_time
from tab_haoban_app_order
where order_id = #{orderId} and delete_flag = 0
limit 1
</select>
</mapper>
</mapper>
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/licence/AppOrderController.java
View file @
a6758082
...
@@ -9,6 +9,8 @@ import com.gic.commons.webapi.reponse.RestResponse;
...
@@ -9,6 +9,8 @@ import com.gic.commons.webapi.reponse.RestResponse;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.manage.api.dto.licence.AppOrderCheckDTO
;
import
com.gic.haoban.manage.api.dto.licence.AppOrderNoticeDTO
;
import
com.gic.haoban.manage.api.dto.licence.AppOrderPageDTO
;
import
com.gic.haoban.manage.api.dto.licence.AppOrderPageDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.AppOrderPageQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.AppOrderPageQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.AppOrderQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.AppOrderQDTO
;
...
@@ -39,11 +41,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -39,11 +41,6 @@ import org.springframework.web.bind.annotation.RestController;
public
class
AppOrderController
{
public
class
AppOrderController
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
AppOrderController
.
class
);
private
static
Logger
logger
=
LogManager
.
getLogger
(
AppOrderController
.
class
);
@Autowired
private
EnterpriseService
enterpriseService
;
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
@Autowired
private
AppOrderApiService
appOrderApiService
;
private
AppOrderApiService
appOrderApiService
;
...
@@ -113,8 +110,9 @@ public class AppOrderController {
...
@@ -113,8 +110,9 @@ public class AppOrderController {
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
()))
{
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
()))
{
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
}
}
ServiceResponse
<
AppOrderCheckDTO
>
response
=
appOrderApiService
.
checkAppOrder
(
loginUser
.
getWxEnterpriseId
());
return
RestResponse
.
successResult
(
null
);
AppOrderCheckVO
vo
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
response
.
getResult
()),
AppOrderCheckVO
.
class
);
return
RestResponse
.
successResult
(
vo
);
}
}
/**
/**
...
@@ -126,7 +124,9 @@ public class AppOrderController {
...
@@ -126,7 +124,9 @@ public class AppOrderController {
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
()))
{
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
()))
{
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
}
}
return
RestResponse
.
successResult
(
null
);
ServiceResponse
<
AppOrderNoticeDTO
>
response
=
appOrderApiService
.
noticeAppOrder
(
loginUser
.
getWxEnterpriseId
());
AppOrderNoticeVO
vo
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
response
.
getResult
()),
AppOrderNoticeVO
.
class
);
return
RestResponse
.
successResult
(
vo
);
}
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/licence/LicenceOrderController.java
View file @
a6758082
...
@@ -3,6 +3,7 @@ package com.gic.haoban.manage.web.controller.licence;
...
@@ -3,6 +3,7 @@ package com.gic.haoban.manage.web.controller.licence;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
...
@@ -15,6 +16,7 @@ import com.gic.enterprise.api.service.EnterpriseService;
...
@@ -15,6 +16,7 @@ import com.gic.enterprise.api.service.EnterpriseService;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.licence.AppOrderNoticeDTO
;
import
com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO
;
import
com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO
;
import
com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO
;
import
com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO
;
import
com.gic.haoban.manage.api.dto.licence.RenewalUserDTO
;
import
com.gic.haoban.manage.api.dto.licence.RenewalUserDTO
;
...
@@ -22,6 +24,7 @@ import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
...
@@ -22,6 +24,7 @@ import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import
com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.RenewalUserQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.RenewalUserQDTO
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.licence.AppOrderApiService
;
import
com.gic.haoban.manage.api.service.licence.LicenceOrderApiService
;
import
com.gic.haoban.manage.api.service.licence.LicenceOrderApiService
;
import
com.gic.haoban.manage.web.config.Config
;
import
com.gic.haoban.manage.web.config.Config
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
...
@@ -74,6 +77,8 @@ public class LicenceOrderController {
...
@@ -74,6 +77,8 @@ public class LicenceOrderController {
private
Pay4WXService
pay4WXService
;
private
Pay4WXService
pay4WXService
;
@Autowired
@Autowired
private
Config
config
;
private
Config
config
;
@Autowired
private
AppOrderApiService
appOrderApiService
;
/**
/**
* 查询订单详情
* 查询订单详情
...
@@ -351,8 +356,15 @@ public class LicenceOrderController {
...
@@ -351,8 +356,15 @@ public class LicenceOrderController {
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
}
}
ServiceResponse
<
String
>
payLicenceOrder
=
licenceOrderApiService
.
isPayLicenceOrder
(
loginUser
.
getWxEnterpriseId
());
ServiceResponse
<
String
>
payLicenceOrder
=
licenceOrderApiService
.
isPayLicenceOrder
(
loginUser
.
getWxEnterpriseId
());
//todo 判断续期订单
AppOrderNoticeDTO
result
=
appOrderApiService
.
noticeAppOrder
(
loginUser
.
getWxEnterpriseId
()).
getResult
();
return
RestResponse
.
successResult
(
null
);
if
(
null
!=
result
&&
(
0
==
result
.
getType
()
||
4
==
result
.
getType
())){
if
(
StrUtil
.
isNotBlank
(
payLicenceOrder
.
getResult
())){
result
.
setType
(
3
);
result
.
setOrderId
(
payLicenceOrder
.
getResult
());
}
}
AppOrderNoticeVO
vo
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
result
),
AppOrderNoticeVO
.
class
);
return
RestResponse
.
successResult
(
vo
);
}
}
/**
/**
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/licence/AppOrderCheckVO.java
View file @
a6758082
...
@@ -42,6 +42,5 @@ public class AppOrderCheckVO implements Serializable {
...
@@ -42,6 +42,5 @@ public class AppOrderCheckVO implements Serializable {
/**
/**
* 当前时间
* 当前时间
*/
*/
private
Date
now
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/licence/AppOrderNoticeVO.java
View file @
a6758082
...
@@ -20,7 +20,7 @@ public class AppOrderNoticeVO implements Serializable {
...
@@ -20,7 +20,7 @@ public class AppOrderNoticeVO implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
/**
* 弹窗类型 0 无需弹窗 1 未购买付费应用弹窗 2付费应用已过期弹窗 3 查询购买许可账号是否存在未支付订单
* 弹窗类型 0 无需弹窗 1 未购买付费应用弹窗 2付费应用已过期弹窗 3 查询购买许可账号是否存在未支付订单
4登录好办,即将过期弹窗
*/
*/
private
Integer
type
;
private
Integer
type
;
/**
/**
...
...
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