|
|
@@ -353,24 +353,39 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
- //乐器销售
|
|
|
+ //乐器销售,声部更改
|
|
|
if (order.getType().equals(OrderTypeEnum.GOODS_SELL) || order.getType().equals(OrderTypeEnum.SUBJECT_CHANGE)) {
|
|
|
return order.getActualAmount();
|
|
|
}
|
|
|
|
|
|
//乐器维修
|
|
|
-// if(order.getType().equals(OrderTypeEnum.REPAIR)){
|
|
|
-// StudentRepair repairInfo = studentRepairDao.getRepairInfo(Integer.parseInt(order.getMusicGroupId()));
|
|
|
-//
|
|
|
-// if (StringUtils.isNotBlank(repairInfo.getGoodsJson())) {
|
|
|
-// List<Goods> goods = JSONObject.parseArray(repairInfo.getGoodsJson(), Goods.class);
|
|
|
-// List<Integer> goodsIds = goods.stream().map(Goods::getId).collect(Collectors.toList());
|
|
|
-// if (goodsIds.size() > 0) {
|
|
|
-// addSellOrder(order.getId(), null, goodsIds, order.getExpectAmount(), order.getBalancePaymentAmount());
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
+ if (order.getType().equals(OrderTypeEnum.REPAIR)) {
|
|
|
+ StudentRepair repairInfo = studentRepairDao.getRepairInfo(Integer.parseInt(order.getMusicGroupId()));
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(repairInfo.getGoodsJson())) {
|
|
|
+ return BigDecimal.ZERO;
|
|
|
+ }
|
|
|
+ List<Goods> goodies = JSONObject.parseArray(repairInfo.getGoodsJson(), Goods.class);
|
|
|
+ List<Integer> goodsIds = goodies.stream().map(Goods::getId).collect(Collectors.toList());
|
|
|
+ if (goodsIds.size() <= 0) {
|
|
|
+ return BigDecimal.ZERO;
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal goodsTotalPrice = BigDecimal.ZERO;
|
|
|
+ goodies = goodsDao.getGoodies(goodsIds);
|
|
|
+ int i = 1;
|
|
|
+ for (Integer goodsId : goodsIds) {
|
|
|
+ for (Goods goods : goodies) {
|
|
|
+ if (goods.getId().equals(goodsId)) {
|
|
|
+ goodsTotalPrice = goodsTotalPrice.add(goods.getDiscountPrice());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BigDecimal balance = order.getBalancePaymentAmount() == null ? BigDecimal.ZERO : order.getBalancePaymentAmount();
|
|
|
+ BigDecimal goodsTotalBalance = goodsTotalPrice.multiply(balance).divide(order.getExpectAmount(), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ return goodsTotalPrice.subtract(goodsTotalBalance);
|
|
|
+ }
|
|
|
|
|
|
//乐团报名
|
|
|
if (order.getType().equals(OrderTypeEnum.APPLY)) {
|