From d4fbea2ac7f7c98ffd83480f8f2535ca92f3baea Mon Sep 17 00:00:00 2001 From: nickchange <126672920+nickchange@users.noreply.github.com> Date: 星期三, 29 十一月 2023 18:19:43 +0800 Subject: [PATCH] 11.29 --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/TStudentController.java | 150 ++++++++++++++++++++++++++++++++++---------------- 1 files changed, 102 insertions(+), 48 deletions(-) diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/TStudentController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/TStudentController.java index 6164351..a01b63e 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/TStudentController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/TStudentController.java @@ -1,6 +1,7 @@ package com.dsh.guns.modular.system.controller.system; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.course.dto.*; import com.dsh.course.entity.EvaluateStudent; @@ -10,6 +11,7 @@ import com.dsh.course.feignClient.competition.CompetitionClient; import com.dsh.course.feignClient.competition.model.ListQuery; import com.dsh.course.feignClient.course.CoursePackageClient; +import com.dsh.course.feignClient.course.CoursePackagePaymentClient; import com.dsh.course.feignClient.course.CourseStuddentClient; import com.dsh.course.feignClient.course.model.TCoursePackage; import com.dsh.course.feignClient.course.model.TCoursePackagePayment; @@ -24,10 +26,7 @@ import com.dsh.guns.core.base.controller.BaseController; import com.dsh.guns.modular.system.model.*; import com.dsh.guns.modular.system.model.dto.*; -import com.dsh.guns.modular.system.service.EvaluateStudentService; -import com.dsh.guns.modular.system.service.ISiteBookingService; -import com.dsh.guns.modular.system.service.IStoreService; -import com.dsh.guns.modular.system.service.ITStudentService; +import com.dsh.guns.modular.system.service.*; import com.dsh.guns.modular.system.util.BigDecimalToChineseAmountUtil; import com.dsh.guns.modular.system.util.ResultUtil; import io.swagger.models.auth.In; @@ -76,6 +75,10 @@ private IStoreService storeService; @Autowired private CompetitionClient competitionClient; + @Autowired + private ICityService cityService; + @Autowired + private CoursePackagePaymentClient coursePackagePaymentClient; @RequestMapping("download") public void down(HttpServletRequest request, HttpServletResponse response) throws IOException { @@ -130,6 +133,8 @@ public String index(Model model) { Integer objectType = UserExt.getUser().getObjectType(); model.addAttribute("objectType",objectType); + List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); + model.addAttribute("list",list); return PREFIX + "tStudent.html"; } @@ -188,7 +193,7 @@ model.addAttribute("userName",tAppUser.getName()); model.addAttribute("tStudentDto",tStudentDto); - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String formattedDate = dateFormat.format(new Date()); model.addAttribute("reDate", formattedDate); @@ -255,17 +260,19 @@ //查询学员信息 TStudentDto tStudentDto = itStudentService.listOne(tStudentId); model.addAttribute("item", tStudentDto); - if (tStudentDto.getLateralSurface()!=null) { + if (tStudentDto.getLateralSurface()!=null&&!tStudentDto.getLateralSurface().equals("")) { String[] pics = tStudentDto.getLateralSurface().split(";"); - model.addAttribute("pic1", pics[0]); - System.out.println("=====pic1==" + pics[0]); - if (pics.length > 1) { - model.addAttribute("pic2", pics[1]); - System.out.println("=====pic2==" + pics[1]); - } - if (pics.length > 2) { - model.addAttribute("pic3", pics[2]); - System.out.println("=====pic3==" + pics[2]); + if (pics.length>0) { + model.addAttribute("pic1", pics[0]); + System.out.println("=====pic1==" + pics[0]); + if (pics.length > 1) { + model.addAttribute("pic2", pics[1]); + System.out.println("=====pic2==" + pics[1]); + } + if (pics.length > 2) { + model.addAttribute("pic3", pics[2]); + System.out.println("=====pic3==" + pics[2]); + } } } @@ -287,19 +294,33 @@ System.out.println("======>t"+tStudentId); //查询学员信息 TStudentDto tStudentDto = itStudentService.listOne(tStudentId); + // 查询该学员第一次购买课包的时间 + String time = coursePackagePaymentClient.getTime(tStudentId); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + try { + if (time!=null){ + Date parse = format.parse(time); + tStudentDto.setTime(parse); + } + } catch (ParseException e) { + e.printStackTrace(); + } + + model.addAttribute("item", tStudentDto); - if (tStudentDto.getLateralSurface()!=null) { - String[] pics = tStudentDto.getLateralSurface().split(";"); - model.addAttribute("pic1", pics[0]); - System.out.println("=====pic1==" + pics[0]); - if (pics.length > 1) { - model.addAttribute("pic2", pics[1]); - System.out.println("=====pic2==" + pics[1]); - } - if (pics.length > 2) { - model.addAttribute("pic3", pics[2]); - System.out.println("=====pic3==" + pics[2]); - } + if (tStudentDto.getLateralSurface()!=null&&!tStudentDto.equals("")) { +// String[] pics = tStudentDto.getLateralSurface().split(";"); +// model.addAttribute("pic1", pics[0]); +// System.out.println("=====pic1==" + pics[0]); +// if (pics.length > 1) { +// model.addAttribute("pic2", pics[1]); +// System.out.println("=====pic2==" + pics[1]); +// } +// if (pics.length > 2) { +// model.addAttribute("pic3", pics[2]); +// System.out.println("=====pic3==" + pics[2]); +// } + model.addAttribute("images",tStudentDto.getLateralSurface()); } @@ -335,9 +356,11 @@ @RequestMapping("/getUseTime/{tStudentId}") @ResponseBody public ResultUtil getMax(@PathVariable("tStudentId") Integer tStudentId) { - Date useTime = courseStuddentClient.getUseTime(tStudentId); + Date vali = studentClient.getById(tStudentId); + +// Date useTime = courseStuddentClient.getUseTime(tStudentId); Map<String, Date> map = new HashMap<>(); - map.put("useTime",useTime); + map.put("useTime",vali); return new ResultUtil<>(0,0,null,map,null); } @@ -416,8 +439,6 @@ List<Map<String,Object>> maps = studentClient.listCom(id); - - return maps; } @@ -432,7 +453,8 @@ evaluateStudent.setImgs(image); // evaluateStudent.setInsertTime(new Date()); - + User user = UserExt.getUser(); + evaluateStudent.setCoachId(user.getId()); appUserClient.save(evaluateStudent); // evaluateStudentService.save(evaluateStudent); @@ -445,15 +467,15 @@ @RequestMapping("/updatecom") @ResponseBody - public ResultUtil updatecom(Integer id,String content,String images) { + public ResultUtil updatecom(@RequestBody StudentPingYuDTO dto) { EvaluateStudent evaluateStudent = new EvaluateStudent(); - evaluateStudent.setId(id); - evaluateStudent.setContent(content); - evaluateStudent.setImgs(images); + evaluateStudent.setId(dto.getId()); + evaluateStudent.setContent(dto.getContent()); + evaluateStudent.setImgs(dto.getImages()); appUserClient.save(evaluateStudent); - evaluateStudentService.updateById(evaluateStudent); +// evaluateStudentService.updateById(evaluateStudent); @@ -500,7 +522,18 @@ @RequestMapping("/classList/{tStudentId}") @ResponseBody public ResultUtil listClass(@PathVariable("tStudentId") Integer tStudentId) { + // 需要过滤体验课 List<ClassListDto> classListDtos = courseStuddentClient.listClass(tStudentId); + for (ClassListDto classListDto : classListDtos) { + if (classListDto.getClassType()==2){ + classListDto.setTotalClassHours(null); + classListDto.setHasClassHours(null); + classListDto.setLaveClassHours(null); + continue; + } + classListDto.setHasClassHours(classListDto.getTotalClassHours()-classListDto.getLaveClassHours()); + + } Map<String,List<ClassListDto>> map = new HashMap<>(); map.put("items",classListDtos); return new ResultUtil<>(0,0,null,map,null); @@ -551,7 +584,7 @@ //// insertBackDto.setIds(ids); // System.out.println("=====insertBackDto========"+insertBackDto); - courseStuddentClient.changeStatus(id); + courseStuddentClient.noStatus(id); courseStuddentClient.backStausClass(id); // courseStuddentClient.zeroClass(id); @@ -566,11 +599,25 @@ @ResponseBody public ResultUtil update(@RequestBody TStudent tStudent) { - String lateralSurface = tStudent.getImage1()+";"+tStudent.getImage2()+";"+tStudent.getImage3(); + List<String> strings = new ArrayList<>(); + if (!tStudent.getImage1().isEmpty()){ + strings.add(tStudent.getImage1()); + } + if (!tStudent.getImage2().isEmpty()){ + strings.add(tStudent.getImage2()); + } + if (!tStudent.getImage3().isEmpty()){ + strings.add(tStudent.getImage3()); + } + String result = String.join(";", strings); - System.out.println("=======lateralSurface======>?"+lateralSurface); - tStudent.setLateralSurface(lateralSurface); - System.out.println("学员体测表的值"+lateralSurface); + +// +// String lateralSurface = tStudent.getImage1()+";"+tStudent.getImage2()+";"+tStudent.getImage3(); +// +// System.out.println("=======lateralSurface======>?"+lateralSurface); + tStudent.setLateralSurface(result); + System.out.println("学员体测表的值"+result); itStudentService.update(tStudent); // appUserClient.updateStudent(tStudent); return new ResultUtil(0,0,"编辑成功"); @@ -599,7 +646,9 @@ updateTimeDto updateTimeDto =new updateTimeDto(date1,id); System.out.println("======updateTimeDto=====>"+updateTimeDto); - courseStuddentClient.updateUseDate(updateTimeDto); +// courseStuddentClient.updateUseDate(updateTimeDto); + + studentClient.update(updateTimeDto); CreateHistoryDto historyDto = new CreateHistoryDto(); @@ -655,9 +704,6 @@ toClassDto.setId(id); courseStuddentClient.toClass(toClassDto); - -// Map<String,List<SelectDto>> map = new HashMap<>(); -// map.put("options",selectDtos); return new ResultUtil(0,0,"编辑成功",1,""); } @@ -669,7 +715,16 @@ public ResultUtil giftSelect(GiftSearchDto giftSearchDto) { List<SelectDto> selectDtos = appUserClient.giftSelect(giftSearchDto); - + // 只查询当前用户下 同时也报名了该课程的学员 +// for (SelectDto selectDto : selectDtos) { +// // 获取课包id +// TCoursePackagePayment tCoursePackagePayment = coursePackagePaymentClient.queryCoursePackagePaymentById(giftSearchDto.getId()); +// +// Integer coursePackageId = tCoursePackagePayment.getCoursePackageId(); +// // 学员id 拿到学员id 判断当前学员是否报名了这门课程 +// Long id = selectDto.getId(); +// // +// } Map<String,List<SelectDto>> map = new HashMap<>(); map.put("options",selectDtos); // Map<String,List<SelectDto>> map = new HashMap<>(); @@ -758,7 +813,6 @@ ToClassDto toClassDto = new ToClassDto(); toClassDto.setToStudentId(toStudentId); toClassDto.setId(id); - courseStuddentClient.toClass(toClassDto); // Map<String,List<SelectDto>> map = new HashMap<>(); -- Gitblit v1.7.1