mall + trade:review 运费价格计算

This commit is contained in:
YunaiV 2023-06-03 19:56:23 +08:00
parent 36ce968893
commit 910d374cee
7 changed files with 44 additions and 49 deletions

View File

@ -57,7 +57,7 @@ public class DeliveryExpressTemplateController {
@Operation(summary = "获得快递运费模板") @Operation(summary = "获得快递运费模板")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:query')") @PreAuthorize("@ss.hasPermission('trade:delivery:express-template:query')")
public CommonResult<DeliveryExpressTemplateRespVO> getDeliveryExpressTemplate(@RequestParam("id") Long id) { public CommonResult<DeliveryExpressTemplateDetailRespVO> getDeliveryExpressTemplate(@RequestParam("id") Long id) {
return success(deliveryExpressTemplateService.getDeliveryExpressTemplate(id)); return success(deliveryExpressTemplateService.getDeliveryExpressTemplate(id));
} }
@ -65,7 +65,7 @@ public class DeliveryExpressTemplateController {
@Operation(summary = "获得快递运费模板列表") @Operation(summary = "获得快递运费模板列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:query')") @PreAuthorize("@ss.hasPermission('trade:delivery:express-template:query')")
public CommonResult<List<DeliveryExpressTemplateSimpleRespVO>> getDeliveryExpressTemplateList(@RequestParam("ids") Collection<Long> ids) { public CommonResult<List<DeliveryExpressTemplateRespVO>> getDeliveryExpressTemplateList(@RequestParam("ids") Collection<Long> ids) {
List<DeliveryExpressTemplateDO> list = deliveryExpressTemplateService.getDeliveryExpressTemplateList(ids); List<DeliveryExpressTemplateDO> list = deliveryExpressTemplateService.getDeliveryExpressTemplateList(ids);
return success(DeliveryExpressTemplateConvert.INSTANCE.convertList(list)); return success(DeliveryExpressTemplateConvert.INSTANCE.convertList(list));
} }
@ -73,7 +73,7 @@ public class DeliveryExpressTemplateController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得快递运费模板分页") @Operation(summary = "获得快递运费模板分页")
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:query')") @PreAuthorize("@ss.hasPermission('trade:delivery:express-template:query')")
public CommonResult<PageResult<DeliveryExpressTemplateSimpleRespVO>> getDeliveryExpressTemplatePage(@Valid DeliveryExpressTemplatePageReqVO pageVO) { public CommonResult<PageResult<DeliveryExpressTemplateRespVO>> getDeliveryExpressTemplatePage(@Valid DeliveryExpressTemplatePageReqVO pageVO) {
PageResult<DeliveryExpressTemplateDO> pageResult = deliveryExpressTemplateService.getDeliveryExpressTemplatePage(pageVO); PageResult<DeliveryExpressTemplateDO> pageResult = deliveryExpressTemplateService.getDeliveryExpressTemplatePage(pageVO);
return success(DeliveryExpressTemplateConvert.INSTANCE.convertPage(pageResult)); return success(DeliveryExpressTemplateConvert.INSTANCE.convertPage(pageResult));
} }

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.List;
@Schema(description = "管理后台 - 快递运费模板的详细 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DeliveryExpressTemplateDetailRespVO extends DeliveryExpressTemplateBaseVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "371")
private Long id;
@Schema(description = "运费模板运费设置", requiredMode = Schema.RequiredMode.REQUIRED)
private List<ExpressTemplateChargeBaseVO> templateCharge;
@Schema(description = "运费模板包邮区域", requiredMode = Schema.RequiredMode.REQUIRED)
private List<ExpressTemplateFreeBaseVO> templateFree;
}

View File

@ -1,28 +1,19 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate; package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.*;
import lombok.EqualsAndHashCode; import java.time.LocalDateTime;
import lombok.ToString;
import java.util.List;
/**
* @author jason
*/
@Schema(description = "管理后台 - 快递运费模板 Response VO") @Schema(description = "管理后台 - 快递运费模板 Response VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class DeliveryExpressTemplateRespVO extends DeliveryExpressTemplateBaseVO { public class DeliveryExpressTemplateRespVO extends DeliveryExpressTemplateBaseVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "371") @Schema(description = "编号,自增", required = true, example = "371")
private Long id; private Long id;
@Schema(description = "运费模板运费设置", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "创建时间", required = true)
private List<ExpressTemplateChargeBaseVO> templateCharge; private LocalDateTime createTime;
@Schema(description = "运费模板包邮区域", requiredMode = Schema.RequiredMode.REQUIRED)
private List<ExpressTemplateFreeBaseVO> templateFree;
} }

View File

@ -1,21 +0,0 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
// TODO @jasonsimplae 是不是不用继承 DeliveryExpressTemplateBaseVO直接 id name 属性就够了
// @芋艿 这里给列表显示用的 需要显示计费方式和排序 所以继承 DeliveryExpressTemplateBaseVO 这是去掉了包邮区域和 区域运费列表
@Schema(description = "管理后台 - 快递运费模板 精简 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DeliveryExpressTemplateSimpleRespVO extends DeliveryExpressTemplateBaseVO {
@Schema(description = "编号,自增", required = true, example = "371")
private Long id;
@Schema(description = "创建时间", required = true)
private LocalDateTime createTime;
}

View File

@ -22,18 +22,18 @@ public interface DeliveryExpressTemplateConvert {
DeliveryExpressTemplateDO convert(DeliveryExpressTemplateUpdateReqVO bean); DeliveryExpressTemplateDO convert(DeliveryExpressTemplateUpdateReqVO bean);
DeliveryExpressTemplateSimpleRespVO convert(DeliveryExpressTemplateDO bean); DeliveryExpressTemplateRespVO convert(DeliveryExpressTemplateDO bean);
DeliveryExpressTemplateRespVO convert2(DeliveryExpressTemplateDO bean); DeliveryExpressTemplateDetailRespVO convert2(DeliveryExpressTemplateDO bean);
List<DeliveryExpressTemplateSimpleRespVO> convertList(List<DeliveryExpressTemplateDO> list); List<DeliveryExpressTemplateRespVO> convertList(List<DeliveryExpressTemplateDO> list);
PageResult<DeliveryExpressTemplateSimpleRespVO> convertPage(PageResult<DeliveryExpressTemplateDO> page); PageResult<DeliveryExpressTemplateRespVO> convertPage(PageResult<DeliveryExpressTemplateDO> page);
default DeliveryExpressTemplateRespVO convert(DeliveryExpressTemplateDO bean, default DeliveryExpressTemplateDetailRespVO convert(DeliveryExpressTemplateDO bean,
List<DeliveryExpressTemplateChargeDO> chargeList, List<DeliveryExpressTemplateChargeDO> chargeList,
List<DeliveryExpressTemplateFreeDO> freeList){ List<DeliveryExpressTemplateFreeDO> freeList){
DeliveryExpressTemplateRespVO respVO = convert2(bean); DeliveryExpressTemplateDetailRespVO respVO = convert2(bean);
respVO.setTemplateCharge(convertTemplateChargeList(chargeList)); respVO.setTemplateCharge(convertTemplateChargeList(chargeList));
respVO.setTemplateFree(convertTemplateFreeList(freeList)); respVO.setTemplateFree(convertTemplateFreeList(freeList));
return respVO; return respVO;

View File

@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.trade.service.delivery;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate.DeliveryExpressTemplateCreateReqVO; import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate.DeliveryExpressTemplateCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate.DeliveryExpressTemplateDetailRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate.DeliveryExpressTemplatePageReqVO; import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate.DeliveryExpressTemplatePageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate.DeliveryExpressTemplateRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate.DeliveryExpressTemplateUpdateReqVO; import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate.DeliveryExpressTemplateUpdateReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateDO; import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateDO;
@ -46,7 +46,7 @@ public interface DeliveryExpressTemplateService {
* @param id 编号 * @param id 编号
* @return 快递运费模板详情 * @return 快递运费模板详情
*/ */
DeliveryExpressTemplateRespVO getDeliveryExpressTemplate(Long id); DeliveryExpressTemplateDetailRespVO getDeliveryExpressTemplate(Long id);
/** /**
* 获得快递运费模板列表 * 获得快递运费模板列表

View File

@ -185,7 +185,7 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla
} }
@Override @Override
public DeliveryExpressTemplateRespVO getDeliveryExpressTemplate(Long id) { public DeliveryExpressTemplateDetailRespVO getDeliveryExpressTemplate(Long id) {
List<DeliveryExpressTemplateChargeDO> chargeList = expressTemplateChargeMapper.selectListByTemplateId(id); List<DeliveryExpressTemplateChargeDO> chargeList = expressTemplateChargeMapper.selectListByTemplateId(id);
List<DeliveryExpressTemplateFreeDO> freeList = expressTemplateFreeMapper.selectListByTemplateId(id); List<DeliveryExpressTemplateFreeDO> freeList = expressTemplateFreeMapper.selectListByTemplateId(id);
DeliveryExpressTemplateDO template = expressTemplateMapper.selectById(id); DeliveryExpressTemplateDO template = expressTemplateMapper.selectById(id);