|
@@ -68,6 +68,7 @@ import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
import java.util.concurrent.ThreadLocalRandom;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.concurrent.locks.ReentrantLock;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static org.jeecg.modules.hikiot.HikiotTool.addFace;
|
|
@@ -116,7 +117,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
private AppCoursesVerificationRecordMapper appCoursesVerificationRecordMapper;
|
|
|
@Resource
|
|
|
private AppContractSignMapper appContractSignMapper;
|
|
|
-// @Resource
|
|
|
+ // @Resource
|
|
|
// private RedissonDelayQueue redissonDelayQueue;
|
|
|
@Resource
|
|
|
private AppDeviceMapper appDeviceMapper;
|
|
@@ -124,7 +125,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
private WeChatPayService weChatPayService;
|
|
|
@Resource
|
|
|
private RedisTemplate<String, Object> redisTemplate;
|
|
|
-// @Resource
|
|
|
+ // @Resource
|
|
|
// private WechatPayV3Utils wechatPayV3Utils;
|
|
|
@Resource
|
|
|
private EvaluateMapper evaluateMapper;
|
|
@@ -597,12 +598,12 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
String startTime = DateUtil.format(priceRule.getStartTime(), "HH:mm:ss");
|
|
|
String endTime = DateUtil.format(priceRule.getEndTime(), "HH:mm:ss");
|
|
|
String expireTime;
|
|
|
- if(priceRule.getEndTime() != null){
|
|
|
+ if (priceRule.getEndTime() != null) {
|
|
|
expireTime = date + " " + endTime;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
expireTime = date;
|
|
|
}
|
|
|
- if(startTime == null){
|
|
|
+ if (startTime == null) {
|
|
|
startTime = DateUtil.format(new Date(), "yyyy-MM-dd");
|
|
|
}
|
|
|
AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
@@ -711,10 +712,10 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
String startTime = DateUtil.format(appSite.getStartTime(), "HH:mm");
|
|
|
String endTime = DateUtil.format(appSite.getEndTime(), "HH:mm");
|
|
|
String expireTime = date + " " + endTime;
|
|
|
- if(null == appSite.getStartTime()){
|
|
|
+ if (null == appSite.getStartTime()) {
|
|
|
startTime = "00:00";
|
|
|
}
|
|
|
- if(null == appSite.getEndTime()){
|
|
|
+ if (null == appSite.getEndTime()) {
|
|
|
endTime = "23:59";
|
|
|
}
|
|
|
AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
@@ -779,9 +780,9 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
|
appOrderProInfo.setProductName(appGame.getName());
|
|
|
- if(appGame.getSiteType() == 1){
|
|
|
+ if (appGame.getSiteType() == 1) {
|
|
|
appOrderProInfo.setAddress(appGameMapper.selectById(appGame.getId()).getAddress());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
appOrderProInfo.setAddress(appSiteMapper.selectById(appGame.getSiteId()).getAddress());
|
|
|
}
|
|
|
appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_3);
|
|
@@ -814,7 +815,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
.setUpdateBy(user.getId())
|
|
|
.setStatus(CommonConstant.STATUS_NORMAL)
|
|
|
.setDelFlag(CommonConstant.DEL_FLAG_0);
|
|
|
- if (ObjectUtil.isNotEmpty(appGame.getSiteId())){
|
|
|
+ if (ObjectUtil.isNotEmpty(appGame.getSiteId())) {
|
|
|
appOrder.setAddressSiteId(appGame.getSiteId());
|
|
|
}
|
|
|
if (StrUtil.isNotBlank(createOrderForm.getGameCertificationForm())) {
|
|
@@ -843,9 +844,9 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
|
appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
|
appOrderProInfo.setProductName(appGame.getName());
|
|
|
- if(appGame.getSiteType() == 1){
|
|
|
+ if (appGame.getSiteType() == 1) {
|
|
|
appOrderProInfo.setAddress(appGameMapper.selectById(appGame.getId()).getAddress());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
appOrderProInfo.setAddress(appSiteMapper.selectById(appGame.getSiteId()).getAddress());
|
|
|
}
|
|
|
appOrderProInfo.setTicketNo(ticketNo);
|
|
@@ -889,7 +890,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
case 2:
|
|
|
//课程
|
|
|
AppCourses appCourse = appCoursesMapper.selectById(appOrder.getProductIds());
|
|
|
- if (ObjectUtil.isEmpty(appCourse)){
|
|
|
+ if (ObjectUtil.isEmpty(appCourse)) {
|
|
|
log.error("当前课程不存在!");
|
|
|
throw new JeecgBootException("当前课程已下架!");
|
|
|
}
|
|
@@ -927,7 +928,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
List<AppOrderProInfo> infoList = appOrderProInfoMapper.selectList(Wrappers.<AppOrderProInfo>lambdaQuery()
|
|
|
.eq(AppOrderProInfo::getProductId, appCourse.getId())
|
|
|
.eq(AppOrderProInfo::getFamilyUserId, familyUserId)
|
|
|
- .eq(AppOrderProInfo::getOrFreePro,CommonConstant.STATUS_0_INT)
|
|
|
+ .eq(AppOrderProInfo::getOrFreePro, CommonConstant.STATUS_0_INT)
|
|
|
.notIn(AppOrderProInfo::getOrderStatus, CommonConstant.ORDER_STATUS_4, CommonConstant.ORDER_STATUS_5, CommonConstant.ORDER_STATUS_6)
|
|
|
);
|
|
|
|
|
@@ -1165,23 +1166,25 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
//生成10位随机券号
|
|
|
.setTicketNo(appOrderProInfo.getTicketNo())
|
|
|
.setIsinStatus(CommonConstant.ISIN_STATUS_0);
|
|
|
- if (appOrder.getType() == 0){
|
|
|
+ if (appOrder.getType() == 0) {
|
|
|
String s = createOrderForm.getProductIds().split(",")[0];
|
|
|
String priceRuleId = s.split("\\|")[0];
|
|
|
AppSitePriceRules priceRule = appSitePriceRulesMapper.selectById(priceRuleId);
|
|
|
AppSitePlace appSitePlace = appSitePlaceMapper.selectById(priceRule.getSitePlaceId());
|
|
|
AppSite appSite = appSiteMapper.selectById(appSitePlace.getSiteId());
|
|
|
appIsin.setUseAddress(appSite.getName());
|
|
|
- }if (appOrder.getType() == 1){
|
|
|
+ }
|
|
|
+ if (appOrder.getType() == 1) {
|
|
|
AppGamePriceRules appGamePriceRules = appGamePriceRulesMapper.selectById(createOrderForm.getProductIds());
|
|
|
AppGame appGame = appGameMapper.findByPriceRules(appGamePriceRules.getId());
|
|
|
appIsin.setUseAddress(sysDepartMapper.selectOne(Wrappers.<SysDepart>lambdaQuery().eq(SysDepart::getOrgCode, appGame.getOrgCode())).getDepartName());
|
|
|
- }if (appOrder.getType() == 2){
|
|
|
+ }
|
|
|
+ if (appOrder.getType() == 2) {
|
|
|
AppSite appSite = appSiteMapper.selectById(appCoursesMapper.selectById(appOrderProInfo.getProductId()).getAddressSiteId());
|
|
|
appIsin.setUseAddress(appSite.getName());
|
|
|
|
|
|
//判断当前课程是否是在学校上课
|
|
|
- if (appSite.getType() == 0){
|
|
|
+ if (appSite.getType() == 0) {
|
|
|
//查询当前课程的课时
|
|
|
AppCourses appCourses = appCoursesMapper.selectById(appOrderProInfo.getProductId());
|
|
|
List<AppCoursesPriceRules> appCoursesPriceRules = appCoursesPriceRulesMapper.selectList(Wrappers.<AppCoursesPriceRules>lambdaQuery().eq(AppCoursesPriceRules::getCoursesId,
|
|
@@ -1215,7 +1218,8 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
familyMembers.getRealNameImg());
|
|
|
JsonObject addUserJson = JsonParser.parseString(addUser).getAsJsonObject();
|
|
|
JsonObject addFaceJson = JsonParser.parseString(addFace).getAsJsonObject();
|
|
|
- if (addUserJson.get("code").getAsInt() != 0 && addFaceJson.get("code").getAsInt() != 0) throw new JeecgBootException("设备录入用户信息失败!请联系管理员");
|
|
|
+ if (addUserJson.get("code").getAsInt() != 0 && addFaceJson.get("code").getAsInt() != 0)
|
|
|
+ throw new JeecgBootException("设备录入用户信息失败!请联系管理员");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1235,7 +1239,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
payForm.setOrderId(appOrder.getId()).setOrderCode(orderCode);
|
|
|
|
|
|
//判断是否试听课(试听课不走订单)
|
|
|
- if ((ObjectUtil.isNotEmpty(appOrder.getOrderOrFree()) && appOrder.getOrderOrFree() == 1) || appOrder.getPrice().compareTo(BigDecimal.ZERO)== 0) {
|
|
|
+ if ((ObjectUtil.isNotEmpty(appOrder.getOrderOrFree()) && appOrder.getOrderOrFree() == 1) || appOrder.getPrice().compareTo(BigDecimal.ZERO) == 0) {
|
|
|
payForm.setOrPayOrder(0);
|
|
|
} else {
|
|
|
//分账能否成功,判断是否可以下单
|
|
@@ -1250,12 +1254,12 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
String orgCode = appOrder.getOrgCode();
|
|
|
SysDepart depart = sysDepartMapper.selectOne(Wrappers.lambdaQuery(SysDepart.class).eq(SysDepart::getOrgCode, orgCode).last("limit 1"));
|
|
|
String deptId = depart.getId();
|
|
|
- if(depart.getSystemType() == 2){
|
|
|
+ if (depart.getSystemType() == 2) {
|
|
|
deptId = depart.getParentId();
|
|
|
}
|
|
|
if (depart.getSystemType() != 0) {
|
|
|
SeparateAccounts separateAccounts = separateAccountsMapper.selectOne(Wrappers.lambdaQuery(SeparateAccounts.class).eq(SeparateAccounts::getDeptId, deptId));
|
|
|
- if (ObjectUtil.isEmpty(separateAccounts)){
|
|
|
+ if (ObjectUtil.isEmpty(separateAccounts)) {
|
|
|
throw new JeecgBootException("商户信息未配置!请联系管理员");
|
|
|
}
|
|
|
//获取分账比例
|
|
@@ -1272,14 +1276,14 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
//商户(分账给平台)
|
|
|
if (depart.getSystemType() == 1) {
|
|
|
BigDecimal[] allocate = RatiosUtil.allocate(price, new BigDecimal[]{SH, PT});
|
|
|
- if((appOrder.getPrice().subtract(FEE)).multiply(BigDecimal.valueOf(0.3)).compareTo(allocate[1].add(insurePrice)) < 0){
|
|
|
+ if ((appOrder.getPrice().subtract(FEE)).multiply(BigDecimal.valueOf(0.3)).compareTo(allocate[1].add(insurePrice)) < 0) {
|
|
|
throw new JeecgBootException("订单金额不支持分账,无法下单!");
|
|
|
}
|
|
|
}
|
|
|
//门店(分账给平台及商户)
|
|
|
if (depart.getSystemType() == 2) {
|
|
|
BigDecimal[] allocate = RatiosUtil.allocate(price, MD, SH, PT);
|
|
|
- if((appOrder.getPrice().subtract(FEE)).multiply(BigDecimal.valueOf(0.3)).compareTo(allocate[1].add(allocate[2]).add(insurePrice)) < 0){
|
|
|
+ if ((appOrder.getPrice().subtract(FEE)).multiply(BigDecimal.valueOf(0.3)).compareTo(allocate[1].add(allocate[2]).add(insurePrice)) < 0) {
|
|
|
throw new JeecgBootException("订单金额不支持分账,无法下单!");
|
|
|
}
|
|
|
}
|
|
@@ -1298,7 +1302,9 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
}
|
|
|
return payForm;
|
|
|
}
|
|
|
+
|
|
|
private static final BigDecimal MIN_THRESHOLD = new BigDecimal("0.01"); // 最小阈值
|
|
|
+
|
|
|
/**
|
|
|
* 计算千分之6并处理临界值
|
|
|
*
|
|
@@ -1324,12 +1330,12 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
: product.setScale(2, RoundingMode.DOWN);
|
|
|
}
|
|
|
|
|
|
- public Map<String, String> payment(String appOrderId){
|
|
|
+ public Map<String, String> payment(String appOrderId) {
|
|
|
AppOrder appOrder = appOrderMapper.selectById(appOrderId);
|
|
|
//查询商户信息
|
|
|
String orgCode = appOrder.getOrgCode();
|
|
|
SysDepart depart = sysDepartMapper.selectOne(Wrappers.lambdaQuery(SysDepart.class).eq(SysDepart::getOrgCode, orgCode).last("limit 1"));
|
|
|
- if (Objects.equals(appOrder.getOrderStatus(), CommonConstant.ORDER_STATUS_4)){
|
|
|
+ if (Objects.equals(appOrder.getOrderStatus(), CommonConstant.ORDER_STATUS_4)) {
|
|
|
throw new JeecgBootException("当前订单已过期,请重新下单!");
|
|
|
}
|
|
|
|
|
@@ -1356,7 +1362,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
// 在查询API和支付通知中原样返回 可作为自定义参数使用
|
|
|
params.put("notify_url", WechatUrlConstants.PAY_V3_NOTIFY); //支付结果异步通知接口
|
|
|
//分账必传参数
|
|
|
- if (appOrder.getOrderType() != 0){
|
|
|
+ if (appOrder.getOrderType() != 0) {
|
|
|
JSONObject settleInfo = new JSONObject();
|
|
|
settleInfo.put("profit_sharing", Boolean.TRUE);
|
|
|
params.put("settle_info", settleInfo);
|
|
@@ -1652,7 +1658,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
appOrderInfoDTO.setLatitude(appGame.getLatitude());
|
|
|
appOrderInfoDTO.setLongitude(appGame.getLongitude());
|
|
|
if (appGame.getSiteType().equals(CommonConstant.STATUS_1_INT)) {
|
|
|
- if (ObjectUtils.isNotEmpty(site)){
|
|
|
+ if (ObjectUtils.isNotEmpty(site)) {
|
|
|
appOrderInfoDTO.setPhone(site.getPhone());
|
|
|
appOrderInfoDTO.setAddressSiteId(site.getId());
|
|
|
}
|
|
@@ -1694,7 +1700,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
if (CollUtil.isNotEmpty(insureOrderInfoList)) {
|
|
|
appOrderInfoDTO.setInsureOrderInfoList(insureOrderInfoList);
|
|
|
}
|
|
|
- if(null == appOrderInfoDTO.getGameAddress()) {
|
|
|
+ if (null == appOrderInfoDTO.getGameAddress()) {
|
|
|
appOrderInfoDTO.setGameAddress(appOrderInfoDTO.getProInfoList().get(0).getAddress());
|
|
|
}
|
|
|
return appOrderInfoDTO;
|
|
@@ -1815,7 +1821,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String orderQuery(String orderCode){
|
|
|
+ public String orderQuery(String orderCode) {
|
|
|
|
|
|
//查询订单
|
|
|
AppOrder appOrder = appOrderMapper.selectOne(Wrappers.<AppOrder>lambdaQuery().eq(AppOrder::getOrderCode, orderCode).last("limit 1"));
|
|
@@ -1836,10 +1842,10 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
}
|
|
|
|
|
|
//null代表查询失败 SUCCESS-成功 USERPAYING和ACCEPT为中间态 其他为支付失败
|
|
|
- JSONObject res = weChatPayService.orderQueryByOutTradeNo(orderCode,depart.getMchId());
|
|
|
+ JSONObject res = weChatPayService.orderQueryByOutTradeNo(orderCode, depart.getMchId());
|
|
|
String s = res == null ? null : res.getString("trade_state");
|
|
|
// String s = "SUCCESS";
|
|
|
- if ("SUCCESS".equals(s) || appOrder.getOriginalPrice().compareTo(BigDecimal.ZERO)==0) {
|
|
|
+ if ("SUCCESS".equals(s) || appOrder.getOriginalPrice().compareTo(BigDecimal.ZERO) == 0) {
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(appOrder) && Objects.equals(appOrder.getOrderStatus(), CommonConstant.ORDER_STATUS_0)) {
|
|
|
appOrder.setOrderStatus(1);
|
|
@@ -1858,7 +1864,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
weChatPayService.addProfitSharingInfos(appOrder);
|
|
|
}
|
|
|
}
|
|
|
- if (ObjectUtil.isEmpty(appOrder.getTransactionId())){
|
|
|
+ if (ObjectUtil.isEmpty(appOrder.getTransactionId())) {
|
|
|
appOrder.setTransactionId(res.getString("transaction_id"));
|
|
|
appOrderMapper.updateById(appOrder);
|
|
|
}
|
|
@@ -1928,9 +1934,9 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
if (ObjectUtil.isNotEmpty(appSitePriceRules)) {
|
|
|
AppSitePlace appSitePlace = appSitePlaceMapper.selectOne(Wrappers.<AppSitePlace>lambdaQuery()
|
|
|
.eq(AppSitePlace::getId, appSitePriceRules.getSitePlaceId()));
|
|
|
- if(null != appSitePlace){
|
|
|
+ if (null != appSitePlace) {
|
|
|
record.setEarlyRefundTime(appSitePlace.getEarlyRefundTime());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
record.setEarlyRefundTime(60);
|
|
|
}
|
|
|
}
|
|
@@ -1942,10 +1948,10 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
if (ObjectUtil.isNotEmpty(proInfoList)) {
|
|
|
List<AppOrderProInfo> infoList = proInfoList.stream().filter(orderProInfo -> !Objects.equals(orderProInfo.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_6)).collect(Collectors.toList());
|
|
|
List<AppOrderProInfo> insureList = proInfoList.stream().filter(orderProInfo -> Objects.equals(orderProInfo.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_6)).collect(Collectors.toList());
|
|
|
- infoList.forEach(a->{
|
|
|
- if(null != record.getAddressSiteId()){
|
|
|
+ infoList.forEach(a -> {
|
|
|
+ if (null != record.getAddressSiteId()) {
|
|
|
a.setAddress(appSiteMapper.selectById(record.getAddressSiteId()).getName());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
a.setAddress(sysDepartMapper.selectOne(Wrappers.<SysDepart>lambdaQuery()
|
|
|
.eq(SysDepart::getOrgCode, "A01").last("limit 1")).getDepartName());
|
|
|
}
|
|
@@ -1957,9 +1963,10 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
});
|
|
|
return pageOrders;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public String refundOrder(RefundOrderForm refundOrderForm){
|
|
|
+ public String refundOrder(RefundOrderForm refundOrderForm) {
|
|
|
AppOrder appOrder = appOrderMapper.selectOne(Wrappers.<AppOrder>lambdaQuery().eq(AppOrder::getOrderCode, refundOrderForm.getOrderCode()).last("limit 1"));
|
|
|
//退款金额
|
|
|
BigDecimal refundAmount = BigDecimal.ZERO;
|
|
@@ -1969,7 +1976,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
if (appOrder.getProfitSharingStatus() > CommonConstant.NUMBER_0) {
|
|
|
throw new JeecgBootException("当前订单无法进行退款,请联系客服处理!");
|
|
|
}
|
|
|
- if(!Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_1) && !appOrder.getOrderType().equals(CommonConstant.ORDER_PRO_INFO_TYPE_2)){
|
|
|
+ if (!Objects.equals(appOrder.getOrderType(), CommonConstant.ORDER_PRO_INFO_TYPE_1) && !appOrder.getOrderType().equals(CommonConstant.ORDER_PRO_INFO_TYPE_2)) {
|
|
|
throw new JeecgBootException("当前订单类型不支持退款!");
|
|
|
}
|
|
|
if (Objects.equals(appOrder.getOrderStatus(), CommonConstant.ORDER_STATUS_2)) {
|
|
@@ -1992,11 +1999,11 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
AppOrderProInfo appOrderProInfo = appOrderProInfoMapper.selectById(refundOrderProInfoId);
|
|
|
String productId = appOrderProInfo.getProductId();
|
|
|
AppSitePriceRules sitePriceRules = appSitePriceRulesMapper.selectById(productId);
|
|
|
- Instant originalInstant = sitePriceRules.getStartTime().toInstant();
|
|
|
+ Instant originalInstant = sitePriceRules.getStartTime().toInstant();
|
|
|
Instant time = originalInstant.minusSeconds(appSitePlace.getEarlyRefundTime() * 60);
|
|
|
Instant now = Instant.now();
|
|
|
if (!now.isBefore(time)) {
|
|
|
- throw new JeecgBootException("商品:"+ appOrderProInfo.getProductName() +" 已超过可退时间,无法进行退款!");
|
|
|
+ throw new JeecgBootException("商品:" + appOrderProInfo.getProductName() + " 已超过可退时间,无法进行退款!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2009,14 +2016,14 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
}
|
|
|
}
|
|
|
//调用退款逻辑
|
|
|
- weChatPayService.refundOrder(appOrder,appOrderProInfoList,refundAmount, refundOrderForm.getReason(),refundOrderForm.getType());
|
|
|
+ weChatPayService.refundOrder(appOrder, appOrderProInfoList, refundAmount, refundOrderForm.getReason(), refundOrderForm.getType());
|
|
|
|
|
|
return "申请成功,预计在3个工作日内处理!";
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public String gameRefundOrder(String orderCode,String reason){
|
|
|
+ public String gameRefundOrder(String orderCode, String reason) {
|
|
|
AppOrder appOrder = appOrderMapper.selectOne(Wrappers.<AppOrder>lambdaQuery().eq(AppOrder::getOrderCode, orderCode).last("limit 1"));
|
|
|
|
|
|
//保险支付金额
|
|
@@ -2042,7 +2049,7 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
refundAmount = appOrder.getPrice().subtract(payAmount);
|
|
|
}
|
|
|
//调用退款逻辑
|
|
|
- weChatPayService.refundOrder(appOrder,null,refundAmount, reason,2);
|
|
|
+ weChatPayService.refundOrder(appOrder, null, refundAmount, reason, 2);
|
|
|
|
|
|
return "申请成功,预计在3个工作日内处理!";
|
|
|
}
|
|
@@ -2115,14 +2122,14 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> impl
|
|
|
public UserPayForm payOrder(String appOrderId) {
|
|
|
UserPayForm payForm = new UserPayForm();
|
|
|
AppOrder appOrder = appOrderMapper.selectById(appOrderId);
|
|
|
- if (ObjectUtil.isEmpty(appOrder)){
|
|
|
+ if (ObjectUtil.isEmpty(appOrder)) {
|
|
|
throw new JeecgBootException("当前订单不存在!");
|
|
|
}
|
|
|
- if (!Objects.equals(appOrder.getOrderStatus(), CommonConstant.ORDER_STATUS_0)){
|
|
|
- if (appOrder.getOrderStatus().equals(CommonConstant.ORDER_STATUS_1) || appOrder.getPayStatus().equals(CommonConstant.STATUS_1_INT)){
|
|
|
+ if (!Objects.equals(appOrder.getOrderStatus(), CommonConstant.ORDER_STATUS_0)) {
|
|
|
+ if (appOrder.getOrderStatus().equals(CommonConstant.ORDER_STATUS_1) || appOrder.getPayStatus().equals(CommonConstant.STATUS_1_INT)) {
|
|
|
throw new JeecgBootException("当前订单已支付!");
|
|
|
}
|
|
|
- if(appOrder.getOrderStatus().equals(CommonConstant.ORDER_STATUS_4)){
|
|
|
+ if (appOrder.getOrderStatus().equals(CommonConstant.ORDER_STATUS_4)) {
|
|
|
throw new JeecgBootException("当前订单已过期取消,请重新下单!");
|
|
|
}
|
|
|
}
|