Browse Source

退款列表

liweifan 3 years ago
parent
commit
204a1d410e

+ 19 - 16
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/UserOrderRefundDao.java

@@ -11,28 +11,31 @@ import com.yonge.cooleshow.biz.dal.vo.UserOrderRefundVo;
 import com.yonge.cooleshow.biz.dal.dto.search.UserOrderRefundSearch;
 
 
-public interface UserOrderRefundDao extends BaseMapper<UserOrderRefund>{
-	/**
-	 * 查询详情
+public interface UserOrderRefundDao extends BaseMapper<UserOrderRefund> {
+    /**
+     * 查询详情
+     *
      * @author liweifan
      * @date 2022-05-09 17:14:30
      * @return: com.yonge.cooleshow.biz.dal.vo.UserOrderRefundVo
-	 */
-	UserOrderRefundVo detail(@Param("id") Long id);
+     */
+    UserOrderRefundVo detail(@Param("id") Long id, @Param("userId") Long userId);
 
-	/**
-	 * 分页查询
+    /**
+     * 分页查询
+     *
      * @author liweifan
      * @date 2022-05-09 17:14:30
      * @return: com.yonge.cooleshow.biz.dal.vo.UserOrderRefundVo
-	 */
-	List<UserOrderRefundVo> selectPage(@Param("page") IPage page, @Param("param") UserOrderRefundSearch userOrderRefund);
-	/***
-	 * 查询订单中,未退费的商品
-	 * @author liweifan
-	 * @param: bizId
-	 * @updateTime 2022/5/9 18:05
-	 * @return: java.util.List<com.yonge.cooleshow.biz.dal.entity.UserOrderDetail>
-	 */
+     */
+    List<UserOrderRefundVo> selectPage(@Param("page") IPage page, @Param("param") UserOrderRefundSearch userOrderRefund);
+
+    /***
+     * 查询订单中,未退费的商品
+     * @author liweifan
+     * @param: bizId
+     * @updateTime 2022/5/9 18:05
+     * @return: java.util.List<com.yonge.cooleshow.biz.dal.entity.UserOrderDetail>
+     */
     List<UserOrderDetail> selectOrderRefundDetils(@Param("orderId") Long orderId);
 }

+ 116 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/UserOrderRefundSearch.java

@@ -1,7 +1,17 @@
 package com.yonge.cooleshow.biz.dal.dto.search;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.yonge.cooleshow.biz.dal.enums.PeriodEnum;
 import com.yonge.toolset.base.page.QueryInfo;
+import com.yonge.toolset.utils.string.StringUtil;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.validation.constraints.NotNull;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.temporal.TemporalAdjusters;
 
 /**
  * @Author: liweifan
@@ -9,6 +19,111 @@ import io.swagger.annotations.ApiModel;
  */
 @ApiModel(value = "UserOrderRefundSearch对象", description = "退款申请表查询对象")
 public class UserOrderRefundSearch extends QueryInfo {
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
+
+    @NotNull(message = "时间类型不能为空")
+    @ApiModelProperty("时间类型 MONTH、月度  YEAR、年度")
+    private PeriodEnum timeType;
+
+    @ApiModelProperty("时间 yyyy | yyyy-MM")
+    private String dateTime;
+    @ApiModelProperty(hidden = true)
+    private Long userId;
+    /***
+     * 开始时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(hidden = true)
+    private LocalDateTime startTime;
+    /***
+     * 结束时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(hidden = true)
+    private LocalDateTime endTime;
+
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public PeriodEnum getTimeType() {
+        return timeType;
+    }
+
+    public void setTimeType(PeriodEnum timeType) {
+        this.timeType = timeType;
+    }
+
+    public String getDateTime() {
+        return dateTime;
+    }
+
+    public void setDateTime(String dateTime) {
+        this.dateTime = dateTime;
+    }
+
+    public LocalDateTime getStartTime() {
+        if (null == startTime) {
+            LocalDateTime firstDay;
+            if (PeriodEnum.YEAR.equals(timeType)) {
+                LocalDate paramDate;
+                if (StringUtil.isEmpty(dateTime)) {
+                    paramDate = LocalDate.now();
+                } else {
+                    paramDate = LocalDate.of(Integer.parseInt(dateTime), 1, 1);
+                }
+                firstDay = LocalDateTime.of(paramDate.with(TemporalAdjusters.firstDayOfYear()), LocalTime.MIN);
+            } else {
+                LocalDate paramDate;
+                if (StringUtil.isEmpty(dateTime)) {
+                    paramDate = LocalDate.now();
+                } else {
+                    String[] classDateSp = dateTime.split("-");
+                    paramDate = LocalDate.of(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1);
+                }
+                firstDay = LocalDateTime.of(paramDate.with(TemporalAdjusters.firstDayOfMonth()), LocalTime.MIN);
+            }
+            return firstDay;
+        }
+        return startTime;
+    }
+
+    public void setStartTime(LocalDateTime startTime) {
+        this.startTime = startTime;
+    }
+
+    public LocalDateTime getEndTime() {
+        if (null == endTime) {
+            LocalDateTime lastDay;
+            if (PeriodEnum.YEAR.equals(timeType)) {
+                LocalDate paramDate;
+                if (StringUtil.isEmpty(dateTime)) {
+                    paramDate = LocalDate.now();
+                } else {
+                    paramDate = LocalDate.of(Integer.parseInt(dateTime), 1, 1);
+                }
+                lastDay = LocalDateTime.of(paramDate.with(TemporalAdjusters.lastDayOfYear()), LocalTime.MAX);
+            } else {
+                LocalDate paramDate;
+                if (StringUtil.isEmpty(dateTime)) {
+                    paramDate = LocalDate.now();
+                } else {
+                    String[] classDateSp = dateTime.split("-");
+                    paramDate = LocalDate.of(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1);
+                }
+                lastDay = LocalDateTime.of(paramDate.with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX);
+            }
+            return lastDay;
+        }
+        return endTime;
+    }
 
+    public void setEndTime(LocalDateTime endTime) {
+        this.endTime = endTime;
+    }
 }

+ 6 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderRefundService.java

@@ -25,7 +25,12 @@ public interface UserOrderRefundService extends IService<UserOrderRefund>  {
  	 * @date 2022-03-30
      */
 	UserOrderRefundVo detail(Long id);
-
+	/**
+	 * 查询详情
+	 * @author liweifan
+	 * @date 2022-03-30
+	 */
+	UserOrderRefundVo detail(Long id,Long userId);
     /**
      * 分页查询
      * @author liweifan

+ 8 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderRefundServiceImpl.java

@@ -82,7 +82,13 @@ public class UserOrderRefundServiceImpl extends ServiceImpl<UserOrderRefundDao,
 
     @Override
     public UserOrderRefundVo detail(Long id) {
-        UserOrderRefundVo detail = baseMapper.detail(id);
+        UserOrderRefundVo detail = baseMapper.detail(id, null);
+        return detail;
+    }
+
+    @Override
+    public UserOrderRefundVo detail(Long id, Long userId) {
+        UserOrderRefundVo detail = baseMapper.detail(id, userId);
         return detail;
     }
 
@@ -309,7 +315,7 @@ public class UserOrderRefundServiceImpl extends ServiceImpl<UserOrderRefundDao,
         if (refundBillBaseResult.getStatus()) {
             orderRefundBill.setTransNo(refundBillBaseResult.getData().getId());
             orderRefundBill.setStatus(TradeStatusEnum.pending);
-        }else{
+        } else {
             orderRefundBill.setStatus(TradeStatusEnum.failed);
             orderRefundBill.setPayFailMsg(refundBillBaseResult.getMsg());
         }

+ 28 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserOrderRefundVo.java

@@ -1,7 +1,10 @@
 package com.yonge.cooleshow.biz.dal.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.yonge.cooleshow.biz.dal.entity.UserOrderRefund;
+import com.yonge.cooleshow.biz.dal.enums.OrderTypeEnum;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.beanutils.BeanUtils;
 
 /**
@@ -11,7 +14,31 @@ import org.apache.commons.beanutils.BeanUtils;
 @ApiModel(value = "UserOrderRefundVo对象", description = "退款申请表查询视图对象")
 public class UserOrderRefundVo extends UserOrderRefund{
 	private static final long serialVersionUID = 1L;
-    
+
+    @ApiModelProperty("订单名称 ")
+    @TableField(value = "order_name_")
+    private String orderName;
+
+    @ApiModelProperty("订单类型:  VIP、开通会员  PRACTICE、陪练课购买  LIVE、直播课购买 VIDEO、视频课购买 MUSIC、单曲点播")
+    @TableField(value = "order_type_")
+    private OrderTypeEnum orderType;
+
+    public String getOrderName() {
+        return orderName;
+    }
+
+    public void setOrderName(String orderName) {
+        this.orderName = orderName;
+    }
+
+    public OrderTypeEnum getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(OrderTypeEnum orderType) {
+        this.orderType = orderType;
+    }
+
     public UserOrderRefundVo buildVo(UserOrderRefund userOrderRefund){
         try {
             BeanUtils.copyProperties(this,userOrderRefund);

+ 19 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderRefundMapper.xml

@@ -39,12 +39,30 @@
         <include refid="baseColumns"/>
         FROM user_order_refund t
         where t.id_ = #{id}
+        <if test="userId != null">
+            and t.user_id_ = #{userId}
+        </if>
     </select>
 
     <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderRefundVo">
         SELECT
-        <include refid="baseColumns" />
+            <include refid="baseColumns" />,
+            o.order_name_ as orderName,
+            o.order_type_ as orderType
         FROM user_order_refund t
+        left join user_order o on t.order_no_ = o.order_no_
+        <where>
+            <if test="param.userId !=null">
+                AND t.user_id_ = #{param.userId}
+            </if>
+            <if test="param.startTime !=null">
+                <![CDATA[AND t.create_time_ >= #{param.startTime} ]]>
+            </if>
+            <if test="param.endTime !=null">
+                <![CDATA[AND t.create_time_ < #{param.endTime} ]]>
+            </if>
+        </where>
+        order by t.create_time_ desc
     </select>
 
     <select id="selectOrderRefundDetils" resultType="com.yonge.cooleshow.biz.dal.entity.UserOrderDetail">

+ 10 - 1
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/UserOrderRefundController.java

@@ -25,7 +25,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
 @RestController
-@RequestMapping("/UserOrderRefunds")
+@RequestMapping("/userOrderRefunds")
 @Api(value = "用户退款表", tags = "用户退款表")
 public class UserOrderRefundController extends BaseController {
 	@Autowired
@@ -41,6 +41,10 @@ public class UserOrderRefundController extends BaseController {
     @GetMapping("/detail/{id}")
     @ApiOperation(value = "详情", notes = "传入id")
     public HttpResponseResult<UserOrderRefundVo> detail(@PathVariable("id") Long id) {
+		SysUser user = sysUserFeignService.queryUserInfo();
+		if (user == null || null == user.getId()) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
     	return succeed(userOrderRefundService.detail(id));
 	}
     
@@ -50,6 +54,11 @@ public class UserOrderRefundController extends BaseController {
     @PostMapping("/page")
     @ApiOperation(value = "查询分页", notes = "传入orderRefundsSearch")
     public HttpResponseResult<PageInfo<UserOrderRefundVo>> page(@RequestBody UserOrderRefundSearch query) {
+		SysUser user = sysUserFeignService.queryUserInfo();
+		if (user == null || null == user.getId()) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		query.setUserId(user.getId());
 		IPage<UserOrderRefundVo> pages = userOrderRefundService.selectPage(PageUtil.getPage(query), query);
         return succeed(PageUtil.pageInfo(pages));
 	}

+ 0 - 110
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/WithdrawController.java

@@ -1,110 +0,0 @@
-//package com.yonge.cooleshow.teacher.controller;
-//
-//import com.alibaba.fastjson.JSONObject;
-//import com.yonge.cooleshow.biz.dal.entity.UserWithdrawalCallback;
-//import com.yonge.cooleshow.biz.dal.service.LingXinService;
-//import com.yonge.cooleshow.biz.dal.service.UserWithdrawalCallbackService;
-//import com.yonge.cooleshow.common.controller.BaseController;
-//import com.yonge.toolset.thirdparty.lingxinpay.RSA;
-//import com.yonge.cooleshow.biz.dal.sdk.WithdrawSdk;
-//import com.yonge.toolset.utils.json.JsonUtil;
-//import io.swagger.annotations.Api;
-//import org.apache.commons.lang3.StringUtils;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.web.bind.annotation.*;
-//
-//import javax.servlet.http.HttpServletRequest;
-//import java.util.Map;
-//import java.util.UUID;
-//
-///**
-// * @Description: 提现回调
-// * @Author: cy
-// * @Date: 2022/5/9
-// */
-//@RestController
-//@RequestMapping("/withdraw")
-//@Api(value = "提现回调", tags = "提现回调")
-//public class WithdrawController extends BaseController {
-//    private final static Logger log = LoggerFactory.getLogger(WithdrawController.class);
-//
-//    @Value("${withdraw.privateKey}")
-//    private String privateKey;//商户自己生成的私钥
-//
-//    @Autowired
-//    private UserWithdrawalCallbackService callbackService;
-//    @Autowired
-//    private LingXinService lingXinService;
-//
-//    /**
-//     * 异步回调接收
-//     *
-//     * @param content
-//     * @param request
-//     * @return
-//     */
-//    @PostMapping("/callback")
-//    public String test(@RequestBody String content, HttpServletRequest request) {
-//        System.out.println(privateKey);
-//        log.info("交易回调请求地址:{} 请求参数:{}", request.getRemoteAddr(), content);
-//        try {
-//            if (StringUtils.isBlank(content)) {
-//                throw new Exception();
-//            }
-//            Map<String, Object> map = JSONObject.parseObject(content);
-//            String jsonStr = RSA.decryptPri((String) map.get("sign"), privateKey);
-//            log.info("jsonStr:{}", jsonStr);
-//
-//            Map<String, Object> withdrawRecord = JSONObject.parseObject(jsonStr);
-//            UserWithdrawalCallback callback = JsonUtil.toJavaObject(withdrawRecord, UserWithdrawalCallback.class);
-//            callbackService.insertCallback(callback);
-//        } catch (Exception e) {
-//            log.error("解密失败e:{}", e);
-//            return "failed";
-//        }
-//        return "success";
-//    }
-//
-//    @PostMapping("/contractCallback")
-//    public String contractCallback(@RequestBody String content, HttpServletRequest request) {
-//        log.info("回调请求地址:{} 请求参数:{}", request.getRemoteAddr(), content);
-//        try {
-//            System.out.println("===成功===");
-//        } catch (Exception e) {
-//            System.out.println("===失败===");
-//            return "failed";
-//        }
-//        return "success";
-//    }
-//
-//    /**
-//     * 提现测试接口
-//     * @param remark
-//     * @return
-//     */
-//    @GetMapping("/test")
-//    public String a(String remark) {
-//        WithdrawSdk withdraw = new WithdrawSdk();
-//        //输入商户订单号
-//        String outerOrderNo = UUID.randomUUID().toString().substring(0, 12);
-//        System.out.println("商户订单号:" + outerOrderNo);
-//        //输入收款人手机号
-//        String name = "何亮";
-//        //输入收款人姓名
-//        String mobile = "17600220933";
-//        //输入收款人身份证号
-//        String certificateNo = "130423199206192818";
-//        //输入转账金额(单位分)
-//        Integer predictAmount = 1;
-//        //输入收款人账号
-//        String payAccount = "6228480018864836772";
-//
-//        String requestParam = withdraw.withdraw(outerOrderNo, name, mobile, certificateNo, predictAmount,
-//                payAccount, remark);
-//        log.info("单笔请求返回参数:{}", requestParam);
-//        return requestParam;
-//    }
-//}