Ver Fonte

增加查询老师分部下所有学生功能-未完成

hgw há 3 anos atrás
pai
commit
7eb424f7aa

+ 26 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRepairService.java

@@ -20,22 +20,33 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
     PageInfo<BasicUserDto> getStudents(RepairStudentQueryInfo queryInfo);
 
     /**
+     * 查询老师主分部下所有学生
+     *
+     * @param param 参数
+     *              <p>  search 模糊搜索
+     */
+    PageInfo<BasicUserDto> getStudentsByTeacherOrgan(Map<String, Object> param);
+
+    /**
      * 添加维修单
+     *
      * @param repairInfo
      * @return
      */
-   Map addRepair(StudentRepair repairInfo) throws Exception;
+    Map addRepair(StudentRepair repairInfo) throws Exception;
 
 
     /**
      * 维修完成
+     *
      * @param id
      * @param description
      */
-    void repairSuccess(Integer id, String description,Integer repairStatus);
+    void repairSuccess(Integer id, String description, Integer repairStatus);
 
     /**
      * 获取学生信息
+     *
      * @param studentId
      * @return
      */
@@ -43,6 +54,7 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
 
     /**
      * 获取维修单详情
+     *
      * @param id
      * @return
      */
@@ -50,6 +62,7 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
 
     /**
      * 支付维修单
+     *
      * @param repairInfo
      * @return
      */
@@ -57,58 +70,60 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
 
     /**
      * 获取学生维修技师信息
+     *
      * @param studentId
      * @return
      */
-    BasicUserDto getStudentRepairer(Integer studentId,Integer organId);
+    BasicUserDto getStudentRepairer(Integer studentId, Integer organId);
 
     /**
      * 支付回调
+     *
      * @param order
      */
     Boolean orderCallback(StudentPaymentOrder order);
 
     /**
+     * @param studentGoodsSell:
+     * @return java.util.Map
      * @describe 添加商品销售订单
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/9/16
      * @time 13:47
-     * @param studentGoodsSell:
-     * @return java.util.Map
      */
     Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception;
 
     /**
+     * @param goodsSellId:
+     * @return java.util.Map
      * @describe 学员扫码支付
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/9/16
      * @time 13:47
-     * @param goodsSellId:
-     * @return java.util.Map
      */
     Map studentPaymentGoodsOrder(Integer goodsSellId) throws Exception;
 
     /**
+     * @param order:
+     * @return void
      * @describe 商品销售订单回调
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/9/16
      * @time 16:58
-     * @param order:
-     * @return void
      */
     void goodsSellOrderCallback(StudentPaymentOrder order);
 
     /**
+     * @param queryInfo:
+     * @return java.lang.Object
      * @describe 获取商品购买教务老师关联的学员列表
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/9/28
      * @time 11:27
-     * @param queryInfo:
-     * @return java.lang.Object
      */
     PageInfo<BasicUserDto> queryEduStudents(QueryInfo queryInfo);
 }

+ 346 - 357
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -8,17 +8,12 @@ import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
 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 org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -43,17 +38,6 @@ import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.GoodsSellDto;
 import com.ym.mec.biz.dal.dto.RepairGoodsDto;
-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.SellOrder;
-import com.ym.mec.biz.dal.entity.StudentGoodsSell;
-import com.ym.mec.biz.dal.entity.StudentInstrument;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentRepair;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
 import com.ym.mec.biz.dal.enums.AccountType;
 import com.ym.mec.biz.dal.enums.CouponDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
@@ -67,22 +51,6 @@ import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.SellTypeEnum;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
-import com.ym.mec.biz.service.ContractService;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.PayService;
-import com.ym.mec.biz.service.SellOrderService;
-import com.ym.mec.biz.service.StudentGoodsSellService;
-import com.ym.mec.biz.service.StudentInstrumentService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
-import com.ym.mec.biz.service.StudentRepairService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysCouponCodeService;
-import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.biz.service.SysPaymentConfigService;
-import com.ym.mec.biz.service.SysUserCashAccountDetailService;
-import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -139,6 +107,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     private StudentGoodsSellService studentGoodsSellService;
     @Autowired
     private SysCouponCodeService sysCouponCodeService;
+    @Autowired
+    private TeacherService teacherService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -174,6 +144,25 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         return pageInfo;
     }
 
+    /**
+     * 查询老师主分部下所有学生
+     *
+     * @param param 参数
+     *              <p>  search 模糊搜索
+     */
+    @Override
+    public PageInfo<BasicUserDto> getStudentsByTeacherOrgan(Map<String, Object> param) {
+        SysUser sysUser = getSysUser();
+        Teacher teacher = teacherService.get(sysUser.getId());
+        return null;
+    }
+
+    private SysUser getSysUser() {
+        //修改机构基础信息
+        return Optional.ofNullable(sysUserFeignService.queryUserInfo())
+                .orElseThrow(() -> new BizException("用户不存在."));
+    }
+
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
@@ -207,52 +196,52 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 }
                 //退优惠券
                 sysCouponCodeService.quit(orderByOrderNo.getCouponCodeId());
-                
+
                 Date nowDate = new Date();
                 //增加商品库存
                 List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(orderByOrderNo.getId());
                 String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
-                if(StringUtils.isNotBlank(goodsIds)){
-                	GoodsProcurement goodsProcurement = null;
-                	List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
-                	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
-                	Goods goods = null;
-        			Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
-        			Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
-                	
-                	for(String goodsIdStr : goodsIds.split(",")){
-                		if(StringUtils.isBlank(goodsIdStr)){
-							continue;
-						}
-						goods = goodsMap.get(Integer.parseInt(goodsIdStr));
-						if(batchUpdateGoodsMap.get(goods.getId()) != null){
-							goods = batchUpdateGoodsMap.get(goods.getId());
-						}
-						goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
-						goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
-						goods.setUpdateTime(nowDate);
-    					
-						batchUpdateGoodsMap.put(goods.getId(), goods);
-    					
-    					// 进货清单
-    					goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
-    					if(goodsProcurement != null){
-							if(goodsProcurementMap.get(goodsProcurement.getId()) != null){
-								goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
-							}
-    						goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
-    						goodsProcurement.setUpdateTime(nowDate);
-							goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
-    					}
-						
-                	}
-                	
-                	if(goodsProcurementMap.size() > 0){
-                		goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
-                	}
-                    
-                    if(batchUpdateGoodsMap.size() > 0){
-                    	goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
+                if (StringUtils.isNotBlank(goodsIds)) {
+                    GoodsProcurement goodsProcurement = null;
+                    List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
+                    Map<Integer, Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, t -> t));
+                    Goods goods = null;
+                    Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
+                    Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
+
+                    for (String goodsIdStr : goodsIds.split(",")) {
+                        if (StringUtils.isBlank(goodsIdStr)) {
+                            continue;
+                        }
+                        goods = goodsMap.get(Integer.parseInt(goodsIdStr));
+                        if (batchUpdateGoodsMap.get(goods.getId()) != null) {
+                            goods = batchUpdateGoodsMap.get(goods.getId());
+                        }
+                        goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
+                        goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
+                        goods.setUpdateTime(nowDate);
+
+                        batchUpdateGoodsMap.put(goods.getId(), goods);
+
+                        // 进货清单
+                        goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
+                        if (goodsProcurement != null) {
+                            if (goodsProcurementMap.get(goodsProcurement.getId()) != null) {
+                                goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
+                            }
+                            goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
+                            goodsProcurement.setUpdateTime(nowDate);
+                            goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
+                        }
+
+                    }
+
+                    if (goodsProcurementMap.size() > 0) {
+                        goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
+                    }
+
+                    if (batchUpdateGoodsMap.size() > 0) {
+                        goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                     }
                 }
             }
@@ -293,9 +282,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             }
         }
         List<Integer> goodsIds = goodsSellDtos.stream().map(GoodsSellDto::getGoodsId).collect(Collectors.toList());
-        Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds,student.getTenantId(), Integer.class, String.class);
-        Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds,student.getTenantId(), Integer.class, BigDecimal.class);
-        Map<Integer, BigDecimal> groupPriceMap = getMap("goods", "id_", "group_purchase_price_", goodsIds,student.getTenantId(), Integer.class, BigDecimal.class);
+        Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds, student.getTenantId(), Integer.class, String.class);
+        Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, student.getTenantId(), Integer.class, BigDecimal.class);
+        Map<Integer, BigDecimal> groupPriceMap = getMap("goods", "id_", "group_purchase_price_", goodsIds, student.getTenantId(), Integer.class, BigDecimal.class);
         for (GoodsSellDto goodsSellDto : goodsSellDtos) {
             goodsSellDto.setGoodsType(integerStringMap.get(goodsSellDto.getGoodsId()));
             if (StringUtils.isNotEmpty(goodsSellDto.getComplementGoodsIdList())) {
@@ -358,7 +347,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrder.setRoutingOrganId(student.getOrganId());
         studentPaymentOrder.setTenantId(student.getTenantId());
         studentPaymentOrderService.insert(studentPaymentOrder);
-        
+
         Date date = new Date();
         //添加订单详情
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<StudentPaymentOrderDetail>();
@@ -366,69 +355,69 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         StudentPaymentOrderDetail studentPaymentOrderDetail = null;
 
         BigDecimal totalPrice = BigDecimal.ZERO;
-        
-        if(goodsSellDtos != null){
-        	//String goodsIdsStr = goodsSellDtos.stream().map(t -> t.getGoodsId().toString()).collect(Collectors.joining(","));
-        	
-        	StringBuffer sb = new StringBuffer();
-        	for(GoodsSellDto goodsSellDto : goodsSellDtos){
-        		for(int i = 0; i < goodsSellDto.getGoodsNum() ; i++){
-        			sb.append(goodsSellDto.getGoodsId()).append(",");
-        		}
-        	}
-        	
-        	String goodsIdsStr = StringUtils.removeEnd(sb.toString(), ",");
-        	
-        	List<Goods> goodsList = goodsService.findGoodsByIds(goodsIdsStr);
-        	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
-        	BigDecimal totalGroupPurchasePrice = BigDecimal.ZERO;
-        	
-        	for(String goodsIdStr : goodsIdsStr.split(",")){
-        		totalGroupPurchasePrice = totalGroupPurchasePrice.add(goodsMap.get(Integer.parseInt(goodsIdStr)).getGroupPurchasePrice());
-        	}
-        	
-        	Goods goods = null;
-        	for(String goodsIdStr : goodsIdsStr.split(",")){
-        		if(StringUtils.isBlank(goodsIdStr)){
-					continue;
-				}
-				goods = goodsMap.get(Integer.parseInt(goodsIdStr));
-				
-				if(goods != null){
-					studentPaymentOrderDetail = new StudentPaymentOrderDetail();
-	                studentPaymentOrderDetail.setCreateTime(date);
-	                if(goods.getType() == GoodsType.INSTRUMENT){
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
-	                }else if(goods.getType() == GoodsType.ACCESSORIES){
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
-	                }else if(goods.getType() == GoodsType.TEACHING || goods.getType() == GoodsType.STAFF){
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
-	                }else{
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
-	                }
-	                studentPaymentOrderDetail.setGoodsIdList(goodsIdStr);
-	                
-	                BigDecimal tempPrice = BigDecimal.ZERO;
-	                if(totalGroupPurchasePrice.compareTo(BigDecimal.ZERO) > 0) {
-	                	tempPrice = studentPaymentOrder.getExpectAmount().multiply(goods.getGroupPurchasePrice()).divide(totalGroupPurchasePrice, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_DOWN);
-	                }
-	                
-	                if(totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0 || goodsIdsStr.split(",").length == studentPaymentOrderDetailList.size() + 1){
-	                	studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
-	                }else{
-	                	studentPaymentOrderDetail.setPrice(tempPrice);
-	                }
-	                studentPaymentOrderDetail.setUpdateTime(date);
-	                studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
-	                
-	                totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
-	                studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
-				}
-        	}
-        }
-        
-        if(studentPaymentOrderDetailList.size() > 0){
-        	studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
+
+        if (goodsSellDtos != null) {
+            //String goodsIdsStr = goodsSellDtos.stream().map(t -> t.getGoodsId().toString()).collect(Collectors.joining(","));
+
+            StringBuffer sb = new StringBuffer();
+            for (GoodsSellDto goodsSellDto : goodsSellDtos) {
+                for (int i = 0; i < goodsSellDto.getGoodsNum(); i++) {
+                    sb.append(goodsSellDto.getGoodsId()).append(",");
+                }
+            }
+
+            String goodsIdsStr = StringUtils.removeEnd(sb.toString(), ",");
+
+            List<Goods> goodsList = goodsService.findGoodsByIds(goodsIdsStr);
+            Map<Integer, Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, t -> t));
+            BigDecimal totalGroupPurchasePrice = BigDecimal.ZERO;
+
+            for (String goodsIdStr : goodsIdsStr.split(",")) {
+                totalGroupPurchasePrice = totalGroupPurchasePrice.add(goodsMap.get(Integer.parseInt(goodsIdStr)).getGroupPurchasePrice());
+            }
+
+            Goods goods = null;
+            for (String goodsIdStr : goodsIdsStr.split(",")) {
+                if (StringUtils.isBlank(goodsIdStr)) {
+                    continue;
+                }
+                goods = goodsMap.get(Integer.parseInt(goodsIdStr));
+
+                if (goods != null) {
+                    studentPaymentOrderDetail = new StudentPaymentOrderDetail();
+                    studentPaymentOrderDetail.setCreateTime(date);
+                    if (goods.getType() == GoodsType.INSTRUMENT) {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
+                    } else if (goods.getType() == GoodsType.ACCESSORIES) {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
+                    } else if (goods.getType() == GoodsType.TEACHING || goods.getType() == GoodsType.STAFF) {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
+                    } else {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
+                    }
+                    studentPaymentOrderDetail.setGoodsIdList(goodsIdStr);
+
+                    BigDecimal tempPrice = BigDecimal.ZERO;
+                    if (totalGroupPurchasePrice.compareTo(BigDecimal.ZERO) > 0) {
+                        tempPrice = studentPaymentOrder.getExpectAmount().multiply(goods.getGroupPurchasePrice()).divide(totalGroupPurchasePrice, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_DOWN);
+                    }
+
+                    if (totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0 || goodsIdsStr.split(",").length == studentPaymentOrderDetailList.size() + 1) {
+                        studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
+                    } else {
+                        studentPaymentOrderDetail.setPrice(tempPrice);
+                    }
+                    studentPaymentOrderDetail.setUpdateTime(date);
+                    studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+
+                    totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
+                    studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
+                }
+            }
+        }
+
+        if (studentPaymentOrderDetailList.size() > 0) {
+            studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
         }
 
         studentPaymentOrder.setVersion(0);
@@ -487,8 +476,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentDao.lockUser(studentId);
         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,studentGoodsSell.getTenantId(), Integer.class, String.class);
-        Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds,studentGoodsSell.getTenantId(), Integer.class, BigDecimal.class);
+        Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds, studentGoodsSell.getTenantId(), Integer.class, String.class);
+        Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, studentGoodsSell.getTenantId(), Integer.class, BigDecimal.class);
         for (GoodsSellDto goodsSellDto : goodsSellDtos) {
             goodsSellDto.setGoodsType(integerStringMap.get(goodsSellDto.getGoodsId()));
             if (StringUtils.isNotEmpty(goodsSellDto.getComplementGoodsIdList())) {
@@ -633,14 +622,14 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         repairInfo.setPayStatus(0);
         repairInfo.setCreateTime(date);
         repairInfo.setUpdateTime(date);
-        
+
         List<RepairGoodsDto> repairGoodsDtos = null;
-        		
+
         String goodsJson = repairInfo.getGoodsJson();
         if (StringUtils.isNotEmpty(goodsJson)) {
             repairGoodsDtos = JSONObject.parseArray(goodsJson, RepairGoodsDto.class);
             List<Integer> goodsIds = repairGoodsDtos.stream().map(e -> e.getId()).collect(Collectors.toList());
-            Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds,student.getTenantId(), Integer.class, BigDecimal.class);
+            Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, student.getTenantId(), Integer.class, BigDecimal.class);
             repairGoodsDtos.forEach(e -> {
                 e.setGroupPurchasePrice(map.get(e.getId()));
             });
@@ -692,8 +681,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
         studentPaymentOrderService.insert(studentPaymentOrder);
         studentPaymentOrder.setVersion(0);
-  
-        
+
+
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<StudentPaymentOrderDetail>();
         // 添加studentPaymentOrderDetail
         StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
@@ -703,69 +692,69 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().multiply(repairInfo.getAmount()).divide(goodsPrice.add(repairInfo.getAmount()), RoundingMode.UP));
         studentPaymentOrderDetail.setUpdateTime(date);
         studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
-        
+
         studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
 
         BigDecimal totalPrice = studentPaymentOrderDetail.getPrice();
         BigDecimal repairPrice = studentPaymentOrderDetail.getPrice();
-        
-        if(StringUtils.isNotBlank(repairInfo.getGoodsJson()) && repairGoodsDtos != null){
-        	String goodsIds = repairGoodsDtos.stream().map(t -> t.getId().toString()).collect(Collectors.joining(","));
-        	List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
-        	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
-        	Goods goods = null;
-        	BigDecimal totalGroupPurchasePrice = BigDecimal.ZERO;
-        	for(String goodsIdStr : goodsIds.split(",")){
-        		if(StringUtils.isBlank(goodsIdStr)){
-					continue;
-				}
-				goods = goodsMap.get(Integer.parseInt(goodsIdStr));
-				
-				if(goods != null){
-					totalGroupPurchasePrice = totalGroupPurchasePrice.add(goods.getGroupPurchasePrice());
-				}
-        	}
-        	for(String goodsIdStr : goodsIds.split(",")){
-        		if(StringUtils.isBlank(goodsIdStr)){
-					continue;
-				}
-				goods = goodsMap.get(Integer.parseInt(goodsIdStr));
-				
-				if(goods != null){
-					studentPaymentOrderDetail = new StudentPaymentOrderDetail();
-	                studentPaymentOrderDetail.setCreateTime(date);
-	                if(goods.getType() == GoodsType.INSTRUMENT){
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
-	                }else if(goods.getType() == GoodsType.ACCESSORIES){
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
-	                }else if(goods.getType() == GoodsType.TEACHING || goods.getType() == GoodsType.STAFF){
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
-	                }else{
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
-	                }
-	                studentPaymentOrderDetail.setGoodsIdList(goodsIdStr);
-	                
-	                BigDecimal tempPrice = BigDecimal.ZERO;
-	                if(totalGroupPurchasePrice.compareTo(BigDecimal.ZERO) > 0) {
-	                	tempPrice = studentPaymentOrder.getExpectAmount().subtract(repairPrice).multiply(goods.getGroupPurchasePrice()).divide(totalGroupPurchasePrice, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_DOWN);
-	                }
-	                
-	                if(totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0 || goodsIds.split(",").length == studentPaymentOrderDetailList.size()){
-	                	studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
-	                }else{
-	                	studentPaymentOrderDetail.setPrice(tempPrice);
-	                }
-	                studentPaymentOrderDetail.setUpdateTime(date);
-	                studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
-	                
-	                totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
-	                studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
-				}
-        	}
-        }
-        
-        if(studentPaymentOrderDetailList.size() > 0){
-        	studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
+
+        if (StringUtils.isNotBlank(repairInfo.getGoodsJson()) && repairGoodsDtos != null) {
+            String goodsIds = repairGoodsDtos.stream().map(t -> t.getId().toString()).collect(Collectors.joining(","));
+            List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
+            Map<Integer, Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, t -> t));
+            Goods goods = null;
+            BigDecimal totalGroupPurchasePrice = BigDecimal.ZERO;
+            for (String goodsIdStr : goodsIds.split(",")) {
+                if (StringUtils.isBlank(goodsIdStr)) {
+                    continue;
+                }
+                goods = goodsMap.get(Integer.parseInt(goodsIdStr));
+
+                if (goods != null) {
+                    totalGroupPurchasePrice = totalGroupPurchasePrice.add(goods.getGroupPurchasePrice());
+                }
+            }
+            for (String goodsIdStr : goodsIds.split(",")) {
+                if (StringUtils.isBlank(goodsIdStr)) {
+                    continue;
+                }
+                goods = goodsMap.get(Integer.parseInt(goodsIdStr));
+
+                if (goods != null) {
+                    studentPaymentOrderDetail = new StudentPaymentOrderDetail();
+                    studentPaymentOrderDetail.setCreateTime(date);
+                    if (goods.getType() == GoodsType.INSTRUMENT) {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
+                    } else if (goods.getType() == GoodsType.ACCESSORIES) {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
+                    } else if (goods.getType() == GoodsType.TEACHING || goods.getType() == GoodsType.STAFF) {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
+                    } else {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
+                    }
+                    studentPaymentOrderDetail.setGoodsIdList(goodsIdStr);
+
+                    BigDecimal tempPrice = BigDecimal.ZERO;
+                    if (totalGroupPurchasePrice.compareTo(BigDecimal.ZERO) > 0) {
+                        tempPrice = studentPaymentOrder.getExpectAmount().subtract(repairPrice).multiply(goods.getGroupPurchasePrice()).divide(totalGroupPurchasePrice, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_DOWN);
+                    }
+
+                    if (totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0 || goodsIds.split(",").length == studentPaymentOrderDetailList.size()) {
+                        studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
+                    } else {
+                        studentPaymentOrderDetail.setPrice(tempPrice);
+                    }
+                    studentPaymentOrderDetail.setUpdateTime(date);
+                    studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+
+                    totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
+                    studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
+                }
+            }
+        }
+
+        if (studentPaymentOrderDetailList.size() > 0) {
+            studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
         }
 
         BigDecimal balance = BigDecimal.ZERO;
@@ -887,7 +876,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         ) {
             throw new BizException("邮寄信息必填");
         }
-        
+
         List<RepairGoodsDto> repairGoodsDtos = null;
         Date date = new Date();
         StudentRepair studentRepair = studentRepairDao.get(repairInfo.getId());
@@ -908,7 +897,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 JSONObject goodObject = (JSONObject) good;
                 BigDecimal groupPurchasePrice = goodObject.getBigDecimal("groupPurchasePrice");
                 if (Objects.nonNull(groupPurchasePrice)) {
-                	goodsPrice = goodsPrice.add(groupPurchasePrice);
+                    goodsPrice = goodsPrice.add(groupPurchasePrice);
                 }
             }
         }
@@ -945,7 +934,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
         studentPaymentOrderService.insert(studentPaymentOrder);
         studentPaymentOrder.setVersion(0);
-        
+
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<StudentPaymentOrderDetail>();
         // 添加studentPaymentOrderDetail
         StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
@@ -955,66 +944,66 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().multiply(studentRepair.getAmount()).divide(goodsPrice.add(studentRepair.getAmount()), RoundingMode.UP));
         studentPaymentOrderDetail.setUpdateTime(date);
         studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
-        
+
         studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
 
         BigDecimal totalPrice = studentPaymentOrderDetail.getPrice();
         BigDecimal repairPrice = studentPaymentOrderDetail.getPrice();
-        
-        if(StringUtils.isNotBlank(studentRepair.getGoodsJson()) && repairGoodsDtos != null){
-        	String goodsIds = repairGoodsDtos.stream().map(t -> t.getId().toString()).collect(Collectors.joining(","));
-        	List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
-        	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
-        	Goods goods = null;
-        	BigDecimal totalGroupPurchasePrice = BigDecimal.ZERO;
-        	for(String goodsIdStr : goodsIds.split(",")){
-        		if(StringUtils.isBlank(goodsIdStr)){
-					continue;
-				}
-				goods = goodsMap.get(Integer.parseInt(goodsIdStr));
-				
-				if(goods != null){
-					totalGroupPurchasePrice = totalGroupPurchasePrice.add(goods.getGroupPurchasePrice());
-				}
-        	}
-        	for(String goodsIdStr : goodsIds.split(",")){
-        		if(StringUtils.isBlank(goodsIdStr)){
-					continue;
-				}
-				goods = goodsMap.get(Integer.parseInt(goodsIdStr));
-				
-				if(goods != null){
-					studentPaymentOrderDetail = new StudentPaymentOrderDetail();
-	                studentPaymentOrderDetail.setCreateTime(date);
-	                if(goods.getType() == GoodsType.INSTRUMENT){
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
-	                }else if(goods.getType() == GoodsType.ACCESSORIES){
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
-	                }else if(goods.getType() == GoodsType.TEACHING || goods.getType() == GoodsType.STAFF){
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
-	                }else{
-	                	studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
-	                }
-	                studentPaymentOrderDetail.setGoodsIdList(goodsIdStr);
-	                
-	                BigDecimal tempPrice = studentPaymentOrder.getExpectAmount().subtract(repairPrice).multiply(goods.getGroupPurchasePrice()).divide(totalGroupPurchasePrice, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_DOWN);
-	                
-	                if(totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0 || goodsIds.split(",").length == studentPaymentOrderDetailList.size()){
-	                	studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
-	                }else{
-	                	studentPaymentOrderDetail.setPrice(tempPrice);
-	                }
-	                studentPaymentOrderDetail.setUpdateTime(date);
-	                studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
-	                
-	                totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
-	                studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
-				}
-        	}
-        }
-        
-        if(studentPaymentOrderDetailList.size() > 0){
-        	studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
+
+        if (StringUtils.isNotBlank(studentRepair.getGoodsJson()) && repairGoodsDtos != null) {
+            String goodsIds = repairGoodsDtos.stream().map(t -> t.getId().toString()).collect(Collectors.joining(","));
+            List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
+            Map<Integer, Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, t -> t));
+            Goods goods = null;
+            BigDecimal totalGroupPurchasePrice = BigDecimal.ZERO;
+            for (String goodsIdStr : goodsIds.split(",")) {
+                if (StringUtils.isBlank(goodsIdStr)) {
+                    continue;
+                }
+                goods = goodsMap.get(Integer.parseInt(goodsIdStr));
+
+                if (goods != null) {
+                    totalGroupPurchasePrice = totalGroupPurchasePrice.add(goods.getGroupPurchasePrice());
+                }
+            }
+            for (String goodsIdStr : goodsIds.split(",")) {
+                if (StringUtils.isBlank(goodsIdStr)) {
+                    continue;
+                }
+                goods = goodsMap.get(Integer.parseInt(goodsIdStr));
+
+                if (goods != null) {
+                    studentPaymentOrderDetail = new StudentPaymentOrderDetail();
+                    studentPaymentOrderDetail.setCreateTime(date);
+                    if (goods.getType() == GoodsType.INSTRUMENT) {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
+                    } else if (goods.getType() == GoodsType.ACCESSORIES) {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
+                    } else if (goods.getType() == GoodsType.TEACHING || goods.getType() == GoodsType.STAFF) {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
+                    } else {
+                        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
+                    }
+                    studentPaymentOrderDetail.setGoodsIdList(goodsIdStr);
+
+                    BigDecimal tempPrice = studentPaymentOrder.getExpectAmount().subtract(repairPrice).multiply(goods.getGroupPurchasePrice()).divide(totalGroupPurchasePrice, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_DOWN);
+
+                    if (totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0 || goodsIds.split(",").length == studentPaymentOrderDetailList.size()) {
+                        studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
+                    } else {
+                        studentPaymentOrderDetail.setPrice(tempPrice);
+                    }
+                    studentPaymentOrderDetail.setUpdateTime(date);
+                    studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+
+                    totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
+                    studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
+                }
+            }
+        }
+
+        if (studentPaymentOrderDetailList.size() > 0) {
+            studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
         }
 
         BigDecimal balance = BigDecimal.ZERO;
@@ -1137,55 +1126,55 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             //购买的商品加入销售列表
             saveSellOrder(studentPaymentOrder.getOrderNo());
         } else if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
-            
-        	//增加商品库存
+
+            //增加商品库存
             List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
             String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
-            if(StringUtils.isNotBlank(goodsIds)){
-            	GoodsProcurement goodsProcurement = null;
-            	List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
-            	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
-            	Goods goods = null;
-    			Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
-    			Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
-            	
-            	for(String goodsIdStr : goodsIds.split(",")){
-            		if(StringUtils.isBlank(goodsIdStr)){
-						continue;
-					}
-					goods = goodsMap.get(Integer.parseInt(goodsIdStr));
-					if(batchUpdateGoodsMap.get(goods.getId()) != null){
-						goods = batchUpdateGoodsMap.get(goods.getId());
-					}
-					goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
-					goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
-					goods.setUpdateTime(nowDate);
-					
-					batchUpdateGoodsMap.put(goods.getId(), goods);
-					
-					// 进货清单
-					goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
-					if(goodsProcurement != null){
-						if(goodsProcurementMap.get(goodsProcurement.getId()) != null){
-							goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
-						}
-						goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
-						goodsProcurement.setUpdateTime(nowDate);
-						goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
-					}
-					
-            	}
-            	
-            	if(goodsProcurementMap.size() > 0){
-            		goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
-            	}
-                
-                if(batchUpdateGoodsMap.size() > 0){
-                	goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
+            if (StringUtils.isNotBlank(goodsIds)) {
+                GoodsProcurement goodsProcurement = null;
+                List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
+                Map<Integer, Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, t -> t));
+                Goods goods = null;
+                Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
+                Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
+
+                for (String goodsIdStr : goodsIds.split(",")) {
+                    if (StringUtils.isBlank(goodsIdStr)) {
+                        continue;
+                    }
+                    goods = goodsMap.get(Integer.parseInt(goodsIdStr));
+                    if (batchUpdateGoodsMap.get(goods.getId()) != null) {
+                        goods = batchUpdateGoodsMap.get(goods.getId());
+                    }
+                    goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
+                    goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
+                    goods.setUpdateTime(nowDate);
+
+                    batchUpdateGoodsMap.put(goods.getId(), goods);
+
+                    // 进货清单
+                    goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
+                    if (goodsProcurement != null) {
+                        if (goodsProcurementMap.get(goodsProcurement.getId()) != null) {
+                            goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
+                        }
+                        goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
+                        goodsProcurement.setUpdateTime(nowDate);
+                        goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
+                    }
+
+                }
+
+                if (goodsProcurementMap.size() > 0) {
+                    goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
+                }
+
+                if (batchUpdateGoodsMap.size() > 0) {
+                    goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                 }
             }
-        	
-        	if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
+
+            if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
                 sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "乐器购买支付失败");
             }
             sysCouponCodeService.quit(studentPaymentOrder.getCouponCodeId());
@@ -1564,54 +1553,54 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             if (this.update(repairInfo) <= 0) {
                 throw new BizException("维修单更新失败");
             }
-            
+
             //增加商品库存
             List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
             String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
-            if(StringUtils.isNotBlank(goodsIds)){
-            	GoodsProcurement goodsProcurement = null;
-            	List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
-            	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
-            	Goods goods = null;
-    			Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
-    			Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
-            	
-            	for(String goodsIdStr : goodsIds.split(",")){
-            		if(StringUtils.isBlank(goodsIdStr)){
-						continue;
-					}
-					goods = goodsMap.get(Integer.parseInt(goodsIdStr));
-					if(batchUpdateGoodsMap.get(goods.getId()) != null){
-						goods = batchUpdateGoodsMap.get(goods.getId());
-					}
-					goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
-					goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
-					goods.setUpdateTime(nowDate);
-					
-					batchUpdateGoodsMap.put(goods.getId(), goods);
-					
-					// 进货清单
-					goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
-					if(goodsProcurement != null){
-						if(goodsProcurementMap.get(goodsProcurement.getId()) != null){
-							goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
-						}
-						goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
-						goodsProcurement.setUpdateTime(nowDate);
-						goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
-					}
-					
-            	}
-            	
-            	if(goodsProcurementMap.size() > 0){
-            		goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
-            	}
-                
-                if(batchUpdateGoodsMap.size() > 0){
-                	goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
+            if (StringUtils.isNotBlank(goodsIds)) {
+                GoodsProcurement goodsProcurement = null;
+                List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
+                Map<Integer, Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, t -> t));
+                Goods goods = null;
+                Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
+                Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
+
+                for (String goodsIdStr : goodsIds.split(",")) {
+                    if (StringUtils.isBlank(goodsIdStr)) {
+                        continue;
+                    }
+                    goods = goodsMap.get(Integer.parseInt(goodsIdStr));
+                    if (batchUpdateGoodsMap.get(goods.getId()) != null) {
+                        goods = batchUpdateGoodsMap.get(goods.getId());
+                    }
+                    goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
+                    goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
+                    goods.setUpdateTime(nowDate);
+
+                    batchUpdateGoodsMap.put(goods.getId(), goods);
+
+                    // 进货清单
+                    goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
+                    if (goodsProcurement != null) {
+                        if (goodsProcurementMap.get(goodsProcurement.getId()) != null) {
+                            goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
+                        }
+                        goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
+                        goodsProcurement.setUpdateTime(nowDate);
+                        goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
+                    }
+
+                }
+
+                if (goodsProcurementMap.size() > 0) {
+                    goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
+                }
+
+                if (batchUpdateGoodsMap.size() > 0) {
+                    goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                 }
             }
-            
+
             if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
                 sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "乐器维修支付失败");
             }

+ 4 - 14
mec-teacher/src/main/java/com/ym/mec/teacher/controller/EduRepairController.java

@@ -50,20 +50,10 @@ public class EduRepairController extends BaseController {
     @Autowired
     private StudentGoodsSellService studentGoodsSellService;
 
-    @ApiOperation("获取学生列表")
-    @GetMapping(value = "/getStudents")
-    public HttpResponseResult<PageInfo<BasicUserDto>> getStudents(RepairStudentQueryInfo queryInfo) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed(HttpStatus.FORBIDDEN, "请登录");
-        }
-        Employee employee = employeeDao.get(sysUser.getId());
-        if (Objects.isNull(employee)) {
-            return failed(HttpStatus.NOT_ACCEPTABLE, "员工信息不存在");
-        }
-        queryInfo.setEmployeeId(sysUser.getId());
-        queryInfo.setOrganIdList(employee.getOrganIdList());
-        return succeed(studentRepairService.getStudents(queryInfo));
+    @ApiOperation("获取学生列表-老师主分部下所有学生")
+    @PostMapping(value = "/getStudentsByTeacherOrgan")
+    public HttpResponseResult<PageInfo<BasicUserDto>> getStudentsByTeacherOrgan(@RequestBody Map<String, Object> param) {
+        return succeed(studentRepairService.getStudentsByTeacherOrgan(param));
     }
 
     @ApiOperation("添加商品销售订单")