|
|
@@ -25,7 +25,6 @@ import org.springblade.los.box.dynamics.mapper.BoxDynamicsRecordMapper;
|
|
|
import org.springblade.los.box.entity.PutBox;
|
|
|
import org.springblade.los.box.excel.EmptyContainerAppearanceAnalysis;
|
|
|
import org.springblade.los.box.mapper.PutBoxMapper;
|
|
|
-import org.springblade.los.box.service.IPutBoxService;
|
|
|
import org.springblade.los.business.sea.entity.Bills;
|
|
|
import org.springblade.los.business.sea.mapper.BillsMapper;
|
|
|
import org.springblade.los.ftp.dto.ApiItem;
|
|
|
@@ -454,7 +453,7 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
.eq(BCorps::getCode, apiRequest.getStationCode())
|
|
|
.last("LIMIT 1"));
|
|
|
if (bCorps == null) {
|
|
|
- msg.append("场站代码:").append(apiRequest.getStationCode()).append("不正确;");
|
|
|
+ msg.append("场站代码:").append(apiRequest.getStationCode()).append("不正确;");
|
|
|
}
|
|
|
// 3. 港口代码有效性校验
|
|
|
BPorts ports = bPortsService.getOne(new LambdaQueryWrapper<BPorts>()
|
|
|
@@ -463,7 +462,7 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
.in(BPorts::getUnCode, apiRequest.getPortNo())
|
|
|
.last("LIMIT 1"));
|
|
|
if (ports == null) {
|
|
|
- msg.append("港口代码:").append(apiRequest.getPortNo()).append("不正确;");
|
|
|
+ msg.append("港口代码:").append(apiRequest.getPortNo()).append("不正确;");
|
|
|
}
|
|
|
// 4. 箱型代码有效性校验
|
|
|
List<String> boxType = apiRequest.getItem().stream().map(ApiItem::getCtnrType).filter(Objects::nonNull)
|
|
|
@@ -475,7 +474,7 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
.eq(BCntrTypes::getIsDeleted, 0)
|
|
|
.in(BCntrTypes::getCode95, boxType));
|
|
|
if (boxTypeList.isEmpty()) {
|
|
|
- msg.append("箱型不正确;");
|
|
|
+ msg.append("箱型").append(String.join(",", boxType)).append("不正确;");
|
|
|
}
|
|
|
}
|
|
|
List<String> boxCodeList = apiRequest.getItem().stream().map(ApiItem::getCtnrNo).filter(Objects::nonNull)
|
|
|
@@ -490,7 +489,7 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
.eq(PutBox::getIsDeleted, 0)
|
|
|
.in(PutBox::getContainerNumber, releaseNoList));
|
|
|
if (putBoxList.isEmpty()) {
|
|
|
- msg.append("放箱号不存在;");
|
|
|
+ msg.append("放箱号").append(String.join(",", releaseNoList)).append("不存在;");
|
|
|
}
|
|
|
}
|
|
|
// 6.提单号有效性校验
|
|
|
@@ -504,7 +503,7 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
.apply("find_in_set(bill_type,'DD,MH')")
|
|
|
.and(i -> i.in(Bills::getHblno, mblnoList).or().in(Bills::getMblno, mblnoList)));
|
|
|
if (billsList.isEmpty()) {
|
|
|
- msg.append("提单号不存在;");
|
|
|
+ msg.append("提单号").append(String.join(",", mblnoList)).append("不存在;");
|
|
|
}
|
|
|
}
|
|
|
BoxDynamicsRecord boxDynamicsRecord = new BoxDynamicsRecord();
|
|
|
@@ -527,7 +526,7 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
List<BoxDynamicsRecordItems> itemsList = new ArrayList<>();
|
|
|
// 9. 执行明细参数校验
|
|
|
- validateBasicParamsItem(apiRequest, msg,billsList,putBoxList,boxTypeList);
|
|
|
+ validateBasicParamsItem(apiRequest, msg, billsList, putBoxList, boxTypeList);
|
|
|
for (ApiItem item : apiRequest.getItem()) {
|
|
|
// 10.构建明细记录对象
|
|
|
BoxDynamicsRecordItems recordItems = new BoxDynamicsRecordItems();
|
|
|
@@ -554,8 +553,8 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
}
|
|
|
// 4).明细箱型数据赋值
|
|
|
if (!boxTypeList.isEmpty()) {
|
|
|
- boxTypeList.stream().filter(e -> e.getCode95().equals(item.getCtnrType())).findFirst().ifPresent(cntrTypes -> recordItems.setBoxType(cntrTypes.getCnName()));
|
|
|
- }
|
|
|
+ boxTypeList.stream().filter(e -> e.getCode95().equals(item.getCtnrType())).findFirst().ifPresent(cntrTypes -> recordItems.setBoxType(cntrTypes.getCnName()));
|
|
|
+ }
|
|
|
// 5).明细场站数据赋值
|
|
|
if (bCorps != null) {
|
|
|
recordItems.setStationCname(bCorps.getCnName());
|
|
|
@@ -570,7 +569,7 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
} catch (ParseException e) {
|
|
|
msg.append("进出场日期格式不正确,请传入格式为‘yyyy-MM-dd’正确格式日期;");
|
|
|
}
|
|
|
- itemsList.add(recordItems);
|
|
|
+ itemsList.add(recordItems);
|
|
|
}
|
|
|
// 11.主表港口数据赋值
|
|
|
if (ports != null) {
|
|
|
@@ -588,7 +587,7 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
}
|
|
|
// 13. 错误处理:如果有错误信息则直接返回
|
|
|
if (ObjectUtils.isNotNull(msg.toString())) {
|
|
|
- return R.fail(500, msg +" 请联系相关人员!");
|
|
|
+ return R.fail(500, msg + " 请联系相关人员!");
|
|
|
} else {
|
|
|
// 14. 数据保存处理
|
|
|
boxDynamicsRecordService.insert(boxDynamicsRecord);
|
|
|
@@ -599,51 +598,53 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
return R.success("成功");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 明细参数校验方法
|
|
|
+ *
|
|
|
* @param apiRequest 请求对象
|
|
|
- * @param msg 错误信息收集器
|
|
|
+ * @param msg 错误信息收集器
|
|
|
*/
|
|
|
- private void validateBasicParamsItem(ApiRequest apiRequest, StringBuilder msg,List<Bills> billsList,
|
|
|
- List<PutBox> putBoxList ,List<BCntrTypes> boxTypeList) {
|
|
|
+ private void validateBasicParamsItem(ApiRequest apiRequest, StringBuilder msg, List<Bills> billsList,
|
|
|
+ List<PutBox> putBoxList, List<BCntrTypes> boxTypeList) {
|
|
|
for (ApiItem item : apiRequest.getItem()) {
|
|
|
if (ObjectUtils.isNull(item.getReleaseNo())) {
|
|
|
- msg.append("放箱号不能为空");
|
|
|
+ msg.append("放箱号不能为空;");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(item.getCtnrNo())) {
|
|
|
- msg.append("箱号不能为空");
|
|
|
+ msg.append("箱号不能为空;");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(item.getCtnrType())) {
|
|
|
- msg.append("箱型不能为空");
|
|
|
+ msg.append("箱型不能为空;");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(item.getApproachExitDate())) {
|
|
|
- msg.append("进出场日期不能为空");
|
|
|
+ msg.append("进出场日期不能为空;");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(item.getObjective())) {
|
|
|
- msg.append("进出场目的不能为空");
|
|
|
+ msg.append("进出场目的不能为空;");
|
|
|
}
|
|
|
if ("CC".equals(apiRequest.getApproachExit())) {
|
|
|
if (ObjectUtils.isNull(item.getMblno())) {
|
|
|
- msg.append("提单号不能为空");
|
|
|
+ msg.append("提单号不能为空;");
|
|
|
}
|
|
|
if (!billsList.isEmpty()) {
|
|
|
List<Bills> bills = billsList.stream().filter(e -> e.getMblno().equals(item.getMblno()) ||
|
|
|
e.getHblno().equals(item.getMblno())).collect(Collectors.toList());
|
|
|
if (bills.isEmpty()) {
|
|
|
- msg.append("提单号:").append(item.getMblno()).append("不存在;");
|
|
|
+ msg.append("提单号:").append(item.getMblno()).append("不存在;");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (!boxTypeList.isEmpty()) {
|
|
|
BCntrTypes cntrTypes = boxTypeList.stream().filter(e -> e.getCode95().equals(item.getCtnrType())).findFirst().orElse(null);
|
|
|
if (cntrTypes == null) {
|
|
|
- msg.append("箱型:").append(item.getCtnrType()).append("不正确,");
|
|
|
+ msg.append("箱型:").append(item.getCtnrType()).append("不正确;");
|
|
|
}
|
|
|
}
|
|
|
if (!putBoxList.isEmpty()) {
|
|
|
PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getReleaseNo())).findFirst().orElse(null);
|
|
|
if (putBox == null) {
|
|
|
- msg.append("放箱号:").append(item.getReleaseNo()).append("不存在;");
|
|
|
+ msg.append("放箱号:").append(item.getReleaseNo()).append("不存在;");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -651,8 +652,9 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
|
|
|
/**
|
|
|
* 基础参数校验方法
|
|
|
+ *
|
|
|
* @param apiRequest 请求对象
|
|
|
- * @param msg 错误信息收集器
|
|
|
+ * @param msg 错误信息收集器
|
|
|
*/
|
|
|
private void validateBasicParams(ApiRequest apiRequest, StringBuilder msg) {
|
|
|
// 校验明细数据不能为空
|
|
|
@@ -665,15 +667,15 @@ public class CyFtpServiceImpl implements CyFtpService {
|
|
|
}
|
|
|
// 校验场站代码不能为空
|
|
|
if (ObjectUtils.isNull(apiRequest.getStationCode())) {
|
|
|
- msg.append("场站代码不能为空");
|
|
|
+ msg.append("场站代码不能为空;");
|
|
|
}
|
|
|
// 校验进出场类型不能为空
|
|
|
if (ObjectUtils.isNull(apiRequest.getApproachExit())) {
|
|
|
- msg.append("进出场类型不能为空");
|
|
|
+ msg.append("进出场类型不能为空;");
|
|
|
}
|
|
|
// 校验推送时间不能为空
|
|
|
if (ObjectUtils.isNull(apiRequest.getImportDate())) {
|
|
|
- msg.append("推送时间不能为空");
|
|
|
+ msg.append("推送时间不能为空;");
|
|
|
}
|
|
|
}
|
|
|
|