From ff3f4ff4c8a6da4c1650611e11a4551680b10d77 Mon Sep 17 00:00:00 2001
From: luo <2855143437@qq.com>
Date: 星期二, 26 九月 2023 21:26:22 +0800
Subject: [PATCH] 9.26。6
---
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCoursePackageController.java | 250 +++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 227 insertions(+), 23 deletions(-)
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCoursePackageController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCoursePackageController.java
index e5268ae..b29cf19 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCoursePackageController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCoursePackageController.java
@@ -21,12 +21,16 @@
import com.dsh.guns.modular.system.service.ITSiteService;
import com.dsh.guns.modular.system.util.ResultUtil;
import io.swagger.models.auth.In;
+import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -69,7 +73,27 @@
-
+ /**
+ * 根据门店获取课程
+ */
+ @ResponseBody
+ @RequestMapping("/getCoursePackageByStoreId")
+ public List<TCoursePackageType> getCoursePackageByStoreId(Integer storeId){
+ List<TCoursePackage> list = coursePackageClient.getCoursePackageByStoreId(storeId);
+ List<Integer> ids = new ArrayList<>();
+ for (TCoursePackage tCoursePackage : list) {
+ ids.add(tCoursePackage.getCoursePackageTypeId());
+ }
+ return coursePackageTypeClient.getByCourseIds(ids);
+ }
+ /**
+ * 根据课包类型获取课包
+ */
+ @ResponseBody
+ @RequestMapping("/getCoursePackageByType")
+ public List<TCoursePackage> getCoursePackageByType(Integer storeId){
+ return coursePackageClient.getCoursePackageByType(storeId);
+ }
/**
* 跳转到列表页
* @param model
@@ -123,7 +147,9 @@
List<Coach> coaches = coachClient.queryCoachByCity(code1);
model.addAttribute("coach", coaches);
-// System.out.println("========type========"+type);
+
+ model.addAttribute("type",type);
+ System.out.println("========type========"+type);
// if (type ==1){
// return PREFIX + "coursePackage_edit.html";
// }
@@ -141,6 +167,36 @@
public String openEditCoursePackage(Model model, Integer id){
TCoursePackage tCoursePackage = coursePackageService.queryById(id);
model.addAttribute("item", tCoursePackage);
+ model.addAttribute("type", tCoursePackage.getType());
+
+ String classStartTime = tCoursePackage.getClassStartTime();
+ String classEndTime = tCoursePackage.getClassEndTime();
+
+ if (tCoursePackage.getStartTime()!=null) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ String dateString = sdf.format(tCoursePackage.getStartTime());
+ String dateString1 = sdf.format(tCoursePackage.getEndTime());
+ model.addAttribute("holi", dateString + " - " + dateString1);
+ }
+ String[] split1 = classStartTime.split(",");
+ String[] split2 = classEndTime.split(",");
+
+ List<String> listtime = new ArrayList<>();
+
+ for (int i = 0; i < split1.length; i++) {
+ String o = split1[i]+"-"+split2[i];
+ listtime.add(o);
+ }
+
+
+ model.addAttribute("time1",listtime.remove(0));
+ if (listtime.size()!=0) {
+ model.addAttribute("times", listtime);
+ }
+
+
+
+
model.addAttribute("classTime", tCoursePackage.getClassStartTime() + ":00 - " + tCoursePackage.getClassEndTime() + ":00");
String[] split = tCoursePackage.getClassWeeks().split(";");
List<String> list5 = Arrays.asList("周一", "周二", "周三", "周四", "周五", "周六", "周日");
@@ -172,17 +228,29 @@
List<Coach> coaches = coachClient.queryCoachByCity(cityCode);
model.addAttribute("coach", coaches);
List<CoursePackagePaymentConfig> list4 = coursePackagePaymentConfigClient.queryCoursePackagePaymentConfigList(id);
+
+
System.out.println("========couponIds=========>"+list4.get(0).getCouponIds());
+
+ model.addAttribute("cashPayment", list4.get(0).getCashPayment() == 0 ? false : true);
+ model.addAttribute("playPaiCoin", list4.get(0).getPlayPaiCoin() == 0 ? false : true);
+
model.addAttribute("couponIds", list4.get(0).getCouponIds());
model.addAttribute("coursePackagePaymentConfig", list4.remove(0));
+ for (int i = 0; i < list4.size(); i++) {
+ list4.get(i).setId(i+2);
+ }
+
model.addAttribute("coursePackagePaymentConfigs", list4);
+ model.addAttribute("index", 1);
+ if (list4.size()!=0) {
CoursePackagePaymentConfig coursePackagePaymentConfig = list4.get(0);
-// if (list4.size()!=0) {
+
model.addAttribute("cashPayment", coursePackagePaymentConfig.getCashPayment() == 0 ? false : true);
model.addAttribute("playPaiCoin", coursePackagePaymentConfig.getPlayPaiCoin() == 0 ? false : true);
System.out.println("=========coursePackagePaymentConfig=============>" + coursePackagePaymentConfig);
// model.addAttribute("couponIds", "3,2");
-// }
+ }
return PREFIX + "coursePackage_edit.html";
}
@@ -197,6 +265,36 @@
public String showCoursePackageDetails(Model model, Integer id){
TCoursePackage tCoursePackage = coursePackageService.queryById(id);
model.addAttribute("item", tCoursePackage);
+ model.addAttribute("type", tCoursePackage.getType());
+
+ String classStartTime = tCoursePackage.getClassStartTime();
+ String classEndTime = tCoursePackage.getClassEndTime();
+
+ if (tCoursePackage.getStartTime()!=null) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ String dateString = sdf.format(tCoursePackage.getStartTime());
+ String dateString1 = sdf.format(tCoursePackage.getEndTime());
+ model.addAttribute("holi", dateString + " - " + dateString1);
+ }
+ String[] split1 = classStartTime.split(",");
+ String[] split2 = classEndTime.split(",");
+
+ List<String> listtime = new ArrayList<>();
+
+ for (int i = 0; i < split1.length; i++) {
+ String o = split1[i]+"-"+split2[i];
+ listtime.add(o);
+ }
+
+
+ model.addAttribute("time1",listtime.remove(0));
+ if (listtime.size()!=0) {
+ model.addAttribute("times", listtime);
+ }
+
+
+
+
model.addAttribute("classTime", tCoursePackage.getClassStartTime() + ":00 - " + tCoursePackage.getClassEndTime() + ":00");
String[] split = tCoursePackage.getClassWeeks().split(";");
List<String> list5 = Arrays.asList("周一", "周二", "周三", "周四", "周五", "周六", "周日");
@@ -228,12 +326,29 @@
List<Coach> coaches = coachClient.queryCoachByCity(cityCode);
model.addAttribute("coach", coaches);
List<CoursePackagePaymentConfig> list4 = coursePackagePaymentConfigClient.queryCoursePackagePaymentConfigList(id);
+
+
+ System.out.println("========couponIds=========>"+list4.get(0).getCouponIds());
+
+ model.addAttribute("cashPayment", list4.get(0).getCashPayment() == 0 ? false : true);
+ model.addAttribute("playPaiCoin", list4.get(0).getPlayPaiCoin() == 0 ? false : true);
+
+ model.addAttribute("couponIds", list4.get(0).getCouponIds());
model.addAttribute("coursePackagePaymentConfig", list4.remove(0));
+ for (int i = 0; i < list4.size(); i++) {
+ list4.get(i).setId(i+2);
+ }
+
model.addAttribute("coursePackagePaymentConfigs", list4);
- CoursePackagePaymentConfig coursePackagePaymentConfig = list4.get(0);
- model.addAttribute("cashPayment", coursePackagePaymentConfig.getCashPayment() == 0 ? false : true);
- model.addAttribute("playPaiCoin", coursePackagePaymentConfig.getPlayPaiCoin() == 0 ? false : true);
-// model.addAttribute("couponIds", coursePackagePaymentConfig.getCouponIds());
+ model.addAttribute("index", 1);
+ if (list4.size()!=0) {
+ CoursePackagePaymentConfig coursePackagePaymentConfig = list4.get(0);
+
+ model.addAttribute("cashPayment", coursePackagePaymentConfig.getCashPayment() == 0 ? false : true);
+ model.addAttribute("playPaiCoin", coursePackagePaymentConfig.getPlayPaiCoin() == 0 ? false : true);
+ System.out.println("=========coursePackagePaymentConfig=============>" + coursePackagePaymentConfig);
+// model.addAttribute("couponIds", "3,2");
+ }
return PREFIX + "coursePackage_info.html";
}
@@ -293,7 +408,12 @@
model.addAttribute("index",id);
model.addAttribute("conpund",conpunids);
- return PREFIX + "TCouponEdit.html";
+
+ if (conpunids!=null){
+ return PREFIX + "TCoupon1.html";
+ }
+
+ return PREFIX + "TCoupon.html";
}
/**
@@ -303,10 +423,19 @@
* @return
*/
@GetMapping("/registrationRecord")
- public String registrationRecord(Model model, Integer id){
+ public String registrationRecord(Model model, Integer id,Integer type){
TCoursePackage tCoursePackage = coursePackageService.queryById(id);
model.addAttribute("item", tCoursePackage);
- return PREFIX + "registrationRecord.html";
+ model.addAttribute("type", type);
+ if (type ==1){
+ return PREFIX + "registrationRecord.html";}
+ if (type == 2){
+ return PREFIX + "registrationRecord2.html";
+ }
+ if (type == 3){
+ return PREFIX + "registrationRecord3.html";
+ }
+ return "registrationRecord.html";
}
@@ -341,7 +470,39 @@
model.addAttribute("times", strings);
model.addAttribute("counts", counts);
+
return PREFIX + "classRecord.html";
+ }
+
+ /**
+ * 假期跳转到上课记录列表页
+ * @param model
+ * @param id
+ * @return
+ */
+ @GetMapping("/openClassRecord1")
+ public String openClassRecord1(Model model, Integer id){
+ TCoursePackage tCoursePackage = coursePackageClient.queryById(id);
+ String[] start = tCoursePackage.getClassStartTime().split(",");
+ String[] end = tCoursePackage.getClassEndTime().split(",");
+ Integer counts = packagePaymentClient.queryByClassId(id);
+
+
+ List<String> strings = new ArrayList<>();
+ for (int i = 0; i <start.length ; i++) {
+ String outTime = start[i] +"-" +end[0];
+ strings.add(outTime);
+ }
+
+ TStore store = storeService.getById(tCoursePackage.getStoreId());
+ Coach coach = coachClient.queryCoachById(tCoursePackage.getCoachId());
+ model.addAttribute("item", tCoursePackage);
+ model.addAttribute("store", store);
+ model.addAttribute("coach", coach);
+ model.addAttribute("times", strings);
+ model.addAttribute("counts", counts);
+
+ return PREFIX + "classRecord2.html";
}
@@ -531,9 +692,24 @@
*/
@ResponseBody
@PostMapping("/addCoursePackage")
- public ResultUtil addCoursePackage(TCoursePackage coursePackage, String coursePackagePaymentConfig){
+ public ResultUtil addCoursePackage(TCoursePackage coursePackage, String coursePackagePaymentConfig) throws ParseException {
String classStartTime = coursePackage.getClassStartTime();
// String classEndTime = coursePackage.getClassEndTime();
+ Date startDate = null;
+ Date endDate =null ;
+
+ String holitime = coursePackage.getHolitime();
+ if (holitime!=null&&holitime!="") {
+ String[] dateParts = holitime.split(" - ");
+ String startDateString = dateParts[0];
+ String endDateString = dateParts[1];
+
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ startDate = dateFormat.parse(startDateString);
+ endDate = dateFormat.parse(endDateString);
+
+ }
+
System.out.println("=======getClassStartTime============"+classStartTime);
String startTime = coursePackage.getClassStartTime();
@@ -548,8 +724,9 @@
String jsonString = jsonArray.getString(i);
String[] split = jsonString.split(" - ");
first.add(split[0]);
- second.add(split[1]);
-
+ if (split.length>1) {
+ second.add(split[1]);
+ }
}
String firstString = String.join(",",first);
String secondString = String.join(",",second);
@@ -558,6 +735,10 @@
System.out.println("=========secondString========>"+secondString);
// classStartTime = classStartTime.substring(0, classStartTime.lastIndexOf(":"));
// classEndTime = classEndTime.substring(0, classEndTime.lastIndexOf(":"));
+
+ coursePackage.setStartTime(startDate);
+ coursePackage.setEndTime(endDate);
+
coursePackage.setClassStartTime(firstString);
coursePackage.setClassEndTime(secondString);
coursePackage.setAuditStatus(1);
@@ -578,12 +759,34 @@
@ResponseBody
@PostMapping("/updateCoursePackage")
public ResultUtil updateCoursePackage(TCoursePackage coursePackage, String coursePackagePaymentConfig){
- String classStartTime = coursePackage.getClassStartTime();
- String classEndTime = coursePackage.getClassEndTime();
- classStartTime = classStartTime.substring(0, classStartTime.lastIndexOf(":"));
- classEndTime = classEndTime.substring(0, classEndTime.lastIndexOf(":"));
- coursePackage.setClassStartTime(classStartTime);
- coursePackage.setClassEndTime(classEndTime);
+
+// System.out.println("=======getClassStartTime============"+classStartTime);
+ String startTime = coursePackage.getClassStartTime();
+ JSONArray jsonArray = JSON.parseArray(startTime);
+ System.out.println("=======jsonArray==========="+jsonArray);
+
+ List<String> first = new ArrayList<>();
+ List<String> second = new ArrayList<>();
+ for (int i = 0; i < jsonArray.size(); i++) {
+// JSONObject jsonObject = JSON.parseObject(jsonArray.getString(i));
+
+ String jsonString = jsonArray.getString(i);
+ String[] split = jsonString.split("-");
+ first.add(split[0]);
+ second.add(split[1]);
+
+ }
+ String firstString = String.join(",",first);
+ String secondString = String.join(",",second);
+ System.out.println("=========firstString========>"+firstString);
+
+ System.out.println("=========secondString========>"+secondString);
+// String classStartTime = coursePackage.getClassStartTime();
+// String classEndTime = coursePackage.getClassEndTime();
+// classStartTime = classStartTime.substring(0, classStartTime.lastIndexOf(":"));
+// classEndTime = classEndTime.substring(0, classEndTime.lastIndexOf(":"));
+ coursePackage.setClassStartTime(firstString);
+ coursePackage.setClassEndTime(secondString);
coursePackageService.updateCoursePackage(coursePackage, coursePackagePaymentConfig);
return ResultUtil.success();
}
@@ -768,13 +971,14 @@
/**
* 补课操作
- * @param coursePackagePaymentId
+ * @param id
* @return
*/
@ResponseBody
@PostMapping("/makeUpMissedLessons")
- public ResultUtil makeUpMissedLessons(Long coursePackagePaymentId){
- return coursePackageService.makeUpMissedLessons(coursePackagePaymentId);
+ public ResultUtil makeUpMissedLessons(Long id){
+ System.out.println("==========coursePackage补课PaymentId======"+id);
+ return coursePackageService.makeUpMissedLessons(id);
}
--
Gitblit v1.7.1