BUG修复更新

This commit is contained in:
dengjun 2024-01-22 13:21:06 +08:00
parent e5d129219d
commit bcb588fd5d
13 changed files with 265 additions and 159 deletions

View File

@ -0,0 +1,52 @@
package com.haitonggauto.rtosc.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 出口进场基本表
* @TableName customer_export_in
*/
@Data
public class ExportInspectExportExcel {
@ExcelProperty("序号")
private Integer serialNo;
@ExcelProperty("船名/航次")
private String shipVoyageName;
@ExcelProperty("港区")
private String portArea;
@ExcelProperty("装船日期")
private String unloadDate;
@ExcelProperty("提单号")
private String billNo;
@ExcelProperty("报关单号")
private String passport;
@ExcelProperty("查验日期")
private String inspectTime;
@ExcelProperty("品牌")
private String brand;
@ExcelProperty("车型")
private String cartType;
@ExcelProperty("车架号")
private String vin;
@ExcelProperty("商品项号")
private String itemNo;
@ExcelProperty("")
private String area;
@ExcelProperty("公司名称")
private String company;
}

View File

@ -9,7 +9,7 @@ import lombok.Data;
* @TableName customer_export_in
*/
@Data
public class InspectExportExcel {
public class ImportInspectExportExcel {
@ExcelProperty("序号")
private Integer serialNo;

View File

@ -14,8 +14,8 @@ import java.util.List;
import java.util.Map;
@FeignClient(name = "https://rtops4.haitongauto.com/tos/api")
//@FeignClient(name = "rtos-openapi")
//@FeignClient(name = "https://rtops4.haitongauto.com/tos/api")
@FeignClient(name = "rtos-openapi")
public interface NuzarOpenApi {
// 根据港区ID获取国家

View File

@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(name = "https://rtops4.haitongauto.com/tos/pub")
//@FeignClient(name = "basic-service")
//@FeignClient(name = "https://rtops4.haitongauto.com/tos/pub")
@FeignClient(name = "basic-service")
public interface NuzarPubApi {

View File

@ -12,8 +12,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = "https://rtops4.haitongauto.com/tos/shp")
//@FeignClient(name = "shipment-service")
//@FeignClient(name = "https://rtops4.haitongauto.com/tos/shp")
@FeignClient(name = "shipment-service")
public interface NuzarShpApi {
@GetMapping("/vesselVoyages/queryVvyName")

View File

@ -2175,19 +2175,19 @@ public class ExportInHandler implements BaseHandler {
.eq(CustomerExportIn::getBrand, brand)
.eq(CustomerExportIn::getModels, models)
.ne(CustomerExportIn::getCartType, "备件"); // 备件的不允许整船导入
if (StringUtils.equals(type, "0")) {
cQuery.and((wrapper) -> {
wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.SUBMIT)
.or()
.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT);
});
} else {
cQuery.and((wrapper) -> {
wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT)
.or()
.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT);
});
}
// if (StringUtils.equals(type, "0")) {
// cQuery.and((wrapper) -> {
// wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.SUBMIT)
// .or()
// .eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT);
// });
// } else {
// cQuery.and((wrapper) -> {
// wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT)
// .or()
// .eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT);
// });
// }
List<CustomerExportIn> exportInList = customerExportInService.list(cQuery);
@ -2230,14 +2230,14 @@ public class ExportInHandler implements BaseHandler {
}
}
if (exportIn.getCheckStatus() == AuditEnum.AUDIT_PASS) { // 审核
errorDataList.addAll(item.getValue().stream().map(p -> {
JSONObject o = JSONObject.from(p);
o.put("status", "审核通过状态的不可导入");
return o;
}).collect(Collectors.toList()));
return;
}
// if (exportIn.getCheckStatus() == AuditEnum.AUDIT_PASS) { // 审核
// errorDataList.addAll(item.getValue().stream().map(p -> {
// JSONObject o = JSONObject.from(p);
// o.put("status", "审核通过状态的不可导入");
// return o;
// }).collect(Collectors.toList()));
// return;
// }
if (exportIn.getEnterQuantity() != item.getValue().size()) {
errorDataList.addAll(item.getValue().stream().map(p -> {
@ -3010,7 +3010,7 @@ public class ExportInHandler implements BaseHandler {
}
if (countryList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getCiyCnname(), item.getOriginPlace())).count() == 0) {
JSONObject o = JSONObject.from(item);
o.put("status", "产地代码错误");
o.put("status", "产地错误");
errorDataList.add(o);
return;
}
@ -3062,7 +3062,7 @@ public class ExportInHandler implements BaseHandler {
}
if (energyTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getEnergyTypeName())).count() == 0) {
JSONObject o = JSONObject.from(item);
o.put("status", "源类型不存在");
o.put("status", "源类型不存在");
errorDataList.add(o);
return;
}
@ -3465,4 +3465,13 @@ public class ExportInHandler implements BaseHandler {
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
}
private void formatData(List<CustomerExportIn> ins) {
if (CollectionUtils.isEmpty(ins)) {
return;
}
ins.stream().forEach(item -> {
});
}
}

View File

@ -14,20 +14,17 @@ import com.haitonggauto.rtosc.api.NuzarOpenApi;
import com.haitonggauto.rtosc.api.NuzarYardApi;
import com.haitonggauto.rtosc.api.dto.*;
import com.haitonggauto.rtosc.common.context.UserContext;
import com.haitonggauto.rtosc.common.db.query.BaseQuery;
import com.haitonggauto.rtosc.common.dto.DictDTO;
import com.haitonggauto.rtosc.common.dto.Result;
import com.haitonggauto.rtosc.common.enums.ErrorType;
import com.haitonggauto.rtosc.common.handler.BaseHandler;
import com.haitonggauto.rtosc.common.utils.DateUtils;
import com.haitonggauto.rtosc.common.utils.ResultUtil;
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
import com.haitonggauto.rtosc.common.utils.WrapperKit;
import com.haitonggauto.rtosc.dto.*;
import com.haitonggauto.rtosc.excel.ExportInCargoExportExcel;
import com.haitonggauto.rtosc.excel.ExportInExportExcel;
import com.haitonggauto.rtosc.excel.InspectExportExcel;
import com.haitonggauto.rtosc.excel.ExportInspectExportExcel;
import com.haitonggauto.rtosc.query.CargoQuery;
import com.haitonggauto.rtosc.query.ExportInCheckQuery;
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
import com.haitonggauto.rtosc.query.ExportInspectQuery;
import com.haitonggauto.rtosc.repository.entity.*;
@ -262,8 +259,8 @@ public class ExportInspectHandler implements BaseHandler {
List<InspectStatusResp> inspectStatusStatus = openApi.getInspectStatusStatus(ids);
Map<String, String> collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatusNm));
page.getRecords().forEach(item -> {
if (collect.containsKey(item.getId()+"")) {
item.setApiInspectStatus(collect.get(item.getId()+""));
if (collect.containsKey(item.getId() + "")) {
item.setApiInspectStatus(collect.get(item.getId() + ""));
}
});
}
@ -287,8 +284,8 @@ public class ExportInspectHandler implements BaseHandler {
List<InspectStatusResp> inspectStatusStatus = openApi.getInspectStatusStatus(ids);
Map<String, String> collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatusNm));
page.getRecords().forEach(item -> {
if (collect.containsKey(item.getId()+"")) {
item.setApiInspectStatus(collect.get(item.getId()+""));
if (collect.containsKey(item.getId() + "")) {
item.setApiInspectStatus(collect.get(item.getId() + ""));
}
});
}
@ -326,6 +323,7 @@ public class ExportInspectHandler implements BaseHandler {
return ResultUtil.success(list);
}
/**
* 新增
*
@ -432,7 +430,7 @@ public class ExportInspectHandler implements BaseHandler {
@ApiOperation("编辑")
@PostMapping("/edit")
// 使用LambdaUpdateWrapper只在特定需求下做处理推荐 将字段修改为空值的处理方法
public Result<String> edit(@RequestParam(required = false, defaultValue = "false")Boolean flag,
public Result<String> edit(@RequestParam(required = false, defaultValue = "false") Boolean flag,
@RequestBody @Validated(ValidationGroup.update.class) ExportInspectVo form) {
if (CollectionUtils.isNotEmpty(form.getCargos())) {
List<String> repeat = form.getCargos().stream().collect(Collectors.groupingBy(ExportInspectCargoVo::getVin, Collectors.counting()))
@ -494,8 +492,8 @@ public class ExportInspectHandler implements BaseHandler {
if (CollectionUtils.isNotEmpty(ids)) {
List<InspectStatusResp> inspectStatusStatus = openApi.getInspectStatusStatus(ids);
Map<String, String> collect = inspectStatusStatus.stream().collect(Collectors.toMap(InspectStatusResp::getApplyId, InspectStatusResp::getInspectionStatus));
if (collect.containsKey(exportInspect.getId()+"")) {
exportInspect.setApiInspectStatus(collect.get(exportInspect.getId()+""));
if (collect.containsKey(exportInspect.getId() + "")) {
exportInspect.setApiInspectStatus(collect.get(exportInspect.getId() + ""));
}
}
@ -684,8 +682,8 @@ public class ExportInspectHandler implements BaseHandler {
}
/**
*
* 导出excel
*
* @param response
*/
@ApiOperation("导出excel")
@ -698,6 +696,7 @@ public class ExportInspectHandler implements BaseHandler {
query.setTradType("E");
query.setPage(1);
query.setRows(500);
// query.setSorts(Arrays.asList(new BaseQuery.SortField("shipName", "desc"), new BaseQuery.SortField("voyage", "desc"), new BaseQuery.SortField("billNo", "desc")));
Wrapper<CustomerExportInspect> queryWrapper = new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerExportInspect.class, query);
ExcelWriter excelWriter = null;
@ -714,7 +713,7 @@ public class ExportInspectHandler implements BaseHandler {
excelWriter = EasyExcel.write(out).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0, "出口查验计划清单").head(InspectExportExcel.class).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0, "出口查验计划清单").head(ExportInspectExportExcel.class).build();
// 查询数据
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
@ -752,19 +751,35 @@ public class ExportInspectHandler implements BaseHandler {
customerService.wrapperEntity(headers);
// 头映射
Map<Long, CustomerExportInspect> collect = headers.stream().collect(Collectors.toMap(item -> item.getId(), item -> item));
// 处理明细数据
List<CustomerExportInspectCargo> list = customerExportInspectCargoService.lambdaQuery().in(CustomerExportInspectCargo::getExportInspectId, headers.stream().map(item -> item.getId()).collect(Collectors.toList())).list();
List<InspectExportExcel> details = list.stream().map(item -> {
CustomerExportInspect head = collect.get(item.getExportInspectId());
InspectExportExcel e = PoMapper.instance.inspectEntity2ExportExcel(head, item);
// 处理明细数据
List<CustomerExportInspectCargo> list = customerExportInspectCargoService.lambdaQuery()
.in(CustomerExportInspectCargo::getExportInspectId, headers.stream().map(item -> item.getId()).collect(Collectors.toList())).list();
// 表头按照船名船航提单号进行分组找出对应的id
LinkedHashMap<String, List<CustomerExportInspect>> inMap = headers.stream()
.collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipId(), item.getVoyageId(), item.getBillNo()), LinkedHashMap::new, Collectors.toList()));
inMap.entrySet().forEach(item -> {
// 头映射
Map<Long, CustomerExportInspect> collect = item.getValue().stream().collect(Collectors.toMap(p -> p.getId(), p -> p));
List<Long> ids = item.getValue().stream().map(p -> p.getId()).collect(Collectors.toList());
// 备件号排序
List<ExportInspectExportExcel> details = list.stream().filter(p -> ids.contains(p.getExportInspectId()))
.sorted(Comparator.comparing(CustomerExportInspectCargo::getCartType).reversed())
.map(p -> {
CustomerExportInspect head = collect.get(p.getExportInspectId());
ExportInspectExportExcel e = PoMapper.instance.inspectEntity2ExportExcel(head, p);
e.setSerialNo(index.getAndIncrement());
e.setShipVoyageName(StringUtils.join(head.getShipName(), "/", head.getVoyage()));
return e;
}).collect(Collectors.toList());
excelWriter.write(details, writeSheet);
});
}
}

View File

@ -4,7 +4,6 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.util.UUIDUtils;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -20,7 +19,6 @@ import com.haitonggauto.rtosc.common.dto.DictDTO;
import com.haitonggauto.rtosc.common.dto.Result;
import com.haitonggauto.rtosc.common.enums.ErrorType;
import com.haitonggauto.rtosc.common.handler.BaseHandler;
import com.haitonggauto.rtosc.common.utils.DateUtils;
import com.haitonggauto.rtosc.common.utils.ResultUtil;
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
import com.haitonggauto.rtosc.common.utils.WrapperKit;
@ -28,7 +26,6 @@ import com.haitonggauto.rtosc.dto.*;
import com.haitonggauto.rtosc.excel.*;
import com.haitonggauto.rtosc.handler.excel.CustomCellWriteHandler;
import com.haitonggauto.rtosc.query.CargoQuery;
import com.haitonggauto.rtosc.query.ExportInCheckQuery;
import com.haitonggauto.rtosc.query.ExportLoadCheckQuery;
import com.haitonggauto.rtosc.query.ExportLoadQuery;
import com.haitonggauto.rtosc.repository.entity.*;
@ -717,6 +714,10 @@ public class ExportLoadHandler implements BaseHandler {
List<WorkStatusDTO> status = openApi.getVinStatus(req);
collect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus));
}
for (CustomerExportLoadCargo cargo : page.getRecords()) {
cargo.setDestPortId(exportLoad.getDestPortId());
cargo.setDestPort(exportLoad.getDestPort());
}
if (MapUtils.isNotEmpty(collect)) {
for (CustomerExportLoadCargo cargo : page.getRecords()) {
cargo.setWorkStatus(collect.get(cargo.getVin()));
@ -1409,8 +1410,8 @@ public class ExportLoadHandler implements BaseHandler {
//普通下拉数据
Map<Integer, String[]> map = new HashMap<>();
String[] isZgArray = {"", ""};
map.put(3, isZgArray);
String[] isZgArray = {"正常", "国内中转", "外进转内出", "长江","沿海"};
map.put(2, isZgArray);
//检查类型-子类
Map<String, List<String>> inspNameMap = new HashMap<>();
//检查类型-父类

View File

@ -22,8 +22,8 @@ import com.haitonggauto.rtosc.common.utils.ResultUtil;
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
import com.haitonggauto.rtosc.common.utils.WrapperKit;
import com.haitonggauto.rtosc.dto.*;
import com.haitonggauto.rtosc.excel.ExportInExportExcel;
import com.haitonggauto.rtosc.excel.InspectExportExcel;
import com.haitonggauto.rtosc.excel.ExportInspectExportExcel;
import com.haitonggauto.rtosc.excel.ImportInspectExportExcel;
import com.haitonggauto.rtosc.handler.mapper.PoMapper;
import com.haitonggauto.rtosc.query.CargoQuery;
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
@ -679,7 +679,7 @@ public class ImportInspectHandler implements BaseHandler {
excelWriter = EasyExcel.write(out).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0, "出口查验计划清单").head(InspectExportExcel.class).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0, "出口查验计划清单").head(ImportInspectExportExcel.class).build();
// 查询数据
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
@ -717,19 +717,34 @@ public class ImportInspectHandler implements BaseHandler {
customerService.wrapperEntity(headers);
// 头映射
Map<Long, CustomerExportInspect> collect = headers.stream().collect(Collectors.toMap(item -> item.getId(), item -> item));
// 处理明细数据
List<CustomerExportInspectCargo> list = customerExportInspectCargoService.lambdaQuery().in(CustomerExportInspectCargo::getExportInspectId, headers.stream().map(item -> item.getId()).collect(Collectors.toList())).list();
List<InspectExportExcel> details = list.stream().map(item -> {
CustomerExportInspect head = collect.get(item.getExportInspectId());
InspectExportExcel e = PoMapper.instance.inspectEntity2ExportExcel(head, item);
// 处理明细数据
List<CustomerExportInspectCargo> list = customerExportInspectCargoService.lambdaQuery()
.in(CustomerExportInspectCargo::getExportInspectId, headers.stream().map(item -> item.getId()).collect(Collectors.toList())).list();
// 表头按照船名船航提单号进行分组找出对应的id
LinkedHashMap<String, List<CustomerExportInspect>> inMap = headers.stream()
.collect(Collectors.groupingBy(item -> StringUtils.joinWith("#$#", item.getShipId(), item.getVoyageId(), item.getBillNo()), LinkedHashMap::new, Collectors.toList()));
inMap.entrySet().forEach(item -> {
// 头映射
Map<Long, CustomerExportInspect> collect = item.getValue().stream().collect(Collectors.toMap(p -> p.getId(), p -> p));
List<Long> ids = item.getValue().stream().map(p -> p.getId()).collect(Collectors.toList());
// 备件号排序
List<ExportInspectExportExcel> details = list.stream().filter(p -> ids.contains(p.getExportInspectId()))
.sorted(Comparator.comparing(CustomerExportInspectCargo::getCartType).reversed())
.map(p -> {
CustomerExportInspect head = collect.get(p.getExportInspectId());
ExportInspectExportExcel e = PoMapper.instance.inspectEntity2ExportExcel(head, p);
e.setSerialNo(index.getAndIncrement());
e.setShipVoyageName(StringUtils.join(head.getShipName(), "/", head.getVoyage()));
return e;
}).collect(Collectors.toList());
excelWriter.write(details, writeSheet);
});
}
}

View File

@ -3,6 +3,8 @@ package com.haitonggauto.rtosc.handler.excel;
import com.alibaba.excel.write.handler.SheetWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddressList;
@ -52,6 +54,7 @@ public class CustomCellWriteHandler implements SheetWriteHandler {
// 获取工作簿对象用于创建存放下拉数据的字典sheet数据页
Workbook workbook = writeWorkbookHolder.getWorkbook();
if (MapUtils.isNotEmpty(map)) {
// 普通数据迭代索引用于存放下拉数据的字典sheet数据页命名
int index = 1;
for (Map.Entry<Integer, String[]> entry : map.entrySet()) {
@ -86,8 +89,9 @@ public class CustomCellWriteHandler implements SheetWriteHandler {
DataValidationConstraint constraint = helper.createFormulaListConstraint(dictSheetName);
setValidation(sheet, helper, constraint, infoList);
}
}
if (MapUtils.isNotEmpty(inspNameArray) && MapUtils.isNotEmpty(probPropsNameArray)) {
//检查类型-父类
Sheet hideSheet = workbook.createSheet("site");
workbook.setSheetHidden(workbook.getSheetIndex(hideSheet), false);
@ -138,13 +142,15 @@ public class CustomCellWriteHandler implements SheetWriteHandler {
String formula = "site!" + range;
name.setRefersToFormula(formula);
}
}
///开始设置大类小类下拉框
DataValidationHelper dvHelper = sheet.getDataValidationHelper();
// 大类规则
DataValidationConstraint expConstraint = dvHelper.createExplicitListConstraint(proInspNameArray);
CellRangeAddressList expRangeAddressList = new CellRangeAddressList(1, 1048575, 3, 3);
setValidation(sheet, dvHelper, expConstraint, expRangeAddressList);
// DataValidationConstraint expConstraint = dvHelper.createExplicitListConstraint(proInspNameArray);
// CellRangeAddressList expRangeAddressList = new CellRangeAddressList(1, 1048575, 3, 3);
// setValidation(sheet, dvHelper, expConstraint, expRangeAddressList);
//检查类型-子类
// 小类规则(各单元格按个设置)

View File

@ -97,5 +97,5 @@ public interface PoMapper {
@Mapping(source = "cargo.cartType", target = "cartType")
@Mapping(source = "cargo.vin", target = "vin")
@Mapping(source = "head.company", target = "company")
InspectExportExcel inspectEntity2ExportExcel(CustomerExportInspect head, CustomerExportInspectCargo cargo);
ExportInspectExportExcel inspectEntity2ExportExcel(CustomerExportInspect head, CustomerExportInspectCargo cargo);
}

View File

@ -73,6 +73,14 @@ public class CustomerExportLoadCargo extends BaseEntity implements Serializable
@ApiModelProperty(value = "作业状态")
private String workStatus;
@TableField(exist = false)
@ApiModelProperty(value = "目的港ID")
private String destPortId;
@TableField(exist = false)
@ApiModelProperty(value = "目的港")
private String destPort;
@TableField(exist = false)
@ApiModelProperty(value = "基本信息")
private CustomerExportLoad exportLoad;