ソースを参照

update 销售列表根据添加日期倒序排

周箭河 5 年 前
コミット
3b86e8abe8

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

@@ -74,6 +74,7 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
 
     /**
      * 获取订单商品
+     *
      * @param orderId
      * @return
      */
@@ -81,15 +82,24 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
 
     /**
      * 获取订单详细
+     *
      * @param orderId
      * @return
      */
     List<StudentPaymentOrderDetail> getOrderDetail(@Param("orderId") Long orderId);
 
     /**
-     *
      * @param orderId
      * @return
      */
     List<String> getOrderDetailType(@Param("orderId") Long orderId);
+
+    /**
+     * 获取学生乐团报名购买的乐器信息
+     *
+     * @param studentId
+     * @param musicGroupId
+     * @return
+     */
+    List<StudentPaymentOrderDetail> getStudentApplyDetail(@Param("studentId") Integer studentId, @Param("musicGroupId") String musicGroupId);
 }

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

@@ -251,5 +251,11 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 */
 	StudentMusicDetailDto getStudentDetail(Integer studentId);
 
-	List<StudentPaymentOrderDetail> getApplyDetail(Integer studentId,String musicGroupId);
+	/**
+	 * 获取学生
+	 * @param studentId
+	 * @param musicGroupId
+	 * @return
+	 */
+	List<StudentPaymentOrderDetail> getStudentApplyDetail(Integer studentId,String musicGroupId);
 }

+ 8 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -93,6 +93,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private RedisCache<String, Object> redisCache;
     @Autowired
     private SellOrderService sellOrderService;
+    @Autowired
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -898,7 +900,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             //销售订单详情
             List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.getOrderDetail(studentPaymentOrder.getId());
             if (orderDetails.size() > 0) {
-                sellOrderService.addOrderDetail2SellOrder(orderDetails, studentPaymentOrder,musicGroup);
+                sellOrderService.addOrderDetail2SellOrder(orderDetails, studentPaymentOrder, musicGroup);
             }
 
             //三方乐团不发送缴费通知
@@ -1099,4 +1101,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentMusicDetailDto getStudentDetail(Integer studentId) {
         return studentRegistrationDao.getStudentDetail(studentId);
     }
+
+    @Override
+    public List<StudentPaymentOrderDetail> getStudentApplyDetail(Integer studentId, String musicGroupId) {
+        return studentPaymentOrderDetailDao.getStudentApplyDetail(studentId, musicGroupId);
+    }
 }

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

@@ -14,7 +14,8 @@
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
         <result column="payment_order_id_" property="paymentOrderId"/>
-        <result column="kit_group_purchase_type_" property="kitGroupPurchaseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="kit_group_purchase_type_" property="kitGroupPurchaseType"
+                typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <collection property="goodsList" ofType="com.ym.mec.biz.dal.entity.Goods">
             <result column="goods_id_" property="id"/>
             <result column="goods_name_" property="name"/>
@@ -27,7 +28,9 @@
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE id_ = #{id}
+        SELECT *
+        FROM student_payment_order_detail
+        WHERE id_ = #{id}
     </select>
 
     <!-- 全查询 -->
@@ -68,7 +71,8 @@
                 payment_order_id_ = #{paymentOrderId},
             </if>
             <if test="kitGroupPurchaseType != null">
-                kit_group_purchase_type_ = #{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+                kit_group_purchase_type_ =
+                #{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
             <if test="type != null">
                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
@@ -79,7 +83,9 @@
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
-        DELETE FROM student_payment_order_detail WHERE id_ = #{id}
+        DELETE
+        FROM student_payment_order_detail
+        WHERE id_ = #{id}
     </delete>
 
     <!-- 分页查询 -->
@@ -107,27 +113,32 @@
 
     <!-- 查询注册订单详情 -->
     <select id="findApplyOrderSuccess" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.* FROM student_payment_order spo
-        LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
-        LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
+        SELECT spod.*
+        FROM student_payment_order spo
+                 LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
+                 LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
         WHERE spo.music_group_id_ = #{musicGroupId}
-        AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-        AND spo.type_ = 'APPLY'
-        AND sr.music_group_id_=#{musicGroupId} AND sr.music_group_status_ != 'QUIT'
+          AND spo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          AND spo.type_ = 'APPLY'
+          AND sr.music_group_id_ = #{musicGroupId}
+          AND sr.music_group_status_ != 'QUIT'
     </select>
 
     <!-- 查询订单详情 -->
     <select id="findApplyOrderGoods" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+        SELECT *
+        FROM student_payment_order_detail
+        WHERE payment_order_id_ = #{orderId}
     </select>
 
     <!-- 查询用户注册订单详情 -->
     <select id="findUserApplyOrder" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.* FROM student_payment_order spo
-        LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
+        SELECT spod.*
+        FROM student_payment_order spo
+                 LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
         WHERE spo.user_id_ = #{userId}
-        AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-        AND spo.type_ = 'APPLY'
+          AND spo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          AND spo.type_ = 'APPLY'
     </select>
     <resultMap id="musicalListDetailDtoMap" type="com.ym.mec.biz.dal.dto.MusicalListDetailDto">
         <result property="paymentOrderId" column="payment_order_id_"/>
@@ -143,10 +154,13 @@
         <result property="goodsNames" column="goods_names_"/>
     </resultMap>
     <select id="getMusicalListDetail" resultMap="musicalListDetailDtoMap">
-        SELECT MAX(spo.id_) payment_order_id_,spo.user_id_  FROM student_payment_order spo
-        LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
-        WHERE spo.music_group_id_ = #{musicGroupId} AND spo.status_ = 'SUCCESS'
-        AND sr.music_group_id_ = #{musicGroupId} AND sr.music_group_status_!='QUIT'
+        SELECT MAX(spo.id_) payment_order_id_, spo.user_id_
+        FROM student_payment_order spo
+                 LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
+        WHERE spo.music_group_id_ = #{musicGroupId}
+          AND spo.status_ = 'SUCCESS'
+          AND sr.music_group_id_ = #{musicGroupId}
+          AND sr.music_group_status_ != 'QUIT'
         GROUP BY spo.user_id_
     </select>
     <select id="queryGoodsNames" resultType="java.util.Map">
@@ -169,16 +183,48 @@
     </select>
 
     <select id="findApplyOrderMusical" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId} AND type_ = 'MUSICAL' LIMIT 1
+        SELECT *
+        FROM student_payment_order_detail
+        WHERE payment_order_id_ = #{orderId}
+          AND type_ = 'MUSICAL'
+        LIMIT 1
     </select>
 
     <select id="getOrderDetail" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.*,g.id_ goods_id_,g.name_ goods_name_,g.group_purchase_price_,g.discount_price_,g.agree_cost_price_,g.type_ goods_type_ FROM student_payment_order_detail spod
-                          LEFT JOIN goods g ON FIND_IN_SET(g.id_,spod.goods_id_list_)
-        WHERE spod.payment_order_id_ = #{orderId} AND spod.goods_id_list_ IS NOT NULL
+        SELECT spod.*,
+               g.id_   goods_id_,
+               g.name_ goods_name_,
+               g.group_purchase_price_,
+               g.discount_price_,
+               g.agree_cost_price_,
+               g.type_ goods_type_
+        FROM student_payment_order_detail spod
+                 LEFT JOIN goods g ON FIND_IN_SET(g.id_, spod.goods_id_list_)
+        WHERE spod.payment_order_id_ = #{orderId}
+          AND spod.goods_id_list_ IS NOT NULL
     </select>
 
     <select id="getOrderDetailType" resultType="java.lang.String">
-        SELECT DISTINCT type_ FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+        SELECT DISTINCT type_
+        FROM student_payment_order_detail
+        WHERE payment_order_id_ = #{orderId}
+    </select>
+
+    <select id="getStudentApplyDetail" resultMap="StudentPaymentOrderDetail">
+        SELECT spod.*,
+               g.id_   goods_id_,
+               g.name_ goods_name_,
+               g.group_purchase_price_,
+               g.discount_price_,
+               g.agree_cost_price_,
+               g.type_ goods_type_
+        FROM student_payment_order_detail spod
+                 LEFT JOIN goods g ON FIND_IN_SET(g.id_, spod.goods_id_list_)
+                 LEFT JOIN student_payment_order spo on spod.payment_order_id_ = spo.id_
+        WHERE spo.user_id_ = #{studentId}
+          AND spo.music_group_id_ = #{musicGroupId}
+          AND spo.status_ = 'SUCCESS'
+          AND spo.type_ = 'APPLY'
+          AND spod.type_ IN ('MUSICAL', 'ACCESSORIES', 'TEACHING', 'OTHER', 'COURSE')
     </select>
 </mapper>

+ 25 - 6
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -1,9 +1,13 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
 import com.ym.mec.biz.dal.dto.StudentAddDto;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -18,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
 import java.util.Date;
+import java.util.List;
 
 @RequestMapping("studentRegistration")
 @Api(tags = "学生报名信息服务")
@@ -26,6 +31,8 @@ public class StudentRegistrationController extends BaseController {
 
     @Autowired
     private StudentRegistrationService studentRegistrationService;
+    @Autowired
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
 
     @ApiOperation(value = "乐团添加学员")
     @PostMapping("/insertStudent")
@@ -49,11 +56,11 @@ public class StudentRegistrationController extends BaseController {
     @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "学生编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "subId", value = "声部编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "Integer")})
-    public Object batchUpdateSubject(Integer userId,Integer subId,String musicGroupId) throws Exception {
+    public Object batchUpdateSubject(Integer userId, Integer subId, String musicGroupId) throws Exception {
         if (null == userId || subId == null || StringUtils.isEmpty(musicGroupId)) {
             return failed("参数校验异常");
         }
-        return succeed(studentRegistrationService.batchUpdateSubject(userId, subId,musicGroupId));
+        return succeed(studentRegistrationService.batchUpdateSubject(userId, subId, musicGroupId));
     }
 
     @ApiOperation(value = "乐团【报名中、缴费中】 学生详情列表分页查询")
@@ -126,7 +133,7 @@ public class StudentRegistrationController extends BaseController {
             @ApiImplicitParam(name = "type", value = "类型(MIX,HIGH)", required = true, dataType = "ClassGroupTypeEnum"),
             @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "int")})
     public HttpResponseResult getMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer actualSubjectId) {
-        return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, type,actualSubjectId));
+        return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, type, actualSubjectId));
     }
 
     @ApiOperation(value = "获取学生报名缴费详情")
@@ -134,11 +141,23 @@ public class StudentRegistrationController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/getApplyDetail')")
     @ApiImplicitParams({@ApiImplicitParam(name = "studentId", value = "学生编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
-    public HttpResponseResult getApplyDetail(String studentId, String musicGroupId) {
-        if (StringUtils.isEmpty(studentId) || StringUtils.isEmpty(musicGroupId)) {
+    public HttpResponseResult<List<StudentPaymentOrderDetail>> getApplyDetail(Integer studentId, String musicGroupId) {
+        if (studentId == null || StringUtils.isEmpty(musicGroupId)) {
             return failed("参数校验异常");
         }
-        return succeed(studentRegistrationService.queryFeeDetail(Integer.parseInt(studentId), musicGroupId));
+        return succeed(studentRegistrationService.getStudentApplyDetail(studentId, musicGroupId));
+    }
+
+    @ApiOperation(value = "获取乐团声部费用信息及乐器和辅件")
+    @GetMapping("/getSubjectGoodsAndInfo")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getSubjectGoodsAndInfo')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "subjectId", value = "声部信息", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<MusicGroupSubjectGoodsAndInfoDto> getSubjectGoodsAndInfo(Integer subjectId, String musicGroupId) {
+        if (subjectId == null || StringUtils.isEmpty(musicGroupId)) {
+            return failed("参数校验异常");
+        }
+        return succeed(musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId));
     }
 
 }