package com.doumee.service.business.impl;
|
|
import com.doumee.biz.system.SystemDictDataBiz;
|
import com.doumee.core.constants.ResponseStatus;
|
import com.doumee.core.exception.BusinessException;
|
import com.doumee.core.model.LoginUserInfo;
|
import com.doumee.core.model.PageData;
|
import com.doumee.core.model.PageWrap;
|
import com.doumee.core.utils.Constants;
|
import com.doumee.core.utils.Utils;
|
import com.doumee.dao.business.CompanyChangeJoinMapper;
|
import com.doumee.dao.business.CompanyChangeMapper;
|
import com.doumee.dao.business.CompanyMapper;
|
import com.doumee.dao.business.MultifileMapper;
|
import com.doumee.dao.business.model.*;
|
import com.doumee.dao.system.SystemUserMapper;
|
import com.doumee.dao.system.model.SystemUser;
|
import com.doumee.service.business.AreasService;
|
import com.doumee.service.business.CompanyChangeService;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.doumee.service.business.CompanyService;
|
import com.doumee.service.business.MultifileService;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import org.apache.commons.lang3.StringUtils;
|
import org.apache.shiro.SecurityUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.context.annotation.Lazy;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.util.CollectionUtils;
|
|
import javax.validation.constraints.NotNull;
|
import java.util.*;
|
import java.util.stream.Collectors;
|
|
/**
|
* 企业变更信息记录表Service实现
|
* @author 江蹄蹄
|
* @date 2023/02/15 08:55
|
*/
|
@Service
|
public class CompanyChangeServiceImpl implements CompanyChangeService {
|
|
@Autowired
|
private CompanyChangeMapper companyChangeMapper;
|
|
@Autowired
|
CompanyChangeJoinMapper companyChangeJoinMapper;
|
|
@Autowired
|
CompanyMapper companyMapper;
|
|
@Lazy
|
@Autowired
|
CompanyService companyService;
|
|
@Autowired
|
AreasService areasService;
|
|
|
@Autowired
|
private MultifileService multifileService;
|
|
@Autowired
|
private MultifileMapper multifileMapper;
|
|
@Autowired
|
SystemUserMapper systemUserMapper;
|
|
@Autowired
|
SystemDictDataBiz systemDictDataBiz;
|
|
@Override
|
public Integer create(CompanyChange companyChange) {
|
if(
|
StringUtils.isBlank(companyChange.getName())||
|
companyChange.getAreaId()==null||
|
companyChange.getCityId()==null||
|
StringUtils.isBlank(companyChange.getCreditCode())||
|
StringUtils.isBlank(companyChange.getLegalPerson())||
|
CollectionUtils.isEmpty(companyChange.getFileList()) ||
|
CollectionUtils.isEmpty(companyChange.getChangeFileList())
|
){
|
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "请按要求填写变更信息");
|
}
|
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
|
Company company = companyMapper.selectById(user.getCompanyId());
|
|
deleteOldChanceByCompanyId(companyChange.getCompanyId());
|
|
if (Objects.isNull(company)){
|
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,企业信息不存在!");
|
}
|
companyChange.setStatus(Constants.ZERO);//待审核
|
companyChange.setIsdeleted(Constants.ZERO);
|
companyChange.setCreateDate(new Date());
|
companyChange.setCreator(user.getId());
|
companyChange.setCompanyId(user.getCompanyId());
|
companyChangeMapper.insert(companyChange);
|
|
//更新文件表
|
//添加营业执照
|
if (!CollectionUtils.isEmpty(companyChange.getFileList())){
|
companyChange.getFileList().stream().forEach(s->{
|
|
if(StringUtils.isEmpty(s.getFileurl())){
|
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "请上传营业执照!");
|
}
|
Multifile multifile = new Multifile();
|
multifile.setIsdeleted(Constants.ZERO);
|
multifile.setCreateDate(new Date());
|
multifile.setObjId(companyChange.getId());
|
multifile.setType(Constants.ZERO);
|
multifile.setObjType(Constants.MultiFile.COMPANY_CHANGE_LICENSE.getKey());
|
multifile.setName(s.getName());
|
multifile.setFileurl(s.getFileurl());
|
multifile.setType(s.getType());
|
multifileService.create(multifile);
|
});
|
}
|
|
//添加工商变更登记图
|
if(org.apache.commons.collections.CollectionUtils.isNotEmpty(companyChange.getChangeFileList())){
|
companyChange.getChangeFileList().stream().forEach(s -> {
|
if(StringUtils.isEmpty(s.getFileurl())){
|
return;
|
}
|
s.setIsdeleted(Constants.ZERO);
|
s.setCreateDate(new Date());
|
s.setObjId(companyChange.getId());
|
s.setType(Constants.ZERO);
|
s.setObjType(Constants.MultiFile.COMPANY_CHANGE_CHANGE.getKey());
|
multifileService.create(s);
|
});
|
|
}
|
|
return companyChange.getId();
|
}
|
|
|
private void deleteOldChanceByCompanyId(Integer companyId){
|
CompanyChange companyChange = new CompanyChange();
|
companyChange.setCompanyId(companyId);
|
companyChange.setStatus(Constants.ZERO);
|
UpdateWrapper<CompanyChange> deleteWrapper = new UpdateWrapper<>(companyChange);
|
companyChangeMapper.delete(deleteWrapper);
|
|
}
|
@Override
|
public void deleteById(Integer id) {
|
companyChangeMapper.deleteById(id);
|
}
|
|
@Override
|
public void delete(CompanyChange companyChange) {
|
UpdateWrapper<CompanyChange> deleteWrapper = new UpdateWrapper<>(companyChange);
|
companyChangeMapper.delete(deleteWrapper);
|
}
|
|
@Override
|
public void deleteByIdInBatch(List<Integer> ids) {
|
if (CollectionUtils.isEmpty(ids)) {
|
return;
|
}
|
companyChangeMapper.deleteBatchIds(ids);
|
}
|
|
@Override
|
public void updateById(CompanyChange companyChange) {
|
companyChangeMapper.updateById(companyChange);
|
}
|
|
@Override
|
public void updateByIdInBatch(List<CompanyChange> companyChanges) {
|
if (CollectionUtils.isEmpty(companyChanges)) {
|
return;
|
}
|
for (CompanyChange companyChange: companyChanges) {
|
this.updateById(companyChange);
|
}
|
}
|
|
@Override
|
public CompanyChange findById(Integer id) {
|
return companyChangeMapper.selectById(id);
|
}
|
|
@Override
|
public CompanyChange findOne(CompanyChange companyChange) {
|
QueryWrapper<CompanyChange> wrapper = new QueryWrapper<>(companyChange);
|
return companyChangeMapper.selectOne(wrapper);
|
}
|
|
@Override
|
public List<CompanyChange> findList(CompanyChange companyChange) {
|
QueryWrapper<CompanyChange> wrapper = new QueryWrapper<>(companyChange);
|
return companyChangeMapper.selectList(wrapper);
|
}
|
|
@Override
|
public PageData<CompanyChange> findPage(PageWrap<CompanyChange> pageWrap) {
|
IPage<CompanyChange> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
|
QueryWrapper<CompanyChange> queryWrapper = new QueryWrapper<>();
|
Utils.MP.blankToNull(pageWrap.getModel());
|
if (pageWrap.getModel().getId() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getId, pageWrap.getModel().getId());
|
}
|
|
if (pageWrap.getModel().getCreator() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getCreator, pageWrap.getModel().getCreator());
|
}
|
if (pageWrap.getModel().getCreateDate() != null) {
|
queryWrapper.lambda().ge(CompanyChange::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
|
queryWrapper.lambda().le(CompanyChange::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
|
}
|
if (pageWrap.getModel().getEditor() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getEditor, pageWrap.getModel().getEditor());
|
}
|
if (pageWrap.getModel().getEditDate() != null) {
|
queryWrapper.lambda().ge(CompanyChange::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
|
queryWrapper.lambda().le(CompanyChange::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
|
}
|
if (pageWrap.getModel().getIsdeleted() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getIsdeleted, pageWrap.getModel().getIsdeleted());
|
}
|
if (pageWrap.getModel().getCompanyId() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getCompanyId, pageWrap.getModel().getCompanyId());
|
}
|
if (pageWrap.getModel().getName() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getName, pageWrap.getModel().getName());
|
}
|
if (pageWrap.getModel().getRemark() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getRemark, pageWrap.getModel().getRemark());
|
}
|
if (pageWrap.getModel().getLegalPerson() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getLegalPerson, pageWrap.getModel().getLegalPerson());
|
}
|
if (pageWrap.getModel().getAreaId() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getAreaId, pageWrap.getModel().getAreaId());
|
}
|
if (pageWrap.getModel().getCityId() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getCityId, pageWrap.getModel().getCityId());
|
}
|
if (pageWrap.getModel().getCreditCode() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getCreditCode, pageWrap.getModel().getCreditCode());
|
}
|
if (pageWrap.getModel().getStatus() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getStatus, pageWrap.getModel().getStatus());
|
}
|
if (pageWrap.getModel().getCheckor() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getCheckor, pageWrap.getModel().getCheckor());
|
}
|
if (pageWrap.getModel().getCheckDate() != null) {
|
queryWrapper.lambda().ge(CompanyChange::getCheckDate, Utils.Date.getStart(pageWrap.getModel().getCheckDate()));
|
queryWrapper.lambda().le(CompanyChange::getCheckDate, Utils.Date.getEnd(pageWrap.getModel().getCheckDate()));
|
}
|
if (pageWrap.getModel().getCheckInfo() != null) {
|
queryWrapper.lambda().eq(CompanyChange::getCheckInfo, pageWrap.getModel().getCheckInfo());
|
}
|
for(PageWrap.SortData sortData: pageWrap.getSorts()) {
|
if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
|
queryWrapper.orderByDesc(sortData.getProperty());
|
} else {
|
queryWrapper.orderByAsc(sortData.getProperty());
|
}
|
}
|
return PageData.from((companyChangeMapper.selectPage(page,queryWrapper)));
|
}
|
|
@Override
|
public PageData<CompanyChange> findCompanyChangePage(PageWrap<CompanyChange> pageWrap) {
|
|
IPage<CompanyChange> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
|
|
MPJLambdaWrapper<CompanyChange> mpjWrapper = new MPJLambdaWrapper<>();
|
mpjWrapper.leftJoin(Company.class,Company::getId,CompanyChange::getCompanyId)
|
.in(Company::getType,Arrays.asList(Constants.CompanyType.BUSINESS_COMPANYTYPE.getValue(),
|
Constants.CompanyType.SERVICE_COMPANYTYPE.getValue(),Constants.CompanyType.ZF_SERVICE_COMPANY.getValue()))
|
.like(StringUtils.isNotEmpty(pageWrap.getModel().getName()),Company::getName,pageWrap.getModel().getCompanyName())
|
.eq(Objects.nonNull(pageWrap.getModel().getStatus()),CompanyChange::getStatus,pageWrap.getModel().getStatus())
|
.selectAll(CompanyChange.class)
|
.selectAs(Company::getName,CompanyChange::getCompanyName)
|
.selectAs(Company::getType,CompanyChange::getCompanyType)
|
.selectAs(Company::getCityId,CompanyChange::getCompanyCityId)
|
.selectAs(Company::getAreaId,CompanyChange::getCompanyAreaId)
|
.selectAs(Company::getRegisterDate,CompanyChange::getCompanyRegisterDate)
|
.selectAs(Company::getAddress,CompanyChange::getCompanyAddress)
|
.orderByDesc(CompanyChange::getCreateDate);
|
|
IPage<CompanyChange> companyChangeIPage = companyChangeJoinMapper.selectPage(page, mpjWrapper);
|
// companyChangeIPage.getRecords().stream().forEach(s->s.setCompanyAddress(getAddress(s.getCompanyCityId(),s.getCompanyAreaId())));
|
return PageData.from(companyChangeIPage);
|
}
|
|
@Override
|
public long count(CompanyChange companyChange) {
|
QueryWrapper<CompanyChange> wrapper = new QueryWrapper<>(companyChange);
|
return companyChangeMapper.selectCount(wrapper);
|
}
|
|
|
@Override
|
public CompanyChange getCompanyChance(@NotNull Integer companyId) {
|
|
CompanyChange companyChange = this.findLastOneByCompanyId(companyId);
|
if (Objects.isNull(companyChange)){
|
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "该企业不存在变更申请数据");
|
}
|
|
String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+ systemDictDataBiz.queryByCode(Constants.OSS,Constants.COMPANY_FILE).getCode();
|
|
|
String address = getAddress(companyChange.getCityId(), companyChange.getAreaId());
|
Areas city = areasService.findById(companyChange.getCityId(), Constants.ONE);
|
CompanyChange company = new CompanyChange();
|
company.setName(companyChange.getName());
|
company.setCreditCode(companyChange.getCreditCode());
|
company.setCityId(companyChange.getCityId());
|
company.setAreaId(companyChange.getAreaId());
|
company.setProvinceId(city.getProvinceId());
|
company.setCompanyAddress(address);
|
company.setLegalPerson(companyChange.getLegalPerson());
|
company.setStatus(companyChange.getStatus());
|
company.setCheckInfo(companyChange.getCheckInfo());
|
Multifile multifile =new Multifile();
|
multifile.setObjId(companyChange.getId());
|
List<Multifile> list = multifileService.findList(multifile);
|
if (!CollectionUtils.isEmpty(list)){
|
List<Multifile> multifiles = list.stream()
|
.filter(s -> Constants.MultiFile.COMPANY_CHANGE_LICENSE.getKey() == s.getObjType())
|
.map(s->{
|
s.setFileurlfull(path+s.getFileurl());
|
return s;
|
})
|
.collect(Collectors.toList());
|
company.setFileList(multifiles);
|
List<String> fileUrls = list.stream()
|
.filter(s -> Constants.MultiFile.COMPANY_CHANGE_LICENSE.getKey() == s.getObjType())
|
.map(s->path+s.getFileurl()).collect(Collectors.toList());
|
company.setFileurls(fileUrls);
|
|
List<String> changeFileUrls = list.stream()
|
.filter(s -> Constants.MultiFile.COMPANY_CHANGE_CHANGE.getKey() == s.getObjType())
|
.map(s-> path + s.getFileurl()).collect(Collectors.toList());
|
company.setFileChangeUrls(changeFileUrls);
|
List<Multifile> changeMultifiles = list.stream()
|
.filter(s -> Constants.MultiFile.COMPANY_CHANGE_CHANGE.getKey() == s.getObjType())
|
.map(s->{
|
s.setFileurlfull(path+s.getFileurl());
|
return s;
|
})
|
.collect(Collectors.toList());
|
|
company.setChangeFileList(changeMultifiles);
|
}
|
return company;
|
}
|
|
|
/**
|
* 获取最新的公司变更
|
* @param companyId
|
* @return
|
*/
|
private CompanyChange findLastOneByCompanyId(Integer companyId){
|
QueryWrapper<CompanyChange> wrapper = new QueryWrapper<>();
|
wrapper.lambda().eq(CompanyChange::getCompanyId,companyId)
|
.orderByDesc(CompanyChange::getCreateDate).last("limit 1");
|
CompanyChange companyChange = companyChangeMapper.selectOne(wrapper);
|
return companyChange;
|
}
|
|
@Transactional(rollbackFor = {BusinessException.class, Exception.class})
|
@Override
|
public void checkCompanyChang(CompanyChange companyChange) {
|
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
|
CompanyChange realCompanyChance = findById(companyChange.getId());
|
if (Constants.ZERO != Constants.formatIntegerNum(realCompanyChance.getStatus())){
|
throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"当前审批已完成");
|
}
|
|
if (Constants.ONE == Constants.formatIntegerNum(companyChange.getStatus())){
|
//如果审核通过
|
// CompanyChange lastCompanyChange = this.findLastOneByCompanyId(realCompanyChance.getCompanyId());
|
QueryWrapper<Company> companyWrapper = new QueryWrapper<>();
|
companyWrapper.lambda().and(wrapper->wrapper
|
.eq(Company::getName,realCompanyChance.getName())
|
.or()
|
.eq(Company::getCreditCode,realCompanyChance.getCreditCode())
|
);
|
companyWrapper
|
.lambda().eq(Company::getIsdeleted,Constants.ZERO);
|
companyWrapper
|
.lambda().ne(Company::getId,realCompanyChance.getCompanyId());
|
|
if (companyMapper.selectCount(companyWrapper)> Constants.ZERO){
|
throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"公司名称或者统一信用代码用重复,请联系相关工作人员");
|
}
|
Company chanceCompany = new Company();
|
chanceCompany.setId(realCompanyChance.getCompanyId());
|
chanceCompany.setName(realCompanyChance.getName());
|
chanceCompany.setCreditCode(realCompanyChance.getCreditCode());
|
chanceCompany.setLegalPerson(realCompanyChance.getLegalPerson());
|
chanceCompany.setCityId(realCompanyChance.getCityId());
|
chanceCompany.setAreaId(realCompanyChance.getAreaId());
|
chanceCompany.setEditDate(new Date());
|
chanceCompany.setEditor(user.getId());
|
companyMapper.updateById(chanceCompany);
|
|
//跟新用户名称
|
if (!StringUtils.isEmpty(realCompanyChance.getName())){
|
QueryWrapper<SystemUser> wrapper = new QueryWrapper<>();
|
wrapper.lambda()
|
.eq(SystemUser::getCompanyId,realCompanyChance.getCompanyId())
|
.in(SystemUser::getType, Constants.UserType.getHasCompanyType())
|
.last("limit 1");
|
SystemUser systemUser1 = systemUserMapper.selectOne(wrapper);
|
if (Objects.nonNull(systemUser1)){
|
SystemUser systemUser = new SystemUser();
|
systemUser.setId(systemUser1.getId());
|
systemUser.setCityId(realCompanyChance.getCityId());
|
systemUser.setAreaId(realCompanyChance.getAreaId());
|
systemUser.setUsername(realCompanyChance.getName());
|
systemUser.setRealname(realCompanyChance.getName());
|
systemUserMapper.updateById(systemUser);
|
}
|
}
|
|
QueryWrapper<Multifile> wrapper = new QueryWrapper();
|
wrapper.lambda()
|
.eq(Multifile::getObjId,realCompanyChance.getId()).eq(Multifile::getObjType,Constants.MultiFile.COMPANY_CHANGE_LICENSE.getKey());
|
//变更附件数据,营业执照,工商变更登记
|
dealMultifiles(realCompanyChance,user);
|
companyChange.setStatus(Constants.ONE);
|
}
|
companyChange.setCheckDate(new Date());
|
companyChange.setCheckor(user.getId());
|
companyChange.setCheckInfo(companyChange.getRemark());
|
companyChangeMapper.updateById(companyChange);
|
}
|
|
/**
|
* 变更附件数据,营业执照,工商变更登记
|
* @param realCompanyChance
|
* @param user
|
*/
|
private void dealMultifiles(CompanyChange realCompanyChance, LoginUserInfo user) {
|
Multifile f = new Multifile();
|
f.setIsdeleted(Constants.ZERO);
|
f.setObjId(realCompanyChance.getId());
|
List<Multifile> fileList = multifileMapper.selectList(new QueryWrapper<>(f));
|
List<Multifile> fileListYyzz = getMultiFileListByObjtype(fileList,Constants.MultiFile.COMPANY_CHANGE_LICENSE.getKey());
|
List<Multifile> fileListGsdj = getMultiFileListByObjtype(fileList,Constants.MultiFile.COMPANY_CHANGE_CHANGE.getKey());
|
deleteAndSaveNewFile(fileListYyzz,realCompanyChance.getCompanyId(),Constants.MultiFile.BUSINESS_LICENSE.getKey(),user);
|
deleteAndSaveNewFile(fileListGsdj,realCompanyChance.getCompanyId(),Constants.MultiFile.BUSINESS_CHANGE.getKey(),user);
|
}
|
|
private void deleteAndSaveNewFile(List<Multifile> list,Integer comId, int key,LoginUserInfo user) {
|
if(list == null || list.size() ==0){
|
return;
|
}
|
//如果营业执照有变更,删除旧数据,新增新数据
|
Multifile tf = new Multifile();
|
tf.setObjId(comId);
|
tf.setObjType(key);
|
multifileService.delete(tf);
|
list.forEach(file->{
|
tf.setIsdeleted(Constants.ZERO);
|
tf.setFileurl(file.getFileurl());
|
tf.setName(file.getName());
|
tf.setType(Constants.MultiFile.multifileType(file.getName()));
|
tf.setCreateDate(new Date());
|
tf.setCreator(user.getId());
|
multifileMapper.insert(tf);
|
});
|
}
|
|
private List<Multifile> getMultiFileListByObjtype(List<Multifile> fileList, int key) {
|
if(fileList==null || fileList.size()==0){
|
return null;
|
}
|
List<Multifile> list = null;
|
for(Multifile item :fileList){
|
if(Constants.equalsInteger(key,item.getObjType())){
|
if(list == null){
|
list = new ArrayList<>();
|
}
|
list.add(item);
|
}
|
}
|
return list;
|
}
|
|
/**
|
* 更新企业附件
|
* @param multifile
|
* @param companyId
|
* @param currentSubject
|
*/
|
private void updateMultifile(Multifile multifile,Integer companyId, LoginUserInfo currentSubject){
|
|
|
Multifile item = new Multifile();
|
item.setIsdeleted(Constants.ZERO);
|
item.setName(multifile.getName());
|
item.setInfo(multifile.getInfo());
|
item.setObjId(companyId);
|
item.setType(multifile.getType());
|
item.setObjType(Constants.formatIntegerNum(multifile.getObjType()) == Constants.MultiFile.COMPANY_CHANGE_LICENSE.getKey()
|
? Constants.MultiFile.BUSINESS_LICENSE.getKey() : Constants.MultiFile.BUSINESS_CHANGE.getKey());
|
item.setFileurl(multifile.getFileurl());
|
item.setCreateDate(new Date());
|
item.setCreator(currentSubject.getId());
|
item.setEditor(currentSubject.getId());
|
item.setEditDate(new Date());
|
multifileService.create(item);
|
|
}
|
|
private String getAddress(Integer cityId,Integer areaId){
|
Areas cityAreas = areasService.findById(cityId, Constants.ONE);
|
Areas areas = areasService.findById(areaId, Constants.TWO);
|
|
String cityName = Optional.ofNullable(cityAreas)
|
.map(s -> s.getProvinceName() + s.getName())
|
.orElseThrow(() -> new BusinessException(ResponseStatus.BAD_REQUEST));
|
String areaName = Optional.ofNullable(areas).map(s -> s.getName()).orElse("");
|
|
return cityName+areaName;
|
}
|
|
}
|