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
75787816
Commit
75787816
authored
Mar 23, 2023
by
jinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企业账号许可购买接口开发
parent
58cfa3a6
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
236 additions
and
75 deletions
+236
-75
LicenceOrderApiService.java
...an/manage/api/service/licence/LicenceOrderApiService.java
+11
-2
TabHaobanLicenceOrderMapper.java
...rvice/dao/mapper/licence/TabHaobanLicenceOrderMapper.java
+31
-5
TabHaobanLicenceOrder.java
.../manage/service/entity/licence/TabHaobanLicenceOrder.java
+9
-0
LicenceOrderService.java
...n/manage/service/service/licence/LicenceOrderService.java
+17
-3
LicenceOrderServiceImpl.java
...service/service/licence/impl/LicenceOrderServiceImpl.java
+20
-15
LicenceOrderApiServiceImpl.java
.../service/out/impl/licence/LicenceOrderApiServiceImpl.java
+57
-8
TabHaobanLicenceOrderMapper.xml
.../resources/mapper/licence/TabHaobanLicenceOrderMapper.xml
+39
-4
Config.java
...rc/main/java/com/gic/haoban/manage/web/config/Config.java
+1
-1
LicenceOrderController.java
...manage/web/controller/licence/LicenceOrderController.java
+33
-35
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+1
-0
LicenceOrderQO.java
.../com/gic/haoban/manage/web/qo/licence/LicenceOrderQO.java
+17
-2
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/licence/LicenceOrderApiService.java
View file @
75787816
...
...
@@ -73,7 +73,7 @@ public interface LicenceOrderApiService {
* @param orderId 订单id
* @return
*/
ServiceResponse
<
Boolean
>
payLicenceOrder
(
Long
orderId
);
ServiceResponse
<
Boolean
>
payLicenceOrder
(
Long
orderId
,
String
wxEnterpriseId
);
/**
* 查询企业是否存在订单未支付接口
...
...
@@ -81,7 +81,7 @@ public interface LicenceOrderApiService {
* @param wxEnterpriseId 企业微信id
* @return
*/
ServiceResponse
<
Boolean
>
isPayLicenceOrder
(
String
wxEnterpriseId
);
ServiceResponse
<
String
>
isPayLicenceOrder
(
String
wxEnterpriseId
);
/**
* 微信通知回调接口
...
...
@@ -91,6 +91,15 @@ public interface LicenceOrderApiService {
* 企业微信通知回调接口
*/
ServiceResponse
<
Boolean
>
qywxCallBack
(
String
params
);
/**
* 保存微信交易信息
* @param orderId 订单id
* @param transactionCode 订单编号
* @param prepayId 微信预支付id
* @param wxOrderId 微信支付id
* @return
*/
ServiceResponse
<
Boolean
>
saveTransactionCode
(
Long
orderId
,
String
transactionCode
,
String
prepayId
,
String
wxOrderId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/licence/TabHaobanLicenceOrderMapper.java
View file @
75787816
package
com
.
gic
.
haoban
.
manage
.
service
.
dao
.
mapper
.
licence
;
import
com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO
;
import
com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -9,7 +8,7 @@ import java.util.List;
/**
* <p>
*
Mapper 接口
* Mapper 接口
* </p>
*
* @author jx
...
...
@@ -19,6 +18,7 @@ public interface TabHaobanLicenceOrderMapper {
/**
* 获取订单详情
*
* @param orderId
* @return
*/
...
...
@@ -26,6 +26,7 @@ public interface TabHaobanLicenceOrderMapper {
/**
* 新增订单
*
* @param tabHaobanLicenceOrder
* @return
*/
...
...
@@ -33,6 +34,7 @@ public interface TabHaobanLicenceOrderMapper {
/**
* 删除订单
*
* @param orderId
* @return
*/
...
...
@@ -40,33 +42,57 @@ public interface TabHaobanLicenceOrderMapper {
/**
* 跟新订单状态
*
* @param orderId
* @param type
* @return
*/
Integer
updateLicenceOrderType
(
@Param
(
"orderId"
)
Long
orderId
,
@Param
(
"type"
)
Integer
type
);
Integer
updateLicenceOrderType
(
@Param
(
"orderId"
)
Long
orderId
,
@Param
(
"type"
)
Integer
type
);
/**
* 跟新企业微信订单状态
*
* @param orderId
* @param type
* @return
*/
Integer
updateQywxOrderType
(
@Param
(
"orderId"
)
Long
orderId
,
@Param
(
"type"
)
Integer
type
);
/**
* 上次订单支付凭证
*
* @param orderId
* @param voucher
* @return
*/
Integer
uploadLicenceOrderVoucher
(
@Param
(
"orderId"
)
Long
orderId
,
@Param
(
"voucher"
)
String
voucher
);
Integer
uploadLicenceOrderVoucher
(
@Param
(
"orderId"
)
Long
orderId
,
@Param
(
"voucher"
)
String
voucher
);
/**
* 根据wxEnterpriseId查询企业是否存在未支付订单
*
* @param wxEnterpriseId
* @return order_id
*/
String
selectByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
String
selectByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
/**
* 分页查询订单列表
*
* @param licenceOrderPageQDTO
* @return
*/
List
<
TabHaobanLicenceOrder
>
getLicenceOrderPage
(
LicenceOrderPageQDTO
licenceOrderPageQDTO
);
Integer
saveTransactionCode
(
@Param
(
"orderId"
)
Long
orderId
,
@Param
(
"transactionCode"
)
String
transactionCode
,
@Param
(
"prepayId"
)
String
prepayId
,
@Param
(
"wxOrderId"
)
String
wxOrderId
);
/**
* 获取订单详情
*
* @param transactionId
* @return
*/
TabHaobanLicenceOrder
selectByTransactionId
(
@Param
(
"transactionId"
)
String
transactionId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/licence/TabHaobanLicenceOrder.java
View file @
75787816
...
...
@@ -158,5 +158,14 @@ public class TabHaobanLicenceOrder implements Serializable {
* 到期时间
*/
private
Date
expireTime
;
/**
* 微信预支付交易id
*/
private
String
prepayId
;
/**
* 微信支付id
*/
private
String
wxOrderId
;
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/licence/LicenceOrderService.java
View file @
75787816
...
...
@@ -25,6 +25,7 @@ public interface LicenceOrderService {
/**
* 删除订单
*
* @param orderId 订单id
* @return
*/
...
...
@@ -32,6 +33,7 @@ public interface LicenceOrderService {
/**
* 新增或者修改订单
*
* @param licenceOrderQDTO
* @return orderId
*/
...
...
@@ -39,19 +41,21 @@ public interface LicenceOrderService {
/**
* 更新订单状态
*
* @param orderId 订单id
* @param type 订单状态
* @param type
订单状态
* @return
*/
Boolean
updateLicenceOrderType
(
Long
orderId
,
Integer
type
,
String
enterpriseId
,
String
wxEnterpriseId
,
String
creatorName
);
Boolean
updateLicenceOrderType
(
Long
orderId
,
Integer
type
,
String
enterpriseId
,
String
wxEnterpriseId
,
String
creatorName
);
/**
* 上次订单支付凭证
*
* @param orderId 订单id
* @param voucher 凭证url
* @return
*/
Boolean
uploadLicenceOrderVoucher
(
Long
orderId
,
String
voucher
,
String
enterpriseId
,
String
wxEnterpriseId
,
String
creatorName
);
Boolean
uploadLicenceOrderVoucher
(
Long
orderId
,
String
voucher
,
String
enterpriseId
,
String
wxEnterpriseId
,
String
creatorName
);
/**
* 查询企业是否存在订单未支付接口
...
...
@@ -63,11 +67,21 @@ public interface LicenceOrderService {
/**
* 分页查询订单列表
*
* @param licenceOrderPageQDTO
* @return
*/
Page
<
LicenceOrderPageDTO
>
getLicenceOrderPage
(
LicenceOrderPageQDTO
licenceOrderPageQDTO
);
/**
* 保存微信交易信息
* @param orderId 订单id
* @param transactionCode 订单编号
* @param prepayId 微信预支付id
* @param wxOrderId 微信支付id
* @return
*/
Integer
saveTransactionCode
(
Long
orderId
,
String
transactionCode
,
String
prepayId
,
String
wxOrderId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/licence/impl/LicenceOrderServiceImpl.java
View file @
75787816
...
...
@@ -2,7 +2,6 @@ package com.gic.haoban.manage.service.service.licence.impl;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.DateUtil
;
...
...
@@ -63,7 +62,6 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
saveOrUpdateLicenceOrder
(
LicenceOrderQDTO
licenceOrderQDTO
)
{
long
orderId
=
UniqueIdUtils
.
uniqueLong
();
if
(
ObjectUtil
.
isNull
(
licenceOrderQDTO
.
getOrderId
())){
//订单不支持修改,只能新增
TabHaobanLicenceOrder
order
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
licenceOrderQDTO
),
TabHaobanLicenceOrder
.
class
);
Date
now
=
new
Date
();
...
...
@@ -75,26 +73,28 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
expireTime
=
DateUtil
.
addNumForMinute
(
now
,
30
);
}
else
{
//生成订单编号
String
num
=
"ZH"
+
UniqueIdUtils
.
uniqueLong
()
;
String
num
=
"ZH"
+
orderId
;
order
.
setTransactionId
(
num
);
expireTime
=
DateUtil
.
addDay
(
now
,
3
);
}
order
.
setExpireTime
(
expireTime
);
tabHaobanLicenceOrderMapper
.
insert
(
order
);
//记录订单进度
saveOrderProgress
(
orderId
,
"创建订单"
,
licenceOrderQDTO
.
getEnterpriseId
(),
licenceOrderQDTO
.
getWxEnterpriseId
(),
licenceOrderQDTO
.
getCreatorName
());
}
saveOrderProgress
(
orderId
,
"创建订单"
,
licenceOrderQDTO
.
getEnterpriseId
(),
licenceOrderQDTO
.
getWxEnterpriseId
(),
licenceOrderQDTO
.
getCreatorName
()
,
1
,
null
,
null
);
return
String
.
valueOf
(
orderId
);
}
private
void
saveOrderProgress
(
Long
orderId
,
String
orderStatus
,
String
enterpriseId
,
String
wxEnterpriseId
,
String
creatorName
){
private
void
saveOrderProgress
(
Long
orderId
,
String
orderStatus
,
String
enterpriseId
,
String
wxEnterpriseId
,
String
creatorName
,
Integer
type
,
String
voucher
,
String
reason
){
TabHaobanLicenceOrderProgress
orderProgress
=
new
TabHaobanLicenceOrderProgress
();
orderProgress
.
setId
(
UniqueIdUtils
.
uniqueLong
());
orderProgress
.
setEnterpriseId
(
enterpriseId
);
orderProgress
.
setWxEnterpriseId
(
wxEnterpriseId
);
orderProgress
.
setOrderId
(
orderId
);
orderProgress
.
setOrderStatus
(
orderStatus
);
orderProgress
.
setType
(
1
);
orderProgress
.
setType
(
type
);
orderProgress
.
setVoucher
(
voucher
);
orderProgress
.
setReason
(
reason
);
orderProgress
.
setCreatorName
(
creatorName
);
tabHaobanLicenceOrderProgressMapper
.
insert
(
orderProgress
);
}
...
...
@@ -105,22 +105,22 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
//记录订单进度
switch
(
type
){
case
0
:
saveOrderProgress
(
orderId
,
"创建订单"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
);
saveOrderProgress
(
orderId
,
"创建订单"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
,
1
,
null
,
null
);
break
;
case
1
:
saveOrderProgress
(
orderId
,
"已支付"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
);
saveOrderProgress
(
orderId
,
"已支付"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
,
1
,
null
,
null
);
break
;
case
2
:
saveOrderProgress
(
orderId
,
"已取消"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
);
saveOrderProgress
(
orderId
,
"已取消"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
,
1
,
null
,
null
);
break
;
case
3
:
saveOrderProgress
(
orderId
,
"已过期"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
);
saveOrderProgress
(
orderId
,
"已过期"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
,
1
,
null
,
null
);
break
;
case
4
:
saveOrderProgress
(
orderId
,
"已退款"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
);
saveOrderProgress
(
orderId
,
"已退款"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
,
1
,
null
,
null
);
break
;
case
5
:
saveOrderProgress
(
orderId
,
"凭证已上传,审核中"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
);
saveOrderProgress
(
orderId
,
"凭证已上传,审核中"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
,
1
,
null
,
null
);
break
;
default
:
break
;
...
...
@@ -138,9 +138,9 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
tabHaobanLicenceOrderMapper
.
uploadLicenceOrderVoucher
(
orderId
,
voucher
);
//记录订单进度
if
(
StrUtil
.
isNotBlank
(
tabHaobanLicenceOrder
.
getVoucher
())){
saveOrderProgress
(
orderId
,
"凭证已重新上传,审核中"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
);
saveOrderProgress
(
orderId
,
"凭证已重新上传,审核中"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
,
1
,
voucher
,
null
);
}
else
{
saveOrderProgress
(
orderId
,
"凭证已上传,审核中"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
);
saveOrderProgress
(
orderId
,
"凭证已上传,审核中"
,
enterpriseId
,
wxEnterpriseId
,
creatorName
,
1
,
voucher
,
null
);
}
//查询gic品牌名称
String
enterpriseName
=
""
;
...
...
@@ -190,4 +190,9 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
return
PageHelperUtils
.
changePageHelperToCurrentPage
(
licenceOrderPage
,
LicenceOrderPageDTO
.
class
);
}
@Override
public
Integer
saveTransactionCode
(
Long
orderId
,
String
transactionCode
,
String
prepayId
,
String
wxOrderId
)
{
return
tabHaobanLicenceOrderMapper
.
saveTransactionCode
(
orderId
,
transactionCode
,
prepayId
,
wxOrderId
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/licence/LicenceOrderApiServiceImpl.java
View file @
75787816
...
...
@@ -17,10 +17,15 @@ 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.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.licence.LicenceOrderApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder
;
import
com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.service.licence.LicenceOrderProgressService
;
import
com.gic.haoban.manage.service.service.licence.LicenceOrderService
;
import
com.gic.wechat.api.dto.qywx.fee.CreateOrderResponseDTO
;
import
com.gic.wechat.api.dto.qywx.fee.qdto.CreateOrderQDTO
;
import
com.gic.wechat.api.service.qywx.QywxOrderApiService
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -50,6 +55,13 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
private
QywxOrderApiService
qywxOrderApiService
;
@Autowired
private
Config
config
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Override
public
ServiceResponse
<
LicenceOrderDTO
>
getLicenceOrderDetail
(
Long
orderId
,
Integer
type
)
{
TabHaobanLicenceOrder
licenceOrderDetail
=
licenceOrderService
.
getLicenceOrderDetail
(
orderId
);
...
...
@@ -106,24 +118,55 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
}
@Override
public
ServiceResponse
<
Boolean
>
payLicenceOrder
(
Long
orderId
)
{
public
ServiceResponse
<
Boolean
>
payLicenceOrder
(
Long
orderId
,
String
wxEnterpriseId
)
{
//企业微信下单
TabHaobanLicenceOrder
licenceOrderDetail
=
licenceOrderService
.
getLicenceOrderDetail
(
orderId
);
if
(
licenceOrderDetail
==
null
){
return
ServiceResponse
.
success
(
false
);
}
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
String
openCorpid
=
wxEnterpriseDTO
.
getOpenCorpid
();
String
serviceCorpid
=
config
.
getCorpid
();
CreateOrderQDTO
orderQDTO
=
new
CreateOrderQDTO
();
orderQDTO
.
setBaseCount
(
0
);
orderQDTO
.
setExternalCount
(
licenceOrderDetail
.
getExternalContactCount
());
//todo 购买人userId,加密 先写死
orderQDTO
.
setBuyerUserid
(
"wo59NLDQAA_8N2VFOP3qPubiCqxi0LGg"
);
if
(
licenceOrderDetail
.
getTimeType
()
==
1
){
orderQDTO
.
setMonths
(
licenceOrderDetail
.
getTimeValue
());
orderQDTO
.
setDays
(
0
);
}
else
{
orderQDTO
.
setMonths
(
0
);
orderQDTO
.
setDays
(
licenceOrderDetail
.
getTimeValue
());
}
ServiceResponse
<
CreateOrderResponseDTO
>
newOrder
=
qywxOrderApiService
.
createNewOrder
(
serviceCorpid
,
openCorpid
,
orderQDTO
);
if
(
newOrder
.
isSuccess
()){
//更新订单状态、企业微信订单状态
CreateOrderResponseDTO
result
=
newOrder
.
getResult
();
return
null
;
return
ServiceResponse
.
success
(
true
);
}
return
ServiceResponse
.
success
(
false
);
}
@Override
public
ServiceResponse
<
Boolean
>
isPayLicenceOrder
(
String
wxEnterpriseId
)
{
public
ServiceResponse
<
String
>
isPayLicenceOrder
(
String
wxEnterpriseId
)
{
String
order
=
licenceOrderService
.
isPayLicenceOrder
(
wxEnterpriseId
);
if
(
StrUtil
.
isNotBlank
(
order
)){
return
ServiceResponse
.
success
(
true
);
}
return
ServiceResponse
.
success
(
false
);
return
ServiceResponse
.
success
(
order
);
}
@Override
public
ServiceResponse
<
Boolean
>
wxCallBack
(
String
params
)
{
logger
.
info
(
"接收微信回调参数:{}"
,
params
);
if
(
StrUtil
.
isBlank
(
params
)){
return
ServiceResponse
.
success
(
false
);
}
JSONObject
object
=
JSONObject
.
parseObject
(
params
,
JSONObject
.
class
);
//微信的订单id,保留方便后续对账
String
orderId
=
object
.
getString
(
"orderId"
);
String
transactionId
=
object
.
getString
(
"transactionId"
);
String
timeEnd
=
object
.
getString
(
"timeEnd"
);
//
return
null
;
}
...
...
@@ -150,4 +193,10 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
}
return
ServiceResponse
.
success
(
true
);
}
@Override
public
ServiceResponse
<
Boolean
>
saveTransactionCode
(
Long
orderId
,
String
transactionCode
,
String
prepayId
,
String
wxOrderId
)
{
licenceOrderService
.
saveTransactionCode
(
orderId
,
transactionCode
,
prepayId
,
wxOrderId
);
return
ServiceResponse
.
success
(
true
);
}
}
haoban-manage3-service/src/main/resources/mapper/licence/TabHaobanLicenceOrderMapper.xml
View file @
75787816
...
...
@@ -30,6 +30,8 @@
<result
column=
"creator_id"
property=
"creatorId"
/>
<result
column=
"creator_name"
property=
"creatorName"
/>
<result
column=
"expire_time"
property=
"expireTime"
/>
<result
column=
"prepay_id"
property=
"prepayId"
/>
<result
column=
"wx_order_id"
property=
"wxOrderId"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
order_id,
...
...
@@ -59,7 +61,9 @@
update_time,
creator_id,
creator_name,
expire_time
expire_time,
prepay_id,
wx_order_id
</sql>
<!-- ===================== 新增 ======================== -->
<insert
id=
"insert"
parameterType=
"com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder"
...
...
@@ -127,7 +131,7 @@
<!-- =====================删除==================== -->
<update
id=
"deleteById"
parameterType=
"long"
>
UPDATE tab_haoban_licence_order
SET delete_flag = 1
SET delete_flag = 1
,update_time = now()
WHERE order_id = #{orderId}
</update>
...
...
@@ -175,14 +179,21 @@
<update
id=
"updateLicenceOrderType"
>
UPDATE tab_haoban_licence_order
SET order_status = #{type}
SET order_status = #{type} ,update_time = now()
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<update
id=
"updateQywxOrderType"
>
UPDATE tab_haoban_licence_order
SET qywx_order_status = #{type} ,update_time = now()
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<update
id=
"uploadLicenceOrderVoucher"
>
UPDATE tab_haoban_licence_order
SET voucher = #{voucher}
SET voucher = #{voucher}
,update_time = now()
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
...
...
@@ -220,4 +231,27 @@
order by create_time desc
</select>
<update
id=
"saveTransactionCode"
>
UPDATE tab_haoban_licence_order
SET
<if
test=
"transactionCode != null"
>
transaction_id = #{transactionCode},
</if>
<if
test=
"prepayId != null"
>
prepay_id = #{prepayId},
</if>
<if
test=
"wxOrderId != null"
>
wx_order_id = #{wxOrderId},
</if>
update_time = now()
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<select
id=
"selectByTransactionId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM tab_haoban_licence_order WHERE transaction_id = #{transactionId} and delete_flag=0
</select>
</mapper>
\ No newline at end of file
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/config/Config.java
View file @
75787816
...
...
@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@EnableApolloConfig
public
class
Config
{
public
class
Config
{
@Value
(
"${corpid}"
)
private
String
corpid
;
@Value
(
"${suiteid}"
)
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/licence/LicenceOrderController.java
View file @
75787816
...
...
@@ -3,14 +3,13 @@ package com.gic.haoban.manage.web.controller.licence;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.commons.util.
ToolUtil
;
import
com.gic.commons.util.
UniqueIdUtils
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
...
...
@@ -23,15 +22,15 @@ 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.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.licence.LicenceOrderApiService
;
import
com.gic.haoban.manage.web.config.Config
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.licence.LicenceOrderPageQO
;
import
com.gic.haoban.manage.web.qo.licence.LicenceOrderQO
;
import
com.gic.haoban.manage.web.vo.licence.LicenceOrderPageVO
;
import
com.gic.haoban.manage.web.vo.licence.LicenceOrderVO
;
import
com.gic.marketing.api.dto.AccountChargeInfoDTO
;
import
com.gic.marketing.api.enums.AccountChargeSceneEnum
;
import
com.gic.marketing.api.service.EnterpriseAccountInfoApiService
;
import
com.gic.thirdparty.api.dto.ScanPayReqDataDTO
;
import
com.gic.thirdparty.api.dto.ScanPayResDataDTO
;
import
com.gic.thirdparty.api.service.Pay4WXService
;
import
com.gic.thirdparty.api.service.RechargeCenterService
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -43,7 +42,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.
math.BigDecimal
;
import
java.
util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -66,11 +65,9 @@ public class LicenceOrderController {
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
private
EnterpriseAccountInfoApiService
enterpriseAccountInfoApiService
;
@Autowired
private
Pay4WXService
pay4WXService
;
@Autowired
private
RechargeCenterService
rechargeCenterService
;
private
Config
config
;
/**
* 查询订单详情
*/
...
...
@@ -174,7 +171,7 @@ public class LicenceOrderController {
* 支付订单
*/
@RequestMapping
(
"licence-order-pay-1"
)
public
RestResponse
<
Map
<
String
,
Object
>>
payLicenceOrder
(
@RequestParam
Long
orderId
,
@RequestParam
(
defaultValue
=
"0"
)
int
accountType
)
{
public
RestResponse
<
Map
<
String
,
Object
>>
payLicenceOrder
(
@RequestParam
Long
orderId
)
{
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
())){
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
...
...
@@ -184,49 +181,50 @@ public class LicenceOrderController {
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_5
.
getCode
()),
HaoBanErrCode
.
ERR_5
.
getMsg
());
}
Integer
money
=
result
.
getPrice
();
if
(
null
!=
loginUser
.
getPhoneNumber
()
&&
Arrays
.
asList
(
"13456789987"
,
"13429152802"
).
contains
(
loginUser
.
getPhoneNumber
()))
{
//测试账号付款一分
money
=
1
;
}
// 交易订单号
String
transactionCode
=
ToolUtil
.
randomStringByTime
(
);
String
transactionCode
=
String
.
valueOf
(
UniqueIdUtils
.
uniqueLong
()
);
ScanPayReqDataDTO
scanPayReqData
=
new
ScanPayReqDataDTO
(
"好办平台企业微信许可账号购买"
,
loginUser
.
getEnterpriseId
(),
transactionCode
,
money
,
DateUtil
.
dateToStr
(
new
Date
(),
DateUtil
.
FORMAT_DATETIME_14
),
""
,
"NATIVE"
);
String
accountDepartId
=
""
;
if
(
accountType
==
0
)
{
AccountChargeInfoDTO
dto
=
this
.
enterpriseAccountInfoApiService
.
getAccountDeparment
(
loginUser
.
getEnterpriseId
(),
AccountChargeSceneEnum
.
creator_only
,
null
,
loginUser
.
getClerkId
())
;
logger
.
info
(
"充值账号信息={}"
,
dto
);
accountDepartId
=
dto
.
getAccountDepartId
()
;
}
if
(
accountType
==
1
)
{
accountDepartId
=
"1"
;
}
scanPayReqData
.
setAccountType
(
accountType
);
scanPayReqData
.
setAccountDepartId
(
accountDepartId
);
//二维码
String
url
=
pay4WXService
.
createPrePaymentOrderForWX
(
scanPayReqData
);
//通知回调的url
String
url
=
"https://hope.demogic.com/"
+
"gic-thirdparty/weixin_payment_result_notice_qywx"
;
scanPayReqData
.
setNotify_url
(
url
);
ScanPayResDataDTO
prePaymentOrderForQYWX
=
pay4WXService
.
createPrePaymentOrderForQYWX
(
scanPayReqData
);
logger
.
info
(
"微信预支付返回信息:{}"
,
JSON
.
toJSONString
(
prePaymentOrderForQYWX
));
if
(
prePaymentOrderForQYWX
==
null
){
logger
.
info
(
"微信预支付订单二维码生成失败!!"
);
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_100034
.
getCode
()),
HaoBanErrCode
.
ERR_100034
.
getMsg
());
}
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"transactionCode"
,
transactionCode
);
map
.
put
(
"url"
,
url
);
map
.
put
(
"url"
,
prePaymentOrderForQYWX
.
getCode_url
()
);
map
.
put
(
"money"
,
money
);
// TODO: 2023/3/21 记录订单号transactionCode
//记录订单号transactionCode和预支付交易会话标识
licenceOrderApiService
.
saveTransactionCode
(
orderId
,
transactionCode
,
prePaymentOrderForQYWX
.
getPrepay_id
(),
null
);
return
RestResponse
.
successResult
(
map
);
}
/**
* 支付订单-判断是否支付成功
*/
@RequestMapping
(
"licence-order-pay-2"
)
public
RestResponse
<
Boolean
>
payLicenceOrder2
(
@RequestParam
String
transactionCode
)
{
public
RestResponse
<
Boolean
>
payLicenceOrder2
(
@RequestParam
Long
orderId
)
{
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
())){
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
}
if
(
StrUtil
.
isBlank
(
transactionCode
)){
LicenceOrderDTO
result
=
licenceOrderApiService
.
getLicenceOrderDetail
(
orderId
,
1
).
getResult
();
if
(
result
==
null
){
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_5
.
getCode
()),
HaoBanErrCode
.
ERR_5
.
getMsg
());
}
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"enterpriseId"
,
loginUser
.
getEnterpriseId
());
params
.
put
(
"out_trade_no"
,
transactionCode
);
boolean
flag
=
rechargeCenterService
.
isRechargeSuccess
(
params
);
logger
.
info
(
"定时刷新(判断是否充值成功) FLAG====> [{}]"
,
flag
);
return
RestResponse
.
successResult
(
flag
);
if
(
result
.
getOrderStatus
()
==
1
){
return
RestResponse
.
successResult
(
true
);
}
return
RestResponse
.
successResult
(
false
);
}
/**
...
...
@@ -256,13 +254,13 @@ public class LicenceOrderController {
* 查询企业是否存在未支付订单
*/
@RequestMapping
(
"licence-order-isPay"
)
public
RestResponse
<
Boolean
>
isPayLicenceOrder
()
{
public
RestResponse
<
String
>
isPayLicenceOrder
()
{
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
if
(
loginUser
==
null
||
StringUtils
.
isBlank
(
loginUser
.
getEnterpriseId
())){
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_4
.
getCode
()),
HaoBanErrCode
.
ERR_4
.
getMsg
());
}
Boolean
result
=
licenceOrderApiService
.
isPayLicenceOrder
(
loginUser
.
getWxEnterpriseId
()).
getResult
(
);
return
RestResponse
.
successResult
(
result
);
ServiceResponse
<
String
>
payLicenceOrder
=
licenceOrderApiService
.
isPayLicenceOrder
(
loginUser
.
getWxEnterpriseId
()
);
return
RestResponse
.
successResult
(
payLicenceOrder
.
getResult
()
);
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
75787816
...
...
@@ -131,6 +131,7 @@ public enum HaoBanErrCode {
*
*/
ERR_100033
(
100033
,
"分组被关联,不可删除"
),
ERR_100034
(
100034
,
"微信预支付订单生成失败!"
),
;
private
int
code
;
private
String
msg
;
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/licence/LicenceOrderQO.java
View file @
75787816
...
...
@@ -75,8 +75,23 @@ public class LicenceOrderQO implements Serializable {
}
else
{
return
-
1
;
}
//单位是分
if
(
this
.
price
!=
myPrice
*
100
){
//转化为分
myPrice
=
myPrice
*
this
.
timeValue
*
100
;
if
(
this
.
timeType
==
1
){
//企业微信的规则: 12.312,最终保留的是12.32
if
(
myPrice
%
12
==
0
){
myPrice
=
myPrice
/
12
;
}
else
{
myPrice
=
myPrice
/
12
+
1
;
}
}
else
{
if
(
myPrice
%
372
==
0
){
myPrice
=
myPrice
/
372
;
}
else
{
myPrice
=
myPrice
/
372
+
1
;
}
}
if
(
this
.
price
!=
myPrice
){
return
0
;
}
return
1
;
...
...
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