From 9c6740ce3038e1041979537ecbe7d801c21d0559 Mon Sep 17 00:00:00 2001 From: luoyisheng <2855143437@qq.com> Date: 星期二, 19 九月 2023 22:53:39 +0800 Subject: [PATCH] 9.19 --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/TStudentController.java | 254 +++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 199 insertions(+), 55 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 91685e1..47961f2 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,19 +1,32 @@ package com.dsh.guns.modular.system.controller.system; -import com.dsh.course.dto.StudentSearch; -import com.dsh.course.dto.TStudentDto; +import com.dsh.course.dto.*; +import com.dsh.course.feignClient.account.AppUserClient; +import com.dsh.course.feignClient.course.CourseStuddentClient; +import com.dsh.course.feignClient.course.model.TCoursePackagePayment; +import com.dsh.course.feignClient.other.HistoryClient; +import com.dsh.course.model.dto.StudentClassInfo; +import com.dsh.guns.config.UserExt; import com.dsh.guns.core.base.controller.BaseController; +import com.dsh.guns.modular.system.model.TStudent; +import com.dsh.guns.modular.system.model.User; +import com.dsh.guns.modular.system.model.dto.SelectDto; import com.dsh.guns.modular.system.service.ITStudentService; import com.dsh.guns.modular.system.util.ResultUtil; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.PathVariable; -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.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 控制器 @@ -28,6 +41,17 @@ private String PREFIX = "/system/tStudent/"; @Autowired private ITStudentService itStudentService; + + @Resource + private CourseStuddentClient courseStuddentClient; + + @Resource + private HistoryClient historyClient; + + + + + /** * 跳转到首页 @@ -50,12 +74,87 @@ */ @RequestMapping("/tStudent_update/{tStudentId}") public String tStudentUpdate(@PathVariable("tStudentId") Integer tStudentId, Model model) { + + System.out.println("======>t"+tStudentId); + //查询学员信息 TStudentDto tStudentDto = itStudentService.listOne(tStudentId); - model.addAttribute("item",tStudentDto); + 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 > 3) { + model.addAttribute("pic3", pics[2]); + System.out.println("=====pic3==" + pics[2]); + } + } + + + //查询课时信息 + StudentClassInfo studentClassInfo = courseStuddentClient.getInfo(tStudentId); + model.addAttribute("studentClassInfo", studentClassInfo); + + //查询课程列表 + List<ClassListDto> classListDtos = courseStuddentClient.listClass(tStudentId); + model.addAttribute("classListDtos", classListDtos); + + + return PREFIX + "tStudentEdit_first.html"; + } + + @RequestMapping("/tStudent_info/{tStudentId}") + public String tStudentInfo(@PathVariable("tStudentId") Integer tStudentId, Model model) { + System.out.println("======>t"+tStudentId); + //查询学员信息 + TStudentDto tStudentDto = itStudentService.listOne(tStudentId); + 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 > 3) { + model.addAttribute("pic3", pics[2]); + System.out.println("=====pic3==" + pics[2]); + } + } + + + //查询课时信息 + StudentClassInfo studentClassInfo = courseStuddentClient.getInfo(tStudentId); + model.addAttribute("studentClassInfo", studentClassInfo); + + + System.out.println("=======controller====studentClassInfo==="+studentClassInfo); return PREFIX + "tStudentEdit.html"; } + + + + // + + /** + * 获取有效期 + */ + @RequestMapping("/getUseTime/{tStudentId}") + @ResponseBody + public ResultUtil getMax(@PathVariable("tStudentId") Integer tStudentId) { + Date useTime = courseStuddentClient.getUseTime(tStudentId); + Map<String, Date> map = new HashMap<>(); + map.put("useTime",useTime); + + return new ResultUtil<>(0,0,null,map,null); + } + /** * 获取列表 */ @@ -67,6 +166,19 @@ return itStudentService.listAll(search); } + /** + * 获取列表 + */ + @RequestMapping("/classList/{tStudentId}") + @ResponseBody + public ResultUtil listClass(@PathVariable("tStudentId") Integer tStudentId) { + List<ClassListDto> classListDtos = courseStuddentClient.listClass(tStudentId); + Map<String,List<ClassListDto>> map = new HashMap<>(); + map.put("items",classListDtos); + return new ResultUtil<>(0,0,null,map,null); + } + + @RequestMapping("/ttt") @ResponseBody @@ -75,55 +187,87 @@ System.out.println("============学员查询接口========="); return ResultUtil.success(); } -// /** -// * 获取一个用户信息 -// */ -// @RequestMapping("/list") -// @ResponseBody -// public TStudentDto listOne(Integer id) { -// -// System.out.println("============学员查询接口========="); -// return itStudentService.listOne(id); -// } + + /** + * 学员修改 + */ + @RequestMapping(value = "/update") + @ResponseBody + + public ResultUtil update(@RequestBody TStudent tStudent, String image1, String image2, String image3 ) { + String lateralSurface = image1+";"+image2+";"+image3; + tStudent.setLateralSurface(lateralSurface); + System.out.println("学员体测表的值"+lateralSurface); + itStudentService.update(tStudent); +// appUserClient.updateStudent(tStudent); + return new ResultUtil(0,0,"编辑成功"); + } + + @Resource + private AppUserClient appUserClient; + /** + * 学员详情修改有效期 + */ + + @RequestMapping("/updateClassTime") + @ResponseBody + public ResultUtil updateClassTime(@RequestParam("date") String date, @RequestParam("id")Integer id, String passPic, String pleasePic ){ + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Date date1; + try { + date1 = dateFormat.parse(date); + } catch (ParseException e) { + // 处理日期转换异常 + e.printStackTrace(); + return ResultUtil.error("日期格式错误"); + } -// -// /** -// * 新增 -// */ -// @RequestMapping(value = "/add") -// @ResponseBody -// public Object add(TStudent tStudent) { -// tStudentService.insert(tStudent); -// return SUCCESS_TIP; -// } -// -// /** -// * 删除 -// */ -// @RequestMapping(value = "/delete") -// @ResponseBody -// public Object delete(@RequestParam Integer tStudentId) { -// tStudentService.deleteById(tStudentId); -// return SUCCESS_TIP; -// } -// -// /** -// * 修改 -// */ -// @RequestMapping(value = "/update") -// @ResponseBody -// public Object update(TStudent tStudent) { -// tStudentService.updateById(tStudent); -// return SUCCESS_TIP; -// } -// -// /** -// * 详情 -// */ -// @RequestMapping(value = "/detail/{tStudentId}") -// @ResponseBody -// public Object detail(@PathVariable("tStudentId") Integer tStudentId) { -// return tStudentService.selectById(tStudentId); -// } + updateTimeDto updateTimeDto =new updateTimeDto(date1,id); + System.out.println("======updateTimeDto=====>"+updateTimeDto); + courseStuddentClient.updateUseDate(updateTimeDto); + + + CreateHistoryDto historyDto = new CreateHistoryDto(); + historyDto.setPleasePic(pleasePic); + historyDto.setPassPic(passPic); + User user = UserExt.getUser(); + historyDto.setCreateBy(user.getId()); + historyDto.setStudentId(id); + +// appUserClient.createHistory(historyDto); + historyClient.createHistory(historyDto); + + + return ResultUtil.success(); + + } + + + /** + * 查询有效期记录 + */ + @RequestMapping(value = "/getHisory/{id}") + @ResponseBody + public ResultUtil getHisory(@PathVariable("id") Integer studentId) { + List<GetHistoryDto> getHistoryDtos = historyClient.getHisory(studentId); + Map<String,List<GetHistoryDto>> map = new HashMap<>(); + map.put("items",getHistoryDtos); + + return new ResultUtil(0,0,"编辑成功",map,""); + } + + /** + * 查询有效期记录 + */ + @RequestMapping(value = "/getUserSlect/{id}") + @ResponseBody + public ResultUtil getUserSlect(@PathVariable("id") Integer payId) { + + List<SelectDto> selectDtos = courseStuddentClient.getSelect(payId); + Map<String,List<SelectDto>> map = new HashMap<>(); + map.put("options",selectDtos); + return new ResultUtil(0,0,"编辑成功",map,""); + } } -- Gitblit v1.7.1