xuhy
2023-06-14 17f18c3d56a70327874aa7dda0adfa2f5e3dafce
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java
@@ -31,6 +31,7 @@
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
@@ -48,6 +49,7 @@
import java.io.OutputStream;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
@@ -129,10 +131,17 @@
     * 跳转到修改
     */
    @RequestMapping("/tDriver_update")
    public String tDriverUpdate( Integer tDriverId, Model model) {
    public String tDriverUpdate( Integer tDriverId, Model model) throws ParseException {
        TDriver tDriver = tDriverService.selectById(tDriverId);
        TDriverResp tDriverResp = new TDriverResp();
        BeanUtils.copyProperties(tDriver,tDriverResp);
        if(Objects.nonNull(tDriverResp.getFirstCertificateTime())){
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            String format1 = format.format(tDriverResp.getFirstCertificateTime());
            tDriverResp.setFirstCertificateTimeStr(format1);
        }
//        tDriverResp.setFirstCertificateTime(format.parse(format1));
        // 查询邀请人
        TDriver tDriver1 = tDriverService.selectById(tDriver.getInviterId());
@@ -147,9 +156,22 @@
        TRegion city = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("code", tDriver.getCityCode())
                .last("LIMIT 1"));
        tDriverResp.setArea(tDriver.getProvinceName()+"/"+tDriver.getCityName()+"/"+tDriver.getAreaName());
        if(Objects.nonNull(district) && Objects.nonNull(city)){
            tDriverResp.setAreaId(city.getParentId()+"/"+city.getId()+"/"+district.getId());
//        tDriverResp.setArea(tDriver.getProvinceName()+"/"+tDriver.getCityName()+"/"+tDriver.getAreaName());
//        if(Objects.nonNull(district) && Objects.nonNull(city)){
//            tDriverResp.setAreaId(city.getParentId()+"/"+city.getId()+"/"+district.getId());
//        }
        if(StringUtils.hasLength(tDriver.getAreaName()) && !tDriver.getAreaName().equals(tDriver.getCityName())){
            tDriverResp.setArea(tDriver.getProvinceName()+"/"+tDriver.getCityName()+"/"+tDriver.getAreaName());
        }else {
            tDriverResp.setArea(tDriver.getProvinceName()+"/"+tDriver.getCityName());
        }
        if(Objects.nonNull(city)){
            if(Objects.nonNull(district) && !district.getCode().equals(city.getCode())){
                tDriverResp.setAreaId(city.getParentId()+"/"+city.getId()+"/"+district.getId());
            }else {
                tDriverResp.setAreaId(city.getParentId()+"/"+city.getId());
            }
        }
        model.addAttribute("item",tDriverResp);
@@ -240,12 +262,20 @@
        String[] split = area.split("/");
        model.addAttribute("provinceName",split[0]);
        model.addAttribute("cityName",split[1]);
        model.addAttribute("districtName",split[2]);
        if(split.length>2){
            model.addAttribute("districtName",split[2]);
        }else {
            model.addAttribute("districtName","");
        }
        String[] split1 = areaId.split("/");
        model.addAttribute("provinceId",split1[0]);
        model.addAttribute("cityId",split1[1]);
        model.addAttribute("districtId",split1[2]);
        if(split1.length>2) {
            model.addAttribute("districtId", split1[2]);
        }else {
            model.addAttribute("districtId", "");
        }
        List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));