package cn.pluss.platform.ys.impl;

import cn.pluss.platform.entity.RegionCodeYs;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.mapper.RegionCodeYsMapper;
import cn.pluss.platform.ys.RegionCodeYsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 银盛地区表 服务实现类
 * </p>
 *
 * @author Djh
 * @since 2021-07-24
 */
@Service
public class RegionCodeYsServiceImpl extends ServiceImpl<RegionCodeYsMapper, RegionCodeYs> implements RegionCodeYsService {

    @Override
    public RegionCodeYs getRegionData(String province, String city, String area) {
        MsgException.checkBlank(province, "省不能为空");
        MsgException.checkBlank(province, "市不能为空");
        MsgException.checkBlank(province, "县区不能为空");

        // 银盛的直辖市的省与市同名
        if (!province.endsWith("省") && !province.endsWith("自治区") && !province.endsWith("市")) {
            province = province + "市";
        }

        if ("新疆维吾尔自治区".equals(province)) {
            province = "新疆维吾尔族自治区";
        }

        /**
         * 暂时
         */
        if (city.startsWith("潜江") || city.startsWith("仙桃") || city.startsWith("天门")) {
            city = "荆门";
        }

        return null;
    }
}
