From 783b9ee7a8caa508d123d34bfbbf294716211dd7 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期三, 18 十月 2023 16:50:16 +0800
Subject: [PATCH] 10.18.2
---
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java | 139 ++++++++++++++++++++++++++++++++++++----------
1 files changed, 109 insertions(+), 30 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 5057fec..d6c2200 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
@@ -12,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;
@@ -49,6 +50,7 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -151,6 +153,113 @@
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);
+ }
+
+ @Override
+ public Integer listStoreId(String code) {
+ return this.baseMapper.queryStore(code);
}
/**
@@ -938,36 +1047,6 @@
return integers;
}
- public static void main(String[] args) {
- List<Integer> week = week("周一,周二");
- // 今天周几
- int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1;
-
- SimpleDateFormat format = new SimpleDateFormat("MM.dd");
-
- ArrayList<String> strings = new ArrayList<>();
- for (Integer integer : week) {
- if(integer<i){
- // 找下一周的时间
- Calendar instance = Calendar.getInstance();
- instance.add(Calendar.DATE,7-(i-integer));
- Date time = instance.getTime();
- strings.add(format.format(time));
-
- }else if(integer>i) {
- Calendar instance = Calendar.getInstance();
- instance.add(Calendar.DATE,integer-i);
- Date time = instance.getTime();
- strings.add(format.format(time));
- }else {
- Calendar instance = Calendar.getInstance();
- instance.add(Calendar.DATE,7);
- Date time = instance.getTime();
- strings.add(format.format(time));
- }
- }
- System.out.println(strings);
- }
@Override
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
public ResultUtil payCourse(PayCourseReq req,Integer userId){
--
Gitblit v1.7.1