package com.ydtech.modules.protocol.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ydtech.modules.protocol.dao.PtlAgreementSchedulingConfigMapper; import com.ydtech.modules.protocol.entity.po.PtlAgreementSchedulingConfig; import com.ydtech.modules.protocol.entity.vo.PtlAgreementSchedulingConfigSaveVo; import com.ydtech.modules.protocol.service.PtlAgreementSchedulingConfigService; import com.ydtech.modules.protocol.utils.AssertionUtils; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.List; import java.util.stream.Collectors; /** * @author wks * @description 针对表【ptl_agreement_scheduling_config(协议调度配置(过滤保险公司))】的数据库操作Service实现 * @createDate 2024-07-22 11:32:12 */ @Service public class PtlAgreementSchedulingConfigServiceImpl extends ServiceImpl implements PtlAgreementSchedulingConfigService { @Override public void allocation(PtlAgreementSchedulingConfigSaveVo ptlAgreementSchedulingConfigSaveVo) { // 拼接字符串 PtlAgreementSchedulingConfig ptlAgreementSchedulingConfig = new PtlAgreementSchedulingConfig(); BeanUtils.copyProperties(ptlAgreementSchedulingConfigSaveVo, ptlAgreementSchedulingConfig); List productsCode = ptlAgreementSchedulingConfigSaveVo.getProductsCode(); String s = String.join(",", productsCode); ptlAgreementSchedulingConfig.setProductsCode(s); // 修改 Integer id = ptlAgreementSchedulingConfig.getId(); if (ObjectUtils.isNotEmpty(id)) { int updateResult = this.baseMapper.updateById(ptlAgreementSchedulingConfig); AssertionUtils.isSucceed(updateResult > 0, "修改配置失败"); } else { // 新增 PtlAgreementSchedulingConfig config = this.getByCompanyId(ptlAgreementSchedulingConfig.getCompanyId()); AssertionUtils.isNotEmpty(config, "修改配置失败"); int insertResult = this.baseMapper.insert(ptlAgreementSchedulingConfig); AssertionUtils.isSucceed(insertResult > 0, "新增配置失败"); } } }