Browse Source

Merge remote-tracking branch 'origin/master'

zouxuan 4 years ago
parent
commit
b72a03309f

+ 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;
@@ -58,7 +57,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      * @param musicGroupId
      * @return
      */
-    StudentFeeDetailDto queryFeeDetail(Integer studentId, String musicGroupId);
+    List<StudentPaymentOrderDetail> queryFeeDetail(Integer studentId, String musicGroupId);
 
     /**
      * 获取未分配的班级的学生

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

@@ -83,5 +83,5 @@ public interface StudentServeService {
      * @param musicGroupId:
      * @return void
      */
-    List<IndexBaseDto> musicGroupHomeworkStat(String musicGroupId, String startDay, String endDay);
+    List<IndexBaseDto> musicGroupHomeworkStat(String musicGroupId, Integer studentId, String startDay, String endDay);
 }

+ 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;
@@ -334,41 +331,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
@@ -1143,7 +1112,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"))

+ 4 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -1045,11 +1045,13 @@ public class StudentServeServiceImpl implements StudentServeService {
     }
 
     @Override
-    public List<IndexBaseDto> musicGroupHomeworkStat(String musicGroupId, String startDayStr, String endDayStr) {
+    public List<IndexBaseDto> musicGroupHomeworkStat(String musicGroupId, Integer studentId, String startDayStr, String endDayStr) {
         List<IndexBaseDto> result = new ArrayList<>();
         List<StudentRegistration> musicGroupStu = studentRegistrationDao.getMusicGroupStu(musicGroupId);
         List<Integer> studentIds = new ArrayList<>();
-        if(!CollectionUtils.isEmpty(musicGroupStu)){
+        if(Objects.nonNull(studentId)){
+            studentIds.add(studentId);
+        }else if(!CollectionUtils.isEmpty(musicGroupStu)){
             studentIds = musicGroupStu.stream().map(StudentRegistration::getUserId).collect(Collectors.toList());
         }
 

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

@@ -295,7 +295,10 @@
     </select>
 
     <select id="getOrderDetailByOrderId" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ IN
+        <foreach collection="orderIdList" open="(" close=")" separator="," item="item">
+            #{item}
+        </foreach>
     </select>
 
     <select id="getInstrumentNumInMusicApply" resultMap="Mapper">

+ 15 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentCourseHomeworkController.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
 import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
 import com.ym.mec.biz.service.StudentCourseHomeworkService;
+import com.ym.mec.biz.service.StudentServeService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
@@ -17,6 +18,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Objects;
@@ -36,6 +38,8 @@ public class StudentCourseHomeworkController extends BaseController {
     private ExtracurricularExercisesReplyService extracurricularExercisesReplyService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private StudentServeService studentServeService;
 
     @ApiOperation(value = "提交作业")
     @PostMapping(value = "/add",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@@ -119,4 +123,15 @@ public class StudentCourseHomeworkController extends BaseController {
         return succeed(studentCourseHomeworkPageInfo);
     }
 
+    @ApiOperation(value = "乐团作业情况")
+    @GetMapping("/musicGroupHomeworkStat")
+    @PreAuthorize("@pcs.hasPermissions('exercisesSituation/musicGroupHomeworkStat')")
+    public HttpResponseResult musicGroupHomeworkStat(String musicGroupId, String startDay, String endDay) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        return succeed(studentServeService.musicGroupHomeworkStat(musicGroupId, sysUser.getId(), startDay, endDay));
+    }
+
 }

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/StudentExtracurricularExercisesSituationController.java

@@ -174,7 +174,7 @@ public class StudentExtracurricularExercisesSituationController extends BaseCont
         if (sysUser == null) {
             return failed("用户信息获取失败");
         }
-        return succeed(studentServeService.musicGroupHomeworkStat(musicGroupId, startDay, endDay));
+        return succeed(studentServeService.musicGroupHomeworkStat(musicGroupId, null, startDay, endDay));
     }
 
 }