Commit 14a5f2ba authored by 332784038@qq.com's avatar 332784038@qq.com

空运渠道有两套规则:

1、AF、AS、AN的渠道编码共用起始编号
2、其他渠道编码独立使用起始编号
parent decae2ef
......@@ -42,6 +42,8 @@ public class BoxAirNumberRecordServiceImpl extends AbstractService<BoxAirNumberR
@Resource
private ApplicationContext applicationContext;
static List<String> PUBLIC_CHANNEL_CODE_LIST = Arrays.asList("AF","AS","AN");
@Override
public BoxAirNumberRecordDO getBoxAirNumberRecord(Long id) {
return boxAirNumberRecordMapper.selectById(id);
......@@ -91,19 +93,19 @@ public class BoxAirNumberRecordServiceImpl extends AbstractService<BoxAirNumberR
BoxAirNumberRecordDO boxAirNumberRecordDO = boxAirNumberRecordMapper.selectOne(new LambdaQueryWrapper<BoxAirNumberRecordDO>()
.eq(BoxAirNumberRecordDO::getTransportType, transportType)
.eq(BoxAirNumberRecordDO::getDestCountryCode, destCountryCode)
.eq(BoxAirNumberRecordDO::getChannelCode, channelCode)
.eq(!PUBLIC_CHANNEL_CODE_LIST.contains(channelCode), BoxAirNumberRecordDO::getChannelCode, channelCode)
.eq(BoxAirNumberRecordDO::getUsed, 0)
.orderByAsc(BoxAirNumberRecordDO::getId).last("limit 1"));
if (Objects.nonNull(boxAirNumberRecordDO)) {
// 修改自编号逻辑
// if (!StringUtils.equals(channelCode, boxAirNumberRecordDO.getChannelCode())) {
// String newNumber = CodeUtils.chargeChannelAirSelfNumbers(destCountryCode, channelCode, boxAirNumberRecordDO.getChannelCode(), boxAirNumberRecordDO.getNumber());
// boxAirNumberRecordDO.setDestId(destId);
// boxAirNumberRecordDO.setDestCountryCode(destCountryCode);
// boxAirNumberRecordDO.setNumber(newNumber);
// boxAirNumberRecordDO.setChannelCode(channelCode);
// boxAirNumberRecordDO.setChannelId(channelId);
// }
if (!StringUtils.equals(channelCode, boxAirNumberRecordDO.getChannelCode())) {
String newNumber = CodeUtils.chargeChannelAirSelfNumbers(destCountryCode, channelCode, boxAirNumberRecordDO.getChannelCode(), boxAirNumberRecordDO.getNumber());
boxAirNumberRecordDO.setDestId(destId);
boxAirNumberRecordDO.setDestCountryCode(destCountryCode);
boxAirNumberRecordDO.setNumber(newNumber);
boxAirNumberRecordDO.setChannelCode(channelCode);
boxAirNumberRecordDO.setChannelId(channelId);
}
// 如果有未使用的编号记录,则直接更新为使用状态后返回
boxAirNumberRecordDO.setUsed(Boolean.TRUE);
boxAirNumberRecordDO.setUpdater(String.valueOf(userId));
......@@ -149,7 +151,7 @@ public class BoxAirNumberRecordServiceImpl extends AbstractService<BoxAirNumberR
.eq(BoxAirNumberRecordDO::getNumber, number)
.eq(BoxAirNumberRecordDO::getTransportType, transportType)
.eq(BoxAirNumberRecordDO::getDestCountryCode, destCountryCode)
.eq(BoxAirNumberRecordDO::getChannelCode, channelCode)
.eq(!PUBLIC_CHANNEL_CODE_LIST.contains(channelCode), BoxAirNumberRecordDO::getChannelCode, channelCode)
.orderByAsc(BoxAirNumberRecordDO::getId).last("limit 1"));
if (Objects.nonNull(boxAirNumberRecordDO)) {
// 修改自编号逻辑
......@@ -178,7 +180,7 @@ public class BoxAirNumberRecordServiceImpl extends AbstractService<BoxAirNumberR
BoxAirNumberRecordDO maxBoxAirNumberRecordDO = boxAirNumberRecordMapper.selectOne(new LambdaQueryWrapper<BoxAirNumberRecordDO>()
.eq(BoxAirNumberRecordDO::getTransportType, transportType)
.eq(BoxAirNumberRecordDO::getDestCountryCode, destCountryCode)
.eq(BoxAirNumberRecordDO::getChannelCode, channelCode)
.eq(!PUBLIC_CHANNEL_CODE_LIST.contains(channelCode), BoxAirNumberRecordDO::getChannelCode, channelCode)
.orderByDesc(BoxAirNumberRecordDO::getId).last("limit 1"));
// 根据最大的自编号生成最新的自编号
String preChannelCode = "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment