package com.hzs.system.config.controller.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.hzs.common.core.annotation.AccessPermissions;
import com.hzs.common.core.annotation.Log;
import com.hzs.common.core.constant.msg.ConfigMsgConstants;
import com.hzs.common.core.enums.EDelFlag;
import com.hzs.common.core.enums.EOperationMethod;
import com.hzs.common.core.enums.EOperationModule;
import com.hzs.common.core.enums.ERegionType;
import com.hzs.common.core.utils.StringUtils;
import com.hzs.common.core.web.controller.BaseController;
import com.hzs.common.core.web.domain.AjaxResult;
import com.hzs.common.core.web.page.TableDataInfo;
import com.hzs.common.domain.system.config.BdContinent;
import com.hzs.common.security.utils.SecurityUtils;
import com.hzs.common.util.TransactionUtils;
import com.hzs.system.config.service.IBdContinentService;
import com.hzs.system.config.vo.BdContinentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 区域配置 前端控制器
 *
 * @author hzs
 * @since 2023-03-29
 */
@RestController
@RequestMapping("/manage/continent")
public class BdContinentController extends BaseController {

    @Autowired
    private IBdContinentService continentService;

    /**
     * @description: 大洲配置列表
     * @author: zhang jing
     * @date: 2023/3/29 15:04
     * @param: [continentVO]
     * @return: com.hzs.common.core.web.page.TableDataInfo
     **/
    @AccessPermissions("ihgConfigList")
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.SELECT)
    @GetMapping("/list")
    public TableDataInfo list(BdContinentVO continentVO) {
        LambdaQueryWrapper<BdContinent> queryWrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotEmpty(continentVO.getRegionName())) {
            queryWrapper.like(BdContinent::getRegionName, continentVO.getRegionName());
        }

        queryWrapper.eq(BdContinent::getPkParentId, EDelFlag.UN_DELETE.getValue());
        queryWrapper.eq(BdContinent::getRegionType, ERegionType.CONTINENT.getValue());
        queryWrapper.orderByAsc(BdContinent::getSort);
        startPage();
        List<BdContinent> list = continentService.list(queryWrapper);
        List<BdContinentVO> listNew = new ArrayList<>();
        list.forEach(item -> listNew.add(BeanUtil.copyProperties(item, BdContinentVO.class)));
        if (StringUtils.isNotEmpty(continentVO.getRegionName())) {
            if (CollectionUtil.isEmpty(listNew)) {
                LambdaQueryWrapper<BdContinent> queryWrapper1 = new LambdaQueryWrapper<>();
                queryWrapper1.eq(BdContinent::getRegionType, ERegionType.CONTINENT.getValue());
                queryWrapper1.like(BdContinent::getRegionName, continentVO.getRegionName());
                startPage();
                List<BdContinent> sonList = continentService.list(queryWrapper1);
                List<BdContinentVO> sonListNew = new ArrayList<>();
                sonList.forEach(item -> sonListNew.add(BeanUtil.copyProperties(item, BdContinentVO.class)));
                if (CollectionUtil.isNotEmpty(sonList)) {
                    LambdaQueryWrapper<BdContinent> queryWrapper2 = new LambdaQueryWrapper<>();
                    queryWrapper2.eq(BdContinent::getPkId, sonList.get(0).getPkParentId());
                    BdContinent continent = continentService.getOne(queryWrapper2);
                    BdContinentVO continentVO1 = BeanUtil.copyProperties(continent, BdContinentVO.class);
                    continentVO1.setSonList(sonListNew);
                    listNew.add(continentVO1);
                }
            }
        }
        return getDataTable(listNew);
    }

    /**
     * @description: 大区配置列表
     * @author: zhang jing
     * @date: 2023/3/31 15:57
     * @param: [continentVO]
     * @return: com.hzs.common.core.web.page.TableDataInfo
     **/
    @AccessPermissions("areaConfigList")
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.SELECT)
    @GetMapping("/list-region")
    public TableDataInfo listRegion(BdContinentVO continentVO) {
        LambdaQueryWrapper<BdContinent> queryWrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotEmpty(continentVO.getRegionName())) {
            queryWrapper.like(BdContinent::getRegionName, continentVO.getRegionName());
        }
        Integer pkCountry = SecurityUtils.getPkCountry();
        queryWrapper.eq(BdContinent::getPkCountry, pkCountry);
        queryWrapper.eq(BdContinent::getPkParentId, EDelFlag.UN_DELETE.getValue());
        queryWrapper.eq(BdContinent::getRegionType, ERegionType.REGION.getValue());
        queryWrapper.orderByAsc(BdContinent::getSort);
        startPage();
        List<BdContinent> list = continentService.list(queryWrapper);
        List<BdContinentVO> listNew = new ArrayList<>();
        list.forEach(item -> listNew.add(BeanUtil.copyProperties(item, BdContinentVO.class)));
        if (StringUtils.isNotEmpty(continentVO.getRegionName())) {
            if (CollectionUtil.isEmpty(listNew)) {
                LambdaQueryWrapper<BdContinent> queryWrapper1 = new LambdaQueryWrapper<>();
                queryWrapper1.eq(BdContinent::getPkCountry, pkCountry);
                queryWrapper1.eq(BdContinent::getRegionType, ERegionType.REGION.getValue());
                queryWrapper1.like(BdContinent::getRegionName, continentVO.getRegionName());
                startPage();
                List<BdContinent> sonList = continentService.list(queryWrapper1);
                List<BdContinentVO> sonListNew = new ArrayList<>();
                sonList.forEach(item -> sonListNew.add(BeanUtil.copyProperties(item, BdContinentVO.class)));
                if (CollectionUtil.isNotEmpty(sonList)) {
                    LambdaQueryWrapper<BdContinent> queryWrapper2 = new LambdaQueryWrapper<>();
                    queryWrapper2.eq(BdContinent::getPkId, sonList.get(0).getPkParentId());
                    BdContinent continent = continentService.getOne(queryWrapper2);
                    BdContinentVO continentVO1 = BeanUtil.copyProperties(continent, BdContinentVO.class);
                    continentVO1.setSonList(sonListNew);
                    listNew.add(continentVO1);
                }
            }
        }
        return getDataTable(listNew);
    }

    /**
     * @description: 根据父级查询子级集合-洲际配置
     * @author: zhang jing
     * @date: 2023/3/31 9:25
     * @param: [continentVO]
     * @return: com.hzs.common.core.web.page.TableDataInfo
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.SELECT)
    @GetMapping("/sonlist")
    public AjaxResult sonlist(BdContinentVO continentVO) {

        if (StringUtils.isNull(continentVO.getPkParentId())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.UPPER_LEVEL_NOT_NULL));
        }
        Integer pkCountry = SecurityUtils.getPkCountry();
        List<BdContinentVO> list = continentService.sonlist(continentVO);
        list.forEach(itm -> {
            LambdaQueryWrapper<BdContinent> queryWrapper = new LambdaQueryWrapper<>();
            queryWrapper.eq(BdContinent::getPkCountry, pkCountry);
            queryWrapper.eq(BdContinent::getPkParentId, itm.getPkId());
            queryWrapper.eq(BdContinent::getRegionType, ERegionType.COUNTRY.getValue());
            List<BdContinent> sonList = continentService.list(queryWrapper);
            if (CollectionUtil.isNotEmpty(sonList)) {
                //存在下一级
                itm.setIsExist(0);
            } else {
                itm.setIsExist(1);
            }
        });
        return AjaxResult.success(list);
    }

    /**
     * @description: 查询子级大区或省
     * @author: zhang jing
     * @date: 2023/3/31 16:08
     * @param: [continentVO]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.SELECT)
    @GetMapping("/sonlist-region")
    public AjaxResult sonlistRegion(BdContinentVO continentVO) {
        if (StringUtils.isNull(continentVO.getPkParentId())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.UPPER_LEVEL_NOT_NULL));
        }
        Integer pkCountry = SecurityUtils.getPkCountry();
        List<BdContinentVO> list = continentService.sonlistRegion(continentVO);
        list.forEach(item -> {
            LambdaQueryWrapper<BdContinent> queryWrapper = new LambdaQueryWrapper<>();
            queryWrapper.eq(BdContinent::getPkCountry, pkCountry);
            queryWrapper.eq(BdContinent::getPkParentId, item.getPkId());
            queryWrapper.eq(BdContinent::getRegionType, ERegionType.PROVINCE.getValue());
            List<BdContinent> sonList = continentService.list(queryWrapper);
            if (CollectionUtil.isNotEmpty(sonList)) {
                //存在下一级
                item.setIsExist(0);
            } else {
                item.setIsExist(1);
            }
        });
        return AjaxResult.success(list);
    }

    /**
     * @description: 根据州查询州关联的国家
     * @author: zhang jing
     * @date: 2023/3/31 9:25
     * @param: [continentVO]
     * @return: com.hzs.common.core.web.page.TableDataInfo
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.SELECT)
    @GetMapping("/countrylist")
    public AjaxResult countryList(BdContinentVO continentVO) {
        if (StringUtils.isNull(continentVO.getPkParentId())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.UPPER_LEVEL_NOT_NULL));
        }
        continentVO.setRegionType(ERegionType.COUNTRY.getValue());
        List<BdContinentVO> selectBdAccountList = continentService.selectRegionList(continentVO);
        return AjaxResult.success(selectBdAccountList);
    }

    /**
     * @description: 查询关联的省
     * @author: zhang jing
     * @date: 2023/3/31 9:25
     * @param: [continentVO]
     * @return: com.hzs.common.core.web.page.TableDataInfo
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.SELECT)
    @GetMapping("/provincelist")
    public AjaxResult provinceList(BdContinentVO continentVO) {
        if (StringUtils.isNull(continentVO.getPkParentId())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.UPPER_LEVEL_NOT_NULL));
        }
        continentVO.setRegionType(ERegionType.PROVINCE.getValue());
        List<BdContinentVO> selectBdAccountList = continentService.selectProvinceList(continentVO);
        return AjaxResult.success(selectBdAccountList);
    }


    /**
     * @description: 新增大洲配置
     * @author: zhang jing
     * @date: 2023/3/29 15:09
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.INSERT)
    @PostMapping("/save")
    public AjaxResult save(@RequestBody BdContinent continent) {
        if (StringUtils.isEmpty(continent.getRegionName())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.CONTINENT_NAME_NOT_NULL));
        }
        if (StringUtils.isNull(continent.getSort())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.HO_SORT_NOT_NULL));
        }
        Integer pkCountry = SecurityUtils.getPkCountry();
        LambdaQueryWrapper<BdContinent> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BdContinent::getPkCountry, pkCountry);
        queryWrapper.eq(BdContinent::getSort, continent.getSort());
        queryWrapper.eq(BdContinent::getRegionType, ERegionType.CONTINENT.getValue());
        List<BdContinent> list = continentService.list(queryWrapper);
        if (CollectionUtil.isNotEmpty(list)) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.HO_SORT_NOT_REPEAT));
        }
        continent.setCreationTime(new Date());
        continent.setPkCreator(SecurityUtils.getUserId());
        continent.setPkCountry(pkCountry);
        return AjaxResult.success(continentService.save(continent));
    }

    /**
     * @description: 新增大区配置
     * @author: zhang jing
     * @date: 2023/3/29 15:09
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.INSERT)
    @PostMapping("/saveRegion")
    public AjaxResult saveRegion(@RequestBody BdContinent continent) {
        if (StringUtils.isEmpty(continent.getRegionName())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.REGION_NAME_NOT_NULL));
        }
        if (StringUtils.isNull(continent.getSort())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.HO_SORT_NOT_NULL));
        }
        Integer pkCountry = SecurityUtils.getPkCountry();
        LambdaQueryWrapper<BdContinent> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BdContinent::getPkCountry, pkCountry);
        queryWrapper.eq(BdContinent::getSort, continent.getSort());
        queryWrapper.eq(BdContinent::getRegionType, ERegionType.REGION.getValue());
        List<BdContinent> list = continentService.list(queryWrapper);
        if (CollectionUtil.isNotEmpty(list)) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.HO_SORT_NOT_REPEAT));
        }
        continent.setRegionType(ERegionType.REGION.getValue());
        continent.setCreationTime(new Date());
        continent.setPkCreator(SecurityUtils.getUserId());
        continent.setPkCountry(pkCountry);
        return AjaxResult.success(continentService.save(continent));
    }

    /**
     * @description: 新增二级大州
     * @author: zhang jing
     * @date: 2023/3/30 15:11
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.INSERT)
    @PostMapping("/saveTwoStage")
    public AjaxResult saveTwoStage(@RequestBody BdContinent continent) {
        if (StringUtils.isEmpty(continent.getRegionName())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.CONTINENT_AREA_NAME_NOT_NULL));
        }
        if (StringUtils.isNull(continent.getPkParentId())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.UPPER_LEVEL_NOT_NULL));
        }
        Integer pkCountry = SecurityUtils.getPkCountry();
        continent.setPkCountry(pkCountry);
        continent.setRegionType(ERegionType.CONTINENT.getValue());
        continent.setCreationTime(new Date());
        return AjaxResult.success(continentService.save(continent));
    }

    /**
     * @description: 新增二级大区
     * @author: zhang jing
     * @date: 2023/3/31 15:50
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.INSERT)
    @PostMapping("/saveTwoStageRegion")
    public AjaxResult saveTwoStageRegion(@RequestBody BdContinent continent) {
        if (StringUtils.isEmpty(continent.getRegionName())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.REGION_NAME_NOT_NULL));
        }
        if (StringUtils.isNull(continent.getPkParentId())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.UPPER_LEVEL_NOT_NULL));
        }
        Integer pkCountry = SecurityUtils.getPkCountry();
        continent.setPkCountry(pkCountry);
        continent.setRegionType(ERegionType.REGION.getValue());
        continent.setCreationTime(new Date());
        return AjaxResult.success(continentService.save(continent));
    }

    /**
     * @description: 绑定国家或地区
     * @author: zhang jing
     * @date: 2023/3/30 15:33
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.INSERT)
    @PostMapping("/binding-country")
    public AjaxResult bindingCountry(@RequestBody BdContinentVO continent) {
        if (StringUtils.isNull(continent.getPkParentId())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.PKID_NOT_NULL));
        }
        if (CollectionUtil.isEmpty(continent.getPkAreaIdList())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.BINDING_COUNTRY_NOT_NULL));
        }
        continent.setRegionType(ERegionType.COUNTRY.getValue());
        continent.setCreationTime(new Date());
        for (Integer pkid : continent.getPkAreaIdList()) {
            BdContinent continent1 = BeanUtil.copyProperties(continent, BdContinent.class);
            continent1.setPkAreaId(pkid);
            LambdaQueryWrapper<BdContinent> queryWrapper = new LambdaQueryWrapper<>();
            queryWrapper.eq(BdContinent::getPkParentId, continent.getPkParentId());
            queryWrapper.eq(BdContinent::getPkAreaId, pkid);
            queryWrapper.eq(BdContinent::getRegionType, ERegionType.COUNTRY.getValue());
            if (StringUtils.isNull(continentService.getOne(queryWrapper))) {
                continentService.save(continent1);
            }
        }
        return AjaxResult.success();
    }

    /**
     * @description: 解绑
     * @author: zhang jing
     * @date: 2023/3/31 17:14
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.DELETE)
    @DeleteMapping("/{pkId}")
    public AjaxResult unbinding(@PathVariable Long pkId) {
        if (StringUtils.isNull(pkId)) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.PKID_NOT_NULL));
        }
        LambdaUpdateWrapper<BdContinent> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(BdContinent::getPkId, pkId);
        updateWrapper.set(BdContinent::getDelFlag, EDelFlag.DELETE.getValue());
        updateWrapper.set(BdContinent::getModifiedTime, new Date());
        updateWrapper.set(BdContinent::getPkModified, SecurityUtils.getUserId());
        return AjaxResult.success(continentService.update(updateWrapper));
    }

    /**
     * @description: 绑定省份
     * @author: zhang jing
     * @date: 2023/3/31 15:52
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.INSERT)
    @PostMapping("/binding-province")
    public AjaxResult bindingProvince(@RequestBody BdContinentVO continent) {
        if (StringUtils.isNull(continent.getPkParentId())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.PKID_NOT_NULL));
        }
        if (CollectionUtil.isEmpty(continent.getPkAreaIdList())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.BINDING_PROVINCE_NOT_NULL));
        }
        continent.setRegionType(ERegionType.PROVINCE.getValue());
        continent.setCreationTime(new Date());
        for (Integer pkid : continent.getPkAreaIdList()) {
            BdContinent continent1 = BeanUtil.copyProperties(continent, BdContinent.class);
            continent1.setPkAreaId(pkid);
            LambdaQueryWrapper<BdContinent> queryWrapper = new LambdaQueryWrapper<>();
            queryWrapper.eq(BdContinent::getPkParentId, continent.getPkParentId());
            queryWrapper.eq(BdContinent::getPkAreaId, pkid);
            queryWrapper.eq(BdContinent::getRegionType, ERegionType.PROVINCE.getValue());
            if (StringUtils.isNull(continentService.getOne(queryWrapper))) {
                continentService.save(continent1);
            }
        }
        return AjaxResult.success();
    }

    /**
     * @description: 区域配置查询
     * @author: zhang jing
     * @date: 2023/3/29 15:13
     * @param: [pkId]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.SELECT)
    @GetMapping("/getOne/{pkId}")
    public AjaxResult getOne(@PathVariable Long pkId) {
        BdContinent continent = continentService.getById(pkId);
        return AjaxResult.success(continent);
    }

    /**
     * @description: 修改大洲配置
     * @author: zhang jing
     * @date: 2023/3/29 15:21
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.UPDATE)
    @PostMapping("/update")
    public AjaxResult update(@RequestBody BdContinent continent) {
        if (StringUtils.isEmpty(continent.getRegionName())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.CONTINENT_NAME_NOT_NULL));
        }
        if (StringUtils.isNull(continent.getSort())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.HO_SORT_NOT_NULL));
        }
        continent.setModifiedTime(new Date());
        continent.setPkModified(SecurityUtils.getUserId());
        return AjaxResult.success(continentService.updateById(continent));
    }

    /**
     * @description: 修改大区配置
     * @author: zhang jing
     * @date: 2023/3/31 15:54
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.UPDATE)
    @PostMapping("/update-region")
    public AjaxResult updateRegion(@RequestBody BdContinent continent) {
        if (StringUtils.isEmpty(continent.getRegionName())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.REGION_NAME_NOT_NULL));
        }
        if (StringUtils.isNull(continent.getSort())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.HO_SORT_NOT_NULL));
        }
        continent.setModifiedTime(new Date());
        continent.setPkModified(SecurityUtils.getUserId());
        return AjaxResult.success(continentService.updateById(continent));
    }

    /**
     * @description: 修改二级洲际
     * @author: zhang jing
     * @date: 2023/3/30 15:22
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.UPDATE)
    @PostMapping("/updateTwoStage")
    public AjaxResult updateTwoStage(@RequestBody BdContinent continent) {
        if (StringUtils.isEmpty(continent.getRegionName())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.CONTINENT_AREA_NAME_NOT_NULL));
        }
        continent.setModifiedTime(new Date());
        continent.setPkModified(SecurityUtils.getUserId());
        return AjaxResult.success(continentService.updateById(continent));
    }

    /**
     * @description: 修改二级大区配置
     * @author: zhang jing
     * @date: 2023/3/31 15:56
     * @param: [continent]
     * @return: com.hzs.common.core.web.domain.AjaxResult
     **/
    @Log(module = EOperationModule.CONTINENT, method = EOperationMethod.UPDATE)
    @PostMapping("/update-twoStage-region")
    public AjaxResult updateTwoStageRegion(@RequestBody BdContinent continent) {
        if (StringUtils.isEmpty(continent.getRegionName())) {
            return AjaxResult.error(TransactionUtils.getContent(ConfigMsgConstants.REGION_NAME_NOT_NULL));
        }
        continent.setModifiedTime(new Date());
        continent.setPkModified(SecurityUtils.getUserId());
        return AjaxResult.success(continentService.updateById(continent));
    }

}
