Browse Source

update:订单详情

yonge 4 years ago
parent
commit
7657670478

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java

@@ -145,7 +145,7 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
      * @param orderId
      * @return
      */
-    List<StudentPaymentOrderDetail> getOrderDetailByOrderId(@Param("orderId") Long orderId);
+    List<StudentPaymentOrderDetail> getOrderDetailByOrderId(@Param("orderIdList") List<Long> orderIdList);
     
     /**
      * 查询乐团报名的乐器购买人数

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java

@@ -19,6 +19,8 @@ public class StudentPaymentOrderDetail {
 	/**  */
 	private Long id;
 	
+	private String name;
+	
 	/** 类型(乐器、辅件、教材、课程) */
 	@ApiModelProperty(value = "类型",required = true)
 	private OrderDetailTypeEnum type;
@@ -71,6 +73,14 @@ public class StudentPaymentOrderDetail {
 		return this.id;
 	}
 
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
 	public OrderDetailTypeEnum getType() {
 		return type;
 	}

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderDetailService.java

@@ -79,6 +79,14 @@ public interface StudentPaymentOrderDetailService extends BaseService<Long, Stud
      */
     List<StudentPaymentOrderDetail> getOrderDetail(Long orderId);
 
+
+    /**
+     * 获取订单详细
+     * @param orderIdList
+     * @return
+     */
+    List<StudentPaymentOrderDetail> getOrderDetail(List<Long> orderIdList);
+
     /**
      * 获取订单类型的详情
      * @param orderId

+ 1 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -10,7 +10,6 @@ import com.ym.mec.biz.dal.dto.PageInfoReg;
 import com.ym.mec.biz.dal.dto.RegisterDto;
 import com.ym.mec.biz.dal.dto.StudentAddDto;
 import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
-import com.ym.mec.biz.dal.dto.StudentFeeDetailDto;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.dto.StudentMusicDetailDto;
 import com.ym.mec.biz.dal.dto.StudentMusicGroupDto;
@@ -56,7 +55,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      * @param musicGroupId
      * @return
      */
-    StudentFeeDetailDto queryFeeDetail(Integer studentId, String musicGroupId);
+    List<StudentPaymentOrderDetail> queryFeeDetail(Integer studentId, String musicGroupId);
 
     /**
      * 获取未分配的班级的学生

+ 25 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -11,6 +11,7 @@ import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.util.collection.MapUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -336,11 +337,32 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
     }
 
     @Override
-    public List<StudentPaymentOrderDetail> getOrderDetail(Long orderId) {
-        return studentPaymentOrderDetailDao.getOrderDetail(orderId);
-    }
+	public List<StudentPaymentOrderDetail> getOrderDetail(Long orderId) {
+		
+    	List<Long> orderIdList = new ArrayList<Long>();
+    	orderIdList.add(orderId);
+    		
+    	return getOrderDetail(orderIdList);
+	}
 
     @Override
+	public List<StudentPaymentOrderDetail> getOrderDetail(List<Long> orderIdList) {
+    	List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailDao.getOrderDetailByOrderId(orderIdList);
+
+		for (StudentPaymentOrderDetail spod : studentPaymentOrderDetailList) {
+			if (spod.getType() == OrderDetailTypeEnum.ACCESSORIES || spod.getType() == OrderDetailTypeEnum.MUSICAL
+					|| spod.getType() == OrderDetailTypeEnum.TEACHING) {
+				List<Goods> goods = goodsService.findGoodsByIds(spod.getGoodsIdList());
+				if (goods != null && goods.size() > 0) {
+					spod.setName(goods.stream().map(t -> t.getName()).collect(Collectors.joining(",")));
+				}
+			}
+		}
+
+		return studentPaymentOrderDetailList;
+	}
+
+	@Override
     public List<String> getOrderDetailType(Long orderId) {
         return studentPaymentOrderDetailDao.getOrderDetailType(orderId);
     }

+ 10 - 39
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -59,14 +59,11 @@ import com.ym.mec.biz.dal.dao.SubjectDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dto.MusicalListDetailDto;
 import com.ym.mec.biz.dal.dto.NoClassMusicStudentDto;
 import com.ym.mec.biz.dal.dto.PageInfoReg;
 import com.ym.mec.biz.dal.dto.RegisterDto;
 import com.ym.mec.biz.dal.dto.StudentAddDto;
 import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
-import com.ym.mec.biz.dal.dto.StudentFeeDetailDto;
-import com.ym.mec.biz.dal.dto.StudentFeeDto;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.dto.StudentMusicDetailDto;
 import com.ym.mec.biz.dal.dto.StudentMusicGroupDto;
@@ -332,41 +329,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public StudentFeeDetailDto queryFeeDetail(Integer studentId, String musicGroupId) {
-        StudentFeeDetailDto studentFeeDetailDto = new StudentFeeDetailDto();
-        List<MusicalListDetailDto> musicalList = studentPaymentOrderDetailService.getMusicalListDetail(musicGroupId, studentId);
-        if (musicalList.size() <= 0) {
-            return studentFeeDetailDto;
-        }
-        MusicalListDetailDto detailDto = musicalList.get(0);
-        studentFeeDetailDto.setTotalAmount(detailDto.getOrderAmount());
-        studentFeeDetailDto.setCourseFee(detailDto.getCourseAmount());
-        if (KitGroupPurchaseTypeEnum.LEASE.equals(detailDto.getKitGroupPurchaseTypeEnum())) {
-            studentFeeDetailDto.setDepositFee(detailDto.getMusicalAmount());
-        }
-        List<StudentFeeDto> studentFeeDtos = new ArrayList<>();
-        if (detailDto.getMusicalName() != null) {
-            StudentFeeDto studentFeeDto = new StudentFeeDto();
-            studentFeeDto.setGoodsName(detailDto.getMusicalName());
-            studentFeeDto.setGoodsType("INSTRUMENT");
-            studentFeeDto.setMusicalFee(detailDto.getMusicalAmount());
-            studentFeeDtos.add(studentFeeDto);
-        }
-        if (detailDto.getAccessoriesName() != null) {
-            StudentFeeDto studentFeeDto = new StudentFeeDto();
-            studentFeeDto.setGoodsName(detailDto.getAccessoriesName());
-            studentFeeDto.setGoodsType("ACCESSORIES");
-            studentFeeDto.setMusicalFee(detailDto.getAccessoriesAmount());
-            studentFeeDtos.add(studentFeeDto);
-        }
-        StudentFeeDto studentFeeDto = new StudentFeeDto();
-        studentFeeDto.setGoodsType("COURSE");
-        studentFeeDto.setMusicalFee(detailDto.getCourseAmount());
-        studentFeeDtos.add(studentFeeDto);
-        studentFeeDetailDto.setGoods(studentFeeDtos);
-
-        return studentFeeDetailDto;
-        //return studentRegistrationDao.queryFeeDetail(studentId, musicGroupId);
+    public List<StudentPaymentOrderDetail> queryFeeDetail(Integer studentId, String musicGroupId) {
+    	
+    	List<StudentPaymentOrder> studentPaymentOrderList = studentPaymentOrderService.queryByCondition(GroupType.MUSIC, musicGroupId, studentId, DealStatusEnum.SUCCESS, OrderTypeEnum.APPLY);
+    	
+    	List<Long> orderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
+
+        return studentPaymentOrderDetailService.getOrderDetail(orderIdList);
     }
 
     @Override
@@ -1141,7 +1110,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
             List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.getOrderDetail(studentPaymentOrder.getId());
 
-            List<StudentPaymentOrderDetail> allDetails = studentPaymentOrderDetailDao.getOrderDetailByOrderId(studentPaymentOrder.getId());
+            List<Long> orderIdList = new ArrayList<Long>();
+            orderIdList.add(studentPaymentOrder.getId());
+            List<StudentPaymentOrderDetail> allDetails = studentPaymentOrderDetailDao.getOrderDetailByOrderId(orderIdList);
             BigDecimal courseFee = allDetails.stream().filter(o -> !o.getType().getCode().equals("MUSICAL"))
                     .filter(o -> !o.getType().getCode().equals("ACCESSORIES"))
                     .filter(o -> !o.getType().getCode().equals("MAINTENANCE"))

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -295,7 +295,7 @@
     </select>
 
     <select id="getOrderDetailByOrderId" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+        SELECT * FROM student_payment_order_detail WHERE find_in_set(payment_order_id_,#{orderId})
     </select>
 
     <select id="getInstrumentNumInMusicApply" resultMap="Mapper">