liujie
2023-10-07 39ba3d67474df6501f149d03afa5a6ad168e9147
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java
@@ -1,6 +1,9 @@
package com.dsh.course.service.impl;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.domain.Person;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -34,12 +37,14 @@
import com.dsh.course.util.*;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
@@ -130,6 +135,22 @@
            list.add(value);
        }
        return cpConfigMapper.changeState(list,dto.getPayUserName(),dto.getUserId());
    }
    @Override
    public void updateBytime(TCoursePackagePayment coursePackagePayment) {
        this.baseMapper.updateBytime(coursePackagePayment);
    }
    @Override
    public List<RegisterOrderVO> listAllRegister(RegisterOrderQuery query) {
        String STime = null;
        String ETime = null;
        if (StringUtils.hasLength(query.getRegisterTime())) {
            STime = query.getRegisterTime().split(" - ")[0] + " 00:00:00";
            ETime = query.getRegisterTime().split(" - ")[1] + " 23:59:59";
        }
        return cpConfigMapper.listAllRegister(query,STime,ETime,query.getAmount());
    }
    /**
@@ -624,6 +645,12 @@
                        TCoursePackage coursePackage = tcpmapper.selectById(tCoursePackagePayment.getCoursePackageId());
                        recordVo.setUserId(appUserId);
                        recordVo.setSiteId(coursePackage.getSiteId());
                        List<Integer> ids = getIds(coursePackage.getSiteId());
                        recordVo.setIds(ids);
                        recordVo.setCoursePackageName(coursePackage.getName());
                        recordVo.setCourseHours(tCoursePackagePayment.getClassHours());
                        Date date = DateUtil.getDate();
@@ -679,7 +706,23 @@
        }
        return recordVoList;
    }
    public List<Integer>  getIds(Integer siteId) {
        HttpRequest httpRequest = HttpRequest.get("https://try.daowepark.com/v7/user_api/general/get_space_area?space_id=" + siteId);
        HttpResponse execute = httpRequest.execute();
        String body = execute.body();
        JSONObject jsonObject = JSONObject.parseObject(body);
        Object data = jsonObject.get("data");
        JSONArray array = JSONArray.parseArray(data.toString());
        List<Integer> ids =new ArrayList<>();
        for (Object o : array) {
            JSONObject jsonObject1 = JSONObject.parseObject(o.toString());
            Object id = jsonObject1.get("id");
            Integer integer = Integer.valueOf(id.toString());
            ids.add(integer);
        }
        return ids;
    }
    @Override
    public ResultUtil insertVipPaymentCallback(String code, String orderNumber) {
        TCoursePackagePayment coursePackagePayment = this.baseMapper.getCoursePackagePaymentByCode(code);
@@ -990,9 +1033,10 @@
                    student1.setCoursePackageId(tCoursePackage.getId());
                    student1.setCoursePackagePaymentId(tCoursePackagePayment1.getId());
                    student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                    student1.setSignInOrNot(0);
                    student1.setSignInOrNot(1);
                    student1.setReservationStatus(1);
                    student1.setInsertTime(new Date());
                    student1.setType(1);
                    cpsMapper.insert(student1);
                } catch (Exception e) {
                    e.printStackTrace();
@@ -1039,8 +1083,8 @@
    }
    @Override
    public List<Integer> getStudentIds(Long payId) {
       return  this.baseMapper.getStudentIds(payId);
    public List<Integer> getStudentIds(Long payId, Integer classId, Integer appId) {
       return  this.baseMapper.getStudentIds(payId,classId,appId);
    }
    @Override