From e0cfe53794b2c90d9f42e5ec821dd5775758d737 Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期一, 09 十月 2023 12:00:53 +0800
Subject: [PATCH] update
---
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 147 insertions(+), 1 deletions(-)
diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java
index 964604b..2bfc8a7 100644
--- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java
+++ b/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;
@@ -9,6 +12,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsh.course.entity.*;
import com.dsh.course.entity.TAppUser;
+import com.dsh.course.entity.dto.StudentQeryDto;
import com.dsh.course.feignclient.account.AppUserClient;
import com.dsh.course.feignclient.account.CoachClient;
import com.dsh.course.feignclient.account.StudentClient;
@@ -41,10 +45,12 @@
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;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -131,6 +137,124 @@
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());
+ }
+
+ @Override
+ public List<Map<String, Object>> getStudentTotal(StudentQeryDto studentQeryDto) {
+ 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());
+ student.put("provinceCode", appUser.getProvinceCode());
+
+ student.put("city", appUser.getCity());
+ student.put("cityCode", appUser.getCityCode());
+
+ Student studentId = studentClient.queryStudentById((Integer) student.get("studentId"));
+ student.put("studentName", studentId.getName());
+
+
+ }
+
+ if (studentQeryDto.getCityCode()!=null&&studentQeryDto.getCityCode()!="") {
+ String value = studentQeryDto.getCityCode();
+ boolean allZeros = value.substring(value.length() - 4).endsWith("0000");
+ System.out.println(allZeros); // Output: true
+ if (allZeros){
+ Iterator<Map<String, Object>> iterator = studentTotal.iterator();
+ while (iterator.hasNext()) {
+ Map<String, Object> student = iterator.next();
+ String cityCode = (String) student.get("provinceCode");
+ if (!cityCode.equals(studentQeryDto.getCityCode())) {
+ iterator.remove(); // Remove the element from the list
+ }
+ }
+ }else{
+ Iterator<Map<String, Object>> iterator = studentTotal.iterator();
+ while (iterator.hasNext()) {
+ Map<String, Object> student = iterator.next();
+ String cityCode = (String) student.get("cityCode");
+ if (!cityCode.equals(studentQeryDto.getCityCode())) {
+ iterator.remove(); // Remove the element from the list
+ }
+ }}
+ }
+
+ if (studentQeryDto.getStudentName()!=null&&studentQeryDto.getStudentName()!=""){
+ List<Map<String, Object>> totallike = new ArrayList<>();
+ for (Map<String, Object> student : studentTotal) {
+ String studentName = (String) student.get("studentName");
+ if (studentName.contains(studentQeryDto.getStudentName())){
+ totallike.add(student);
+ }
+
+ }
+ return totallike;
+ }
+ return studentTotal;
+ }
+
+ @Override
+ public List<Map<String, Object>> bypac(PacQueryDto pacQueryDto) {
+ if (pacQueryDto.getCityCode()!=null&&pacQueryDto.getCityCode()!=""){
+ String value = pacQueryDto.getCityCode();
+ boolean allZeros = value.substring(value.length() - 4).endsWith("0000");
+ System.out.println(allZeros); // Output: true
+
+ if (allZeros){
+ pacQueryDto.setProvinceCode(pacQueryDto.getCityCode());
+ pacQueryDto.setCityCode(null);
+ }
+
+ }
+ List<Map<String, Object>> maps = this.baseMapper.pacQueryDto(pacQueryDto);
+
+ if (pacQueryDto.getName()!=null&&pacQueryDto.getName()!=""){
+ List<Map<String, Object>> totallike = new ArrayList<>();
+ for (Map<String, Object> student : maps) {
+ String studentName = (String) student.get("name");
+ if (studentName.contains(pacQueryDto.getName())){
+ totallike.add(student);
+ }
+
+ }
+ return totallike;
+ }
+
+
+ return maps;
+ }
+
+ @Override
+ public List<TCoursePackagePayment> listOne(List<Integer> ids) {
+ return this.baseMapper.listOne(ids);
}
/**
@@ -625,6 +749,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();
@@ -680,7 +810,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);
@@ -991,7 +1137,7 @@
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);
--
Gitblit v1.7.1