| 
					
				 | 
			
			
				@@ -109,11 +109,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //关闭老订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(StringUtils.isNotEmpty(studentGoodsSell.getOrderNo())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNotEmpty(studentGoodsSell.getOrderNo())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(studentGoodsSell.getOrderNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(orderByOrderNo.getBalancePaymentAmount() != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (orderByOrderNo.getBalancePaymentAmount() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentGoodsSell.setIsUseBalancePayment(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentGoodsSell.setIsUseBalancePayment(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderByOrderNo.setStatus(DealStatusEnum.CLOSE); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -122,14 +122,14 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 sysUserCashAccountService.updateBalance(orderByOrderNo.getUserId(), orderByOrderNo.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             StudentGoodsSell byOrderNo = studentGoodsSellDao.findByOrderNo(studentGoodsSell.getOrderNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(byOrderNo != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (byOrderNo != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentGoodsSell = byOrderNo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                studentGoodsSell.setGoodsSellDtos(JSON.parseArray(byOrderNo.getGoodsJson(),GoodsSellDto.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentGoodsSell.setGoodsSellDtos(JSON.parseArray(byOrderNo.getGoodsJson(), GoodsSellDto.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer studentId = studentGoodsSell.getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<GoodsSellDto> goodsSellDtos = studentGoodsSell.getGoodsSellDtos(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(goodsSellDtos == null || goodsSellDtos.size() == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (goodsSellDtos == null || goodsSellDtos.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("请选择需要购买的商品"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (studentId == null) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -139,21 +139,21 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentDao.lockUser(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SysUser student = sysUserFeignService.queryUserById(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //如果教务老师为空,代表学员自己创建的订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(studentGoodsSell.getTeacherId() == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (studentGoodsSell.getTeacherId() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //获取学生关联的所有教务老师列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<Integer> stuEducation = studentRepairDao.countStuEducation(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (stuEducation != null && stuEducation.size() == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (stuEducation != null && stuEducation.size() == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //获取学员乐团关联的教务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 MusicGroup musicGroup = musicGroupDao.getStuMusic(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentGoodsSell.setTeacherId(stuEducation.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(musicGroup != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (musicGroup != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     studentGoodsSell.setCooperationOrganId(musicGroup.getCooperationOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }else if(studentGoodsSell.getCooperationOrganId() == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (studentGoodsSell.getCooperationOrganId() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //获取教务老师,学员关联的乐团 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            MusicGroup musicGroup = musicGroupDao.getStuEduMusic(studentId,studentGoodsSell.getTeacherId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(musicGroup != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            MusicGroup musicGroup = musicGroupDao.getStuEduMusic(studentId, studentGoodsSell.getTeacherId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (musicGroup != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentGoodsSell.setCooperationOrganId(musicGroup.getCooperationOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -162,7 +162,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, Integer.class, BigDecimal.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (GoodsSellDto goodsSellDto : goodsSellDtos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             goodsSellDto.setGoodsType(integerStringMap.get(goodsSellDto.getGoodsId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(StringUtils.isNotEmpty(goodsSellDto.getComplementGoodsIdList())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isNotEmpty(goodsSellDto.getComplementGoodsIdList())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 goodsSellDto.setGoodsSellDtos(goodsService.queryGoodsSellDtos(goodsSellDto.getComplementGoodsIdList())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             goodsSellDto.setGoodsPrice(map.get(goodsSellDto.getGoodsId())); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -175,7 +175,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             amount = amount.add(goodsSellDto.getTotalGoodsPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         amount = amount.subtract(studentGoodsSell.getMarketAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(amount.signum() < 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (amount.signum() < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("操作失败:订单金额异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentGoodsSell.setOrganId(student.getOrganId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -257,13 +257,13 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentGoodsSell studentGoodsSell = studentGoodsSellDao.get(goodsSellId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer studentId = studentGoodsSell.getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentDao.lockUser(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<GoodsSellDto> goodsSellDtos = JSONObject.parseArray(studentGoodsSell.getGoodsJson(),GoodsSellDto.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<GoodsSellDto> goodsSellDtos = JSONObject.parseArray(studentGoodsSell.getGoodsJson(), GoodsSellDto.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Integer> goodsIds = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds, Integer.class, String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, Integer.class, BigDecimal.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (GoodsSellDto goodsSellDto : goodsSellDtos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             goodsSellDto.setGoodsType(integerStringMap.get(goodsSellDto.getGoodsId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(StringUtils.isNotEmpty(goodsSellDto.getComplementGoodsIdList())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isNotEmpty(goodsSellDto.getComplementGoodsIdList())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 goodsSellDto.setGoodsSellDtos(goodsService.queryGoodsSellDtos(goodsSellDto.getComplementGoodsIdList())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             goodsSellDto.setGoodsPrice(map.get(goodsSellDto.getGoodsId())); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -276,7 +276,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             amount = amount.add(goodsSellDto.getTotalGoodsPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         amount = amount.subtract(studentGoodsSell.getMarketAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(amount.signum() < 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (amount.signum() < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("操作失败:订单金额异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String orderNo1 = studentGoodsSell.getOrderNo(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -284,16 +284,16 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentGoodsSell.setOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentPaymentOrder studentPaymentOrder = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(StringUtils.isNotEmpty(orderNo1)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNotEmpty(orderNo1)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(orderNo1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(studentPaymentOrder != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (studentPaymentOrder != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw new BizException("该订单已支付"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //关闭老订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(studentPaymentOrder.getBalancePaymentAmount() != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (studentPaymentOrder.getBalancePaymentAmount() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     studentGoodsSell.setIsUseBalancePayment(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     studentGoodsSell.setIsUseBalancePayment(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentPaymentOrder.setStatus(DealStatusEnum.CLOSE); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -726,7 +726,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PageInfo<BasicUserDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         MapUtil.populateMap(params, queryInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        params.put("teacherId",sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        params.put("teacherId", sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<BasicUserDto> dataList = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int count = studentRepairDao.countEduStudents(params); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -742,7 +742,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return pageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void saveSellOrder(String orderNo){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void saveSellOrder(String orderNo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StudentGoodsSell studentGoodsSell = studentGoodsSellDao.findByOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String goodsJson = studentGoodsSell.getGoodsJson(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -750,13 +750,13 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //用户选择的商品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<Integer, List<GoodsSellDto>> collect = goodsSellDtos.stream().collect(Collectors.groupingBy(GoodsSellDto::getGoodsId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Integer> goodsIds = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        goodsSellDtos.forEach(e->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        goodsSellDtos.forEach(e -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (int i = 0; i < e.getGoodsNum(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 goodsIds.add(e.getGoodsId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AccountType accountType = AccountType.INTERNAL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(StringUtils.isNotEmpty(orderByOrderNo.getPaymentChannel())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNotEmpty(orderByOrderNo.getPaymentChannel())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(orderByOrderNo.getPaymentChannel()), orderByOrderNo.getMerNos()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //实际扣减的库存商品 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -771,11 +771,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //包含减免余额的总金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal totalAmount = goodsSellDtos.stream().map(e -> e.getTotalGoodsPrice()).reduce(BigDecimal.ZERO, BigDecimal::add); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //组合商品减免金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Integer,BigDecimal> parentGoodsCutTotalPriceMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Integer, BigDecimal> parentGoodsCutTotalPriceMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //组合商品附加金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Integer,BigDecimal> parentGoodsAddTotalPriceMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Integer, BigDecimal> parentGoodsAddTotalPriceMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //组合商品实际总价 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Integer,BigDecimal> parentGoodsTotalPriceMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Integer, BigDecimal> parentGoodsTotalPriceMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //应付总额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal totalActual = totalAmount.subtract(marketAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //可用应付 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -804,16 +804,17 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (GoodsSellDto sellDto : goodsSellDto.getGoodsSellDtos()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 totalGoodsPrice = totalGoodsPrice.add(sellDto.getTotalGoodsPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            parentGoodsTotalPriceMap.put(sellOrder.getParentGoodsId(),totalGoodsPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            parentGoodsTotalPriceMap.put(sellOrder.getParentGoodsId(), totalGoodsPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //如果组合价大于预计总价 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (parentTotalGoodsPrice.compareTo(totalGoodsPrice) == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                parentGoodsAddTotalPriceMap.put(sellOrder.getParentGoodsId(),parentTotalGoodsPrice.subtract(totalGoodsPrice)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else if(parentTotalGoodsPrice.compareTo(totalGoodsPrice) == -1){//小于 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                parentGoodsCutTotalPriceMap.put(sellOrder.getParentGoodsId(),totalGoodsPrice.subtract(parentTotalGoodsPrice)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (parentTotalGoodsPrice.compareTo(totalGoodsPrice) == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentGoodsAddTotalPriceMap.put(sellOrder.getParentGoodsId(), parentTotalGoodsPrice.subtract(totalGoodsPrice)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (parentTotalGoodsPrice.compareTo(totalGoodsPrice) == -1) {//小于 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentGoodsCutTotalPriceMap.put(sellOrder.getParentGoodsId(), totalGoodsPrice.subtract(parentTotalGoodsPrice)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //分配组合商品的中单个商品的价格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        noFreeAmount:for (Integer parentGoodsId : orderListMap.keySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        noFreeAmount: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (Integer parentGoodsId : orderListMap.keySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal addTotalPrice = parentGoodsAddTotalPriceMap.get(parentGoodsId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             usableParentGoodsAddTotalPrice = addTotalPrice; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -834,29 +835,29 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //获取比例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 BigDecimal ratioAmount = sellDto.getTotalGoodsPrice().divide(divide, 6, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(addTotalPrice != null && addTotalPrice.doubleValue() > 0l){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (addTotalPrice != null && addTotalPrice.doubleValue() > 0l) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //如果是最后一件商品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if(i == integers.size() - 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (i == integers.size() - 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         sellDto.setTotalGoodsPrice(sellDto.getTotalGoodsPrice().add(usableParentGoodsAddTotalPrice)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         //获取分配的附加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        BigDecimal multiply = ratioAmount.multiply(addTotalPrice).setScale(2,BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigDecimal multiply = ratioAmount.multiply(addTotalPrice).setScale(2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         sellDto.setTotalGoodsPrice(sellDto.getTotalGoodsPrice().add(multiply)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         usableParentGoodsAddTotalPrice = usableParentGoodsAddTotalPrice.subtract(multiply); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     sellDto.setGoodsPrice(sellDto.getTotalGoodsPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else if(cutTotalPrice != null && cutTotalPrice.doubleValue() > 0l){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else if (cutTotalPrice != null && cutTotalPrice.doubleValue() > 0l) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //如果是最后一件商品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if(i == integers.size() - 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (i == integers.size() - 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         sellDto.setTotalGoodsPrice(sellDto.getTotalGoodsPrice().subtract(usableParentGoodsCutTotalPrice)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         //获取分配的组合减免金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        BigDecimal multiply = ratioAmount.multiply(cutTotalPrice).setScale(2,BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigDecimal multiply = ratioAmount.multiply(cutTotalPrice).setScale(2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         sellDto.setTotalGoodsPrice(sellDto.getTotalGoodsPrice().subtract(multiply)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         usableParentGoodsCutTotalPrice = usableParentGoodsCutTotalPrice.subtract(multiply); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     sellDto.setGoodsPrice(sellDto.getTotalGoodsPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     continue noFreeAmount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -864,14 +865,14 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (int i = 0; i < sellOrderList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             SellOrder sellOrder = sellOrderList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer e = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(sellOrder.getParentGoodsId() != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (sellOrder.getParentGoodsId() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 e = sellOrder.getParentGoodsId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 e = sellOrder.getGoodsId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             GoodsSellDto goodsSellDto = collect.get(e).get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<GoodsSellDto> sellDtos = goodsSellDto.getGoodsSellDtos(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(sellDtos != null && sellDtos.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (sellDtos != null && sellDtos.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Map<Integer, List<GoodsSellDto>> map = sellDtos.stream().collect(Collectors.groupingBy(GoodsSellDto::getGoodsId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 goodsSellDto = map.get(sellOrder.getGoodsId()).get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -888,32 +889,32 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //获取比例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal ratioAmount = multiply2.divide(totalAmount, 6, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //如果有减免金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(marketAmount.doubleValue() > 0l){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (marketAmount.doubleValue() > 0l) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //如果是最后一件商品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(i == sellOrderList.size() - 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (i == sellOrderList.size() - 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     goodsSellDto.setTotalGoodsPrice(multiply2.subtract(usableMarketAmount)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //获取分配的减免金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    BigDecimal multiply = ratioAmount.multiply(marketAmount).setScale(2,BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal multiply = ratioAmount.multiply(marketAmount).setScale(2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     goodsSellDto.setTotalGoodsPrice(multiply2.subtract(multiply)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     usableMarketAmount = usableMarketAmount.subtract(multiply); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //如果没有使用余额,那么实际金额和预计金额一致 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(balancePaymentAmount.doubleValue() == 0l){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (balancePaymentAmount.doubleValue() == 0l) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 sellOrder.setActualAmount(goodsSellDto.getTotalGoodsPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 sellOrder.setBalanceAmount(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //如果是最后一件商品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(i == sellOrderList.size() - 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (i == sellOrderList.size() - 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     sellOrder.setActualAmount(usableAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     sellOrder.setBalanceAmount(usableBalance); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //获取分配的余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    BigDecimal multiply = ratioAmount.multiply(balancePaymentAmount).setScale(2,BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal multiply = ratioAmount.multiply(balancePaymentAmount).setScale(2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //分配的实际支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    BigDecimal multiply1 = ratioAmount.multiply(realityAmount).setScale(2,BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal multiply1 = ratioAmount.multiply(realityAmount).setScale(2, BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     sellOrder.setActualAmount(multiply1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     sellOrder.setBalanceAmount(multiply); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     usableAmount = usableAmount.subtract(multiply1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -923,9 +924,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sellOrder.setExpectAmount(sellOrder.getActualAmount().add(sellOrder.getBalanceAmount())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //            sellOrder.setSellCost2(JSONObject.toJSONString(costMap)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(SellTypeEnum.ACCESSORIES.getCode().equals(goodsSellDto.getGoodsType())||SellTypeEnum.INSTRUMENT.getCode().equals(goodsSellDto.getGoodsType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (SellTypeEnum.ACCESSORIES.getCode().equals(goodsSellDto.getGoodsType()) || SellTypeEnum.INSTRUMENT.getCode().equals(goodsSellDto.getGoodsType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 sellOrder.setType(SellTypeEnum.valueOf(goodsSellDto.getGoodsType())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 sellOrder.setType(SellTypeEnum.OTHER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sellOrder.setGoodsId(sellOrder.getGoodsId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -937,7 +938,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sellOrder.setEduTeacherId(studentGoodsSell.getTeacherId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sellOrder.setCooperationOrganId(studentGoodsSell.getCooperationOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(sellOrderList.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (sellOrderList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             sellOrderService.batchInsert(sellOrderList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |