yonge 5 years ago
parent
commit
b02d6b32e8

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentApplyRefunds.java

@@ -1,7 +1,10 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.enums.AuditStatusEnum;
+
 import io.swagger.annotations.ApiModelProperty;
+
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.math.BigDecimal;
@@ -45,6 +48,10 @@ public class StudentApplyRefunds {
 	@ApiModelProperty(value = "原订单编号",required = true)
 	private Long origPaymentOrderId;
 	
+	private StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+	
+	private SysUser user = new SysUser();
+	
 	public void setId(Long id){
 		this.id = id;
 	}
@@ -125,6 +132,22 @@ public class StudentApplyRefunds {
 		this.remark = remark;
 	}
 
+	public StudentPaymentOrder getStudentPaymentOrder() {
+		return studentPaymentOrder;
+	}
+
+	public void setStudentPaymentOrder(StudentPaymentOrder studentPaymentOrder) {
+		this.studentPaymentOrder = studentPaymentOrder;
+	}
+
+	public SysUser getUser() {
+		return user;
+	}
+
+	public void setUser(SysUser user) {
+		this.user = user;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 17 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrder.java

@@ -1,16 +1,17 @@
 package com.ym.mec.biz.dal.entity;
 
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-
-import com.ym.mec.biz.dal.enums.PaymentChannelTypeEnum;
 import io.swagger.annotations.ApiModelProperty;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
 import java.math.BigDecimal;
 import java.util.Date;
 
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.dal.enums.PaymentChannelTypeEnum;
+
 /**
  * 对应数据库表(student_payment_order):
  */
@@ -85,6 +86,8 @@ public class StudentPaymentOrder {
 
 	private PaymentChannelTypeEnum paymentChannelType;
 	
+	private SysUser user = new SysUser();
+	
 	public void setId(Long id){
 		this.id = id;
 	}
@@ -244,6 +247,14 @@ public class StudentPaymentOrder {
         this.paymentChannelType = paymentChannelType;
     }
 
+	public SysUser getUser() {
+		return user;
+	}
+
+	public void setUser(SysUser user) {
+		this.user = user;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 28 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentApplyrefundsQueryInfo.java

@@ -0,0 +1,28 @@
+package com.ym.mec.biz.dal.page;
+
+import java.util.Date;
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class StudentApplyrefundsQueryInfo extends QueryInfo {
+
+	private Date startTime;
+
+	private Date endTime;
+
+	public Date getStartTime() {
+		return startTime;
+	}
+
+	public void setStartTime(Date startTime) {
+		this.startTime = startTime;
+	}
+
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+}

+ 0 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderService.java

@@ -6,9 +6,6 @@ import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
-import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 
 public interface StudentPaymentOrderService extends BaseService<Long, StudentPaymentOrder> {

+ 24 - 4
mec-biz/src/main/resources/config/mybatis/StudentApplyRefundsMapper.xml

@@ -18,6 +18,12 @@
         <result column="orig_payment_order_id_" property="origPaymentOrderId"/>
         <result column="remark_" property="remark"/>
     </resultMap>
+    
+    <resultMap type="com.ym.mec.biz.dal.entity.StudentApplyRefunds" extends="StudentApplyRefunds" id="StudentApplyRefundsListDTO">
+    	<result column="spo.expect_amount_" property="studentPaymentOrder.expectAmount"/>
+    	<result column="spo.actual_amount_" property="studentPaymentOrder.actualAmount"/>
+    	<result column="u.username_" property="user.username"/>
+    </resultMap>
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="StudentApplyRefunds">
@@ -80,13 +86,27 @@
 	</delete>
 
     <!-- 分页查询 -->
-    <select id="queryPage" resultMap="StudentApplyRefunds" parameterType="map">
-        SELECT * FROM student_apply_refunds ORDER BY id_
-        <include refid="global.limit"/>
+    <select id="queryPage" resultMap="StudentApplyRefundsListDTO" parameterType="map">
+        SELECT sar.*,spo.expect_amount_,spo.actual_amount_,u.username_ FROM student_apply_refunds sar left join student_payment_order spo on sar.orig_payment_order_id_ = spo.id_ left join sys_user u on sar.user_id_ = u.id_
+        where 1=1 
+        <if test="startTime != null">
+            and sar.create_time_ &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            and sar.create_time_ &lt;= #{endTime}
+        </if>
+        ORDER BY sar.id_ <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM student_apply_refunds
+		SELECT count(1) FROM student_apply_refunds sar left join student_payment_order spo on sar.orig_payment_order_id_ = spo.id_ 
+		where 1=1 
+        <if test="startTime != null">
+            and sar.create_time_ = #{startTime}
+        </if>
+        <if test="endTime != null">
+            and sar.create_time_ = #{endTime}
+        </if>
 	</select>
 </mapper>

+ 8 - 3
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -26,6 +26,10 @@
         <result column="pay_time_" property="payTime"/>
         <result column="version_" property="version"/>
     </resultMap>
+    
+    <resultMap type="com.ym.mec.biz.dal.entity.StudentPaymentOrder" extends="StudentPaymentOrder" id="PaymentOrderAndStudentInfo">
+    	<result column="username_" property="user.username"/>
+    </resultMap>
 
     <resultMap type="com.ym.mec.biz.dal.entity.Goods" id="Goods">
         <result column="id_" property="id"/>
@@ -139,8 +143,8 @@
     </delete>
 
     <!-- 分页查询 -->
-    <select id="queryPage" resultMap="StudentPaymentOrder" parameterType="map">
-        SELECT * FROM student_payment_order spo
+    <select id="queryPage" resultMap="PaymentOrderAndStudentInfo" parameterType="map">
+        SELECT spo.*,u.username_ FROM student_payment_order spo left join sys_user u on spo.user_id_ = u.id_
         <include refid="queryPaymentOrder"/>
         ORDER BY spo.id_
         <include refid="global.limit"/>
@@ -187,7 +191,7 @@
         FROM
         student_vip_group_payment svgp
         LEFT JOIN student_payment_order spo ON svgp.student_payment_order_id_=spo.id_
-        WHERE svgp.user_id_=#{userId} AND svgp.vip_group_id_=#{vipGroupId} AND spo.status_='ING'
+        WHERE svgp.user_id_=#{userId} AND svgp.vip_group_id_=#{vipGroupId} AND spo.status_='ING' and spo.type_ = 'SMALL_CLASS_TO_BUY'
     </select>
     <!-- 查询报名订单 -->
     <select id="findMusicGroupApplyOrderByStatus" resultMap="StudentPaymentOrder">
@@ -220,6 +224,7 @@
             <result column="goods_name_"/>
         </collection>
     </resultMap>
+    
     <select id="findGoodsIds" resultMap="userGoodsDto">
         SELECT g.id_ goods_id_,g.name_ goods_name_ FROM student_payment_order spo
         LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_

+ 31 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentApplyRefundsController.java

@@ -0,0 +1,31 @@
+package com.ym.mec.web.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.page.StudentApplyrefundsQueryInfo;
+import com.ym.mec.biz.service.StudentApplyRefundsService;
+import com.ym.mec.common.controller.BaseController;
+
+@RequestMapping("studentRefunds")
+@Api(tags = "退费服务")
+@RestController
+public class StudentApplyRefundsController extends BaseController {
+	
+	@Autowired
+	private StudentApplyRefundsService studentApplyRefundsService;
+
+	@ApiOperation(value = "查询退费列表")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('studentRefunds/queryPage')")
+    public Object queryPage(StudentApplyrefundsQueryInfo queryInfo){
+		
+        return succeed(studentApplyRefundsService.queryPage(queryInfo));
+    }
+}

+ 31 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentOrderController.java

@@ -0,0 +1,31 @@
+package com.ym.mec.web.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.common.controller.BaseController;
+
+@RequestMapping("order")
+@Api(tags = "订单服务")
+@RestController
+public class StudentPaymentOrderController extends BaseController {
+
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
+
+    @ApiOperation(value = "获取订单列表")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('order/queryPage')")
+    public Object queryOrderPage(StudentPaymentOrderQueryInfo queryInfo){
+        return succeed(studentPaymentOrderService.queryPage(queryInfo));
+    }
+
+}

+ 5 - 4
mec-web/src/main/java/com/ym/mec/web/controller/student/StudentPaymentOrderController.java

@@ -1,16 +1,17 @@
 package com.ym.mec.web.controller.student;
 
-import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.common.controller.BaseController;
+
 @RequestMapping("studentPaymentOrder")
 @Api(tags = "学生缴费订单服务")
 @RestController