进港导出格式
This commit is contained in:
parent
3250f6b570
commit
1dfb2a1279
|
@ -0,0 +1,27 @@
|
|||
package com.haitonggauto.rtosc.dto;
|
||||
|
||||
import com.haitonggauto.rtosc.common.utils.ValidationGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "提离明细编辑",description = "")
|
||||
public class DepartureDetailVo implements Serializable {
|
||||
|
||||
@NotNull(groups = {ValidationGroup.update.class}, message = "提离港区ID不能为空")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
@Valid
|
||||
@NotNull(groups = {ValidationGroup.insert.class, ValidationGroup.update.class}, message = "货物必须填!" )
|
||||
@Size(min = 1 , message = "提离港区验货物至少要有一个")
|
||||
private List<DepartureCargoVo> cargos;
|
||||
|
||||
}
|
|
@ -72,8 +72,14 @@ public class ExportInExcel {
|
|||
/**
|
||||
* 进场时间
|
||||
*/
|
||||
@ExcelProperty("进场时间")
|
||||
private String enterTime;
|
||||
@ExcelProperty("进场开始时间")
|
||||
private String beginEnterTime;
|
||||
|
||||
/**
|
||||
* 进场时间
|
||||
*/
|
||||
@ExcelProperty("进场结束时间")
|
||||
private String endEnterTime;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
|
@ -136,25 +142,25 @@ public class ExportInExcel {
|
|||
* 长
|
||||
*/
|
||||
@ExcelProperty("长")
|
||||
private Integer length;
|
||||
private BigDecimal length;
|
||||
|
||||
/**
|
||||
* 宽
|
||||
*/
|
||||
@ExcelProperty("宽")
|
||||
private Integer width;
|
||||
private BigDecimal width;
|
||||
|
||||
/**
|
||||
* 高
|
||||
*/
|
||||
@ExcelProperty("高")
|
||||
private Integer height;
|
||||
private BigDecimal height;
|
||||
|
||||
/**
|
||||
* 重量(吨)
|
||||
*/
|
||||
@ExcelProperty("重量(吨)")
|
||||
private Integer weight;
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* 操作模式
|
||||
|
|
|
@ -19,10 +19,7 @@ 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.*;
|
||||
import com.haitonggauto.rtosc.dto.CheckVinRepeatVo;
|
||||
import com.haitonggauto.rtosc.dto.DepartureCargoVo;
|
||||
import com.haitonggauto.rtosc.dto.DepartureCheckVo;
|
||||
import com.haitonggauto.rtosc.dto.DepartureVo;
|
||||
import com.haitonggauto.rtosc.dto.*;
|
||||
import com.haitonggauto.rtosc.query.CargoQuery;
|
||||
import com.haitonggauto.rtosc.query.DepartureQuery;
|
||||
import com.haitonggauto.rtosc.repository.entity.*;
|
||||
|
@ -62,6 +59,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -384,6 +382,66 @@ public class DepartureHandler implements BaseHandler {
|
|||
return ResultUtil.success(String.valueOf(departure.getId()));
|
||||
}
|
||||
|
||||
@ApiOperation("审核端明细编辑")
|
||||
@PostMapping("/cargo/edit")
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
// 使用LambdaUpdateWrapper只在特定需求下做处理(推荐) 将字段修改为空值的处理方法
|
||||
public Result<String> cargoEdit(@RequestBody @Validated(ValidationGroup.update.class) DepartureDetailVo form) {
|
||||
// 验证是否有重复的车架号
|
||||
if (CollectionUtils.isNotEmpty(form.getCargos())) {
|
||||
List<String> repeat = form.getCargos().stream().collect(Collectors.groupingBy(DepartureCargoVo::getVin, Collectors.counting()))
|
||||
.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(repeat)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号重复");
|
||||
}
|
||||
}
|
||||
|
||||
CustomerDeparture dep = departureService.getById(form.getId());
|
||||
if (dep.getCheckStatus() == AuditEnum.AUDIT_PASS) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "审核通过之后不能进行编辑");
|
||||
}
|
||||
|
||||
// 验证是否重复申请
|
||||
List<String> vins = form.getCargos().stream().map(item -> item.getVin()).collect(Collectors.toList());
|
||||
List<CustomerDepartureCargo> exists = departureCargoService.lambdaQuery().in(CustomerDepartureCargo::getVin, vins).ne(CustomerDepartureCargo::getDepartureId, form.getId()).list();
|
||||
List<String> repeat = exists.stream().map(item -> item.getVin()).collect(Collectors.toList());;
|
||||
if (CollectionUtils.isNotEmpty(exists)) {
|
||||
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), StringUtils.join(repeat, ",") + "车架号不能重复申请");
|
||||
}
|
||||
|
||||
|
||||
List<CustomerDepartureCargo> cargos = form.getCargos().stream().map(item -> {
|
||||
CustomerDepartureCargo entity = PoMapper.instance.departureCargoVo2Entity(item);
|
||||
entity.setDepartureId(dep.getId());
|
||||
entity.setTermcd(dep.getPortAreaId());
|
||||
return entity;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
{
|
||||
|
||||
List<CustomerDepartureCargo> insert = cargos.stream().filter(item -> item.getId() == null).collect(Collectors.toList());
|
||||
List<CustomerDepartureCargo> update = cargos.stream().filter(item -> item.getId() != null).collect(Collectors.toList());
|
||||
|
||||
// 需要更新的
|
||||
departureCargoService.updateBatchById(update);
|
||||
|
||||
// 需要删除的
|
||||
List<Long> collect = update.stream().map(item -> item.getId()).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CustomerDepartureCargo> query = new LambdaQueryWrapper<>();
|
||||
query.eq(CustomerDepartureCargo::getDepartureId, dep.getId());
|
||||
List<Long> delete = departureCargoService.list(query).stream()
|
||||
.map(item -> item.getId())
|
||||
.filter(item -> !collect.contains(item))
|
||||
.collect(Collectors.toList());
|
||||
departureCargoService.removeByIds(delete);
|
||||
|
||||
// 需要删除的
|
||||
departureCargoService.saveBatch(insert);
|
||||
}
|
||||
|
||||
return ResultUtil.success(String.valueOf(dep.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @param id
|
||||
|
|
|
@ -1367,6 +1367,15 @@ public class ExportInHandler implements BaseHandler {
|
|||
|
||||
}
|
||||
|
||||
@ApiOperation("验证是否是出口条码打印中的货物")
|
||||
@PostMapping("/valid/print/vin")
|
||||
public Result<List<String>> validPrintVin(@RequestBody @NotNull(message = "验证列表不能为空") @Size(min = 1, message = "验证列表不能为空") ValidList<String> vins) {
|
||||
List<CustomerExportInCargo> exists = customerExportInCargoService.list(new LambdaQueryWrapper<CustomerExportInCargo>().in(CustomerExportInCargo::getVin, vins));
|
||||
List<String> existVins = exists.stream().map(p -> p.getVin()).collect(Collectors.toList());
|
||||
|
||||
return ResultUtil.success(existVins);
|
||||
}
|
||||
|
||||
@ApiOperation("车架号导入(数组形式)")
|
||||
@PostMapping("/import-vin-data")
|
||||
public Result<List<JSONObject>> importVinData(@RequestBody @Validated ImportVinVo vinList) throws IOException {
|
||||
|
@ -2010,12 +2019,12 @@ public class ExportInHandler implements BaseHandler {
|
|||
List<ExportInExcel> rows = page.getRecords().stream().map(item -> {
|
||||
// item.setEnergyTypeName(item.getEnergyType().text());
|
||||
ExportInExcel e = PoMapper.instance.entity2Excel(item);
|
||||
e.setEnterTime(
|
||||
StringUtils.join(
|
||||
item.getBeginEnterTime() != null ? DateUtils.formatDate(item.getBeginEnterTime(), "yyyy-MM-dd HH:mm") : "",
|
||||
",",
|
||||
item.getEndEnterTime() != null ? DateUtils.formatDate(item.getEndEnterTime(), "yyyy-MM-dd HH:mm") : ""
|
||||
));
|
||||
// e.setEnterTime(
|
||||
// StringUtils.join(
|
||||
// item.getBeginEnterTime() != null ? DateUtils.formatDate(item.getBeginEnterTime(), "yyyy-MM-dd HH:mm") : "",
|
||||
// ",",
|
||||
// item.getEndEnterTime() != null ? DateUtils.formatDate(item.getEndEnterTime(), "yyyy-MM-dd HH:mm") : ""
|
||||
// ));
|
||||
// 处理一下时间问题
|
||||
return e;
|
||||
}).collect(Collectors.toList());
|
||||
|
|
|
@ -51,6 +51,8 @@ public interface PoMapper {
|
|||
|
||||
CustomerFreeTrade freeTradeCheckVo2Entity(FreeTradeCheckVo vo);
|
||||
|
||||
@Mapping(source = "beginEnterTime", target = "beginEnterTime", dateFormat="yyyy/MM/dd")
|
||||
@Mapping(source = "endEnterTime", target = "endEnterTime", dateFormat="yyyy/MM/dd")
|
||||
ExportInExcel entity2Excel(CustomerExportIn entity);
|
||||
|
||||
CustomerFreeTrade excel2Entity(FreeTradeExcel excel);
|
||||
|
|
Loading…
Reference in New Issue