|
@@ -30,13 +30,9 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
-import java.math.BigDecimal;
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -203,24 +199,23 @@ public class AppOrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> i
|
|
List<AppGameScheduleVO> gameScheduleVOList = appGameScheduleMapper.getListVo(gameId);
|
|
List<AppGameScheduleVO> gameScheduleVOList = appGameScheduleMapper.getListVo(gameId);
|
|
appOrderInfoVO.setGameScheduleVOList(gameScheduleVOList);
|
|
appOrderInfoVO.setGameScheduleVOList(gameScheduleVOList);
|
|
}
|
|
}
|
|
|
|
+ //无固定场团购优惠
|
|
|
|
+ if (appOrder.getOrderType() == 2) {
|
|
|
|
+ appOrderInfoVO.setTDiscounts(appOrder.getTDiscounts());
|
|
|
|
+ appOrderInfoVO.setTotalPrice(appOrderInfoVO.getTotalPrice().add(appOrder.getTDiscounts()));
|
|
|
|
+ }
|
|
//课程才有核销记录和优惠信息
|
|
//课程才有核销记录和优惠信息
|
|
if (appOrder.getType() == 2) {
|
|
if (appOrder.getType() == 2) {
|
|
- BigDecimal sDiscounts = BigDecimal.ZERO;
|
|
|
|
- BigDecimal tDiscounts = BigDecimal.ZERO;
|
|
|
|
- for (AppOrderProInfo proInfo : proInfoList) {
|
|
|
|
- if (proInfo.getOrFreePro() == 1) {
|
|
|
|
- sDiscounts = sDiscounts.add(proInfo.getOriginalPrice());
|
|
|
|
- }
|
|
|
|
- BigDecimal discounts = proInfo.getOriginalPrice().subtract(proInfo.getPrice());
|
|
|
|
- tDiscounts = tDiscounts.add(discounts);
|
|
|
|
- }
|
|
|
|
//优惠信息
|
|
//优惠信息
|
|
- if (sDiscounts.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
- appOrderInfoVO.setSDiscounts(sDiscounts);
|
|
|
|
|
|
+ if (appOrder.getSDiscounts() != null){
|
|
|
|
+ appOrderInfoVO.setSDiscounts(appOrder.getSDiscounts());
|
|
|
|
+ appOrderInfoVO.setTotalPrice(appOrderInfoVO.getTotalPrice().add(appOrder.getSDiscounts()));
|
|
}
|
|
}
|
|
- if (tDiscounts.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
- appOrderInfoVO.setTDiscounts(tDiscounts);
|
|
|
|
|
|
+ if (appOrder.getTDiscounts() != null){
|
|
|
|
+ appOrderInfoVO.setTDiscounts(appOrder.getTDiscounts());
|
|
|
|
+ appOrderInfoVO.setTotalPrice(appOrderInfoVO.getTotalPrice().add(appOrder.getTDiscounts()));
|
|
}
|
|
}
|
|
|
|
+
|
|
//核销记录
|
|
//核销记录
|
|
List<AppCoursesVerificationRecord> verificationRecords =
|
|
List<AppCoursesVerificationRecord> verificationRecords =
|
|
appCoursesVerificationRecordMapper.selectList(Wrappers.<AppCoursesVerificationRecord>lambdaQuery().eq(AppCoursesVerificationRecord::getOrderId, orderId));
|
|
appCoursesVerificationRecordMapper.selectList(Wrappers.<AppCoursesVerificationRecord>lambdaQuery().eq(AppCoursesVerificationRecord::getOrderId, orderId));
|
|
@@ -229,7 +224,7 @@ public class AppOrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> i
|
|
listMap.keySet().forEach(p -> {
|
|
listMap.keySet().forEach(p -> {
|
|
VerificationRecordDTO verificationRecordDTO = new VerificationRecordDTO();
|
|
VerificationRecordDTO verificationRecordDTO = new VerificationRecordDTO();
|
|
verificationRecordDTO.setCoursesType(p).setVerificationRecordList(listMap.get(p));
|
|
verificationRecordDTO.setCoursesType(p).setVerificationRecordList(listMap.get(p));
|
|
- verificationRecordDTOList.add(new VerificationRecordDTO());
|
|
|
|
|
|
+ verificationRecordDTOList.add(verificationRecordDTO);
|
|
});
|
|
});
|
|
appOrderInfoVO.setVerificationRecordDTOList(verificationRecordDTOList);
|
|
appOrderInfoVO.setVerificationRecordDTOList(verificationRecordDTOList);
|
|
}
|
|
}
|
|
@@ -299,16 +294,32 @@ public class AppOrderServiceImpl extends ServiceImpl<AppOrderMapper, AppOrder> i
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public Boolean scanCodeVerification(List<String> isinIds) {
|
|
public Boolean scanCodeVerification(List<String> isinIds) {
|
|
|
|
|
|
|
|
+ LoginUser loginUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+
|
|
for (String isinId : isinIds) {
|
|
for (String isinId : isinIds) {
|
|
//查询对应券号
|
|
//查询对应券号
|
|
AppIsin appIsin = appIsinMapper.selectById(isinId);
|
|
AppIsin appIsin = appIsinMapper.selectById(isinId);
|
|
appIsin.setIsinStatus(CommonConstant.ISIN_STATUS_2);
|
|
appIsin.setIsinStatus(CommonConstant.ISIN_STATUS_2);
|
|
|
|
+ appIsin.setVerifyUserId(loginUser.getId());
|
|
|
|
+ appIsin.setVerifyUserName(loginUser.getUsername());
|
|
|
|
+ appIsin.setUseTime(new Date());
|
|
appIsinMapper.updateById(appIsin);
|
|
appIsinMapper.updateById(appIsin);
|
|
//修改订单状态
|
|
//修改订单状态
|
|
String orderProInfoId = appIsin.getOrderProInfoId();
|
|
String orderProInfoId = appIsin.getOrderProInfoId();
|
|
AppOrderProInfo appOrderProInfo = appOrderProInfoMapper.selectById(orderProInfoId);
|
|
AppOrderProInfo appOrderProInfo = appOrderProInfoMapper.selectById(orderProInfoId);
|
|
- appOrderProInfo.setOrderStatus(CommonConstant.ORDER_STATUS_1);
|
|
|
|
|
|
+ appOrderProInfo.setOrderStatus(CommonConstant.ORDER_STATUS_2);
|
|
appOrderProInfoMapper.updateById(appOrderProInfo);
|
|
appOrderProInfoMapper.updateById(appOrderProInfo);
|
|
|
|
+ //修改订单状态
|
|
|
|
+ String orderId = appOrderProInfo.getOrderId();
|
|
|
|
+ AppOrder appOrder = appOrderMapper.selectById(orderId);
|
|
|
|
+ if (ObjectUtil.isNotEmpty(appOrder)){
|
|
|
|
+ List<AppOrderProInfo> proInfoList = appOrderProInfoMapper.selectList(Wrappers.<AppOrderProInfo>lambdaQuery().eq(AppOrderProInfo::getOrderId, orderId).eq(AppOrderProInfo::getType, CommonConstant.ORDER_PRO_INFO_TYPE_5));
|
|
|
|
+ long count = proInfoList.stream().filter(info -> Objects.equals(info.getOrderStatus(), CommonConstant.ORDER_STATUS_2)).count();
|
|
|
|
+ if(count == proInfoList.size()){
|
|
|
|
+ appOrder.setOrderStatus(CommonConstant.ORDER_STATUS_2);
|
|
|
|
+ appOrderMapper.updateById(appOrder);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return Boolean.TRUE;
|
|
return Boolean.TRUE;
|
|
}
|
|
}
|