This commit is contained in:
mash 2024-10-14 16:59:51 +08:00
parent 0287b861af
commit 45273128ac
3 changed files with 58 additions and 36 deletions

View File

@ -215,8 +215,8 @@ public class ProductCategoryController extends DefaultBaseController {
int pageIndex = 1;
while (true) {
PageResult<ProductCategory> pageResult = productCategoryService.query(pageIndex, getExportSize(), vo);
List<ProductCategoryExportModel> models = BeanUtil.copyToList(pageResult.getDatas(), ProductCategoryExportModel.class);
models.forEach(e -> e.setAvailable(BooleanUtil.toBoolean(e.getAvailable()) ? "启用" : "停用"));
List<ProductCategory> datas = pageResult.getDatas();
List<ProductCategoryExportModel> models = datas.stream().map(ProductCategoryExportModel::new).collect(Collectors.toList());
builder.doWrite(models);
if (!pageResult.isHasNext()) {

View File

@ -2,11 +2,14 @@ package com.lframework.xingyun.basedata.excel.product.category;
import com.alibaba.excel.annotation.ExcelProperty;
import com.lframework.starter.web.annotations.excel.ExcelRequired;
import com.lframework.starter.web.bo.BaseBo;
import com.lframework.starter.web.components.excel.ExcelModel;
import com.lframework.xingyun.basedata.entity.ProductCategory;
import com.lframework.xingyun.template.core.enums.Available;
import lombok.Data;
@Data
public class ProductCategoryExportModel implements ExcelModel {
public class ProductCategoryExportModel extends BaseBo<ProductCategory> implements ExcelModel {
/**
* 编号
@ -34,4 +37,27 @@ public class ProductCategoryExportModel implements ExcelModel {
@ExcelProperty("备注")
private String description;
@Override
protected void afterInit(ProductCategory dto) {
this.available = dto.getAvailable() ? Available.ENABLE.getDesc() : Available.UNABLE.getDesc();
}
@Override
public <A> BaseBo<ProductCategory> convert(ProductCategory dto) {
return super.convert(dto);
}
@Override
protected void init(ProductCategory dto) {
super.init(dto);
}
public ProductCategoryExportModel() {
}
public ProductCategoryExportModel(ProductCategory dto) {
super(dto);
}
}

View File

@ -1,5 +1,6 @@
package com.lframework.xingyun.sc.bo.purchase;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lframework.starter.common.constants.StringPool;
@ -23,10 +24,10 @@ import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import lombok.Data;
@Data
public class QueryPurchaseOrderBo extends BaseBo<PurchaseOrder> {
@ -185,18 +186,13 @@ public class QueryPurchaseOrderBo extends BaseBo<PurchaseOrder> {
PurchaseOrderWithReceiveBo result = new PurchaseOrderWithReceiveBo(data);
ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class);
List<ReceiveSheet> receiveSheetList = receiveSheetService.list(Wrappers.lambdaQuery(ReceiveSheet.class).eq(ReceiveSheet::getPurchaseOrderId, id).eq(ReceiveSheet::getStatus, PurchaseOrderStatus.APPROVE_PASS.getCode()));
if (receiveSheetList.isEmpty()) {
LambdaQueryWrapper<ReceiveSheet> queryWrapper = Wrappers.lambdaQuery(ReceiveSheet.class)
.eq(ReceiveSheet::getPurchaseOrderId, id).eq(ReceiveSheet::getStatus, PurchaseOrderStatus.APPROVE_PASS.getCode());
int receiveSheetList = receiveSheetService.count(queryWrapper);
if (receiveSheetList == 0) {
this.orderStatus = OrderStatus.IN_LOGISTICS.getCode();
} else {
if (result.getDetails() == null) {
this.orderStatus = OrderStatus.COMPLETE_RECEIPT_OF_GOODS.getCode();
} else {
int reduce = result.getDetails().stream().mapToInt(PurchaseOrderWithReceiveBo.DetailBo::getRemainNum).sum();
if (reduce > 0) {
this.orderStatus = OrderStatus.PARTIAL_RECEIPT_OF_GOODS.getCode();
}
}
this.orderStatus = result.getDetails() != null ? OrderStatus.PARTIAL_RECEIPT_OF_GOODS.getCode() : OrderStatus.COMPLETE_RECEIPT_OF_GOODS.getCode();
}
this.status = dto.getStatus().getCode();