liujie
2025-12-31 f41ad34afe55808df434a5d816d50e418324f4cd
文档调整
5个文件已修改
35 ■■■■■ 已修改文件
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/InsuranceController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TCourseOrderMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/TCourseOrderService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCourseOrderServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TCourseOrderMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/InsuranceController.java
@@ -11,10 +11,7 @@
import com.ruoyi.system.dto.BuyInsuranceDto;
import com.ruoyi.system.model.*;
import com.ruoyi.system.query.GetCourseListQuery;
import com.ruoyi.system.service.TAppUserService;
import com.ruoyi.system.service.TBannerService;
import com.ruoyi.system.service.TInsuranceOrderService;
import com.ruoyi.system.service.TInsuranceService;
import com.ruoyi.system.service.*;
import com.ruoyi.system.vo.UserInsuranceVo;
import com.ruoyi.system.wxPay.utils.WxRefundUtil;
import com.ruoyi.system.wxPay.utils.WxV3Pay;
@@ -30,6 +27,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
@@ -45,13 +43,16 @@
    private final TInsuranceService tInsuranceService;
    private final WxV3Pay wxV3Pay;
    private final TAppUserService  tAppUserService;
    private final TCourseOrderService tCourseOrderService;
    public InsuranceController(TInsuranceOrderService tInsuranceOrderService, TokenService tokenService, TInsuranceService tInsuranceService, WxV3Pay wxV3Pay, TAppUserService tAppUserService) {
    public InsuranceController(TInsuranceOrderService tInsuranceOrderService, TokenService tokenService, TInsuranceService tInsuranceService, WxV3Pay wxV3Pay, TAppUserService tAppUserService, TCourseOrderService tCourseOrderService) {
        this.tInsuranceOrderService = tInsuranceOrderService;
        this.tokenService = tokenService;
        this.tInsuranceService = tInsuranceService;
        this.wxV3Pay = wxV3Pay;
        this.tAppUserService = tAppUserService;
        this.tCourseOrderService = tCourseOrderService;
    }
@@ -135,6 +136,14 @@
        order1.setRequestRefundTime(new Date());
        order1.setRefundMoney(order1.getPayMoney().doubleValue());
        Integer type = order1.getType();
        // 判断是否有当前的课程 待支付 和已完成
        int count = tCourseOrderService.countOrderNum( userId, type);
        if(count>0){
            return R.fail("请先完成课程");
        }
        if(!userId.equals(order1.getAppUserId())){
            return R.fail("无权限操作");
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TCourseOrderMapper.java
@@ -42,4 +42,6 @@
     */
    List<TRefundOrderExport> exportRefundOrder(@Param("query")TCourseOrderQuery query);
    int countOrderNum(@Param("userId") String userId, @Param("type") Integer type);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/TCourseOrderService.java
@@ -45,4 +45,7 @@
     * @return
     */
    List<TRefundOrderExport> exportRefundOrder(TCourseOrderQuery query);
    int countOrderNum(String userId, Integer type);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCourseOrderServiceImpl.java
@@ -52,4 +52,9 @@
        List<TRefundOrderExport> list = this.baseMapper.exportRefundOrder(query);
        return list;
    }
    @Override
    public int countOrderNum(String userId, Integer type) {
         return this.baseMapper.countOrderNum(userId,type);
    }
}
ruoyi-system/src/main/resources/mapper/system/TCourseOrderMapper.xml
@@ -157,5 +157,11 @@
        </where>
        ORDER BY tco.create_time DESC
    </select>
    <select id="countOrderNum" resultType="java.lang.Integer">
select count(1) from t_course_order tco left join t_course tc on tc.id = tco.course_id
where tco.disabled = 0 and tco.app_user_id = #{userId}
and tco.pay_status in (1,2) and tc.course_type = #{type}
    </select>
</mapper>