| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.StoreStaffClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.modular.system.model.CoachQuery; |
| | | import com.dsh.guns.modular.system.model.Store; |
| | | import com.dsh.guns.modular.system.model.TCity; |
| | | import com.dsh.guns.modular.system.model.TStore; |
| | | import com.dsh.guns.modular.system.service.ICityService; |
| | | 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; |
| | |
| | | private CityManagerClient cityManagerClient; |
| | | @Autowired |
| | | private StoreStaffClient storeStaffClient; |
| | | @Autowired |
| | | private ICityService cityService; |
| | | /** |
| | | * 跳转体测预约管理首页 |
| | | */ |
| | |
| | | @RequestMapping("/add") |
| | | public String add(Model model) { |
| | | Integer roleType = UserExt.getUser().getObjectType(); |
| | | List<CityManager> province = cityManagerClient.listAll(); |
| | | Set<String> seenNames = new HashSet<>(); |
| | | List<CityManager> result = new ArrayList<>(); |
| | | for (CityManager cityManager : province) { |
| | | if(!seenNames.contains(cityManager.getProvince())){ |
| | | result.add(cityManager); |
| | | seenNames.add(cityManager.getProvince()); |
| | | } |
| | | } |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | if (roleType == 2){ |
| | | Integer cityManagerId = UserExt.getUser().getObjectId(); |
| | | CityManager cityManager = cityManagerClient.queryCityManagerById(cityManagerId); |
| | | List<Store> stores = storeClient.getStoreByCityManagerId(cityManagerId); |
| | | model.addAttribute("stores",stores); |
| | | } |
| | | model.addAttribute("list",result); |
| | | model.addAttribute("list",list); |
| | | |
| | | model.addAttribute("roleType",roleType); |
| | | return PREFIX + "TBodySideAppointment_add.html"; |
| | |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | BodySideAppointment data = bodySideAppointmentClient.getInfoById(id); |
| | | if (roleType == 1){ |
| | | List<CityManager> cityManagers = cityManagerClient.listAll(); |
| | | List<CityManager> province = new ArrayList<>(); |
| | | List<CityManager> city = new ArrayList<>(); |
| | | Set<String> seenNames = new HashSet<>(); |
| | | Set<String> c = new HashSet<>(); |
| | | // 省列表 |
| | | List<CityManager> result = new ArrayList<>(); |
| | | // 市列表 |
| | | List<CityManager> cities = new ArrayList<>(); |
| | | // 对省/市去重 |
| | | for (CityManager cityManager : cityManagers) { |
| | | if(!seenNames.contains(cityManager.getProvince())){ |
| | | result.add(cityManager); |
| | | seenNames.add(cityManager.getProvince()); |
| | | } |
| | | if(!c.contains(cityManager.getProvince())){ |
| | | cities.add(cityManager); |
| | | c.add(cityManager.getProvince()); |
| | | } |
| | | } |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | TCity province1 = cityService.getOne(new QueryWrapper<TCity>().eq("name", data.getProvince())); |
| | | List<TCity> city = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, province1.getId())); |
| | | model.addAttribute("list",list); |
| | | List<Store> stores = storeClient.getStore(data.getCity()); |
| | | model.addAttribute("stores",stores); |
| | | model.addAttribute("list",result); |
| | | model.addAttribute("cities",cities); |
| | | model.addAttribute("cities",city); |
| | | }else if (roleType == 2){ |
| | | List<Store> stores = storeClient.getStoreByCityManagerId(objectId); |
| | | model.addAttribute("stores",stores); |
| | |
| | | return queryBodySideAppointmentVOS; |
| | | } |
| | | |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | /** |
| | | * 添加/修改体测预约记录 |
| | | */ |
| | |
| | | // 获取当前登录人id |
| | | Integer cityManagerId = UserExt.getUser().getObjectId(); |
| | | if (roleType == 2){ |
| | | CityManager cityManager = cityManagerClient.queryCityManagerById(cityManagerId); |
| | | TStore cityManager = storeService.getById(vo.getStoreId()); |
| | | vo.setProvince(cityManager.getProvince()); |
| | | vo.setProvinceCode(cityManager.getProvinceCode()); |
| | | vo.setCity(cityManager.getCity()); |