nickchange
2023-10-24 1869200173b11ba40149752b648e85af2ab62a1f
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCompetitionController.java
@@ -11,19 +11,24 @@
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.TOperatorCity;
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.service.TOperatorCityService;
import com.dsh.guns.modular.system.service.TOperatorService;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -84,6 +89,17 @@
    @RequestMapping("/tCompetition_update/{id}")
    public String tCarUpdate(@PathVariable Integer id, Model model) {
        Competition competition = competitionClient.queryById(id);
        System.out.println("======competition======"+competition);
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String startTime = formatter.format(competition.getStartTime());
        model.addAttribute("startTime",startTime);
        String endTime = formatter.format(competition.getEndTime());
        model.addAttribute("endTime",endTime);
        String registerEndTime = formatter.format(competition.getRegisterEndTime());
        model.addAttribute("registerEndTime",registerEndTime);
        model.addAttribute("item",competition);
        List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
        TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, competition.getProvinceCode()));
@@ -99,6 +115,13 @@
    @RequestMapping("/tCompetition_info/{id}")
    public String tCarInfo(@PathVariable Integer id, Model model) {
        Competition competition = competitionClient.queryById(id);
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String startTime = formatter.format(competition.getStartTime());
        model.addAttribute("startTime",startTime);
        String endTime = formatter.format(competition.getEndTime());
        model.addAttribute("endTime",endTime);
        String registerEndTime = formatter.format(competition.getRegisterEndTime());
        model.addAttribute("registerEndTime",registerEndTime);
        model.addAttribute("item",competition);
        List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
        TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, competition.getProvinceCode()));
@@ -190,11 +213,11 @@
            }
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
            competition.setStartTime(format1.parse(competition.getSTime()));
            competition.setEndTime(format1.parse(competition.getETime()));
            competition.setRegisterEndTime(format.parse(competition.getREndTime()));
//            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//            SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
//            competition.setStartTime(format1.parse(competition.getSTime()));
//            competition.setEndTime(format1.parse(competition.getETime()));
//            competition.setRegisterEndTime(format.parse(competition.getREndTime()));
            competitionClient.add(competition);
            return new SuccessTip<>();
        }catch (Exception e){
@@ -252,9 +275,17 @@
        }
    }
    @Autowired
    private TOperatorCityService operatorCityService;
    @RequestMapping(value = "/onChange")
    @ResponseBody
    public Object onChange(Integer oneId) {
        System.out.println("======"+oneId);
        List<TOperatorCity> list = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getOperatorId, oneId).eq(TOperatorCity::getType, 2));
            if (list.size()!=0){
                return list;
            }
        try {
            TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, oneId));
            return cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId,one.getId()));