提交 a9afea14 authored 作者: jiangwenye's avatar jiangwenye

平台账户配置

上级 5db01ee2
......@@ -113,6 +113,8 @@ public enum PerformanceResultEnum implements ResultEnum {
SLIDER_CHECK_FAIL(1911, "滑块验证错误"),
ORDER_CHILD_SYNC_ERROR(1912, "承运同步网络货运异常"),
PLATFORM_ACCOUNT_CONFIG_ONLY(1913, "当前配置已存在"),
;
private final int code;
private final String msg;
......
......@@ -6,6 +6,8 @@ import com.clx.performance.model.PlatformAccountConfig;
import com.clx.performance.param.pc.carrier.PagePlatformAccountConfigParam;
import com.msl.common.dao.BaseDao;
import java.util.List;
public interface PlatformAccountConfigDao extends BaseDao<PlatformAccountConfigMapper, PlatformAccountConfig, Integer> {
......@@ -15,4 +17,6 @@ public interface PlatformAccountConfigDao extends BaseDao<PlatformAccountConfigM
boolean updatePlatformAccountConfig(PlatformAccountConfig platformAccountConfig);
List<PlatformAccountConfig> checkPlatformAccountConfigOnly(PlatformAccountConfig config);
}
......@@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.order.enums.DeleteStatusEnum;
import com.clx.performance.dao.PlatformAccountConfigDao;
import com.clx.performance.enums.PlatformAccountConfigEnum;
import com.clx.performance.mapper.PlatformAccountConfigMapper;
import com.clx.performance.model.PlatformAccountConfig;
import com.clx.performance.param.pc.carrier.PagePlatformAccountConfigParam;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Objects;
/**
......@@ -61,4 +63,18 @@ public class PlatformAccountConfigImpl extends BaseDaoImpl<PlatformAccountConfig
.set(PlatformAccountConfig::getBankCardNo, config.getBankCardNo())
);
}
@Override
public List<PlatformAccountConfig> checkPlatformAccountConfigOnly(PlatformAccountConfig config) {
LambdaQueryWrapper<PlatformAccountConfig> query = new LambdaQueryWrapper<>();
query.eq(PlatformAccountConfig :: getDeleteStatus, DeleteStatusEnum.YES.getCode());
query.eq(PlatformAccountConfig :: getBusinessType, config.getBusinessType());
query.eq(PlatformAccountConfig :: getOwnerType, config.getOwnerType());
query.eq(PlatformAccountConfig :: getInvoiceCompanyId, config.getInvoiceCompanyId());
query.eq(PlatformAccountConfig :: getConfigRange, config.getConfigRange());
if(Objects.equals(config.getBusinessType(), PlatformAccountConfigEnum.BusinessType.SETTLE.getCode())){
query.eq(PlatformAccountConfig :: getInvoiceType, config.getInvoiceType());
}
return baseMapper.selectList(query);
}
}
......@@ -11,11 +11,14 @@ import com.clx.performance.param.pc.carrier.SavePlatformAccountConfigParam;
import com.clx.performance.service.PlatformAccountConfigService;
import com.clx.performance.struct.PlatformAccountConfigStruct;
import com.clx.performance.vo.pc.carrier.settle.*;
import com.msl.common.exception.ServiceSystemException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* @author jiangwenye
......@@ -53,6 +56,7 @@ public class PlatformAccountConfigServiceImpl implements PlatformAccountConfigSe
@Override
public void updatePlatformAccountConfig(SavePlatformAccountConfigParam param) {
PlatformAccountConfig config = new PlatformAccountConfig();
config.setId(param.getId());
config.setBusinessType(param.getBusinessType());
......@@ -66,6 +70,9 @@ public class PlatformAccountConfigServiceImpl implements PlatformAccountConfigSe
config.setOpenBank(param.getOpenBank());
config.setBankCode(param.getBankCode());
config.setBankCardNo(param.getBankCardNo());
if(!checkConfigOnly(config)){
throw new ServiceSystemException(PerformanceResultEnum.PLATFORM_ACCOUNT_CONFIG_ONLY);
}
platformAccountConfigDao.updatePlatformAccountConfig(config);
}
......@@ -84,8 +91,24 @@ public class PlatformAccountConfigServiceImpl implements PlatformAccountConfigSe
config.setBankCode(param.getBankCode());
config.setBankCardNo(param.getBankCardNo());
config.setDeleteStatus(DeleteStatusEnum.YES.getCode());
if(!checkConfigOnly(config)){
throw new ServiceSystemException(PerformanceResultEnum.PLATFORM_ACCOUNT_CONFIG_ONLY);
}
platformAccountConfigDao.saveEntity(config);
}
public boolean checkConfigOnly(PlatformAccountConfig config){
List<PlatformAccountConfig> checkList = platformAccountConfigDao.checkPlatformAccountConfigOnly(config);
if(CollectionUtils.isNotEmpty(checkList)){
if(checkList.size() > 1){
return false;
}
PlatformAccountConfig check = checkList.get(0);
if(!Objects.equals(check.getId(),config.getId())){
return false;
}
}
return true;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论