44323
2023-11-05 75bac456c3d66f6b173b1213776158c3bc5f8b96
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java
@@ -35,14 +35,12 @@
import com.dsh.course.model.vo.RegisterCourseVo;
import com.dsh.course.model.vo.request.*;
import com.dsh.course.model.vo.response.*;
import com.dsh.course.service.CoursePackageSchedulingService;
import com.dsh.course.service.ICoursePackageSchedulingService;
import com.dsh.course.service.TCoursePackagePaymentService;
import com.dsh.course.util.*;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -165,15 +163,6 @@
        List<Map<String, Object>> studentTotal = this.baseMapper.getStudentTotal(studentQeryDto);
        for (Map<String, Object> student : studentTotal) {
            BigDecimal cashPayment = (BigDecimal) student.get("cashPayment");
            BigDecimal totalClassHours = (BigDecimal) student.get("totalClassHours");
            BigDecimal hasHours = (BigDecimal) student.get("hasHours");
            BigDecimal hasPayment = cashPayment.divide(totalClassHours, 2, RoundingMode.HALF_UP)
                    .multiply(hasHours).setScale(2, RoundingMode.HALF_UP);
            student.put("hasPayment", hasPayment);
            Integer appUserId = (Integer) student.get("appUserId");
            AppUser appUser = appuClient.queryAppUser(appUserId);
            student.put("province", appUser.getProvince());
@@ -184,8 +173,18 @@
            Student studentId = studentClient.queryStudentById((Integer) student.get("studentId"));
            student.put("studentName", studentId.getName());
            BigDecimal cashPayment = (BigDecimal) student.get("cashPayment");
            BigDecimal totalClassHours = (BigDecimal) student.get("totalClassHours");
            BigDecimal hasHours = (BigDecimal) student.get("hasHours");
            if (cashPayment==null){
                continue;
            }
            if (totalClassHours.compareTo(BigDecimal.ZERO)==0){
                totalClassHours = totalClassHours.add(new BigDecimal("1"));
            }
            BigDecimal hasPayment = cashPayment.divide(totalClassHours, 2, RoundingMode.HALF_UP)
                    .multiply(hasHours).setScale(2, RoundingMode.HALF_UP);
            student.put("hasPayment", hasPayment);
        }
        if (studentQeryDto.getCityCode()!=null&&studentQeryDto.getCityCode()!="") {
@@ -433,6 +432,7 @@
            TCoursePackage coursePackage = tcpmapper.selectById(tCoursePackagePayment.getCoursePackageId());
            response.setCoursePackageId(tCoursePackagePayment.getCoursePackageId());
            response.setCoverDrawing(coursePackage.getCoverDrawing());
            response.setDetailDrawing(coursePackage.getDetailDrawing());
            response.setCoursePackageName(coursePackage.getName());
            response.setCoursePayId(tCoursePackagePayment.getId());
            List<Integer> integers = StrUtils.dealStrToList(coursePackage.getClassWeeks());
@@ -663,7 +663,7 @@
    public ResultUtil AlipayPayment(String code, BigDecimal request){
        TCoursePackagePaymentMapper baseMapper1 = this.baseMapper;
        ResultUtil alipay = payMoneyUtil.alipay("课包购买", "", "", code, request.toString(),
        ResultUtil alipay = payMoneyUtil.alipay("课包购买", "课包购买", "", code, request.toString(),
                "/base/coursePackage/alipayRegisteredCoursesCallback");
        if(alipay.getCode() == 200){
            new Thread(new Runnable() {
@@ -734,6 +734,7 @@
    }
    @Override
    public List<RecordAppoint> obtainStuClassDetails(Integer stuId, Integer appUserId,Integer pageNum) {
@@ -755,8 +756,8 @@
        if (tCoursePackagePayments.size() > 0 ){
//            int pageNum = 1; // 页码
            int pageSize = 10; // 每页记录数
            Page<CoursePackageStudent> page = new Page<>(pageNum, pageSize);
            int pageSize = 5; // 每页记录数
            Page<CoursePackageStudent> page = new Page<>(1, pageSize);
//            for (TCoursePackagePayment tCoursePackagePayment : tCoursePackagePayments) {
//                List<CoursePackageStudent> coursePackageStudent1 = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>()
@@ -783,6 +784,10 @@
                             coursePackage = tcpmapper.selectById(coursePackageStudent.getCoursePackageId());
                             coursePackageId = coursePackageStudent.getCoursePackageId();
                        }
                        recordVo.setSid(Arrays.asList(coursePackage.getStoreId()));
                        List<Integer> rid  = stoClient.querySiteId(coursePackage.getStoreId());
                        recordVo.setRid(rid);
                        recordVo.setUserId(appUserId);
                        recordVo.setSiteId(coursePackage.getSiteId());
                        List<Integer> ids1 = getIds(coursePackage.getSiteId());
@@ -799,9 +804,22 @@
//                        recordVo.setCourseHours(tCoursePackagePayment.getClassHours());
                        Date date = DateUtil.getDate();
                        String classStartTime = coursePackage.getClassStartTime();
                        String classEndTime = coursePackage.getClassEndTime();
                        recordVo.setTimeFrame(simpleDateFormat.format(date)+" "+classStartTime+"-"+classEndTime);
                        CoursePackageScheduling byId = coursePackageSchedulingService.getById(coursePackageStudent.getCoursePackageSchedulingId());
//                        String classStartTime = coursePackage.getClassStartTime();
//                        String classEndTime = coursePackage.getClassEndTime();
                        if (byId == null){
                            continue;
                        }
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        String dateString1 = sdf.format(byId.getClassDate());
                        String dateString2 = sdf.format(byId.getEndDate());
                        recordVo.setTimeFrame(dateString1 + "-" + dateString2.substring(11));
//                        recordVo.setTimeFrame(simpleDateFormat.format(date)+" "+classStartTime+"-"+classEndTime);
                        Store store = stoClient.queryStoreById(coursePackage.getStoreId());
                        recordVo.setStoreNameAddr(store.getName()+store.getAddress());
                        recordVo.setCourseStuRecordId(coursePackageStudent.getId());
@@ -810,7 +828,7 @@
                        List<String> integerList = Arrays.asList(split);
                        String weekOfDate = DateTimeHelper.getWeekOfDate(new Date());
                        if (integerList.contains(weekOfDate)){
                            String dat = simpleDateFormat.format(date) +" "+ classStartTime;
                            String dat = simpleDateFormat.format(date) +" "+ dateString2.substring(11);
                            Date start = null;
                            try {