| | |
| | | import org.springblade.core.tool.constant.RoleConstant; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.system.entity.Region; |
| | | import org.springblade.system.entity.Tenant; |
| | | import org.springblade.system.service.IDeptService; |
| | | import org.springblade.system.service.IRegionService; |
| | | import org.springblade.system.service.ITenantService; |
| | | import org.springblade.system.vo.RoleVO; |
| | | import org.springblade.system.vo.TenantVo; |
| | |
| | | public class TenantController extends BladeController { |
| | | |
| | | private final ITenantService tenantService; |
| | | |
| | | private final IRegionService iRegionService; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | @ApiOperation(value = "新增或修改", notes = "传入tenant") |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) |
| | | public R submit(@Valid @RequestBody Tenant tenant) { |
| | | //判断省市区的值是否为数字或者中文字符串 |
| | | if(null!=tenant.getProvince()){ |
| | | //如果不是数字,则需调用接口匹配数据(直接取区、县参数) |
| | | if (!tenant.getDistrict().matches("^[0-9]*$") && !tenant.getCity().matches("^[0-9]*$")){ |
| | | Region region = iRegionService.selRegionDetail(tenant.getDistrict(),tenant.getCity()); |
| | | if (null!=region){ |
| | | //封装数据 |
| | | tenant.setProvince(region.getProvinceCode()); |
| | | tenant.setCity(region.getCityCode()); |
| | | tenant.setDistrict(region.getDistrictCode()); |
| | | } |
| | | } |
| | | } |
| | | return R.status(tenantService.submitTenant(tenant)); |
| | | } |
| | | |