| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.CoachClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | import com.dsh.course.feignClient.account.model.Coach; |
| | | import com.dsh.course.feignClient.course.CoursePackageTypeClient; |
| | | import com.dsh.course.feignClient.course.model.TCoursePackageType; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.modular.system.model.TSite; |
| | | import com.dsh.guns.modular.system.model.TStore; |
| | | import com.dsh.guns.modular.system.service.ICoursePackageService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.service.ITSiteService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/coursePackage") |
| | | public class TCoursePackageController { |
| | | public class TCoursePackageController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/coursePackage/"; |
| | | |
| | |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | |
| | | @Resource |
| | | private CityManagerClient cityManagerClient; |
| | | |
| | | @Autowired |
| | | private ITSiteService siteService; |
| | | |
| | | @Resource |
| | | private CoachClient coachClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @GetMapping("/openCoursePackageListPage") |
| | | public String openCoursePackageListPage(Model model){ |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType(); |
| | | model.addAttribute("coursePackageType", tCoursePackageTypes); |
| | | List<Map<String, Object>> list = storeService.queryProvince(); |
| | | String cityCode = null; |
| | | if(objectType == 2){//城市管理员 |
| | | CityManager cityManager = cityManagerClient.queryCityManagerById(objectId); |
| | | cityCode = cityManager.getCityCode(); |
| | | } |
| | | List<Map<String, Object>> list = storeService.queryProvince(cityCode); |
| | | model.addAttribute("province", list); |
| | | model.addAttribute("objectType", objectType); |
| | | return PREFIX + "coursePackage.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/openAddCoursePackage") |
| | | public String openAddCoursePackage(Model model){ |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType(); |
| | | model.addAttribute("coursePackageType", tCoursePackageTypes); |
| | | String cityCode = null; |
| | | if(objectType == 2){//城市管理员 |
| | | CityManager cityManager = cityManagerClient.queryCityManagerById(objectId); |
| | | cityCode = cityManager.getCityCode(); |
| | | } |
| | | List<Map<String, Object>> list = storeService.queryProvince(cityCode); |
| | | model.addAttribute("province", list); |
| | | Object code = list.get(0).get("code"); |
| | | List<Map<String, Object>> list1 = storeService.queryCity(code.toString(), cityCode); |
| | | model.addAttribute("city", list1); |
| | | String code1 = list1.get(0).get("code").toString(); |
| | | List<TStore> list2 = storeService.list(new QueryWrapper<TStore>().eq("cityCode", code1).eq("state", 1)); |
| | | model.addAttribute("store", list2); |
| | | TStore store = list2.get(0); |
| | | List<TSite> list3 = siteService.list(new QueryWrapper<TSite>().eq("storeId", store.getId()).eq("state", 1)); |
| | | model.addAttribute("site", list3); |
| | | List<Coach> coaches = coachClient.queryCoachByCity(code1); |
| | | model.addAttribute("coach", coaches); |
| | | return PREFIX + "coursePackage_add.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryCity") |
| | | public List<Map<String, Object>> queryCity(Integer code){ |
| | | return storeService.queryCity(code); |
| | | public List<Map<String, Object>> queryCity(String code){ |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | String cityCode = null; |
| | | if(objectType == 2){//城市管理员 |
| | | CityManager cityManager = cityManagerClient.queryCityManagerById(objectId); |
| | | cityCode = cityManager.getCityCode(); |
| | | } |
| | | return storeService.queryCity(code, cityCode); |
| | | } |
| | | |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/queryCoursePackageLists") |
| | | public Object queryCoursePackageLists(String provinceCode, String cityCode, Integer coursePackageTypeId, String name, Integer status, Integer state){ |
| | | Page<Map<String, Object>> mapPage = coursePackageService.queryCoursePackageLists(provinceCode, cityCode, coursePackageTypeId, name, status, state); |
| | | return mapPage; |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | Integer storeId = null; |
| | | if(objectType == 2){//城市管理员 |
| | | CityManager cityManager = cityManagerClient.queryCityManagerById(objectId); |
| | | provinceCode = cityManager.getProvinceCode(); |
| | | cityCode = cityManager.getCityCode(); |
| | | } |
| | | if(objectType == 3) {//城市管理员 |
| | | storeId = objectId; |
| | | } |
| | | Page<Map<String, Object>> mapPage = coursePackageService.queryCoursePackageLists(provinceCode, cityCode, coursePackageTypeId, storeId, name, status, state); |
| | | return super.packForBT(mapPage); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |