|
@ -25,6 +25,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
@ -164,6 +165,12 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
baseDao.insert(centerEntity); |
|
|
baseDao.insert(centerEntity); |
|
|
if (CollectionUtils.isNotEmpty(formDTO.getMatterList())){ |
|
|
if (CollectionUtils.isNotEmpty(formDTO.getMatterList())){ |
|
|
List<IcPartyServiceCenterMatterEntity> matters = ConvertUtils.sourceToTarget(formDTO.getMatterList(), IcPartyServiceCenterMatterEntity.class); |
|
|
List<IcPartyServiceCenterMatterEntity> matters = ConvertUtils.sourceToTarget(formDTO.getMatterList(), IcPartyServiceCenterMatterEntity.class); |
|
|
|
|
|
Map<String, List<IcPartyServiceCenterMatterEntity>> groupByMatterName = matters.stream().collect(Collectors.groupingBy(IcPartyServiceCenterMatterEntity::getMatterName)); |
|
|
|
|
|
groupByMatterName.forEach((k,v) -> { |
|
|
|
|
|
if (v.size() > NumConstant.ONE){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.MATTER_NAME_EXISTS_APPOINTMENT_ERROR.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
matters.forEach(m -> { |
|
|
matters.forEach(m -> { |
|
|
m.setCustomerId(customerId); |
|
|
m.setCustomerId(customerId); |
|
|
m.setPartyServiceCenterId(centerEntity.getId()); |
|
|
m.setPartyServiceCenterId(centerEntity.getId()); |
|
@ -194,14 +201,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
IcPartyServiceCenterEntity centerEntity = ConvertUtils.sourceToTarget(formDTO, IcPartyServiceCenterEntity.class); |
|
|
IcPartyServiceCenterEntity centerEntity = ConvertUtils.sourceToTarget(formDTO, IcPartyServiceCenterEntity.class); |
|
|
centerEntity.setId(formDTO.getPartyServiceCenterId()); |
|
|
centerEntity.setId(formDTO.getPartyServiceCenterId()); |
|
|
baseDao.updateById(centerEntity); |
|
|
baseDao.updateById(centerEntity); |
|
|
if (CollectionUtils.isNotEmpty(formDTO.getMatterList())){ |
|
|
|
|
|
List<IcPartyServiceCenterMatterEntity> matters = ConvertUtils.sourceToTarget(formDTO.getMatterList(), IcPartyServiceCenterMatterEntity.class); |
|
|
|
|
|
matters.forEach(m -> { |
|
|
|
|
|
m.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
|
|
m.setPartyServiceCenterId(formDTO.getPartyServiceCenterId()); |
|
|
|
|
|
}); |
|
|
|
|
|
matterService.insertBatch(matters); |
|
|
|
|
|
} |
|
|
|
|
|
// del matter
|
|
|
// del matter
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getDelMatterList())){ |
|
|
if (CollectionUtils.isNotEmpty(formDTO.getDelMatterList())){ |
|
|
List<String> delMatterList = formDTO.getDelMatterList(); |
|
|
List<String> delMatterList = formDTO.getDelMatterList(); |
|
@ -218,6 +218,25 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
matterService.deleteBatchIds(delMatterList); |
|
|
matterService.deleteBatchIds(delMatterList); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getMatterList())){ |
|
|
|
|
|
List<String> existsMatterNames = matterService.selectMatterNameByCenterId(formDTO.getPartyServiceCenterId()); |
|
|
|
|
|
List<IcPartyServiceCenterMatterEntity> matters = ConvertUtils.sourceToTarget(formDTO.getMatterList(), IcPartyServiceCenterMatterEntity.class); |
|
|
|
|
|
List<String> paramMatterNames = matters.stream().map(m -> m.getMatterName()).collect(Collectors.toList()); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(existsMatterNames)){ |
|
|
|
|
|
paramMatterNames.addAll(existsMatterNames); |
|
|
|
|
|
} |
|
|
|
|
|
Integer allSize = paramMatterNames.size(); |
|
|
|
|
|
Integer distinctSize = paramMatterNames.stream().distinct().collect(Collectors.toList()).size(); |
|
|
|
|
|
if (distinctSize < allSize){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.MATTER_NAME_EXISTS_APPOINTMENT_ERROR.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
matters.forEach(m -> { |
|
|
|
|
|
m.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
|
|
m.setPartyServiceCenterId(formDTO.getPartyServiceCenterId()); |
|
|
|
|
|
}); |
|
|
|
|
|
matterService.insertBatch(matters); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|