Commit 23efe54f by 林永健

refactor(strategy): 重构营销活动相关接口的数据传输方式

- 将多个控制器中的数据传输对象转换为RpcPagination包装类型
- 添加productType字段支持商品和套餐类型的区分查询
- 优化数据库查询方法,统一使用DTO映射和分页参数
- 移除过时的日期格式化工具类方法,改用hutool工具包
- 增强商品/套餐变动检测逻辑并添加相应的日志记录
- 统一错误处理和参数验证机制,提升代码健壮性
- 优化MyBatis映射配置,增加DTO结果映射支持
1 parent fc723696
Showing 28 changed files with 194 additions and 120 deletions
...@@ -15,19 +15,11 @@ import java.util.List; ...@@ -15,19 +15,11 @@ import java.util.List;
* @since 2026/06/16 * @since 2026/06/16
*/ */
@Data @Data
@ApiModel(value = "上架商品分页查询请求") @ApiModel(value = "上架商品查询请求")
public class GoodsPageReqDTO implements Serializable { public class GoodsPageReqDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 页码 */
@ApiModelProperty(notes = "页码,默认1")
private Integer pageNum;
/** 每页条数 */
@ApiModelProperty(notes = "每页条数,默认10")
private Integer pageSize;
/** 适用门店号列表 */ /** 适用门店号列表 */
@ApiModelProperty(notes = "适用门店号列表", required = true) @ApiModelProperty(notes = "适用门店号列表", required = true)
private List<Integer> merchantIds; private List<Integer> merchantIds;
......
...@@ -20,6 +20,10 @@ public class GoodsTypeInfoDTO implements Serializable { ...@@ -20,6 +20,10 @@ public class GoodsTypeInfoDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 商品别名 */
@ApiModelProperty(notes = "商品别名")
private String goodsAlias;
/** 商品类型 */ /** 商品类型 */
@ApiModelProperty(notes = "商品类型") @ApiModelProperty(notes = "商品类型")
private Integer goodsType; private Integer goodsType;
......
package cn.com.glsx.dj.strategy.dto; package cn.com.glsx.dj.strategy.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -24,13 +27,25 @@ public class MarketingActivityCreateReqDTO implements Serializable { ...@@ -24,13 +27,25 @@ public class MarketingActivityCreateReqDTO implements Serializable {
@ApiModelProperty(notes = "活动名称,最多30字", required = true) @ApiModelProperty(notes = "活动名称,最多30字", required = true)
private String activityName; private String activityName;
/** 活动开始时间(yyyy-MM-dd HH:00) */ /** 操作人ID(透传,用于记录createdBy) */
@ApiModelProperty(notes = "活动开始时间(yyyy-MM-dd HH:00)", required = true) @ApiModelProperty(notes = "操作人ID")
private String startTime; private String operatorId;
/** 活动结束时间(yyyy-MM-dd HH:00) */ /** 操作人姓名(透传,用于记录createdBy) */
@ApiModelProperty(notes = "活动结束时间(yyyy-MM-dd HH:00)", required = true) @ApiModelProperty(notes = "操作人姓名")
private String endTime; private String operatorName;
/** 活动开始时间 */
@ApiModelProperty(notes = "活动开始时间", required = true)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
/** 活动结束时间 */
@ApiModelProperty(notes = "活动结束时间", required = true)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
/** 活动标签名称快照 */ /** 活动标签名称快照 */
@ApiModelProperty(notes = "活动标签名称", required = true) @ApiModelProperty(notes = "活动标签名称", required = true)
......
package cn.com.glsx.dj.strategy.dto; package cn.com.glsx.dj.strategy.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 活动详情响应DTO * 活动详情响应DTO
...@@ -29,11 +31,13 @@ public class MarketingActivityDetailRespDTO implements Serializable { ...@@ -29,11 +31,13 @@ public class MarketingActivityDetailRespDTO implements Serializable {
/** 活动开始时间 */ /** 活动开始时间 */
@ApiModelProperty(notes = "活动开始时间") @ApiModelProperty(notes = "活动开始时间")
private String startTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
/** 活动结束时间 */ /** 活动结束时间 */
@ApiModelProperty(notes = "活动结束时间") @ApiModelProperty(notes = "活动结束时间")
private String endTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
/** 活动标签 */ /** 活动标签 */
@ApiModelProperty(notes = "活动标签") @ApiModelProperty(notes = "活动标签")
......
package cn.com.glsx.dj.strategy.dto; package cn.com.glsx.dj.strategy.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 活动延期请求DTO * 活动延期请求DTO
...@@ -24,6 +27,8 @@ public class MarketingActivityExtendReqDTO implements Serializable { ...@@ -24,6 +27,8 @@ public class MarketingActivityExtendReqDTO implements Serializable {
private Integer activityId; private Integer activityId;
/** 新的结束时间 */ /** 新的结束时间 */
@ApiModelProperty(notes = "新的结束时间(yyyy-MM-dd HH:mm)", required = true) @ApiModelProperty(notes = "新的结束时间", required = true)
private String newEndTime; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date newEndTime;
} }
...@@ -10,19 +10,11 @@ import java.io.Serializable; ...@@ -10,19 +10,11 @@ import java.io.Serializable;
* 活动操作日志分页查询请求DTO * 活动操作日志分页查询请求DTO
*/ */
@Data @Data
@ApiModel(value = "活动操作日志分页查询请求") @ApiModel(value = "活动操作日志查询请求")
public class MarketingActivityLogPageReqDTO implements Serializable { public class MarketingActivityLogPageReqDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 活动ID */ /** 活动ID */
@ApiModelProperty(notes = "活动ID", required = true) @ApiModelProperty(notes = "活动ID", required = true)
private Integer activityId; private Integer activityId;
/** 页码 */
@ApiModelProperty(notes = "页码,默认1")
private Integer pageNum;
/** 每页条数 */
@ApiModelProperty(notes = "每页条数,默认10")
private Integer pageSize;
} }
package cn.com.glsx.dj.strategy.dto; package cn.com.glsx.dj.strategy.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 活动分页查询请求DTO * 活动分页查询请求DTO
...@@ -19,14 +22,6 @@ public class MarketingActivityPageReqDTO implements Serializable { ...@@ -19,14 +22,6 @@ public class MarketingActivityPageReqDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 页码 */
@ApiModelProperty(notes = "页码,默认1")
private Integer pageNum;
/** 每页条数 */
@ApiModelProperty(notes = "每页条数,默认10")
private Integer pageSize;
/** 活动名称(模糊) */ /** 活动名称(模糊) */
@ApiModelProperty(notes = "活动名称(模糊查询)") @ApiModelProperty(notes = "活动名称(模糊查询)")
private String activityName; private String activityName;
...@@ -41,9 +36,13 @@ public class MarketingActivityPageReqDTO implements Serializable { ...@@ -41,9 +36,13 @@ public class MarketingActivityPageReqDTO implements Serializable {
/** 活动时间范围-起始 */ /** 活动时间范围-起始 */
@ApiModelProperty(notes = "活动时间范围-起始") @ApiModelProperty(notes = "活动时间范围-起始")
private String startTime; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
/** 活动时间范围-结束 */ /** 活动时间范围-结束 */
@ApiModelProperty(notes = "活动时间范围-结束") @ApiModelProperty(notes = "活动时间范围-结束")
private String endTime; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
} }
...@@ -24,6 +24,9 @@ public class MarketingActivityProductItemRespDTO implements Serializable { ...@@ -24,6 +24,9 @@ public class MarketingActivityProductItemRespDTO implements Serializable {
@ApiModelProperty(notes = "子商品ID") @ApiModelProperty(notes = "子商品ID")
private Integer itemId; private Integer itemId;
@ApiModelProperty(notes = "关联套餐记录ID")
private Integer activityProductId;
/** 子商品编码 */ /** 子商品编码 */
@ApiModelProperty(notes = "子商品编码") @ApiModelProperty(notes = "子商品编码")
private String goodsCode; private String goodsCode;
......
...@@ -10,7 +10,7 @@ import java.io.Serializable; ...@@ -10,7 +10,7 @@ import java.io.Serializable;
* 活动商品/套餐分页查询请求DTO * 活动商品/套餐分页查询请求DTO
*/ */
@Data @Data
@ApiModel(value = "活动商品/套餐分页查询请求") @ApiModel(value = "活动商品/套餐查询请求")
public class MarketingActivityProductPageReqDTO implements Serializable { public class MarketingActivityProductPageReqDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -22,11 +22,7 @@ public class MarketingActivityProductPageReqDTO implements Serializable { ...@@ -22,11 +22,7 @@ public class MarketingActivityProductPageReqDTO implements Serializable {
@ApiModelProperty(notes = "车系ID,不分车系传-1") @ApiModelProperty(notes = "车系ID,不分车系传-1")
private Integer carSeriesId; private Integer carSeriesId;
/** 页码 */ /** 类型: 0-套餐 1-商品 */
@ApiModelProperty(notes = "页码,默认1") @ApiModelProperty(notes = "类型: 0-套餐 1-商品")
private Integer pageNum; private Integer productType;
/** 每页条数 */
@ApiModelProperty(notes = "每页条数,默认10")
private Integer pageSize;
} }
...@@ -29,6 +29,9 @@ public class MarketingActivityProductReqDTO implements Serializable { ...@@ -29,6 +29,9 @@ public class MarketingActivityProductReqDTO implements Serializable {
@ApiModelProperty(notes = "类型: 0-套餐 1-商品", required = true) @ApiModelProperty(notes = "类型: 0-套餐 1-商品", required = true)
private Integer productType; private Integer productType;
@ApiModelProperty(notes = "商品|套餐名称")
private String productName;
/** 上架商品编码 */ /** 上架商品编码 */
@ApiModelProperty(notes = "上架商品编码(productType=GOODS时必填)") @ApiModelProperty(notes = "上架商品编码(productType=GOODS时必填)")
private String goodsCode; private String goodsCode;
......
...@@ -10,19 +10,11 @@ import java.io.Serializable; ...@@ -10,19 +10,11 @@ import java.io.Serializable;
* 活动门店分页查询请求DTO * 活动门店分页查询请求DTO
*/ */
@Data @Data
@ApiModel(value = "活动门店分页查询请求") @ApiModel(value = "活动门店查询请求")
public class MarketingActivityStoreReqDTO implements Serializable { public class MarketingActivityStoreReqDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 活动ID */ /** 活动ID */
@ApiModelProperty(notes = "活动ID", required = true) @ApiModelProperty(notes = "活动ID", required = true)
private Integer activityId; private Integer activityId;
/** 页码 */
@ApiModelProperty(notes = "页码,默认1")
private Integer pageNum;
/** 每页条数 */
@ApiModelProperty(notes = "每页条数,默认10")
private Integer pageSize;
} }
package cn.com.glsx.dj.strategy.dto; package cn.com.glsx.dj.strategy.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -28,13 +31,25 @@ public class MarketingActivityUpdateReqDTO implements Serializable { ...@@ -28,13 +31,25 @@ public class MarketingActivityUpdateReqDTO implements Serializable {
@ApiModelProperty(notes = "活动名称", required = true) @ApiModelProperty(notes = "活动名称", required = true)
private String activityName; private String activityName;
/** 操作人ID(透传,用于记录updatedBy) */
@ApiModelProperty(notes = "操作人ID")
private String operatorId;
/** 操作人姓名(透传,用于记录updatedBy) */
@ApiModelProperty(notes = "操作人姓名")
private String operatorName;
/** 活动开始时间 */ /** 活动开始时间 */
@ApiModelProperty(notes = "活动开始时间", required = true) @ApiModelProperty(notes = "活动开始时间", required = true)
private String startTime; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
/** 活动结束时间 */ /** 活动结束时间 */
@ApiModelProperty(notes = "活动结束时间", required = true) @ApiModelProperty(notes = "活动结束时间", required = true)
private String endTime; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
/** 活动标签 */ /** 活动标签 */
@ApiModelProperty(notes = "活动标签", required = true) @ApiModelProperty(notes = "活动标签", required = true)
......
package cn.com.glsx.dj.strategy.dto; package cn.com.glsx.dj.strategy.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 活动操作日志响应VO * 活动操作日志响应VO
...@@ -21,6 +23,7 @@ public class OperationLogVO implements Serializable { ...@@ -21,6 +23,7 @@ public class OperationLogVO implements Serializable {
@ApiModelProperty(notes = "操作人姓名") @ApiModelProperty(notes = "操作人姓名")
private String operatorName; private String operatorName;
/** 操作时间 */ /** 操作时间 */
@ApiModelProperty(notes = "操作时间(yyyy-MM-dd HH:mm:ss)") @ApiModelProperty(notes = "操作时间")
private String operateTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date operateTime;
} }
...@@ -15,19 +15,11 @@ import java.util.List; ...@@ -15,19 +15,11 @@ import java.util.List;
* @since 2026/06/16 * @since 2026/06/16
*/ */
@Data @Data
@ApiModel(value = "套餐分页查询请求") @ApiModel(value = "套餐查询请求")
public class PackagePageReqDTO implements Serializable { public class PackagePageReqDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 页码 */
@ApiModelProperty(notes = "页码,默认1")
private Integer pageNum;
/** 每页条数 */
@ApiModelProperty(notes = "每页条数,默认10")
private Integer pageSize;
/** 适用门店号列表 */ /** 适用门店号列表 */
@ApiModelProperty(notes = "适用门店号列表", required = true) @ApiModelProperty(notes = "适用门店号列表", required = true)
private List<Integer> merchantIds; private List<Integer> merchantIds;
......
...@@ -22,9 +22,9 @@ import java.util.List; ...@@ -22,9 +22,9 @@ import java.util.List;
public interface MarketingActivityRemote { public interface MarketingActivityRemote {
@ApiMethod("分页查询活动列表") @ApiMethod("分页查询活动列表")
@ApiParam(name = "request", notes = "分页查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "pagination", notes = "分页条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("活动分页列表") @ApiResponse("活动分页列表")
RpcResponse<RpcPagination<MarketingActivityRespDTO>> page(MarketingActivityPageReqDTO request); RpcResponse<RpcPagination<MarketingActivityRespDTO>> page(RpcPagination<MarketingActivityPageReqDTO> pagination);
@ApiMethod("创建营销活动") @ApiMethod("创建营销活动")
@ApiParam(name = "request", notes = "创建请求", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "request", notes = "创建请求", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
...@@ -37,19 +37,19 @@ public interface MarketingActivityRemote { ...@@ -37,19 +37,19 @@ public interface MarketingActivityRemote {
RpcResponse<MarketingActivityDetailRespDTO> detail(Integer activityId); RpcResponse<MarketingActivityDetailRespDTO> detail(Integer activityId);
@ApiMethod("查询活动关联门店(分页)") @ApiMethod("查询活动关联门店(分页)")
@ApiParam(name = "request", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "pagination", notes = "分页条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("门店分页列表") @ApiResponse("门店分页列表")
RpcResponse<RpcPagination<StoreVO>> stores(MarketingActivityStoreReqDTO request); RpcResponse<RpcPagination<StoreVO>> stores(RpcPagination<MarketingActivityStoreReqDTO> pagination);
@ApiMethod("查询活动关联商品/套餐(分页)") @ApiMethod("查询活动关联商品/套餐(分页)")
@ApiParam(name = "request", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "pagination", notes = "分页条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("商品/套餐分页列表") @ApiResponse("商品/套餐分页列表")
RpcResponse<RpcPagination<MarketingActivityProductRespDTO>> products(MarketingActivityProductPageReqDTO request); RpcResponse<RpcPagination<MarketingActivityProductRespDTO>> products(RpcPagination<MarketingActivityProductPageReqDTO> pagination);
@ApiMethod("查询活动操作日志(分页)") @ApiMethod("查询活动操作日志(分页)")
@ApiParam(name = "request", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "pagination", notes = "分页条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("操作日志分页列表") @ApiResponse("操作日志分页列表")
RpcResponse<RpcPagination<OperationLogVO>> logs(MarketingActivityLogPageReqDTO request); RpcResponse<RpcPagination<OperationLogVO>> logs(RpcPagination<MarketingActivityLogPageReqDTO> pagination);
@ApiMethod("编辑营销活动") @ApiMethod("编辑营销活动")
@ApiParam(name = "request", notes = "编辑请求", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "request", notes = "编辑请求", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
......
...@@ -24,9 +24,9 @@ import java.util.List; ...@@ -24,9 +24,9 @@ import java.util.List;
public interface MarketingGoodsRemote { public interface MarketingGoodsRemote {
@ApiMethod("分页查询商品") @ApiMethod("分页查询商品")
@ApiParam(name = "request", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "pagination", notes = "分页条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("商品分页列表") @ApiResponse("商品分页列表")
RpcResponse<RpcPagination<GoodsRespDTO>> page(GoodsPageReqDTO request); RpcResponse<RpcPagination<GoodsRespDTO>> page(RpcPagination<GoodsPageReqDTO> pagination);
@ApiMethod("查询商品/套餐适用门店") @ApiMethod("查询商品/套餐适用门店")
@ApiParam(name = "request", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "request", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
......
...@@ -23,9 +23,9 @@ import java.util.List; ...@@ -23,9 +23,9 @@ import java.util.List;
public interface MarketingPackageRemote { public interface MarketingPackageRemote {
@ApiMethod("分页查询套餐") @ApiMethod("分页查询套餐")
@ApiParam(name = "request", notes = "查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "pagination", notes = "分页条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("套餐分页列表") @ApiResponse("套餐分页列表")
RpcResponse<RpcPagination<PackageRespDTO>> page(PackagePageReqDTO request); RpcResponse<RpcPagination<PackageRespDTO>> page(RpcPagination<PackagePageReqDTO> pagination);
@ApiMethod("查询套餐下子商品") @ApiMethod("查询套餐下子商品")
@ApiParam(name = "packageId", notes = "套餐ID", dataType = ApiParam.DataTypeEnum.STRING, required = true) @ApiParam(name = "packageId", notes = "套餐ID", dataType = ApiParam.DataTypeEnum.STRING, required = true)
......
package cn.com.glsx.dj.strategy.mapper; package cn.com.glsx.dj.strategy.mapper;
import cn.com.glsx.dj.strategy.dto.ActivityPackageItemDTO; import cn.com.glsx.dj.strategy.dto.ActivityPackageItemDTO;
import cn.com.glsx.dj.strategy.dto.MarketingActivityProductItemRespDTO;
import cn.com.glsx.dj.strategy.model.MarketingActivityProductItem; import cn.com.glsx.dj.strategy.model.MarketingActivityProductItem;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -33,6 +34,8 @@ public interface MarketingActivityProductItemMapper extends OreMapper<MarketingA ...@@ -33,6 +34,8 @@ public interface MarketingActivityProductItemMapper extends OreMapper<MarketingA
*/ */
int deleteByActivityProductId(@Param("activityProductId") Integer activityProductId); int deleteByActivityProductId(@Param("activityProductId") Integer activityProductId);
List<MarketingActivityProductItemRespDTO> selectItemDTOByActivityProductIds(@Param("productIds") List<Integer> productIds);
/** /**
* 按 productId 列表批量查询子商品 * 按 productId 列表批量查询子商品
*/ */
......
package cn.com.glsx.dj.strategy.mapper; package cn.com.glsx.dj.strategy.mapper;
import cn.com.glsx.dj.strategy.dto.MarketingActivityProductPageReqDTO;
import cn.com.glsx.dj.strategy.dto.MarketingActivityProductRespDTO;
import cn.com.glsx.dj.strategy.model.MarketingActivityProduct; import cn.com.glsx.dj.strategy.model.MarketingActivityProduct;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -23,11 +25,9 @@ public interface MarketingActivityProductMapper extends OreMapper<MarketingActiv ...@@ -23,11 +25,9 @@ public interface MarketingActivityProductMapper extends OreMapper<MarketingActiv
int batchInsert(@Param("list") List<MarketingActivityProduct> list); int batchInsert(@Param("list") List<MarketingActivityProduct> list);
/** /**
* 按活动ID+车系ID查询 * 通用查询(DTO映射,支持 productType/carSeriesId 过滤)
*/ */
List<MarketingActivityProduct> selectByActivityIdAndCarSeriesId( List<MarketingActivityProductRespDTO> selectProductDTOList(@Param("query") MarketingActivityProductPageReqDTO query);
@Param("activityId") Integer activityId,
@Param("carSeriesId") Integer carSeriesId);
/** /**
* 按活动ID+车系ID删除 * 按活动ID+车系ID删除
...@@ -37,16 +37,6 @@ public interface MarketingActivityProductMapper extends OreMapper<MarketingActiv ...@@ -37,16 +37,6 @@ public interface MarketingActivityProductMapper extends OreMapper<MarketingActiv
@Param("carSeriesId") Integer carSeriesId); @Param("carSeriesId") Integer carSeriesId);
/** /**
* 按活动ID查询全部
*/
List<MarketingActivityProduct> selectByActivityId(@Param("activityId") Integer activityId);
/**
* 更新单个字段(优惠价/激励等)
*/
int updateSelective(MarketingActivityProduct record);
/**
* 按门店+商品编码查询有效活动商品 * 按门店+商品编码查询有效活动商品
*/ */
List<MarketingActivityProduct> selectActiveByMerchantIdAndGoodsCodes( List<MarketingActivityProduct> selectActiveByMerchantIdAndGoodsCodes(
......
...@@ -28,9 +28,9 @@ public class MarketingActivityRemoteImpl implements MarketingActivityRemote { ...@@ -28,9 +28,9 @@ public class MarketingActivityRemoteImpl implements MarketingActivityRemote {
private final MarketingActivityService marketingActivityService; private final MarketingActivityService marketingActivityService;
@Override @Override
public RpcResponse<RpcPagination<MarketingActivityRespDTO>> page(MarketingActivityPageReqDTO request) { public RpcResponse<RpcPagination<MarketingActivityRespDTO>> page(RpcPagination<MarketingActivityPageReqDTO> pagination) {
try { try {
return RpcResponse.success(RpcPagination.copyPage(marketingActivityService.page(request))); return RpcResponse.success(RpcPagination.copyPage(marketingActivityService.page(pagination)));
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
log.error("分页查询活动发生业务异常", e); log.error("分页查询活动发生业务异常", e);
return RpcResponse.error(e); return RpcResponse.error(e);
...@@ -69,9 +69,9 @@ public class MarketingActivityRemoteImpl implements MarketingActivityRemote { ...@@ -69,9 +69,9 @@ public class MarketingActivityRemoteImpl implements MarketingActivityRemote {
} }
@Override @Override
public RpcResponse<RpcPagination<StoreVO>> stores(MarketingActivityStoreReqDTO request) { public RpcResponse<RpcPagination<StoreVO>> stores(RpcPagination<MarketingActivityStoreReqDTO> pagination) {
try { try {
return RpcResponse.success(RpcPagination.copyPage(marketingActivityService.stores(request))); return RpcResponse.success(RpcPagination.copyPage(marketingActivityService.stores(pagination)));
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
log.error("查询活动门店发生业务异常", e); log.error("查询活动门店发生业务异常", e);
return RpcResponse.error(e); return RpcResponse.error(e);
...@@ -82,9 +82,9 @@ public class MarketingActivityRemoteImpl implements MarketingActivityRemote { ...@@ -82,9 +82,9 @@ public class MarketingActivityRemoteImpl implements MarketingActivityRemote {
} }
@Override @Override
public RpcResponse<RpcPagination<MarketingActivityProductRespDTO>> products(MarketingActivityProductPageReqDTO request) { public RpcResponse<RpcPagination<MarketingActivityProductRespDTO>> products(RpcPagination<MarketingActivityProductPageReqDTO> pagination) {
try { try {
return RpcResponse.success(RpcPagination.copyPage(marketingActivityService.products(request))); return RpcResponse.success(RpcPagination.copyPage(marketingActivityService.products(pagination)));
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
log.error("查询活动商品发生业务异常", e); log.error("查询活动商品发生业务异常", e);
return RpcResponse.error(e); return RpcResponse.error(e);
...@@ -95,9 +95,9 @@ public class MarketingActivityRemoteImpl implements MarketingActivityRemote { ...@@ -95,9 +95,9 @@ public class MarketingActivityRemoteImpl implements MarketingActivityRemote {
} }
@Override @Override
public RpcResponse<RpcPagination<OperationLogVO>> logs(MarketingActivityLogPageReqDTO request) { public RpcResponse<RpcPagination<OperationLogVO>> logs(RpcPagination<MarketingActivityLogPageReqDTO> pagination) {
try { try {
return RpcResponse.success(RpcPagination.copyPage(marketingActivityService.logs(request))); return RpcResponse.success(RpcPagination.copyPage(marketingActivityService.logs(pagination)));
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
log.error("查询活动日志发生业务异常", e); log.error("查询活动日志发生业务异常", e);
return RpcResponse.error(e); return RpcResponse.error(e);
......
...@@ -30,9 +30,9 @@ public class MarketingGoodsRemoteImpl implements MarketingGoodsRemote { ...@@ -30,9 +30,9 @@ public class MarketingGoodsRemoteImpl implements MarketingGoodsRemote {
private final MarketingGoodsService marketingGoodsService; private final MarketingGoodsService marketingGoodsService;
@Override @Override
public RpcResponse<RpcPagination<GoodsRespDTO>> page(GoodsPageReqDTO request) { public RpcResponse<RpcPagination<GoodsRespDTO>> page(RpcPagination<GoodsPageReqDTO> pagination) {
try { try {
return RpcResponse.success(RpcPagination.copyPage(marketingGoodsService.page(request))); return RpcResponse.success(RpcPagination.copyPage(marketingGoodsService.page(pagination)));
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
log.error("分页查询商品发生业务异常", e); log.error("分页查询商品发生业务异常", e);
return RpcResponse.error(e); return RpcResponse.error(e);
......
...@@ -29,9 +29,9 @@ public class MarketingPackageRemoteImpl implements MarketingPackageRemote { ...@@ -29,9 +29,9 @@ public class MarketingPackageRemoteImpl implements MarketingPackageRemote {
private final MarketingPackageService marketingPackageService; private final MarketingPackageService marketingPackageService;
@Override @Override
public RpcResponse<RpcPagination<PackageRespDTO>> page(PackagePageReqDTO request) { public RpcResponse<RpcPagination<PackageRespDTO>> page(RpcPagination<PackagePageReqDTO> pagination) {
try { try {
return RpcResponse.success(RpcPagination.copyPage(marketingPackageService.page(request))); return RpcResponse.success(RpcPagination.copyPage(marketingPackageService.page(pagination)));
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
log.error("分页查询套餐发生业务异常", e); log.error("分页查询套餐发生业务异常", e);
return RpcResponse.error(e); return RpcResponse.error(e);
......
...@@ -5,8 +5,11 @@ import cn.com.glsx.dj.strategy.dto.GoodsRespDTO; ...@@ -5,8 +5,11 @@ import cn.com.glsx.dj.strategy.dto.GoodsRespDTO;
import cn.com.glsx.dj.strategy.dto.GoodsStoreReqDTO; import cn.com.glsx.dj.strategy.dto.GoodsStoreReqDTO;
import cn.com.glsx.dj.strategy.dto.GoodsStoreRespDTO; import cn.com.glsx.dj.strategy.dto.GoodsStoreRespDTO;
import cn.com.glsx.dj.strategy.mapper.MarketingGoodsQueryMapper; import cn.com.glsx.dj.strategy.mapper.MarketingGoodsQueryMapper;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.util.RpcAssert;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -24,13 +27,12 @@ public class MarketingGoodsService { ...@@ -24,13 +27,12 @@ public class MarketingGoodsService {
private final MarketingGoodsQueryMapper marketingGoodsQueryMapper; private final MarketingGoodsQueryMapper marketingGoodsQueryMapper;
public PageInfo<GoodsRespDTO> page(GoodsPageReqDTO request) { public Page<GoodsRespDTO> page(RpcPagination<GoodsPageReqDTO> pagination) {
if (request.getMerchantIds() == null || request.getMerchantIds().isEmpty()) { GoodsPageReqDTO request = pagination.getCondition();
return new PageInfo<>(Collections.emptyList()); RpcAssert.assertNotEmpty(request.getMerchantIds(), DefaultErrorEnum.SERVER_ERROR, "商户ID不能为空");
} Page<GoodsRespDTO> res = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
PageHelper.startPage(request.getPageNum(), request.getPageSize()); marketingGoodsQueryMapper.pageGoods(request);
List<GoodsRespDTO> list = marketingGoodsQueryMapper.pageGoods(request); return res;
return new PageInfo<>(list);
} }
public List<GoodsStoreRespDTO> stores(GoodsStoreReqDTO request) { public List<GoodsStoreRespDTO> stores(GoodsStoreReqDTO request) {
......
...@@ -4,6 +4,9 @@ import cn.com.glsx.dj.strategy.dto.PackageItemRespDTO; ...@@ -4,6 +4,9 @@ import cn.com.glsx.dj.strategy.dto.PackageItemRespDTO;
import cn.com.glsx.dj.strategy.dto.PackagePageReqDTO; import cn.com.glsx.dj.strategy.dto.PackagePageReqDTO;
import cn.com.glsx.dj.strategy.dto.PackageRespDTO; import cn.com.glsx.dj.strategy.dto.PackageRespDTO;
import cn.com.glsx.dj.strategy.mapper.MarketingPackageQueryMapper; import cn.com.glsx.dj.strategy.mapper.MarketingPackageQueryMapper;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.util.RpcAssert;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -24,11 +27,10 @@ public class MarketingPackageService { ...@@ -24,11 +27,10 @@ public class MarketingPackageService {
private final MarketingPackageQueryMapper marketingPackageQueryMapper; private final MarketingPackageQueryMapper marketingPackageQueryMapper;
public Page<PackageRespDTO> page(PackagePageReqDTO request) { public Page<PackageRespDTO> page(RpcPagination<PackagePageReqDTO> pagination) {
if (request.getMerchantIds() == null || request.getMerchantIds().isEmpty()) { PackagePageReqDTO request = pagination.getCondition();
return null; RpcAssert.assertNotEmpty(request.getMerchantIds(), DefaultErrorEnum.SERVER_ERROR, "商户ID不能为空");
} Page<PackageRespDTO> res = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
Page<PackageRespDTO> res = PageHelper.startPage(request.getPageNum(), request.getPageSize());
marketingPackageQueryMapper.pagePackages(request); marketingPackageQueryMapper.pagePackages(request);
return res; return res;
} }
......
...@@ -16,6 +16,20 @@ ...@@ -16,6 +16,20 @@
</foreach> </foreach>
</insert> </insert>
<!-- 子商品 DTO 映射 -->
<resultMap id="ItemRespDTOResultMap" type="cn.com.glsx.dj.strategy.dto.MarketingActivityProductItemRespDTO">
<id column="id" property="itemId" jdbcType="INTEGER"/>
<result column="activity_product_id" property="activityProductId" jdbcType="INTEGER"/>
<result column="goods_code" property="goodsCode" jdbcType="VARCHAR"/>
<result column="goods_name" property="goodsName" jdbcType="VARCHAR"/>
<result column="goods_type" property="goodsType" jdbcType="INTEGER"/>
<result column="goods_type_name" property="goodsTypeName" jdbcType="VARCHAR"/>
<result column="current_price" property="currentPrice" jdbcType="DECIMAL"/>
<result column="minimum_price" property="minimumPrice" jdbcType="DECIMAL"/>
<result column="discount_price" property="discountPrice" jdbcType="DECIMAL"/>
<result column="sales_incentive" property="salesIncentive" jdbcType="DECIMAL"/>
</resultMap>
<select id="selectByActivityProductId" resultType="cn.com.glsx.dj.strategy.model.MarketingActivityProductItem"> <select id="selectByActivityProductId" resultType="cn.com.glsx.dj.strategy.model.MarketingActivityProductItem">
SELECT * FROM dj_marketing_activity_product_item SELECT * FROM dj_marketing_activity_product_item
WHERE activity_product_id = #{activityProductId} AND deleted_flag = 'N' WHERE activity_product_id = #{activityProductId} AND deleted_flag = 'N'
...@@ -30,6 +44,16 @@ ...@@ -30,6 +44,16 @@
AND deleted_flag = 'N' AND deleted_flag = 'N'
</select> </select>
<select id="selectItemDTOByActivityProductIds" resultMap="ItemRespDTOResultMap">
SELECT *
FROM dj_marketing_activity_product_item
WHERE activity_product_id IN
<foreach collection="productIds" item="pid" open="(" separator="," close=")">
#{pid}
</foreach>
AND deleted_flag = 'N'
</select>
<update id="deleteByActivityProductId"> <update id="deleteByActivityProductId">
UPDATE dj_marketing_activity_product_item SET deleted_flag = 'D', updated_date = NOW() UPDATE dj_marketing_activity_product_item SET deleted_flag = 'D', updated_date = NOW()
WHERE activity_product_id = #{activityProductId} WHERE activity_product_id = #{activityProductId}
......
...@@ -37,6 +37,41 @@ ...@@ -37,6 +37,41 @@
ORDER BY sort_order ORDER BY sort_order
</select> </select>
<!-- 通用查询(DTO 映射) -->
<resultMap id="ProductRespDTOResultMap" type="cn.com.glsx.dj.strategy.dto.MarketingActivityProductRespDTO">
<id column="id" property="productId" jdbcType="INTEGER"/>
<result column="car_series_id" property="carSeriesId" jdbcType="INTEGER"/>
<result column="product_type" property="productType" jdbcType="TINYINT"/>
<result column="goods_type" property="goodsType" jdbcType="INTEGER"/>
<result column="goods_type_name" property="goodsTypeName" jdbcType="VARCHAR"/>
<result column="goods_code" property="goodsCode" jdbcType="VARCHAR"/>
<result column="package_code" property="packageCode" jdbcType="VARCHAR"/>
<result column="sort_order" property="sortOrder" jdbcType="INTEGER"/>
<result column="tab_name" property="tabName" jdbcType="VARCHAR"/>
<result column="tab_description" property="tabDescription" jdbcType="VARCHAR"/>
<result column="discount_price" property="discountPrice" jdbcType="DECIMAL"/>
<result column="current_price" property="currentPrice" jdbcType="DECIMAL"/>
<result column="minimum_price" property="minimumPrice" jdbcType="DECIMAL"/>
<result column="sales_incentive" property="salesIncentive" jdbcType="DECIMAL"/>
<result column="is_main_push" property="isMainPush" jdbcType="TINYINT"/>
<result column="main_image_url" property="mainImageUrl" jdbcType="VARCHAR"/>
<result column="thumb_image_url" property="thumbImageUrl" jdbcType="VARCHAR"/>
<result column="detail_image_url" property="detailImageUrl" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectProductDTOList" resultMap="ProductRespDTOResultMap">
SELECT *
FROM dj_marketing_activity_product
WHERE activity_id = #{query.activityId} AND deleted_flag = 'N'
<if test="query.carSeriesId != null">
AND car_series_id = #{query.carSeriesId}
</if>
<if test="query.productType != null">
AND product_type = #{query.productType}
</if>
ORDER BY sort_order
</select>
<update id="deleteByActivityIdAndCarSeriesId"> <update id="deleteByActivityIdAndCarSeriesId">
UPDATE dj_marketing_activity_product SET deleted_flag = 'D', updated_date = NOW() UPDATE dj_marketing_activity_product SET deleted_flag = 'D', updated_date = NOW()
WHERE activity_id = #{activityId} AND deleted_flag = 'N' WHERE activity_id = #{activityId} AND deleted_flag = 'N'
......
...@@ -65,7 +65,10 @@ ...@@ -65,7 +65,10 @@
<!-- 根据 goodsCode 查询 goods_type/goods_type_name/现售价/最低限价 --> <!-- 根据 goodsCode 查询 goods_type/goods_type_name/现售价/最低限价 -->
<select id="findGoodsTypeInfo" resultType="cn.com.glsx.dj.strategy.dto.GoodsTypeInfoDTO"> <select id="findGoodsTypeInfo" resultType="cn.com.glsx.dj.strategy.dto.GoodsTypeInfoDTO">
SELECT gi.goods_type AS goodsType, gi.goods_type_name AS goodsTypeName, SELECT
mgi.goods_alias AS goodsAlias,
gi.goods_type AS goodsType,
gi.goods_type_name AS goodsTypeName,
COALESCE(mgi.sell_price, 0) AS currentPrice, COALESCE(mgi.sell_price, 0) AS currentPrice,
COALESCE(mgi.min_sell_price, 0) AS minimumPrice COALESCE(mgi.min_sell_price, 0) AS minimumPrice
FROM dj_car_life_merchant_goods_info mgi FROM dj_car_life_merchant_goods_info mgi
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!