| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.CoachClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | import com.dsh.course.feignClient.account.model.Coach; |
| | | import com.dsh.course.feignClient.course.CoursePackageClient; |
| | | import com.dsh.course.feignClient.course.CoursePackageDiscountClient; |
| | | import com.dsh.course.feignClient.course.CoursePackagePaymentConfigClient; |
| | | import com.dsh.course.feignClient.course.CoursePackageTypeClient; |
| | | import com.dsh.course.feignClient.course.*; |
| | | import com.dsh.course.feignClient.course.model.*; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.service.ITSiteService; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/openAddCoursePackage") |
| | | public String openAddCoursePackage(Model model){ |
| | | public String openAddCoursePackage(Model model,Integer type){ |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType(); |
| | |
| | | model.addAttribute("site", list3); |
| | | List<Coach> coaches = coachClient.queryCoachByCity(code1); |
| | | model.addAttribute("coach", coaches); |
| | | |
| | | // System.out.println("========type========"+type); |
| | | // if (type ==1){ |
| | | // return PREFIX + "coursePackage_edit.html"; |
| | | // } |
| | | return PREFIX + "coursePackage_add.html"; |
| | | } |
| | | |
| | |
| | | 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("couponIds", list4.get(0).getCouponIds()); |
| | | model.addAttribute("coursePackagePaymentConfig", list4.remove(0)); |
| | | 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); |
| | | // 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"; |
| | | } |
| | | |
| | |
| | | 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()); |
| | | return PREFIX + "coursePackage_info.html"; |
| | | } |
| | | |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/conpun/{id}") |
| | | public String conpun(@PathVariable Integer id,Model model){ |
| | | model.addAttribute("index",id); |
| | | return PREFIX + "TCoupon.html"; |
| | | } |
| | | |
| | | @GetMapping("/conpun1/{id}") |
| | | public String conpun1(Model model,@PathVariable Integer id,String conpunids){ |
| | | System.out.println("=====model=======conpunids======"+conpunids); |
| | | model.addAttribute("index",id); |
| | | |
| | | model.addAttribute("conpund",conpunids); |
| | | return PREFIX + "TCouponEdit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到优惠卷选择表页 |
| | | * @param model |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/registrationRecord") |
| | | public String registrationRecord(Model model, Integer id){ |
| | | TCoursePackage tCoursePackage = coursePackageService.queryById(id); |
| | |
| | | return PREFIX + "registrationRecord.html"; |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | @Autowired CoursePackagePaymentClient packagePaymentClient; |
| | | |
| | | /** |
| | | * 跳转到上课记录列表页 |
| | |
| | | @GetMapping("/openClassRecord") |
| | | public String openClassRecord(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 + "classRecord.html"; |
| | | } |
| | | |
| | |
| | | @PostMapping("/addCoursePackage") |
| | | public ResultUtil addCoursePackage(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); |
| | | // String classEndTime = coursePackage.getClassEndTime(); |
| | | |
| | | 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); |
| | | // classStartTime = classStartTime.substring(0, classStartTime.lastIndexOf(":")); |
| | | // classEndTime = classEndTime.substring(0, classEndTime.lastIndexOf(":")); |
| | | coursePackage.setClassStartTime(firstString); |
| | | coursePackage.setClassEndTime(secondString); |
| | | coursePackage.setAuditStatus(1); |
| | | coursePackage.setStatus(1); |
| | | coursePackage.setState(1); |