| | |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TBranchOfficeResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TDriverResp; |
| | | import com.stylefeng.guns.modular.system.enums.StatusEnum; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ITRegionService; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemConfigService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | |
| | | * 跳转区域页面新增 |
| | | */ |
| | | @RequestMapping("/areaPageAdd") |
| | | public String areaPageAdd(Model model) { |
| | | List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",tRegions); |
| | | return PREFIX + "tBranchOfficeAreaAdd.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转区域页面编辑 |
| | | */ |
| | | @RequestMapping("/areaPageUpdate") |
| | | public String areaPageUpdate(String area,String areaId,Model model) { |
| | | public String areaPageAdd(String area,String areaId,Model model) { |
| | | String[] split1 = areaId.split("/"); |
| | | List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("provinceList",tRegions); |
| | | List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList()); |
| | | // 查询市 |
| | | List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", provinceIds)); |
| | | List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0])); |
| | | model.addAttribute("cityList",tRegions1); |
| | | |
| | | // 查询区 |
| | |
| | | model.addAttribute("districtName",""); |
| | | } |
| | | |
| | | String[] split1 = areaId.split("/"); |
| | | model.addAttribute("provinceId",split1[0]); |
| | | model.addAttribute("cityId",split1[1]); |
| | | if(split1.length>2) { |
| | |
| | | }else { |
| | | model.addAttribute("districtId", ""); |
| | | } |
| | | }else { |
| | | model.addAttribute("provinceName",""); |
| | | model.addAttribute("cityName","split[1]"); |
| | | model.addAttribute("districtName",""); |
| | | |
| | | model.addAttribute("provinceId",""); |
| | | model.addAttribute("cityId","split1[1]"); |
| | | model.addAttribute("districtId", ""); |
| | | } |
| | | return PREFIX + "tBranchOfficeAreaAdd.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转区域页面编辑 |
| | | */ |
| | | @RequestMapping("/areaPageUpdate") |
| | | public String areaPageUpdate(String area,String areaId,Model model) { |
| | | |
| | | String[] split = area.split("/"); |
| | | model.addAttribute("provinceName",split[0]); |
| | | model.addAttribute("cityName",split[1]); |
| | | if(split.length>2){ |
| | | model.addAttribute("districtName",split[2]); |
| | | }else { |
| | | model.addAttribute("districtName",""); |
| | | } |
| | | |
| | | String[] split1 = areaId.split("/"); |
| | | String provinceId = split1[0]; |
| | | model.addAttribute("provinceId",split1[0]); |
| | | model.addAttribute("cityId",split1[1]); |
| | | 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)); |
| | | model.addAttribute("provinceList",tRegions); |
| | | // List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList()); |
| | | // 查询市 |
| | | List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", provinceId)); |
| | | model.addAttribute("cityList",tRegions1); |
| | | |
| | | // 查询区 |
| | | List<Integer> cityIds = tRegions1.stream().map(TRegion::getId).collect(Collectors.toList()); |
| | | List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", cityIds)); |
| | | model.addAttribute("districtList",tRegions2); |
| | | |
| | | return PREFIX + "tBranchOfficeAreaUpdate.html"; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | public Object areaCity(Integer parentId,Model model) { |
| | | List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", parentId)); |
| | | /*if(CollectionUtils.isEmpty(tRegions) && StringUtils.hasLength(parentName)){ |
| | | TRegion parent = tRegionService.selectOne(new EntityWrapper<TRegion>().eq("name", parentName)); |
| | | tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", parentId)); |
| | | }*/ |
| | | model.addAttribute("list",tRegions); |
| | | return tRegions; |
| | | } |
| | |
| | | @ResponseBody |
| | | public Object start(Integer id) { |
| | | TBranchOffice tBranchOffice = tBranchOfficeService.selectById(id); |
| | | tBranchOffice.setStatus(1); |
| | | tBranchOffice.setStatus(StatusEnum.NORMAL.getCode()); |
| | | tBranchOfficeService.updateById(tBranchOffice); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | @ResponseBody |
| | | public Object updateStatus(Integer id) { |
| | | TBranchOffice tBranchOffice = tBranchOfficeService.selectById(id); |
| | | tBranchOffice.setStatus(2); |
| | | tBranchOffice.setStatus(StatusEnum.FREEZE.getCode()); |
| | | tBranchOfficeService.updateById(tBranchOffice); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | if(Objects.nonNull(o)){ |
| | | return o; |
| | | } |
| | | tBranchOffice.setStatus(1); |
| | | tBranchOffice.setStatus(StatusEnum.NORMAL.getCode()); |
| | | |
| | | tBranchOfficeService.insert(tBranchOffice); |
| | | return SUCCESS_TIP; |
| | |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tBranchOfficeId) { |
| | | tBranchOfficeService.deleteById(tBranchOfficeId); |
| | | TBranchOffice tBranchOffice = tBranchOfficeService.selectById(tBranchOfficeId); |
| | | tBranchOffice.setStatus(StatusEnum.DELETE.getCode()); |
| | | tBranchOfficeService.updateById(tBranchOffice); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |