From fc0128242f812e476470dc9bada901d36ae09daf Mon Sep 17 00:00:00 2001 From: zepengdev <lzpsmith@outlook.com> Date: Thu, 31 Jul 2025 16:37:52 +0800 Subject: [PATCH] feat: 1、增加店铺包装费用 2、修复营业时间显示问题和修改异常问题 --- oying-system/src/main/java/com/oying/modules/pc/store/domain/Store.java | 18 ++++++--- oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreFieldUpdateRequest.java | 3 + oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreUpdateRequest.java | 6 +++ oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCreateRequest.java | 4 ++ oying-system/src/main/java/com/oying/modules/pc/store/view/StoreMerchantView.java | 12 ++++++ oying-system/src/main/java/com/oying/modules/pc/store/view/CustomerStoreView.java | 30 +++++++++++++-- oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml | 5 +- oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCustomerDetailDto.java | 3 + oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreMerchantController.java | 6 +- oying-system/src/main/java/com/oying/modules/pc/store/view/StoreSimpleView.java | 3 + oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java | 12 ++++-- 11 files changed, 83 insertions(+), 19 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/domain/Store.java b/oying-system/src/main/java/com/oying/modules/pc/store/domain/Store.java index 5ba2fd9..833fe2a 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/domain/Store.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/domain/Store.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import com.oying.base.BaseEntity; import com.oying.modules.pc.product.domain.Product; import io.swagger.annotations.ApiModelProperty; @@ -78,19 +79,15 @@ @ApiModelProperty(value = "店铺标签,逗号分隔") private String tags; - @ApiModelProperty(value = "配送费用") - private BigDecimal deliveryFee; - - @ApiModelProperty(value = "起送金额") - private BigDecimal deliveryMinimum; - @ApiModelProperty(value = "联系电话") private String contactPhone; @ApiModelProperty(value = "营业开始时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime openTime; @ApiModelProperty(value = "营业结束时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime closeTime; @ApiModelProperty(value = "营业状态") @@ -139,6 +136,15 @@ @ApiModelProperty(value = "评分") private Double score = 0d; + @ApiModelProperty(value = "包装费用") + private BigDecimal packagingFee; + + @ApiModelProperty(value = "配送费用") + private BigDecimal deliveryFee; + + @ApiModelProperty(value = "起送金额") + private BigDecimal deliveryMinimum; + @TableField(exist = false) @ApiModelProperty(value = "配送距离") private Integer deliveryDuration = 0; diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCreateRequest.java b/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCreateRequest.java index 011205f..05c2404 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCreateRequest.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCreateRequest.java @@ -7,6 +7,7 @@ import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import java.math.BigDecimal; import java.time.LocalTime; import java.util.ArrayList; import java.util.List; @@ -67,6 +68,9 @@ @ApiModelProperty(value = "是否支持自提") private Integer selfPickup; + @ApiModelProperty(value = "包装费用") + private BigDecimal packagingFee; + @ApiModelProperty(value = "店铺资质", example = "[]") private List<StoreQualificationCreateRequest> qualificationList = new ArrayList<>(); diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCustomerDetailDto.java b/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCustomerDetailDto.java index 7dc881f..c693101 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCustomerDetailDto.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreCustomerDetailDto.java @@ -1,5 +1,6 @@ package com.oying.modules.pc.store.domain.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -39,9 +40,11 @@ private String contactPhone; @ApiModelProperty(value = "营业开始时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime openTime; @ApiModelProperty(value = "营业结束时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime closeTime; private String businessHours; diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreFieldUpdateRequest.java b/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreFieldUpdateRequest.java index 0bc09b2..faba857 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreFieldUpdateRequest.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreFieldUpdateRequest.java @@ -1,5 +1,6 @@ package com.oying.modules.pc.store.domain.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -73,9 +74,11 @@ public interface UpdateStoreBusinessHoursGroup{} @NotNull(groups = UpdateStoreBusinessHoursGroup.class) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime openTime; @NotNull(groups = UpdateStoreBusinessHoursGroup.class) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime closeTime; public interface UpdateStoreAddressGroup{} diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreUpdateRequest.java b/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreUpdateRequest.java index 9ea552d..bf35cd7 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreUpdateRequest.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreUpdateRequest.java @@ -1,5 +1,6 @@ package com.oying.modules.pc.store.domain.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import com.oying.modules.pc.product.domain.Product; import com.oying.modules.pc.store.domain.StoreQualification; import io.swagger.annotations.ApiModelProperty; @@ -61,13 +62,18 @@ @ApiModelProperty(value = "起送金额") private BigDecimal deliveryMinimum; + @ApiModelProperty(value = "包装费用") + private BigDecimal packagingFee; + @ApiModelProperty(value = "联系电话") private String contactPhone; @ApiModelProperty(value = "营业开始时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime openTime; @ApiModelProperty(value = "营业结束时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime closeTime; @ApiModelProperty(value = "详细地址") diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java b/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java index bfcf1c1..8e0c22d 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java @@ -1,5 +1,7 @@ package com.oying.modules.pc.store.rest; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.util.ObjUtil; import com.oying.modules.pc.product.domain.Product; import com.oying.modules.pc.product.domain.dto.ProductQueryCriteria; @@ -18,7 +20,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.springframework.beans.BeanUtils; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -59,7 +60,7 @@ public ResponseEntity<?> getStoreById(@PathVariable("storeId") Long storeId) { Store store = storeService.getById(storeId); CustomerStoreView view = new CustomerStoreView(); - BeanUtils.copyProperties(store, view); + BeanUtil.copyProperties(store, view, CopyOptions.create().setIgnoreNullValue(true)); view.setBusinessHours(BusinessHoursUtils.formatBusinessHours(store.getOpenTime(), store.getCloseTime())); return ResponseEntity.ok(R.success(view)); } @@ -68,10 +69,13 @@ @ApiOperation("查询店铺") public ResponseEntity<?> getStoreDetailsById(@PathVariable("storeId") Long storeId) { Store store = storeService.getById(storeId); + CustomerStoreView view = new CustomerStoreView(); + BeanUtil.copyProperties(store, view, CopyOptions.create().setIgnoreNullValue(true)); + view.setBusinessHours(BusinessHoursUtils.formatBusinessHours(store.getOpenTime(), store.getCloseTime())); if (ObjUtil.isNotEmpty(store)) { - store.setQualifications(storeQualificationService.getByStoreId(storeId)); + view.setQualifications(storeQualificationService.getByStoreId(storeId)); } - return ResponseEntity.ok(R.success(store)); + return ResponseEntity.ok(R.success(view)); } private List<Product> getProductsByStoreId(Long storeId) { diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreMerchantController.java b/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreMerchantController.java index 4f5f2f0..306160f 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreMerchantController.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreMerchantController.java @@ -73,9 +73,9 @@ //@PreAuthorize("@el.check('merchant:store:getById')") public ResponseEntity<?> getStoreById(@PathVariable Long storeId) { Store store = storeService.getById(storeId); - StoreMerchantView view = new StoreMerchantView(); - BeanUtils.copyProperties(store, view); - return ResponseEntity.ok(R.success(view)); + /*StoreMerchantView view = new StoreMerchantView(); + BeanUtils.copyProperties(store, view);*/ + return ResponseEntity.ok(R.success(store)); } @GetMapping(value = "/{storeId}/details") diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/view/CustomerStoreView.java b/oying-system/src/main/java/com/oying/modules/pc/store/view/CustomerStoreView.java index b43552e..d3f2474 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/view/CustomerStoreView.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/view/CustomerStoreView.java @@ -1,12 +1,13 @@ package com.oying.modules.pc.store.view; -import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.oying.modules.pc.store.domain.StoreQualification; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.Getter; -import lombok.Setter; +import java.math.BigDecimal; import java.time.LocalTime; +import java.util.List; @Data public class CustomerStoreView { @@ -41,13 +42,22 @@ @ApiModelProperty(value = "联系电话") private String contactPhone; + @ApiModelProperty(value = "营业时间") + private String businessHours; + @ApiModelProperty(value = "营业开始时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime openTime; @ApiModelProperty(value = "营业结束时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime closeTime; - private String businessHours; + @ApiModelProperty(value = "营业状态") + private Integer businessStatus; + + @ApiModelProperty(value = "市级代码") + private String cityCode; @ApiModelProperty(value = "详细地址") private String address; @@ -70,6 +80,15 @@ @ApiModelProperty(value = "评分") private Double score = 0d; + @ApiModelProperty(value = "包装费用") + private BigDecimal packagingFee; + + @ApiModelProperty(value = "配送费用") + private BigDecimal deliveryFee; + + @ApiModelProperty(value = "起送金额") + private BigDecimal deliveryMinimum; + @ApiModelProperty(value = "配送距离") private Integer deliveryDuration = 0; @@ -82,4 +101,7 @@ @ApiModelProperty(value = "月销售量") private Integer monthlyUnitsSold = 0; + @ApiModelProperty(value = "资质") + private List<StoreQualification> qualifications; + } diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/view/StoreMerchantView.java b/oying-system/src/main/java/com/oying/modules/pc/store/view/StoreMerchantView.java index cb84e75..1c8b870 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/view/StoreMerchantView.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/view/StoreMerchantView.java @@ -1,9 +1,13 @@ package com.oying.modules.pc.store.view; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.oying.modules.pc.store.domain.StoreQualification; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.math.BigDecimal; import java.time.LocalTime; +import java.util.List; @Data public class StoreMerchantView { @@ -35,13 +39,18 @@ @ApiModelProperty(value = "店铺描述") private String description; + @ApiModelProperty(value = "包装费用") + private BigDecimal packagingFee; + @ApiModelProperty(value = "联系电话") private String contactPhone; @ApiModelProperty(value = "营业开始时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime openTime; @ApiModelProperty(value = "营业结束时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime closeTime; @ApiModelProperty(value = "详细地址") @@ -65,4 +74,7 @@ @ApiModelProperty(value = "版本号") private Long version; + @ApiModelProperty(value = "资质") + private List<StoreQualification> qualifications; + } diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/view/StoreSimpleView.java b/oying-system/src/main/java/com/oying/modules/pc/store/view/StoreSimpleView.java index 8f8c764..6652206 100644 --- a/oying-system/src/main/java/com/oying/modules/pc/store/view/StoreSimpleView.java +++ b/oying-system/src/main/java/com/oying/modules/pc/store/view/StoreSimpleView.java @@ -1,5 +1,6 @@ package com.oying.modules.pc.store.view; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -52,9 +53,11 @@ private String contactPhone; @ApiModelProperty(value = "营业开始时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime openTime; @ApiModelProperty(value = "营业结束时间") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") private LocalTime closeTime; @ApiModelProperty(value = "市级代码") diff --git a/oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml b/oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml index a70ccfa..8182980 100644 --- a/oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml +++ b/oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml @@ -23,6 +23,7 @@ <result property="tags" column="tags"/> <result property="deliveryFee" column="delivery_fee"/> <result property="deliveryMinimum" column="delivery_minimum"/> + <result property="packagingFee" column="packaging_fee"/> <result property="contactPhone" column="contact_phone"/> <result property="openTime" column="open_time"/> <result property="closeTime" column="close_time"/> @@ -43,14 +44,14 @@ <sql id="store_column_list"> store_id, merchant_id, platform_category_id, store_type, store_code, store_name, business_scope, status, business_status, audit_status, logo_image_id, logo_image_url, - cover_image_id, cover_image_url, description, tags, delivery_fee, delivery_minimum, contact_phone, open_time, close_time, + cover_image_id, cover_image_url, description, tags, delivery_fee, delivery_minimum, packaging_fee, contact_phone, open_time, close_time, address, longitude, latitude, geo_hash, geo_point, coordinate_system, radius, returns, self_pickup, create_by, create_time, update_by, update_time, version </sql> <sql id="selectStoreVo"> select store_id, merchant_id, platform_category_id, store_type, store_code, store_name, business_scope, status, business_status, audit_status, logo_image_id, logo_image_url, - cover_image_id, cover_image_url, description, tags, delivery_fee, delivery_minimum, contact_phone, open_time, close_time, + cover_image_id, cover_image_url, description, tags, delivery_fee, delivery_minimum, packaging_fee, contact_phone, open_time, close_time, address, longitude, latitude, geo_hash, geo_point, coordinate_system, radius, returns, self_pickup, create_by, create_time, update_by, update_time, version from pc_store </sql> -- Gitblit v1.9.3