|
@@ -19,6 +19,7 @@ import java.util.Optional;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.entity.OrderSkuSync;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
@@ -56,21 +57,6 @@ import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
|
|
|
-import com.ym.mec.biz.dal.entity.ActivityUserMapper;
|
|
|
-import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
|
|
|
-import com.ym.mec.biz.dal.entity.Goods;
|
|
|
-import com.ym.mec.biz.dal.entity.GoodsProcurement;
|
|
|
-import com.ym.mec.biz.dal.entity.MusicGroup;
|
|
|
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
|
|
|
-import com.ym.mec.biz.dal.entity.SellOrder;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentGoodsSell;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentRegistration;
|
|
|
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
|
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
|
|
|
-import com.ym.mec.biz.dal.entity.VipGroupActivity;
|
|
|
import com.ym.mec.biz.dal.enums.AccountType;
|
|
|
import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
@@ -115,92 +101,101 @@ import com.ym.mec.thirdparty.yqpay.YqPayUtil;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
@Service
|
|
|
public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, StudentPaymentOrder> implements StudentPaymentOrderService {
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentPaymentOrderDao studentPaymentOrderDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private YqPayFeignService yqPayFeignService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentRegistrationService studentRegistrationService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
@Lazy
|
|
|
private VipGroupService vipGroupService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MusicGroupService musicGroupService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SporadicChargeInfoService sporadicChargeInfoService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private PracticeGroupService practiceGroupService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysUserCashAccountDao sysUserCashAccountDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentRepairService studentRepairService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysUserCashAccountService sysUserCashAccountService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SubjectChangeService subjectChangeService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private DegreeRegistrationService degreeRegistrationService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private IdGeneratorService idGeneratorService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private GoodsDao goodsDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private GoodsService goodsService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentInstrumentService studentInstrumentService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ReplacementInstrumentActivityService replacementInstrumentActivityService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ChildrenDayReserveService childrenDayReserveService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MemberRankSettingService memberRankSettingService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private PayService payService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private CloudTeacherOrderService cloudTeacherOrderService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysCouponCodeService sysCouponCodeService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private VipGroupActivityService vipGroupActivityService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ActivityUserMapperService activityUserMapperService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private TenantConfigService tenantConfigService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private GoodsProcurementDao goodsProcurementDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysPaymentConfigService sysPaymentConfigService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SellOrderDao sellOrderDao;
|
|
|
@Lazy
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ContractService contractService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private HfMerchantConfigService hfMerchantConfigService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentDao studentDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysUserCashAccountDetailService sysUserCashAccountDetailService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private YeepayPaymentService yeepayPaymentService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
|
|
|
+ @Resource
|
|
|
+ private MusicGroupPaymentCalenderAddressService musicGroupPaymentCalenderAddressService;
|
|
|
+ @Resource
|
|
|
+ private StudentRepairDao studentRepairDao;
|
|
|
+ @Resource
|
|
|
+ private MusicGroupDao musicGroupDao;
|
|
|
+ @Resource
|
|
|
+ private StudentGoodsSellDao studentGoodsSellDao;
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
@Override
|
|
@@ -1305,14 +1300,6 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
return studentPaymentOrderDao.getMemberIngOrder(member, status);
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private StudentRepairDao studentRepairDao;
|
|
|
- @Autowired
|
|
|
- private MusicGroupDao musicGroupDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private StudentGoodsSellDao studentGoodsSellDao;
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Map createOrder(MallCreateOrderModel model) throws Exception {
|
|
@@ -2218,9 +2205,27 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
return;
|
|
|
}
|
|
|
List<String> orderNos = orderSkuSyncs.stream().map(e -> e.getOrderNo()).collect(Collectors.toList());
|
|
|
+ Map<String, List<OrderSkuSync.SkuSync>> skuMap = orderSkuSyncs.stream().collect(Collectors.toMap(OrderSkuSync::getOrderNo, OrderSkuSync::getSkuSyncList));
|
|
|
List<SellOrder> sellOrders = sellOrderDao.queryByOrganNos(orderNos);
|
|
|
+ //检查学校商品采购订单
|
|
|
+ List<MusicGroupPaymentCalenderAddress> calenderAddresses = musicGroupPaymentCalenderAddressService.lambdaQuery().
|
|
|
+ in(MusicGroupPaymentCalenderAddress::getOrderNo, orderNos).
|
|
|
+ eq(MusicGroupPaymentCalenderAddress::getDeliveryFlag, false).list();
|
|
|
+ if (CollectionUtils.isNotEmpty(calenderAddresses)) {
|
|
|
+ Map<String, MusicGroupPaymentCalenderAddress> addressMap = calenderAddresses.stream().
|
|
|
+ collect(Collectors.toMap(MusicGroupPaymentCalenderAddress::getOrderNo, e -> e));
|
|
|
+ List<String> addressOrders = calenderAddresses.stream().map(MusicGroupPaymentCalenderAddress::getOrderNo).collect(Collectors.toList());
|
|
|
+ for (String addressOrder : addressOrders) {
|
|
|
+ MusicGroupPaymentCalenderAddress address = addressMap.get(addressOrder);
|
|
|
+ address.setDeliveryDetail(JSON.toJSONString(skuMap.get(addressOrder)));
|
|
|
+ address.setDeliveryFlag(true);
|
|
|
+ }
|
|
|
+ musicGroupPaymentCalenderAddressService.updateBatchById(calenderAddresses);
|
|
|
+ //如果有审核通过的外部订单,更新对应的商品信息
|
|
|
+
|
|
|
+ }
|
|
|
if (CollectionUtils.isEmpty(sellOrders)) {
|
|
|
- throw new BizException("订单不存在");
|
|
|
+ return;
|
|
|
}
|
|
|
sellOrders = sellOrders.stream().filter(e -> e.getDeliveryTime() == null).collect(Collectors.toList());
|
|
|
if(CollectionUtils.isEmpty(sellOrders)){
|
|
@@ -2234,10 +2239,10 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
continue;
|
|
|
}
|
|
|
//获取sku平均成本价
|
|
|
- Map<Long,List<OrderSkuSync.SkuSync>> skuMap = orderSkuSync.getSkuSyncList().stream().collect(Collectors.groupingBy(OrderSkuSync.SkuSync::getSku));
|
|
|
- Map<Long,BigDecimal> costMap = new HashMap<>(skuMap.keySet().size());
|
|
|
- for (Long skuId : skuMap.keySet()) {
|
|
|
- List<OrderSkuSync.SkuSync> skuSyncs = skuMap.get(skuId);
|
|
|
+ Map<Long,List<OrderSkuSync.SkuSync>> skuDetailMap = orderSkuSync.getSkuSyncList().stream().collect(Collectors.groupingBy(OrderSkuSync.SkuSync::getSku));
|
|
|
+ Map<Long,BigDecimal> costMap = new HashMap<>(skuDetailMap.keySet().size());
|
|
|
+ for (Long skuId : skuDetailMap.keySet()) {
|
|
|
+ List<OrderSkuSync.SkuSync> skuSyncs = skuDetailMap.get(skuId);
|
|
|
//汇总成本价
|
|
|
BigDecimal costPrice = skuSyncs.stream().map(e -> e.getPrice().multiply(new BigDecimal(e.getCount()))).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
//获取总数
|