1,商品中心-商品类目,需要导出功能和按钮
2,采购管理-采购订单管理 添加订单状态 3,销售管理-销售订单管理 添加订单状态
This commit is contained in:
parent
ed9b38c123
commit
0287b861af
|
@ -1,7 +1,13 @@
|
|||
package com.lframework.xingyun.basedata.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import com.lframework.starter.common.exceptions.impl.DefaultClientException;
|
||||
import com.lframework.starter.common.utils.CollectionUtil;
|
||||
import com.lframework.starter.web.components.excel.ExcelMultipartWriterSheetBuilder;
|
||||
import com.lframework.starter.web.resp.PageResult;
|
||||
import com.lframework.xingyun.basedata.excel.product.category.ProductCategoryExportModel;
|
||||
import com.lframework.xingyun.basedata.excel.product.category.ProductCategoryExportModelVo;
|
||||
import com.lframework.xingyun.template.core.service.RecursionMappingService;
|
||||
import com.lframework.starter.web.annotations.security.HasPermission;
|
||||
import com.lframework.starter.web.common.utils.ApplicationUtil;
|
||||
|
@ -199,4 +205,29 @@ public class ProductCategoryController extends DefaultBaseController {
|
|||
|
||||
return InvokeResultBuilder.success();
|
||||
}
|
||||
|
||||
@ApiOperation("导出")
|
||||
@HasPermission({"base-data:product:category:export"})
|
||||
@PostMapping(value = "/export")
|
||||
public void exportExcel(@Valid ProductCategoryExportModelVo vo) {
|
||||
ExcelMultipartWriterSheetBuilder builder = ExcelUtil.multipartExportXls("商品类目", ProductCategoryExportModel.class);
|
||||
try {
|
||||
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()) ? "启用" : "停用"));
|
||||
builder.doWrite(models);
|
||||
|
||||
if (!pageResult.isHasNext()) {
|
||||
break;
|
||||
}
|
||||
pageIndex++;
|
||||
}
|
||||
} finally {
|
||||
builder.finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
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.components.excel.ExcelModel;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProductCategoryExportModel implements ExcelModel {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@ExcelRequired
|
||||
@ExcelProperty("编号")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ExcelRequired
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ExcelProperty("状态")
|
||||
private String available;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty("备注")
|
||||
private String description;
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.lframework.xingyun.basedata.excel.product.category;
|
||||
|
||||
import com.lframework.starter.web.vo.BaseVo;
|
||||
import com.lframework.starter.web.vo.SortPageVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ProductCategoryExportModelVo extends SortPageVo implements BaseVo, Serializable {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String available;
|
||||
}
|
|
@ -1,12 +1,19 @@
|
|||
package com.lframework.xingyun.basedata.impl.product;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.lframework.starter.common.constants.StringPool;
|
||||
import com.lframework.starter.common.exceptions.impl.DefaultClientException;
|
||||
import com.lframework.starter.common.utils.Assert;
|
||||
import com.lframework.starter.common.utils.CollectionUtil;
|
||||
import com.lframework.starter.common.utils.ObjectUtil;
|
||||
import com.lframework.starter.common.utils.StringUtil;
|
||||
import com.lframework.starter.web.resp.PageResult;
|
||||
import com.lframework.starter.web.utils.PageHelperUtil;
|
||||
import com.lframework.starter.web.utils.PageResultUtil;
|
||||
import com.lframework.xingyun.basedata.excel.product.category.ProductCategoryExportModelVo;
|
||||
import com.lframework.xingyun.template.core.annotations.OpLog;
|
||||
import com.lframework.xingyun.basedata.enums.BaseDataOpLogType;
|
||||
import com.lframework.starter.web.impl.BaseMpServiceImpl;
|
||||
|
@ -39,6 +46,22 @@ public class ProductCategoryServiceImpl extends
|
|||
@Autowired
|
||||
private RecursionMappingService recursionMappingService;
|
||||
|
||||
@Override
|
||||
public PageResult<ProductCategory> query(Integer pageIndex, Integer pageSize, ProductCategoryExportModelVo vo) {
|
||||
Assert.greaterThanZero(pageIndex);
|
||||
Assert.greaterThanZero(pageSize);
|
||||
|
||||
PageHelperUtil.startPage(pageIndex, pageSize);
|
||||
List<ProductCategory> datas = this.list(Wrappers.lambdaQuery(ProductCategory.class)
|
||||
.like(StrUtil.isNotBlank(vo.getName()), ProductCategory::getName,vo.getName())
|
||||
.like(StrUtil.isNotBlank(vo.getCode()), ProductCategory::getCode,vo.getCode())
|
||||
.eq(StrUtil.isNotBlank(vo.getAvailable()), ProductCategory::getAvailable,Boolean.TRUE)
|
||||
.orderByAsc(ProductCategory::getCode).orderByDesc(ProductCategory::getAvailable)
|
||||
);
|
||||
|
||||
return PageResultUtil.convert(new PageInfo<>(datas));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductCategory> getAllProductCategories() {
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.lframework.xingyun.basedata.service.product;
|
||||
|
||||
import com.lframework.starter.web.resp.PageResult;
|
||||
import com.lframework.starter.web.service.BaseMpService;
|
||||
import com.lframework.xingyun.basedata.entity.ProductCategory;
|
||||
import com.lframework.xingyun.basedata.excel.product.category.ProductCategoryExportModelVo;
|
||||
import com.lframework.xingyun.basedata.vo.product.category.CreateProductCategoryVo;
|
||||
import com.lframework.xingyun.basedata.vo.product.category.QueryProductCategorySelectorVo;
|
||||
import com.lframework.xingyun.basedata.vo.product.category.UpdateProductCategoryVo;
|
||||
|
@ -10,6 +12,16 @@ import java.util.List;
|
|||
|
||||
public interface ProductCategoryService extends BaseMpService<ProductCategory> {
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
PageResult<ProductCategory> query(Integer pageIndex, Integer pageSize, ProductCategoryExportModelVo vo);
|
||||
|
||||
/**
|
||||
* 查询全部类目信息
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.lframework.xingyun.sc.bo.purchase;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.lframework.starter.common.constants.StringPool;
|
||||
import com.lframework.starter.common.utils.StringUtil;
|
||||
|
@ -9,12 +10,21 @@ import com.lframework.xingyun.basedata.entity.StoreCenter;
|
|||
import com.lframework.xingyun.basedata.entity.Supplier;
|
||||
import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService;
|
||||
import com.lframework.xingyun.basedata.service.supplier.SupplierService;
|
||||
import com.lframework.xingyun.sc.dto.purchase.PurchaseOrderWithReceiveDto;
|
||||
import com.lframework.xingyun.sc.entity.PurchaseOrder;
|
||||
import com.lframework.xingyun.sc.entity.ReceiveSheet;
|
||||
import com.lframework.xingyun.sc.enums.OrderStatus;
|
||||
import com.lframework.xingyun.sc.enums.PurchaseOrderStatus;
|
||||
import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService;
|
||||
import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService;
|
||||
import com.lframework.xingyun.template.core.service.UserService;
|
||||
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
|
||||
|
@ -125,6 +135,12 @@ public class QueryPurchaseOrderBo extends BaseBo<PurchaseOrder> {
|
|||
@ApiModelProperty("状态")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
@ApiModelProperty("订单状态")
|
||||
private Integer orderStatus;
|
||||
|
||||
/**
|
||||
* 拒绝原因
|
||||
*/
|
||||
|
@ -164,6 +180,25 @@ public class QueryPurchaseOrderBo extends BaseBo<PurchaseOrder> {
|
|||
this.approveBy = userService.findById(dto.getApproveBy()).getName();
|
||||
}
|
||||
|
||||
PurchaseOrderService purchaseOrderService = ApplicationUtil.getBean(PurchaseOrderService.class);
|
||||
PurchaseOrderWithReceiveDto data = purchaseOrderService.getWithReceive(id);
|
||||
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()) {
|
||||
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.status = dto.getStatus().getCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,10 @@ import com.lframework.xingyun.basedata.entity.Customer;
|
|||
import com.lframework.xingyun.basedata.entity.StoreCenter;
|
||||
import com.lframework.xingyun.basedata.service.customer.CustomerService;
|
||||
import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService;
|
||||
import com.lframework.xingyun.sc.dto.sale.SaleOrderWithOutDto;
|
||||
import com.lframework.xingyun.sc.entity.SaleOrder;
|
||||
import com.lframework.xingyun.sc.enums.OrderStatus;
|
||||
import com.lframework.xingyun.sc.service.sale.SaleOrderService;
|
||||
import com.lframework.xingyun.template.core.service.UserService;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -117,6 +120,12 @@ public class QuerySaleOrderBo extends BaseBo<SaleOrder> {
|
|||
@ApiModelProperty("状态")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
@ApiModelProperty("订单状态")
|
||||
private Integer orderStatus;
|
||||
|
||||
/**
|
||||
* 拒绝原因
|
||||
*/
|
||||
|
@ -156,6 +165,12 @@ public class QuerySaleOrderBo extends BaseBo<SaleOrder> {
|
|||
this.approveBy = userService.findById(dto.getApproveBy()).getName();
|
||||
}
|
||||
|
||||
SaleOrderService saleOrderService = ApplicationUtil.getBean(SaleOrderService.class);
|
||||
SaleOrderWithOutDto data = saleOrderService.getWithOut(id);
|
||||
SaleOrderWithOutBo result = new SaleOrderWithOutBo(data);
|
||||
|
||||
this.orderStatus = result.getDetails() != null ? OrderStatus.NOT_SHIPPED_YET.getCode() : OrderStatus.ALREADY_SHIPPED.getCode();
|
||||
|
||||
this.status = dto.getStatus().getCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.lframework.xingyun.sc.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.lframework.starter.web.enums.BaseEnum;
|
||||
|
||||
public enum OrderStatus implements BaseEnum<Integer> {
|
||||
|
||||
IN_LOGISTICS(0, "物流中"),
|
||||
PARTIAL_RECEIPT_OF_GOODS(1, "部分收货"),
|
||||
COMPLETE_RECEIPT_OF_GOODS(2, "完全收货"),
|
||||
|
||||
ALREADY_SHIPPED(3, "已发货"),
|
||||
NOT_SHIPPED_YET(4, "未发货");
|
||||
|
||||
@EnumValue
|
||||
private Integer code;
|
||||
|
||||
private String desc;
|
||||
|
||||
OrderStatus(Integer code, String desc) {
|
||||
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCode() {
|
||||
|
||||
return this.code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc() {
|
||||
|
||||
return this.desc;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue