Commit b481db08 by 杨浩

bug修复

parent 2f7230fd
......@@ -121,7 +121,7 @@ public class ErpPurchaseOrderController {
/* ----- 供应商接口 ----- */
@GetMapping("/supplier/purchase-order/get")
@Operation(summary = "获得采购订单")
@Operation(summary = "供应商 - 获得采购订单")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public CommonResult<ErpPurchaseOrderRespVO> supplierGetPurchaseOrder(@RequestParam("id") Long id) {
......@@ -133,7 +133,7 @@ public class ErpPurchaseOrderController {
}
@GetMapping("/supplier/purchase-order/page")
@Operation(summary = "获得采购订单分页")
@Operation(summary = "供应商 - 获得采购订单分页")
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public CommonResult<PageResult<ErpPurchaseOrderRespVO>> supplierGetPurchaseOrderPage(@Valid ErpPurchaseOrderPageReqVO pageReqVO) {
pageReqVO.setSupplierId(supplierApi.querySupplierIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
......@@ -142,7 +142,7 @@ public class ErpPurchaseOrderController {
}
@GetMapping("/supplier/purchase-ordercount")
@Operation(summary = "根据配送状态统计数量")
@Operation(summary = "供应商 - 根据配送状态统计数量")
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public CommonResult<Map<String, Long>> supplierQueryCount(@Valid ErpPurchaseOrderPageReqVO pageReqVO) {
pageReqVO.setSupplierId(supplierApi.querySupplierIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
......@@ -150,7 +150,7 @@ public class ErpPurchaseOrderController {
}
@PostMapping("/supplier/purchase-order/accepting-orders")
@Operation(summary = "接单")
@Operation(summary = "供应商 - 接单")
@Parameter(name = "ids", description = "编号", required = true)
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public CommonResult<Boolean> supplierAcceptingOrders(@RequestParam("ids") List<Long> ids) {
......@@ -160,7 +160,7 @@ public class ErpPurchaseOrderController {
}
@PostMapping("/supplier/purchase-order/delivery")
@Operation(summary = "发货")
@Operation(summary = "供应商 - 发货")
@Parameter(name = "ids", description = "编号", required = true)
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public CommonResult<Boolean> supplierPurchaseOrderDelivery(@RequestParam("ids") List<Long> ids) {
......@@ -219,6 +219,7 @@ public class ErpPurchaseOrderController {
MapUtils.findAndThen(userMap, Long.parseLong(purchaseOrder.getCreator()), user -> purchaseOrder.setCreatorName(user.getNickname()));
MapUtils.findAndThen(customerOrderMap, purchaseOrder.getCustomerOrderId(), customerOrder -> {
purchaseOrder.setAddressInfo(customerOrder.getAddressInfo());
purchaseOrder.setWarehouseInfo(customerOrder.getWarehouseInfo());
purchaseOrder.setPlanDeliveryStartTime(customerOrder.getPlanDeliveryStartTime());
purchaseOrder.setPlanDeliveryEndTime(customerOrder.getPlanDeliveryEndTime());
purchaseOrder.setCustomerOrderCode(customerOrder.getCode());
......
......@@ -35,7 +35,6 @@ 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.*;
......@@ -79,7 +78,7 @@ public class SupplierPurchaseReturnController {
@DeleteMapping("/delete")
@Operation(summary = "删除采购退货")
@Parameter(name = "ids", description = "编号数组", required = true)
@PreAuthorize("@ss.hasPermission('erp:purchase-return:delete')")
//@PreAuthorize("@ss.hasPermission('erp:purchase-return:delete')")
public CommonResult<Boolean> deletePurchaseReturn(@RequestParam("ids") List<Long> ids) {
purchaseReturnService.deletePurchaseReturn(ids);
return success(true);
......@@ -88,7 +87,7 @@ public class SupplierPurchaseReturnController {
@GetMapping("/get")
@Operation(summary = "获得采购退货")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:purchase-return:query')")
//@PreAuthorize("@ss.hasPermission('erp:purchase-return:query')")
public CommonResult<ErpPurchaseReturnRespVO> getPurchaseReturn(@RequestParam("id") Long id) {
ErpPurchaseReturnDO purchaseReturn = purchaseReturnService.getPurchaseReturn(id);
if (purchaseReturn == null) {
......@@ -109,7 +108,7 @@ public class SupplierPurchaseReturnController {
@GetMapping("/page")
@Operation(summary = "获得采购退货分页")
@PreAuthorize("@ss.hasPermission('erp:purchase-return:query')")
//@PreAuthorize("@ss.hasPermission('erp:purchase-return:query')")
public CommonResult<PageResult<ErpPurchaseReturnRespVO>> getPurchaseReturnPage(@Valid ErpPurchaseReturnPageReqVO pageReqVO) {
pageReqVO.setSupplierId(supplierApi.querySupplierIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
PageResult<ErpPurchaseReturnDO> pageResult = purchaseReturnService.getPurchaseReturnPage(pageReqVO);
......@@ -118,7 +117,7 @@ public class SupplierPurchaseReturnController {
@GetMapping("/export-excel")
@Operation(summary = "导出采购退货 Excel")
@PreAuthorize("@ss.hasPermission('erp:purchase-return:export')")
//@PreAuthorize("@ss.hasPermission('erp:purchase-return:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPurchaseReturnExcel(@Valid ErpPurchaseReturnPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
......
package cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.order;
import cn.idev.excel.annotation.ExcelProperty;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.validation.InEnum;
import cn.iocoder.foodnexus.module.erp.api.enums.ErpDeliveryStatus;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -56,6 +58,14 @@ public class ErpPurchaseOrderPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] orderTime;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "预计配送开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] planDeliveryStartTime;
@Schema(description = "备注", example = "你猜")
private String remark;
......@@ -84,12 +94,17 @@ public class ErpPurchaseOrderPageReqVO extends PageParam {
private String createMonth;
/**
*
*
* 枚举 {@link ErpDeliveryStatus}
*/
@Schema(description = "发货状态")
private List<String> deliveryStatus;
private List<String> deliveryStatusList;
/**
* 枚举 {@link ErpDeliveryStatus}
*/
@Schema(description = "发货状态")
@InEnum(ErpDeliveryStatus.class)
private String deliveryStatus;
@Schema(description = "配送模式")
private DeliveryMode deliveryMode;
......@@ -100,4 +115,13 @@ public class ErpPurchaseOrderPageReqVO extends PageParam {
@Schema(description = "客户名称")
private String customerName;
@Schema(description = "联系人")
private String contactUser;
@Schema(description = "联系号码")
private String contactPhone;
@Schema(description = "商品名称")
private String productName;
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.order;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.iocoder.foodnexus.module.erp.api.enums.ErpDeliveryStatus;
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.DeliveryMode;
import cn.iocoder.foodnexus.module.product.api.dto.ProductInfo;
......@@ -119,6 +120,9 @@ public class ErpPurchaseOrderRespVO {
@Schema(description = "客户收货地址info")
private CustomerAddressInfo addressInfo;
@Schema(description = "配送仓库info")
private WarehouseInfo warehouseInfo;
@Schema(description = "预计配送开始时间")
@ExcelProperty("预计配送开始时间")
private LocalDateTime planDeliveryStartTime;
......
......@@ -118,7 +118,7 @@ public class ErpStockController {
}
Map<Long, ProductSpuDO> productMap = productSpuService.getProductVOMap(
convertSet(pageResult.getList(), ErpStockDO::getProductId));
Map<Long, ErpWarehouseDO> warehouseMap = warehouseService.getWarehouseMap(
Map<Long, String> warehouseMap = warehouseService.getNameWithParentMap(
convertSet(pageResult.getList(), ErpStockDO::getWarehouseId));
Map<Long, String> categoryMap = productCategoryService.getMap(productMap.keySet());
Map<Long, Long> supplierCountMap = productSupplierService.getCountMap(productMap.keySet());
......@@ -127,7 +127,7 @@ public class ErpStockController {
.setUnitName(product.getUnitName())
.setIntroduction(product.getIntroduction()));
MapUtils.findAndThen(categoryMap, stock.getProductId(), stock::setCategoryName);
MapUtils.findAndThen(warehouseMap, stock.getWarehouseId(), warehouse -> stock.setWarehouseName(warehouse.getName()));
MapUtils.findAndThen(warehouseMap, stock.getWarehouseId(), stock::setWarehouseName);
MapUtils.findAndThen(supplierCountMap, stock.getProductId(), stock::setProductSupplierCount);
});
}
......
......@@ -12,6 +12,7 @@ import cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus;
import cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.order.SupplierMonthOrderPageReqVO;
import cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.order.SupplierMonthOrderRespVO;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.yulichang.query.MPJQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
......@@ -50,10 +51,12 @@ public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO>
.likeIfPresent(ErpPurchaseOrderDO::getNo, reqVO.getNo())
.eqIfPresent(ErpPurchaseOrderDO::getSupplierId, reqVO.getSupplierId())
.betweenIfPresent(ErpPurchaseOrderDO::getOrderTime, reqVO.getOrderTime())
.betweenIfPresent(ErpPurchaseOrderDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ErpPurchaseOrderDO::getStatus, reqVO.getStatus())
.likeIfPresent(ErpPurchaseOrderDO::getRemark, reqVO.getRemark())
.eqIfPresent(ErpPurchaseOrderDO::getCreator, reqVO.getCreator())
.inIfPresent(ErpPurchaseOrderDO::getDeliveryStatus, reqVO.getDeliveryStatus())
.eqIfPresent(ErpPurchaseOrderDO::getDeliveryStatus, reqVO.getDeliveryStatus())
.inIfPresent(ErpPurchaseOrderDO::getDeliveryStatus, reqVO.getDeliveryStatusList())
.eqIfPresent(ErpPurchaseOrderDO::getCustomerOrderId, reqVO.getCustomerOrderId())
.orderByDesc(ErpPurchaseOrderDO::getId);
// 入库状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报 in_count 错误
......@@ -91,6 +94,12 @@ public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO>
.eq(reqVO.getProductId() != null, ErpPurchaseOrderItemDO::getProductId, reqVO.getProductId())
.groupBy(ErpPurchaseOrderDO::getId); // 避免 1 对多查询,产生相同的 1
}
if (CommonUtil.isNotBlank(reqVO.getProductName())) {
query.leftJoin(ErpPurchaseOrderItemDO.class, ErpPurchaseOrderItemDO::getOrderId, ErpPurchaseOrderDO::getId)
.leftJoin(ProductSpuDO.class, ProductSpuDO::getId, ErpPurchaseOrderItemDO::getProductId)
.like(ProductSpuDO::getName, reqVO.getProductName())
.groupBy(ErpPurchaseOrderDO::getId);
}
if (CommonUtil.isNotBlank(reqVO.getCreateMonth())) {
String createMonth = reqVO.getCreateMonth().trim();
String startOfMonth = createMonth + "-01 00:00:00";
......@@ -110,6 +119,16 @@ public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO>
query.like("ec.`name`", reqVO.getCustomerName());
query.groupBy(ErpPurchaseOrderDO::getId);
}
if (CommonUtil.isNotEmpty(reqVO.getPlanDeliveryStartTime())) {
query.leftJoin("order_customer_order oco1 on oco1.id = t.customer_order_id");
query.between("oco1.plan_delivery_start_time", reqVO.getPlanDeliveryStartTime()[0], reqVO.getPlanDeliveryStartTime()[1]);
query.groupBy(ErpPurchaseOrderDO::getId);
}
if (CommonUtil.isNotBlank(reqVO.getContactPhone()) || CommonUtil.isNotBlank(reqVO.getContactUser())) {
query.leftJoin("order_customer_order oco2 on oco2.id = t.customer_order_id");
query.likeIfExists("oco2.address_info", reqVO.getContactPhone());
query.likeIfExists("oco2.address_info", reqVO.getContactUser());
}
return query;
}
......
......@@ -101,4 +101,11 @@ public interface ErpWarehouseService {
PageResult<ErpWarehouseDO> getWarehousePage(ErpWarehousePageReqVO pageReqVO);
Map<Long, String> queryNameByIds(Collection<Long> longs);
/**
* 获取仓库/库区名称
* @param ids
* @return
*/
Map<Long, String> getNameWithParentMap(Collection<Long> ids);
}
\ No newline at end of file
......@@ -141,6 +141,26 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService, ErpWarehous
return result;
}
/**
* 获取仓库/库区名称
*
* @param ids
* @return
*/
@Override
public Map<Long, String> getNameWithParentMap(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return new HashMap<>();
}
List<ErpWarehouseDO> erpWarehouseDOS = warehouseMapper.selectByIds(ids);
return CommonUtil.listConvertMap(erpWarehouseDOS, ErpWarehouseDO::getId, value -> {
if (!ErpWarehouseDO.PARENT_ID_ROOT.equals(value.getParentId())) {
return Optional.ofNullable(this.getWarehouse(value.getParentId())).map(parent -> parent.getName() + "/").orElse("") + value.getName();
}
return value.getName();
});
}
@Override
public boolean existsById(Long warehouseId) {
return warehouseMapper.exists(Wrappers.<ErpWarehouseDO>lambdaQuery()
......
......@@ -58,4 +58,7 @@ public class DeliveryStaffPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "只查询未绑定")
private Boolean filterVirgin;
}
\ No newline at end of file
......@@ -52,7 +52,6 @@ import cn.iocoder.foodnexus.module.operations.service.inquiresupplierpush.Inquir
@RestController
@RequestMapping("/operations/inquire-supplier-push")
@Validated
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public class InquireSupplierPushController {
@Resource
......@@ -73,6 +72,7 @@ public class InquireSupplierPushController {
@PostMapping("/confirm")
@Operation(summary = "确认询价")
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public CommonResult<Boolean> updateInquireSupplierPush(@Valid @RequestBody AppInquireSupplierPushConfirmReqVO updateReqVO) {
updateReqVO.setSupplierId(supplierApi.querySupplierIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
inquireSupplierPushService.confirm(updateReqVO);
......@@ -121,6 +121,7 @@ public class InquireSupplierPushController {
@GetMapping("/inquirePrice/get")
@Operation(summary = "inquirePrice获得询价推送")
@Parameter(name = "id", description = "询价主题id", required = true, example = "1024")
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public CommonResult<AppInquireSupplierPushDetailsRespVO> getInquireSupplierPushDetails(@RequestParam("id") Long id) {
AppInquireSupplierPushPageReqVO pageReqVO = new AppInquireSupplierPushPageReqVO();
pageReqVO.setInquirePriceId(id);
......@@ -137,6 +138,7 @@ public class InquireSupplierPushController {
@GetMapping("/inquirePrice/page")
@Operation(summary = "inquirePrice获得询价推送分页")
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public CommonResult<PageResult<AppInquireSupplierPushRespVO>> getInquireSupplierPushPage(@Valid AppInquireSupplierPushPageReqVO pageReqVO) {
pageReqVO.setSupplierId(supplierApi.querySupplierIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
return success(inquireSupplierPushService.getAppInquireSupplierPushPage(pageReqVO));
......
......@@ -51,4 +51,7 @@ public class VehicleInfoPageReqVO extends PageParam {
@Schema(description = "创建人")
private String creator;
@Schema(description = "只查询未绑定")
private Boolean filterVirgin;
}
\ No newline at end of file
......@@ -3,9 +3,12 @@ package cn.iocoder.foodnexus.module.operations.dal.mysql.deliverystaff;
import java.util.*;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.foodnexus.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.foodnexus.framework.mybatis.core.query.MPJLambdaWrapperX;
import cn.iocoder.foodnexus.module.operations.dal.dataobject.deliverystaff.DeliveryStaffDO;
import cn.iocoder.foodnexus.module.operations.dal.dataobject.vehicleinfo.VehicleInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.foodnexus.module.operations.controller.admin.deliverystaff.vo.*;
......@@ -18,7 +21,7 @@ import cn.iocoder.foodnexus.module.operations.controller.admin.deliverystaff.vo.
public interface DeliveryStaffMapper extends BaseMapperX<DeliveryStaffDO> {
default PageResult<DeliveryStaffDO> selectPage(DeliveryStaffPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DeliveryStaffDO>()
MPJLambdaWrapperX<DeliveryStaffDO> wrapper = new MPJLambdaWrapperX<DeliveryStaffDO>()
.likeIfPresent(DeliveryStaffDO::getName, reqVO.getName())
.eqIfPresent(DeliveryStaffDO::getIdNumber, reqVO.getIdNumber())
.eqIfPresent(DeliveryStaffDO::getContact, reqVO.getContact())
......@@ -33,7 +36,13 @@ public interface DeliveryStaffMapper extends BaseMapperX<DeliveryStaffDO> {
.eqIfPresent(DeliveryStaffDO::getDriverLicenseFile, reqVO.getDriverLicenseFile())
.eqIfPresent(DeliveryStaffDO::getRemark, reqVO.getRemark())
.betweenIfPresent(DeliveryStaffDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DeliveryStaffDO::getId));
.orderByDesc(DeliveryStaffDO::getId);
if (CommonUtil.isNotEmpty(reqVO.getFilterVirgin()) && reqVO.getFilterVirgin()) {
wrapper.leftJoin(VehicleInfoDO.class, VehicleInfoDO::getVehicleStaff, DeliveryStaffDO::getId);
wrapper.isNull(VehicleInfoDO::getId);
wrapper.groupBy(DeliveryStaffDO::getId);
}
return selectPage(reqVO, wrapper);
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package cn.iocoder.foodnexus.module.operations.dal.mysql.vehicleinfo;
import java.util.*;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.foodnexus.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.foodnexus.module.operations.dal.dataobject.vehicleinfo.VehicleInfoDO;
......@@ -31,6 +32,8 @@ public interface VehicleInfoMapper extends BaseMapperX<VehicleInfoDO> {
.eqIfPresent(VehicleInfoDO::getStaffLicenseStatus, reqVO.getStaffLicenseStatus())
.betweenIfPresent(VehicleInfoDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(VehicleInfoDO::getCreator, reqVO.getCreator())
.isNull(CommonUtil.isNotEmpty(reqVO.getFilterVirgin()) && reqVO.getFilterVirgin(),
VehicleInfoDO::getVehicleStaff)
.orderByDesc(VehicleInfoDO::getId));
}
......
......@@ -188,7 +188,8 @@ public class InquirePriceServiceImpl implements InquirePriceService {
supplierPush.setInquirePriceItemId(inquirePriceItemDO.getId());
supplierPush.setProductId(productSupplier.getProductId());
supplierPush.setCategoryId(inquirePriceItemDO.getCategoryId());
supplierPush.setConfirm(Boolean.FALSE);
supplierPush.setConfirm(Boolean.TRUE);
supplierPush.setSupplierQuote(inquirePriceItemDO.getFloatingPrice());
totalSupplierPush.add(supplierPush);
}
}
......
......@@ -27,8 +27,7 @@ public class OrderScoreSaveReqVO {
@NotNull(message = "供应商id不能为空")
private Long supplierId;
@Schema(description = "客户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7606")
@NotNull(message = "客户id不能为空")
@Schema(description = "客户id", example = "7606")
private Long customerId;
@Schema(description = "得分", requiredMode = Schema.RequiredMode.REQUIRED)
......
......@@ -67,7 +67,7 @@ public class OperaSupplierPurchaseOrderController {
orderPageReqVo.setPageNo(pageReqVO.getPageNo());
// orderPageReqVo.setSupplierId(supplierApi.querySupplierIdByUserId(getLoginUserId()));
orderPageReqVo.setCreateMonth(pageReqVO.getMonth());
orderPageReqVo.setDeliveryStatus(CommonUtil.asList(ErpDeliveryStatus.ARRIVAL.getStatus(), ErpDeliveryStatus.RECONCILIATION.getStatus()));
orderPageReqVo.setDeliveryStatusList(CommonUtil.asList(ErpDeliveryStatus.ARRIVAL.getStatus(), ErpDeliveryStatus.RECONCILIATION.getStatus()));
PageResult<ErpPurchaseOrderDO> pageResult = purchaseOrderService.getPurchaseOrderPage(orderPageReqVo);
return success(BeanUtils.toBean(pageResult, SupplierMonthOrderDetailsRespVO.class, this::transform));
}
......
......@@ -71,7 +71,7 @@ public class SupplierPurchaseOrderController {
orderPageReqVo.setPageNo(pageReqVO.getPageNo());
orderPageReqVo.setSupplierId(supplierApi.querySupplierIdByUserId(getLoginUserId()));
orderPageReqVo.setCreateMonth(pageReqVO.getMonth());
orderPageReqVo.setDeliveryStatus(CommonUtil.asList(ErpDeliveryStatus.ARRIVAL.getStatus(), ErpDeliveryStatus.RECONCILIATION.getStatus()));
orderPageReqVo.setDeliveryStatusList(CommonUtil.asList(ErpDeliveryStatus.ARRIVAL.getStatus(), ErpDeliveryStatus.RECONCILIATION.getStatus()));
PageResult<ErpPurchaseOrderDO> pageResult = purchaseOrderService.getPurchaseOrderPage(orderPageReqVo);
return success(BeanUtils.toBean(pageResult, SupplierMonthOrderDetailsRespVO.class, this::transform));
}
......@@ -85,7 +85,7 @@ public class SupplierPurchaseOrderController {
orderPageReqVo.setPageNo(1);
orderPageReqVo.setSupplierId(supplierApi.querySupplierIdByUserId(getLoginUserId()));
orderPageReqVo.setCreateMonth(month);
orderPageReqVo.setDeliveryStatus(CommonUtil.asList(ErpDeliveryStatus.ARRIVAL.getStatus(), ErpDeliveryStatus.RECONCILIATION.getStatus()));
orderPageReqVo.setDeliveryStatusList(CommonUtil.asList(ErpDeliveryStatus.ARRIVAL.getStatus(), ErpDeliveryStatus.RECONCILIATION.getStatus()));
PageResult<ErpPurchaseOrderDO> pageResult = purchaseOrderService.getPurchaseOrderPage(orderPageReqVo);
purchaseOrderService.reconciliation(pageResult.getList(), orderPageReqVo.getSupplierId());
return success(Boolean.TRUE);
......
......@@ -35,11 +35,16 @@ public class CustomerAddressServiceImpl implements CustomerAddressService {
@Override
public Long createCustomerAddress(CustomerAddressSaveReqVO createReqVO) {
Long loginUserId = getLoginUserId();
if (createReqVO.getIsDefault()) {
customerAddressMapper.update(Wrappers.<CustomerAddressDO>lambdaUpdate()
.set(CustomerAddressDO::getIsDefault, Boolean.FALSE)
.eq(CustomerAddressDO::getIsDefault, Boolean.TRUE)
.eq(CustomerAddressDO::getCreator, getLoginUserId()));
.eq(CustomerAddressDO::getCreator, loginUserId));
}
if (!customerAddressMapper.exists(Wrappers.<CustomerAddressDO>lambdaQuery()
.eq(CustomerAddressDO::getCreator, loginUserId))) {
createReqVO.setIsDefault(Boolean.TRUE);
}
// 插入
CustomerAddressDO customerAddress = BeanUtils.toBean(createReqVO, CustomerAddressDO.class);
......
......@@ -3,6 +3,8 @@ package cn.iocoder.foodnexus.module.product.controller.admin.spu;
import cn.iocoder.foodnexus.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.common.util.collection.MapUtils;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils;
import cn.iocoder.foodnexus.module.product.controller.admin.spu.vo.*;
......@@ -10,6 +12,7 @@ import cn.iocoder.foodnexus.module.product.convert.spu.ProductSpuConvert;
import cn.iocoder.foodnexus.module.product.dal.dataobject.sku.ProductSkuDO;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.foodnexus.module.product.enums.spu.ProductSpuStatusEnum;
import cn.iocoder.foodnexus.module.product.service.category.ProductCategoryService;
import cn.iocoder.foodnexus.module.product.service.sku.ProductSkuService;
import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService;
import cn.iocoder.foodnexus.module.system.controller.admin.vo.AuditCommonReqVO;
......@@ -19,6 +22,7 @@ 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.*;
......@@ -41,8 +45,8 @@ public class ProductSpuController {
@Resource
private ProductSpuService productSpuService;
@Resource
private ProductSkuService productSkuService;
@Autowired
private ProductCategoryService productCategoryService;
@PostMapping("/create")
@Operation(summary = "创建商品 SPU")
......@@ -94,9 +98,9 @@ public class ProductSpuController {
if (spu == null) {
return success(null);
}
// 查询商品 SKU
List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spu.getId());
return success(ProductSpuConvert.INSTANCE.convert(spu, skus));
return success(BeanUtils.toBean(spu, ProductSpuRespVO.class, item -> {
item.setCategoryName(productCategoryService.queryNameById(item.getCategoryId()));
}));
}
@GetMapping("/list-all-simple")
......@@ -114,8 +118,11 @@ public class ProductSpuController {
@Parameter(name = "spuIds", description = "spu 编号列表", required = true, example = "[1,2,3]")
@PreAuthorize("@ss.hasPermission('product:spu:query')")
public CommonResult<List<ProductSpuRespVO>> getSpuList(@RequestParam("spuIds") Collection<Long> spuIds) {
return success(ProductSpuConvert.INSTANCE.convertForSpuDetailRespListVO(
productSpuService.getSpuList(spuIds), productSkuService.getSkuListBySpuId(spuIds)));
List<ProductSpuDO> spuList = productSpuService.getSpuList(spuIds);
Map<Long, String> categoryMap = productCategoryService.getMap(CommonUtil.listConvertSet(spuList, ProductSpuDO::getCategoryId));
return success(BeanUtils.toBean(spuList, ProductSpuRespVO.class, item -> {
MapUtils.findAndThen(categoryMap, item.getCategoryId(), item::setCategoryName);
}));
}
@GetMapping("/page")
......@@ -123,7 +130,10 @@ public class ProductSpuController {
@PreAuthorize("@ss.hasPermission('product:spu:query')")
public CommonResult<PageResult<ProductSpuRespVO>> getSpuPage(@Valid ProductSpuPageReqVO pageVO) {
PageResult<ProductSpuDO> pageResult = productSpuService.getSpuPage(pageVO);
return success(BeanUtils.toBean(pageResult, ProductSpuRespVO.class));
Map<Long, String> categoryMap = productCategoryService.getMap(CommonUtil.listConvertSet(pageResult.getList(), ProductSpuDO::getCategoryId));
return success(BeanUtils.toBean(pageResult, ProductSpuRespVO.class, item -> {
MapUtils.findAndThen(categoryMap, item.getCategoryId(), item::setCategoryName);
}));
}
......
......@@ -37,6 +37,8 @@ public class ProductSpuRespVO {
@ExcelProperty("商品分类编号")
private Long categoryId;
@Schema(description = "分类名称")
private String categoryName;
@Schema(description = "商品封面图", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.png")
@ExcelProperty("商品封面图")
......
......@@ -34,8 +34,8 @@ public interface ProductSpuConvert {
}
default List<ProductSpuRespVO> convertForSpuDetailRespListVO(List<ProductSpuDO> spus, List<ProductSkuDO> skus) {
Map<Long, List<ProductSkuDO>> skuMultiMap = convertMultiMap(skus, ProductSkuDO::getSpuId);
return CollectionUtils.convertList(spus, spu -> convert(spu, skuMultiMap.get(spu.getId())));
// Map<Long, List<ProductSkuDO>> skuMultiMap = convertMultiMap(skus, ProductSkuDO::getSpuId);
return CollectionUtils.convertList(spus, spu -> convert(spu, null));
}
}
......@@ -81,7 +81,7 @@ spring:
redis:
host: 127.0.0.1 # 地址
port: 6379 # 端口
database: 0 # 数据库索引
database: 1 # 数据库索引
password: 123456 # 密码,建议生产环境开启
--- #################### 定时任务相关配置 ####################
......
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