From 1a3801b7316b0a23b6d3924eb4fbb023b1edef83 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期二, 07 十一月 2023 10:30:14 +0800 Subject: [PATCH] 后台bug修改 --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/CoachController.java | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 38 insertions(+), 14 deletions(-) diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/CoachController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/CoachController.java index e5a6959..6b1d951 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/CoachController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/CoachController.java @@ -1,6 +1,7 @@ package com.dsh.guns.modular.system.controller.code; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.course.feignClient.account.CityManagerClient; import com.dsh.course.feignClient.account.CoachClient; import com.dsh.course.feignClient.account.CoachTypeClient; @@ -13,6 +14,8 @@ import com.dsh.guns.modular.system.model.CoachChangeStateVO; import com.dsh.guns.modular.system.model.CoachQuery; import com.dsh.guns.modular.system.model.Store; +import com.dsh.guns.modular.system.model.TStore; +import com.dsh.guns.modular.system.service.IStoreService; import com.dsh.guns.modular.system.util.ResultUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -21,6 +24,7 @@ import java.text.SimpleDateFormat; import java.util.*; +import java.util.stream.Collectors; /** @@ -43,20 +47,21 @@ */ @RequestMapping("") public String index(Model model) { + Integer objectType = UserExt.getUser().getObjectType(); Integer objectId = UserExt.getUser().getObjectId(); - List<Coach> list1=coachClient.getProvince(); CoachQuery coachQuery = new CoachQuery(); + coachQuery.setStoreIds(new ArrayList<>()); List<CoachSerchVO> data = coachClient.listAll(coachQuery); - List<String> province = new ArrayList<>(); - for (Coach coach : list1) { + for (CoachSerchVO coach : data) { province.add(coach.getProvince()); } + HashSet<String> set = new HashSet<String>(province); String roleid = UserExt.getUser().getRoleid(); model.addAttribute("role",roleid); model.addAttribute("data",data); - model.addAttribute("list",province); + model.addAttribute("list",set); model.addAttribute("objectType",objectType); model.addAttribute("objectId",objectId); return PREFIX + "TCoach.html"; @@ -67,7 +72,16 @@ @RequestMapping(value = "/getCity") @ResponseBody public List<Coach> getCity(String province) { - return coachClient.getCity(province); + List<Coach> city = coachClient.getCity(province); + List<Coach> res = new ArrayList<>(); + List<String> list = new ArrayList<>(); + for (Coach coach : city) { + if (!list.contains(coach.getCity())){ + res.add(coach); + list.add(coach.getCity()); + } + } + return res; } /** @@ -89,7 +103,6 @@ CoachQuery coachQuery = new CoachQuery(); List<CoachSerchVO> data = coachClient.listAll(coachQuery); List<CoachType> list = coachTypeClient.list(); - String roleid = UserExt.getUser().getRoleid(); model.addAttribute("role",roleid); model.addAttribute("data",data); @@ -99,6 +112,7 @@ model.addAttribute("coachType",list); return PREFIX + "TCoach_add.html"; } + /** * 添加教练 */ @@ -107,15 +121,11 @@ public ResultUtil addCoach(@RequestBody Coach coach) { Integer objectId = UserExt.getUser().getObjectId(); if (UserExt.getUser().getObjectType() == 2){ - CityManager cityManager = cityManagerClient.queryCityManagerById(objectId); - coach.setProvince(cityManager.getProvince()); - coach.setProvinceCode(cityManager.getProvinceCode()); - coach.setCity(cityManager.getCity()); - coach.setCityCode(cityManager.getCityCode()); coach.setCityManagerId(objectId); - } - if (coach.getDiploma().equals("")) coach.setDiploma(null); + if (coach.getDiploma().equals("")) { + coach.setDiploma(null); + } if (coach.getCertificateImg().equals("") ){ coach.setCertificateImg(null); } @@ -139,6 +149,7 @@ coachClient.changeState(vo); return ResultUtil.success(); } + /** * 跳转修改教练页面 */ @@ -177,10 +188,11 @@ model.addAttribute("type",0); String[] split = data.get(0).getCertificateImg().split(","); List<String> pictures = new ArrayList<>(Arrays.asList(split)); - model.addAttribute("pictures",pictures); + model.addAttribute("pictures",data.get(0).getCertificateImg()); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String birthday = format.format(data.get(0).getBirthday()); model.addAttribute("birthday",birthday); + model.addAttribute("diploma",data.get(0).getDiploma()); return PREFIX + "TCoach_edit.html"; } /** @@ -230,6 +242,8 @@ /** * 获取教练列表 */ + @Autowired + private IStoreService storeService; @RequestMapping(value = "/list") @ResponseBody public List<CoachSerchVO> list(String province, String city, String name, String phone) { @@ -238,6 +252,16 @@ coachQuery.setCity(city); coachQuery.setName(name); coachQuery.setPhone(phone); + Integer objectType = UserExt.getUser().getObjectType(); + if (objectType == 1){ + Integer objectId = UserExt.getUser().getObjectId(); + coachQuery.setOperatorId(objectId); + } + if (objectType == 2){ + Integer objectId = UserExt.getUser().getObjectId(); + coachQuery.setOperatorId(objectId); + } + return coachClient.listAll(coachQuery); } } -- Gitblit v1.7.1