Commit c5b64606 by 杨浩

bug调整

parent 9d633d1d
...@@ -5,7 +5,7 @@ import cn.idev.excel.annotation.ExcelProperty; ...@@ -5,7 +5,7 @@ import cn.idev.excel.annotation.ExcelProperty;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo; import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode; import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
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;
...@@ -120,7 +120,7 @@ public class ErpSaleOrderRespVO { ...@@ -120,7 +120,7 @@ public class ErpSaleOrderRespVO {
private Long addressId; private Long addressId;
@Schema(description = "客户收货地址info") @Schema(description = "客户收货地址info")
@TableField(typeHandler = Fastjson2TypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private CustomerAddressInfo addressInfo; private CustomerAddressInfo addressInfo;
@Data @Data
......
...@@ -3,7 +3,7 @@ package cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.order; ...@@ -3,7 +3,7 @@ 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.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode; import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
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;
...@@ -62,7 +62,7 @@ public class ErpSaleOrderSaveReqVO { ...@@ -62,7 +62,7 @@ public class ErpSaleOrderSaveReqVO {
private Long addressId; private Long addressId;
@Schema(description = "客户收货地址info") @Schema(description = "客户收货地址info")
@TableField(typeHandler = Fastjson2TypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private CustomerAddressInfo addressInfo; private CustomerAddressInfo addressInfo;
@Schema(description = "订单清单列表") @Schema(description = "订单清单列表")
......
...@@ -95,6 +95,6 @@ public class ErpPurchaseOrderItemDO extends BaseDO { ...@@ -95,6 +95,6 @@ public class ErpPurchaseOrderItemDO extends BaseDO {
/** /**
* 客户订单id * 客户订单id
*/ */
private Long customerId; private Long customerOrderId;
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.KeySequence; ...@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField; 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 com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*; import lombok.*;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -155,6 +155,6 @@ public class ErpSaleOrderDO extends BaseDO { ...@@ -155,6 +155,6 @@ public class ErpSaleOrderDO extends BaseDO {
/** /**
* 客户收货地址info * 客户收货地址info
*/ */
@TableField(typeHandler = Fastjson2TypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private CustomerAddressInfo addressInfo; private CustomerAddressInfo addressInfo;
} }
\ No newline at end of file
...@@ -98,7 +98,10 @@ public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService { ...@@ -98,7 +98,10 @@ public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService {
calculateTotalPrice(purchaseOrder, purchaseOrderItems); calculateTotalPrice(purchaseOrder, purchaseOrderItems);
purchaseOrderMapper.insert(purchaseOrder); purchaseOrderMapper.insert(purchaseOrder);
// 2.2 插入订单项 // 2.2 插入订单项
purchaseOrderItems.forEach(o -> o.setOrderId(purchaseOrder.getId())); purchaseOrderItems.forEach(o -> {
o.setOrderId(purchaseOrder.getId());
o.setCustomerOrderId(purchaseOrder.getCustomerOrderId());
});
purchaseOrderItemMapper.insertBatch(purchaseOrderItems); purchaseOrderItemMapper.insertBatch(purchaseOrderItems);
return purchaseOrder.getId(); return purchaseOrder.getId();
} }
......
...@@ -4,7 +4,7 @@ import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo; ...@@ -4,7 +4,7 @@ import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
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.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*; import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam; import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
...@@ -33,7 +33,7 @@ public class CustomerOrderPageReqVO extends PageParam { ...@@ -33,7 +33,7 @@ public class CustomerOrderPageReqVO extends PageParam {
private Long warehouseAreaId; private Long warehouseAreaId;
@Schema(description = "仓库信息") @Schema(description = "仓库信息")
@TableField(typeHandler = Fastjson2TypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private WarehouseInfo warehouseInfo; private WarehouseInfo warehouseInfo;
@Schema(description = "配送模式") @Schema(description = "配送模式")
......
...@@ -2,6 +2,7 @@ package cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo; ...@@ -2,6 +2,7 @@ package cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo;
import cn.iocoder.foodnexus.module.product.api.dto.ProductInfo; import cn.iocoder.foodnexus.module.product.api.dto.ProductInfo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
...@@ -22,7 +23,7 @@ public class AppCustomerOrderItemSaveReqVO { ...@@ -22,7 +23,7 @@ public class AppCustomerOrderItemSaveReqVO {
@Schema(description = "订单商品数量", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "订单商品数量", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "订单商品数量不能为空") @NotNull(message = "订单商品数量不能为空")
@Size(min = 1, message = "订单商品数量不能小于1") @Min(value = 1, message = "订单商品数量不能小于1")
private Integer orderItemQuantity; private Integer orderItemQuantity;
@Schema(description = "商品对应供应商id", hidden = true) @Schema(description = "商品对应供应商id", hidden = true)
......
...@@ -32,8 +32,7 @@ public class AppCustomerOrderSaveReqVO { ...@@ -32,8 +32,7 @@ public class AppCustomerOrderSaveReqVO {
private Long addressId; private Long addressId;
@Schema(description = "配送模式", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "配送模式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "配送模式不能为空") @NotNull(message = "配送模式不能为空")
@InEnum(DeliveryMode.class)
private DeliveryMode deliveryMode; private DeliveryMode deliveryMode;
@Schema(description = "预计配送开始时间") @Schema(description = "预计配送开始时间")
......
package cn.iocoder.foodnexus.module.order.controller.app.customeraddress; package cn.iocoder.foodnexus.module.order.controller.app.customeraddress;
import cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressPageReqVO; 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.CustomerAddressRespVO;
import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressSaveReqVO; import cn.iocoder.foodnexus.module.order.controller.app.customeraddress.vo.CustomerAddressSaveReqVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -39,17 +42,20 @@ public class CustomerAddressController { ...@@ -39,17 +42,20 @@ public class CustomerAddressController {
@Resource @Resource
private CustomerAddressService customerAddressService; private CustomerAddressService customerAddressService;
@Autowired
private ErpCustomerApi customerApi;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建客户 - 我的地址") @Operation(summary = "创建客户 - 我的地址")
@PreAuthorize("@ss.hasPermission('order:customer-address:create')")
public CommonResult<Long> createCustomerAddress(@Valid @RequestBody CustomerAddressSaveReqVO createReqVO) { public CommonResult<Long> createCustomerAddress(@Valid @RequestBody CustomerAddressSaveReqVO createReqVO) {
createReqVO.setCustomerId(customerApi.queryCustomerIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
return success(customerAddressService.createCustomerAddress(createReqVO)); return success(customerAddressService.createCustomerAddress(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新客户 - 我的地址") @Operation(summary = "更新客户 - 我的地址")
@PreAuthorize("@ss.hasPermission('order:customer-address:update')")
public CommonResult<Boolean> updateCustomerAddress(@Valid @RequestBody CustomerAddressSaveReqVO updateReqVO) { public CommonResult<Boolean> updateCustomerAddress(@Valid @RequestBody CustomerAddressSaveReqVO updateReqVO) {
updateReqVO.setCustomerId(customerApi.queryCustomerIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
customerAddressService.updateCustomerAddress(updateReqVO); customerAddressService.updateCustomerAddress(updateReqVO);
return success(true); return success(true);
} }
...@@ -57,7 +63,6 @@ public class CustomerAddressController { ...@@ -57,7 +63,6 @@ public class CustomerAddressController {
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除客户 - 我的地址") @Operation(summary = "删除客户 - 我的地址")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('order:customer-address:delete')")
public CommonResult<Boolean> deleteCustomerAddress(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteCustomerAddress(@RequestParam("id") Long id) {
customerAddressService.deleteCustomerAddress(id); customerAddressService.deleteCustomerAddress(id);
return success(true); return success(true);
...@@ -75,7 +80,6 @@ public class CustomerAddressController { ...@@ -75,7 +80,6 @@ public class CustomerAddressController {
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得客户 - 我的地址") @Operation(summary = "获得客户 - 我的地址")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('order:customer-address:query')")
public CommonResult<CustomerAddressRespVO> getCustomerAddress(@RequestParam("id") Long id) { public CommonResult<CustomerAddressRespVO> getCustomerAddress(@RequestParam("id") Long id) {
CustomerAddressDO customerAddress = customerAddressService.getCustomerAddress(id); CustomerAddressDO customerAddress = customerAddressService.getCustomerAddress(id);
return success(BeanUtils.toBean(customerAddress, CustomerAddressRespVO.class)); return success(BeanUtils.toBean(customerAddress, CustomerAddressRespVO.class));
...@@ -83,8 +87,8 @@ public class CustomerAddressController { ...@@ -83,8 +87,8 @@ public class CustomerAddressController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得客户 - 我的地址分页") @Operation(summary = "获得客户 - 我的地址分页")
@PreAuthorize("@ss.hasPermission('order:customer-address:query')")
public CommonResult<PageResult<CustomerAddressRespVO>> getCustomerAddressPage(@Valid CustomerAddressPageReqVO pageReqVO) { public CommonResult<PageResult<CustomerAddressRespVO>> getCustomerAddressPage(@Valid CustomerAddressPageReqVO pageReqVO) {
pageReqVO.setCustomerId(customerApi.queryCustomerIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
PageResult<CustomerAddressDO> pageResult = customerAddressService.getCustomerAddressPage(pageReqVO); PageResult<CustomerAddressDO> pageResult = customerAddressService.getCustomerAddressPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CustomerAddressRespVO.class)); return success(BeanUtils.toBean(pageResult, CustomerAddressRespVO.class));
} }
......
...@@ -4,7 +4,7 @@ import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo; ...@@ -4,7 +4,7 @@ import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo; 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.JacksonTypeHandler;
import lombok.*; import lombok.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -30,7 +30,7 @@ public class CustomerOrderDO extends BaseDO { ...@@ -30,7 +30,7 @@ public class CustomerOrderDO extends BaseDO {
/** /**
* id * id
*/ */
@TableId @TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id; private Long id;
/** /**
* 订单编号 * 订单编号
...@@ -57,7 +57,7 @@ public class CustomerOrderDO extends BaseDO { ...@@ -57,7 +57,7 @@ public class CustomerOrderDO extends BaseDO {
/** /**
* 仓库信息 * 仓库信息
*/ */
@TableField(typeHandler = Fastjson2TypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private WarehouseInfo warehouseInfo; private WarehouseInfo warehouseInfo;
/** /**
* 客户收货地址id * 客户收货地址id
...@@ -66,7 +66,7 @@ public class CustomerOrderDO extends BaseDO { ...@@ -66,7 +66,7 @@ public class CustomerOrderDO extends BaseDO {
/** /**
* 客户收货地址info * 客户收货地址info
*/ */
@TableField(typeHandler = Fastjson2TypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private CustomerAddressInfo addressInfo; private CustomerAddressInfo addressInfo;
/** /**
* 配送模式 * 配送模式
...@@ -106,7 +106,7 @@ public class CustomerOrderDO extends BaseDO { ...@@ -106,7 +106,7 @@ public class CustomerOrderDO extends BaseDO {
/** /**
* 订单备注 * 订单备注
*/ */
@TableField(typeHandler = Fastjson2TypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private CustomerOrderRemark orderRemark; private CustomerOrderRemark orderRemark;
} }
\ No newline at end of file
package cn.iocoder.foodnexus.module.order.dal.dataobject.customerorderitem; package cn.iocoder.foodnexus.module.order.dal.dataobject.customerorderitem;
import cn.iocoder.foodnexus.module.product.api.dto.ProductInfo; import cn.iocoder.foodnexus.module.product.api.dto.ProductInfo;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -48,7 +48,7 @@ public class CustomerOrderItemDO extends BaseDO { ...@@ -48,7 +48,7 @@ public class CustomerOrderItemDO extends BaseDO {
/** /**
* 商品信息 * 商品信息
*/ */
@TableField(typeHandler = Fastjson2TypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private ProductInfo productInfo; private ProductInfo productInfo;
/** /**
* 商品对应供应商id * 商品对应供应商id
......
...@@ -210,12 +210,13 @@ public class CheckTaskServiceImpl implements CheckTaskService { ...@@ -210,12 +210,13 @@ public class CheckTaskServiceImpl implements CheckTaskService {
throw exception(CHECK_TASK_CREATE_ERROR); throw exception(CHECK_TASK_CREATE_ERROR);
} }
CustomerOrderDO customerOrder = customerOrderService.getCustomerOrder(purchaseOrder.getCustomerOrderId());
checkTask.setNo(genCodeUtils.createAmBatch("LLZJ")); checkTask.setNo(genCodeUtils.createAmBatch("LLZJ"));
checkTask.setStatus(CheckTaskStatus.TO_BE_CHECK.getKey()); checkTask.setStatus(CheckTaskStatus.TO_BE_CHECK.getKey());
checkTask.setSupplierId(checkTask.getSupplierId()); checkTask.setSupplierId(checkTask.getSupplierId());
checkTask.setPurchaseOrderId(purchaseOrder.getId()); checkTask.setPurchaseOrderId(purchaseOrder.getId());
checkTask.setCustomerOrderId(purchaseOrder.getCustomerOrderId()); checkTask.setCustomerOrderId(purchaseOrder.getCustomerOrderId());
checkTask.setCustomerId(purchaseOrderItems.get(0).getCustomerId()); checkTask.setCustomerId(customerOrder.getCustomerId());
checkTask.setArrivalTime(LocalDateTime.now()); checkTask.setArrivalTime(LocalDateTime.now());
Map<Long, ProductSpuDO> spuMap = productSpuService.getSpuMap(CommonUtil.listConvertSet(purchaseOrderItems, Map<Long, ProductSpuDO> spuMap = productSpuService.getSpuMap(CommonUtil.listConvertSet(purchaseOrderItems,
......
package cn.iocoder.foodnexus.module.system.controller.app.province;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.module.system.controller.admin.province.vo.ProvinceRespVO;
import cn.iocoder.foodnexus.module.system.controller.admin.province.vo.ProvinceSaveReqVO;
import cn.iocoder.foodnexus.module.system.service.province.ProvinceService;
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.validation.Valid;
import org.apache.commons.compress.utils.Lists;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static cn.iocoder.foodnexus.framework.common.pojo.CommonResult.success;
@Tag(name = "APP - 地区数据")
@RestController
@RequestMapping("/system/province")
@Validated
public class AppProvinceController {
@Resource
private ProvinceService provinceService;
@GetMapping("/query")
@Operation(summary = "获取省份信息")
@Parameter(name = "parentId", description = "父级id")
@Parameter(name = "type", description = "类型(1-省份 2-市 3-县区 4-街道)")
@Parameter(name = "keyword", description = "查询字段")
public CommonResult<List<ProvinceRespVO>> query(@RequestParam(value = "parentId", required = false) Long parentId,
@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "keyword", required = false) String keyword) {
if (CommonUtil.isEmpty(parentId) && CommonUtil.isEmpty(type) && CommonUtil.isEmpty(keyword)) {
// 防止拉取所有数据
return success(Lists.newArrayList());
}
return success(BeanUtils.toBean(provinceService.queryList(parentId, type, keyword), ProvinceRespVO.class));
}
}
\ No newline at end of file
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