nickchange
2023-10-24 fc076febec4f1e4b46beeca343f78010d8f8924d
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCoursePackageController.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsh.course.feignClient.account.CityManagerClient;
@@ -14,12 +15,12 @@
import com.dsh.guns.config.UserExt;
import com.dsh.guns.core.base.controller.BaseController;
import com.dsh.guns.core.util.ToolUtil;
import com.dsh.guns.modular.system.model.TCity;
import com.dsh.guns.modular.system.model.TOperator;
import com.dsh.guns.modular.system.model.TSite;
import com.dsh.guns.modular.system.model.TStore;
import com.dsh.guns.modular.system.model.dto.SelectDto;
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 com.dsh.guns.modular.system.service.*;
import com.dsh.guns.modular.system.util.ResultUtil;
import io.swagger.models.auth.In;
import org.aspectj.weaver.ast.Var;
@@ -70,7 +71,8 @@
    @Resource
    private CoursePackageClient coursePackageClient;
    @Autowired
    private ICityService cityService;
@@ -100,18 +102,16 @@
     * @param model
     * @return
     */
    @Autowired
    private TOperatorService operatorService;
    @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);
        String cityCode = null;
        if(objectType == 2){//城市管理员
            CityManager cityManager = cityManagerClient.queryCityManagerById(objectId);
            cityCode = cityManager.getCityCode();
        }
        List<Map<String, Object>> list = storeService.queryProvince(cityCode);
        List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
        model.addAttribute("province", list);
        model.addAttribute("objectType", objectType);
        return PREFIX + "coursePackage.html";
@@ -643,13 +643,22 @@
        Integer objectType = UserExt.getUser().getObjectType();
        Integer objectId = UserExt.getUser().getObjectId();
        String cityCode = null;
        if(objectType == 2){//城市管理员
            CityManager cityManager = cityManagerClient.queryCityManagerById(objectId);
            cityCode = cityManager.getCityCode();
        }
//        if(objectType == 2){//城市管理员
//            CityManager cityManager = cityManagerClient.queryCityManagerById(objectId);
//            cityCode = cityManager.getCityCode();
//        }
        System.out.println("======="+storeService.queryCity(code, cityCode));
//        return storeService.queryCity(code, cityCode);
        return new ResultUtil(0,null,null,storeService.queryCity(code, cityCode),null);
    }
    @ResponseBody
    @PostMapping("/queryCity3")
    public ResultUtil queryCity3(){
        System.out.println("======="+storeService.queryCity1());
//        return storeService.queryCity(code, cityCode);
        return new ResultUtil(0,null,null,storeService.queryCity1(),null);
    }
@@ -692,6 +701,26 @@
        return new ResultUtil(0,0,null,list,null);
    }
    @ResponseBody
    @PostMapping("/queryStore3")
    public ResultUtil queryStore3(){
        List<TStore> list = storeService.list(new QueryWrapper<TStore>().select("id","name").eq("state", 1));
//        Map<String,Integer> map = new LinkedHashMap<>();
        List<SelectDto>  selectDtos = new ArrayList<>();
        Map<String,Integer> map = new HashMap<>();
//        for (TStore store : list) {
//            SelectDto selectDto = new SelectDto();
//            selectDto.setId(Long.valueOf(store.getId()));
//            selectDto.setValue(store.getName());
//               selectDtos.add(selectDto);
//
//        }
//        map.put("options",selectDtos);
        return new ResultUtil(0,0,null,list,null);
    }
    @ResponseBody
    @PostMapping("/queryStore1/")
@@ -1036,7 +1065,7 @@
     */
    @ResponseBody
    @PostMapping("/afterClassExercises")
    public ResultUtil afterClassExercises(Long id, Integer courseId, Integer integral){
    public ResultUtil afterClassExercises(Long id, Integer courseId, Integer integral,Integer packId){
        return coursePackageService.afterClassExercises(id, courseId, integral);
    }