|
@@ -51,6 +51,7 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.ym.mec.biz.dal.enums.DealStatusEnum.CLOSE;
|
|
@@ -75,8 +76,6 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Resource
|
|
|
private PracticeGroupService practiceGroupService;
|
|
|
@Resource
|
|
|
- private SysUserCashAccountDao sysUserCashAccountDao;
|
|
|
- @Resource
|
|
|
private StudentRepairService studentRepairService;
|
|
|
@Resource
|
|
|
private SysUserCashAccountService sysUserCashAccountService;
|
|
@@ -85,16 +84,12 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Resource
|
|
|
private DegreeRegistrationService degreeRegistrationService;
|
|
|
@Resource
|
|
|
- private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
|
|
|
- @Resource
|
|
|
private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
|
@Resource
|
|
|
private IdGeneratorService idGeneratorService;
|
|
|
@Resource
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
@Resource
|
|
|
- private GoodsDao goodsDao;
|
|
|
- @Resource
|
|
|
private GoodsService goodsService;
|
|
|
@Resource
|
|
|
private StudentInstrumentService studentInstrumentService;
|
|
@@ -147,8 +142,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
private MusicGroupDao musicGroupDao;
|
|
|
@Resource
|
|
|
private StudentGoodsSellDao studentGoodsSellDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentPaymentOrderService studentPaymentOrderService;
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
@@ -502,7 +496,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
HfMerchantConfig hfMerchantConfig = null;
|
|
|
|
|
|
- List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderDao.getRouteOrders(order.getOrderNo());
|
|
|
+ List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderService.getDao().getRouteOrders(order.getOrderNo());
|
|
|
|
|
|
PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(order.getPaymentChannel());
|
|
|
|
|
@@ -540,7 +534,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
LOGGER.info("分账信息返回:{}", map);
|
|
|
routeOrder.setServiceFee(new BigDecimal(map.get("fee_amt").toString()));
|
|
|
routeOrder.setUpdateTime(date);
|
|
|
- studentPaymentRouteOrderDao.update(routeOrder);
|
|
|
+ studentPaymentRouteOrderService.getDao().update(routeOrder);
|
|
|
} catch (Exception e) {
|
|
|
LOGGER.error("分账失败 orderId:{}", order.getId(), e);
|
|
|
continue;
|
|
@@ -598,7 +592,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
for (StudentPaymentRouteOrder spro : routeOrders) {
|
|
|
|
|
|
- studentPaymentRouteOrderDao.update(spro);
|
|
|
+ studentPaymentRouteOrderService.getDao().update(spro);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -727,7 +721,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
int count = this.findCount(params);
|
|
|
count = count + jmCount;
|
|
|
|
|
|
- BigDecimal totalUserBalance = sysUserCashAccountDao.getTotalUserBalance(params);
|
|
|
+ BigDecimal totalUserBalance = sysUserCashAccountService.getDao().getTotalUserBalance(params);
|
|
|
pageInfo.setTotalUserBalance(totalUserBalance);
|
|
|
if (count > 0) {
|
|
|
pageInfo.setTotal(count);
|
|
@@ -830,7 +824,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(childGoodIds)) {
|
|
|
- studentPaymentOrderDetail.setChildGoodsList(goodsDao.findGoodsByIds(childGoodIds));
|
|
|
+ studentPaymentOrderDetail.setChildGoodsList(goodsService.getGoodsDao().findGoodsByIds(childGoodIds));
|
|
|
}
|
|
|
if (studentPaymentOrderDetail.getType() == OrderDetailTypeEnum.CLOUD_TEACHER || studentPaymentOrderDetail.getType() == OrderDetailTypeEnum.CLOUD_TEACHER_PLUS) {
|
|
|
studentPaymentOrderDetail.setCloudTeacherOrderDto(cloudTeacherOrderService.queryOrderInfoByOrderId(studentPaymentOrderDetail.getPaymentOrderId()));
|
|
@@ -1372,7 +1366,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void mallBuyOrderCallback(StudentPaymentOrder studentPaymentOrder) {
|
|
|
Date nowDate = new Date();
|
|
|
//更新订单信息
|
|
@@ -1410,7 +1404,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//如果有空的商品货号,不处理
|
|
|
if(count == 0l){
|
|
|
List<String> productSns = goodsOrderItemVOS.stream().map(e -> e.getProductSn()).distinct().collect(Collectors.toList());
|
|
|
- List<Goods> goodsList = goodsDao.findBySns(productSns);
|
|
|
+ List<Goods> goodsList = goodsService.getGoodsDao().findBySns(productSns);
|
|
|
//如果有不匹配的商品货号,不处理
|
|
|
if(CollectionUtils.isEmpty(goodsList) || goodsList.size() < productSns.size()){
|
|
|
return;
|
|
@@ -1572,7 +1566,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//如果有空的商品货号,不处理
|
|
|
if(count == 0l){
|
|
|
List<String> productSns = goodsOrderItemVOS.stream().map(e -> e.getProductSn()).distinct().collect(Collectors.toList());
|
|
|
- List<Goods> goodsList = goodsDao.findBySns(productSns);
|
|
|
+ List<Goods> goodsList = goodsService.getGoodsDao().findBySns(productSns);
|
|
|
//如果有不匹配的商品货号,不处理
|
|
|
if(CollectionUtils.isEmpty(goodsList) || goodsList.size() < productSns.size()){
|
|
|
return;
|
|
@@ -1819,6 +1813,17 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
feeByTypeMap = feeByType.stream().collect(Collectors.groupingBy(StudentPaymentOrderExportDto::getId));
|
|
|
childRepairMap = MapUtil.convertIntegerMap(sellOrderDao.queryChildRepair(otherOrderIds));
|
|
|
}
|
|
|
+ //获取外部订单
|
|
|
+ Map<String, StudentPaymentRouteOrder> routeOrderMap = new HashMap<>();
|
|
|
+ List<String> outOrderNos = studentPaymentOrderExportDtos.stream().filter(e -> e.getGroupType() == GroupType.OUTORDER && e.getType() == OrderTypeEnum.SCHOOL)
|
|
|
+ .map(e -> e.getOrderNo()).collect(Collectors.toList());
|
|
|
+ if(CollectionUtils.isNotEmpty(outOrderNos)){
|
|
|
+ List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderService.getDao().queryByOrderNos(outOrderNos);
|
|
|
+ if (CollectionUtils.isNotEmpty(routeOrders)){
|
|
|
+ routeOrderMap = routeOrders.stream().filter(e->e.getType() == OrderTypeEnum.SCHOOL_GOODS_PURCHASE)
|
|
|
+ .collect(Collectors.toMap(StudentPaymentRouteOrder::getOrderNo, Function.identity()));
|
|
|
+ }
|
|
|
+ }
|
|
|
//阳光、善学、坚韧、做更好的自己
|
|
|
// List<Integer> organIds = studentPaymentOrderExportDtos.stream().map(e -> e.getOrganId()).distinct().collect(Collectors.toList());
|
|
|
Map<Integer, String> userOrganNameMap = this.getMap("organization","id_","name_",true,1,Integer.class,String.class);
|
|
@@ -2001,14 +2006,18 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
} else {
|
|
|
//拆分导入订单
|
|
|
if (row.getType() == OrderTypeEnum.OUTORDER || row.getType() == OrderTypeEnum.SCHOOL) {
|
|
|
- if (row.getType() == OrderTypeEnum.SCHOOL) {
|
|
|
- row.setMusicalFee(BigDecimal.ZERO);
|
|
|
- row.setTeachingFee(BigDecimal.ZERO);
|
|
|
- row.setMaintenanceProductFee(BigDecimal.ZERO);
|
|
|
- row.setOtherFee(BigDecimal.ZERO);
|
|
|
- row.setLargeMusicalFee(add);
|
|
|
+ if(routeOrderMap.get(row.getOrderNo()) != null){
|
|
|
+ row.setLargeMusicalFee(subtract);
|
|
|
+ }else {
|
|
|
+ if (row.getType() == OrderTypeEnum.SCHOOL) {
|
|
|
+ row.setMusicalFee(BigDecimal.ZERO);
|
|
|
+ row.setTeachingFee(BigDecimal.ZERO);
|
|
|
+ row.setMaintenanceProductFee(BigDecimal.ZERO);
|
|
|
+ row.setOtherFee(BigDecimal.ZERO);
|
|
|
+ row.setLargeMusicalFee(add);
|
|
|
+ }
|
|
|
+ row.setCourseSchoolBuyAmount(subtract);
|
|
|
}
|
|
|
- row.setCourseSchoolBuyAmount(subtract);
|
|
|
} else if (row.getType() == OrderTypeEnum.OTHER) {
|
|
|
row.setOtherFee(row.getOtherFee().add(subtract));
|
|
|
} else {
|