|
|
@ -25,6 +25,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
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.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
@ -137,6 +138,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
* @date 2021/11/22 9:13 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void addPartyServiceCenter(AddPartyServiceCenterFormDTO formDTO, TokenDto tokenDto) { |
|
|
|
String customerId = tokenDto.getCustomerId(); |
|
|
|
LambdaQueryWrapper<IcPartyServiceCenterEntity> l = new LambdaQueryWrapper<>(); |
|
|
@ -164,6 +166,12 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
baseDao.insert(centerEntity); |
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getMatterList())){ |
|
|
|
List<IcPartyServiceCenterMatterEntity> matters = ConvertUtils.sourceToTarget(formDTO.getMatterList(), IcPartyServiceCenterMatterEntity.class); |
|
|
|
List<String> paramMatterNames = matters.stream().map(m -> m.getMatterName()).collect(Collectors.toList()); |
|
|
|
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(customerId); |
|
|
|
m.setPartyServiceCenterId(centerEntity.getId()); |
|
|
@ -181,6 +189,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
* @date 2021/11/22 10:21 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void editPartyServiceCenter(EditPartyServiceCenterFormDTO formDTO, TokenDto tokenDto) { |
|
|
|
LambdaQueryWrapper<IcPartyServiceCenterEntity> l = new LambdaQueryWrapper<>(); |
|
|
|
l.eq(IcPartyServiceCenterEntity::getCenterName,formDTO.getCenterName()) |
|
|
@ -194,14 +203,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
IcPartyServiceCenterEntity centerEntity = ConvertUtils.sourceToTarget(formDTO, IcPartyServiceCenterEntity.class); |
|
|
|
centerEntity.setId(formDTO.getPartyServiceCenterId()); |
|
|
|
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
|
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getDelMatterList())){ |
|
|
|
List<String> delMatterList = formDTO.getDelMatterList(); |
|
|
@ -218,6 +220,25 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -227,6 +248,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
* @date 2021/11/22 1:25 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delMatter(DelMatterFormDTO formDTO) { |
|
|
|
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> re = new LambdaQueryWrapper<>(); |
|
|
|
re.eq(BaseEpmetEntity::getDelFlag,NumConstant.ZERO). |
|
|
@ -247,6 +269,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
* @date 2021/11/22 2:06 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void appointment(AppointmentFormDTO formDTO, TokenDto tokenDto) { |
|
|
|
String customerId = tokenDto.getCustomerId(); |
|
|
|
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> l = new LambdaQueryWrapper<>(); |
|
|
@ -407,6 +430,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
* @date 2021/11/26 5:21 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void cancelAppointment(CancelAppointmentFormDTO formDTO) { |
|
|
|
matterAppointmentRecordDao.cancelAppointment(formDTO.getRecordId(), formDTO.getUserId()); |
|
|
|
} |
|
|
|