Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
29be62f1
Commit
29be62f1
authored
Feb 28, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店新增保洁时段
parent
9b36552f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
79 deletions
+86
-79
SStore.java
share-system/src/main/java/share/system/domain/SStore.java
+3
-0
OrderPayService.java
...m/src/main/java/share/system/service/OrderPayService.java
+3
-3
OrderPayServiceImpl.java
...n/java/share/system/service/impl/OrderPayServiceImpl.java
+72
-74
SStoreMapper.xml
...-system/src/main/resources/mapper/system/SStoreMapper.xml
+8
-2
No files found.
share-system/src/main/java/share/system/domain/SStore.java
View file @
29be62f1
...
...
@@ -76,6 +76,9 @@ public class SStore extends BaseEntity
@Excel
(
name
=
"结束营业时间"
)
private
String
openEndTime
;
@Excel
(
name
=
"保洁时段"
)
private
String
cleaningPeriod
;
/** 门店类型 1:标准店 2: 形象店 3:旗舰店 */
@Excel
(
name
=
"门店类型 1:标准店 2: 形象店 3:旗舰店"
)
private
String
storeType
;
...
...
share-system/src/main/java/share/system/service/OrderPayService.java
View file @
29be62f1
package
share
.
system
.
service
;
import
share.system.domain.Recharge
;
//
import share.system.domain.Recharge;
import
share.system.domain.SOrder
;
import
share.system.response.OrderPayResultResponse
;
import
share.system.response.RechargePayResultResponse
;
//
import share.system.response.RechargePayResultResponse;
/**
* @Author wwl
...
...
@@ -30,6 +30,6 @@ public interface OrderPayService {
* @param recharge 支付参数
* @return OrderPayResultResponse
*/
RechargePayResultResponse
saobeiRechargePayment
(
Recharge
recharge
);
//
RechargePayResultResponse saobeiRechargePayment(Recharge recharge);
}
share-system/src/main/java/share/system/service/impl/OrderPayServiceImpl.java
View file @
29be62f1
...
...
@@ -20,12 +20,10 @@ import share.common.exception.base.BaseException;
import
share.common.utils.BaseUtil
;
import
share.common.utils.DateUtil
;
import
share.common.utils.JsonConvertUtil
;
import
share.system.domain.Recharge
;
import
share.system.domain.SConsumerToken
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.*
;
import
share.system.response.OrderPayResultResponse
;
import
share.system.response.RechargePayResultResponse
;
import
share.system.service.*
;
import
share.system.util.WxPayUtil
;
...
...
@@ -56,8 +54,8 @@ public class OrderPayServiceImpl implements OrderPayService {
@Autowired
private
SaobeiService
saobeiService
;
@Autowired
private
RechargeService
rechargeService
;
//
@Autowired
//
private RechargeService rechargeService;
/**
* 获取域名
...
...
@@ -113,28 +111,28 @@ public class OrderPayServiceImpl implements OrderPayService {
* @param recharge 支付参数
* @return
*/
@Override
public
RechargePayResultResponse
saobeiRechargePayment
(
Recharge
recharge
)
{
RechargePayResultResponse
response
=
new
RechargePayResultResponse
();
response
.
setRechargeNo
(
recharge
.
getRechargeNo
());
response
.
setPayType
(
PayTypeEnum
.
getEnumByCode
(
recharge
.
getPayType
()).
getValue
());
response
.
setStatus
(
YesNoEnum
.
no
.
getFlag
());
// 扫呗支付
ConcurrentHashMap
<
String
,
String
>
unifiedorder
=
saobeiUnifiedRecharge
(
recharge
);
WxPayJsResultVo
vo
=
new
WxPayJsResultVo
();
vo
.
setAppId
(
unifiedorder
.
get
(
"appId"
));
vo
.
setNonceStr
(
unifiedorder
.
get
(
"nonceStr"
));
vo
.
setPackages
(
unifiedorder
.
get
(
"package"
));
vo
.
setSignType
(
unifiedorder
.
get
(
"signType"
));
vo
.
setTimeStamp
(
unifiedorder
.
get
(
"timeStamp"
));
vo
.
setPaySign
(
unifiedorder
.
get
(
"paySign"
));
// 更新商户订单号
recharge
.
setOutTradeNo
(
unifiedorder
.
get
(
"outTradeNo"
));
recharge
.
setTerminalTrace
(
unifiedorder
.
get
(
"terminalTrace"
));
rechargeService
.
updateById
(
recharge
);
response
.
setJsConfig
(
vo
);
return
response
;
}
//
@Override
//
public RechargePayResultResponse saobeiRechargePayment(Recharge recharge) {
//
RechargePayResultResponse response = new RechargePayResultResponse();
//
response.setRechargeNo(recharge.getRechargeNo());
//
response.setPayType(PayTypeEnum.getEnumByCode(recharge.getPayType()).getValue());
//
response.setStatus(YesNoEnum.no.getFlag());
//
// 扫呗支付
//
ConcurrentHashMap<String, String> unifiedorder = saobeiUnifiedRecharge(recharge);
//
WxPayJsResultVo vo = new WxPayJsResultVo();
//
vo.setAppId(unifiedorder.get("appId"));
//
vo.setNonceStr(unifiedorder.get("nonceStr"));
//
vo.setPackages(unifiedorder.get("package"));
//
vo.setSignType(unifiedorder.get("signType"));
//
vo.setTimeStamp(unifiedorder.get("timeStamp"));
//
vo.setPaySign(unifiedorder.get("paySign"));
//
// 更新商户订单号
//
recharge.setOutTradeNo(unifiedorder.get("outTradeNo"));
//
recharge.setTerminalTrace(unifiedorder.get("terminalTrace"));
//
rechargeService.updateById(recharge);
//
response.setJsConfig(vo);
//
return response;
//
}
/**
...
...
@@ -264,59 +262,59 @@ public class OrderPayServiceImpl implements OrderPayService {
* @param recharge 充值对象
* @return 预下单返回对象
*/
private
ConcurrentHashMap
<
String
,
String
>
saobeiUnifiedRecharge
(
Recharge
recharge
)
{
// 获取用户openId
SConsumerToken
userToken
=
consumerTokenService
.
getTokenByUserId
(
recharge
.
getConsumerId
());
if
(
ObjectUtil
.
isNull
(
userToken
))
{
throw
new
BaseException
(
"该用户没有openId"
);
}
// 获取appid、mch_id
// 微信签名key
String
appId
=
weChatConfig
.
getAppId
();
String
mchId
=
weChatConfig
.
getMchId
();
String
signKey
=
weChatConfig
.
getSignKey
();
// 获取扫呗微信预下单对象
SaobeiMiniPayRequestVo
unifiedorderVo
=
getSaobeiUnifiedRechargeVo
(
recharge
,
userToken
.
getToken
(),
appId
,
mchId
,
signKey
);
// 预下单(统一下单)
SaobeiMiniPayResponse
response
=
saobeiService
.
wechatMinipay
(
unifiedorderVo
);
logger
.
info
(
"SaobeiMiniPayResponse :"
,
JsonConvertUtil
.
write2JsonStr
(
response
));
// 组装前端预下单参数
ConcurrentHashMap
<
String
,
String
>
map
=
new
ConcurrentHashMap
<>();
map
.
put
(
"appId"
,
response
.
getAppId
());
map
.
put
(
"nonceStr"
,
response
.
getNonceStr
());
map
.
put
(
"package"
,
response
.
getPackage_str
());
map
.
put
(
"signType"
,
response
.
getSignType
());
map
.
put
(
"timeStamp"
,
response
.
getTimeStamp
());
map
.
put
(
"paySign"
,
response
.
getPaySign
());
map
.
put
(
"prepayTime"
,
DateUtil
.
nowDateTimeStr
());
map
.
put
(
"outTradeNo"
,
response
.
getOut_trade_no
());
map
.
put
(
"terminalTrace"
,
unifiedorderVo
.
getTerminal_trace
());
return
map
;
}
//
private ConcurrentHashMap<String, String> saobeiUnifiedRecharge(Recharge recharge) {
//
// 获取用户openId
//
SConsumerToken userToken = consumerTokenService.getTokenByUserId(recharge.getConsumerId());
//
if (ObjectUtil.isNull(userToken)) {
//
throw new BaseException("该用户没有openId");
//
}
//
// 获取appid、mch_id
//
// 微信签名key
//
String appId = weChatConfig.getAppId();
//
String mchId = weChatConfig.getMchId();
//
String signKey = weChatConfig.getSignKey();
//
// 获取扫呗微信预下单对象
//
SaobeiMiniPayRequestVo unifiedorderVo = getSaobeiUnifiedRechargeVo(recharge, userToken.getToken(), appId, mchId, signKey);
//
// 预下单(统一下单)
//
SaobeiMiniPayResponse response = saobeiService.wechatMinipay(unifiedorderVo);
//
logger.info("SaobeiMiniPayResponse :", JsonConvertUtil.write2JsonStr(response));
//
// 组装前端预下单参数
//
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
//
map.put("appId", response.getAppId());
//
map.put("nonceStr", response.getNonceStr());
//
map.put("package", response.getPackage_str());
//
map.put("signType", response.getSignType());
//
map.put("timeStamp", response.getTimeStamp());
//
map.put("paySign", response.getPaySign());
//
map.put("prepayTime", DateUtil.nowDateTimeStr());
//
map.put("outTradeNo", response.getOut_trade_no());
//
map.put("terminalTrace", unifiedorderVo.getTerminal_trace());
//
return map;
//
}
/**
* 获取预下单对象 (扫呗-微信)
* 充值
* @return 预下单对象
*/
private
SaobeiMiniPayRequestVo
getSaobeiUnifiedRechargeVo
(
Recharge
recharge
,
String
openid
,
String
appId
,
String
mchId
,
String
signKey
)
{
AttachVo
attachVo
=
new
AttachVo
(
OrderTypeEnum
.
RECHARGE
.
getValue
(),
recharge
.
getConsumerId
());
SaobeiMiniPayRequestVo
vo
=
new
SaobeiMiniPayRequestVo
();
vo
.
setSub_appid
(
appId
);
vo
.
setMerchant_no
(
saobeiConfig
.
getMerchantNo
());
vo
.
setTerminal_id
(
saobeiConfig
.
getTerminalId
());
vo
.
setAttach
(
JSONObject
.
toJSONString
(
attachVo
));
vo
.
setTerminal_trace
(
BaseUtil
.
getOrderNo
(
"WXNO"
));
vo
.
setTerminal_time
(
DateUtil
.
nowDate
(
Constants
.
DATE_TIME_FORMAT_NUM
));
vo
.
setOrder_body
(
StrUtil
.
concat
(
true
,
recharge
.
getRechargeAmount
().
toString
(),
"元充值!"
));
// 订单中使用的是BigDecimal,这里要转为Integer类型
vo
.
setTotal_fee
(
String
.
valueOf
(
recharge
.
getRechargeAmount
().
multiply
(
BigDecimal
.
TEN
).
multiply
(
BigDecimal
.
TEN
).
intValue
()));
vo
.
setNotify_url
(
apiDomain
+
PayConstants
.
SAOBEI_PAY_NOTIFY_API_URI
);
vo
.
setTrade_type
(
PayConstants
.
WX_PAY_TRADE_TYPE_JS
);
vo
.
setOpen_id
(
openid
);
vo
.
setDevice_no
(
"WEB"
);
return
vo
;
}
//
private SaobeiMiniPayRequestVo getSaobeiUnifiedRechargeVo(Recharge recharge, String openid, String appId, String mchId, String signKey) {
//
AttachVo attachVo = new AttachVo(OrderTypeEnum.RECHARGE.getValue(), recharge.getConsumerId());
//
//
SaobeiMiniPayRequestVo vo = new SaobeiMiniPayRequestVo();
//
vo.setSub_appid(appId);
//
vo.setMerchant_no(saobeiConfig.getMerchantNo());
//
vo.setTerminal_id(saobeiConfig.getTerminalId());
//
vo.setAttach(JSONObject.toJSONString(attachVo));
//
vo.setTerminal_trace(BaseUtil.getOrderNo("WXNO"));
//
vo.setTerminal_time(DateUtil.nowDate(Constants.DATE_TIME_FORMAT_NUM));
//
vo.setOrder_body(StrUtil.concat(true,recharge.getRechargeAmount().toString(),"元充值!"));
//
// 订单中使用的是BigDecimal,这里要转为Integer类型
//
vo.setTotal_fee(String.valueOf(recharge.getRechargeAmount().multiply(BigDecimal.TEN).multiply(BigDecimal.TEN).intValue()));
//
vo.setNotify_url(apiDomain + PayConstants.SAOBEI_PAY_NOTIFY_API_URI);
//
vo.setTrade_type(PayConstants.WX_PAY_TRADE_TYPE_JS);
//
vo.setOpen_id(openid);
//
vo.setDevice_no("WEB");
//
return vo;
//
}
}
share-system/src/main/resources/mapper/system/SStoreMapper.xml
View file @
29be62f1
...
...
@@ -25,6 +25,7 @@
<result
property=
"status"
column=
"status"
/>
<result
property=
"openStartTime"
column=
"open_start_time"
/>
<result
property=
"openEndTime"
column=
"open_end_time"
/>
<result
property=
"cleaningPeriod"
column=
"cleaning_period"
/>
<result
property=
"storeType"
column=
"store_type"
/>
</resultMap>
...
...
@@ -49,6 +50,7 @@
status,
open_start_time,
open_end_time,
cleaning_period,
store_type
from s_store
</sql>
...
...
@@ -71,6 +73,7 @@
<if
test=
"openStartTime != null "
>
and open_start_time = #{openStartTime}
</if>
<if
test=
"openEndTime != null "
>
and open_end_time = #{openEndTime}
</if>
<if
test=
"storeType != null "
>
and store_type = #{storeType}
</if>
<if
test=
"cleaningPeriod != null "
>
and cleaning_period = #{cleaningPeriod}
</if>
</where>
order by create_time desc
</select>
...
...
@@ -107,6 +110,7 @@
<if
test=
"openStartTime != null"
>
open_start_time,
</if>
<if
test=
"openEndTime != null"
>
open_end_time,
</if>
<if
test=
"storeType != null"
>
store_type,
</if>
<if
test=
"cleaningPeriod != null"
>
cleaning_period,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"name != null"
>
#{name},
</if>
...
...
@@ -129,6 +133,7 @@
<if
test=
"openStartTime != null"
>
#{openStartTime},
</if>
<if
test=
"openEndTime != null"
>
#{openEndTime},
</if>
<if
test=
"storeType != null"
>
#{storeType},
</if>
<if
test=
"cleaningPeriod != null"
>
#{cleaningPeriod},
</if>
</trim>
</insert>
...
...
@@ -152,9 +157,10 @@
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"openStartTime !=
null
"
>
open_start_time = #{openStartTime},
</if>
<if
test=
"openEndTime !=
null
"
>
open_end_time = #{openEndTime},
</if>
<if
test=
"openStartTime !=
''
"
>
open_start_time = #{openStartTime},
</if>
<if
test=
"openEndTime !=
''
"
>
open_end_time = #{openEndTime},
</if>
<if
test=
"storeType != null"
>
store_type = #{storeType},
</if>
<if
test=
"cleaningPeriod != ''"
>
cleaning_period = #{cleaningPeriod},
</if>
</trim>
where id = #{id}
</update>
...
...
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