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

平台账户配置

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