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

View File

@ -2,36 +2,62 @@ package com.lframework.xingyun.basedata.excel.product.category;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.lframework.starter.web.annotations.excel.ExcelRequired; 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.starter.web.components.excel.ExcelModel;
import com.lframework.xingyun.basedata.entity.ProductCategory;
import com.lframework.xingyun.template.core.enums.Available;
import lombok.Data; import lombok.Data;
@Data @Data
public class ProductCategoryExportModel implements ExcelModel { public class ProductCategoryExportModel extends BaseBo<ProductCategory> implements ExcelModel {
/** /**
* 编号 * 编号
*/ */
@ExcelRequired @ExcelRequired
@ExcelProperty("编号") @ExcelProperty("编号")
private String code; private String code;
/** /**
* 名称 * 名称
*/ */
@ExcelRequired @ExcelRequired
@ExcelProperty("名称") @ExcelProperty("名称")
private String name; private String name;
/** /**
* 状态 * 状态
*/ */
@ExcelProperty("状态") @ExcelProperty("状态")
private String available; private String available;
/** /**
* 备注 * 备注
*/ */
@ExcelProperty("备注") @ExcelProperty("备注")
private String description; 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; package com.lframework.xingyun.sc.bo.purchase;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.lframework.starter.common.constants.StringPool; import com.lframework.starter.common.constants.StringPool;
@ -23,10 +24,10 @@ import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import lombok.Data; import lombok.Data;
@Data @Data
public class QueryPurchaseOrderBo extends BaseBo<PurchaseOrder> { public class QueryPurchaseOrderBo extends BaseBo<PurchaseOrder> {
@ -185,18 +186,13 @@ public class QueryPurchaseOrderBo extends BaseBo<PurchaseOrder> {
PurchaseOrderWithReceiveBo result = new PurchaseOrderWithReceiveBo(data); PurchaseOrderWithReceiveBo result = new PurchaseOrderWithReceiveBo(data);
ReceiveSheetService receiveSheetService = ApplicationUtil.getBean(ReceiveSheetService.class); 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())); LambdaQueryWrapper<ReceiveSheet> queryWrapper = Wrappers.lambdaQuery(ReceiveSheet.class)
if (receiveSheetList.isEmpty()) { .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(); this.orderStatus = OrderStatus.IN_LOGISTICS.getCode();
} else { } else {
if (result.getDetails() == null) { this.orderStatus = result.getDetails() != null ? OrderStatus.PARTIAL_RECEIPT_OF_GOODS.getCode() : OrderStatus.COMPLETE_RECEIPT_OF_GOODS.getCode();
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.status = dto.getStatus().getCode(); this.status = dto.getStatus().getCode();