review 修改

This commit is contained in:
jason 2023-05-30 21:17:51 +08:00
parent 6bdc31a315
commit f8db53896f
12 changed files with 40 additions and 72 deletions

View File

@ -50,6 +50,7 @@ public interface ErrorCodeConstants {
ErrorCode EXPRESS_CODE_DUPLICATE = new ErrorCode(1011003001, "已经存在该编码的快递公司");
ErrorCode EXPRESS_TEMPLATE_NOT_EXISTS = new ErrorCode(1011003002, "运费模板不存在");
ErrorCode EXPRESS_TEMPLATE_NAME_DUPLICATE = new ErrorCode(1011003002, "已经存在该运费模板名");
ErrorCode PICK_UP_STORE_NOT_EXISTS = new ErrorCode(1011003003, "自提门店不存在");
// ========== Price 相关 1011004000 ============
ErrorCode PRICE_CALCULATE_PAY_PRICE_ILLEGAL = new ErrorCode(1011004000, "支付价格计算异常,原因:价格小于等于 0");

View File

@ -75,7 +75,6 @@ public class DeliveryExpressController {
return success(DeliveryExpressConvert.INSTANCE.convertPage(pageResult));
}
// TODO @jason运费模版@芋艿 你的意思是运费模板导出没有必要吧已经去掉了这个是快递公司导出
@GetMapping("/export-excel")
@Operation(summary = "导出快递公司 Excel")
@PreAuthorize("@ss.hasPermission('trade:delivery:express:export')")
@ -87,5 +86,4 @@ public class DeliveryExpressController {
List<DeliveryExpressExcelVO> dataList = DeliveryExpressConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "快递公司.xls", "数据", DeliveryExpressExcelVO.class, dataList);
}
}

View File

@ -20,7 +20,6 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 快递运费模板")
@RestController
@RequestMapping("/trade/delivery/express-template")

View File

@ -27,8 +27,8 @@ public class DeliveryExpressBaseVO {
@NotNull(message = "排序不能为空")
private Integer sort;
@Schema(description = "状态0正常 1停用", required = true, example = "1")
@NotNull(message = "状态0正常 1停用不能为空")
@Schema(description = "状态", required = true, example = "1")
@NotNull(message = "状态不能为空")
private Integer status;
}

View File

@ -15,14 +15,12 @@ import java.util.List;
@ToString(callSuper = true)
public class DeliveryExpressTemplateCreateReqVO extends DeliveryExpressTemplateBaseVO {
// TODO @jason不用给默认值哈
@Schema(description = "区域运费列表")
@Valid
private List<ExpressTemplateChargeBaseVO> templateCharge = Collections.emptyList();
private List<ExpressTemplateChargeBaseVO> templateCharge;
@Schema(description = "包邮区域列表")
@Valid
private List<ExpressTemplateFreeBaseVO> templateFree = Collections.emptyList();
private List<ExpressTemplateFreeBaseVO> templateFree;
}

View File

@ -5,6 +5,7 @@ import lombok.*;
import java.time.LocalDateTime;
// TODO @jasonsimplae 是不是不用继承 DeliveryExpressTemplateBaseVO直接 id name 属性就够了
// @芋艿 这里给列表显示用的 需要显示计费方式和排序 所以继承 DeliveryExpressTemplateBaseVO 这是去掉了包邮区域和 区域运费列表
@Schema(description = "管理后台 - 快递运费模板 精简 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)

View File

@ -7,7 +7,6 @@ import lombok.ToString;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.List;
@Schema(description = "管理后台 - 快递运费模板更新 Request VO")
@ -20,14 +19,38 @@ public class DeliveryExpressTemplateUpdateReqVO extends DeliveryExpressTemplateB
@NotNull(message = "编号不能为空")
private Long id;
// TODO @jasonpojo 不给默认值哈
@Schema(description = "区域运费列表")
@Valid
private List<ExpressTemplateChargeUpdateVO> templateCharge = Collections.emptyList();
private List<ExpressTemplateChargeUpdateVO> templateCharge;
@Schema(description = "包邮区域列表")
@Valid
private List<ExpressTemplateFreeUpdateVO> templateFree = Collections.emptyList();
private List<ExpressTemplateFreeUpdateVO> templateFree;
@Schema(description = "管理后台 - 快递运费模板区域运费更新 Request VO")
@Data
public static class ExpressTemplateChargeUpdateVO extends ExpressTemplateChargeBaseVO {
@Schema(description = "编号", example = "6592")
private Long id;
// TODO @jason这几个字段应该不通过前端传递而是后端查询后去赋值的
@Schema(description = "配送模板编号", example = "1")
private Long templateId;
@Schema(description = "配送计费方式", example = "1")
private Integer chargeMode;
}
@Schema(description = "管理后台 - 快递运费模板包邮区域更新 Request VO")
@Data
public static class ExpressTemplateFreeUpdateVO extends ExpressTemplateFreeBaseVO {
@Schema(description = "编号", example = "6592")
private Long id;
@Schema(description = "配送模板编号", example = "1")
private Long templateId;
}
}

View File

@ -1,22 +0,0 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
// TODO @jason这个 vo 可以内嵌到 DeliveryExpressTemplateUpdateReqVO避免 vo 过多不好分辨
@Schema(description = "管理后台 - 快递公司创建 Request VO")
@Data
public class ExpressTemplateChargeUpdateVO extends ExpressTemplateChargeBaseVO {
@Schema(description = "编号", example = "6592")
private Long id;
// TODO @jason这几个字段应该不通过前端传递而是后端查询后去赋值的
@Schema(description = "配送模板编号", example = "1")
private Long templateId;
@Schema(description = "配送计费方式", example = "1")
private Integer chargeMode;
}

View File

@ -1,19 +0,0 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
// TODO @jason这个 vo 可以内嵌到 DeliveryExpressTemplateUpdateReqVO避免 vo 过多不好分辨
// TODO @jasonswagger 缺失
/**
* 快递运费模板包邮 更新 VO
*/
@Data
public class ExpressTemplateFreeUpdateVO extends ExpressTemplateFreeBaseVO {
@Schema(description = "编号", example = "6592")
private Long id;
@Schema(description = "配送模板编号", example = "1")
private Long templateId;
}

View File

@ -12,12 +12,6 @@ import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 快递公司 Convert
*
* @author jason
*/
@Mapper
public interface DeliveryExpressConvert {

View File

@ -11,11 +11,6 @@ import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 快递运费模板 Convert
*
* @author jason
*/
@Mapper
public interface DeliveryExpressTemplateConvert {
@ -48,7 +43,7 @@ public interface DeliveryExpressTemplateConvert {
DeliveryExpressTemplateChargeDO convertTemplateCharge(Long templateId, Integer chargeMode, ExpressTemplateChargeBaseVO vo);
DeliveryExpressTemplateChargeDO convertTemplateCharge(ExpressTemplateChargeUpdateVO vo);
DeliveryExpressTemplateChargeDO convertTemplateCharge(DeliveryExpressTemplateUpdateReqVO.ExpressTemplateChargeUpdateVO vo);
default List<DeliveryExpressTemplateChargeDO> convertTemplateChargeList(Long templateId, Integer chargeMode, List<ExpressTemplateChargeBaseVO> list) {
return CollectionUtils.convertList(list, vo -> convertTemplateCharge(templateId, chargeMode, vo));
@ -58,7 +53,7 @@ public interface DeliveryExpressTemplateConvert {
DeliveryExpressTemplateFreeDO convertTemplateFree(Long templateId, ExpressTemplateFreeBaseVO vo);
DeliveryExpressTemplateFreeDO convertTemplateFree(ExpressTemplateFreeUpdateVO vo);
DeliveryExpressTemplateFreeDO convertTemplateFree(DeliveryExpressTemplateUpdateReqVO.ExpressTemplateFreeUpdateVO vo);
List<ExpressTemplateChargeBaseVO> convertTemplateChargeList(List<DeliveryExpressTemplateChargeDO> list);

View File

@ -82,10 +82,10 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla
private void updateExpressTemplateFree(DeliveryExpressTemplateUpdateReqVO updateReqVO) {
// 1.1 获得新增/修改的区域列表
List<DeliveryExpressTemplateFreeDO> oldFreeList = expressTemplateFreeMapper.selectListByTemplateId(updateReqVO.getId());
List<ExpressTemplateFreeUpdateVO> newFreeList = updateReqVO.getTemplateFree();
List<DeliveryExpressTemplateUpdateReqVO.ExpressTemplateFreeUpdateVO> newFreeList = updateReqVO.getTemplateFree();
List<DeliveryExpressTemplateFreeDO> addFreeList = new ArrayList<>(newFreeList.size()); // 新增包邮区域列表
List<DeliveryExpressTemplateFreeDO> updateFreeList = new ArrayList<>(newFreeList.size()); // 更新包邮区域列表
for (ExpressTemplateFreeUpdateVO item : newFreeList) {
for (DeliveryExpressTemplateUpdateReqVO.ExpressTemplateFreeUpdateVO item : newFreeList) {
if (Objects.nonNull(item.getId())) {
updateFreeList.add(INSTANCE.convertTemplateFree(item));
} else {
@ -113,10 +113,10 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla
private void updateExpressTemplateCharge(DeliveryExpressTemplateUpdateReqVO updateReqVO) {
// 1.1 获得新增/修改的区域列表
List<DeliveryExpressTemplateChargeDO> oldChargeList = expressTemplateChargeMapper.selectListByTemplateId(updateReqVO.getId());
List<ExpressTemplateChargeUpdateVO> newChargeList = updateReqVO.getTemplateCharge();
List<DeliveryExpressTemplateUpdateReqVO.ExpressTemplateChargeUpdateVO> newChargeList = updateReqVO.getTemplateCharge();
List<DeliveryExpressTemplateChargeDO> addList = new ArrayList<>(newChargeList.size()); // 新增运费区域列表
List<DeliveryExpressTemplateChargeDO> updateList = new ArrayList<>(newChargeList.size()); // 更新运费区域列表
for (ExpressTemplateChargeUpdateVO item : newChargeList) {
for (DeliveryExpressTemplateUpdateReqVO.ExpressTemplateChargeUpdateVO item : newChargeList) {
if (item.getId() != null) {
// 计费模式以主表为准
item.setChargeMode(updateReqVO.getChargeMode());