Commit 9ce4cb0e by 叶立庆

Merge branch 'v5.8.4' into 'master'

上线合并

See merge request !5
2 parents 7df725d6 a9de5c49
Showing 43 changed files with 803 additions and 75 deletions
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
<name>rpc-dj-goods-listing-api</name> <name>rpc-dj-goods-listing-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.dj.goods.listing.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.dj.goods.listing.remote</deploy.scanPackage>
<goods-listing.api.version>1.0.0-SNAPSHOT</goods-listing.api.version> <goods-listing.api.version>1.1.0-SNAPSHOT</goods-listing.api.version>
<smartcarlife.api.version>5.8.0-SNAPSHOT</smartcarlife.api.version> <smartcarlife.api.version>5.8.4-SNAPSHOT</smartcarlife.api.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
......
package cn.com.glsx.dj.goods.listing.dto;
import cn.com.glsx.dj.goods.listing.model.GoodsListingLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.List;
@Data
@ToString
public class GoodsListingApprovalBaseInfoDTO implements Serializable{
/**
*
*/
private static final long serialVersionUID = -8611419779113680371L;
@ApiModelProperty(notes = "单据编号")
private String businessCode;
@ApiModelProperty(notes = "流量方信息")
private String merchantNames;
@ApiModelProperty(notes = "上架类型 1-单店模式 2-项目制批量上架")
private Byte shelfType;
@ApiModelProperty(notes = "系统状态 0-草稿 1-待审核 2-已审核 3-驳回")
private Byte systemStatus;
@ApiModelProperty(notes = "基础场景编码")
private String baseSceneCode;
@ApiModelProperty(notes = "商品上架表excel文件url")
private String goodsCreateExcel;
@ApiModelProperty(notes = "确认步骤:1.基础信息,2.上架商品;3.分账配置;4.对账配置;5.预估利润率")
private Byte confirmStep;
@ApiModelProperty(notes = "操作")
private List<GoodsListingLog> logList;
@ApiModelProperty(notes = "商户号列表")
private List<Integer> merchantIdList;
@ApiModelProperty(notes = "利润率是否全部计算完成(Y:是,N:否)")
private String profitRateCalFinish;
@ApiModelProperty(notes = "当前商户号")
private Integer merchantId;
}
...@@ -35,6 +35,12 @@ public class GoodsListingApproveAllImportVo implements Serializable { ...@@ -35,6 +35,12 @@ public class GoodsListingApproveAllImportVo implements Serializable {
/** 商品ID 会员权益、精品升级场景用到**/ /** 商品ID 会员权益、精品升级场景用到**/
private String upgradeCommodityCode; private String upgradeCommodityCode;
/** 类型(上架方式) */
private String shelfStyle;
/** 原上架ID */
private String oldMerchantGoodsCode;
/** 商品别名 会员权益、精品升级场景用到**/ /** 商品别名 会员权益、精品升级场景用到**/
private String upgradeGoodsNameAlias; private String upgradeGoodsNameAlias;
...@@ -44,6 +50,12 @@ public class GoodsListingApproveAllImportVo implements Serializable { ...@@ -44,6 +50,12 @@ public class GoodsListingApproveAllImportVo implements Serializable {
/** 最低价 会员权益、精品升级场景用到**/ /** 最低价 会员权益、精品升级场景用到**/
private String minSellPrice; private String minSellPrice;
/** 是否作为赠送产品 */
private String isGiftCost;
/** 产品成本获取方式 */
private String upgradeProductCostStyle;
/** 嘀加成本 会员权益场景用到**/ /** 嘀加成本 会员权益场景用到**/
private String djCost; private String djCost;
...@@ -53,6 +65,9 @@ public class GoodsListingApproveAllImportVo implements Serializable { ...@@ -53,6 +65,9 @@ public class GoodsListingApproveAllImportVo implements Serializable {
/** 销售占比 会员权益场景、精品升级用到**/ /** 销售占比 会员权益场景、精品升级用到**/
private String saleRatio; private String saleRatio;
/** 服务项目 */
private String serviceItem;
/** 流量方是否线上自动分账 会员权益场景、精品升级用到**/ /** 流量方是否线上自动分账 会员权益场景、精品升级用到**/
private String shopMerchantAutoDivide; private String shopMerchantAutoDivide;
...@@ -101,6 +116,9 @@ public class GoodsListingApproveAllImportVo implements Serializable { ...@@ -101,6 +116,9 @@ public class GoodsListingApproveAllImportVo implements Serializable {
/** 其他费用归属 会员权益、精品升级场景用到**/ /** 其他费用归属 会员权益、精品升级场景用到**/
private String otherFeeTarget; private String otherFeeTarget;
/** 市场费是否前置 */
private String managementMarketingFeesPrerequisite;
/** 管理层市场费1计算方式 会员权益、精品升级场景用到**/ /** 管理层市场费1计算方式 会员权益、精品升级场景用到**/
private String managerMarket1CalType; private String managerMarket1CalType;
...@@ -113,6 +131,9 @@ public class GoodsListingApproveAllImportVo implements Serializable { ...@@ -113,6 +131,9 @@ public class GoodsListingApproveAllImportVo implements Serializable {
/** 管理层市场费2 会员权益、精品升级场景用到**/ /** 管理层市场费2 会员权益、精品升级场景用到**/
private String managerMarket2CalTypeFee; private String managerMarket2CalTypeFee;
/** 一线激励是否前置 */
private String firstLineSunshinePrerequisite;
/** 一线阳光是否开启线上积分 会员权益、精品升级场景用到**/ /** 一线阳光是否开启线上积分 会员权益、精品升级场景用到**/
private String firstLineSunshineOnlinePointsFlag; private String firstLineSunshineOnlinePointsFlag;
......
...@@ -3,6 +3,7 @@ package cn.com.glsx.dj.goods.listing.dto; ...@@ -3,6 +3,7 @@ package cn.com.glsx.dj.goods.listing.dto;
import java.util.List; import java.util.List;
import cn.com.glsx.dj.goods.listing.model.GoodsListingProductBase; import cn.com.glsx.dj.goods.listing.model.GoodsListingProductBase;
import cn.com.glsx.dj.smartcarlife.dto.MerchantSettleDistributeRuleTestRuleDTO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -24,4 +25,6 @@ public class GoodsListingProductBaseDTO extends GoodsListingProductBase{ ...@@ -24,4 +25,6 @@ public class GoodsListingProductBaseDTO extends GoodsListingProductBase{
private List<GoodsListingProductDetailDTO> detailList; private List<GoodsListingProductDetailDTO> detailList;
private Boolean needDetail; private Boolean needDetail;
private MerchantSettleDistributeRuleTestRuleDTO settleDistributeRuleTestRuleDTO;
} }
package cn.com.glsx.dj.goods.listing.dto; package cn.com.glsx.dj.goods.listing.dto;
import java.math.BigDecimal;
import java.util.List;
import cn.com.glsx.dj.goods.listing.model.GoodsListingProductDetail; import cn.com.glsx.dj.goods.listing.model.GoodsListingProductDetail;
import cn.com.glsx.dj.smartcarlife.dto.UpgradeGoodsDTO; import cn.com.glsx.dj.smartcarlife.dto.UpgradeGoodsDTO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -11,6 +8,9 @@ import lombok.Data; ...@@ -11,6 +8,9 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.math.BigDecimal;
import java.util.List;
@Data @Data
@ToString(callSuper = true) @ToString(callSuper = true)
@AllArgsConstructor @AllArgsConstructor
...@@ -35,4 +35,15 @@ public class GoodsListingProductDetailDTO extends GoodsListingProductDetail {/** ...@@ -35,4 +35,15 @@ public class GoodsListingProductDetailDTO extends GoodsListingProductDetail {/**
@ApiModelProperty(notes = "套餐编码") @ApiModelProperty(notes = "套餐编码")
private String packageCode; private String packageCode;
@ApiModelProperty(notes = "权益、延保 且 供应方=广联直营 0-否 1-是 ")
private Integer supplyFlag = 0;
@ApiModelProperty(notes ="供应方名称")
private String supplierName;
private String specificationData;
private String specificationTypeSequence;
} }
...@@ -29,5 +29,8 @@ public class GoodsListingSubmitDTO extends CreateBusinessApproveDTO { ...@@ -29,5 +29,8 @@ public class GoodsListingSubmitDTO extends CreateBusinessApproveDTO {
@ApiModelProperty(notes = "基础场景编码(6位)") @ApiModelProperty(notes = "基础场景编码(6位)")
private String baseSceneCode; private String baseSceneCode;
@ApiModelProperty(notes = "上架模式 1-特殊商品上架 2-常规商品上架")
private Byte shelfModel;
private List<Integer> allServiceItemIdList; private List<Integer> allServiceItemIdList;
} }
package cn.com.glsx.dj.goods.listing.dto; package cn.com.glsx.dj.goods.listing.dto;
import java.io.Serializable;
import javax.validation.constraints.NotEmpty;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
@Data @Data
@ToString @ToString
public class SaveReconciliationBaseRuleDTO implements Serializable{ public class SaveReconciliationBaseRuleDTO implements Serializable{
...@@ -28,4 +27,12 @@ public class SaveReconciliationBaseRuleDTO implements Serializable{ ...@@ -28,4 +27,12 @@ public class SaveReconciliationBaseRuleDTO implements Serializable{
private String firstLineSunshine2OnlinePointsFlag; private String firstLineSunshine2OnlinePointsFlag;
private String updatedBy; private String updatedBy;
@NotEmpty
@ApiModelProperty(name = "managementMarketingFeesPrerequisite", notes = "管理层市场费是否前置:是-Y 否-N")
private String managementMarketingFeesPrerequisite;
@NotEmpty
@ApiModelProperty(name = "firstLineSunshinePrerequisite", notes = "一线阳光是否前置:是-Y 否-N")
private String firstLineSunshinePrerequisite;
} }
package cn.com.glsx.dj.goods.listing.enums;
import java.util.Arrays;
/**
* @Author: chenx
* @Description: 计算方式
* @Date: 2025/2/26 14:26
* @Version: 1.0
*/
public enum CalculateStyleEnum {
/**
* 按毛利比例
*/
GROSS_RATIO((byte)1,"毛利"),
/**
* 按收入比例
*/
INCOME_PROPORTION((byte)2,"收入"),
/**
* 按固定金额
*/
FIXED_AMOUNT((byte)3,"固定"),
/**
* 固定*购买数量
*/
FIX_AMOUNT_WITH_PURCHASE_NUM((byte)10,"固定*购买数量");
private byte value;
private String displayName;
CalculateStyleEnum(Byte value, String displayName) {
this.value = value;
this.displayName = displayName;
}
public byte getValue() {
return value;
}
public String getDisplayName() {
return displayName;
}
public static CalculateStyleEnum getByValue(Byte value){
if (value != null) {
for (CalculateStyleEnum e : CalculateStyleEnum.values()) {
if (e.getValue() == value.byteValue()) {
return e;
}
}
}
return null;
}
public static Byte getValueByDisplayName(String displayName){
if (displayName != null) {
for (CalculateStyleEnum e : CalculateStyleEnum.values()) {
if (e.getDisplayName().equals(displayName)) {
return e.getValue();
}
}
}
return null;
}
public static Byte getValueByShopDisplayName(String displayName){
if (displayName != null) {
for (CalculateStyleEnum e : Arrays.asList(
GROSS_RATIO,
INCOME_PROPORTION,
FIXED_AMOUNT,
FIX_AMOUNT_WITH_PURCHASE_NUM
)) {
if (e.getDisplayName().equals(displayName)) {
return e.getValue();
}
}
}
return null;
}
public static Byte getValueByPartnerDisplayName(String displayName){
if (displayName != null) {
for (CalculateStyleEnum e : Arrays.asList(
GROSS_RATIO,
INCOME_PROPORTION,
FIXED_AMOUNT,
FIX_AMOUNT_WITH_PURCHASE_NUM
)) {
if (e.getDisplayName().equals(displayName)) {
return e.getValue();
}
}
}
return null;
}
public static Byte getValueByOtherFeeDisplayName(String displayName){
if (displayName != null) {
for (CalculateStyleEnum e : Arrays.asList(
GROSS_RATIO,
INCOME_PROPORTION,
FIXED_AMOUNT,
FIX_AMOUNT_WITH_PURCHASE_NUM
)) {
if (e.getDisplayName().equals(displayName)) {
return e.getValue();
}
}
}
return null;
}
//dj_car_life_yq_merchant_service_details.profit_mode_type 园区店服务信息 ,两边值定义不一致才做此转换
public static CalculateStyleEnum convertByProfitModeType(Byte profitModeType) {
if(profitModeType == null) {
return null;
}
switch(profitModeType) {
case 1://按收入比例
return INCOME_PROPORTION;
case 2://按毛利比例
return GROSS_RATIO;
case 3://按固定金额
return FIXED_AMOUNT;
case 4://按固定金额*购买数量
return FIX_AMOUNT_WITH_PURCHASE_NUM;
default:
}
return null;
}
}
package cn.com.glsx.dj.goods.listing.enums;
/**
* 成本获取方式
*/
public enum CostStyleEnum {
/**
* 自定义成本
*/
CUSTOM_COST((byte)1,"自定义成本"),
/**
* 默认带入产品成本
*/
DEFAULT_PRODUCT_COST((byte)2,"默认带入产品成本")
;
private byte value;
private String displayName;
CostStyleEnum(Byte value, String displayName) {
this.value = value;
this.displayName = displayName;
}
public byte getValue() {
return value;
}
public String getDisplayName() {
return displayName;
}
public static CostStyleEnum getByValue(Byte value){
if (value != null) {
for (CostStyleEnum temp : CostStyleEnum.values()) {
if (temp.getValue() == value.byteValue()) {
return temp;
}
}
}
return null;
}
}
\ No newline at end of file \ No newline at end of file
...@@ -79,12 +79,12 @@ public class GoodsListingEnum { ...@@ -79,12 +79,12 @@ public class GoodsListingEnum {
//系统状态 0-草稿 1-待审核 2-已审核 3-驳回 //系统状态 0-草稿 1-待审核 2-已审核 3-驳回
public enum SystemStatus{ public enum SystemStatus{
DRAFT((byte) 0, "草稿"), DRAFT((byte) 0, "草稿"),
PENDING((byte) 1, "待审核"), PENDING((byte) 1, "商务审核"),
APPROVED((byte) 2, "已审核"), APPROVED((byte) 2, "已完成"),
REJECTED((byte) 3, "驳回"), REJECTED((byte) 3, "驳回"),
// PROFIT_RATE_CALCULATING((byte) 4, "利润率计算中"), // PROFIT_RATE_CALCULATING((byte) 4, "利润率计算中"),
REVIEWING((byte) 5, "审核提交中"), REVIEWING((byte) 5, "数据处理中"),
REVIEW_FAIL((byte) 6, "审核提交失败"); REVIEW_FAIL((byte) 6, "数据处理失败");
private final Byte value; private final Byte value;
private final String name; private final String name;
......
package cn.com.glsx.dj.goods.listing.enums;
/**
* 上架模式
*/
public enum ShelfModelEnum {
/**
* 特殊商品上架
*/
SPECIAL_SHELF((byte)1,"特殊商品上架"),
/**
* 常规商品上架
*/
ORDINARY_SHELF((byte)2,"常规商品上架")
;
private byte value;
private String displayName;
ShelfModelEnum(Byte value, String displayName) {
this.value = value;
this.displayName = displayName;
}
public byte getValue() {
return value;
}
public String getDisplayName() {
return displayName;
}
public static ShelfModelEnum getByValue(Byte value){
if (value != null) {
for (ShelfModelEnum temp : ShelfModelEnum.values()) {
if (temp.getValue() == value.byteValue()) {
return temp;
}
}
}
return null;
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.goods.listing.enums;
/**
* 类型(上架方式)
*/
public enum ShelfStyleEnum {
/**
* 新增
*/
ADD((byte)1,"新增"),
/**
* 修改
*/
UPDATE((byte)2,"修改")
;
private byte value;
private String displayName;
ShelfStyleEnum(Byte value, String displayName) {
this.value = value;
this.displayName = displayName;
}
public byte getValue() {
return value;
}
public String getDisplayName() {
return displayName;
}
public static ShelfStyleEnum getByValue(Byte value){
if (value != null) {
for (ShelfStyleEnum temp : ShelfStyleEnum.values()) {
if (temp.getValue() == value.byteValue()) {
return temp;
}
}
}
return null;
}
}
\ No newline at end of file \ No newline at end of file
...@@ -123,4 +123,18 @@ public class GoodsListingApproval implements Serializable { ...@@ -123,4 +123,18 @@ public class GoodsListingApproval implements Serializable {
@ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)") @ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)")
@Column(name = "deleted_flag") @Column(name = "deleted_flag")
private String deletedFlag; private String deletedFlag;
/**
* 上架模式 1-特殊商品上架 2-常规商品上架
*/
@ApiModelProperty(name = "shelfModel", notes = "上架模式 1-特殊商品上架 2-常规商品上架")
@Column(name = "shelf_model")
private Byte shelfModel;
/**
* 上架商品excel文件url
*/
@ApiModelProperty(name = "onShelvesExcel", notes = "上架商品excel文件url")
@Column(name = "on_shelves_excel")
private String onShelvesExcel;
} }
\ No newline at end of file \ No newline at end of file
...@@ -160,6 +160,20 @@ public class GoodsListingBaseRule implements Serializable { ...@@ -160,6 +160,20 @@ public class GoodsListingBaseRule implements Serializable {
private Date updatedDate; private Date updatedDate;
/** /**
* 管理层市场费是否前置:是-Y 否-N
*/
@ApiModelProperty(name = "managementMarketingFeesPrerequisite", notes = "管理层市场费是否前置:是-Y 否-N")
@Column(name = "management_marketing_fees_prerequisite")
private String managementMarketingFeesPrerequisite;
/**
* 一线阳光是否前置:是-Y 否-N
*/
@ApiModelProperty(name = "firstLineSunshinePrerequisite", notes = "一线阳光是否前置:是-Y 否-N")
@Column(name = "first_line_sunshine_prerequisite")
private String firstLineSunshinePrerequisite;
/**
* 删除标示(D:已删除;N:未删除) * 删除标示(D:已删除;N:未删除)
*/ */
@ApiModelProperty(name = "deletedFlag", notes = "删除标示(D:已删除;N:未删除)") @ApiModelProperty(name = "deletedFlag", notes = "删除标示(D:已删除;N:未删除)")
......
package cn.com.glsx.dj.goods.listing.model; package cn.com.glsx.dj.goods.listing.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -11,6 +8,10 @@ import lombok.NoArgsConstructor; ...@@ -11,6 +8,10 @@ import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@ApiModel(value = "GoodsListingGoodsTypeGroup", description = "商品上架商品类型分组") @ApiModel(value = "GoodsListingGoodsTypeGroup", description = "商品上架商品类型分组")
@Table(name = "dj_car_life_goods_listing_goods_type_group") @Table(name = "dj_car_life_goods_listing_goods_type_group")
@Data @Data
...@@ -62,6 +63,13 @@ public class GoodsListingGoodsTypeGroup implements Serializable { ...@@ -62,6 +63,13 @@ public class GoodsListingGoodsTypeGroup implements Serializable {
private Byte categoryType; private Byte categoryType;
/** /**
* 对账品类分组关联的分账品类分组id
*/
@ApiModelProperty(name = "relationDivId", notes = "对账品类分组关联的财务品类分组id")
@Column(name = "relation_div_id")
private Integer relationDivId;
/**
* 创建人 * 创建人
*/ */
@ApiModelProperty(name = "createdBy", notes = "创建人") @ApiModelProperty(name = "createdBy", notes = "创建人")
......
...@@ -222,6 +222,27 @@ public class GoodsListingProductBase implements Serializable { ...@@ -222,6 +222,27 @@ public class GoodsListingProductBase implements Serializable {
private Date updatedDate; private Date updatedDate;
/** /**
* 类型(上架方式):1-新增 2-修改
*/
@ApiModelProperty(name = "shelfStyle", notes = "类型(上架方式):1-新增 2-修改")
@Column(name = "shelf_style")
private Byte shelfStyle;
/**
* 原上架ID(原商户商品编码)
*/
@ApiModelProperty(name = "oldMerchantGoodsCode", notes = "原上架ID(原商户商品编码)")
@Column(name = "old_merchant_goods_code")
private String oldMerchantGoodsCode;
/**
* 是否作为赠送成本:是-Y 否-N
*/
@ApiModelProperty(name = "isGiftCost", notes = "是否作为赠送成本:是-Y 否-N")
@Column(name = "is_gift_cost")
private String isGiftCost;
/**
* 删除标识(D:已删除;N:未删除) * 删除标识(D:已删除;N:未删除)
*/ */
@ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)") @ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)")
......
...@@ -178,6 +178,35 @@ public class GoodsListingProductDetail implements Serializable { ...@@ -178,6 +178,35 @@ public class GoodsListingProductDetail implements Serializable {
private Date updatedDate; private Date updatedDate;
/** /**
* 服务项目
*/
@ApiModelProperty(name = "serviceItem", notes = "服务项目")
@Column(name = "service_item")
private String serviceItem;
/**
* 服务项目id
*/
@ApiModelProperty(name = "serviceItemId", notes = "服务项目id")
@Column(name = "service_item_id")
private Integer serviceItemId;
/**
* 产品成本获取方式 1-自定义成本 2-默认带入产品成本
*/
@ApiModelProperty(name = "upgradeProductCostStyle", notes = "产品成本获取方式 1-自定义成本 2-默认带入产品成本")
@Column(name = "upgrade_product_cost_style")
private Byte upgradeProductCostStyle;
/**
* 第三方成本获取方式 1-自定义成本 2-默认带入产品成本
*/
@ApiModelProperty(name = "thirdPartyCostStyle", notes = "第三方成本获取方式 1-自定义成本 2-默认带入产品成本")
@Column(name = "third_party_cost_style")
private Byte thirdPartyCostStyle;
/**
* 删除标识(D:已删除;N:未删除) * 删除标识(D:已删除;N:未删除)
*/ */
@ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)") @ApiModelProperty(name = "deletedFlag", notes = "删除标识(D:已删除;N:未删除)")
......
package cn.com.glsx.dj.goods.listing.remote; package cn.com.glsx.dj.goods.listing.remote;
import java.util.List; import cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalBaseInfoDTO;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalDTO; import cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalDTO;
import cn.com.glsx.dj.goods.listing.model.GoodsListingApproval; import cn.com.glsx.dj.goods.listing.model.GoodsListingApproval;
import cn.com.glsx.dj.goods.listing.model.GoodsListingLog; import cn.com.glsx.dj.goods.listing.model.GoodsListingLog;
...@@ -16,6 +12,10 @@ import cn.com.glsx.framework.core.annotation.ApiService; ...@@ -16,6 +12,10 @@ import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiService(value="商品上架审批接口", owner="zhoulm") @ApiService(value="商品上架审批接口", owner="zhoulm")
public interface GoodsListingApprovalRemote { public interface GoodsListingApprovalRemote {
...@@ -29,7 +29,7 @@ public interface GoodsListingApprovalRemote { ...@@ -29,7 +29,7 @@ public interface GoodsListingApprovalRemote {
@ApiMethod("凭UUID查询商品上架审批详情") @ApiMethod("凭UUID查询商品上架审批详情")
@ApiParam(name = "uuid", notes = "异步任务唯一标识UUID", dataType = ApiParam.DataTypeEnum.STRING, required = true) @ApiParam(name = "uuid", notes = "异步任务唯一标识UUID", dataType = ApiParam.DataTypeEnum.STRING, required = true)
RpcResponse<GoodsListingApproval> getByUuid(@NotBlank String uuid); RpcResponse<GoodsListingApprovalBaseInfoDTO> getByUuid(@NotBlank String uuid);
@ApiMethod("查询商品上架日志列表") @ApiMethod("查询商品上架日志列表")
@ApiParam(name = "businessCode", notes = "单据编号", dataType = ApiParam.DataTypeEnum.STRING, required = true) @ApiParam(name = "businessCode", notes = "单据编号", dataType = ApiParam.DataTypeEnum.STRING, required = true)
......
...@@ -16,4 +16,9 @@ public interface GoodsListingSubmitRemote { ...@@ -16,4 +16,9 @@ public interface GoodsListingSubmitRemote {
@ApiParam(name = "submitDTO", notes = "商品上架提交参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true) @ApiParam(name = "submitDTO", notes = "商品上架提交参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("异步任务UUID") @ApiResponse("异步任务UUID")
RpcResponse<String> save(@NotNull GoodsListingSubmitDTO submitDTO); RpcResponse<String> save(@NotNull GoodsListingSubmitDTO submitDTO);
@ApiMethod("常规商品上架提交")
@ApiParam(name = "submitDTO", notes = "常规商品上架提交参数", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("异步任务UUID")
RpcResponse<String> saveOrdinary(@NotNull GoodsListingSubmitDTO submitDTO);
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>
<skipTests>true</skipTests> <skipTests>true</skipTests>
<goods-listing.api.version>1.0.0-SNAPSHOT</goods-listing.api.version> <goods-listing.api.version>1.1.0-SNAPSHOT</goods-listing.api.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
...@@ -44,7 +44,13 @@ ...@@ -44,7 +44,13 @@
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-smartcarlife-api</artifactId> <artifactId>rpc-dj-smartcarlife-api</artifactId>
<version>5.8.0-SNAPSHOT</version> <version>5.8.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.com.glsx.dj.strategy</groupId>
<artifactId>rpc-dj-strategy-api</artifactId>
<version>5.8.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
package cn.com.glsx.dj.goods.listing.config; package cn.com.glsx.dj.goods.listing.config;
import cn.com.glsx.dj.smartcarlife.remote.*;
import cn.com.glsx.dj.strategy.remote.MarketingGoodsRemote;
import cn.com.glsx.dj.strategy.remote.MarketingPackageRemote;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import cn.com.glsx.dj.smartcarlife.remote.MerchantSettleDistributeRuleRemote;
import cn.com.glsx.dj.smartcarlife.remote.MerchantStoreInfoRemote;
import cn.com.glsx.dj.smartcarlife.remote.PaymentChannelRemote;
import cn.com.glsx.dj.smartcarlife.remote.UpgradeGoodsRemote;
import cn.com.glsx.dj.smartcarlife.remote.GoodsListingRemote;
import cn.com.glsx.dj.smartcarlife.remote.MerchantGoodsInfoRemote;
/** /**
* 商品上架提交流程依赖的车生活远程服务。 * 商品上架提交流程依赖的车生活远程服务。
*/ */
...@@ -31,6 +27,11 @@ public class SmartcarlifeDubboConfig extends DubboConfig { ...@@ -31,6 +27,11 @@ public class SmartcarlifeDubboConfig extends DubboConfig {
} }
@Bean @Bean
public MerchantReconciliationRuleRemote merchantReconciliationRuleRemote() {
return factory.builder(MerchantReconciliationRuleRemote.class).check(check).version("1.0.0").timeout(timeout).build();
}
@Bean
public GoodsListingRemote goodsListingRemote() { public GoodsListingRemote goodsListingRemote() {
return factory.builder(GoodsListingRemote.class).check(check).protocol("dubbo").version("1.0.0").timeout(60000 * 30).retries(0).build(); return factory.builder(GoodsListingRemote.class).check(check).protocol("dubbo").version("1.0.0").timeout(60000 * 30).retries(0).build();
} }
...@@ -45,4 +46,24 @@ public class SmartcarlifeDubboConfig extends DubboConfig { ...@@ -45,4 +46,24 @@ public class SmartcarlifeDubboConfig extends DubboConfig {
return factory.builder(MerchantGoodsInfoRemote.class).check(check).version("1.0.0").timeout(timeout).build(); return factory.builder(MerchantGoodsInfoRemote.class).check(check).version("1.0.0").timeout(timeout).build();
} }
@Bean
public MerchantPackageGoodsInfoRemote merchantPackageGoodsInfoRemote() {
return factory.builder(MerchantPackageGoodsInfoRemote.class).check(check).version("1.0.0").timeout(timeout).build();
}
@Bean
public MarketingGoodsRemote marketingGoodsRemote(){
return factory.builder(MarketingGoodsRemote.class).check(check).timeout(timeout).build();
}
@Bean
public MarketingPackageRemote marketingPackageRemote(){
return factory.builder(MarketingPackageRemote.class).check(check).timeout(timeout).build();
}
@Bean
public ConstructionRemote constructionRemote(){
return factory.builder(ConstructionRemote.class).check(check).version("1.0.0").timeout(timeout).build();
}
} }
package cn.com.glsx.dj.goods.listing.constant; package cn.com.glsx.dj.goods.listing.constant;
import cn.com.glsx.dj.smartcarlife.enums.FeeCategoryEnum;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import cn.com.glsx.dj.smartcarlife.enums.FeeCategoryEnum;
/** /**
* *
* @Title CommonConstants * @Title CommonConstants
...@@ -83,13 +83,20 @@ public class CommonConstants { ...@@ -83,13 +83,20 @@ public class CommonConstants {
public static final String SPECIFICATION_SEPARATOR = ";~;"; public static final String SPECIFICATION_SEPARATOR = ";~;";
public static final String STOCK_INSUFFICIENT = "库存不足"; public static final String STOCK_INSUFFICIENT = "库存不足";
/** 商品上架分账配置费用类目 **/ /** 修改商品上架分账配置费用类目 **/
public static final List<Integer> GOODS_LISTING_DIVISION_EXPENSECATEGORY_IDS = Arrays.asList( public static final List<Integer> GOODS_LISTING_DIVISION_EXPENSECATEGORY_IDS = Arrays.asList(
FeeCategoryEnum.TRAFFIC_FEE.getValue(), FeeCategoryEnum.TRAFFIC_FEE.getValue(),
FeeCategoryEnum.SERVICE_PROVIDER_PROFIT_SHARING.getValue(), FeeCategoryEnum.SERVICE_PROVIDER_PROFIT_SHARING.getValue(),
FeeCategoryEnum.PARTNER_SETTLE_RESOURCE_FEE.getValue(), FeeCategoryEnum.PARTNER_SETTLE_RESOURCE_FEE.getValue(),
FeeCategoryEnum.SETTLE_OTHER_FEE.getValue() FeeCategoryEnum.SETTLE_OTHER_FEE.getValue()
); );
/** 下一步/上一步商品上架分账配置费用类目 **/
public static final List<Integer> STEP_GOODS_LISTING_DIVISION_EXPENSECATEGORY_IDS = Arrays.asList(
FeeCategoryEnum.TRAFFIC_FEE.getValue(),
FeeCategoryEnum.SERVICE_PROVIDER_PROFIT_SHARING.getValue(),
FeeCategoryEnum.PARTNER_SETTLE_RESOURCE_FEE.getValue(),
FeeCategoryEnum.SETTLE_OTHER_FEE.getValue()
);
/** 商品上架精品升级场景分账设置费用类目**/ /** 商品上架精品升级场景分账设置费用类目**/
public static final List<Integer> GOODS_LISTING_SCENE1_DISTRIBUTION_EXPENSECATEGORY_IDS = Arrays.asList( public static final List<Integer> GOODS_LISTING_SCENE1_DISTRIBUTION_EXPENSECATEGORY_IDS = Arrays.asList(
FeeCategoryEnum.TRAFFIC_FEE.getValue(), FeeCategoryEnum.TRAFFIC_FEE.getValue(),
...@@ -97,7 +104,7 @@ public class CommonConstants { ...@@ -97,7 +104,7 @@ public class CommonConstants {
FeeCategoryEnum.PARTNER_SETTLE_RESOURCE_FEE.getValue(), FeeCategoryEnum.PARTNER_SETTLE_RESOURCE_FEE.getValue(),
FeeCategoryEnum.SETTLE_OTHER_FEE.getValue(), FeeCategoryEnum.SETTLE_OTHER_FEE.getValue(),
FeeCategoryEnum.PRODUCT_COST.getValue(), FeeCategoryEnum.PRODUCT_COST.getValue(),
FeeCategoryEnum.RECOVERY_COST.getValue(), // FeeCategoryEnum.RECOVERY_COST.getValue(),
FeeCategoryEnum.HANDLING_FEE.getValue() FeeCategoryEnum.HANDLING_FEE.getValue()
); );
......
...@@ -18,4 +18,7 @@ public interface GoodsListingProductBaseMapper extends OreMapper<GoodsListingPro ...@@ -18,4 +18,7 @@ public interface GoodsListingProductBaseMapper extends OreMapper<GoodsListingPro
List<GoodsListingProductBaseDTO> list(GoodsListingProductBaseDTO condition); List<GoodsListingProductBaseDTO> list(GoodsListingProductBaseDTO condition);
int countProfitRateNotCalFinish(GoodsListingProductBaseDTO condition); int countProfitRateNotCalFinish(GoodsListingProductBaseDTO condition);
int updateProfitRateCalFinishStart(GoodsListingProductBaseDTO record);
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.goods.listing.mapper.old;
import cn.com.glsx.dj.smartcarlife.model.GoodsInfo;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper
public interface GoodsInfoMapper extends OreMapper<GoodsInfo> {
}
package cn.com.glsx.dj.goods.listing.mapper.old;
import cn.com.glsx.dj.smartcarlife.model.GoodsReviewLog;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper
public interface GoodsReviewLogMapper extends OreMapper<GoodsReviewLog> {
}
...@@ -6,4 +6,10 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper; ...@@ -6,4 +6,10 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper @Mapper
public interface SmartcarMerchantGoodsInfoMapper extends OreMapper<MerchantGoodsInfo> { public interface SmartcarMerchantGoodsInfoMapper extends OreMapper<MerchantGoodsInfo> {
/**
* 商品上架单店修改原地更新专用。
* 不能使用updateByPrimaryKeySelective,否则封装对象中需要清空的字段会被跳过。
*/
int updateListingInPlace(MerchantGoodsInfo goodsInfo);
} }
...@@ -6,4 +6,10 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper; ...@@ -6,4 +6,10 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper @Mapper
public interface SmartcarMerchantPackageGoodsInfoMapper extends OreMapper<MerchantPackageGoodsInfo> { public interface SmartcarMerchantPackageGoodsInfoMapper extends OreMapper<MerchantPackageGoodsInfo> {
/**
* 商品上架单店修改套餐原地更新专用。
* 固定更新指定字段,允许把模板中已清空的字段同步更新为null。
*/
int updateListingInPlace(MerchantPackageGoodsInfo packageInfo);
} }
package cn.com.glsx.dj.goods.listing.mapper.old;
import cn.com.glsx.dj.smartcarlife.model.UpgradeGoods;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
/**
* @author chenx
*/
@Mapper
public interface UpgradeGoodsMapper extends OreMapper<UpgradeGoods> {
}
package cn.com.glsx.dj.goods.listing.remote; package cn.com.glsx.dj.goods.listing.remote;
import java.util.List; import cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalBaseInfoDTO;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalDTO; import cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalDTO;
import cn.com.glsx.dj.goods.listing.model.GoodsListingApproval; import cn.com.glsx.dj.goods.listing.model.GoodsListingApproval;
import cn.com.glsx.dj.goods.listing.model.GoodsListingLog; import cn.com.glsx.dj.goods.listing.model.GoodsListingLog;
...@@ -19,6 +12,12 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination; ...@@ -19,6 +12,12 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
@DubboService(version = "1.0.0",validation = "true") @DubboService(version = "1.0.0",validation = "true")
@Slf4j @Slf4j
public class GoodsListingApprovalRemoteImpl implements GoodsListingApprovalRemote { public class GoodsListingApprovalRemoteImpl implements GoodsListingApprovalRemote {
...@@ -51,7 +50,7 @@ public class GoodsListingApprovalRemoteImpl implements GoodsListingApprovalRemot ...@@ -51,7 +50,7 @@ public class GoodsListingApprovalRemoteImpl implements GoodsListingApprovalRemot
} }
@Override @Override
public RpcResponse<GoodsListingApproval> getByUuid(@NotBlank String uuid) { public RpcResponse<GoodsListingApprovalBaseInfoDTO> getByUuid(@NotBlank String uuid) {
try{ try{
return RpcResponse.success(goodsListingApprovalService.getByUuid(uuid)); return RpcResponse.success(goodsListingApprovalService.getByUuid(uuid));
} catch(Exception e) { } catch(Exception e) {
......
package cn.com.glsx.dj.goods.listing.remote; package cn.com.glsx.dj.goods.listing.remote;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import cn.com.glsx.dj.goods.listing.dto.GoodsListingSubmitDTO; import cn.com.glsx.dj.goods.listing.dto.GoodsListingSubmitDTO;
import cn.com.glsx.dj.goods.listing.service.GoodsListingSubmitService; import cn.com.glsx.dj.goods.listing.service.GoodsListingSubmitService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j @Slf4j
@DubboService(validation = "true", version = "1.0.0") @DubboService(validation = "true", version = "1.0.0")
...@@ -25,4 +24,14 @@ public class GoodsListingSubmitRemoteImpl implements GoodsListingSubmitRemote { ...@@ -25,4 +24,14 @@ public class GoodsListingSubmitRemoteImpl implements GoodsListingSubmitRemote {
return RpcResponse.error(e); return RpcResponse.error(e);
} }
} }
@Override
public RpcResponse<String> saveOrdinary(GoodsListingSubmitDTO submitDTO) {
try {
return RpcResponse.success(goodsListingSubmitService.saveOrdinary(submitDTO));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
} }
package cn.com.glsx.dj.goods.listing.service; package cn.com.glsx.dj.goods.listing.service;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import cn.com.glsx.dj.goods.listing.dto.SaveDivisionBaseRuleDTO; import cn.com.glsx.dj.goods.listing.dto.SaveDivisionBaseRuleDTO;
import cn.com.glsx.dj.goods.listing.dto.SaveReconciliationBaseRuleDTO; import cn.com.glsx.dj.goods.listing.dto.SaveReconciliationBaseRuleDTO;
import cn.com.glsx.dj.goods.listing.mapper.GoodsListingBaseRuleMapper; import cn.com.glsx.dj.goods.listing.mapper.GoodsListingBaseRuleMapper;
...@@ -17,6 +10,12 @@ import cn.com.glsx.framework.core.enums.DefaultErrorEnum; ...@@ -17,6 +10,12 @@ import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert; import cn.com.glsx.framework.core.util.RpcAssert;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Service @Service
@Slf4j @Slf4j
...@@ -83,6 +82,8 @@ public class GoodsListingBaseRuleService { ...@@ -83,6 +82,8 @@ public class GoodsListingBaseRuleService {
GoodsListingBaseRule goodsListingBaseRule = getByBusinessCode(dto.getBusinessCode()); GoodsListingBaseRule goodsListingBaseRule = getByBusinessCode(dto.getBusinessCode());
goodsListingBaseRule.setFirstLineSunshineOnlinePointsFlag(dto.getFirstLineSunshineOnlinePointsFlag()); goodsListingBaseRule.setFirstLineSunshineOnlinePointsFlag(dto.getFirstLineSunshineOnlinePointsFlag());
goodsListingBaseRule.setFirstLineSunshine2OnlinePointsFlag(dto.getFirstLineSunshine2OnlinePointsFlag()); goodsListingBaseRule.setFirstLineSunshine2OnlinePointsFlag(dto.getFirstLineSunshine2OnlinePointsFlag());
goodsListingBaseRule.setManagementMarketingFeesPrerequisite(dto.getManagementMarketingFeesPrerequisite());
goodsListingBaseRule.setFirstLineSunshinePrerequisite(dto.getFirstLineSunshinePrerequisite());
goodsListingBaseRule.setUpdatedBy(dto.getUpdatedBy()); goodsListingBaseRule.setUpdatedBy(dto.getUpdatedBy());
goodsListingBaseRule.setUpdatedDate(new Date()); goodsListingBaseRule.setUpdatedDate(new Date());
goodsListingBaseRuleMapper.updateByPrimaryKey(goodsListingBaseRule); goodsListingBaseRuleMapper.updateByPrimaryKey(goodsListingBaseRule);
......
...@@ -65,8 +65,12 @@ public class GoodsListingReconciliationRuleService { ...@@ -65,8 +65,12 @@ public class GoodsListingReconciliationRuleService {
} }
} }
/**
* 复制旧对账规则到新规则时,排除本次修改的旧上架ID,避免拆分后的新规则继续命中旧商品/旧套餐。
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void copyOld(MerchantReconciliationRule newReconciliationRule, DivisionRuleEffectRecord divisionRuleEffectRecord) { public void copyOld(MerchantReconciliationRule newReconciliationRule, DivisionRuleEffectRecord divisionRuleEffectRecord,
Set<String> excludeMerchantGoodsCodes, Set<String> excludePackageCodes) {
try { try {
// DivisionRuleEffectRecord divisionRuleEffectRecord = getByEffectDate(newReconciliationRule.getMerchantId(), newReconciliationRule.getBaseSceneCode()); // DivisionRuleEffectRecord divisionRuleEffectRecord = getByEffectDate(newReconciliationRule.getMerchantId(), newReconciliationRule.getBaseSceneCode());
if(Objects.isNull(divisionRuleEffectRecord)) { if(Objects.isNull(divisionRuleEffectRecord)) {
...@@ -85,6 +89,13 @@ public class GoodsListingReconciliationRuleService { ...@@ -85,6 +89,13 @@ public class GoodsListingReconciliationRuleService {
if(CollectionUtils.isEmpty(oldReconciliationGroupRuleList)) { if(CollectionUtils.isEmpty(oldReconciliationGroupRuleList)) {
return ; return ;
} }
// 过滤后没有剩余商品关系的旧对账组不再复制,避免生成空对账组。
oldReconciliationGroupRuleList = oldReconciliationGroupRuleList.stream()
.filter(item -> hasCopyableRelations(item.getId(), excludeMerchantGoodsCodes, excludePackageCodes))
.collect(Collectors.toList());
if(CollectionUtils.isEmpty(oldReconciliationGroupRuleList)) {
return ;
}
List<MerchantGoodsTypeGroupReconciliationRule> newGroupRuleList = new ArrayList<>(); List<MerchantGoodsTypeGroupReconciliationRule> newGroupRuleList = new ArrayList<>();
for(MerchantGoodsTypeGroupReconciliationRule item : oldReconciliationGroupRuleList) { for(MerchantGoodsTypeGroupReconciliationRule item : oldReconciliationGroupRuleList) {
...@@ -144,8 +155,15 @@ public class GoodsListingReconciliationRuleService { ...@@ -144,8 +155,15 @@ public class GoodsListingReconciliationRuleService {
List<GoodsTypeGroupRelation> oldGoodsTypeGroupRelationList = smartcarGoodsTypeGroupRelationMapper.select(GoodsTypeGroupRelation.builder() List<GoodsTypeGroupRelation> oldGoodsTypeGroupRelationList = smartcarGoodsTypeGroupRelationMapper.select(GoodsTypeGroupRelation.builder()
.goodsTypeGroupRuleId(oldGoodsTypeGroupRuleId) .goodsTypeGroupRuleId(oldGoodsTypeGroupRuleId)
.ruleType(RuleTypeEnum.RECONCILIATION_RULE.getValue()) .ruleType(RuleTypeEnum.RECONCILIATION_RULE.getValue())
.deletedFlag(DeletedFlagEnum.N.name())
.build()); .build());
if(CollectionUtils.isNotEmpty(oldGoodsTypeGroupRelationList)) { if(CollectionUtils.isNotEmpty(oldGoodsTypeGroupRelationList)) {
oldGoodsTypeGroupRelationList = oldGoodsTypeGroupRelationList.stream()
// 旧商品/旧套餐关系不复制,新规则只保留未修改商品的历史关系。
.filter(item -> !isExcludedRelation(item, excludeMerchantGoodsCodes, excludePackageCodes))
.collect(Collectors.toList());
}
if(CollectionUtils.isNotEmpty(oldGoodsTypeGroupRelationList)) {
for(GoodsTypeGroupRelation relation : oldGoodsTypeGroupRelationList) { for(GoodsTypeGroupRelation relation : oldGoodsTypeGroupRelationList) {
GoodsTypeGroupRelation newRelation = GoodsTypeGroupRelation.builder() GoodsTypeGroupRelation newRelation = GoodsTypeGroupRelation.builder()
.ruleType(relation.getRuleType()).goodsTypeGroupRuleId(newGoodsTypeGroupRuleId) .ruleType(relation.getRuleType()).goodsTypeGroupRuleId(newGoodsTypeGroupRuleId)
...@@ -190,6 +208,33 @@ public class GoodsListingReconciliationRuleService { ...@@ -190,6 +208,33 @@ public class GoodsListingReconciliationRuleService {
} }
} }
private boolean hasCopyableRelations(Integer goodsTypeGroupRuleId, Set<String> excludeMerchantGoodsCodes,
Set<String> excludePackageCodes) {
if(goodsTypeGroupRuleId == null) {
return false;
}
List<GoodsTypeGroupRelation> list = smartcarGoodsTypeGroupRelationMapper.select(GoodsTypeGroupRelation.builder()
.goodsTypeGroupRuleId(goodsTypeGroupRuleId)
.ruleType(RuleTypeEnum.RECONCILIATION_RULE.getValue())
.deletedFlag(DeletedFlagEnum.N.name())
.build());
if(CollectionUtils.isEmpty(list)) {
return false;
}
return list.stream().anyMatch(item -> !isExcludedRelation(item, excludeMerchantGoodsCodes, excludePackageCodes));
}
private boolean isExcludedRelation(GoodsTypeGroupRelation relation, Set<String> excludeMerchantGoodsCodes,
Set<String> excludePackageCodes) {
if(relation == null) {
return false;
}
return (CollectionUtils.isNotEmpty(excludeMerchantGoodsCodes)
&& excludeMerchantGoodsCodes.contains(relation.getMerchantGoodsCode()))
|| (CollectionUtils.isNotEmpty(excludePackageCodes)
&& excludePackageCodes.contains(relation.getPackageCode()));
}
public void validConfirmStep(GoodsListingApproval goodsListingApproval) { public void validConfirmStep(GoodsListingApproval goodsListingApproval) {
try { try {
List<GoodsListingExpenseCategoryRule> allExpenseCategoryRuleList = goodsListingExpenseCategoryRuleService.listByBusinessCode(goodsListingApproval.getBusinessCode()); List<GoodsListingExpenseCategoryRule> allExpenseCategoryRuleList = goodsListingExpenseCategoryRuleService.listByBusinessCode(goodsListingApproval.getBusinessCode());
......
...@@ -101,7 +101,8 @@ public class GoodsListingSettleRuleService { ...@@ -101,7 +101,8 @@ public class GoodsListingSettleRuleService {
*/ */
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public void copyOld(MerchantSettleAccountRule newSettleRule, MerchantDivisionRule newDivisionRule, public void copyOld(MerchantSettleAccountRule newSettleRule, MerchantDivisionRule newDivisionRule,
DivisionRuleEffectRecord effectRecord, GoodsListingBaseRule baseRule, GoodsListingMerchantRef merchantRef) { DivisionRuleEffectRecord effectRecord, GoodsListingBaseRule baseRule, GoodsListingMerchantRef merchantRef,
Set<String> excludeMerchantGoodsCodes, Set<String> excludePackageCodes) {
try { try {
// DivisionRuleEffectRecord effectRecord = getByEffectDate(newSettleRule.getMerchantId(), newSettleRule.getBaseSceneCode()); // DivisionRuleEffectRecord effectRecord = getByEffectDate(newSettleRule.getMerchantId(), newSettleRule.getBaseSceneCode());
if(Objects.isNull(effectRecord)) { if(Objects.isNull(effectRecord)) {
...@@ -122,7 +123,9 @@ public class GoodsListingSettleRuleService { ...@@ -122,7 +123,9 @@ public class GoodsListingSettleRuleService {
: listOldDivisionGroupRules(oldDivisionRule.getId()); : listOldDivisionGroupRules(oldDivisionRule.getId());
Set<Integer> oldGoodsTypeGroupIds = collectOldGoodsTypeGroupIds(oldSettleGroupRuleList, oldDivisionGroupRuleList); Set<Integer> oldGoodsTypeGroupIds = collectOldGoodsTypeGroupIds(oldSettleGroupRuleList, oldDivisionGroupRuleList);
Map<Integer, GoodsTypeGroup> oldGoodsTypeGroupMap = listOldGoodsTypeGroupMap(oldGoodsTypeGroupIds); Map<Integer, GoodsTypeGroup> oldGoodsTypeGroupMap = listOldGoodsTypeGroupMap(oldGoodsTypeGroupIds);
Map<Integer, List<GoodsTypeGroupRelation>> oldGoodsTypeGroupRelationMap = listOldGoodsTypeGroupRelationMap(oldGoodsTypeGroupIds); // 复制旧规则给新规则时先过滤本次修改的旧上架ID,修改商品只走Excel生成的新规则。
Map<Integer, List<GoodsTypeGroupRelation>> oldGoodsTypeGroupRelationMap = listOldGoodsTypeGroupRelationMap(oldGoodsTypeGroupIds,
excludeMerchantGoodsCodes, excludePackageCodes);
Map<Integer, List<MerchantExpenseCategoryRule>> oldExpenseCategoryRuleMap = listOldExpenseCategoryRuleMap(oldSettleGroupRuleList); Map<Integer, List<MerchantExpenseCategoryRule>> oldExpenseCategoryRuleMap = listOldExpenseCategoryRuleMap(oldSettleGroupRuleList);
Map<Integer, List<MerchantDistributionRule>> oldDistributionRuleMap = listOldDistributionRuleMap(oldDivisionGroupRuleList); Map<Integer, List<MerchantDistributionRule>> oldDistributionRuleMap = listOldDistributionRuleMap(oldDivisionGroupRuleList);
// 财务规则和分账规则引用的是同一个业务品类组。 // 财务规则和分账规则引用的是同一个业务品类组。
...@@ -190,11 +193,17 @@ public class GoodsListingSettleRuleService { ...@@ -190,11 +193,17 @@ public class GoodsListingSettleRuleService {
List<Integer> oldGoodsTypeGroupRuleIds = new ArrayList<>(); List<Integer> oldGoodsTypeGroupRuleIds = new ArrayList<>();
List<MerchantGoodsTypeGroupSettleRule> copiedSettleGroupRuleList = new ArrayList<>(); List<MerchantGoodsTypeGroupSettleRule> copiedSettleGroupRuleList = new ArrayList<>();
for(MerchantGoodsTypeGroupSettleRule item : oldSettleGroupRuleList) { for(MerchantGoodsTypeGroupSettleRule item : oldSettleGroupRuleList) {
oldGoodsTypeGroupRuleIds.add(item.getId());
Integer newGoodsTypeGroupId = copyGoodsTypeGroupIfNecessary(item.getGoodsTypeGroupId(), goodsTypeGroupMap, Integer newGoodsTypeGroupId = copyGoodsTypeGroupIfNecessary(item.getGoodsTypeGroupId(), goodsTypeGroupMap,
oldGoodsTypeGroupMap, oldGoodsTypeGroupRelationMap, copiedRelationList, now, updatedBy); oldGoodsTypeGroupMap, oldGoodsTypeGroupRelationMap, copiedRelationList, now, updatedBy);
if(newGoodsTypeGroupId == null) {
continue;
}
oldGoodsTypeGroupRuleIds.add(item.getId());
copiedSettleGroupRuleList.add(buildCopiedSettleGroupRule(item, newSettleRuleId, newGoodsTypeGroupId, now, updatedBy)); copiedSettleGroupRuleList.add(buildCopiedSettleGroupRule(item, newSettleRuleId, newGoodsTypeGroupId, now, updatedBy));
} }
if(CollectionUtils.isEmpty(copiedSettleGroupRuleList)) {
return Collections.emptyMap();
}
// 财务品类规则自身ID会被费用类目引用;这里批量插入后必须校验主键回填。 // 财务品类规则自身ID会被费用类目引用;这里批量插入后必须校验主键回填。
smartcarMerchantGoodsTypeGroupSettleRuleMapper.insertList(copiedSettleGroupRuleList); smartcarMerchantGoodsTypeGroupSettleRuleMapper.insertList(copiedSettleGroupRuleList);
Map<Integer, Integer> settleGroupRuleIdMap = new HashMap<>(); Map<Integer, Integer> settleGroupRuleIdMap = new HashMap<>();
...@@ -222,11 +231,17 @@ public class GoodsListingSettleRuleService { ...@@ -222,11 +231,17 @@ public class GoodsListingSettleRuleService {
List<Integer> oldGoodsTypeGroupRuleIds = new ArrayList<>(); List<Integer> oldGoodsTypeGroupRuleIds = new ArrayList<>();
List<MerchantGoodsTypeGroupDivisionRule> copiedDivisionGroupRuleList = new ArrayList<>(); List<MerchantGoodsTypeGroupDivisionRule> copiedDivisionGroupRuleList = new ArrayList<>();
for(MerchantGoodsTypeGroupDivisionRule item : oldDivisionGroupRuleList) { for(MerchantGoodsTypeGroupDivisionRule item : oldDivisionGroupRuleList) {
oldGoodsTypeGroupRuleIds.add(item.getId());
Integer newGoodsTypeGroupId = copyGoodsTypeGroupIfNecessary(item.getGoodsTypeGroupId(), goodsTypeGroupMap, Integer newGoodsTypeGroupId = copyGoodsTypeGroupIfNecessary(item.getGoodsTypeGroupId(), goodsTypeGroupMap,
oldGoodsTypeGroupMap, oldGoodsTypeGroupRelationMap, copiedRelationList, now, updatedBy); oldGoodsTypeGroupMap, oldGoodsTypeGroupRelationMap, copiedRelationList, now, updatedBy);
if(newGoodsTypeGroupId == null) {
continue;
}
oldGoodsTypeGroupRuleIds.add(item.getId());
copiedDivisionGroupRuleList.add(buildCopiedDivisionGroupRule(item, newDivisionRuleId, newGoodsTypeGroupId, now, updatedBy)); copiedDivisionGroupRuleList.add(buildCopiedDivisionGroupRule(item, newDivisionRuleId, newGoodsTypeGroupId, now, updatedBy));
} }
if(CollectionUtils.isEmpty(copiedDivisionGroupRuleList)) {
return;
}
// 分账品类规则自身ID会被分账分配明细引用;这里批量插入后必须校验主键回填。 // 分账品类规则自身ID会被分账分配明细引用;这里批量插入后必须校验主键回填。
smartcarMerchantGoodsTypeGroupDivisionRuleMapper.insertList(copiedDivisionGroupRuleList); smartcarMerchantGoodsTypeGroupDivisionRuleMapper.insertList(copiedDivisionGroupRuleList);
for(int i = 0; i < copiedDivisionGroupRuleList.size(); i++) { for(int i = 0; i < copiedDivisionGroupRuleList.size(); i++) {
...@@ -251,6 +266,11 @@ public class GoodsListingSettleRuleService { ...@@ -251,6 +266,11 @@ public class GoodsListingSettleRuleService {
if(newGoodsTypeGroupId != null) { if(newGoodsTypeGroupId != null) {
return newGoodsTypeGroupId; return newGoodsTypeGroupId;
} }
List<GoodsTypeGroupRelation> oldRelationList = oldGoodsTypeGroupRelationMap.get(oldGoodsTypeGroupId);
if(CollectionUtils.isEmpty(oldRelationList)) {
// 本次修改的原上架ID已被过滤,旧品类组没有剩余商品/套餐关系时不再复制该组。
return null;
}
GoodsTypeGroup oldGoodsTypeGroup = oldGoodsTypeGroupMap.get(oldGoodsTypeGroupId); GoodsTypeGroup oldGoodsTypeGroup = oldGoodsTypeGroupMap.get(oldGoodsTypeGroupId);
RpcAssert.assertNotNull(oldGoodsTypeGroup, DefaultErrorEnum.SERVER_ERROR,"复制分账品类规则异常"); RpcAssert.assertNotNull(oldGoodsTypeGroup, DefaultErrorEnum.SERVER_ERROR,"复制分账品类规则异常");
GoodsTypeGroup copiedGoodsTypeGroup = buildCopiedGoodsTypeGroup(oldGoodsTypeGroup, now, updatedBy); GoodsTypeGroup copiedGoodsTypeGroup = buildCopiedGoodsTypeGroup(oldGoodsTypeGroup, now, updatedBy);
...@@ -260,7 +280,7 @@ public class GoodsListingSettleRuleService { ...@@ -260,7 +280,7 @@ public class GoodsListingSettleRuleService {
newGoodsTypeGroupId = copiedGoodsTypeGroup.getId(); newGoodsTypeGroupId = copiedGoodsTypeGroup.getId();
goodsTypeGroupMap.put(oldGoodsTypeGroupId, newGoodsTypeGroupId); goodsTypeGroupMap.put(oldGoodsTypeGroupId, newGoodsTypeGroupId);
prepareOldGoodsTypeGroupRelations(oldGoodsTypeGroupId, newGoodsTypeGroupId, prepareOldGoodsTypeGroupRelations(oldGoodsTypeGroupId, newGoodsTypeGroupId,
oldGoodsTypeGroupRelationMap.get(oldGoodsTypeGroupId), copiedRelationList, now, updatedBy); oldRelationList, copiedRelationList, now, updatedBy);
return newGoodsTypeGroupId; return newGoodsTypeGroupId;
} }
...@@ -645,7 +665,8 @@ public class GoodsListingSettleRuleService { ...@@ -645,7 +665,8 @@ public class GoodsListingSettleRuleService {
/** /**
* 批量查询旧品类组关系明细,并按旧品类组ID分组。 * 批量查询旧品类组关系明细,并按旧品类组ID分组。
*/ */
private Map<Integer, List<GoodsTypeGroupRelation>> listOldGoodsTypeGroupRelationMap(Set<Integer> oldGoodsTypeGroupIds) { private Map<Integer, List<GoodsTypeGroupRelation>> listOldGoodsTypeGroupRelationMap(Set<Integer> oldGoodsTypeGroupIds,
Set<String> excludeMerchantGoodsCodes, Set<String> excludePackageCodes) {
if(CollectionUtils.isEmpty(oldGoodsTypeGroupIds)) { if(CollectionUtils.isEmpty(oldGoodsTypeGroupIds)) {
return Collections.emptyMap(); return Collections.emptyMap();
} }
...@@ -657,9 +678,27 @@ public class GoodsListingSettleRuleService { ...@@ -657,9 +678,27 @@ public class GoodsListingSettleRuleService {
if(CollectionUtils.isEmpty(list)) { if(CollectionUtils.isEmpty(list)) {
return Collections.emptyMap(); return Collections.emptyMap();
} }
list = list.stream()
// 本次修改的旧商品/旧套餐不能复制到新规则,否则新规则会同时命中新旧上架ID。
.filter(item -> !isExcludedRelation(item, excludeMerchantGoodsCodes, excludePackageCodes))
.collect(Collectors.toList());
if(CollectionUtils.isEmpty(list)) {
return Collections.emptyMap();
}
return list.stream().collect(Collectors.groupingBy(GoodsTypeGroupRelation::getGoodsTypeGroupRuleId)); return list.stream().collect(Collectors.groupingBy(GoodsTypeGroupRelation::getGoodsTypeGroupRuleId));
} }
private boolean isExcludedRelation(GoodsTypeGroupRelation relation, Set<String> excludeMerchantGoodsCodes,
Set<String> excludePackageCodes) {
if(relation == null) {
return false;
}
return (CollectionUtils.isNotEmpty(excludeMerchantGoodsCodes)
&& excludeMerchantGoodsCodes.contains(relation.getMerchantGoodsCode()))
|| (CollectionUtils.isNotEmpty(excludePackageCodes)
&& excludePackageCodes.contains(relation.getPackageCode()));
}
/** /**
* 批量查询旧财务费用类目明细,并按旧财务品类规则ID分组。 * 批量查询旧财务费用类目明细,并按旧财务品类规则ID分组。
*/ */
...@@ -819,8 +858,8 @@ public class GoodsListingSettleRuleService { ...@@ -819,8 +858,8 @@ public class GoodsListingSettleRuleService {
} }
List<Integer> expenseCategoryIdList = expenseCategoryRuleList.stream() List<Integer> expenseCategoryIdList = expenseCategoryRuleList.stream()
.map(GoodsListingExpenseCategoryRule::getExpenseCategoryId).collect(Collectors.toList()); .map(GoodsListingExpenseCategoryRule::getExpenseCategoryId).collect(Collectors.toList());
if(!CommonConstants.GOODS_LISTING_DIVISION_EXPENSECATEGORY_IDS.containsAll(expenseCategoryIdList) || if(!CommonConstants.STEP_GOODS_LISTING_DIVISION_EXPENSECATEGORY_IDS.containsAll(expenseCategoryIdList) ||
CommonConstants.GOODS_LISTING_DIVISION_EXPENSECATEGORY_IDS.size() != expenseCategoryIdList.size()) { CommonConstants.STEP_GOODS_LISTING_DIVISION_EXPENSECATEGORY_IDS.size() != expenseCategoryIdList.size()) {
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR,"分账配置费用类目数量异常"); throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR,"分账配置费用类目数量异常");
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
<result column="shelf_model" property="shelfModel" jdbcType="TINYINT" />
</resultMap> </resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalDTO" extends="BaseResultMap"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.goods.listing.dto.GoodsListingApprovalDTO" extends="BaseResultMap">
...@@ -35,14 +36,14 @@ ...@@ -35,14 +36,14 @@
--> -->
id, business_code, uuid, shelf_type, system_status, rejected_reason, goods_create_excel, id, business_code, uuid, shelf_type, system_status, rejected_reason, goods_create_excel,
base_scene_code, confirm_step, created_by, created_date, updated_by, updated_date, base_scene_code, confirm_step, created_by, created_date, updated_by, updated_date,
deleted_flag deleted_flag, shelf_model
</sql> </sql>
<select id="list" resultMap="DTOResultMap"> <select id="list" resultMap="DTOResultMap">
select select
gla.id, gla.business_code, gla.uuid, gla.shelf_type, gla.system_status, gla.rejected_reason, gla.id, gla.business_code, gla.uuid, gla.shelf_type, gla.system_status, gla.rejected_reason,
gla.goods_create_excel, gla.base_scene_code, gla.confirm_step, gla.created_by, gla.created_date, gla.goods_create_excel, gla.base_scene_code, gla.confirm_step, gla.created_by, gla.created_date,
gla.updated_by, gla.updated_date gla.updated_by, gla.updated_date, gla.shelf_model
from dj_car_life_goods_listing_approval gla from dj_car_life_goods_listing_approval gla
<include refid="condition"></include> <include refid="condition"></include>
order by gla.id desc order by gla.id desc
...@@ -69,6 +70,9 @@ ...@@ -69,6 +70,9 @@
<if test="baseSceneCode != null and baseSceneCode !=''"> <if test="baseSceneCode != null and baseSceneCode !=''">
and gla.base_scene_code = #{baseSceneCode} and gla.base_scene_code = #{baseSceneCode}
</if> </if>
<if test="shelfModel != null">
and gla.shelf_model = #{shelfModel}
</if>
</where> </where>
</sql> </sql>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" /> <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="management_marketing_fees_prerequisite" property="managementMarketingFeesPrerequisite" jdbcType="CHAR" />
<result column="first_line_sunshine_prerequisite" property="firstLineSunshinePrerequisite" jdbcType="CHAR" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
...@@ -34,6 +36,7 @@ ...@@ -34,6 +36,7 @@
partner_merchant_divide_target, partner_merchant2_auto_divide, partner_merchant2_divide_target, partner_merchant_divide_target, partner_merchant2_auto_divide, partner_merchant2_divide_target,
other_fee_divide_target, first_line_sunshine_online_points_flag, first_line_sunshine2_online_points_flag, other_fee_divide_target, first_line_sunshine_online_points_flag, first_line_sunshine2_online_points_flag,
reality_shop_merchant_id, reality_shop_merchant_name, reality_shop_user_type, reality_shop_level, reality_shop_merchant_id, reality_shop_merchant_name, reality_shop_user_type, reality_shop_level,
created_by, created_date, updated_by, updated_date, deleted_flag created_by, created_date, updated_by, updated_date, management_marketing_fees_prerequisite,
first_line_sunshine_prerequisite, deleted_flag
</sql> </sql>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<result column="group_type" property="groupType" jdbcType="TINYINT" /> <result column="group_type" property="groupType" jdbcType="TINYINT" />
<result column="rule_type" property="ruleType" jdbcType="TINYINT" /> <result column="rule_type" property="ruleType" jdbcType="TINYINT" />
<result column="category_type" property="categoryType" jdbcType="TINYINT" /> <result column="category_type" property="categoryType" jdbcType="TINYINT" />
<result column="relation_div_id" property="relationDivId" jdbcType="INTEGER" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" /> <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" /> <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
...@@ -39,12 +40,12 @@ ...@@ -39,12 +40,12 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, business_code, group_type, rule_type, category_type, created_by, created_date, id, business_code, group_type, rule_type, category_type, relation_div_id, created_by, created_date,
updated_by, updated_date, deleted_flag updated_by, updated_date, deleted_flag
</sql> </sql>
<select id="listBase" parameterType="cn.com.glsx.dj.goods.listing.dto.GoodsListingGoodsTypeGroupDTO" resultMap="DTOResultMap"> <select id="listBase" parameterType="cn.com.glsx.dj.goods.listing.dto.GoodsListingGoodsTypeGroupDTO" resultMap="DTOResultMap">
select id, business_code, group_type, category_type from dj_car_life_goods_listing_goods_type_group select id, business_code, group_type, category_type, relation_div_id from dj_car_life_goods_listing_goods_type_group
<where> <where>
deleted_flag = 'N' deleted_flag = 'N'
<if test="businessCode != null and businessCode !=''"> <if test="businessCode != null and businessCode !=''">
...@@ -59,7 +60,7 @@ ...@@ -59,7 +60,7 @@
<select id="getDetailById" resultMap="DTOResultMap"> <select id="getDetailById" resultMap="DTOResultMap">
SELECT SELECT
glgtg.id, glgtg.business_code, glgtg.group_type, glgtg.rule_type, glgtg.category_type, glgtg.id, glgtg.business_code, glgtg.group_type, glgtg.rule_type, glgtg.category_type, glgtg.relation_div_id,
glgtgr.upgrade_goods_id,glgtgr.merchant_goods_code, glgtgr.upgrade_commodity_code, glgtgr.upgrade_goods_name, glgtgr.upgrade_goods_id,glgtgr.merchant_goods_code, glgtgr.upgrade_commodity_code, glgtgr.upgrade_goods_name,
glgtgr.goods_type, glgtgr.goods_type_name, glgtgr.package_code, glgtgr.package_name, glgtgr.goods_type, glgtgr.goods_type_name, glgtgr.package_code, glgtgr.package_name,
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" /> <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="shelf_style" property="shelfStyle" jdbcType="TINYINT" />
<result column="old_merchant_goods_code" property="oldMerchantGoodsCode" jdbcType="VARCHAR" />
<result column="is_gift_cost" property="isGiftCost" jdbcType="CHAR" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap> </resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.goods.listing.dto.GoodsListingProductBaseDTO" extends="BaseResultMap"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.goods.listing.dto.GoodsListingProductBaseDTO" extends="BaseResultMap">
...@@ -50,6 +53,10 @@ ...@@ -50,6 +53,10 @@
<result column="third_party_cost" property="thirdPartyCost" jdbcType="DECIMAL" /> <result column="third_party_cost" property="thirdPartyCost" jdbcType="DECIMAL" />
<result column="inventory_type" property="inventoryType" jdbcType="TINYINT" /> <result column="inventory_type" property="inventoryType" jdbcType="TINYINT" />
<result column="merchant_goods_code" property="merchantGoodsCode"/> <result column="merchant_goods_code" property="merchantGoodsCode"/>
<result column="service_item" property="serviceItem" jdbcType="VARCHAR" />
<result column="service_item_id" property="serviceItemId" jdbcType="INTEGER" />
<result column="upgrade_product_cost_style" property="upgradeProductCostStyle" jdbcType="TINYINT" />
<result column="third_party_cost_style" property="thirdPartyCostStyle" jdbcType="TINYINT" />
</collection> </collection>
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
...@@ -60,7 +67,7 @@ ...@@ -60,7 +67,7 @@
revenue, traffic_share_profit, service_provider_profit, dj_revenue, dj_cost, manager_market_fee, revenue, traffic_share_profit, service_provider_profit, dj_revenue, dj_cost, manager_market_fee,
manager_market_fee1, manager_market_fee2, first_line_sunshine_incentive_fee, first_line_sunshine2_incentive_fee, manager_market_fee1, manager_market_fee2, first_line_sunshine_incentive_fee, first_line_sunshine2_incentive_fee,
resource_fee, labor_cost, dj_gross_profit, profit_rate, integrity, profit_rate_cal_finish, resource_fee, labor_cost, dj_gross_profit, profit_rate, integrity, profit_rate_cal_finish,
created_by, created_date, updated_by, updated_date, deleted_flag created_by, created_date, updated_by, updated_date, shelf_style, old_merchant_goods_code, is_gift_cost, deleted_flag
</sql> </sql>
<select id="listBase" parameterType="cn.com.glsx.dj.goods.listing.model.GoodsListingProductBase" resultMap="BaseResultMap"> <select id="listBase" parameterType="cn.com.glsx.dj.goods.listing.model.GoodsListingProductBase" resultMap="BaseResultMap">
...@@ -78,10 +85,10 @@ ...@@ -78,10 +85,10 @@
<select id="getDetailById" resultMap="DTOResultMap"> <select id="getDetailById" resultMap="DTOResultMap">
select select
glpb.id, glpb.business_code, glpb.product_type, glpb.settlement_type, glpb.product_name,glpb.package_code, glpb.id, glpb.business_code, glpb.product_type, glpb.settlement_type, glpb.product_name,glpb.package_code,
glpb.package_alias,glpb.sales_proportion_percent, glpb.package_alias,glpb.sales_proportion_percent, glpb.shelf_style, glpb.old_merchant_goods_code, glpb.is_gift_cost,
glpd.upgrade_goods_id, glpd.upgrade_commodity_code, glpd.upgrade_goods_name, glpd.upgrade_goods_id, glpd.upgrade_commodity_code, glpd.upgrade_goods_name,
glpd.goods_alias, glpd.position, glpd.sell_price, glpd.min_sell_price, glpd.upgrade_product_cost, glpd.recovery_cost, glpd.goods_alias, glpd.position, glpd.sell_price, glpd.min_sell_price, glpd.upgrade_product_cost, glpd.recovery_cost,
glpd.gift_cost, glpd.third_party_cost, glpd.inventory_type,glpd.merchant_goods_code glpd.gift_cost, glpd.third_party_cost, glpd.inventory_type,glpd.merchant_goods_code, glpd.service_item, glpd.service_item_id, glpd.upgrade_product_cost_style, glpd.third_party_cost_style
from dj_car_life_goods_listing_product_base glpb from dj_car_life_goods_listing_product_base glpb
left join dj_car_life_goods_listing_product_detail glpd on glpd.product_base_id=glpb.id and glpd.deleted_flag='N' left join dj_car_life_goods_listing_product_detail glpd on glpd.product_base_id=glpb.id and glpd.deleted_flag='N'
where glpb.deleted_flag='N' and glpb.id = #{id} where glpb.deleted_flag='N' and glpb.id = #{id}
...@@ -92,7 +99,8 @@ ...@@ -92,7 +99,8 @@
id, business_code, product_type, settlement_type, product_name,package_code,package_alias, sales_proportion_percent, id, business_code, product_type, settlement_type, product_name,package_code,package_alias, sales_proportion_percent,
revenue, traffic_share_profit, service_provider_profit, dj_revenue, dj_cost, manager_market_fee, revenue, traffic_share_profit, service_provider_profit, dj_revenue, dj_cost, manager_market_fee,
manager_market_fee1, manager_market_fee2, first_line_sunshine_incentive_fee, first_line_sunshine2_incentive_fee, manager_market_fee1, manager_market_fee2, first_line_sunshine_incentive_fee, first_line_sunshine2_incentive_fee,
resource_fee, labor_cost, dj_gross_profit, profit_rate, integrity, profit_rate_cal_finish resource_fee, labor_cost, dj_gross_profit, profit_rate, integrity, profit_rate_cal_finish,
shelf_style, old_merchant_goods_code, is_gift_cost
from dj_car_life_goods_listing_product_base glpb from dj_car_life_goods_listing_product_base glpb
<include refid="listCondition"/> <include refid="listCondition"/>
order by glpb.id asc order by glpb.id asc
...@@ -124,4 +132,19 @@ ...@@ -124,4 +132,19 @@
select count(0) from dj_car_life_goods_listing_product_base select count(0) from dj_car_life_goods_listing_product_base
where deleted_flag='N' and business_code = #{businessCode} and (profit_rate_cal_finish is null or profit_rate_cal_finish !='Y') where deleted_flag='N' and business_code = #{businessCode} and (profit_rate_cal_finish is null or profit_rate_cal_finish !='Y')
</select> </select>
<update id="updateProfitRateCalFinishStart" parameterType="cn.com.glsx.dj.goods.listing.dto.GoodsListingProductBaseDTO">
update dj_car_life_goods_listing_product_base
<set>
revenue = null,traffic_share_profit = null,service_provider_profit = null,
dj_revenue = null,dj_cost = null,manager_market_fee = null,
manager_market_fee1 = null,manager_market_fee2 = null,
first_line_sunshine_incentive_fee = null,
first_line_sunshine2_incentive_fee = null,
resource_fee = null,labor_cost = null,
dj_gross_profit = null,profit_rate = null,
profit_rate_cal_finish = 'N',updated_date = NOW()
</set>
where deleted_flag ='N' and business_code = #{businessCode}
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" /> <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
<result column="service_item" property="serviceItem" jdbcType="VARCHAR" />
<result column="service_item_id" property="serviceItemId" jdbcType="INTEGER" />
<result column="upgrade_product_cost_style" property="upgradeProductCostStyle" jdbcType="TINYINT" />
<result column="third_party_cost_style" property="thirdPartyCostStyle" jdbcType="TINYINT" />
</resultMap> </resultMap>
<resultMap type="cn.com.glsx.dj.goods.listing.dto.GoodsListingProductDetailDTO" id="DTOResultMap" extends="BaseResultMap"> <resultMap type="cn.com.glsx.dj.goods.listing.dto.GoodsListingProductDetailDTO" id="DTOResultMap" extends="BaseResultMap">
<result column="product_type" property="productType"/> <result column="product_type" property="productType"/>
...@@ -42,7 +46,7 @@ ...@@ -42,7 +46,7 @@
goods_type,goods_type_name, goods_type,goods_type_name,
goods_alias, position, sell_price, min_sell_price, upgrade_product_cost, recovery_cost, goods_alias, position, sell_price, min_sell_price, upgrade_product_cost, recovery_cost,
gift_cost, third_party_cost, inventory_type, created_by, created_date, updated_by, gift_cost, third_party_cost, inventory_type, created_by, created_date, updated_by,
updated_date, deleted_flag updated_date, deleted_flag, service_item, service_item_id, upgrade_product_cost_style, third_party_cost_style
</sql> </sql>
<select id="list" parameterType="cn.com.glsx.dj.goods.listing.dto.GoodsListingProductDetailDTO" resultMap="DTOResultMap"> <select id="list" parameterType="cn.com.glsx.dj.goods.listing.dto.GoodsListingProductDetailDTO" resultMap="DTOResultMap">
...@@ -51,7 +55,7 @@ ...@@ -51,7 +55,7 @@
glpd.upgrade_commodity_code, glpd.upgrade_goods_name, glpd.goods_type,glpd.goods_type_name, glpd.upgrade_commodity_code, glpd.upgrade_goods_name, glpd.goods_type,glpd.goods_type_name,
glpd.goods_alias, glpd.position, glpd.sell_price, glpd.min_sell_price, glpd.upgrade_product_cost, glpd.recovery_cost, glpd.goods_alias, glpd.position, glpd.sell_price, glpd.min_sell_price, glpd.upgrade_product_cost, glpd.recovery_cost,
glpd.gift_cost, glpd.third_party_cost, glpd.inventory_type, glpd.created_by, glpd.created_date, glpd.updated_by, glpd.gift_cost, glpd.third_party_cost, glpd.inventory_type, glpd.created_by, glpd.created_date, glpd.updated_by,
glpd.updated_date, glpd.deleted_flag, glpd.updated_date, glpd.deleted_flag, glpd.service_item, glpd.service_item_id, glpd.upgrade_product_cost_style, glpd.third_party_cost_style,
glpb.product_type,glpb.product_name,glpb.package_code glpb.product_type,glpb.product_name,glpb.package_code
from dj_car_life_goods_listing_product_detail glpd from dj_car_life_goods_listing_product_detail glpd
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.goods.listing.mapper.old.SmartcarMerchantGoodsInfoMapper">
<update id="updateListingInPlace" parameterType="cn.com.glsx.dj.smartcarlife.model.MerchantGoodsInfo">
update dj_car_life_merchant_goods_info
set
merchant_goods_code = #{merchantGoodsCode,jdbcType=VARCHAR},
package_code = #{packageCode,jdbcType=VARCHAR},
scene_type = #{sceneType,jdbcType=TINYINT},
base_scene_code = #{baseSceneCode,jdbcType=VARCHAR},
upgrade_goods_id = #{upgradeGoodsId,jdbcType=INTEGER},
goods_alias = #{goodsAlias,jdbcType=VARCHAR},
sell_price = #{sellPrice,jdbcType=DECIMAL},
min_sell_price = #{minSellPrice,jdbcType=DECIMAL},
upgrade_product_cost = #{upgradeProductCost,jdbcType=DECIMAL},
gift_cost = #{giftCost,jdbcType=DECIMAL},
recovery_cost = #{recoveryCost,jdbcType=DECIMAL},
third_party_cost = #{thirdPartyCost,jdbcType=DECIMAL},
position = #{position,jdbcType=INTEGER},
service_item_id = #{serviceItemId,jdbcType=INTEGER},
product_cost_type = #{productCostType,jdbcType=TINYINT},
upgrade_supply_mode = #{upgradeSupplyMode,jdbcType=TINYINT},
base_product_flag = #{baseProductFlag,jdbcType=CHAR},
base_supply_mode = #{baseSupplyMode,jdbcType=TINYINT},
upgrade_product_flag = #{upgradeProductFlag,jdbcType=CHAR},
sell_price_valid_type = #{sellPriceValidType,jdbcType=TINYINT},
valid_min_sell_price = #{validMinSellPrice,jdbcType=CHAR},
status = #{status,jdbcType=TINYINT},
last_on_shelf_time = #{lastOnShelfTime,jdbcType=TIMESTAMP},
shelf_source = #{shelfSource,jdbcType=TINYINT},
finance_check_flag = #{financeCheckFlag,jdbcType=CHAR},
dj_cost = #{djCost,jdbcType=DECIMAL},
updated_by = #{updatedBy,jdbcType=VARCHAR},
updated_date = #{updatedDate,jdbcType=TIMESTAMP},
deleted_flag = #{deletedFlag,jdbcType=CHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.goods.listing.mapper.old.SmartcarMerchantPackageGoodsInfoMapper">
<update id="updateListingInPlace" parameterType="cn.com.glsx.dj.smartcarlife.model.MerchantPackageGoodsInfo">
update dj_car_life_merchant_package_goods_info
set
package_code = #{packageCode,jdbcType=VARCHAR},
package_name = #{packageName,jdbcType=VARCHAR},
package_alias = #{packageAlias,jdbcType=VARCHAR},
base_scene_code = #{baseSceneCode,jdbcType=VARCHAR},
scene_type = #{sceneType,jdbcType=TINYINT},
status = #{status,jdbcType=TINYINT},
last_on_shelf_time = #{lastOnShelfTime,jdbcType=TIMESTAMP},
finance_check_flag = #{financeCheckFlag,jdbcType=CHAR},
updated_by = #{updatedBy,jdbcType=VARCHAR},
updated_date = #{updatedDate,jdbcType=TIMESTAMP},
deleted_flag = #{deletedFlag,jdbcType=CHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
  • @wangxw1
    commented
    Master

    一、关键问题与优化建议(Top 3)

    1. 严重:Dubbo 服务提供者 Remote 接口返回值变更破坏向下兼容性

    • 问题描述:在 rpc-dj-goods-listing-api 模块的 GoodsListingApprovalRemote 接口中,已有方法 getByUuid 的返回值从 GoodsListingApproval 变更为 GoodsListingApprovalBaseInfoDTO。
    • 影响分析:触犯了分布式服务接口设计的核心禁忌。虽然不是请求参数变更,但返回值的变更同样属于危险实现。旧版本的服务消费者在反序列化该方法的结果时,会因为类型不匹配抛出反序列化异常(如 Hessian 异常)或 ClassCastException,导致线上大面积调用失败。
    • 优化建议:严禁修改已有 Dubbo 接口的签名(含入参和出参)。建议恢复原方法签名,并通过新增方法来满足新需求: ```java // 恢复原方法以保持兼容 @Deprecated RpcResponse getByUuid(@NotBlank String uuid);

    // 新增方法提供给新业务使用 @ApiMethod("凭UUID查询商品上架审批基础详情") RpcResponse getBaseInfoByUuid(@NotBlank String uuid);

    
    **2. 一般:枚举类中存在严重的代码重复(违背 DRY 原则)**
    - **问题描述**:在新增的 `CalculateStyleEnum.java` 中,`getValueByShopDisplayName`、`getValueByPartnerDisplayName` 和 `getValueByOtherFeeDisplayName` 三个方法的内部实现逻辑完全一模一样,甚至连构造的 `Arrays.asList` 列表也完全相同。
    - **影响分析**:严重违背 DRY(Don't Repeat Yourself)原则,导致代码冗余。如果未来需要增加一种计算方式,开发人员需要在多个方法中重复修改,极易遗漏并引发 Bug。
    - **优化建议**:如果当前业务逻辑确实一致,建议合并为一个通用方法;如果为了保留未来业务分化的可能性,应该抽取一个私有方法进行复用:
      ```java
      // 抽取公共私有方法
      private static Byte getValueFromList(String displayName, List<CalculateStyleEnum> list) {
          if (displayName == null) return null;
          for (CalculateStyleEnum e : list) {
              if (e.getDisplayName().equals(displayName)) return e.getValue();
          }
          return null;
      }
    
      public static Byte getValueByShopDisplayName(String displayName) {
          return getValueFromList(displayName, Arrays.asList(GROSS_RATIO, INCOME_PROPORTION, FIXED_AMOUNT, FIX_AMOUNT_WITH_PURCHASE_NUM));
      }
      // 其他两个方法同理调用 getValueFromList
    

    3. 建议:枚举类的反向查找性能与内存分配优化

    • 问题描述:在 CalculateStyleEnum、CostStyleEnum 等多个新增枚举类中,通过 value 或 displayName 反查枚举实例时,均在方法内部使用了 for 循环遍历 .values() 或 Arrays.asList()。
    • 影响分析:Java 枚举的 values() 方法在每次调用时都会克隆并返回一个新的数组,Arrays.asList() 也会创建新对象。在高并发场景下频繁调用这些转化方法,会产生不必要的临时对象,增加 GC 压力;同时 O(N) 的遍历查找效率不如 O(1) 的哈希查找。
    • 优化建议:使用静态 Map 缓存枚举的映射关系。 ```java private static final Map VALUE_MAP = new HashMap<>(); static { for (CalculateStyleEnum e : CalculateStyleEnum.values()) { VALUE_MAP.put(e.getValue(), e); } }

    public static CalculateStyleEnum getByValue(Byte value) { return value == null ? null : VALUE_MAP.get(value); }

    
    ---
    
    #### 二、评分明细
    
    - **功能实现的正确性与健壮性(28/40分)**:
      扣分主要在于 Dubbo API 返回值类型的直接修改,这在微服务架构中是极其危险的操作,会导致服务消费端引发反序列化异常。其他业务字段的新增与 DTO 映射逻辑基本正确。
    - **安全性与潜在风险(30/30分)**:
      本次代码变更多为 DTO 和 Entity 的字段扩展,未涉及直接的 SQL 拼接,未发现 SQL 注入、越权等明显安全漏洞。
    - **最佳实践与可维护性(14/20分)**:
      扣分在于 `CalculateStyleEnum` 存在明显的代码复制粘贴痕迹(DRY 原则违背),且枚举反查未采用静态 `Map` 缓存的最佳实践。
    - **性能与资源利用(4/5分)**:
      整体资源利用合理,微小扣分在于枚举类中的 `values()` 和 `Arrays.asList()` 在每次方法调用时都会产生临时对象,存在轻微的性能浪费。
    - **提交信息质量(5/5分)**:
      Commit message 质量极高。采用了标准的 Conventional Commits 规范(如 `feat`, `fix`, `refactor`),并且详细列出了每个 commit 的具体改动点和业务意图,非常便于追溯。
    
    总分:81分
    
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!