|
@@ -38,8 +38,6 @@ import org.jeecg.modules.app.vo.PageOrdersVO;
|
|
import org.jeecg.modules.app.vo.QueryOrderVerifyRecordsVO;
|
|
import org.jeecg.modules.app.vo.QueryOrderVerifyRecordsVO;
|
|
import org.jeecg.modules.pay.config.WechatConstants;
|
|
import org.jeecg.modules.pay.config.WechatConstants;
|
|
import org.jeecg.modules.pay.config.WechatUrlConstants;
|
|
import org.jeecg.modules.pay.config.WechatUrlConstants;
|
|
-import org.jeecg.modules.pay.vo.NotifyRequest;
|
|
|
|
-import org.jeecg.modules.pay.vo.NotifyResponse;
|
|
|
|
import org.jeecg.modules.redission.RedissonDelayQueue;
|
|
import org.jeecg.modules.redission.RedissonDelayQueue;
|
|
import org.jeecg.modules.system.app.dto.receiptPaymentDetails.ReceiptPaymentDetailsInfoVo;
|
|
import org.jeecg.modules.system.app.dto.receiptPaymentDetails.ReceiptPaymentDetailsInfoVo;
|
|
import org.jeecg.modules.system.app.entity.*;
|
|
import org.jeecg.modules.system.app.entity.*;
|
|
@@ -526,6 +524,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
AppOrderProInfo proInfo = appOrderProInfoMapper.selectOne(Wrappers.<AppOrderProInfo>lambdaQuery()
|
|
AppOrderProInfo proInfo = appOrderProInfoMapper.selectOne(Wrappers.<AppOrderProInfo>lambdaQuery()
|
|
.eq(AppOrderProInfo::getProductId, productId)
|
|
.eq(AppOrderProInfo::getProductId, productId)
|
|
.in(AppOrderProInfo::getFamilyUserId, familyIds)
|
|
.in(AppOrderProInfo::getFamilyUserId, familyIds)
|
|
|
|
+ .last("limit 1")
|
|
);
|
|
);
|
|
if (ObjectUtil.isNotEmpty(proInfo)) {
|
|
if (ObjectUtil.isNotEmpty(proInfo)) {
|
|
String userName = proInfo.getUserName();
|
|
String userName = proInfo.getUserName();
|
|
@@ -537,6 +536,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
|
|
|
// 查询库存
|
|
// 查询库存
|
|
Integer stock = (Integer) redisTemplate.opsForValue().get(stockKey);
|
|
Integer stock = (Integer) redisTemplate.opsForValue().get(stockKey);
|
|
|
|
+ log.info("学校场地预约商品库存数量:{}", stock);
|
|
// 缓存没有商品库存,查询数据库
|
|
// 缓存没有商品库存,查询数据库
|
|
if (stock == null) {
|
|
if (stock == null) {
|
|
AppSitePriceRules product = appSitePriceRulesMapper.selectById(productId);
|
|
AppSitePriceRules product = appSitePriceRulesMapper.selectById(productId);
|
|
@@ -579,7 +579,6 @@ public class OrderServiceImpl implements IOrderService {
|
|
.setFamilyIds(createOrderForm.getFamilyIds())
|
|
.setFamilyIds(createOrderForm.getFamilyIds())
|
|
.setOriginalPrice(priceRule.getSellingPrice())
|
|
.setOriginalPrice(priceRule.getSellingPrice())
|
|
.setAddressSiteId(appSite.getId())
|
|
.setAddressSiteId(appSite.getId())
|
|
- .setPrice(totalPrice)
|
|
|
|
.setCreateTime(new Date())
|
|
.setCreateTime(new Date())
|
|
.setUpdateTime(new Date())
|
|
.setUpdateTime(new Date())
|
|
.setCreateBy(user.getId())
|
|
.setCreateBy(user.getId())
|
|
@@ -649,7 +648,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
appOrderProInfo.setAddress(appSite.getName());
|
|
appOrderProInfo.setAddress(appSite.getName());
|
|
appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_1);
|
|
appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_1);
|
|
appOrderProInfo.setProductImage(appSite.getCover());
|
|
appOrderProInfo.setProductImage(appSite.getCover());
|
|
- appOrderProInfo.setOriginalPrice(priceRule.getOriginalPrice());
|
|
|
|
|
|
+ appOrderProInfo.setOriginalPrice(priceRule.getSellingPrice());
|
|
appOrderProInfo.setPrice(priceRule.getSellingPrice());
|
|
appOrderProInfo.setPrice(priceRule.getSellingPrice());
|
|
appOrderProInfo.setOrderStatus(0);
|
|
appOrderProInfo.setOrderStatus(0);
|
|
appOrderProInfo.setQuantity(1);
|
|
appOrderProInfo.setQuantity(1);
|
|
@@ -889,11 +888,17 @@ public class OrderServiceImpl implements IOrderService {
|
|
//判断当前课程是否已下过单
|
|
//判断当前课程是否已下过单
|
|
List<AppOrderProInfo> infos = appOrderProInfoMapper.selectList(Wrappers.<AppOrderProInfo>lambdaQuery()
|
|
List<AppOrderProInfo> infos = appOrderProInfoMapper.selectList(Wrappers.<AppOrderProInfo>lambdaQuery()
|
|
.eq(AppOrderProInfo::getProductId, appCourse.getId())
|
|
.eq(AppOrderProInfo::getProductId, appCourse.getId())
|
|
- .eq(AppOrderProInfo::getFamilyUserId, familyUserId)
|
|
|
|
- .eq(AppOrderProInfo::getOrFreePro, CommonConstant.STATUS_1_INT));
|
|
|
|
- if (ObjectUtil.isNotEmpty(infos)) {
|
|
|
|
|
|
+ .eq(AppOrderProInfo::getFamilyUserId, familyUserId));
|
|
|
|
+ List<AppOrderProInfo> infoList = infos.stream().filter(info -> Objects.equals(info.getOrFreePro(), CommonConstant.STATUS_0_INT)).collect(Collectors.toList());
|
|
|
|
+ if (ObjectUtil.isNotEmpty(infoList)) {
|
|
throw new JeecgBootException("当前课程已下过单,请勿重复下单");
|
|
throw new JeecgBootException("当前课程已下过单,请勿重复下单");
|
|
}
|
|
}
|
|
|
|
+ if (Objects.equals(createOrderForm.getOrFreeOrder(), CommonConstant.STATUS_1_INT)){
|
|
|
|
+ List<AppOrderProInfo> freeProList = infos.stream().filter(info -> Objects.equals(info.getOrFreePro(), CommonConstant.STATUS_0_INT)).collect(Collectors.toList());
|
|
|
|
+ if (ObjectUtil.isNotEmpty(freeProList)) {
|
|
|
|
+ throw new JeecgBootException("当前试听课课程已下过单,请勿重复下单");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
AppOrderProInfo appOrderProInfo = new AppOrderProInfo();
|
|
appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
appOrderProInfo.setProductId(createOrderForm.getProductIds());
|
|
appOrderProInfo.setProductName(appCourse.getName());
|
|
appOrderProInfo.setProductName(appCourse.getName());
|
|
@@ -969,8 +974,6 @@ public class OrderServiceImpl implements IOrderService {
|
|
//团购优惠
|
|
//团购优惠
|
|
appOrder.setTDiscounts(BigDecimal.ZERO);
|
|
appOrder.setTDiscounts(BigDecimal.ZERO);
|
|
}
|
|
}
|
|
- //原订单总价
|
|
|
|
- appOrder.setOriginalPrice(sumCoursePrice);
|
|
|
|
//使用人IDs
|
|
//使用人IDs
|
|
appOrder.setFamilyIds(createOrderForm.getFamilyIds());
|
|
appOrder.setFamilyIds(createOrderForm.getFamilyIds());
|
|
|
|
|
|
@@ -1016,6 +1019,8 @@ public class OrderServiceImpl implements IOrderService {
|
|
//计算总价 = 订单金额 + 保单金额
|
|
//计算总价 = 订单金额 + 保单金额
|
|
totalPrice = totalPrice.add(sumPrice);
|
|
totalPrice = totalPrice.add(sumPrice);
|
|
}
|
|
}
|
|
|
|
+ //原订单总价
|
|
|
|
+ appOrder.setOriginalPrice(totalPrice);
|
|
appOrder.setPrice(totalPrice);
|
|
appOrder.setPrice(totalPrice);
|
|
appOrderMapper.insert(appOrder);
|
|
appOrderMapper.insert(appOrder);
|
|
if (appOrder.getOrderType() == 5 && appOrder.getOrderOrFree() == 0) {
|
|
if (appOrder.getOrderType() == 5 && appOrder.getOrderOrFree() == 0) {
|
|
@@ -1598,26 +1603,6 @@ public class OrderServiceImpl implements IOrderService {
|
|
return appOrder;
|
|
return appOrder;
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public NotifyResponse orderNotify(NotifyRequest notifyRequestForm) {
|
|
|
|
-
|
|
|
|
- //查询订单
|
|
|
|
- AppOrder appOrder = appOrderMapper.selectOne(Wrappers.<AppOrder>lambdaQuery().eq(AppOrder::getOrderCode, notifyRequestForm.getOut_trade_no()).last("limit 1"));
|
|
|
|
- if (ObjectUtil.isNotEmpty(appOrder)) {
|
|
|
|
- appOrder
|
|
|
|
- .setPayId(notifyRequestForm.getAcc_trade_no())
|
|
|
|
- .setOrderStatus(2)
|
|
|
|
- .setPayStatus(2)
|
|
|
|
- .setPayTime(DateUtil.parse(notifyRequestForm.getTrade_time(), "yyyyMMddHHmmss"))
|
|
|
|
- .setCallbackStatus(1);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- NotifyResponse notifyResponse = new NotifyResponse();
|
|
|
|
- notifyResponse.setCode("SUCCESS").setMessage("执行成功");
|
|
|
|
-
|
|
|
|
- return notifyResponse;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public String orderQuery(String orderCode) throws IOException {
|
|
public String orderQuery(String orderCode) throws IOException {
|
|
|
|
|