From 9486766c806fe1d9e082b2fd02ea1cc558f1b443 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期四, 08 五月 2025 09:21:57 +0800 Subject: [PATCH] bug修改 --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/TStudentController.java | 191 ++++++++++++++++++++++++++++++++--------------- 1 files changed, 129 insertions(+), 62 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 ada2d2a..f36f5f3 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 @@ -4,10 +4,13 @@ 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.CoursePackageOrderStudent; import com.dsh.course.entity.EvaluateStudent; import com.dsh.course.feignClient.account.AppUserClient; import com.dsh.course.feignClient.account.StudentClient; import com.dsh.course.feignClient.account.model.TAppUser; +import com.dsh.course.feignClient.communityWorldCup.Model.StoreIds; +import com.dsh.course.feignClient.communityWorldCup.WorldCupClient; import com.dsh.course.feignClient.competition.CompetitionClient; import com.dsh.course.feignClient.competition.model.ListQuery; import com.dsh.course.feignClient.course.CoursePackageClient; @@ -39,6 +42,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.management.relation.RelationService; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -197,18 +201,31 @@ String formattedDate = dateFormat.format(new Date()); model.addAttribute("reDate", formattedDate); - List<TCoursePackagePayment> coursePackagePayments = courseStuddentClient.queryByIds(ids); + List<CoursePackageOrderStudent> coursePackagePayments = courseStuddentClient.queryByIds(ids); BigDecimal countAll = new BigDecimal(0); - for (TCoursePackagePayment payment : coursePackagePayments){ + for (CoursePackageOrderStudent payment : coursePackagePayments){ //课包名称 TCoursePackage tCoursePackage = coursePackageClient.queryById(payment.getCoursePackageId()); + List<CoursePackageOrder> ordes = courseStuddentClient.getOrder(payment.getId()); + + + payment.setName(tCoursePackage.getName()); payment.setId(Long.valueOf(tCoursePackage.getId())); - BigDecimal cashPayment = payment.getCashPayment(); + + BigDecimal cashPayment = BigDecimal.ZERO; + for (CoursePackageOrder order : ordes) { + BigDecimal cashPayment1 = order.getCashPayment(); + if (cashPayment1 != null) { + cashPayment = cashPayment.add(cashPayment1); + } + } + payment.setCashPayment(cashPayment); +// BigDecimal cashPayment = payment.getCashPayment(); if (cashPayment==null){ cashPayment = BigDecimal.ZERO; } @@ -289,6 +306,11 @@ return PREFIX + "tStudentEdit_first.html"; } + @Autowired + private IMenuService menuService; + + @Autowired + private IRelationService relationService; @RequestMapping("/tStudent_info/{tStudentId}") public String tStudentInfo(@PathVariable("tStudentId") Integer tStudentId, Model model) { System.out.println("======>t"+tStudentId); @@ -309,17 +331,7 @@ model.addAttribute("item", tStudentDto); 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()); } @@ -329,6 +341,17 @@ System.out.println("=======controller====studentClassInfo==="+studentClassInfo); + + + User user = UserExt.getUser(); + + List<Relation> list = relationService.list(new QueryWrapper<Relation>().eq("menuid", 391).eq("roleid", user.getRoleid())); + if (!list.isEmpty()){ + model.addAttribute("back",false); + }else { + model.addAttribute("back",true); + } + return PREFIX + "tStudentEdit.html"; } @@ -355,9 +378,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); } @@ -366,6 +391,8 @@ private ISiteBookingService siteBookingService; @Autowired private BallClient ballClient; + @Autowired + private WorldCupClient worldCupClient; /** * 获取列表 */ @@ -375,11 +402,39 @@ List<Integer> ids = new ArrayList<>(); if(UserExt.getUser().getObjectType()==3){ + List<Integer> storeIds = new ArrayList<>(); + storeIds.add(UserExt.getUser().getObjectId()); + ListQuery listQuery = new ListQuery(); + listQuery.setIds(storeIds); + // 赛事 + List<Integer> list = competitionClient.getUserIds(listQuery); + // 获取场地预约记录 拿到用户ids + List<Integer> siteUsers = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", storeIds)) + .stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); + // 获取课程购买记录 拿到用户ids + List<Integer> cpUsers = coursePackageClient.getCoursePackageByStoreIds(storeIds); + // 获取游戏记录 拿到用户ids + List<Integer> gameUsers = ballClient.getGameByStoreIds(storeIds); + // 世界杯参与记录 拿到用户ids + StoreIds req = new StoreIds(); + req.setStoreIds(storeIds); + List<Integer> studentIds = worldCupClient.getStudentIds(req); + // 用户ids + List<Integer> users = new ArrayList<>(); + users.addAll(list); + users.addAll(siteUsers); + users.addAll(cpUsers); + users.addAll(gameUsers); + users.addAll(studentIds); + // 去重后的用户id + List<Integer> collect = users.stream().distinct().collect(Collectors.toList()); ids = appUserClient.getUserStore(UserExt.getUser().getObjectId()); + ids.addAll(collect); + List<Integer> collect1 = ids.stream().distinct().collect(Collectors.toList()); if(ids.size()==0){ ids.add(-1); } - search.setIds(ids); + search.setIds(collect1); } if(UserExt.getUser().getObjectType()==2){ // 获取运营商下的所有门店id集合 @@ -399,12 +454,17 @@ List<Integer> cpUsers = coursePackageClient.getCoursePackageByStoreIds(storeIds); // 获取游戏记录 拿到用户ids List<Integer> gameUsers = ballClient.getGameByStoreIds(storeIds); + // 世界杯参与记录 拿到学员ids + StoreIds req = new StoreIds(); + req.setStoreIds(storeIds); + List<Integer> studentIds = worldCupClient.getStudentIds(req); // 用户ids List<Integer> users = new ArrayList<>(); users.addAll(list); users.addAll(siteUsers); users.addAll(cpUsers); users.addAll(gameUsers); + users.addAll(studentIds); // 去重后的用户id List<Integer> collect = users.stream().distinct().collect(Collectors.toList()); ids = appUserClient.getUserYYs(UserExt.getUser().getObjectId()); @@ -433,9 +493,7 @@ @RequestMapping("/listcom/{id}") @ResponseBody public List<Map<String,Object>> listcom(@PathVariable("id") Integer id) { - - List<Map<String,Object>> maps = studentClient.listCom(id); - + List<Map<String,Object>> maps = studentClient.listCom(id); return maps; } @@ -522,12 +580,14 @@ // 需要过滤体验课 List<ClassListDto> classListDtos = courseStuddentClient.listClass(tStudentId); for (ClassListDto classListDto : classListDtos) { - classListDto.setHasClassHours(classListDto.getTotalClassHours()-classListDto.getLaveClassHours()); 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); @@ -546,11 +606,14 @@ insertBackDto.setIds(ids); System.out.println("=====insertBackDto========"+insertBackDto); - courseStuddentClient.insertBack(insertBackDto); + Integer i = courseStuddentClient.insertBack(insertBackDto); + if (i == 1){ + return ResultUtil.error("当前课程已在退费申请中"); + } //取消排课 - courseStuddentClient.cancel(ids); - System.out.println("============学员查询接口========="); +// courseStuddentClient.cancel(ids); +// System.out.println("============学员查询接口========="); return ResultUtil.success(); } @@ -559,32 +622,21 @@ @RequestMapping("/changeStatus/{id}") @ResponseBody public ResultUtil changeStatus(@PathVariable Integer id) { -// InsertBackDto insertBackDto= new InsertBackDto(); -// insertBackDto.setId(id); -//// insertBackDto.setIds(ids); -// System.out.println("=====insertBackDto========"+insertBackDto); - courseStuddentClient.changeStatus(id); courseStuddentClient.zeroClass(id); System.out.println("============学员查询接口========="); - return new ResultUtil<>(0,0,"同意成功",null,null); + return new ResultUtil<>(0,0,"已同意",null,null); } @RequestMapping("/noStatus/{id}") @ResponseBody public ResultUtil noStatus(@PathVariable Integer id) { -// InsertBackDto insertBackDto= new InsertBackDto(); -// insertBackDto.setId(id); -//// insertBackDto.setIds(ids); -// System.out.println("=====insertBackDto========"+insertBackDto); - - courseStuddentClient.changeStatus(id); + courseStuddentClient.noStatus(id); courseStuddentClient.backStausClass(id); -// courseStuddentClient.zeroClass(id); System.out.println("============学员查询接口========="); - return new ResultUtil<>(0,0,"同意成功",null,null); + return new ResultUtil<>(0,0,"已拒绝",null,null); } /** @@ -594,11 +646,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,"编辑成功"); @@ -627,7 +693,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(); @@ -683,9 +751,6 @@ toClassDto.setId(id); courseStuddentClient.toClass(toClassDto); - -// Map<String,List<SelectDto>> map = new HashMap<>(); -// map.put("options",selectDtos); return new ResultUtil(0,0,"编辑成功",1,""); } @@ -698,15 +763,15 @@ 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(); - // - } +// 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<>(); @@ -756,10 +821,10 @@ System.out.println("========ToHoliDto========="+resultUtil); - if (resultUtil==""||resultUtil==null){ - return new ResultUtil<>(0,0,"报名成功"); + if (resultUtil.equals("报名成功")){ + return new ResultUtil<>(0,0,resultUtil); }else{ - return new ResultUtil<>(0,0,"报名成功,以下学员剩余课时不足"+resultUtil);} + return new ResultUtil<>(0,1,resultUtil);} } @@ -780,13 +845,15 @@ String resultUtil = courseStuddentClient.toTrans(toHoliDto); System.out.println("========ToHoliDto========="+resultUtil); + if (resultUtil.equals("换课成功")) { + return new ResultUtil<>(0,0,resultUtil); - if (resultUtil==""){ - return new ResultUtil<>(0,0,"报名成功"); - }else{ - return new ResultUtil<>(0,0,"报名成功,以下学员剩余课时不足"+resultUtil);} + }else { + return new ResultUtil<>(0,1,resultUtil); + } } + //赠课 @RequestMapping(value = "/giftTo") -- Gitblit v1.7.1