批量修改

This commit is contained in:
dengjun 2023-12-25 13:53:40 +08:00
parent 031902091a
commit 21800c12d8
4 changed files with 45 additions and 12 deletions

View File

@ -47,22 +47,22 @@ public class ExportInCheckQuery extends BaseQuery {
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "开始申请时间") @ApiModelProperty(value = "开始申请时间")
@DbQuery(field = "applyTime", symbol = SqlSymbol.GTE) @DbQuery(field = "applyTime", symbol = SqlSymbol.GTE)
private Date beginApplyTime; private Date beginEnterTime;
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "结束申请时间") @ApiModelProperty(value = "结束申请时间")
@DbQuery(field = "applyTime", symbol = SqlSymbol.LTE) @DbQuery(field = "applyTime", symbol = SqlSymbol.LTE)
private Date endApplyTime; private Date endEnterTime;
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "开始进场时间") @ApiModelProperty(value = "开始进场时间")
@DbQuery(field = "beginEnterTime", symbol = SqlSymbol.GTE) @DbQuery(field = "beginEnterTime", symbol = SqlSymbol.GTE)
private Date beginEnterTime; private Date beginApplyTime;
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "结束进场时间") @ApiModelProperty(value = "结束进场时间")
@DbQuery(field = "endEnterTime", symbol = SqlSymbol.LTE) @DbQuery(field = "endEnterTime", symbol = SqlSymbol.LTE)
private Date endEnterTime; private Date endApplyTime;
@ApiModelProperty(value = "贸易类型") @ApiModelProperty(value = "贸易类型")
private String tradType; private String tradType;

View File

@ -290,6 +290,12 @@ public class DepartureHandler implements BaseHandler {
public Result<String> submitCheckReverse(@RequestBody public Result<String> submitCheckReverse(@RequestBody
@NotNull(message = "请传入要审核的提离港区ID") @NotNull(message = "请传入要审核的提离港区ID")
@Size(min = 1, message = "ID列表不能为空") List<Long> ids) { @Size(min = 1, message = "ID列表不能为空") List<Long> ids) {
// 是否除提交审核的其它状态
Long count = departureService.lambdaQuery().in(CustomerDeparture::getId, ids).ne(CustomerDeparture::getCheckStatus, AuditEnum.AUDIT).count();
if (count > 0) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "有非待审核状态数据,不能撤销");
}
departureService.lambdaUpdate().set(CustomerDeparture::getCheckStatus, AuditEnum.SUBMIT) departureService.lambdaUpdate().set(CustomerDeparture::getCheckStatus, AuditEnum.SUBMIT)
.set(CustomerDeparture::getCheckResult, null).in(CustomerDeparture::getId, ids).update(); .set(CustomerDeparture::getCheckResult, null).in(CustomerDeparture::getId, ids).update();
return ResultUtil.success("success"); return ResultUtil.success("success");

View File

@ -311,28 +311,44 @@ public class ExportInHandler implements BaseHandler {
// if (query.getCheckStatus() == null) { // if (query.getCheckStatus() == null) {
// query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT)); // query.setCheckStatusList(Arrays.asList(AuditEnum.AUDIT, AuditEnum.AUDIT_PASS, AuditEnum.AUDIT_REJECT));
// } // }
// String vin = query.getVin(); String vin = query.getVin();
// if (StringUtils.isNotEmpty(vin)) { if (StringUtils.isNotEmpty(vin)) {
// query.setVin(null); query.setVin(null);
// } }
query.setBillNum(null); // query.setBillNum(null);
query.setCheckStatus(AuditEnum.AUDIT_PASS); query.setCheckStatus(AuditEnum.AUDIT_PASS);
// 条件过滤查询
QueryWrapper<CustomerExportIn> queryWrapper = (QueryWrapper) new WrapperKit() { QueryWrapper<CustomerExportIn> queryWrapper = (QueryWrapper) new WrapperKit() {
}.changeBaseQueryToWrapper(CustomerExportIn.class, query); }.changeBaseQueryToWrapper(CustomerExportIn.class, query);
queryWrapper.select("sum(quantity) as quantity, port_area_id, ship_id, voyage_id, max(update_date) as update_date"); queryWrapper.select("sum(quantity) as quantity, port_area_id, ship_id, voyage_id, max(update_date) as update_date");
queryWrapper.groupBy("port_area_id, ship_id, voyage_id"); queryWrapper.groupBy("port_area_id, ship_id, voyage_id");
// if (StringUtils.isNotEmpty(vin)) { if (StringUtils.isNotEmpty(vin)) {
// queryWrapper.exists("select id from customer_export_in_cargo where customer_export_in_cargo.export_in_id=customer_export_in.id and customer_export_in_cargo.vin={0}", vin); queryWrapper.exists("select id from customer_export_in_cargo where customer_export_in_cargo.export_in_id=customer_export_in.id and customer_export_in_cargo.vin={0}", vin);
// } }
Page<CustomerExportIn> page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper); Page<CustomerExportIn> page = customerExportInService.page(new Page<>(query.getPage(), query.getRows()), queryWrapper);
customerService.wrapperEntity(page.getRecords()); customerService.wrapperEntity(page.getRecords());
// 总量查询
if (CollectionUtils.isNotEmpty(page.getRecords())) {
QueryWrapper<CustomerExportIn> q = new QueryWrapper<>();
q.in("voyage_id", page.getRecords().stream().map(item -> item.getVoyageId()).collect(Collectors.toList()));
q.select("sum(quantity) as quantity, port_area_id, ship_id, voyage_id");
q.groupBy("port_area_id, ship_id, voyage_id");
List<CustomerExportIn> list = customerExportInService.list(q);
Map<String, Integer> map = list.stream().collect(Collectors.toMap(item -> StringUtils.joinWith("@", item.getPortAreaId(), item.getShipId(), item.getVoyageId()), item -> item.getQuantity()));
page.getRecords().stream().forEach(item -> {
item.setQuantity(map.get(StringUtils.joinWith("@", item.getPortAreaId(), item.getShipId(), item.getVoyageId())));
});
}
return ResultUtil.success(page); return ResultUtil.success(page);
} }
@ -683,6 +699,11 @@ public class ExportInHandler implements BaseHandler {
public Result<String> submitCheckReverse(@RequestBody public Result<String> submitCheckReverse(@RequestBody
@NotNull(message = "请传入要审核的出口进场ID") @NotNull(message = "请传入要审核的出口进场ID")
@Size(min = 1, message = "ID列表不能为空") List<Long> ids) { @Size(min = 1, message = "ID列表不能为空") List<Long> ids) {
// 是否除提交审核的其它状态
Long count = customerExportInService.lambdaQuery().in(CustomerExportIn::getId, ids).ne(CustomerExportIn::getCheckStatus, AuditEnum.AUDIT).count();
if (count > 0) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "有非待审核状态数据,不能撤销");
}
customerExportInService.lambdaUpdate().set(CustomerExportIn::getCheckStatus, AuditEnum.SUBMIT) customerExportInService.lambdaUpdate().set(CustomerExportIn::getCheckStatus, AuditEnum.SUBMIT)
.set(CustomerExportIn::getCheckResult, null) .set(CustomerExportIn::getCheckResult, null)
.in(CustomerExportIn::getId, ids).update(); .in(CustomerExportIn::getId, ids).update();

View File

@ -414,6 +414,12 @@ public class ExportLoadHandler implements BaseHandler {
public Result<String> submitCheckReverse(@RequestBody public Result<String> submitCheckReverse(@RequestBody
@NotNull(message = "请传入要审核的出口装船ID") @NotNull(message = "请传入要审核的出口装船ID")
@Size(min = 1, message = "ID列表不能为空") List<Long> ids) { @Size(min = 1, message = "ID列表不能为空") List<Long> ids) {
// 是否除提交审核的其它状态
Long count = customerExportLoadService.lambdaQuery().in(CustomerExportLoad::getId, ids).ne(CustomerExportLoad::getCheckStatus, AuditEnum.AUDIT).count();
if (count > 0) {
return ResultUtil.failure(ErrorType.PARAMS_ERROR.id(), "有非待审核状态数据,不能撤销");
}
customerExportLoadService.lambdaUpdate().set(CustomerExportLoad::getCheckStatus, AuditEnum.SUBMIT) customerExportLoadService.lambdaUpdate().set(CustomerExportLoad::getCheckStatus, AuditEnum.SUBMIT)
.set(CustomerExportLoad::getCheckResult, null).in(CustomerExportLoad::getId, ids).update(); .set(CustomerExportLoad::getCheckResult, null).in(CustomerExportLoad::getId, ids).update();
return ResultUtil.success("success"); return ResultUtil.success("success");