Commit 4d0e9e6d by 杨浩

拆分采购订单到拣货

parent 15236b1f
...@@ -16,6 +16,7 @@ public enum ErpDeliveryStatus implements ArrayValuable<String> { ...@@ -16,6 +16,7 @@ public enum ErpDeliveryStatus implements ArrayValuable<String> {
MATCHED("MATCHED", "已匹配"), MATCHED("MATCHED", "已匹配"),
NOT_YET("NOT_YET", "未发货"), NOT_YET("NOT_YET", "未发货"),
ALREADY("ALREADY", "已发货"), ALREADY("ALREADY", "已发货"),
ARRIVAL("ARRIVAL", "已到货"),
; ;
public static final String[] ARRAYS = Arrays.stream(values()).map(ErpDeliveryStatus::getStatus).toArray(String[]::new); public static final String[] ARRAYS = Arrays.stream(values()).map(ErpDeliveryStatus::getStatus).toArray(String[]::new);
......
package cn.iocoder.foodnexus.module.erp.controller.admin.purchase;
import cn.iocoder.foodnexus.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.foodnexus.framework.common.enums.CommonStatusEnum;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils;
import cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.supplier.ErpProductSupplierBindReqVO;
import cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO;
import cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierRespVO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import cn.iocoder.foodnexus.module.erp.service.product.ProductSupplierService;
import cn.iocoder.foodnexus.module.erp.service.purchase.ErpSupplierService;
import cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.ProductSpuPageReqVO;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService;
import cn.iocoder.foodnexus.module.system.controller.admin.vo.AuditCommonReqVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.foodnexus.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.foodnexus.framework.common.pojo.CommonResult.success;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertList;
@Tag(name = "管理后台 - ERP 供应商")
@RestController
@RequestMapping("/erp/supplier")
@Validated
public class ErpSupplierController {
@Resource
private ErpSupplierService supplierService;
@Autowired
private ProductSupplierService productSupplierService;
@Autowired
private ProductSpuService productSpuService;
/*@PostMapping("/create")
@Operation(summary = "创建供应商")
@PreAuthorize("@ss.hasPermission('erp:supplier:create')")
public CommonResult<Long> createSupplier(@Valid @RequestBody ErpSupplierSaveReqVO createReqVO) {
return success(supplierService.createSupplier(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新供应商")
@PreAuthorize("@ss.hasPermission('erp:supplier:update')")
public CommonResult<Boolean> updateSupplier(@Valid @RequestBody ErpSupplierSaveReqVO updateReqVO) {
supplierService.updateSupplier(updateReqVO);
return success(true);
}*/
@PutMapping("/audit")
@Operation(summary = "审核供应商")
@PreAuthorize("@ss.hasPermission('erp:supplier:update')")
public CommonResult<Boolean> audit(@Valid @RequestBody AuditCommonReqVO auditReqVO) {
supplierService.audit(auditReqVO);
return success(true);
}
@PostMapping("/bind-product")
@Operation(summary = "绑定商品")
@PreAuthorize("@ss.hasPermission('erp:supplier:update')")
public CommonResult<Boolean> bindProduct(@Valid @RequestBody ErpProductSupplierBindReqVO bindReqVO) {
supplierService.bindProduct(bindReqVO);
return success(Boolean.TRUE);
}
@GetMapping("/query-product")
@Operation(summary = "根据供应商查询对应商品")
@Parameter(name = "supplierId", description = "编号", required = true, example = "1024")
public CommonResult<PageResult<ProductSpuDO>> querySupplier(@RequestParam("supplierId") Long supplierId,
@Valid ProductSpuPageReqVO pageReqVO ) {
List<Long> productIds = productSupplierService.queryBySupplierId(supplierId);
if (CommonUtil.isNotEmpty(productIds)) {
pageReqVO.setIdList(productIds);
return success(productSpuService.getSpuPage(pageReqVO));
}
return success(PageResult.empty());
}
@GetMapping("/query-supplier")
@Operation(summary = "根据产品查询对应供应商")
@Parameter(name = "productId", description = "编号", required = true, example = "1024")
public CommonResult<PageResult<ErpSupplierDO>> querySupplier(@RequestParam("productId") Long productId,
@Valid ErpSupplierPageReqVO pageReqVO ) {
List<Long> supplierIds = productSupplierService.queryByProductId(productId);
if (CommonUtil.isNotEmpty(supplierIds)) {
pageReqVO.setIdList(supplierIds);
return success(supplierService.getSupplierPage(pageReqVO));
}
return success(PageResult.empty());
}
@DeleteMapping("/delete")
@Operation(summary = "删除供应商")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:supplier:delete')")
public CommonResult<Boolean> deleteSupplier(@RequestParam("id") Long id) {
supplierService.deleteSupplier(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得供应商")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:supplier:query')")
public CommonResult<ErpSupplierRespVO> getSupplier(@RequestParam("id") Long id) {
ErpSupplierDO supplier = supplierService.getSupplier(id);
return success(BeanUtils.toBean(supplier, ErpSupplierRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得供应商分页")
@PreAuthorize("@ss.hasPermission('erp:supplier:query')")
public CommonResult<PageResult<ErpSupplierRespVO>> getSupplierPage(@Valid ErpSupplierPageReqVO pageReqVO) {
PageResult<ErpSupplierDO> pageResult = supplierService.getSupplierPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpSupplierRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得供应商精简列表", description = "只包含被开启的供应商,主要用于前端的下拉选项")
public CommonResult<List<ErpSupplierRespVO>> getSupplierSimpleList() {
List<ErpSupplierDO> list = supplierService.getSupplierListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(convertList(list, supplier -> new ErpSupplierRespVO().setId(supplier.getId()).setName(supplier.getName())));
}
@GetMapping("/export-excel")
@Operation(summary = "导出供应商 Excel")
@PreAuthorize("@ss.hasPermission('erp:supplier:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportSupplierExcel(@Valid ErpSupplierPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpSupplierDO> list = supplierService.getSupplierPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "供应商.xls", "数据", ErpSupplierRespVO.class,
BeanUtils.toBean(list, ErpSupplierRespVO.class));
}
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.erp.controller.app; package cn.iocoder.foodnexus.module.erp.controller.admin.purchase;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum; import cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum;
...@@ -27,7 +27,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; ...@@ -27,7 +27,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -44,12 +43,12 @@ import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUt ...@@ -44,12 +43,12 @@ import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUt
* create at: 2025/9/23 11:11 * create at: 2025/9/23 11:11
* @description: 采购订单 * @description: 采购订单
*/ */
@Tag(name = "管理后台 - ERP 采购订单") @Tag(name = "管理后台 - ERP 采购订单(仓库管理)")
@RestController @RestController
@RequestMapping("/supplier/purchase-order") @RequestMapping("/supplier/purchase-order")
@Validated @Validated
@AppSystemAuth(UserSystemEnum.SUPPLIER) @AppSystemAuth(UserSystemEnum.SUPPLIER)
public class AppPurchaseOrderController { public class PurchaseOrderController {
@Resource @Resource
private ErpPurchaseOrderService purchaseOrderService; private ErpPurchaseOrderService purchaseOrderService;
...@@ -109,6 +108,15 @@ public class AppPurchaseOrderController { ...@@ -109,6 +108,15 @@ public class AppPurchaseOrderController {
return success(Boolean.TRUE); return success(Boolean.TRUE);
} }
@PostMapping("/arrival")
@Operation(summary = "到货")
@Parameter(name = "ids", description = "编号", required = true)
public CommonResult<Boolean> arrival(@RequestParam("ids") List<Long> ids) {
purchaseOrderService.delivery(ids, supplierApi.querySupplierIdByUserId(SecurityFrameworkUtils.getLoginUserId()),
ErpDeliveryStatus.ALREADY, ErpDeliveryStatus.ARRIVAL, CustomerOrderStatus.SUPPLIER_ARRIVE);
return success(Boolean.TRUE);
}
private PageResult<ErpPurchaseOrderRespVO> buildPurchaseOrderVOPageResult(PageResult<ErpPurchaseOrderDO> pageResult) { private PageResult<ErpPurchaseOrderRespVO> buildPurchaseOrderVOPageResult(PageResult<ErpPurchaseOrderDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) { if (CollUtil.isEmpty(pageResult.getList())) {
......
...@@ -94,6 +94,12 @@ public class ErpPurchaseInRespVO { ...@@ -94,6 +94,12 @@ public class ErpPurchaseInRespVO {
@ExcelProperty("产品信息") @ExcelProperty("产品信息")
private String productNames; private String productNames;
@Schema(description = "销售订单")
private Long saleOrderId;
@Schema(description = "销售子订单")
private Long saleOrderItemId;
@Data @Data
public static class Item { public static class Item {
...@@ -110,7 +116,7 @@ public class ErpPurchaseInRespVO { ...@@ -110,7 +116,7 @@ public class ErpPurchaseInRespVO {
private Long productId; private Long productId;
@Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productUnitId; private String productUnit;
@Schema(description = "产品单价", example = "100.00") @Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice; private BigDecimal productPrice;
......
...@@ -38,6 +38,12 @@ public class ErpPurchaseInSaveReqVO { ...@@ -38,6 +38,12 @@ public class ErpPurchaseInSaveReqVO {
@Schema(description = "备注", example = "你猜") @Schema(description = "备注", example = "你猜")
private String remark; private String remark;
@Schema(description = "销售订单")
private Long saleOrderId;
@Schema(description = "销售子订单")
private Long saleOrderItemId;
@Schema(description = "入库清单列表") @Schema(description = "入库清单列表")
private List<Item> items; private List<Item> items;
...@@ -61,7 +67,7 @@ public class ErpPurchaseInSaveReqVO { ...@@ -61,7 +67,7 @@ public class ErpPurchaseInSaveReqVO {
@Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品单位单位不能为空") @NotNull(message = "产品单位单位不能为空")
private Long productUnitId; private String productUnit;
@Schema(description = "产品单价", example = "100.00") @Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice; private BigDecimal productPrice;
......
...@@ -83,6 +83,24 @@ public class ErpSaleOrderController { ...@@ -83,6 +83,24 @@ public class ErpSaleOrderController {
return success(true); return success(true);
} }
@PostMapping("/delivery-staff")
@Operation(summary = "选择配送人员")
@PreAuthorize("@ss.hasPermission('erp:sale-out:update')")
public CommonResult<Boolean> updateDeliveryStaff(@RequestParam("id") Long id,
@RequestParam("deliveryStaffId") Long deliveryStaffId) {
return success(saleOrderService.updateDeliveryStaff(id, deliveryStaffId));
}
@PostMapping("/pick-up")
@Operation(summary = "检获")
@Parameter(name = "id", description = "销售订单id", required = true)
@Parameter(name = "itemId", description = "销售订单子id", required = true)
public CommonResult<Boolean> pickUp(@RequestParam("id") Long id,
@RequestParam("itemId") Long itemId) {
saleOrderService.updatePickUp(id, itemId);
return success(Boolean.TRUE);
}
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除销售订单") @Operation(summary = "删除销售订单")
@Parameter(name = "ids", description = "编号数组", required = true) @Parameter(name = "ids", description = "编号数组", required = true)
......
...@@ -2,6 +2,10 @@ package cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order; ...@@ -2,6 +2,10 @@ package cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty; import cn.idev.excel.annotation.ExcelProperty;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
...@@ -100,6 +104,25 @@ public class ErpSaleOrderRespVO { ...@@ -100,6 +104,25 @@ public class ErpSaleOrderRespVO {
@Schema(description = "销售退货数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") @Schema(description = "销售退货数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal returnCount; private BigDecimal returnCount;
@Schema(description = "客户订单id")
private Long customerOrderId;
@Schema(description = "配送模式")
private DeliveryMode deliveryMode;
@Schema(description = "配送时间")
private LocalDateTime deliveryTime;
@Schema(description = "配送人员")
private Long deliveryStaffId;
@Schema(description = "客户收货地址id")
private Long addressId;
@Schema(description = "客户收货地址info")
@TableField(typeHandler = Fastjson2TypeHandler.class)
private CustomerAddressInfo addressInfo;
@Data @Data
public static class Item { public static class Item {
...@@ -110,7 +133,7 @@ public class ErpSaleOrderRespVO { ...@@ -110,7 +133,7 @@ public class ErpSaleOrderRespVO {
private Long productId; private Long productId;
@Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productUnitId; private String productUnit;
@Schema(description = "产品单价", example = "100.00") @Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice; private BigDecimal productPrice;
...@@ -150,6 +173,13 @@ public class ErpSaleOrderRespVO { ...@@ -150,6 +173,13 @@ public class ErpSaleOrderRespVO {
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") @Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用 private BigDecimal stockCount; // 该字段仅仅在“详情”和“编辑”时使用
@Schema(description = "采购订单id")
private Long purchaseOrderId;
@Schema(description = "供应商id")
private Long supplierId;
@Schema(description = "拣货状态")
private String pickUpStatus;
} }
} }
package cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order; package cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
...@@ -41,6 +45,26 @@ public class ErpSaleOrderSaveReqVO { ...@@ -41,6 +45,26 @@ public class ErpSaleOrderSaveReqVO {
@Schema(description = "备注", example = "你猜") @Schema(description = "备注", example = "你猜")
private String remark; private String remark;
@Schema(description = "客户订单id")
@NotNull(message = "客户订单id不能为空")
private Long customerOrderId;
@Schema(description = "配送模式")
private DeliveryMode deliveryMode;
@Schema(description = "配送时间")
private LocalDateTime deliveryTime;
@Schema(description = "配送人员")
private Long deliveryStaffId;
@Schema(description = "客户收货地址id")
private Long addressId;
@Schema(description = "客户收货地址info")
@TableField(typeHandler = Fastjson2TypeHandler.class)
private CustomerAddressInfo addressInfo;
@Schema(description = "订单清单列表") @Schema(description = "订单清单列表")
private List<Item> items; private List<Item> items;
...@@ -56,7 +80,7 @@ public class ErpSaleOrderSaveReqVO { ...@@ -56,7 +80,7 @@ public class ErpSaleOrderSaveReqVO {
@Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113") @Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品单位单位不能为空") @NotNull(message = "产品单位单位不能为空")
private Long productUnitId; private String productUnit;
@Schema(description = "产品单价", example = "100.00") @Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice; private BigDecimal productPrice;
...@@ -71,6 +95,15 @@ public class ErpSaleOrderSaveReqVO { ...@@ -71,6 +95,15 @@ public class ErpSaleOrderSaveReqVO {
@Schema(description = "备注", example = "随便") @Schema(description = "备注", example = "随便")
private String remark; private String remark;
@Schema(description = "采购订单id")
private Long purchaseOrderId;
@Schema(description = "供应商id")
private Long supplierId;
@Schema(description = "拣货状态")
private String pickUpStatus;
} }
} }
\ No newline at end of file
...@@ -120,4 +120,14 @@ public class ErpPurchaseInDO extends BaseDO { ...@@ -120,4 +120,14 @@ public class ErpPurchaseInDO extends BaseDO {
*/ */
private String remark; private String remark;
/**
* 销售订单
*/
private Long saleOrderId;
/**
* 销售子订单
*/
private Long saleOrderItemId;
} }
\ No newline at end of file
...@@ -60,7 +60,7 @@ public class ErpPurchaseInItemDO extends BaseDO { ...@@ -60,7 +60,7 @@ public class ErpPurchaseInItemDO extends BaseDO {
* *
* 冗余 {@link ErpProductDO#getUnitId()} * 冗余 {@link ErpProductDO#getUnitId()}
*/ */
private Long productUnitId; private String productUnit;
/** /**
* 产品单位单价,单位:元 * 产品单位单价,单位:元
......
...@@ -3,9 +3,13 @@ package cn.iocoder.foodnexus.module.erp.dal.dataobject.sale; ...@@ -3,9 +3,13 @@ package cn.iocoder.foodnexus.module.erp.dal.dataobject.sale;
import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus; import cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.finance.ErpAccountDO; import cn.iocoder.foodnexus.module.erp.dal.dataobject.finance.ErpAccountDO;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import lombok.*; import lombok.*;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -16,7 +20,7 @@ import java.time.LocalDateTime; ...@@ -16,7 +20,7 @@ import java.time.LocalDateTime;
* *
* @author 芋道源码 * @author 芋道源码
*/ */
@TableName(value = "erp_sale_order") @TableName(value = "erp_sale_order", autoResultMap = true)
@KeySequence("erp_sale_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @KeySequence("erp_sale_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
...@@ -119,4 +123,38 @@ public class ErpSaleOrderDO extends BaseDO { ...@@ -119,4 +123,38 @@ public class ErpSaleOrderDO extends BaseDO {
*/ */
private BigDecimal returnCount; private BigDecimal returnCount;
/**
* 客户订单id
*/
private Long customerOrderId;
/**
* 配送模式
*
* 枚举 {@link DeliveryMode}
*/
private DeliveryMode deliveryMode;
/**
* 配送时间
*/
private LocalDateTime deliveryTime;
/**
* 配送人员
*
* DeliveryStaffDO
*/
private Long deliveryStaffId;
/**
* 客户收货地址id
*/
private Long addressId;
/**
* 客户收货地址info
*/
@TableField(typeHandler = Fastjson2TypeHandler.class)
private CustomerAddressInfo addressInfo;
} }
\ No newline at end of file
...@@ -2,6 +2,8 @@ package cn.iocoder.foodnexus.module.erp.dal.dataobject.sale; ...@@ -2,6 +2,8 @@ package cn.iocoder.foodnexus.module.erp.dal.dataobject.sale;
import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.product.ErpProductDO; import cn.iocoder.foodnexus.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -38,15 +40,14 @@ public class ErpSaleOrderItemDO extends BaseDO { ...@@ -38,15 +40,14 @@ public class ErpSaleOrderItemDO extends BaseDO {
/** /**
* 产品编号 * 产品编号
* *
* 关联 {@link ErpProductDO#getId()} * 关联 {@link ProductSpuDO#getId()}
*/ */
private Long productId; private Long productId;
/** /**
* 产品单位单位 * 产品单位单位
* *
* 冗余 {@link ErpProductDO#getUnitId()}
*/ */
private Long productUnitId; private String productUnit;
/** /**
* 产品单位单价,单位:元 * 产品单位单价,单位:元
...@@ -90,4 +91,21 @@ public class ErpSaleOrderItemDO extends BaseDO { ...@@ -90,4 +91,21 @@ public class ErpSaleOrderItemDO extends BaseDO {
*/ */
private BigDecimal returnCount; private BigDecimal returnCount;
/**
* 采购订单id
*/
private Long purchaseOrderId;
/**
* 供应商id
*/
private Long supplierId;
/**
* 拣货状态
*
* {@link SaleOrderPickUpStatus}
*/
private String pickUpStatus;
} }
\ No newline at end of file
package cn.iocoder.foodnexus.module.erp.enums;
import cn.iocoder.foodnexus.framework.common.core.ArrayValuable;
import cn.iocoder.foodnexus.module.erp.enums.stock.ErpStockRecordBizTypeEnum;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* @author : yanghao
* create at: 2025/9/25 14:58
* @description:
*/
@RequiredArgsConstructor
@Getter
public enum SaleOrderPickUpStatus implements ArrayValuable<String> {
TO_BE("TO_BE", "待拣"),
PICK_UP("PICK_UP", "已拣"),
;
public static final String[] ARRAYS = Arrays.stream(values()).map(SaleOrderPickUpStatus::getType).toArray(String[]::new);
/**
* 类型
*/
private final String type;
/**
* 名字
*/
private final String name;
@Override
public String[] array() {
return ARRAYS;
}
}
...@@ -206,7 +206,7 @@ public class ErpPurchaseInServiceImpl implements ErpPurchaseInService { ...@@ -206,7 +206,7 @@ public class ErpPurchaseInServiceImpl implements ErpPurchaseInService {
Map<Long, ErpProductDO> productMap = convertMap(productList, ErpProductDO::getId); Map<Long, ErpProductDO> productMap = convertMap(productList, ErpProductDO::getId);
// 2. 转化为 ErpPurchaseInItemDO 列表 // 2. 转化为 ErpPurchaseInItemDO 列表
return convertList(list, o -> BeanUtils.toBean(o, ErpPurchaseInItemDO.class, item -> { return convertList(list, o -> BeanUtils.toBean(o, ErpPurchaseInItemDO.class, item -> {
item.setProductUnitId(productMap.get(item.getProductId()).getUnitId()); // item.setProductUnitId(productMap.get(item.getProductId()).getUnitId());
item.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount())); item.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount()));
if (item.getTotalPrice() == null) { if (item.getTotalPrice() == null) {
return; return;
......
...@@ -388,6 +388,13 @@ public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService { ...@@ -388,6 +388,13 @@ public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService {
} }
this.createPurchaseOrder(purchaseOrder); this.createPurchaseOrder(purchaseOrder);
CustomerOrderRecordEvent recordEvent = new CustomerOrderRecordEvent();
recordEvent.setOrderStatus(CustomerOrderStatus.ORDER_MATCH);
recordEvent.setCustomerOrderId(orderId);
recordEvent.setSupplierId(supplierId);
recordEvent.setCopyWriter(CommonUtil.asList(list.get(0).getSupplierName()));
orderRecordApi.recordEvent(recordEvent);
} }
} }
} }
...@@ -107,4 +107,12 @@ public interface ErpSaleOrderService { ...@@ -107,4 +107,12 @@ public interface ErpSaleOrderService {
*/ */
List<ErpSaleOrderItemDO> getSaleOrderItemListByOrderIds(Collection<Long> orderIds); List<ErpSaleOrderItemDO> getSaleOrderItemListByOrderIds(Collection<Long> orderIds);
/**
* 更新销售订单配送人员
* @param id
* @param deliveryStaffId
*/
boolean updateDeliveryStaff(Long id, Long deliveryStaffId);
void updatePickUp(Long id, Long itemId);
} }
\ No newline at end of file
...@@ -3,30 +3,43 @@ package cn.iocoder.foodnexus.module.erp.service.sale; ...@@ -3,30 +3,43 @@ package cn.iocoder.foodnexus.module.erp.service.sale;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult; import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.common.util.number.MoneyUtils; import cn.iocoder.foodnexus.framework.common.util.number.MoneyUtils;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils; import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.in.ErpPurchaseInSaveReqVO;
import cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderPageReqVO; import cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderPageReqVO;
import cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderSaveReqVO; import cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order.ErpSaleOrderSaveReqVO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.product.ErpProductDO; import cn.iocoder.foodnexus.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseOrderDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderDO; import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderItemDO; import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderItemDO;
import cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOrderItemMapper; import cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOrderItemMapper;
import cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOrderMapper; import cn.iocoder.foodnexus.module.erp.dal.mysql.sale.ErpSaleOrderMapper;
import cn.iocoder.foodnexus.module.erp.dal.redis.no.ErpNoRedisDAO; import cn.iocoder.foodnexus.module.erp.dal.redis.no.ErpNoRedisDAO;
import cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus; import cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus;
import cn.iocoder.foodnexus.module.erp.enums.SaleOrderPickUpStatus;
import cn.iocoder.foodnexus.module.erp.service.finance.ErpAccountService; import cn.iocoder.foodnexus.module.erp.service.finance.ErpAccountService;
import cn.iocoder.foodnexus.module.erp.service.product.ErpProductService; import cn.iocoder.foodnexus.module.erp.service.product.ErpProductService;
import cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseInService;
import cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseOrderService;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderApi;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderRecordApi;
import cn.iocoder.foodnexus.module.order.api.DeliveryStaffApi;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderDTO;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRecordEvent;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.system.api.user.AdminUserApi; import cn.iocoder.foodnexus.module.system.api.user.AdminUserApi;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Collection; import java.time.LocalDateTime;
import java.util.Collections; import java.util.*;
import java.util.List;
import java.util.Map;
import static cn.iocoder.foodnexus.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.foodnexus.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.*; import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.*;
...@@ -61,6 +74,21 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService { ...@@ -61,6 +74,21 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
@Resource @Resource
private AdminUserApi adminUserApi; private AdminUserApi adminUserApi;
@Autowired
private ErpPurchaseInService purchaseInService;
@Autowired
private CustomerOrderRecordApi orderRecordApi;
@Autowired
private CustomerOrderApi customerOrderApi;
@Autowired
private ErpPurchaseOrderService purchaseOrderService;
@Autowired
private DeliveryStaffApi deliveryStaffApi;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long createSaleOrder(ErpSaleOrderSaveReqVO createReqVO) { public Long createSaleOrder(ErpSaleOrderSaveReqVO createReqVO) {
...@@ -169,7 +197,7 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService { ...@@ -169,7 +197,7 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
Map<Long, ErpProductDO> productMap = convertMap(productList, ErpProductDO::getId); Map<Long, ErpProductDO> productMap = convertMap(productList, ErpProductDO::getId);
// 2. 转化为 ErpSaleOrderItemDO 列表 // 2. 转化为 ErpSaleOrderItemDO 列表
return convertList(list, o -> BeanUtils.toBean(o, ErpSaleOrderItemDO.class, item -> { return convertList(list, o -> BeanUtils.toBean(o, ErpSaleOrderItemDO.class, item -> {
item.setProductUnitId(productMap.get(item.getProductId()).getUnitId()); // item.setProductUnit(productMap.get(item.getProductId()).getUni());
item.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount())); item.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount()));
if (item.getTotalPrice() == null) { if (item.getTotalPrice() == null) {
return; return;
...@@ -304,4 +332,73 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService { ...@@ -304,4 +332,73 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
return saleOrderItemMapper.selectListByOrderIds(orderIds); return saleOrderItemMapper.selectListByOrderIds(orderIds);
} }
/**
* 更新销售订单配送人员
*
* @param id
* @param deliveryStaffId
*/
@Override
public boolean updateDeliveryStaff(Long id, Long deliveryStaffId) {
return saleOrderMapper.update(Wrappers.<ErpSaleOrderDO>lambdaUpdate()
.set(ErpSaleOrderDO::getDeliveryStaffId, deliveryStaffId)
.eq(ErpSaleOrderDO::getId, id)) > 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updatePickUp(Long id, Long itemId) {
ErpSaleOrderDO saleOrder = getSaleOrder(id);
ErpSaleOrderItemDO saleItemOrder = saleOrderItemMapper.selectById(itemId);
CustomerOrderDTO customerOrder = customerOrderApi.queryById(saleOrder.getCustomerOrderId());
if (CommonUtil.isEmpty(saleOrder) || CommonUtil.isEmpty(saleItemOrder)) {
throw exception(SALE_ORDER_NOT_EXISTS);
}
saleOrderItemMapper.update(Wrappers.<ErpSaleOrderItemDO>lambdaUpdate()
.set(ErpSaleOrderItemDO::getPickUpStatus, SaleOrderPickUpStatus.PICK_UP.getType())
.eq(ErpSaleOrderItemDO::getId, itemId));
// 插入采购入库单
ErpPurchaseInSaveReqVO inSaveReqVO = new ErpPurchaseInSaveReqVO();
inSaveReqVO.setInTime(LocalDateTime.now());
inSaveReqVO.setOrderId(saleOrder.getCustomerOrderId());
inSaveReqVO.setSaleOrderId(saleOrder.getId());
inSaveReqVO.setSaleOrderItemId(saleItemOrder.getId());
ErpPurchaseInSaveReqVO.Item item = getItem(saleItemOrder, customerOrder);
inSaveReqVO.setItems(CommonUtil.asList(item));
purchaseInService.createPurchaseIn(inSaveReqVO);
Long allCount = saleOrderItemMapper.selectCount(ErpSaleOrderItemDO::getOrderId, saleOrder.getId());
Long pickUpCount = saleOrderItemMapper.selectCount(Wrappers.<ErpSaleOrderItemDO>lambdaQuery()
.eq(ErpSaleOrderItemDO::getOrderId, saleOrder.getId())
.eq(ErpSaleOrderItemDO::getPickUpStatus, SaleOrderPickUpStatus.PICK_UP.getType()));
if (allCount > 0 && Objects.equals(pickUpCount, allCount)) {
String deliveryName = deliveryStaffApi.queryNameByStaffId(saleOrder.getDeliveryStaffId());
String warehouseName = Optional.ofNullable(customerOrder.getWarehouseInfo()).map(WarehouseInfo::getName).orElse("");
ErpPurchaseOrderDO purchaseOrder = purchaseOrderService.getPurchaseOrder(saleItemOrder.getPurchaseOrderId());
CustomerOrderRecordEvent event = new CustomerOrderRecordEvent();
event.setOrderStatus(CustomerOrderStatus.SORTING);
event.setCustomerOrderId(saleOrder.getCustomerOrderId());
event.setSupplierId(purchaseOrder.getSupplierId());
event.setCopyWriter(CommonUtil.asList(warehouseName, deliveryName));
orderRecordApi.recordEvent(event);
}
}
private static ErpPurchaseInSaveReqVO.Item getItem(ErpSaleOrderItemDO saleItemOrder, CustomerOrderDTO customerOrder) {
ErpPurchaseInSaveReqVO.Item item = new ErpPurchaseInSaveReqVO.Item();
item.setOrderItemId(saleItemOrder.getPurchaseOrderId());
item.setWarehouseId(customerOrder.getWarehouseAreaId());
item.setProductId(saleItemOrder.getProductId());
item.setProductUnit(saleItemOrder.getProductUnit());
item.setProductPrice(saleItemOrder.getProductPrice());
item.setCount(saleItemOrder.getCount());
item.setTaxPercent(saleItemOrder.getTaxPercent());
item.setRemark(saleItemOrder.getRemark());
return item;
}
} }
...@@ -6,6 +6,12 @@ import cn.iocoder.foodnexus.module.erp.api.service.ErpSupplierApi; ...@@ -6,6 +6,12 @@ import cn.iocoder.foodnexus.module.erp.api.service.ErpSupplierApi;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpSupplierDO; import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpCustomerDO; import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpCustomerDO;
import cn.iocoder.foodnexus.module.erp.service.purchase.ErpSupplierService; import cn.iocoder.foodnexus.module.erp.service.purchase.ErpSupplierService;
import cn.iocoder.foodnexus.module.operations.controller.admin.inquirepriceitem.vo.InquirePriceItemRespVO;
import cn.iocoder.foodnexus.module.operations.dal.dataobject.inquirepriceitem.InquirePriceItemDO;
import cn.iocoder.foodnexus.module.operations.service.inquirepriceitem.InquirePriceItemService;
import cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.ProductSpuRespVO;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -21,6 +27,7 @@ import jakarta.validation.*; ...@@ -21,6 +27,7 @@ import jakarta.validation.*;
import jakarta.servlet.http.*; import jakarta.servlet.http.*;
import java.util.*; import java.util.*;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam; import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
...@@ -51,6 +58,12 @@ public class InquireSupplierPushController { ...@@ -51,6 +58,12 @@ public class InquireSupplierPushController {
private ErpSupplierApi supplierApi; private ErpSupplierApi supplierApi;
@Autowired @Autowired
private ProductSpuService productSpuService;
@Autowired
private InquirePriceItemService inquirePriceItemService;
@Autowired
private ErpSupplierService supplierService; private ErpSupplierService supplierService;
...@@ -115,8 +128,15 @@ public class InquireSupplierPushController { ...@@ -115,8 +128,15 @@ public class InquireSupplierPushController {
public CommonResult<PageResult<InquireSupplierPushRespVO>> getInquireSupplierPushPage(@Valid InquireSupplierPushPageReqVO pageReqVO) { public CommonResult<PageResult<InquireSupplierPushRespVO>> getInquireSupplierPushPage(@Valid InquireSupplierPushPageReqVO pageReqVO) {
PageResult<InquireSupplierPushDO> pageResult = inquireSupplierPushService.getInquireSupplierPushPage(pageReqVO); PageResult<InquireSupplierPushDO> pageResult = inquireSupplierPushService.getInquireSupplierPushPage(pageReqVO);
Map<Long, String> nameMap = supplierApi.queryNameMapByIds(pageResult.getList().stream().map(InquireSupplierPushDO::getSupplierId).toList()); Map<Long, String> nameMap = supplierApi.queryNameMapByIds(pageResult.getList().stream().map(InquireSupplierPushDO::getSupplierId).toList());
return success(BeanUtils.toBean(pageResult, InquireSupplierPushRespVO.class, item -> Map<Long, ProductSpuDO> spuMap = productSpuService.getSpuMap(pageResult.getList().stream().map(InquireSupplierPushDO::getProductId).toList());
MapUtils.findAndThen(nameMap, item.getSupplierId(), item::setSupplierName))); Map<Long, InquirePriceItemDO> itemMap = inquirePriceItemService.queryMap(pageResult.getList().stream().map(InquireSupplierPushDO::getInquirePriceItemId).toList());
return success(BeanUtils.toBean(pageResult, InquireSupplierPushRespVO.class, item ->{
MapUtils.findAndThen(nameMap, item.getSupplierId(), item::setSupplierName);
MapUtils.findAndThen(itemMap, item.getInquirePriceItemId(), priceItem ->
item.setInquirePriceItem(BeanUtils.toBean(priceItem, InquirePriceItemRespVO.class)));
MapUtils.findAndThen(spuMap, item.getProductId(), productSpu ->
item.setProductSpu(BeanUtils.toBean(productSpu, ProductSpuRespVO.class)));
}));
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
......
package cn.iocoder.foodnexus.module.operations.controller.admin.inquiresupplierpush.vo; package cn.iocoder.foodnexus.module.operations.controller.admin.inquiresupplierpush.vo;
import cn.iocoder.foodnexus.module.operations.controller.admin.inquirepriceitem.vo.InquirePriceItemRespVO;
import cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.ProductSpuRespVO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
...@@ -27,10 +29,19 @@ public class InquireSupplierPushRespVO { ...@@ -27,10 +29,19 @@ public class InquireSupplierPushRespVO {
@ExcelProperty("询价主题id") @ExcelProperty("询价主题id")
private Long inquirePriceId; private Long inquirePriceId;
@Schema(description = "询价子id")
private Long inquirePriceItemId;
@Schema(description = "询价子项")
private InquirePriceItemRespVO inquirePriceItem;
@Schema(description = "商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3596") @Schema(description = "商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3596")
@ExcelProperty("商品id") @ExcelProperty("商品id")
private Long productId; private Long productId;
@Schema(description = "商品spu")
private ProductSpuRespVO productSpu;
@Schema(description = "商品分类id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2949") @Schema(description = "商品分类id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2949")
@ExcelProperty("商品分类id") @ExcelProperty("商品分类id")
private Long categoryId; private Long categoryId;
......
...@@ -5,6 +5,7 @@ import cn.hutool.core.stream.StreamUtil; ...@@ -5,6 +5,7 @@ import cn.hutool.core.stream.StreamUtil;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil; import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.module.operations.dal.dataobject.deliverystaffcustomer.DeliveryStaffCustomerDO; import cn.iocoder.foodnexus.module.operations.dal.dataobject.deliverystaffcustomer.DeliveryStaffCustomerDO;
import cn.iocoder.foodnexus.module.operations.dal.mysql.deliverystaffcustomer.DeliveryStaffCustomerMapper; import cn.iocoder.foodnexus.module.operations.dal.mysql.deliverystaffcustomer.DeliveryStaffCustomerMapper;
import cn.iocoder.foodnexus.module.order.api.DeliveryStaffApi;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
...@@ -32,7 +33,7 @@ import static cn.iocoder.foodnexus.module.operations.enums.ErrorCodeConstants.*; ...@@ -32,7 +33,7 @@ import static cn.iocoder.foodnexus.module.operations.enums.ErrorCodeConstants.*;
*/ */
@Service @Service
@Validated @Validated
public class DeliveryStaffServiceImpl implements DeliveryStaffService { public class DeliveryStaffServiceImpl implements DeliveryStaffService, DeliveryStaffApi {
@Resource @Resource
private DeliveryStaffMapper deliveryStaffMapper; private DeliveryStaffMapper deliveryStaffMapper;
...@@ -113,4 +114,8 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService { ...@@ -113,4 +114,8 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService {
.in(DeliveryStaffCustomerDO::getCustomerId, updateReqVO.getCustomerIdList())); .in(DeliveryStaffCustomerDO::getCustomerId, updateReqVO.getCustomerIdList()));
} }
@Override
public String queryNameByStaffId(Long staffId) {
return Optional.ofNullable(deliveryStaffMapper.selectById(staffId)).map(DeliveryStaffDO::getName).orElse("");
}
} }
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.api;
/**
* @author : yanghao
* create at: 2025/9/25 15:54
* @description: 配送员api
*/
public interface DeliveryStaffApi {
String queryNameByStaffId(Long staffId);
}
package cn.iocoder.foodnexus.module.order.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author : yanghao
* create at: 2025/9/24 11:41
* @description: 客户-收获地址
*/
@Data
public class CustomerAddressInfo implements Serializable {
/**
* id
*/
private Long id;
/**
* 客户id
*/
private Long customerId;
/**
* 联系人
*/
private String contactUser;
/**
* 联系号码
*/
private String contactPhone;
/**
* 省id
*/
private Long provinceId;
/**
* 省name
*/
private String provinceName;
/**
* 市
*/
private Long cityId;
/**
* 市
*/
private String cityName;
/**
* 区
*/
private Long regionId;
/**
* 区
*/
private String regionName;
/**
* 详细地址
*/
private String address;
/**
* 是否默认
*/
private Boolean isDefault;
}
...@@ -16,7 +16,7 @@ import java.util.Arrays; ...@@ -16,7 +16,7 @@ import java.util.Arrays;
public enum CustomerOrderStatus implements ArrayValuable<String> { public enum CustomerOrderStatus implements ArrayValuable<String> {
// 下单成功 // 下单成功
ORDER_SUCCESS("下单成功", "order_success") { ORDER_SUCCESS("下单成功", "ORDER_SUCCESS") {
@Override @Override
public String getText() { public String getText() {
return "您已成功下单\n" + return "您已成功下单\n" +
...@@ -24,63 +24,63 @@ public enum CustomerOrderStatus implements ArrayValuable<String> { ...@@ -24,63 +24,63 @@ public enum CustomerOrderStatus implements ArrayValuable<String> {
} }
}, },
// 订单匹配 // 订单匹配
ORDER_MATCH("订单匹配", "order_match") { ORDER_MATCH("订单匹配", "ORDER_MATCH") {
@Override @Override
public String getText() { public String getText() {
return "【%s】供应商 匹配成功"; return "【%s】供应商 匹配成功";
} }
}, },
// 供应商接单 // 供应商接单
SUPPLIER_ACCEPT_ORDER("供应商接单", "supplier_accept_order") { SUPPLIER_ACCEPT_ORDER("供应商接单", "SUPPLIER_ACCEPT_ORDER") {
@Override @Override
public String getText() { public String getText() {
return "【%s】供应商 已接单"; return "【%s】供应商 已接单";
} }
}, },
// 供应商发货 // 供应商发货
SUPPLIER_SHIP("供应商发货", "supplier_ship") { SUPPLIER_SHIP("供应商发货", "SUPPLIER_SHIP") {
@Override @Override
public String getText() { public String getText() {
return "【%s】供应商 已发货"; return "【%s】供应商 已发货";
} }
}, },
// 供应商到货 // 供应商到货
SUPPLIER_ARRIVE("供应商到货", "supplier_arrive") { SUPPLIER_ARRIVE("供应商到货", "SUPPLIER_ARRIVE") {
@Override @Override
public String getText() { public String getText() {
return "【%s】供应商 已到货"; return "【%s】供应商 已到货";
} }
}, },
// 分仓质检 // 分仓质检
WAREHOUSE_INSPECTION("分仓质检", "warehouseInspection") { WAREHOUSE_INSPECTION("分仓质检", "WAREHOUSE_INSPECTION") {
@Override @Override
public String getText() { public String getText() {
return "您的商品已到达【%s】分仓,已完成质检入库;查看质检报告【%s】"; return "您的商品已到达【%s】分仓,已完成质检入库;查看质检报告【%s】";
} }
}, },
// 商品分拣 // 商品分拣
SORTING("商品分拣", "sorting") { SORTING("商品分拣", "SORTING") {
@Override @Override
public String getText() { public String getText() {
return "您的商品在【%s】分仓已完成分拣,【%s】正在进行配送"; return "您的商品在【%s】分仓已完成分拣,【%s】正在进行配送";
} }
}, },
// 商品配送 // 商品配送
DELIVERY("商品配送", "delivery") { DELIVERY("商品配送", "DELIVERY") {
@Override @Override
public String getText() { public String getText() {
return "您的商品将在16小时内完成配送,请保持电话畅通,配送员【%s】联系方式:【%s】"; return "您的商品将在16小时内完成配送,请保持电话畅通,配送员【%s】联系方式:【%s】";
} }
}, },
// 商品到货 // 商品到货
ARRIVAL("商品到货", "arrival") { ARRIVAL("商品到货", "ARRIVAL") {
@Override @Override
public String getText() { public String getText() {
return "您的商品已送到收货地址,请前往签收;配送员【%s】 联系方式:【%s】"; return "您的商品已送到收货地址,请前往签收;配送员【%s】 联系方式:【%s】";
} }
}, },
// 商品签收 // 商品签收
SIGN_RECEIPT("商品签收", "signReceipt") { SIGN_RECEIPT("商品签收", "SIGN_RECEIPT") {
@Override @Override
public String getText() { public String getText() {
return "您的商品完成签收查看签收单【%s】"; return "您的商品完成签收查看签收单【%s】";
...@@ -88,6 +88,13 @@ public enum CustomerOrderStatus implements ArrayValuable<String> { ...@@ -88,6 +88,13 @@ public enum CustomerOrderStatus implements ArrayValuable<String> {
}, },
CANCEL("取消订单", "CANCEL") {
@Override
public String getText() {
return "";
}
},
; ;
private final String label; private final String label;
......
package cn.iocoder.foodnexus.module.order.controller.admin.checktask;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import static cn.iocoder.foodnexus.framework.common.pojo.CommonResult.success;
import cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils;
import cn.iocoder.foodnexus.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.foodnexus.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktask.CheckTaskDO;
import cn.iocoder.foodnexus.module.order.service.checktask.CheckTaskService;
@Tag(name = "管理后台 - 来料质检")
@RestController
@RequestMapping("/order/check-task")
@Validated
public class CheckTaskController {
@Resource
private CheckTaskService checkTaskService;
@PostMapping("/create")
@Operation(summary = "创建来料质检")
@PreAuthorize("@ss.hasPermission('order:check-task:create')")
public CommonResult<Long> createCheckTask(@Valid @RequestBody CheckTaskSaveReqVO createReqVO) {
return success(checkTaskService.createCheckTask(createReqVO));
}
@PutMapping("/check")
@Operation(summary = "质检")
@PreAuthorize("@ss.hasPermission('order:check-task:update')")
public CommonResult<Boolean> check(@Valid @RequestBody CheckTaskCheckReqVO updateReqVO) {
checkTaskService.check(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除来料质检")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('order:check-task:delete')")
public CommonResult<Boolean> deleteCheckTask(@RequestParam("id") Long id) {
checkTaskService.deleteCheckTask(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除来料质检")
@PreAuthorize("@ss.hasPermission('order:check-task:delete')")
public CommonResult<Boolean> deleteCheckTaskList(@RequestParam("ids") List<Long> ids) {
checkTaskService.deleteCheckTaskListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得来料质检")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('order:check-task:query')")
public CommonResult<CheckTaskRespVO> getCheckTask(@RequestParam("id") Long id) {
CheckTaskDO checkTask = checkTaskService.getCheckTask(id);
return success(BeanUtils.toBean(checkTask, CheckTaskRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得来料质检分页")
@PreAuthorize("@ss.hasPermission('order:check-task:query')")
public CommonResult<PageResult<CheckTaskRespVO>> getCheckTaskPage(@Valid CheckTaskPageReqVO pageReqVO) {
PageResult<CheckTaskDO> pageResult = checkTaskService.getCheckTaskPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CheckTaskRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出来料质检 Excel")
@PreAuthorize("@ss.hasPermission('order:check-task:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCheckTaskExcel(@Valid CheckTaskPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CheckTaskDO> list = checkTaskService.getCheckTaskPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "来料质检.xls", "数据", CheckTaskRespVO.class,
BeanUtils.toBean(list, CheckTaskRespVO.class));
}
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo;
import cn.iocoder.foodnexus.framework.common.validation.InEnum;
import cn.iocoder.foodnexus.module.order.enums.CheckTaskStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.List;
/**
* @author : yanghao
* create at: 2025/9/24 17:31
* @description: 质检来料质检
*/
@Data
public class CheckTaskCheckReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4629")
@NotNull(message = "id不能为空")
private Long id;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "状态不能为空")
@InEnum(CheckTaskStatus.class)
private String status;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "附件")
private String files;
@Schema(description = "质检清单")
@Valid
@NotNull(message = "质检清单不能为空")
@Size(min = 1, message = "质检清单不能为空")
private List<Item> items;
@Data
public static class Item {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5717")
@NotNull(message = "items.id不能为空")
private Long id;
@Schema(description = "质检结果", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "质检结果不能为空")
private String checkResult;
}
}
package cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo;
import lombok.Data;
/**
* @author : yanghao
* create at: 2025/9/24 16:56
* @description: 来料质检创建事件
*/
@Data
public class CheckTaskCreateEvent {
/**
* 供应商采购订单id
*/
private Long supplierOrderId;
}
package cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.foodnexus.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 来料质检清单分页 Request VO")
@Data
public class CheckTaskItemsPageReqVO extends PageParam {
@Schema(description = "来料质检id", example = "31590")
private Long checkTaskId;
@Schema(description = "商品id", example = "30398")
private Long productId;
@Schema(description = "商品名称", example = "王五")
private String productName;
@Schema(description = "商品分类", example = "20330")
private Long categoryId;
@Schema(description = "商品分类名称", example = "王五")
private String categoryName;
@Schema(description = "商品封面图", example = "https://www.iocoder.cn")
private String picUrl;
@Schema(description = "检查数量", example = "24148")
private Integer checkCount;
@Schema(description = "商品单位", example = "李四")
private String unitName;
@Schema(description = "质检结果")
private String checkResult;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
import cn.iocoder.foodnexus.framework.excel.core.annotations.DictFormat;
import cn.iocoder.foodnexus.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 来料质检清单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CheckTaskItemsRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5717")
@ExcelProperty("id")
private Long id;
@Schema(description = "来料质检id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31590")
@ExcelProperty("来料质检id")
private Long checkTaskId;
@Schema(description = "商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30398")
@ExcelProperty("商品id")
private Long productId;
@Schema(description = "商品名称", example = "王五")
@ExcelProperty("商品名称")
private String productName;
@Schema(description = "商品分类", example = "20330")
@ExcelProperty("商品分类")
private Long categoryId;
@Schema(description = "商品分类名称", example = "王五")
@ExcelProperty("商品分类名称")
private String categoryName;
@Schema(description = "商品封面图", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
@ExcelProperty("商品封面图")
private String picUrl;
@Schema(description = "检查数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "24148")
@ExcelProperty("检查数量")
private Integer checkCount;
@Schema(description = "商品单位", example = "李四")
@ExcelProperty("商品单位")
private String unitName;
@Schema(description = "质检结果", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "质检结果", converter = DictConvert.class)
@DictFormat("order_check_task_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private String checkResult;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 来料质检清单新增/修改 Request VO")
@Data
public class CheckTaskItemsSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5717")
private Long id;
@Schema(description = "来料质检id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31590")
@NotNull(message = "来料质检id不能为空")
private Long checkTaskId;
@Schema(description = "商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30398")
@NotNull(message = "商品id不能为空")
private Long productId;
@Schema(description = "商品名称", example = "王五")
private String productName;
@Schema(description = "商品分类", example = "20330")
private Long categoryId;
@Schema(description = "商品分类名称", example = "王五")
private String categoryName;
@Schema(description = "商品封面图", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
@NotEmpty(message = "商品封面图不能为空")
private String picUrl;
@Schema(description = "检查数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "24148")
@NotNull(message = "检查数量不能为空")
private Integer checkCount;
@Schema(description = "商品单位", example = "李四")
private String unitName;
@Schema(description = "质检结果", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "质检结果不能为空")
private String checkResult;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.foodnexus.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 来料质检分页 Request VO")
@Data
public class CheckTaskPageReqVO extends PageParam {
@Schema(description = "编号")
private String no;
@Schema(description = "状态", example = "2")
private String status;
@Schema(description = "供应商编号", example = "10284")
private Long supplierId;
@Schema(description = "关联采购订单id", example = "31869")
private Long purchaseOrderId;
@Schema(description = "关联客户订单id", example = "1535")
private Long customerOrderId;
@Schema(description = "客户id", example = "7050")
private Long customerId;
@Schema(description = "到货时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] arrivalTime;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "附件")
private String files;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
import cn.iocoder.foodnexus.framework.excel.core.annotations.DictFormat;
import cn.iocoder.foodnexus.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 来料质检 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CheckTaskRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4629")
@ExcelProperty("id")
private Long id;
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("编号")
private String no;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat("order_check_task_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private String status;
@Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10284")
@ExcelProperty("供应商编号")
private Long supplierId;
@Schema(description = "关联采购订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31869")
@ExcelProperty("关联采购订单id")
private Long purchaseOrderId;
@Schema(description = "关联客户订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1535")
@ExcelProperty("关联客户订单id")
private Long customerOrderId;
@Schema(description = "客户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7050")
@ExcelProperty("客户id")
private Long customerId;
@Schema(description = "到货时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("到货时间")
private LocalDateTime arrivalTime;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
private String remark;
@Schema(description = "附件")
@ExcelProperty("附件")
private String files;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 来料质检新增/修改 Request VO")
@Data
public class CheckTaskSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4629")
private Long id;
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "编号不能为空")
private String no;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "状态不能为空")
private String status;
@Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10284")
@NotNull(message = "供应商编号不能为空")
private Long supplierId;
@Schema(description = "关联采购订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31869")
@NotNull(message = "关联采购订单id不能为空")
private Long purchaseOrderId;
@Schema(description = "关联客户订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1535")
@NotNull(message = "关联客户订单id不能为空")
private Long customerOrderId;
@Schema(description = "客户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7050")
@NotNull(message = "客户id不能为空")
private Long customerId;
@Schema(description = "到货时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "到货时间不能为空")
private LocalDateTime arrivalTime;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "附件")
private String files;
@Schema(description = "来料质检清单")
private List<CheckTaskItemsSaveReqVO> items;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo; package cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo;
import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo; import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus; import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode; import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
...@@ -45,6 +47,12 @@ public class CustomerOrderRespVO { ...@@ -45,6 +47,12 @@ public class CustomerOrderRespVO {
@ExcelProperty("仓库信息") @ExcelProperty("仓库信息")
private WarehouseInfo warehouseInfo; private WarehouseInfo warehouseInfo;
@Schema(description = "客户收货地址id")
private Long addressId;
@Schema(description = "客户收货地址info")
private CustomerAddressInfo addressInfo;
@Schema(description = "配送模式", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "配送模式", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "配送模式", converter = DictConvert.class) @ExcelProperty(value = "配送模式", converter = DictConvert.class)
@DictFormat("order_delivery_mode") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 @DictFormat("order_delivery_mode") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
...@@ -82,4 +90,7 @@ public class CustomerOrderRespVO { ...@@ -82,4 +90,7 @@ public class CustomerOrderRespVO {
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@Schema(description = "订单备注")
private CustomerOrderRemark orderRemark;
} }
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo; package cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo;
import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo; import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus; import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode; import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
...@@ -39,6 +40,12 @@ public class CustomerOrderSaveReqVO { ...@@ -39,6 +40,12 @@ public class CustomerOrderSaveReqVO {
@Schema(description = "仓库信息") @Schema(description = "仓库信息")
private WarehouseInfo warehouseInfo; private WarehouseInfo warehouseInfo;
@Schema(description = "客户收货地址id")
private Long addressId;
@Schema(description = "客户收货地址info")
private CustomerAddressInfo addressInfo;
@Schema(description = "配送模式", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "配送模式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "配送模式不能为空") @NotEmpty(message = "配送模式不能为空")
private DeliveryMode deliveryMode; private DeliveryMode deliveryMode;
......
...@@ -5,11 +5,14 @@ import cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum; ...@@ -5,11 +5,14 @@ import cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult; import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam; import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult; import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils; import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils; import cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils;
import cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderPageReqVO; import cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderPageReqVO;
import cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderRespVO; import cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderRespVO;
import cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderSaveReqVO; import cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.CustomerOrderSaveReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderRemarkReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO; import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderDO; import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderDO;
import cn.iocoder.foodnexus.module.order.service.customerorder.CustomerOrderService; import cn.iocoder.foodnexus.module.order.service.customerorder.CustomerOrderService;
...@@ -24,6 +27,7 @@ import org.springframework.security.access.prepost.PreAuthorize; ...@@ -24,6 +27,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.sql.rowset.serial.SerialException;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
...@@ -48,11 +52,28 @@ public class AppCustomerOrderController { ...@@ -48,11 +52,28 @@ public class AppCustomerOrderController {
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新客户总订单") @Operation(summary = "更新客户总订单")
public CommonResult<Boolean> updateCustomerOrder(@Valid @RequestBody CustomerOrderSaveReqVO updateReqVO) { public CommonResult<Boolean> updateCustomerOrder(@Valid @RequestBody AppCustomerOrderSaveReqVO updateReqVO) throws SerialException {
customerOrderService.updateCustomerOrder(updateReqVO); if (CommonUtil.isEmpty(updateReqVO.getId())) {
throw new SerialException("订单id不能为空");
}
customerOrderService.appUpdateCustomerOrder(updateReqVO);
return success(true); return success(true);
} }
@PostMapping("cancel")
@Operation(summary = "取消客户订单")
public CommonResult<Boolean> cancel(@Valid @RequestBody AppCustomerOrderRemarkReqVO reqVO) {
customerOrderService.cancel(reqVO);
return success(Boolean.TRUE);
}
@PostMapping("receipt")
@Operation(summary = "签收客户订单")
public CommonResult<Boolean> receipt(@Valid @RequestBody AppCustomerOrderRemarkReqVO reqVO) {
customerOrderService.receipt(reqVO);
return success(Boolean.TRUE);
}
@DeleteMapping("/delete-list") @DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true) @Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除客户总订单") @Operation(summary = "批量删除客户总订单")
......
package cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List;
/**
* @author : yanghao
* create at: 2025/9/24 15:51
* @description: 订单备注
*/
@Data
public class AppCustomerOrderRemarkReqVO {
@Schema(description = "订单id")
@NotNull(message = "id不能为空")
private Long id;
@Schema(description = "说明")
private String remark;
@Schema(description = "相关文件")
private List<String> remarkFiles;
}
...@@ -16,6 +16,9 @@ import java.util.List; ...@@ -16,6 +16,9 @@ import java.util.List;
@Data @Data
public class AppCustomerOrderSaveReqVO { public class AppCustomerOrderSaveReqVO {
@Schema(description = "订单id,新增为空")
private Long id;
@Schema(description = "收获仓库id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27065") @Schema(description = "收获仓库id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27065")
@NotNull(message = "收获仓库id不能为空") @NotNull(message = "收获仓库id不能为空")
private Long warehouseId; private Long warehouseId;
...@@ -24,6 +27,9 @@ public class AppCustomerOrderSaveReqVO { ...@@ -24,6 +27,9 @@ public class AppCustomerOrderSaveReqVO {
@NotNull(message = "收获库区id不能为空") @NotNull(message = "收获库区id不能为空")
private Long warehouseAreaId; private Long warehouseAreaId;
@Schema(description = "客户收货地址id")
@NotNull(message = "客户收货地址id不能为空")
private Long addressId;
@Schema(description = "配送模式", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "配送模式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "配送模式不能为空") @NotEmpty(message = "配送模式不能为空")
......
package cn.iocoder.foodnexus.module.order.controller.app.customeraddress;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressPageReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressRespVO;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressSaveReqVO;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import static cn.iocoder.foodnexus.framework.common.pojo.CommonResult.success;
import cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils;
import cn.iocoder.foodnexus.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.foodnexus.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customeraddress.CustomerAddressDO;
import cn.iocoder.foodnexus.module.order.service.customeraddress.CustomerAddressService;
@Tag(name = "管理后台 - 客户 - 我的地址")
@RestController
@RequestMapping("/order/customer-address")
@Validated
public class CustomerAddressController {
@Resource
private CustomerAddressService customerAddressService;
@PostMapping("/create")
@Operation(summary = "创建客户 - 我的地址")
@PreAuthorize("@ss.hasPermission('order:customer-address:create')")
public CommonResult<Long> createCustomerAddress(@Valid @RequestBody CustomerAddressSaveReqVO createReqVO) {
return success(customerAddressService.createCustomerAddress(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新客户 - 我的地址")
@PreAuthorize("@ss.hasPermission('order:customer-address:update')")
public CommonResult<Boolean> updateCustomerAddress(@Valid @RequestBody CustomerAddressSaveReqVO updateReqVO) {
customerAddressService.updateCustomerAddress(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除客户 - 我的地址")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('order:customer-address:delete')")
public CommonResult<Boolean> deleteCustomerAddress(@RequestParam("id") Long id) {
customerAddressService.deleteCustomerAddress(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除客户 - 我的地址")
@PreAuthorize("@ss.hasPermission('order:customer-address:delete')")
public CommonResult<Boolean> deleteCustomerAddressList(@RequestParam("ids") List<Long> ids) {
customerAddressService.deleteCustomerAddressListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得客户 - 我的地址")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('order:customer-address:query')")
public CommonResult<CustomerAddressRespVO> getCustomerAddress(@RequestParam("id") Long id) {
CustomerAddressDO customerAddress = customerAddressService.getCustomerAddress(id);
return success(BeanUtils.toBean(customerAddress, CustomerAddressRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得客户 - 我的地址分页")
@PreAuthorize("@ss.hasPermission('order:customer-address:query')")
public CommonResult<PageResult<CustomerAddressRespVO>> getCustomerAddressPage(@Valid CustomerAddressPageReqVO pageReqVO) {
PageResult<CustomerAddressDO> pageResult = customerAddressService.getCustomerAddressPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CustomerAddressRespVO.class));
}
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.foodnexus.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 客户 - 我的地址分页 Request VO")
@Data
public class CustomerAddressPageReqVO extends PageParam {
@Schema(description = "客户id", example = "17120")
private Long customerId;
@Schema(description = "联系人")
private String contactUser;
@Schema(description = "联系号码")
private String contactPhone;
@Schema(description = "省id", example = "24818")
private Long provinceId;
@Schema(description = "省name", example = "李四")
private String provinceName;
@Schema(description = "市", example = "22031")
private Long cityId;
@Schema(description = "市", example = "张三")
private String cityName;
@Schema(description = "区", example = "3268")
private Long regionId;
@Schema(description = "区", example = "赵六")
private String regionName;
@Schema(description = "详细地址")
private String address;
@Schema(description = "是否默认")
private Boolean isDefault;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 客户 - 我的地址 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CustomerAddressRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15256")
@ExcelProperty("id")
private Long id;
@Schema(description = "客户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17120")
@ExcelProperty("客户id")
private Long customerId;
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("联系人")
private String contactUser;
@Schema(description = "联系号码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("联系号码")
private String contactPhone;
@Schema(description = "省id", example = "24818")
@ExcelProperty("省id")
private Long provinceId;
@Schema(description = "省name", example = "李四")
@ExcelProperty("省name")
private String provinceName;
@Schema(description = "市", example = "22031")
@ExcelProperty("市")
private Long cityId;
@Schema(description = "市", example = "张三")
@ExcelProperty("市")
private String cityName;
@Schema(description = "区", example = "3268")
@ExcelProperty("区")
private Long regionId;
@Schema(description = "区", example = "赵六")
@ExcelProperty("区")
private String regionName;
@Schema(description = "详细地址")
@ExcelProperty("详细地址")
private String address;
@Schema(description = "是否默认", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否默认")
private Boolean isDefault;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 客户 - 我的地址新增/修改 Request VO")
@Data
public class CustomerAddressSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15256")
private Long id;
@Schema(description = "客户id", hidden = true)
private Long customerId;
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "联系人不能为空")
private String contactUser;
@Schema(description = "联系号码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "联系号码不能为空")
private String contactPhone;
@Schema(description = "省id", example = "24818")
private Long provinceId;
@Schema(description = "省name", example = "李四")
private String provinceName;
@Schema(description = "市", example = "22031")
private Long cityId;
@Schema(description = "市", example = "张三")
private String cityName;
@Schema(description = "区", example = "3268")
private Long regionId;
@Schema(description = "区", example = "赵六")
private String regionName;
@Schema(description = "详细地址")
private String address;
@Schema(description = "是否默认", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否默认不能为空")
private Boolean isDefault;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.dal.dataobject.checktask;
import cn.iocoder.foodnexus.module.order.enums.CheckTaskStatus;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO;
/**
* 来料质检 DO
*
* @author 超级管理员
*/
@TableName("order_check_task")
@KeySequence("order_check_task_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CheckTaskDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 编号
*/
private String no;
/**
* 状态
*
* 枚举 {@link CheckTaskStatus}
*/
private String status;
/**
* 供应商编号
*/
private Long supplierId;
/**
* 关联采购订单id
*/
private Long purchaseOrderId;
/**
* 关联客户订单id
*/
private Long customerOrderId;
/**
* 客户id
*/
private Long customerId;
/**
* 到货时间
*/
private LocalDateTime arrivalTime;
/**
* 备注
*/
private String remark;
/**
* 附件
*/
private String files;
/**
* 质检时间
*/
private LocalDateTime checkTime;
/**
* 质检用户
*/
private Long checkUserId;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.dal.dataobject.checktaskitems;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO;
/**
* 来料质检清单 DO
*
* @author 超级管理员
*/
@TableName("order_check_task_items")
@KeySequence("order_check_task_items_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CheckTaskItemsDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 来料质检id
*/
private Long checkTaskId;
/**
* 商品id
*/
private Long productId;
/**
* 商品名称
*/
private String productName;
/**
* 商品分类
*/
private Long categoryId;
/**
* 商品分类名称
*/
private String categoryName;
/**
* 商品封面图
*/
private String picUrl;
/**
* 检查数量
*/
private Integer checkCount;
/**
* 商品单位
*/
private String unitName;
/**
* 质检结果
*
* 枚举 {@link TODO order_check_task_status 对应的类}
*/
private String checkResult;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.dal.dataobject.customeraddress;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO;
/**
* 客户 - 我的地址 DO
*
* @author 超级管理员
*/
@TableName("order_customer_address")
@KeySequence("order_customer_address_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CustomerAddressDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 客户id
*/
private Long customerId;
/**
* 联系人
*/
private String contactUser;
/**
* 联系号码
*/
private String contactPhone;
/**
* 省id
*/
private Long provinceId;
/**
* 省name
*/
private String provinceName;
/**
* 市
*/
private Long cityId;
/**
* 市
*/
private String cityName;
/**
* 区
*/
private Long regionId;
/**
* 区
*/
private String regionName;
/**
* 详细地址
*/
private String address;
/**
* 是否默认
*/
private Boolean isDefault;
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder; package cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder;
import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo; import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus; import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode; import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
...@@ -59,6 +60,15 @@ public class CustomerOrderDO extends BaseDO { ...@@ -59,6 +60,15 @@ public class CustomerOrderDO extends BaseDO {
@TableField(typeHandler = Fastjson2TypeHandler.class) @TableField(typeHandler = Fastjson2TypeHandler.class)
private WarehouseInfo warehouseInfo; private WarehouseInfo warehouseInfo;
/** /**
* 客户收货地址id
*/
private Long addressId;
/**
* 客户收货地址info
*/
@TableField(typeHandler = Fastjson2TypeHandler.class)
private CustomerAddressInfo addressInfo;
/**
* 配送模式 * 配送模式
* *
* 枚举 {@link DeliveryMode} * 枚举 {@link DeliveryMode}
...@@ -93,5 +103,10 @@ public class CustomerOrderDO extends BaseDO { ...@@ -93,5 +103,10 @@ public class CustomerOrderDO extends BaseDO {
*/ */
private String operCompany; private String operCompany;
/**
* 订单备注
*/
@TableField(typeHandler = Fastjson2TypeHandler.class)
private CustomerOrderRemark orderRemark;
} }
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author : yanghao
* create at: 2025/9/24 15:28
* @description: 客户 - 订单备注
*/
@Data
public class CustomerOrderRemark implements Serializable {
/**
* 说明
*/
private String remark;
/**
* 操作时间
*/
private LocalDateTime operTime;
/**
* 相关文件
*/
private List<String> remarkFiles;
}
package cn.iocoder.foodnexus.module.order.dal.mysql.checktask;
import java.util.*;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.foodnexus.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktask.CheckTaskDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.*;
/**
* 来料质检 Mapper
*
* @author 超级管理员
*/
@Mapper
public interface CheckTaskMapper extends BaseMapperX<CheckTaskDO> {
default PageResult<CheckTaskDO> selectPage(CheckTaskPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CheckTaskDO>()
.eqIfPresent(CheckTaskDO::getNo, reqVO.getNo())
.eqIfPresent(CheckTaskDO::getStatus, reqVO.getStatus())
.eqIfPresent(CheckTaskDO::getSupplierId, reqVO.getSupplierId())
.eqIfPresent(CheckTaskDO::getPurchaseOrderId, reqVO.getPurchaseOrderId())
.eqIfPresent(CheckTaskDO::getCustomerOrderId, reqVO.getCustomerOrderId())
.eqIfPresent(CheckTaskDO::getCustomerId, reqVO.getCustomerId())
.betweenIfPresent(CheckTaskDO::getArrivalTime, reqVO.getArrivalTime())
.eqIfPresent(CheckTaskDO::getRemark, reqVO.getRemark())
.eqIfPresent(CheckTaskDO::getFiles, reqVO.getFiles())
.betweenIfPresent(CheckTaskDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CheckTaskDO::getId));
}
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.dal.mysql.checktaskitems;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.foodnexus.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.CheckTaskItemsPageReqVO;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktaskitems.CheckTaskItemsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.*;
/**
* 来料质检清单 Mapper
*
* @author 超级管理员
*/
@Mapper
public interface CheckTaskItemsMapper extends BaseMapperX<CheckTaskItemsDO> {
default PageResult<CheckTaskItemsDO> selectPage(CheckTaskItemsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CheckTaskItemsDO>()
.eqIfPresent(CheckTaskItemsDO::getCheckTaskId, reqVO.getCheckTaskId())
.eqIfPresent(CheckTaskItemsDO::getProductId, reqVO.getProductId())
.likeIfPresent(CheckTaskItemsDO::getProductName, reqVO.getProductName())
.eqIfPresent(CheckTaskItemsDO::getCategoryId, reqVO.getCategoryId())
.likeIfPresent(CheckTaskItemsDO::getCategoryName, reqVO.getCategoryName())
.eqIfPresent(CheckTaskItemsDO::getPicUrl, reqVO.getPicUrl())
.eqIfPresent(CheckTaskItemsDO::getCheckCount, reqVO.getCheckCount())
.likeIfPresent(CheckTaskItemsDO::getUnitName, reqVO.getUnitName())
.eqIfPresent(CheckTaskItemsDO::getCheckResult, reqVO.getCheckResult())
.betweenIfPresent(CheckTaskItemsDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CheckTaskItemsDO::getId));
}
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.dal.mysql.customeraddress;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.foodnexus.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressPageReqVO;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customeraddress.CustomerAddressDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户 - 我的地址 Mapper
*
* @author 超级管理员
*/
@Mapper
public interface CustomerAddressMapper extends BaseMapperX<CustomerAddressDO> {
default PageResult<CustomerAddressDO> selectPage(CustomerAddressPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CustomerAddressDO>()
.eqIfPresent(CustomerAddressDO::getCustomerId, reqVO.getCustomerId())
.eqIfPresent(CustomerAddressDO::getContactUser, reqVO.getContactUser())
.eqIfPresent(CustomerAddressDO::getContactPhone, reqVO.getContactPhone())
.eqIfPresent(CustomerAddressDO::getProvinceId, reqVO.getProvinceId())
.likeIfPresent(CustomerAddressDO::getProvinceName, reqVO.getProvinceName())
.eqIfPresent(CustomerAddressDO::getCityId, reqVO.getCityId())
.likeIfPresent(CustomerAddressDO::getCityName, reqVO.getCityName())
.eqIfPresent(CustomerAddressDO::getRegionId, reqVO.getRegionId())
.likeIfPresent(CustomerAddressDO::getRegionName, reqVO.getRegionName())
.eqIfPresent(CustomerAddressDO::getAddress, reqVO.getAddress())
.eqIfPresent(CustomerAddressDO::getIsDefault, reqVO.getIsDefault())
.betweenIfPresent(CustomerAddressDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CustomerAddressDO::getId));
}
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.enums;
import cn.iocoder.foodnexus.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* @author : yanghao
* create at: 2025/9/24 17:08
* @description: 来料质检状态
*/
@Getter
@AllArgsConstructor
public enum CheckTaskStatus implements ArrayValuable<String> {
TO_BE_CHECK( "待质检", "TO_BE_CHECK"),
NORMAL( "质检合格", "NORMAL"),
ABNORMAL( "质检不合格", "ABNORMAL"),
;
private final String label;
private final String key;
public static final String[] ARRAYS = Arrays.stream(values()).map(CheckTaskStatus::getKey).toArray(String[]::new);
/**
* @return 数组
*/
@Override
public String[] array() {
return ARRAYS;
}
}
...@@ -15,6 +15,7 @@ public interface ErrorCodeConstants { ...@@ -15,6 +15,7 @@ public interface ErrorCodeConstants {
ErrorCode CUSTOMER_ORDER_NOT_EXISTS = new ErrorCode(1_019_100_001, "客户总订单不存在"); ErrorCode CUSTOMER_ORDER_NOT_EXISTS = new ErrorCode(1_019_100_001, "客户总订单不存在");
ErrorCode CUSTOMER_ORDER_WAREHOUSE_NOEXISTS = new ErrorCode(1_019_100_002, "仓库不存在"); ErrorCode CUSTOMER_ORDER_WAREHOUSE_NOEXISTS = new ErrorCode(1_019_100_002, "仓库不存在");
ErrorCode CUSTOMER_WAREHOUSE_NOT_BIND = new ErrorCode(1_019_100_003, "所选仓库未绑定"); ErrorCode CUSTOMER_WAREHOUSE_NOT_BIND = new ErrorCode(1_019_100_003, "所选仓库未绑定");
ErrorCode CUSTOMER_ORDER_ADDRESS_NOEXISTS = new ErrorCode(1_019_100_004, "仓库不存在");
// ========== 客户订单-子订单 1_020_100_0001 ========== // ========== 客户订单-子订单 1_020_100_0001 ==========
ErrorCode CUSTOMER_ORDER_ITEM_NOT_EXISTS = new ErrorCode(1_020_100_001, "客户订单-子订单不存在"); ErrorCode CUSTOMER_ORDER_ITEM_NOT_EXISTS = new ErrorCode(1_020_100_001, "客户订单-子订单不存在");
...@@ -23,4 +24,11 @@ public interface ErrorCodeConstants { ...@@ -23,4 +24,11 @@ public interface ErrorCodeConstants {
// ========== 客户订单进度记录 1_021_100_001 ========== // ========== 客户订单进度记录 1_021_100_001 ==========
ErrorCode CUSTOMER_ORDER_RECORD_NOT_EXISTS = new ErrorCode(1_021_100_001, "客户订单进度记录不存在"); ErrorCode CUSTOMER_ORDER_RECORD_NOT_EXISTS = new ErrorCode(1_021_100_001, "客户订单进度记录不存在");
// ========== 客户 - 我的地址 1_022_100_001 ==========
ErrorCode CUSTOMER_ADDRESS_NOT_EXISTS = new ErrorCode(1_022_100_001, "客户 - 我的地址不存在");
// ========== 来料质检 1_023_100_001 ==========
ErrorCode CHECK_TASK_NOT_EXISTS = new ErrorCode(1_023_100_001, "来料质检不存在");
ErrorCode CHECK_TASK_CREATE_ERROR = new ErrorCode(1_023_100_002, "来料质检新增失败");
ErrorCode CHECK_TASK_STATUS_ERROR = new ErrorCode(1_023_100_003, "来料质检已质检");
} }
package cn.iocoder.foodnexus.module.order.service.checktask;
import java.util.*;
import jakarta.validation.*;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktask.CheckTaskDO;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
/**
* 来料质检 Service 接口
*
* @author 超级管理员
*/
public interface CheckTaskService {
/**
* 创建来料质检
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createCheckTask(@Valid CheckTaskSaveReqVO createReqVO);
/**
* 更新来料质检
*
* @param updateReqVO 更新信息
*/
void updateCheckTask(@Valid CheckTaskSaveReqVO updateReqVO);
/**
* 删除来料质检
*
* @param id 编号
*/
void deleteCheckTask(Long id);
/**
* 批量删除来料质检
*
* @param ids 编号
*/
void deleteCheckTaskListByIds(List<Long> ids);
/**
* 获得来料质检
*
* @param id 编号
* @return 来料质检
*/
CheckTaskDO getCheckTask(Long id);
/**
* 获得来料质检分页
*
* @param pageReqVO 分页查询
* @return 来料质检分页
*/
PageResult<CheckTaskDO> getCheckTaskPage(CheckTaskPageReqVO pageReqVO);
/**
* 质检
* @param updateReqVO
*/
void check(CheckTaskCheckReqVO updateReqVO);
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.service.checktask;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.foodnexus.module.erp.api.PurchaseOrderSplitEvent;
import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseOrderDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseOrderItemDO;
import cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseOrderService;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderRecordApi;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktaskitems.CheckTaskItemsDO;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderDO;
import cn.iocoder.foodnexus.module.order.dal.mysql.checktaskitems.CheckTaskItemsMapper;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRecordEvent;
import cn.iocoder.foodnexus.module.order.enums.CheckTaskStatus;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.order.service.checktaskitems.CheckTaskItemsService;
import cn.iocoder.foodnexus.module.order.service.customerorder.CustomerOrderService;
import cn.iocoder.foodnexus.module.product.api.ProductSpuApi;
import cn.iocoder.foodnexus.module.product.api.category.ProductCategoryApi;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.foodnexus.module.product.service.category.ProductCategoryService;
import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService;
import cn.iocoder.foodnexus.module.system.util.GenCodeUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.transaction.event.TransactionPhase;
import org.springframework.transaction.event.TransactionalEventListener;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.*;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktask.CheckTaskDO;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.module.order.dal.mysql.checktask.CheckTaskMapper;
import static cn.iocoder.foodnexus.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.diffList;
import static cn.iocoder.foodnexus.module.order.enums.ErrorCodeConstants.*;
/**
* 来料质检 Service 实现类
*
* @author 超级管理员
*/
@Service
@Validated
@Slf4j
public class CheckTaskServiceImpl implements CheckTaskService {
@Resource
private CheckTaskMapper checkTaskMapper;
@Autowired
private CheckTaskItemsMapper checkTaskItemsMapper;
@Autowired
private CheckTaskItemsService checkTaskItemsService;
@Autowired
@Lazy
private ErpPurchaseOrderService purchaseOrderService;
@Autowired
private ProductSpuService productSpuService;
@Autowired
private ProductCategoryService productCategoryService;
@Autowired
@Lazy
private CustomerOrderRecordApi orderRecordApi;
@Autowired
@Lazy
private CustomerOrderService customerOrderService;
@Autowired
private GenCodeUtils genCodeUtils;
@Override
@Transactional(rollbackFor = Exception.class)
public Long createCheckTask(CheckTaskSaveReqVO createReqVO) {
// 插入
CheckTaskDO checkTask = BeanUtils.toBean(createReqVO, CheckTaskDO.class);
checkTaskMapper.insert(checkTask);
Long id = checkTask.getId();
for (CheckTaskItemsSaveReqVO item : createReqVO.getItems()) {
item.setCheckTaskId(id);
checkTaskItemsService.createCheckTaskItems(item);
}
// 返回
return checkTask.getId();
}
@Override
public void updateCheckTask(CheckTaskSaveReqVO updateReqVO) {
// 校验存在
validateCheckTaskExists(updateReqVO.getId());
// 更新
CheckTaskDO updateObj = BeanUtils.toBean(updateReqVO, CheckTaskDO.class);
checkTaskMapper.updateById(updateObj);
}
@Override
public void deleteCheckTask(Long id) {
// 校验存在
validateCheckTaskExists(id);
// 删除
checkTaskMapper.deleteById(id);
}
@Override
public void deleteCheckTaskListByIds(List<Long> ids) {
// 删除
checkTaskMapper.deleteByIds(ids);
}
private void validateCheckTaskExists(Long id) {
if (checkTaskMapper.selectById(id) == null) {
throw exception(CHECK_TASK_NOT_EXISTS);
}
}
@Override
public CheckTaskDO getCheckTask(Long id) {
return checkTaskMapper.selectById(id);
}
@Override
public PageResult<CheckTaskDO> getCheckTaskPage(CheckTaskPageReqVO pageReqVO) {
return checkTaskMapper.selectPage(pageReqVO);
}
/**
* 质检
*
* @param updateReqVO
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void check(CheckTaskCheckReqVO updateReqVO) {
CheckTaskDO checkTaskDO = checkTaskMapper.selectById(updateReqVO.getId());
if (checkTaskDO == null) {
throw exception(CHECK_TASK_NOT_EXISTS);
}
if (CheckTaskStatus.NORMAL.getKey().equals(updateReqVO.getStatus())) {
throw exception(CHECK_TASK_STATUS_ERROR);
}
checkTaskMapper.update(Wrappers.<CheckTaskDO>lambdaUpdate()
.set(CheckTaskDO::getRemark, updateReqVO.getRemark())
.set(CheckTaskDO::getFiles, updateReqVO.getFiles())
.set(CheckTaskDO::getCheckTime, LocalDateTime.now())
.set(CheckTaskDO::getCheckUserId, SecurityFrameworkUtils.getLoginUserId())
.eq(CheckTaskDO::getId, updateReqVO.getId()));
List<CheckTaskItemsDO> updateItems = BeanUtils.toBean(updateReqVO.getItems(), CheckTaskItemsDO.class);
checkTaskItemsMapper.updateById(updateItems);
if (CheckTaskStatus.NORMAL.getKey().equals(updateReqVO.getStatus())) {
// 查询关联的客户订单
CustomerOrderDO customerOrder = customerOrderService.getCustomerOrder(checkTaskDO.getCustomerOrderId());
String warehouseName = Optional.ofNullable(customerOrder.getWarehouseInfo()).map(WarehouseInfo::getName).orElse("");
CustomerOrderRecordEvent event = new CustomerOrderRecordEvent();
event.setOrderStatus(CustomerOrderStatus.WAREHOUSE_INSPECTION);
event.setSupplierId(checkTaskDO.getSupplierId());
event.setCustomerOrderId(checkTaskDO.getCustomerOrderId());
event.setCopyWriter(CommonUtil.asList(warehouseName, updateReqVO.getFiles()));
orderRecordApi.recordEvent(event);
}
}
@Async
@TransactionalEventListener(classes = CheckTaskCreateEvent.class, phase = TransactionPhase.AFTER_COMMIT)
public void createCheckTask(CheckTaskCreateEvent event) {
log.info("来料质检创建事件:{}", event);
if (CommonUtil.isEmpty(event) || CommonUtil.isEmpty(event.getSupplierOrderId())) {
return ;
}
ErpPurchaseOrderDO purchaseOrder = purchaseOrderService.getPurchaseOrder(event.getSupplierOrderId());
List<ErpPurchaseOrderItemDO> purchaseOrderItems = purchaseOrderService.getPurchaseOrderItemListByOrderId(event.getSupplierOrderId());
this.createCheckTask(this.transform(purchaseOrder, purchaseOrderItems));
}
private CheckTaskSaveReqVO transform(ErpPurchaseOrderDO purchaseOrder, List<ErpPurchaseOrderItemDO> purchaseOrderItems) {
CheckTaskSaveReqVO checkTask = new CheckTaskSaveReqVO();
if (CommonUtil.isEmpty(purchaseOrder)) {
throw exception(CHECK_TASK_CREATE_ERROR);
}
if (CommonUtil.isEmpty(purchaseOrderItems)) {
throw exception(CHECK_TASK_CREATE_ERROR);
}
checkTask.setNo(genCodeUtils.createAmBatch("LLZJ"));
checkTask.setStatus(CheckTaskStatus.TO_BE_CHECK.getKey());
checkTask.setSupplierId(checkTask.getSupplierId());
checkTask.setPurchaseOrderId(purchaseOrder.getId());
checkTask.setCustomerOrderId(purchaseOrder.getCustomerOrderId());
checkTask.setCustomerId(purchaseOrderItems.get(0).getCustomerId());
checkTask.setArrivalTime(LocalDateTime.now());
Map<Long, ProductSpuDO> spuMap = productSpuService.getSpuMap(CommonUtil.listConvertSet(purchaseOrderItems,
ErpPurchaseOrderItemDO::getProductId));
checkTask.setItems(CommonUtil.listConvert(purchaseOrderItems, purchaseOrderItem -> {
CheckTaskItemsSaveReqVO item = new CheckTaskItemsSaveReqVO();
ProductSpuDO productSpuDO = spuMap.get(purchaseOrderItem.getProductId());
item.setProductId(purchaseOrderItem.getProductId());
item.setCategoryId(productSpuDO.getCategoryId());
item.setCategoryName(productCategoryService.queryNameById(productSpuDO.getCategoryId()));
item.setPicUrl(productSpuDO.getPicUrl());
item.setCheckCount(purchaseOrderItem.getCount());
item.setUnitName(purchaseOrderItem.getProductUnit());
item.setCheckResult(CheckTaskStatus.TO_BE_CHECK.getKey());
return item;
}));
return checkTask;
}
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.service.checktaskitems;
import java.util.*;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.CheckTaskItemsPageReqVO;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.CheckTaskItemsSaveReqVO;
import jakarta.validation.*;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktaskitems.CheckTaskItemsDO;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
/**
* 来料质检清单 Service 接口
*
* @author 超级管理员
*/
public interface CheckTaskItemsService {
/**
* 创建来料质检清单
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createCheckTaskItems(@Valid CheckTaskItemsSaveReqVO createReqVO);
/**
* 更新来料质检清单
*
* @param updateReqVO 更新信息
*/
void updateCheckTaskItems(@Valid CheckTaskItemsSaveReqVO updateReqVO);
/**
* 删除来料质检清单
*
* @param id 编号
*/
void deleteCheckTaskItems(Long id);
/**
* 批量删除来料质检清单
*
* @param ids 编号
*/
void deleteCheckTaskItemsListByIds(List<Long> ids);
/**
* 获得来料质检清单
*
* @param id 编号
* @return 来料质检清单
*/
CheckTaskItemsDO getCheckTaskItems(Long id);
/**
* 获得来料质检清单分页
*
* @param pageReqVO 分页查询
* @return 来料质检清单分页
*/
PageResult<CheckTaskItemsDO> getCheckTaskItemsPage(CheckTaskItemsPageReqVO pageReqVO);
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.service.checktaskitems;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.CheckTaskItemsPageReqVO;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.CheckTaskItemsSaveReqVO;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktaskitems.CheckTaskItemsDO;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.module.order.dal.mysql.checktaskitems.CheckTaskItemsMapper;
import static cn.iocoder.foodnexus.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertList;
/**
* 来料质检清单 Service 实现类
*
* @author 超级管理员
*/
@Service
@Validated
public class CheckTaskItemsServiceImpl implements CheckTaskItemsService {
@Resource
private CheckTaskItemsMapper checkTaskItemsMapper;
@Override
public Long createCheckTaskItems(CheckTaskItemsSaveReqVO createReqVO) {
// 插入
CheckTaskItemsDO checkTaskItems = BeanUtils.toBean(createReqVO, CheckTaskItemsDO.class);
checkTaskItemsMapper.insert(checkTaskItems);
// 返回
return checkTaskItems.getId();
}
@Override
public void updateCheckTaskItems(CheckTaskItemsSaveReqVO updateReqVO) {
// 更新
CheckTaskItemsDO updateObj = BeanUtils.toBean(updateReqVO, CheckTaskItemsDO.class);
checkTaskItemsMapper.updateById(updateObj);
}
@Override
public void deleteCheckTaskItems(Long id) {
// 删除
checkTaskItemsMapper.deleteById(id);
}
@Override
public void deleteCheckTaskItemsListByIds(List<Long> ids) {
// 删除
checkTaskItemsMapper.deleteByIds(ids);
}
@Override
public CheckTaskItemsDO getCheckTaskItems(Long id) {
return checkTaskItemsMapper.selectById(id);
}
@Override
public PageResult<CheckTaskItemsDO> getCheckTaskItemsPage(CheckTaskItemsPageReqVO pageReqVO) {
return checkTaskItemsMapper.selectPage(pageReqVO);
}
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.service.customeraddress;
import java.util.*;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressPageReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressSaveReqVO;
import jakarta.validation.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customeraddress.CustomerAddressDO;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
/**
* 客户 - 我的地址 Service 接口
*
* @author 超级管理员
*/
public interface CustomerAddressService {
/**
* 创建客户 - 我的地址
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createCustomerAddress(@Valid CustomerAddressSaveReqVO createReqVO);
/**
* 更新客户 - 我的地址
*
* @param updateReqVO 更新信息
*/
void updateCustomerAddress(@Valid CustomerAddressSaveReqVO updateReqVO);
/**
* 删除客户 - 我的地址
*
* @param id 编号
*/
void deleteCustomerAddress(Long id);
/**
* 批量删除客户 - 我的地址
*
* @param ids 编号
*/
void deleteCustomerAddressListByIds(List<Long> ids);
/**
* 获得客户 - 我的地址
*
* @param id 编号
* @return 客户 - 我的地址
*/
CustomerAddressDO getCustomerAddress(Long id);
/**
* 获得客户 - 我的地址分页
*
* @param pageReqVO 分页查询
* @return 客户 - 我的地址分页
*/
PageResult<CustomerAddressDO> getCustomerAddressPage(CustomerAddressPageReqVO pageReqVO);
boolean existsById(Long addressId);
}
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.service.customeraddress;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressPageReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressSaveReqVO;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customeraddress.CustomerAddressDO;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.module.order.dal.mysql.customeraddress.CustomerAddressMapper;
import static cn.iocoder.foodnexus.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.foodnexus.module.order.enums.ErrorCodeConstants.*;
/**
* 客户 - 我的地址 Service 实现类
*
* @author 超级管理员
*/
@Service
@Validated
public class CustomerAddressServiceImpl implements CustomerAddressService {
@Resource
private CustomerAddressMapper customerAddressMapper;
@Override
public Long createCustomerAddress(CustomerAddressSaveReqVO createReqVO) {
// 插入
CustomerAddressDO customerAddress = BeanUtils.toBean(createReqVO, CustomerAddressDO.class);
customerAddressMapper.insert(customerAddress);
// 返回
return customerAddress.getId();
}
@Override
public void updateCustomerAddress(CustomerAddressSaveReqVO updateReqVO) {
// 校验存在
validateCustomerAddressExists(updateReqVO.getId());
// 更新
CustomerAddressDO updateObj = BeanUtils.toBean(updateReqVO, CustomerAddressDO.class);
customerAddressMapper.updateById(updateObj);
}
@Override
public void deleteCustomerAddress(Long id) {
// 校验存在
validateCustomerAddressExists(id);
// 删除
customerAddressMapper.deleteById(id);
}
@Override
public void deleteCustomerAddressListByIds(List<Long> ids) {
// 删除
customerAddressMapper.deleteByIds(ids);
}
private void validateCustomerAddressExists(Long id) {
if (customerAddressMapper.selectById(id) == null) {
throw exception(CUSTOMER_ADDRESS_NOT_EXISTS);
}
}
@Override
public CustomerAddressDO getCustomerAddress(Long id) {
return customerAddressMapper.selectById(id);
}
@Override
public PageResult<CustomerAddressDO> getCustomerAddressPage(CustomerAddressPageReqVO pageReqVO) {
return customerAddressMapper.selectPage(pageReqVO);
}
@Override
public boolean existsById(Long addressId) {
return customerAddressMapper.exists(Wrappers.<CustomerAddressDO>lambdaQuery()
.eq(CustomerAddressDO::getId, addressId));
}
}
\ No newline at end of file
...@@ -2,6 +2,8 @@ package cn.iocoder.foodnexus.module.order.service.customerorder; ...@@ -2,6 +2,8 @@ package cn.iocoder.foodnexus.module.order.service.customerorder;
import java.util.*; import java.util.*;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderRemarkReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO; import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO;
import jakarta.validation.*; import jakarta.validation.*;
import cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.*; import cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.*;
...@@ -67,4 +69,22 @@ public interface CustomerOrderService { ...@@ -67,4 +69,22 @@ public interface CustomerOrderService {
* @return * @return
*/ */
Long appCreateCustomerOrder(AppCustomerOrderSaveReqVO createReqVO); Long appCreateCustomerOrder(AppCustomerOrderSaveReqVO createReqVO);
/**
* 客户修改订单
* @param updateReqVO
*/
void appUpdateCustomerOrder(AppCustomerOrderSaveReqVO updateReqVO);
/**
* 取消订单
* @param id
*/
void cancel(AppCustomerOrderRemarkReqVO reqVO);
/**
* 签收订单
* @param reqVO
*/
void receipt(AppCustomerOrderRemarkReqVO reqVO);
} }
\ No newline at end of file
...@@ -16,13 +16,17 @@ import cn.iocoder.foodnexus.module.operations.service.inquiresupplierpush.Inquir ...@@ -16,13 +16,17 @@ import cn.iocoder.foodnexus.module.operations.service.inquiresupplierpush.Inquir
import cn.iocoder.foodnexus.module.order.api.CustomerOrderApi; import cn.iocoder.foodnexus.module.order.api.CustomerOrderApi;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderRecordApi; import cn.iocoder.foodnexus.module.order.api.CustomerOrderRecordApi;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderItemSaveReqVO; import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderItemSaveReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderRemarkReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO; import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorderitem.CustomerOrderItemDO; import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorderitem.CustomerOrderItemDO;
import cn.iocoder.foodnexus.module.order.dal.mysql.customerorderitem.CustomerOrderItemMapper; import cn.iocoder.foodnexus.module.order.dal.mysql.customerorderitem.CustomerOrderItemMapper;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderDTO; import cn.iocoder.foodnexus.module.order.dto.CustomerOrderDTO;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderItemDTO; import cn.iocoder.foodnexus.module.order.dto.CustomerOrderItemDTO;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRecordEvent; import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRecordEvent;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus; import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.order.service.customeraddress.CustomerAddressService;
import cn.iocoder.foodnexus.module.order.service.customerorderitem.CustomerOrderItemService; import cn.iocoder.foodnexus.module.order.service.customerorderitem.CustomerOrderItemService;
import cn.iocoder.foodnexus.module.product.api.InquireCustomerApi; import cn.iocoder.foodnexus.module.product.api.InquireCustomerApi;
import cn.iocoder.foodnexus.module.product.api.dto.CustomerVisibleProductRespDTO; import cn.iocoder.foodnexus.module.product.api.dto.CustomerVisibleProductRespDTO;
...@@ -31,11 +35,13 @@ import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService; ...@@ -31,11 +35,13 @@ import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService;
import cn.iocoder.foodnexus.module.system.util.GenCodeUtils; import cn.iocoder.foodnexus.module.system.util.GenCodeUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -82,12 +88,16 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -82,12 +88,16 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
private ErpWarehouseApi warehouseApi; private ErpWarehouseApi warehouseApi;
@Autowired @Autowired
private CustomerAddressService addressService;
@Autowired
private InquireSupplierPushService inquireSupplierPushService; private InquireSupplierPushService inquireSupplierPushService;
@Autowired @Autowired
private ErpSupplierApi supplierApi; private ErpSupplierApi supplierApi;
@Autowired @Autowired
@Lazy
private CustomerOrderRecordApi orderRecordApi; private CustomerOrderRecordApi orderRecordApi;
@Autowired @Autowired
...@@ -157,8 +167,8 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -157,8 +167,8 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
@CustomerVisible @CustomerVisible
public Long appCreateCustomerOrder(AppCustomerOrderSaveReqVO createReqVO) { public Long appCreateCustomerOrder(AppCustomerOrderSaveReqVO createReqVO) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
this.validCustomerOrder(createReqVO, loginUser.getId());
Long customerId = customerApi.queryCustomerIdByUserId(loginUser.getId()); Long customerId = customerApi.queryCustomerIdByUserId(loginUser.getId());
this.validCustomerOrder(createReqVO, customerId);
CustomerVisibleProductRespDTO dto = inquireCustomerApi.queryCustomerIdByCustomerId(customerId); CustomerVisibleProductRespDTO dto = inquireCustomerApi.queryCustomerIdByCustomerId(customerId);
Map<Long, CustomerVisibleProductRespDTO.CustomerProduct> customerProductMap = CommonUtil.listConvertMap(dto.getItems(), CustomerVisibleProductRespDTO.CustomerProduct::getProductId); Map<Long, CustomerVisibleProductRespDTO.CustomerProduct> customerProductMap = CommonUtil.listConvertMap(dto.getItems(), CustomerVisibleProductRespDTO.CustomerProduct::getProductId);
Set<Long> supplierSet = new HashSet<>(); Set<Long> supplierSet = new HashSet<>();
...@@ -183,6 +193,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -183,6 +193,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
createOrder.setOrderStatus(CustomerOrderStatus.ORDER_SUCCESS); createOrder.setOrderStatus(CustomerOrderStatus.ORDER_SUCCESS);
createOrder.setCustomerId(customerId); createOrder.setCustomerId(customerId);
createOrder.setWarehouseInfo(warehouseApi.getInfoByWarehouseAreaId(createOrder.getWarehouseAreaId())); createOrder.setWarehouseInfo(warehouseApi.getInfoByWarehouseAreaId(createOrder.getWarehouseAreaId()));
createOrder.setAddressInfo(BeanUtils.toBean(addressService.getCustomerAddress(createReqVO.getAddressId()), CustomerAddressInfo.class));
createOrder.setSupplierCount(supplierSet.size()); createOrder.setSupplierCount(supplierSet.size());
createOrder.setProductCount(procuctSet.size()); createOrder.setProductCount(procuctSet.size());
// 子订单补全 // 子订单补全
...@@ -219,6 +230,63 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -219,6 +230,63 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
} }
/** /**
* 客户修改订单
*
* @param updateReqVO
*/
@Override
@Transactional(rollbackFor = Exception.class)
@CustomerVisible
public void appUpdateCustomerOrder(AppCustomerOrderSaveReqVO updateReqVO) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
CustomerOrderDO customerOrder = getCustomerOrder(updateReqVO.getId());
if (CommonUtil.isEmpty(customerOrder)) {
throw exception(CUSTOMER_ORDER_NOT_EXISTS);
}
Long customerId = customerApi.queryCustomerIdByUserId(loginUser.getId());
this.validCustomerOrder(updateReqVO, customerId);
// TODO 具体修改什么待定
// TODO 采购订单拆分更新
}
/**
* 取消订单
*
* @param reqVO
*/
@Override
public void cancel(AppCustomerOrderRemarkReqVO reqVO) {
CustomerOrderDO customerOrder = getCustomerOrder(reqVO.getId());
if (CommonUtil.isEmpty(customerOrder)) {
throw exception(CUSTOMER_ORDER_NOT_EXISTS);
}
// TODO ... 取消订单校验待定(订单状态)
CustomerOrderRemark orderRemark = BeanUtils.toBean(reqVO, CustomerOrderRemark.class, item -> {
item.setOperTime(LocalDateTime.now());
});
customerOrderMapper.update(Wrappers.<CustomerOrderDO>lambdaUpdate()
.set(CustomerOrderDO::getOrderRemark, orderRemark)
.eq(CustomerOrderDO::getId, reqVO.getId()));
}
/**
* 签收订单
*
* @param reqVO
*/
@Override
public void receipt(AppCustomerOrderRemarkReqVO reqVO) {
// TODO .. 校验订单
// TODO .. 根据签收单调整订单价格等
// TODO .. 修改订单状态
}
/**
* {@link ErpPurchaseOrderServiceImpl#orderSplit(PurchaseOrderSplitEvent)} * {@link ErpPurchaseOrderServiceImpl#orderSplit(PurchaseOrderSplitEvent)}
*/ */
private void orderSplitPurchase(Long customerOrderId) { private void orderSplitPurchase(Long customerOrderId) {
...@@ -237,6 +305,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -237,6 +305,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
if (!customerWarehouseService.exists(createReqVO.getWarehouseAreaId(), customerId)) { if (!customerWarehouseService.exists(createReqVO.getWarehouseAreaId(), customerId)) {
throw exception(CUSTOMER_WAREHOUSE_NOT_BIND); throw exception(CUSTOMER_WAREHOUSE_NOT_BIND);
} }
if (!addressService.existsById(createReqVO.getAddressId())) {
throw exception(CUSTOMER_ORDER_ADDRESS_NOEXISTS);
}
} }
@Override @Override
......
...@@ -99,6 +99,7 @@ public class CustomerOrderRecordServiceImpl implements CustomerOrderRecordServic ...@@ -99,6 +99,7 @@ public class CustomerOrderRecordServiceImpl implements CustomerOrderRecordServic
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void recordEvent(CustomerOrderRecordEvent event) { public void recordEvent(CustomerOrderRecordEvent event) {
SpringUtils.getApplicationContext().publishEvent(event); SpringUtils.getApplicationContext().publishEvent(event);
} }
......
...@@ -7,6 +7,7 @@ import jakarta.validation.Valid; ...@@ -7,6 +7,7 @@ import jakarta.validation.Valid;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Optional;
/** /**
* 商品分类 Service 接口 * 商品分类 Service 接口
...@@ -93,4 +94,8 @@ public interface ProductCategoryService { ...@@ -93,4 +94,8 @@ public interface ProductCategoryService {
*/ */
void validateCategoryList(Collection<Long> ids); void validateCategoryList(Collection<Long> ids);
default String queryNameById(Long categoryId) {
return Optional.ofNullable(this.getCategory(categoryId))
.map(ProductCategoryDO::getName).orElse("");
}
} }
...@@ -3,7 +3,7 @@ spring: ...@@ -3,7 +3,7 @@ spring:
name: foodnexus-server name: foodnexus-server
profiles: profiles:
active: dev active: local
main: main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment