BUG修复更新
This commit is contained in:
parent
e5d129219d
commit
bcb588fd5d
|
@ -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;
|
||||||
|
}
|
|
@ -9,7 +9,7 @@ import lombok.Data;
|
||||||
* @TableName customer_export_in
|
* @TableName customer_export_in
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class InspectExportExcel {
|
public class ImportInspectExportExcel {
|
||||||
|
|
||||||
@ExcelProperty("序号")
|
@ExcelProperty("序号")
|
||||||
private Integer serialNo;
|
private Integer serialNo;
|
|
@ -14,8 +14,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@FeignClient(name = "https://rtops4.haitongauto.com/tos/api")
|
//@FeignClient(name = "https://rtops4.haitongauto.com/tos/api")
|
||||||
//@FeignClient(name = "rtos-openapi")
|
@FeignClient(name = "rtos-openapi")
|
||||||
public interface NuzarOpenApi {
|
public interface NuzarOpenApi {
|
||||||
|
|
||||||
// 根据港区ID获取国家
|
// 根据港区ID获取国家
|
||||||
|
|
|
@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@FeignClient(name = "https://rtops4.haitongauto.com/tos/pub")
|
//@FeignClient(name = "https://rtops4.haitongauto.com/tos/pub")
|
||||||
//@FeignClient(name = "basic-service")
|
@FeignClient(name = "basic-service")
|
||||||
public interface NuzarPubApi {
|
public interface NuzarPubApi {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@FeignClient(name = "https://rtops4.haitongauto.com/tos/shp")
|
//@FeignClient(name = "https://rtops4.haitongauto.com/tos/shp")
|
||||||
//@FeignClient(name = "shipment-service")
|
@FeignClient(name = "shipment-service")
|
||||||
public interface NuzarShpApi {
|
public interface NuzarShpApi {
|
||||||
|
|
||||||
@GetMapping("/vesselVoyages/queryVvyName")
|
@GetMapping("/vesselVoyages/queryVvyName")
|
||||||
|
|
|
@ -2175,19 +2175,19 @@ public class ExportInHandler implements BaseHandler {
|
||||||
.eq(CustomerExportIn::getBrand, brand)
|
.eq(CustomerExportIn::getBrand, brand)
|
||||||
.eq(CustomerExportIn::getModels, models)
|
.eq(CustomerExportIn::getModels, models)
|
||||||
.ne(CustomerExportIn::getCartType, "备件"); // 备件的不允许整船导入
|
.ne(CustomerExportIn::getCartType, "备件"); // 备件的不允许整船导入
|
||||||
if (StringUtils.equals(type, "0")) {
|
// if (StringUtils.equals(type, "0")) {
|
||||||
cQuery.and((wrapper) -> {
|
// cQuery.and((wrapper) -> {
|
||||||
wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.SUBMIT)
|
// wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.SUBMIT)
|
||||||
.or()
|
// .or()
|
||||||
.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT);
|
// .eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT);
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
cQuery.and((wrapper) -> {
|
// cQuery.and((wrapper) -> {
|
||||||
wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT)
|
// wrapper.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT)
|
||||||
.or()
|
// .or()
|
||||||
.eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT);
|
// .eq(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT_REJECT);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
List<CustomerExportIn> exportInList = customerExportInService.list(cQuery);
|
List<CustomerExportIn> exportInList = customerExportInService.list(cQuery);
|
||||||
|
|
||||||
|
@ -2230,14 +2230,14 @@ public class ExportInHandler implements BaseHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exportIn.getCheckStatus() == AuditEnum.AUDIT_PASS) { // 审核
|
// if (exportIn.getCheckStatus() == AuditEnum.AUDIT_PASS) { // 审核
|
||||||
errorDataList.addAll(item.getValue().stream().map(p -> {
|
// errorDataList.addAll(item.getValue().stream().map(p -> {
|
||||||
JSONObject o = JSONObject.from(p);
|
// JSONObject o = JSONObject.from(p);
|
||||||
o.put("status", "审核通过状态的不可导入");
|
// o.put("status", "审核通过状态的不可导入");
|
||||||
return o;
|
// return o;
|
||||||
}).collect(Collectors.toList()));
|
// }).collect(Collectors.toList()));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (exportIn.getEnterQuantity() != item.getValue().size()) {
|
if (exportIn.getEnterQuantity() != item.getValue().size()) {
|
||||||
errorDataList.addAll(item.getValue().stream().map(p -> {
|
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) {
|
if (countryList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getCiyCnname(), item.getOriginPlace())).count() == 0) {
|
||||||
JSONObject o = JSONObject.from(item);
|
JSONObject o = JSONObject.from(item);
|
||||||
o.put("status", "产地代码错误");
|
o.put("status", "产地错误");
|
||||||
errorDataList.add(o);
|
errorDataList.add(o);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3062,7 +3062,7 @@ public class ExportInHandler implements BaseHandler {
|
||||||
}
|
}
|
||||||
if (energyTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getEnergyTypeName())).count() == 0) {
|
if (energyTypeList.stream().filter(p -> StringUtils.equalsIgnoreCase(p.getText(), item.getEnergyTypeName())).count() == 0) {
|
||||||
JSONObject o = JSONObject.from(item);
|
JSONObject o = JSONObject.from(item);
|
||||||
o.put("status", "源类型不存在");
|
o.put("status", "能源类型不存在");
|
||||||
errorDataList.add(o);
|
errorDataList.add(o);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3465,4 +3465,13 @@ public class ExportInHandler implements BaseHandler {
|
||||||
|
|
||||||
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
|
return ResultUtil.success(rst, String.valueOf(page.getTotal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void formatData(List<CustomerExportIn> ins) {
|
||||||
|
if (CollectionUtils.isEmpty(ins)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ins.stream().forEach(item -> {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,20 +14,17 @@ import com.haitonggauto.rtosc.api.NuzarOpenApi;
|
||||||
import com.haitonggauto.rtosc.api.NuzarYardApi;
|
import com.haitonggauto.rtosc.api.NuzarYardApi;
|
||||||
import com.haitonggauto.rtosc.api.dto.*;
|
import com.haitonggauto.rtosc.api.dto.*;
|
||||||
import com.haitonggauto.rtosc.common.context.UserContext;
|
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.DictDTO;
|
||||||
import com.haitonggauto.rtosc.common.dto.Result;
|
import com.haitonggauto.rtosc.common.dto.Result;
|
||||||
import com.haitonggauto.rtosc.common.enums.ErrorType;
|
import com.haitonggauto.rtosc.common.enums.ErrorType;
|
||||||
import com.haitonggauto.rtosc.common.handler.BaseHandler;
|
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.ResultUtil;
|
||||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||||
import com.haitonggauto.rtosc.common.utils.WrapperKit;
|
import com.haitonggauto.rtosc.common.utils.WrapperKit;
|
||||||
import com.haitonggauto.rtosc.dto.*;
|
import com.haitonggauto.rtosc.dto.*;
|
||||||
import com.haitonggauto.rtosc.excel.ExportInCargoExportExcel;
|
import com.haitonggauto.rtosc.excel.ExportInspectExportExcel;
|
||||||
import com.haitonggauto.rtosc.excel.ExportInExportExcel;
|
|
||||||
import com.haitonggauto.rtosc.excel.InspectExportExcel;
|
|
||||||
import com.haitonggauto.rtosc.query.CargoQuery;
|
import com.haitonggauto.rtosc.query.CargoQuery;
|
||||||
import com.haitonggauto.rtosc.query.ExportInCheckQuery;
|
|
||||||
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
|
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
|
||||||
import com.haitonggauto.rtosc.query.ExportInspectQuery;
|
import com.haitonggauto.rtosc.query.ExportInspectQuery;
|
||||||
import com.haitonggauto.rtosc.repository.entity.*;
|
import com.haitonggauto.rtosc.repository.entity.*;
|
||||||
|
@ -326,6 +323,7 @@ public class ExportInspectHandler implements BaseHandler {
|
||||||
|
|
||||||
return ResultUtil.success(list);
|
return ResultUtil.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*
|
*
|
||||||
|
@ -684,8 +682,8 @@ public class ExportInspectHandler implements BaseHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* 导出excel
|
* 导出excel
|
||||||
|
*
|
||||||
* @param response
|
* @param response
|
||||||
*/
|
*/
|
||||||
@ApiOperation("导出excel")
|
@ApiOperation("导出excel")
|
||||||
|
@ -698,6 +696,7 @@ public class ExportInspectHandler implements BaseHandler {
|
||||||
query.setTradType("E");
|
query.setTradType("E");
|
||||||
query.setPage(1);
|
query.setPage(1);
|
||||||
query.setRows(500);
|
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() {
|
Wrapper<CustomerExportInspect> queryWrapper = new WrapperKit() {
|
||||||
}.changeBaseQueryToWrapper(CustomerExportInspect.class, query);
|
}.changeBaseQueryToWrapper(CustomerExportInspect.class, query);
|
||||||
ExcelWriter excelWriter = null;
|
ExcelWriter excelWriter = null;
|
||||||
|
@ -714,7 +713,7 @@ public class ExportInspectHandler implements BaseHandler {
|
||||||
|
|
||||||
excelWriter = EasyExcel.write(out).build();
|
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);
|
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
|
||||||
|
@ -752,19 +751,35 @@ public class ExportInspectHandler implements BaseHandler {
|
||||||
|
|
||||||
customerService.wrapperEntity(headers);
|
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());
|
List<CustomerExportInspectCargo> list = customerExportInspectCargoService.lambdaQuery()
|
||||||
InspectExportExcel e = PoMapper.instance.inspectEntity2ExportExcel(head, item);
|
.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.setSerialNo(index.getAndIncrement());
|
||||||
e.setShipVoyageName(StringUtils.join(head.getShipName(), "/", head.getVoyage()));
|
e.setShipVoyageName(StringUtils.join(head.getShipName(), "/", head.getVoyage()));
|
||||||
return e;
|
return e;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
excelWriter.write(details, writeSheet);
|
excelWriter.write(details, writeSheet);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.ExcelWriter;
|
import com.alibaba.excel.ExcelWriter;
|
||||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.alibaba.fastjson2.util.UUIDUtils;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
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.dto.Result;
|
||||||
import com.haitonggauto.rtosc.common.enums.ErrorType;
|
import com.haitonggauto.rtosc.common.enums.ErrorType;
|
||||||
import com.haitonggauto.rtosc.common.handler.BaseHandler;
|
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.ResultUtil;
|
||||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||||
import com.haitonggauto.rtosc.common.utils.WrapperKit;
|
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.excel.*;
|
||||||
import com.haitonggauto.rtosc.handler.excel.CustomCellWriteHandler;
|
import com.haitonggauto.rtosc.handler.excel.CustomCellWriteHandler;
|
||||||
import com.haitonggauto.rtosc.query.CargoQuery;
|
import com.haitonggauto.rtosc.query.CargoQuery;
|
||||||
import com.haitonggauto.rtosc.query.ExportInCheckQuery;
|
|
||||||
import com.haitonggauto.rtosc.query.ExportLoadCheckQuery;
|
import com.haitonggauto.rtosc.query.ExportLoadCheckQuery;
|
||||||
import com.haitonggauto.rtosc.query.ExportLoadQuery;
|
import com.haitonggauto.rtosc.query.ExportLoadQuery;
|
||||||
import com.haitonggauto.rtosc.repository.entity.*;
|
import com.haitonggauto.rtosc.repository.entity.*;
|
||||||
|
@ -717,6 +714,10 @@ public class ExportLoadHandler implements BaseHandler {
|
||||||
List<WorkStatusDTO> status = openApi.getVinStatus(req);
|
List<WorkStatusDTO> status = openApi.getVinStatus(req);
|
||||||
collect = status.stream().collect(Collectors.toMap(WorkStatusDTO::getVinCode, WorkStatusDTO::getWorkStatus));
|
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)) {
|
if (MapUtils.isNotEmpty(collect)) {
|
||||||
for (CustomerExportLoadCargo cargo : page.getRecords()) {
|
for (CustomerExportLoadCargo cargo : page.getRecords()) {
|
||||||
cargo.setWorkStatus(collect.get(cargo.getVin()));
|
cargo.setWorkStatus(collect.get(cargo.getVin()));
|
||||||
|
@ -1409,8 +1410,8 @@ public class ExportLoadHandler implements BaseHandler {
|
||||||
|
|
||||||
//普通下拉数据
|
//普通下拉数据
|
||||||
Map<Integer, String[]> map = new HashMap<>();
|
Map<Integer, String[]> map = new HashMap<>();
|
||||||
String[] isZgArray = {"是", "否"};
|
String[] isZgArray = {"正常", "国内中转", "外进转内出", "长江","沿海"};
|
||||||
map.put(3, isZgArray);
|
map.put(2, isZgArray);
|
||||||
//检查类型-子类
|
//检查类型-子类
|
||||||
Map<String, List<String>> inspNameMap = new HashMap<>();
|
Map<String, List<String>> inspNameMap = new HashMap<>();
|
||||||
//检查类型-父类
|
//检查类型-父类
|
||||||
|
|
|
@ -22,8 +22,8 @@ import com.haitonggauto.rtosc.common.utils.ResultUtil;
|
||||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||||
import com.haitonggauto.rtosc.common.utils.WrapperKit;
|
import com.haitonggauto.rtosc.common.utils.WrapperKit;
|
||||||
import com.haitonggauto.rtosc.dto.*;
|
import com.haitonggauto.rtosc.dto.*;
|
||||||
import com.haitonggauto.rtosc.excel.ExportInExportExcel;
|
import com.haitonggauto.rtosc.excel.ExportInspectExportExcel;
|
||||||
import com.haitonggauto.rtosc.excel.InspectExportExcel;
|
import com.haitonggauto.rtosc.excel.ImportInspectExportExcel;
|
||||||
import com.haitonggauto.rtosc.handler.mapper.PoMapper;
|
import com.haitonggauto.rtosc.handler.mapper.PoMapper;
|
||||||
import com.haitonggauto.rtosc.query.CargoQuery;
|
import com.haitonggauto.rtosc.query.CargoQuery;
|
||||||
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
|
import com.haitonggauto.rtosc.query.ExportInspectCheckQuery;
|
||||||
|
@ -679,7 +679,7 @@ public class ImportInspectHandler implements BaseHandler {
|
||||||
|
|
||||||
excelWriter = EasyExcel.write(out).build();
|
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);
|
Page<CustomerExportInspect> page = customerExportInspectService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
|
||||||
|
@ -717,19 +717,34 @@ public class ImportInspectHandler implements BaseHandler {
|
||||||
|
|
||||||
customerService.wrapperEntity(headers);
|
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());
|
List<CustomerExportInspectCargo> list = customerExportInspectCargoService.lambdaQuery()
|
||||||
InspectExportExcel e = PoMapper.instance.inspectEntity2ExportExcel(head, item);
|
.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.setSerialNo(index.getAndIncrement());
|
||||||
e.setShipVoyageName(StringUtils.join(head.getShipName(), "/", head.getVoyage()));
|
e.setShipVoyageName(StringUtils.join(head.getShipName(), "/", head.getVoyage()));
|
||||||
return e;
|
return e;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
excelWriter.write(details, writeSheet);
|
excelWriter.write(details, writeSheet);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.haitonggauto.rtosc.handler.excel;
|
||||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
|
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.usermodel.*;
|
||||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ public class CustomCellWriteHandler implements SheetWriteHandler {
|
||||||
// 获取工作簿对象,用于创建存放下拉数据的字典sheet数据页
|
// 获取工作簿对象,用于创建存放下拉数据的字典sheet数据页
|
||||||
Workbook workbook = writeWorkbookHolder.getWorkbook();
|
Workbook workbook = writeWorkbookHolder.getWorkbook();
|
||||||
|
|
||||||
|
if (MapUtils.isNotEmpty(map)) {
|
||||||
// 普通数据,迭代索引,用于存放下拉数据的字典sheet数据页命名
|
// 普通数据,迭代索引,用于存放下拉数据的字典sheet数据页命名
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (Map.Entry<Integer, String[]> entry : map.entrySet()) {
|
for (Map.Entry<Integer, String[]> entry : map.entrySet()) {
|
||||||
|
@ -86,8 +89,9 @@ public class CustomCellWriteHandler implements SheetWriteHandler {
|
||||||
DataValidationConstraint constraint = helper.createFormulaListConstraint(dictSheetName);
|
DataValidationConstraint constraint = helper.createFormulaListConstraint(dictSheetName);
|
||||||
setValidation(sheet, helper, constraint, infoList);
|
setValidation(sheet, helper, constraint, infoList);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MapUtils.isNotEmpty(inspNameArray) && MapUtils.isNotEmpty(probPropsNameArray)) {
|
||||||
//检查类型-父类
|
//检查类型-父类
|
||||||
Sheet hideSheet = workbook.createSheet("site");
|
Sheet hideSheet = workbook.createSheet("site");
|
||||||
workbook.setSheetHidden(workbook.getSheetIndex(hideSheet), false);
|
workbook.setSheetHidden(workbook.getSheetIndex(hideSheet), false);
|
||||||
|
@ -138,13 +142,15 @@ public class CustomCellWriteHandler implements SheetWriteHandler {
|
||||||
String formula = "site!" + range;
|
String formula = "site!" + range;
|
||||||
name.setRefersToFormula(formula);
|
name.setRefersToFormula(formula);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///开始设置(大类小类)下拉框
|
///开始设置(大类小类)下拉框
|
||||||
DataValidationHelper dvHelper = sheet.getDataValidationHelper();
|
DataValidationHelper dvHelper = sheet.getDataValidationHelper();
|
||||||
// 大类规则
|
// 大类规则
|
||||||
DataValidationConstraint expConstraint = dvHelper.createExplicitListConstraint(proInspNameArray);
|
// DataValidationConstraint expConstraint = dvHelper.createExplicitListConstraint(proInspNameArray);
|
||||||
CellRangeAddressList expRangeAddressList = new CellRangeAddressList(1, 1048575, 3, 3);
|
// CellRangeAddressList expRangeAddressList = new CellRangeAddressList(1, 1048575, 3, 3);
|
||||||
setValidation(sheet, dvHelper, expConstraint, expRangeAddressList);
|
// setValidation(sheet, dvHelper, expConstraint, expRangeAddressList);
|
||||||
|
|
||||||
|
|
||||||
//检查类型-子类
|
//检查类型-子类
|
||||||
// 小类规则(各单元格按个设置)
|
// 小类规则(各单元格按个设置)
|
||||||
|
|
|
@ -97,5 +97,5 @@ public interface PoMapper {
|
||||||
@Mapping(source = "cargo.cartType", target = "cartType")
|
@Mapping(source = "cargo.cartType", target = "cartType")
|
||||||
@Mapping(source = "cargo.vin", target = "vin")
|
@Mapping(source = "cargo.vin", target = "vin")
|
||||||
@Mapping(source = "head.company", target = "company")
|
@Mapping(source = "head.company", target = "company")
|
||||||
InspectExportExcel inspectEntity2ExportExcel(CustomerExportInspect head, CustomerExportInspectCargo cargo);
|
ExportInspectExportExcel inspectEntity2ExportExcel(CustomerExportInspect head, CustomerExportInspectCargo cargo);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -73,6 +73,14 @@ public class CustomerExportLoadCargo extends BaseEntity implements Serializable
|
||||||
@ApiModelProperty(value = "作业状态")
|
@ApiModelProperty(value = "作业状态")
|
||||||
private String workStatus;
|
private String workStatus;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "目的港ID")
|
||||||
|
private String destPortId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "目的港")
|
||||||
|
private String destPort;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "基本信息")
|
@ApiModelProperty(value = "基本信息")
|
||||||
private CustomerExportLoad exportLoad;
|
private CustomerExportLoad exportLoad;
|
||||||
|
|
Loading…
Reference in New Issue