Commit e02d0eed by 叶立庆

Merge branch 'v5.8.6' into 'master'

上线合并

See merge request !54
2 parents 4ec05a03 4dfed8d3
Showing 57 changed files with 1302 additions and 42 deletions
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<name>rpc-dj-smartcarlife-api</name> <name>rpc-dj-smartcarlife-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.dj.smartcarlife.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.dj.smartcarlife.remote</deploy.scanPackage>
<smartcarlife.api.version>5.8.5-SNAPSHOT</smartcarlife.api.version> <smartcarlife.api.version>5.8.6-SNAPSHOT</smartcarlife.api.version>
<shopamll.api.version>5.6.4-SNAPSHOT</shopamll.api.version> <shopamll.api.version>5.6.4-SNAPSHOT</shopamll.api.version>
</properties> </properties>
<dependencies> <dependencies>
......
package cn.com.glsx.dj.smartcarlife.dto; package cn.com.glsx.dj.smartcarlife.dto;
import cn.com.glsx.dj.smartcarlife.model.CreateBusinessApproveMerchant;
import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantGuaranteeConfigDTO; import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantGuaranteeConfigDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.UsedCarProfitRuleDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.UsedCarTrafficTargetDTO;
import cn.com.glsx.dj.smartcarlife.model.CreateBusinessApproveMerchant;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -81,4 +83,14 @@ public class CreateBusinessApproveMerchantDTO extends CreateBusinessApproveMerch ...@@ -81,4 +83,14 @@ public class CreateBusinessApproveMerchantDTO extends CreateBusinessApproveMerch
* 兜底配置列表 * 兜底配置列表
*/ */
private List<MerchantGuaranteeConfigDTO> guaranteeList; private List<MerchantGuaranteeConfigDTO> guaranteeList;
/**
* 二手车流量方经营目标数据(仅二手车业务场景)
*/
private UsedCarTrafficTargetDTO usedCarTrafficTargetData;
/**
* 二手车分润规则列表(仅二手车业务场景)
*/
private List<UsedCarProfitRuleDTO> usedCarProfitRuleList;
} }
\ No newline at end of file \ No newline at end of file
...@@ -86,4 +86,7 @@ public class GoodsWarehousingInfoDTO extends GoodsWarehousingInfo{ ...@@ -86,4 +86,7 @@ public class GoodsWarehousingInfoDTO extends GoodsWarehousingInfo{
@ApiModelProperty(notes="所属商户(主服务商)商户名称") @ApiModelProperty(notes="所属商户(主服务商)商户名称")
private String partnerMerchantName; private String partnerMerchantName;
@ApiModelProperty(notes = "产品ID")
private String commodityCode;
} }
...@@ -24,6 +24,8 @@ public class MerchantGoodsStockReduceRecordDTO extends MerchantGoodsStockReduceR ...@@ -24,6 +24,8 @@ public class MerchantGoodsStockReduceRecordDTO extends MerchantGoodsStockReduceR
@ApiModelProperty(notes="商品名称") @ApiModelProperty(notes="商品名称")
private String upgradeGoodsName; private String upgradeGoodsName;
private String commodityCode;
@ApiModelProperty(notes="系列") @ApiModelProperty(notes="系列")
private String goodsSeries; private String goodsSeries;
......
...@@ -200,7 +200,4 @@ public class PurchaseOrderDeliveryDetailDTO extends PurchaseOrderDeliveryDetail ...@@ -200,7 +200,4 @@ public class PurchaseOrderDeliveryDetailDTO extends PurchaseOrderDeliveryDetail
@ApiModelProperty(notes="是否支持扫码入库") @ApiModelProperty(notes="是否支持扫码入库")
private Boolean canScanEnable; private Boolean canScanEnable;
@ApiModelProperty(notes = "升级商品编码")
private String upgradeCommodityCode;
} }
...@@ -170,4 +170,7 @@ public class PurchaseOrderPageDTO extends PurchaseOrder { ...@@ -170,4 +170,7 @@ public class PurchaseOrderPageDTO extends PurchaseOrder {
@ApiModelProperty(notes = "供应商名称,模糊搜索") @ApiModelProperty(notes = "供应商名称,模糊搜索")
private String thirdPartyName; private String thirdPartyName;
@ApiModelProperty(notes = "产品ID(升级商品编码),精确匹配采购订单商品 upgrade_goods_commodity_code")
private String commodityCode;
} }
package cn.com.glsx.dj.smartcarlife.dto; package cn.com.glsx.dj.smartcarlife.dto;
import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantGuaranteeConfigDTO; import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantGuaranteeConfigDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.UsedCarProfitRuleDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.UsedCarTrafficTargetDTO;
import cn.com.glsx.dj.smartcarlife.model.ServiceMerchant; import cn.com.glsx.dj.smartcarlife.model.ServiceMerchant;
import cn.com.glsx.dj.smartcarlife.model.ServiceMerchantRef; import cn.com.glsx.dj.smartcarlife.model.ServiceMerchantRef;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -92,4 +94,14 @@ public class ServiceMerchantRefDTO extends ServiceMerchantRef { ...@@ -92,4 +94,14 @@ public class ServiceMerchantRefDTO extends ServiceMerchantRef {
* 兜底配置列表 * 兜底配置列表
*/ */
private List<MerchantGuaranteeConfigDTO> guaranteeList; private List<MerchantGuaranteeConfigDTO> guaranteeList;
/**
* 二手车流量方经营目标数据(仅二手车业务场景)
*/
private UsedCarTrafficTargetDTO usedCarTrafficTargetData;
/**
* 二手车分润规则列表(仅二手车业务场景)
*/
private List<UsedCarProfitRuleDTO> usedCarProfitRuleList;
} }
...@@ -208,5 +208,9 @@ public class StockAllocateDeliveryListDTO implements Serializable { ...@@ -208,5 +208,9 @@ public class StockAllocateDeliveryListDTO implements Serializable {
@ApiModelProperty(notes = "关联采购订单编号") @ApiModelProperty(notes = "关联采购订单编号")
private String purchaseOrderCode; private String purchaseOrderCode;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
@ApiModelProperty(notes = "产品ID")
private String commodityCode;
} }
...@@ -79,4 +79,9 @@ public class StockAllocateDeliveryPageDTO implements Serializable { ...@@ -79,4 +79,9 @@ public class StockAllocateDeliveryPageDTO implements Serializable {
@ApiModelProperty(notes = "关联采购订单编号") @ApiModelProperty(notes = "关联采购订单编号")
private String purchaseOrderCode; private String purchaseOrderCode;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
private String commodityCode;
} }
...@@ -94,4 +94,10 @@ public class StockAllocateRecordDTO extends StockAllocateRecord implements Seria ...@@ -94,4 +94,10 @@ public class StockAllocateRecordDTO extends StockAllocateRecord implements Seria
*/ */
@ApiModelProperty(notes = "关联采购订单编号") @ApiModelProperty(notes = "关联采购订单编号")
private String purchaseOrderCode; private String purchaseOrderCode;
/**
* 产品ID(升级商品编码),模糊匹配采购订单商品
*/
private String commodityCode;
} }
...@@ -60,4 +60,6 @@ public class StockAllocateRecordExportDTO extends StockAllocateRecord implements ...@@ -60,4 +60,6 @@ public class StockAllocateRecordExportDTO extends StockAllocateRecord implements
@ApiModelProperty(notes = "0-未发货,1-全部发货,2-部分发货") @ApiModelProperty(notes = "0-未发货,1-全部发货,2-部分发货")
private String deliveryStatusName; private String deliveryStatusName;
private String commodityCode;
} }
...@@ -46,6 +46,12 @@ public class StockFlowDTO implements Serializable { ...@@ -46,6 +46,12 @@ public class StockFlowDTO implements Serializable {
private String upgradeGoodsName; private String upgradeGoodsName;
/** /**
* 产品ID
*/
@ApiModelProperty(notes = "产品ID")
private String commodityCode;
/**
* 商品编码 * 商品编码
*/ */
@ApiModelProperty(notes = "商品编码") @ApiModelProperty(notes = "商品编码")
......
...@@ -213,4 +213,7 @@ public class UpgradeGoodsDTO extends UpgradeGoods { ...@@ -213,4 +213,7 @@ public class UpgradeGoodsDTO extends UpgradeGoods {
@ApiModelProperty(notes = "供应方编号(单选筛选)") @ApiModelProperty(notes = "供应方编号(单选筛选)")
private String supplierCode; private String supplierCode;
@ApiModelProperty(notes = "采购商品上架记录(草稿/待审核/已上架,用于前端判断产品是否可删除)")
private List<PurchaseGoodsInfo> purchaseGoodsInfos;
} }
...@@ -40,4 +40,16 @@ public class MerchantDetailResponseDTO implements Serializable { ...@@ -40,4 +40,16 @@ public class MerchantDetailResponseDTO implements Serializable {
*/ */
@ApiModelProperty(value = "兜底配置列表") @ApiModelProperty(value = "兜底配置列表")
private List<MerchantGuaranteeConfigDTO> guaranteeList; private List<MerchantGuaranteeConfigDTO> guaranteeList;
/**
* 二手车流量方经营目标(仅二手车业务场景返回)
*/
@ApiModelProperty(value = "二手车流量方经营目标")
private UsedCarTrafficTargetDTO usedCarTrafficTarget;
/**
* 二手车分润规则列表(仅二手车业务场景返回)
*/
@ApiModelProperty(value = "二手车分润规则列表")
private List<UsedCarProfitRuleDTO> usedCarProfitRuleList;
} }
package cn.com.glsx.dj.smartcarlife.dto.merchant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@ApiModel(value = "UsedCarProfitRuleDTO", description = "二手车分润规则DTO")
public class UsedCarProfitRuleDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("置换类型")
private String replaceType;
@ApiModelProperty("门店分润-报废车")
private BigDecimal storeProfitScrapCar;
@ApiModelProperty(value = "分润类型", required = true)
private String profitType;
@ApiModelProperty("进销差分润比例(%)")
private BigDecimal profitDiffRate;
@ApiModelProperty("收购车价区间起始(元)")
private BigDecimal buyPriceRangeStart;
@ApiModelProperty("收购车价区间结束(元)")
private BigDecimal buyPriceRangeEnd;
@ApiModelProperty("收购车价区间分润(元)")
private BigDecimal buyPriceRangeProfit;
@ApiModelProperty(value = "流量费分润(元)", required = true)
private BigDecimal trafficFeeProfit;
@ApiModelProperty("流量费分润备注")
private String trafficFeeProfitRemark;
@ApiModelProperty(value = "是否单车兜底", required = true)
private String singleCarGuaranteeFlag;
@ApiModelProperty("单车兜底金额(元)")
private BigDecimal singleCarGuaranteeAmount;
@ApiModelProperty(value = "总经理市场费计算方式", required = true)
private String gmMarketFeeCalcType;
@ApiModelProperty(value = "总经理市场费(元)", required = true)
private BigDecimal gmMarketFee;
@ApiModelProperty(value = "销售经理市场费计算方式", required = true)
private String salesManagerMarketFeeCalcType;
@ApiModelProperty(value = "销售经理市场费(元)", required = true)
private BigDecimal salesManagerMarketFee;
@ApiModelProperty(value = "一线阳光计算方式", required = true)
private String frontlineSunshineCalcType;
@ApiModelProperty(value = "一线阳光激励费(元)", required = true)
private BigDecimal frontlineSunshineIncentiveFee;
@ApiModelProperty("资源费计算方式")
private String resourceFeeCalcType;
@ApiModelProperty("资源费")
private BigDecimal resourceFee;
@ApiModelProperty(value = "店端总分润毛利占比(%)", required = true)
private BigDecimal storeTotalProfitGrossRate;
}
package cn.com.glsx.dj.smartcarlife.dto.merchant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@ApiModel(value = "UsedCarTrafficTargetDTO", description = "二手车流量方信息和经营目标值DTO")
public class UsedCarTrafficTargetDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("资金税务主体")
private String fundingTaxEntity;
@ApiModelProperty("品牌")
private String brand;
@ApiModelProperty("车型备注")
private String carModelRemark;
@ApiModelProperty("品牌定位")
private String brandPositioning;
@ApiModelProperty("门店评级")
private String storeRating;
@ApiModelProperty("新车订单目标(台/月)")
private Integer newCarOrderTarget;
@ApiModelProperty("目标置换率(%)")
private BigDecimal targetReplaceRate;
@ApiModelProperty("收车目标(台/月)")
private Integer recycleTarget;
@ApiModelProperty("品牌置换率(%)")
private BigDecimal brandReplaceRate;
@ApiModelProperty("置换订单评估转化率(%)")
private BigDecimal replaceOrderEvalConvertRate;
@ApiModelProperty("平均进销差(元)")
private BigDecimal avgProfitDiff;
@ApiModelProperty("溢价率(%)")
private BigDecimal premiumRate;
@ApiModelProperty("置换订单评估率(%)")
private BigDecimal replaceOrderEvalRate;
}
...@@ -3,6 +3,8 @@ package cn.com.glsx.dj.smartcarlife.dto.merchantRef; ...@@ -3,6 +3,8 @@ package cn.com.glsx.dj.smartcarlife.dto.merchantRef;
import cn.com.glsx.dj.smartcarlife.dto.ProductDetailBusinessDTO; import cn.com.glsx.dj.smartcarlife.dto.ProductDetailBusinessDTO;
import cn.com.glsx.dj.smartcarlife.dto.TrafficPartyBusinessDTO; import cn.com.glsx.dj.smartcarlife.dto.TrafficPartyBusinessDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantGuaranteeConfigDTO; import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantGuaranteeConfigDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.UsedCarProfitRuleDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.UsedCarTrafficTargetDTO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -78,4 +80,14 @@ public class MerchantRefSceneAddDTO implements Serializable { ...@@ -78,4 +80,14 @@ public class MerchantRefSceneAddDTO implements Serializable {
* 兜底配置列表 * 兜底配置列表
*/ */
private List<MerchantGuaranteeConfigDTO> guaranteeList; private List<MerchantGuaranteeConfigDTO> guaranteeList;
/**
* 二手车流量方经营目标数据(仅二手车业务场景)
*/
private UsedCarTrafficTargetDTO usedCarTrafficTargetData;
/**
* 二手车分润规则列表(仅二手车业务场景)
*/
private List<UsedCarProfitRuleDTO> usedCarProfitRuleList;
} }
...@@ -18,6 +18,11 @@ public class PurchaseOrderGoodsExportDTO implements Serializable{ ...@@ -18,6 +18,11 @@ public class PurchaseOrderGoodsExportDTO implements Serializable{
private String upgradeGoodsName; private String upgradeGoodsName;
/** /**
* 产品ID(升级商品编码)
*/
private String upgradeGoodsCommodityCode;
/**
* 产品别名 * 产品别名
*/ */
private String purchaseGoodsName; private String purchaseGoodsName;
......
...@@ -164,4 +164,6 @@ public class PurchaseOrderGoodsPageDTO extends PurchaseOrderGoods { ...@@ -164,4 +164,6 @@ public class PurchaseOrderGoodsPageDTO extends PurchaseOrderGoods {
private List<Integer> signStatusList; private List<Integer> signStatusList;
private String signStatusStr; private String signStatusStr;
private String commodityCode;
} }
...@@ -29,6 +29,10 @@ public class MerchantShopGoodsStockDTO extends MerchantShopGoodsStock { ...@@ -29,6 +29,10 @@ public class MerchantShopGoodsStockDTO extends MerchantShopGoodsStock {
@ApiModelProperty(notes = "商品名称") @ApiModelProperty(notes = "商品名称")
private String upgradeGoodsName; private String upgradeGoodsName;
@ApiModelProperty(notes="产品ID")
private String commodityCode;
@ApiModelProperty(notes="系列") @ApiModelProperty(notes="系列")
private String goodsSeries; private String goodsSeries;
...@@ -97,4 +101,11 @@ public class MerchantShopGoodsStockDTO extends MerchantShopGoodsStock { ...@@ -97,4 +101,11 @@ public class MerchantShopGoodsStockDTO extends MerchantShopGoodsStock {
@ApiModelProperty(notes="查询时间") @ApiModelProperty(notes="查询时间")
private String queryDate; private String queryDate;
public String getCommodityCode() {
return commodityCode;
}
public void setCommodityCode(String commodityCode) {
this.commodityCode = commodityCode;
}
} }
...@@ -77,7 +77,9 @@ public class CarLifeEnum { ...@@ -77,7 +77,9 @@ public class CarLifeEnum {
/** 智享后台批量导入**/ /** 智享后台批量导入**/
DJ_IMPORT((byte)3), DJ_IMPORT((byte)3),
/** 嘀加上架 **/ /** 嘀加上架 **/
DJ_CREATE_BUSINESS((byte)4); DJ_CREATE_BUSINESS((byte)4),
/** 商品上架自动同步 **/
AUTO_SYNC((byte)5);
; ;
private final byte value; private final byte value;
......
...@@ -14,7 +14,9 @@ public enum PurchaseGoodsLogType { ...@@ -14,7 +14,9 @@ public enum PurchaseGoodsLogType {
/** 修改上架信息 **/ /** 修改上架信息 **/
UPDATE((byte) 5, "{0}修改上架信息"), UPDATE((byte) 5, "{0}修改上架信息"),
/** 修改采购价 **/ /** 修改采购价 **/
UPDATE_PURCHASE_PRICE((byte) 6, "{0}修改采购价"); UPDATE_PURCHASE_PRICE((byte) 6, "{0}修改采购价"),
/** 商品上架自动同步生成 **/
AUTO_CREATE((byte) 7, "商品上架自动生成");
private final Byte value; private final Byte value;
......
...@@ -79,6 +79,13 @@ public class PurchaseOrderDeliveryDetail implements Serializable{ ...@@ -79,6 +79,13 @@ public class PurchaseOrderDeliveryDetail implements Serializable{
@ApiModelProperty(notes = "升级商品id", required = true, dataType = "int") @ApiModelProperty(notes = "升级商品id", required = true, dataType = "int")
@Column(name = "upgrade_goods_id") @Column(name = "upgrade_goods_id")
private Integer upgradeGoodsId; private Integer upgradeGoodsId;
/**
* 产品ID(升级商品commodity_code)
*/
@ApiModelProperty(notes = "产品ID")
@Column(name = "upgrade_commodity_code")
private String upgradeCommodityCode;
/** /**
* 采购订单商品主键ID * 采购订单商品主键ID
......
...@@ -47,6 +47,13 @@ public class StockAllocateDetail implements Serializable { ...@@ -47,6 +47,13 @@ public class StockAllocateDetail implements Serializable {
private String goodsName; private String goodsName;
/** /**
* 产品ID(升级商品commodity_code)
*/
@ApiModelProperty(notes = "产品ID")
@Column(name = "upgrade_commodity_code")
private String upgradeCommodityCode;
/**
* 商品编号 * 商品编号
*/ */
@Column(name = "product_code") @Column(name = "product_code")
......
package cn.com.glsx.dj.smartcarlife.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "dj_car_life_used_car_profit_rule")
public class UsedCarProfitRule implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 流量方ID
*/
@Column(name = "traffic_party_id")
@ApiModelProperty(notes = "流量方ID")
private Integer trafficPartyId;
/**
* 置换类型
*/
@Column(name = "replace_type")
@ApiModelProperty(notes = "置换类型")
private String replaceType;
/**
* 门店分润-【报废车】
*/
@Column(name = "store_profit_scrap_car")
@ApiModelProperty(notes = "门店分润-【报废车】")
private BigDecimal storeProfitScrapCar;
/**
* 分润类型
*/
@Column(name = "profit_type")
@ApiModelProperty(notes = "分润类型")
private String profitType;
/**
* 进销差分润比例(%)
*/
@Column(name = "profit_diff_rate")
@ApiModelProperty(notes = "进销差分润比例(%)")
private BigDecimal profitDiffRate;
/**
* 收购车价区间起始(元)
*/
@Column(name = "buy_price_range_start")
@ApiModelProperty(notes = "收购车价区间起始(元)")
private BigDecimal buyPriceRangeStart;
/**
* 收购车价区间结束(元)
*/
@Column(name = "buy_price_range_end")
@ApiModelProperty(notes = "收购车价区间结束(元)")
private BigDecimal buyPriceRangeEnd;
/**
* 收购车价区间分润(元)
*/
@Column(name = "buy_price_range_profit")
@ApiModelProperty(notes = "收购车价区间分润(元)")
private BigDecimal buyPriceRangeProfit;
/**
* 流量费分润(元)
*/
@Column(name = "traffic_fee_profit")
@ApiModelProperty(notes = "流量费分润(元)")
private BigDecimal trafficFeeProfit;
/**
* 流量费分润备注
*/
@Column(name = "traffic_fee_profit_remark")
@ApiModelProperty(notes = "流量费分润备注")
private String trafficFeeProfitRemark;
/**
* 是否单车兜底:Y-是,N-否
*/
@Column(name = "single_car_guarantee_flag")
@ApiModelProperty(notes = "是否单车兜底:Y-是,N-否")
private String singleCarGuaranteeFlag;
/**
* 单车兜底金额(元)
*/
@Column(name = "single_car_guarantee_amount")
@ApiModelProperty(notes = "单车兜底金额(元)")
private BigDecimal singleCarGuaranteeAmount;
/**
* 总经理市场费计算方式
*/
@Column(name = "gm_market_fee_calc_type")
@ApiModelProperty(notes = "总经理市场费计算方式")
private String gmMarketFeeCalcType;
/**
* 总经理市场费(元)
*/
@Column(name = "gm_market_fee")
@ApiModelProperty(notes = "总经理市场费(元)")
private BigDecimal gmMarketFee;
/**
* 销售经理市场费计算方式
*/
@Column(name = "sales_manager_market_fee_calc_type")
@ApiModelProperty(notes = "销售经理市场费计算方式")
private String salesManagerMarketFeeCalcType;
/**
* 销售经理市场费(元)
*/
@Column(name = "sales_manager_market_fee")
@ApiModelProperty(notes = "销售经理市场费(元)")
private BigDecimal salesManagerMarketFee;
/**
* 一线阳光计算方式
*/
@Column(name = "frontline_sunshine_calc_type")
@ApiModelProperty(notes = "一线阳光计算方式")
private String frontlineSunshineCalcType;
/**
* 一线阳光激励费(元)
*/
@Column(name = "frontline_sunshine_incentive_fee")
@ApiModelProperty(notes = "一线阳光激励费(元)")
private BigDecimal frontlineSunshineIncentiveFee;
/**
* 资源费计算方式
*/
@Column(name = "resource_fee_calc_type")
@ApiModelProperty(notes = "资源费计算方式")
private String resourceFeeCalcType;
/**
* 资源费
*/
@Column(name = "resource_fee")
@ApiModelProperty(notes = "资源费")
private BigDecimal resourceFee;
/**
* 店端总分润毛利占比(%)
*/
@Column(name = "store_total_profit_gross_rate")
@ApiModelProperty(notes = "店端总分润毛利占比(%)")
private BigDecimal storeTotalProfitGrossRate;
/**
* 创建人
*/
@Column(name = "created_by")
@ApiModelProperty(notes = "创建人")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_date")
@ApiModelProperty(notes = "创建时间")
private Date createdDate;
/**
* 更新人
*/
@Column(name = "updated_by")
@ApiModelProperty(notes = "更新人")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_date")
@ApiModelProperty(notes = "更新时间")
private Date updatedDate;
/**
* 删除标记:N-未删除,Y-已删除
*/
@Column(name = "deleted_flag")
@ApiModelProperty(notes = "删除标记:N-未删除,Y-已删除")
private String deletedFlag;
}
package cn.com.glsx.dj.smartcarlife.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "dj_car_life_used_car_traffic_target")
public class UsedCarTrafficTarget implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 流量方ID
*/
@Column(name = "traffic_party_id")
@ApiModelProperty(notes = "流量方ID")
private Integer trafficPartyId;
/**
* 资金税务主体
*/
@Column(name = "funding_tax_entity")
@ApiModelProperty(notes = "资金税务主体")
private String fundingTaxEntity;
/**
* 品牌
*/
@Column(name = "brand")
@ApiModelProperty(notes = "品牌")
private String brand;
/**
* 车型备注
*/
@Column(name = "car_model_remark")
@ApiModelProperty(notes = "车型备注")
private String carModelRemark;
/**
* 品牌定位
*/
@Column(name = "brand_positioning")
@ApiModelProperty(notes = "品牌定位")
private String brandPositioning;
/**
* 门店评级
*/
@Column(name = "store_rating")
@ApiModelProperty(notes = "门店评级")
private String storeRating;
/**
* 新车订单目标(台/月)
*/
@Column(name = "new_car_order_target")
@ApiModelProperty(notes = "新车订单目标(台/月)")
private Integer newCarOrderTarget;
/**
* 目标置换率(%)
*/
@Column(name = "target_replace_rate")
@ApiModelProperty(notes = "目标置换率(%)")
private BigDecimal targetReplaceRate;
/**
* 收车目标(台/月)
*/
@Column(name = "recycle_target")
@ApiModelProperty(notes = "收车目标(台/月)")
private Integer recycleTarget;
/**
* 品牌置换率(%)
*/
@Column(name = "brand_replace_rate")
@ApiModelProperty(notes = "品牌置换率(%)")
private BigDecimal brandReplaceRate;
/**
* 置换订单评估转化率(%)【标准值】
*/
@Column(name = "replace_order_eval_convert_rate")
@ApiModelProperty(notes = "置换订单评估转化率(%)【标准值】")
private BigDecimal replaceOrderEvalConvertRate;
/**
* 平均进销差(元)【标准值】
*/
@Column(name = "avg_profit_diff")
@ApiModelProperty(notes = "平均进销差(元)【标准值】")
private BigDecimal avgProfitDiff;
/**
* 溢价率(%)【标准值】
*/
@Column(name = "premium_rate")
@ApiModelProperty(notes = "溢价率(%)【标准值】")
private BigDecimal premiumRate;
/**
* 置换订单评估率(%)
*/
@Column(name = "replace_order_eval_rate")
@ApiModelProperty(notes = "置换订单评估率(%)")
private BigDecimal replaceOrderEvalRate;
/**
* 创建人
*/
@Column(name = "created_by")
@ApiModelProperty(notes = "创建人")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_date")
@ApiModelProperty(notes = "创建时间")
private Date createdDate;
/**
* 更新人
*/
@Column(name = "updated_by")
@ApiModelProperty(notes = "更新人")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_date")
@ApiModelProperty(notes = "更新时间")
private Date updatedDate;
/**
* 删除标记:N-未删除,Y-已删除
*/
@Column(name = "deleted_flag")
@ApiModelProperty(notes = "删除标记:N-未删除,Y-已删除")
private String deletedFlag;
}
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<skipTests>true</skipTests> <skipTests>true</skipTests>
<shopmall.api.version>5.8.2-SNAPSHOT</shopmall.api.version> <shopmall.api.version>5.8.2-SNAPSHOT</shopmall.api.version>
<stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version> <stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version>
<smartcarlife.api.version>5.8.5-SNAPSHOT</smartcarlife.api.version> <smartcarlife.api.version>5.8.6-SNAPSHOT</smartcarlife.api.version>
<sale.api.version>5.8.4-SNAPSHOT</sale.api.version> <sale.api.version>5.8.4-SNAPSHOT</sale.api.version>
<mindworkplate.api.version>5.8.3-SNAPSHOT</mindworkplate.api.version> <mindworkplate.api.version>5.8.3-SNAPSHOT</mindworkplate.api.version>
</properties> </properties>
......
...@@ -136,4 +136,12 @@ public interface UpgradeGoodsMapper extends OreMapper<UpgradeGoods> { ...@@ -136,4 +136,12 @@ public interface UpgradeGoodsMapper extends OreMapper<UpgradeGoods> {
*/ */
List<java.util.Map<String, Object>> countOnShelfMerchantGoods(@Param("upgradeGoodsIds") List<Integer> upgradeGoodsIds); List<java.util.Map<String, Object>> countOnShelfMerchantGoods(@Param("upgradeGoodsIds") List<Integer> upgradeGoodsIds);
/**
* 根据升级商品ID列表批量查询产品ID(只返回id、commodity_code)
*
* @param upgradeGoodsIds 升级商品ID列表
* @return 升级商品ID与产品ID的对应关系
*/
List<UpgradeGoods> listCommodityCodeByIds(@Param("upgradeGoodsIds") List<Integer> upgradeGoodsIds);
} }
package cn.com.glsx.dj.smartcarlife.mapper;
import cn.com.glsx.dj.smartcarlife.model.UsedCarProfitRule;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface UsedCarProfitRuleMapper {
List<UsedCarProfitRule> findByTrafficPartyId(@Param("trafficPartyId") Integer trafficPartyId);
int deleteByTrafficPartyId(@Param("trafficPartyId") Integer trafficPartyId, @Param("updatedBy") String updatedBy);
int insertList(@Param("list") List<UsedCarProfitRule> list);
}
package cn.com.glsx.dj.smartcarlife.mapper;
import cn.com.glsx.dj.smartcarlife.model.UsedCarTrafficTarget;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UsedCarTrafficTargetMapper {
UsedCarTrafficTarget findByTrafficPartyId(@Param("trafficPartyId") Integer trafficPartyId);
int insert(UsedCarTrafficTarget record);
int updateByPrimaryKeySelective(UsedCarTrafficTarget record);
}
...@@ -11,6 +11,7 @@ import cn.com.glsx.dj.smartcarlife.enums.CarLifeEnum.ShelfStatus; ...@@ -11,6 +11,7 @@ import cn.com.glsx.dj.smartcarlife.enums.CarLifeEnum.ShelfStatus;
import cn.com.glsx.dj.smartcarlife.enums.SpecificationTypeEnum; import cn.com.glsx.dj.smartcarlife.enums.SpecificationTypeEnum;
import cn.com.glsx.dj.smartcarlife.mapper.BaseGoodsMapper; import cn.com.glsx.dj.smartcarlife.mapper.BaseGoodsMapper;
import cn.com.glsx.dj.smartcarlife.mapper.GoodsOperationLogMapper; import cn.com.glsx.dj.smartcarlife.mapper.GoodsOperationLogMapper;
import cn.com.glsx.dj.smartcarlife.mapper.PurchaseGoodsInfoMapper;
import cn.com.glsx.dj.smartcarlife.mapper.UpgradeGoodsMapper; import cn.com.glsx.dj.smartcarlife.mapper.UpgradeGoodsMapper;
import cn.com.glsx.dj.smartcarlife.model.*; import cn.com.glsx.dj.smartcarlife.model.*;
import cn.com.glsx.dj.smartcarlife.service.common.GoodsOperationLogService; import cn.com.glsx.dj.smartcarlife.service.common.GoodsOperationLogService;
...@@ -49,6 +50,8 @@ import java.math.BigDecimal; ...@@ -49,6 +50,8 @@ import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import tk.mybatis.mapper.entity.Example;
@Slf4j @Slf4j
@Service @Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
...@@ -106,6 +109,9 @@ public class BaseGoodsService { ...@@ -106,6 +109,9 @@ public class BaseGoodsService {
@Autowired @Autowired
private UpgradeGoodsProviderRefService upgradeGoodsProviderRefService; private UpgradeGoodsProviderRefService upgradeGoodsProviderRefService;
@Autowired
private PurchaseGoodsInfoMapper purchaseGoodsInfoMapper;
public List<BaseGoodsDTO> list(BaseGoodsDTO record) { public List<BaseGoodsDTO> list(BaseGoodsDTO record) {
RpcAssert.assertNotNull(record, DefaultErrorEnum.DATA_NULL, "BaseGoodsDTO not be null"); RpcAssert.assertNotNull(record, DefaultErrorEnum.DATA_NULL, "BaseGoodsDTO not be null");
try { try {
...@@ -362,6 +368,8 @@ public class BaseGoodsService { ...@@ -362,6 +368,8 @@ public class BaseGoodsService {
} }
//设置sku是否已上架 //设置sku是否已上架
setMerchantGoodsExist(upgradeGoodsDTOList); setMerchantGoodsExist(upgradeGoodsDTOList);
// 一次性批量查询采购商品上架记录(草稿/待审核/已上架),避免循环查询
fillPurchaseGoodsInfos(upgradeGoodsDTOList);
record.setUpgradeGoodsList(upgradeGoodsDTOList); record.setUpgradeGoodsList(upgradeGoodsDTOList);
UpdateOperationLog updateOperationLog = new UpdateOperationLog(1, baseGoodsId); UpdateOperationLog updateOperationLog = new UpdateOperationLog(1, baseGoodsId);
...@@ -410,6 +418,40 @@ public class BaseGoodsService { ...@@ -410,6 +418,40 @@ public class BaseGoodsService {
} }
} }
/**
* 批量填充每个SKU下的采购商品上架记录(草稿/待审核/已上架,未删除),
* 用于前端结合 merchantGoodsInfos 判断产品是否可删除。一次性查询,避免循环查库。
*/
private void fillPurchaseGoodsInfos(List<UpgradeGoodsDTO> upgradeGoodsDTOList) {
if (CollectionUtils.isEmpty(upgradeGoodsDTOList)) {
return;
}
List<Integer> upgradeGoodsIds = upgradeGoodsDTOList.stream()
.map(UpgradeGoodsDTO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(upgradeGoodsIds)) {
return;
}
Example example = new Example(PurchaseGoodsInfo.class);
example.createCriteria()
.andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name())
.andIn("upgradeGoodsId", upgradeGoodsIds)
.andIn("status", Arrays.asList(
CarLifeEnum.MerchantGoodsStatus.DRAFT.getValue(),
CarLifeEnum.MerchantGoodsStatus.WAIT_AUDIT.getValue(),
CarLifeEnum.MerchantGoodsStatus.ON_SHELF.getValue()));
List<PurchaseGoodsInfo> purchaseGoodsInfos = purchaseGoodsInfoMapper.selectByExample(example);
Map<Integer, List<PurchaseGoodsInfo>> purchaseGoodsMap = purchaseGoodsInfos.stream()
.filter(pgi -> pgi.getUpgradeGoodsId() != null)
.collect(Collectors.groupingBy(PurchaseGoodsInfo::getUpgradeGoodsId));
for (UpgradeGoodsDTO dto : upgradeGoodsDTOList) {
if (dto.getId() != null) {
dto.setPurchaseGoodsInfos(purchaseGoodsMap.get(dto.getId()));
}
}
}
public GoodsMixDTO getByBaseGoodsIdPage(GoodsGetByBaseGoodsIdDTO request) { public GoodsMixDTO getByBaseGoodsIdPage(GoodsGetByBaseGoodsIdDTO request) {
RpcAssert.assertNotNull(request.getId(), DefaultErrorEnum.DATA_NULL, "baseGoodsId not be null"); RpcAssert.assertNotNull(request.getId(), DefaultErrorEnum.DATA_NULL, "baseGoodsId not be null");
try { try {
......
...@@ -3,22 +3,10 @@ package cn.com.glsx.dj.smartcarlife.service; ...@@ -3,22 +3,10 @@ package cn.com.glsx.dj.smartcarlife.service;
import cn.com.glsx.dj.smartcarlife.dto.ProductDetailBusinessDTO; import cn.com.glsx.dj.smartcarlife.dto.ProductDetailBusinessDTO;
import cn.com.glsx.dj.smartcarlife.dto.ServiceMerchantRefDTO; import cn.com.glsx.dj.smartcarlife.dto.ServiceMerchantRefDTO;
import cn.com.glsx.dj.smartcarlife.dto.TrafficPartyBusinessDTO; import cn.com.glsx.dj.smartcarlife.dto.TrafficPartyBusinessDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantEditDTO; import cn.com.glsx.dj.smartcarlife.dto.merchant.*;
import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantGuaranteeConfigDTO; import cn.com.glsx.dj.smartcarlife.mapper.*;
import cn.com.glsx.dj.smartcarlife.dto.merchant.ProductDetailDTO; import cn.com.glsx.dj.smartcarlife.model.*;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreInfoHistoryMapper;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreInfoMapper;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreProductDetailHistoryMapper;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreProductDetailMapper;
import cn.com.glsx.dj.smartcarlife.model.MerchantGuaranteeConfig;
import cn.com.glsx.dj.smartcarlife.model.MerchantStoreInfo;
import cn.com.glsx.dj.smartcarlife.model.MerchantStoreInfoHistory;
import cn.com.glsx.dj.smartcarlife.model.MerchantStoreProductDetail;
import cn.com.glsx.dj.smartcarlife.model.MerchantStoreProductDetailHistory;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -27,6 +15,10 @@ import org.springframework.stereotype.Service; ...@@ -27,6 +15,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/** /**
* 商户门店信息服务 * 商户门店信息服务
*/ */
...@@ -49,6 +41,12 @@ public class MerchantStoreInfoService { ...@@ -49,6 +41,12 @@ public class MerchantStoreInfoService {
@Autowired @Autowired
private MerchantGuaranteeConfigService merchantGuaranteeConfigService; private MerchantGuaranteeConfigService merchantGuaranteeConfigService;
@Autowired
private UsedCarTrafficTargetMapper usedCarTrafficTargetMapper;
@Autowired
private UsedCarProfitRuleMapper usedCarProfitRuleMapper;
/** /**
* 保存销售品类信息 * 保存销售品类信息
* @param merchantRefDTO 商户关联DTO * @param merchantRefDTO 商户关联DTO
...@@ -166,8 +164,6 @@ public class MerchantStoreInfoService { ...@@ -166,8 +164,6 @@ public class MerchantStoreInfoService {
BeanUtils.copyProperties(trafficPartyBusinessData, merchantStoreInfo); BeanUtils.copyProperties(trafficPartyBusinessData, merchantStoreInfo);
merchantStoreInfo.setCreatedBy(updatedBy);
merchantStoreInfo.setCreatedDate(new java.util.Date());
merchantStoreInfo.setUpdatedBy(updatedBy); merchantStoreInfo.setUpdatedBy(updatedBy);
merchantStoreInfo.setUpdatedDate(new java.util.Date()); merchantStoreInfo.setUpdatedDate(new java.util.Date());
merchantStoreInfo.setDeletedFlag("N"); merchantStoreInfo.setDeletedFlag("N");
...@@ -182,6 +178,8 @@ public class MerchantStoreInfoService { ...@@ -182,6 +178,8 @@ public class MerchantStoreInfoService {
createMerchantStoreInfoHistory(merchantStoreInfo, 2, sceneMerchantRefUpdId); createMerchantStoreInfoHistory(merchantStoreInfo, 2, sceneMerchantRefUpdId);
} else { } else {
// 插入新记录 // 插入新记录
merchantStoreInfo.setCreatedBy(updatedBy);
merchantStoreInfo.setCreatedDate(new java.util.Date());
merchantStoreInfoMapper.insert(merchantStoreInfo); merchantStoreInfoMapper.insert(merchantStoreInfo);
// 创建历史记录(新增操作) // 创建历史记录(新增操作)
createMerchantStoreInfoHistory(merchantStoreInfo, 1, sceneMerchantRefUpdId); createMerchantStoreInfoHistory(merchantStoreInfo, 1, sceneMerchantRefUpdId);
...@@ -401,4 +399,74 @@ public class MerchantStoreInfoService { ...@@ -401,4 +399,74 @@ public class MerchantStoreInfoService {
return true; return true;
} }
/**
* 处理二手车流量方经营目标(1:1,insert 或 update)
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public Boolean handleUsedCarTrafficTarget(Integer trafficPartyId, UsedCarTrafficTargetDTO dto, String updatedBy) {
log.info("处理二手车流量方经营目标,trafficPartyId: {}", trafficPartyId);
if (trafficPartyId == null || dto == null) {
return true;
}
try {
UsedCarTrafficTarget target = new UsedCarTrafficTarget();
BeanUtils.copyProperties(dto, target);
target.setTrafficPartyId(trafficPartyId);
target.setCreatedBy(updatedBy);
target.setCreatedDate(new java.util.Date());
target.setUpdatedBy(updatedBy);
target.setUpdatedDate(new java.util.Date());
target.setDeletedFlag("N");
UsedCarTrafficTarget existing = usedCarTrafficTargetMapper.findByTrafficPartyId(trafficPartyId);
if (existing != null) {
target.setId(existing.getId());
usedCarTrafficTargetMapper.updateByPrimaryKeySelective(target);
} else {
usedCarTrafficTargetMapper.insert(target);
}
return true;
} catch (Exception e) {
log.error("处理二手车流量方经营目标失败,trafficPartyId: {}", trafficPartyId, e);
throw new RpcServiceException("处理二手车流量方经营目标失败: " + e.getMessage());
}
}
/**
* 批量处理二手车分润规则(1:N,全量替换)
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public Boolean handleUsedCarProfitRuleBatch(Integer trafficPartyId, List<UsedCarProfitRuleDTO> dtoList, String updatedBy) {
log.info("批量处理二手车分润规则,trafficPartyId: {}, 数量: {}", trafficPartyId, dtoList != null ? dtoList.size() : 0);
if (trafficPartyId == null || dtoList == null) {
return true;
}
try {
// 先逻辑删除旧记录
usedCarProfitRuleMapper.deleteByTrafficPartyId(trafficPartyId, updatedBy);
// 再批量插入新记录
if (!dtoList.isEmpty()) {
List<UsedCarProfitRule> rules = new ArrayList<>();
Date now = new Date();
for (UsedCarProfitRuleDTO dto : dtoList) {
UsedCarProfitRule rule = new UsedCarProfitRule();
BeanUtils.copyProperties(dto, rule);
rule.setTrafficPartyId(trafficPartyId);
rule.setCreatedBy(updatedBy);
rule.setCreatedDate(now);
rule.setUpdatedBy(updatedBy);
rule.setUpdatedDate(now);
rule.setDeletedFlag("N");
rules.add(rule);
}
usedCarProfitRuleMapper.insertList(rules);
}
return true;
} catch (Exception e) {
log.error("批量处理二手车分润规则失败,trafficPartyId: {}", trafficPartyId, e);
throw new RpcServiceException("批量处理二手车分润规则失败: " + e.getMessage());
}
}
} }
...@@ -124,6 +124,7 @@ public class PurchaseOrderDeliveryDetailService { ...@@ -124,6 +124,7 @@ public class PurchaseOrderDeliveryDetailService {
detailDTO.setGoodsType(orderGoods.getGoodsType()); detailDTO.setGoodsType(orderGoods.getGoodsType());
detailDTO.setGoodsTypeName(orderGoods.getGoodsTypeName()); detailDTO.setGoodsTypeName(orderGoods.getGoodsTypeName());
detailDTO.setUpgradeGoodsId(orderGoods.getUpgradeGoodsId()); detailDTO.setUpgradeGoodsId(orderGoods.getUpgradeGoodsId());
detailDTO.setUpgradeCommodityCode(orderGoods.getUpgradeGoodsCommodityCode());
detailDTO.setType(orderGoods.getType()); detailDTO.setType(orderGoods.getType());
detailDTO.setUpgradeGoodsName(orderGoods.getUpgradeGoodsName()); detailDTO.setUpgradeGoodsName(orderGoods.getUpgradeGoodsName());
detailDTO.setDeliveryRemark(orderGoods.getDeliveryRemark()); detailDTO.setDeliveryRemark(orderGoods.getDeliveryRemark());
...@@ -196,6 +197,7 @@ public class PurchaseOrderDeliveryDetailService { ...@@ -196,6 +197,7 @@ public class PurchaseOrderDeliveryDetailService {
detailDTO.setGoodsType(allocateDetail.getGoodsType()); detailDTO.setGoodsType(allocateDetail.getGoodsType());
detailDTO.setGoodsTypeName(allocateDetail.getGoodsTypeName()); detailDTO.setGoodsTypeName(allocateDetail.getGoodsTypeName());
detailDTO.setUpgradeGoodsId(allocateDetail.getGoodsId()); detailDTO.setUpgradeGoodsId(allocateDetail.getGoodsId());
detailDTO.setUpgradeCommodityCode(allocateDetail.getUpgradeGoodsCommodityCode());
detailDTO.setType(allocateDetail.getProductCode()); detailDTO.setType(allocateDetail.getProductCode());
detailDTO.setUpgradeGoodsName(allocateDetail.getGoodsName()); detailDTO.setUpgradeGoodsName(allocateDetail.getGoodsName());
//detailDTO.setDeliveryRemark(allocateDetail.getDeliveryRemark()); //detailDTO.setDeliveryRemark(allocateDetail.getDeliveryRemark());
......
...@@ -1095,6 +1095,24 @@ public class ServiceMerchantRefService { ...@@ -1095,6 +1095,24 @@ public class ServiceMerchantRefService {
merchantStoreInfoService.handleGuaranteeBusinessData(merchantId, merchantRefDTO.getBaseSceneCode(), merchantRefDTO.getGuaranteeList(), sceneMerchantRefUpdId, merchantRefDTO.getUpdatedBy()); merchantStoreInfoService.handleGuaranteeBusinessData(merchantId, merchantRefDTO.getBaseSceneCode(), merchantRefDTO.getGuaranteeList(), sceneMerchantRefUpdId, merchantRefDTO.getUpdatedBy());
} }
// 处理二手车业务表数据(仅二手车场景 baseSceneCode=120101)
if (BaseSceneEnum.USED_CAR_RECYCLE.getBaseSceneCode().equals(merchantRefDTO.getBaseSceneCode())
&& sceneMerchantRefUpdId != null) {
Integer trafficPartyId = merchantRefDTO.getTrafficPartyBusinessData() != null
? merchantRefDTO.getTrafficPartyBusinessData().getTrafficPartyId()
: null;
if (trafficPartyId != null) {
if (merchantRefDTO.getUsedCarTrafficTargetData() != null) {
merchantStoreInfoService.handleUsedCarTrafficTarget(trafficPartyId,
merchantRefDTO.getUsedCarTrafficTargetData(), merchantRefDTO.getUpdatedBy());
}
if (CollectionUtils.isNotEmpty(merchantRefDTO.getUsedCarProfitRuleList())) {
merchantStoreInfoService.handleUsedCarProfitRuleBatch(trafficPartyId,
merchantRefDTO.getUsedCarProfitRuleList(), merchantRefDTO.getUpdatedBy());
}
}
}
return true; return true;
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
log.error("rpc" + e.getMessage(), e); log.error("rpc" + e.getMessage(), e);
...@@ -1927,6 +1945,8 @@ public class ServiceMerchantRefService { ...@@ -1927,6 +1945,8 @@ public class ServiceMerchantRefService {
.trafficPartyBusinessData(merchant.getTrafficPartyBusinessData()) .trafficPartyBusinessData(merchant.getTrafficPartyBusinessData())
.productDetailBusinessDataList(merchant.getProductDetailBusinessDataList()) .productDetailBusinessDataList(merchant.getProductDetailBusinessDataList())
.guaranteeList(merchant.getGuaranteeList()) .guaranteeList(merchant.getGuaranteeList())
.usedCarTrafficTargetData(merchant.getUsedCarTrafficTargetData())
.usedCarProfitRuleList(merchant.getUsedCarProfitRuleList())
.serviceList(serviceList).updatedBy(merchant.getUpdatedBy()).build(); .serviceList(serviceList).updatedBy(merchant.getUpdatedBy()).build();
addOrUpdateSceneMerchantRefByBaseCode(merchantRefSceneAddDTO); addOrUpdateSceneMerchantRefByBaseCode(merchantRefSceneAddDTO);
}catch (RpcServiceException rpcServiceException){ }catch (RpcServiceException rpcServiceException){
...@@ -1974,6 +1994,8 @@ public class ServiceMerchantRefService { ...@@ -1974,6 +1994,8 @@ public class ServiceMerchantRefService {
merchantRefDTO.setTrafficPartyBusinessData(merchantRefSceneAddDTO.getTrafficPartyBusinessData()); merchantRefDTO.setTrafficPartyBusinessData(merchantRefSceneAddDTO.getTrafficPartyBusinessData());
merchantRefDTO.setProductDetailBusinessDataList(merchantRefSceneAddDTO.getProductDetailBusinessDataList()); merchantRefDTO.setProductDetailBusinessDataList(merchantRefSceneAddDTO.getProductDetailBusinessDataList());
merchantRefDTO.setGuaranteeList(merchantRefSceneAddDTO.getGuaranteeList()); merchantRefDTO.setGuaranteeList(merchantRefSceneAddDTO.getGuaranteeList());
merchantRefDTO.setUsedCarTrafficTargetData(merchantRefSceneAddDTO.getUsedCarTrafficTargetData());
merchantRefDTO.setUsedCarProfitRuleList(merchantRefSceneAddDTO.getUsedCarProfitRuleList());
thiz.addOrUpdateSceneMerchantRef(merchantRefDTO); thiz.addOrUpdateSceneMerchantRef(merchantRefDTO);
//同步园区店员工信息 //同步园区店员工信息
taskExecutor.execute(()->staffInfoService.syncMerchantStaff(merchantRefDTO.getYqMerchantId())); taskExecutor.execute(()->staffInfoService.syncMerchantStaff(merchantRefDTO.getYqMerchantId()));
......
...@@ -1520,9 +1520,32 @@ public class UpgradeGoodsService { ...@@ -1520,9 +1520,32 @@ public class UpgradeGoodsService {
UpgradeGoods upgradeGoods = upgradeGoodsMapper.selectByPrimaryKey(upgradedGoodsId); UpgradeGoods upgradeGoods = upgradeGoodsMapper.selectByPrimaryKey(upgradedGoodsId);
RpcAssert.assertNotNull(upgradeGoods, DefaultErrorEnum.DATA_NULL, "升级商品不存在"); RpcAssert.assertNotNull(upgradeGoods, DefaultErrorEnum.DATA_NULL, "升级商品不存在");
//RpcAssert.assertIsTrue(Objects.equals(upgradeGoods.getDeletedFlag(), BaseModel.DeletedFlagEnum.N.name()), DefaultErrorEnum.DATA_NULL, "升级商品已删除"); //RpcAssert.assertIsTrue(Objects.equals(upgradeGoods.getDeletedFlag(), BaseModel.DeletedFlagEnum.N.name()), DefaultErrorEnum.DATA_NULL, "升级商品已删除");
boolean b = updateUpdatedGoodsShelfStatus(new UpdateUpgradeGoodsDTO(upgradedGoodsId, condition.getStatus(), condition.getUpdatedBy())); boolean skipOffShelf = false;
goodsReviewUpdateBaseGoodsStatus.updateBaseGoodsStatus(upgradeGoods.getBaseGoodsId(),condition.getUpdatedBy()); if (CarLifeEnum.ShelfStatus.OUT_SHELF.getValue() == condition.getStatus()) {
return b; // 任一渠道(商户商品/采购商品)仍有上架记录时,不允许将SKU置为下架
long merchantGoodsCount = merchantGoodsInfoService.count(
MerchantGoodsInfoDTO.builder()
.upgradeGoodsId(upgradedGoodsId)
.status(CarLifeEnum.MerchantGoodsStatus.ON_SHELF.getValue())
.deletedFlag(BaseModel.DeletedFlagEnum.N.name())
.build());
long purchaseGoodsCount = purchaseGoodsInfoMapper.count(
PurchaseGoodsInfoDTO.builder()
.upgradeGoodsId(upgradedGoodsId)
.status(CarLifeEnum.MerchantGoodsStatus.ON_SHELF.getValue())
.build());
skipOffShelf = merchantGoodsCount > 0 || purchaseGoodsCount > 0;
if (skipOffShelf) {
log.info("changeShelfStatus SKU仍有上架渠道记录,跳过下架 upgradeGoodsId={}, merchantGoodsCount={}, purchaseGoodsCount={}, updatedBy={}",
upgradedGoodsId, merchantGoodsCount, purchaseGoodsCount, condition.getUpdatedBy());
}
}
if (!skipOffShelf) {
updateUpdatedGoodsShelfStatus(new UpdateUpgradeGoodsDTO(upgradedGoodsId, condition.getStatus(), condition.getUpdatedBy()));
}
// 无论是否跳过下架,都重算产品可用状态(幂等)
goodsReviewUpdateBaseGoodsStatus.updateBaseGoodsStatus(upgradeGoods.getBaseGoodsId(), condition.getUpdatedBy());
return true;
} catch (RpcServiceException e) { } catch (RpcServiceException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
......
...@@ -17,6 +17,7 @@ import cn.com.glsx.dj.smartcarlife.model.*; ...@@ -17,6 +17,7 @@ import cn.com.glsx.dj.smartcarlife.model.*;
import cn.com.glsx.dj.smartcarlife.response.goods.PackageGoodsResponse; import cn.com.glsx.dj.smartcarlife.response.goods.PackageGoodsResponse;
import cn.com.glsx.dj.smartcarlife.service.*; import cn.com.glsx.dj.smartcarlife.service.*;
import cn.com.glsx.dj.smartcarlife.service.createBusiness.CreateBusinessProductService; import cn.com.glsx.dj.smartcarlife.service.createBusiness.CreateBusinessProductService;
import cn.com.glsx.dj.smartcarlife.service.purchaseGoods.PurchaseGoodsInfoService;
import cn.com.glsx.dj.smartcarlife.service.scene.SceneService; import cn.com.glsx.dj.smartcarlife.service.scene.SceneService;
import cn.com.glsx.dj.smartcarlife.service.stock.MerchantGoodsStockMonthReportService; import cn.com.glsx.dj.smartcarlife.service.stock.MerchantGoodsStockMonthReportService;
import cn.com.glsx.dj.smartcarlife.util.CommonUtil; import cn.com.glsx.dj.smartcarlife.util.CommonUtil;
...@@ -88,6 +89,9 @@ public class MerchantGoodsInfoService { ...@@ -88,6 +89,9 @@ public class MerchantGoodsInfoService {
private YqMerchantConfigService yqMerchantConfigService; private YqMerchantConfigService yqMerchantConfigService;
@Autowired @Autowired
private UpgradeGoodsService upgradeGoodsService; private UpgradeGoodsService upgradeGoodsService;
@Lazy
@Autowired
private PurchaseGoodsInfoService purchaseGoodsInfoService;
@Autowired @Autowired
private UpgradeGoodsServiceItemsRelationService upgradeGoodsServiceItemsRelationService; private UpgradeGoodsServiceItemsRelationService upgradeGoodsServiceItemsRelationService;
@Autowired @Autowired
...@@ -1083,6 +1087,14 @@ public class MerchantGoodsInfoService { ...@@ -1083,6 +1087,14 @@ public class MerchantGoodsInfoService {
.build(); .build();
upgradeGoodsService.changeShelfStatus(upgradeGoodsDTO); upgradeGoodsService.changeShelfStatus(upgradeGoodsDTO);
// 商品上架自动同步生成采购上架记录(待审核),失败不影响主流程
try {
purchaseGoodsInfoService.autoSyncFromMerchantGoods(merchantGoodsInfo, record.getUpdatedBy());
} catch (Exception e) {
log.error("autoSyncFromMerchantGoods invoke failed, merchantGoodsId={}", item, e);
}
pushGoodsManager.sendGoods(merchantGoodsInfo, record.getUpdatedBy()); pushGoodsManager.sendGoods(merchantGoodsInfo, record.getUpdatedBy());
//如果该商品是上架状态与场景是2.0的 自动开通场景 //如果该商品是上架状态与场景是2.0的 自动开通场景
if(SceneTypeEnum.SCENE1_0.getValue() == merchantGoodsInfo.getSceneType()) { if(SceneTypeEnum.SCENE1_0.getValue() == merchantGoodsInfo.getSceneType()) {
...@@ -1188,6 +1200,15 @@ public class MerchantGoodsInfoService { ...@@ -1188,6 +1200,15 @@ public class MerchantGoodsInfoService {
merchantGoodsInfo.getId(), ref.getMerchantId(), merchantGoodsInfo.getUpgradeGoodsId(), merchantGoodsInfo.getId(), ref.getMerchantId(), merchantGoodsInfo.getUpgradeGoodsId(),
finalUpgradeGoodsType, record.getUpdatedBy())); finalUpgradeGoodsType, record.getUpdatedBy()));
} }
// 商品上架自动同步生成采购上架记录(待审核),失败不影响主流程
log.info("商品上架, 同步生成采购上架记录开始");
try {
purchaseGoodsInfoService.autoSyncFromMerchantGoods(merchantGoodsInfo, record.getUpdatedBy());
} catch (Exception e) {
log.error("autoSyncFromMerchantGoods invoke failed, merchantGoodsId={}", item, e);
}
log.info("商品上架, 同步生成采购上架记录结束");
log.info("上架ID:{}处理完成",merchantGoodsInfo.getMerchantGoodsCode()); log.info("上架ID:{}处理完成",merchantGoodsInfo.getMerchantGoodsCode());
} }
}); });
......
...@@ -9,6 +9,9 @@ import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantInfoHistoryDTO; ...@@ -9,6 +9,9 @@ import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantInfoHistoryDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantGuaranteeConfigDTO; import cn.com.glsx.dj.smartcarlife.dto.merchant.MerchantGuaranteeConfigDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.ProductDetailDTO; import cn.com.glsx.dj.smartcarlife.dto.merchant.ProductDetailDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.ProductDetailHistoryDTO; import cn.com.glsx.dj.smartcarlife.dto.merchant.ProductDetailHistoryDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.UsedCarProfitRuleDTO;
import cn.com.glsx.dj.smartcarlife.dto.merchant.UsedCarTrafficTargetDTO;
import cn.com.glsx.dj.smartcarlife.enums.BaseSceneEnum;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantGuaranteeConfigMapper; import cn.com.glsx.dj.smartcarlife.mapper.MerchantGuaranteeConfigMapper;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantGuaranteeConfigHistoryMapper; import cn.com.glsx.dj.smartcarlife.mapper.MerchantGuaranteeConfigHistoryMapper;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreInfoHistoryMapper; import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreInfoHistoryMapper;
...@@ -16,12 +19,16 @@ import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreInfoMapper; ...@@ -16,12 +19,16 @@ import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreInfoMapper;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreProductDetailHistoryMapper; import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreProductDetailHistoryMapper;
import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreProductDetailMapper; import cn.com.glsx.dj.smartcarlife.mapper.MerchantStoreProductDetailMapper;
import cn.com.glsx.dj.smartcarlife.mapper.SceneMerchantRefUpdMapper; import cn.com.glsx.dj.smartcarlife.mapper.SceneMerchantRefUpdMapper;
import cn.com.glsx.dj.smartcarlife.mapper.UsedCarProfitRuleMapper;
import cn.com.glsx.dj.smartcarlife.mapper.UsedCarTrafficTargetMapper;
import cn.com.glsx.dj.smartcarlife.model.MerchantGuaranteeConfigHistory; import cn.com.glsx.dj.smartcarlife.model.MerchantGuaranteeConfigHistory;
import cn.com.glsx.dj.smartcarlife.model.MerchantStoreInfo; import cn.com.glsx.dj.smartcarlife.model.MerchantStoreInfo;
import cn.com.glsx.dj.smartcarlife.model.MerchantStoreInfoHistory; import cn.com.glsx.dj.smartcarlife.model.MerchantStoreInfoHistory;
import cn.com.glsx.dj.smartcarlife.model.MerchantStoreProductDetail; import cn.com.glsx.dj.smartcarlife.model.MerchantStoreProductDetail;
import cn.com.glsx.dj.smartcarlife.model.MerchantStoreProductDetailHistory; import cn.com.glsx.dj.smartcarlife.model.MerchantStoreProductDetailHistory;
import cn.com.glsx.dj.smartcarlife.model.SceneMerchantRefUpd; import cn.com.glsx.dj.smartcarlife.model.SceneMerchantRefUpd;
import cn.com.glsx.dj.smartcarlife.model.UsedCarProfitRule;
import cn.com.glsx.dj.smartcarlife.model.UsedCarTrafficTarget;
import cn.com.glsx.dj.smartcarlife.service.MerchantStoreInfoQueryService; import cn.com.glsx.dj.smartcarlife.service.MerchantStoreInfoQueryService;
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;
...@@ -59,6 +66,8 @@ public class MerchantStoreInfoQueryServiceImpl implements MerchantStoreInfoQuery ...@@ -59,6 +66,8 @@ public class MerchantStoreInfoQueryServiceImpl implements MerchantStoreInfoQuery
private final SceneMerchantRefUpdMapper sceneMerchantRefUpdMapper; private final SceneMerchantRefUpdMapper sceneMerchantRefUpdMapper;
private final MerchantGuaranteeConfigMapper merchantGuaranteeConfigMapper; private final MerchantGuaranteeConfigMapper merchantGuaranteeConfigMapper;
private final MerchantGuaranteeConfigHistoryMapper merchantGuaranteeConfigHistoryMapper; private final MerchantGuaranteeConfigHistoryMapper merchantGuaranteeConfigHistoryMapper;
private final UsedCarTrafficTargetMapper usedCarTrafficTargetMapper;
private final UsedCarProfitRuleMapper usedCarProfitRuleMapper;
@Autowired @Autowired
private MerchantRemote merchantRemote; private MerchantRemote merchantRemote;
...@@ -195,6 +204,26 @@ public class MerchantStoreInfoQueryServiceImpl implements MerchantStoreInfoQuery ...@@ -195,6 +204,26 @@ public class MerchantStoreInfoQueryServiceImpl implements MerchantStoreInfoQuery
responseDTO.setGuaranteeList(guaranteeList); responseDTO.setGuaranteeList(guaranteeList);
// 二手车业务场景,补充二手车流量方经营目标和分润规则
if (BaseSceneEnum.USED_CAR_RECYCLE.getBaseSceneCode().equals(queryDTO.getBaseSceneCode())
&& merchantStoreInfo.getTrafficPartyId() != null) {
UsedCarTrafficTarget target = usedCarTrafficTargetMapper.findByTrafficPartyId(merchantStoreInfo.getTrafficPartyId());
if (target != null) {
UsedCarTrafficTargetDTO targetDTO = new UsedCarTrafficTargetDTO();
BeanUtils.copyProperties(target, targetDTO);
responseDTO.setUsedCarTrafficTarget(targetDTO);
}
List<UsedCarProfitRule> rules = usedCarProfitRuleMapper.findByTrafficPartyId(merchantStoreInfo.getTrafficPartyId());
if (!CollectionUtils.isEmpty(rules)) {
List<UsedCarProfitRuleDTO> ruleDTOList = rules.stream().map(rule -> {
UsedCarProfitRuleDTO ruleDTO = new UsedCarProfitRuleDTO();
BeanUtils.copyProperties(rule, ruleDTO);
return ruleDTO;
}).collect(Collectors.toList());
responseDTO.setUsedCarProfitRuleList(ruleDTOList);
}
}
return responseDTO; return responseDTO;
} }
...@@ -251,6 +280,40 @@ public class MerchantStoreInfoQueryServiceImpl implements MerchantStoreInfoQuery ...@@ -251,6 +280,40 @@ public class MerchantStoreInfoQueryServiceImpl implements MerchantStoreInfoQuery
return merchantDetailResponseDTO; return merchantDetailResponseDTO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
// 如果是二手车业务场景,补充二手车流量方经营目标和分润规则
if (BaseSceneEnum.USED_CAR_RECYCLE.getBaseSceneCode().equals(queryDTO.getBaseSceneCode())) {
// 收集所有 trafficPartyId
Set<Integer> trafficPartyIdSet = merchantStoreInfo.stream()
.map(MerchantStoreInfo::getTrafficPartyId)
.filter(java.util.Objects::nonNull)
.collect(Collectors.toSet());
if (!trafficPartyIdSet.isEmpty()) {
// 逐个查询并填充(数据量一般不大,暂不做批量查询扩展)
for (MerchantDetailResponseDTO dto : responseDTOList) {
Integer trafficPartyId = dto.getMerchantInfo() != null ? dto.getMerchantInfo().getTrafficPartyId() : null;
if (trafficPartyId == null) {
continue;
}
UsedCarTrafficTarget target = usedCarTrafficTargetMapper.findByTrafficPartyId(trafficPartyId);
if (target != null) {
UsedCarTrafficTargetDTO targetDTO = new UsedCarTrafficTargetDTO();
BeanUtils.copyProperties(target, targetDTO);
dto.setUsedCarTrafficTarget(targetDTO);
}
List<UsedCarProfitRule> rules = usedCarProfitRuleMapper.findByTrafficPartyId(trafficPartyId);
if (!CollectionUtils.isEmpty(rules)) {
List<UsedCarProfitRuleDTO> ruleDTOList = rules.stream().map(rule -> {
UsedCarProfitRuleDTO ruleDTO = new UsedCarProfitRuleDTO();
BeanUtils.copyProperties(rule, ruleDTO);
return ruleDTO;
}).collect(Collectors.toList());
dto.setUsedCarProfitRuleList(ruleDTOList);
}
}
}
}
return responseDTOList; return responseDTOList;
} }
} }
...@@ -106,6 +106,20 @@ public class MerchantPurchaseGoodsRefService { ...@@ -106,6 +106,20 @@ public class MerchantPurchaseGoodsRefService {
} }
} }
public List<MerchantPurchaseGoodsRef> listByPurchaseGoodsIds(List<Integer> purchaseGoodsIds) {
RpcAssert.assertNotEmpty(purchaseGoodsIds,DefaultErrorEnum.DATA_NULL,"purchaseGoodsIds is null");
try {
Example example = new Example(MerchantPurchaseGoodsRef.class);
example.createCriteria()
.andEqualTo("deletedFlag", DeletedFlagEnum.N.name())
.andIn("purchaseGoodsId", purchaseGoodsIds);
return merchantPurchaseGoodsRefMapper.selectByExample(example);
}catch(Exception e) {
log.error(e.getMessage(),e);
throw new RpcServiceException(DefaultErrorEnum.DATA_EXIST,e.getMessage());
}
}
public List<MerchantPurchaseGoodsRef> listByGoodsIdsAndMerchantId(List<Integer> purchaseGoodsIds,Integer merchantId) { public List<MerchantPurchaseGoodsRef> listByGoodsIdsAndMerchantId(List<Integer> purchaseGoodsIds,Integer merchantId) {
RpcAssert.assertNotEmpty(purchaseGoodsIds,DefaultErrorEnum.DATA_NULL,"purchaseGoodsIds is null"); RpcAssert.assertNotEmpty(purchaseGoodsIds,DefaultErrorEnum.DATA_NULL,"purchaseGoodsIds is null");
RpcAssert.assertNotNull(merchantId,DefaultErrorEnum.DATA_NULL,"merchantId is null"); RpcAssert.assertNotNull(merchantId,DefaultErrorEnum.DATA_NULL,"merchantId is null");
......
...@@ -27,6 +27,10 @@ public class PurchaseGoodsLogService { ...@@ -27,6 +27,10 @@ public class PurchaseGoodsLogService {
private PurchaseGoodsLogMapper purchaseGoodsLogMapper; private PurchaseGoodsLogMapper purchaseGoodsLogMapper;
public void insert(PurchaseGoodsLogType logType,Integer purchaseGoodsId,String updatedBy) { public void insert(PurchaseGoodsLogType logType,Integer purchaseGoodsId,String updatedBy) {
insert(logType, purchaseGoodsId, updatedBy, MessageFormat.format(logType.getMessage(),updatedBy));
}
public void insert(PurchaseGoodsLogType logType,Integer purchaseGoodsId,String updatedBy,String logContent) {
RpcAssert.assertNotNull(logType,DefaultErrorEnum.DATA_NULL,"logType is null"); RpcAssert.assertNotNull(logType,DefaultErrorEnum.DATA_NULL,"logType is null");
RpcAssert.assertNotNull(purchaseGoodsId,DefaultErrorEnum.DATA_NULL,"purchaseGoodsId is null"); RpcAssert.assertNotNull(purchaseGoodsId,DefaultErrorEnum.DATA_NULL,"purchaseGoodsId is null");
RpcAssert.assertNotEmpty(updatedBy,DefaultErrorEnum.DATA_NULL,"updatedBy is null"); RpcAssert.assertNotEmpty(updatedBy,DefaultErrorEnum.DATA_NULL,"updatedBy is null");
...@@ -36,7 +40,7 @@ public class PurchaseGoodsLogService { ...@@ -36,7 +40,7 @@ public class PurchaseGoodsLogService {
.createdBy(updatedBy).updatedBy(updatedBy).createdDate(now).updatedDate(now) .createdBy(updatedBy).updatedBy(updatedBy).createdDate(now).updatedDate(now)
.deletedFlag(DeletedFlagEnum.N.name()).purchaseGoodsId(purchaseGoodsId) .deletedFlag(DeletedFlagEnum.N.name()).purchaseGoodsId(purchaseGoodsId)
.logType(logType.getValue()) .logType(logType.getValue())
.logContent(MessageFormat.format(logType.getMessage(),updatedBy)) .logContent(logContent)
.build(); .build();
purchaseGoodsLogMapper.insertUseGeneratedKeys(record); purchaseGoodsLogMapper.insertUseGeneratedKeys(record);
}catch(Exception e) { }catch(Exception e) {
......
...@@ -5,6 +5,7 @@ import cn.com.glsx.dj.smartcarlife.model.MerchantShopGoodsStock; ...@@ -5,6 +5,7 @@ import cn.com.glsx.dj.smartcarlife.model.MerchantShopGoodsStock;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
...@@ -25,8 +26,10 @@ import com.github.pagehelper.PageHelper; ...@@ -25,8 +26,10 @@ import com.github.pagehelper.PageHelper;
import cn.com.glsx.dj.smartcarlife.dto.StockAllocateDetailDTO; import cn.com.glsx.dj.smartcarlife.dto.StockAllocateDetailDTO;
import cn.com.glsx.dj.smartcarlife.dto.StockAllocateRecordDTO; import cn.com.glsx.dj.smartcarlife.dto.StockAllocateRecordDTO;
import cn.com.glsx.dj.smartcarlife.mapper.StockAllocateDetailMapper; import cn.com.glsx.dj.smartcarlife.mapper.StockAllocateDetailMapper;
import cn.com.glsx.dj.smartcarlife.mapper.UpgradeGoodsMapper;
import cn.com.glsx.dj.smartcarlife.model.StockAllocateDetail; import cn.com.glsx.dj.smartcarlife.model.StockAllocateDetail;
import cn.com.glsx.dj.smartcarlife.model.StockAllocateRecord; import cn.com.glsx.dj.smartcarlife.model.StockAllocateRecord;
import cn.com.glsx.dj.smartcarlife.model.UpgradeGoods;
import cn.com.glsx.framework.core.beans.BaseModel; import cn.com.glsx.framework.core.beans.BaseModel;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
...@@ -43,6 +46,9 @@ public class StockAllocateDetailService { ...@@ -43,6 +46,9 @@ public class StockAllocateDetailService {
private StockAllocateDetailMapper stockAllocateDetailMapper; private StockAllocateDetailMapper stockAllocateDetailMapper;
@Autowired @Autowired
private UpgradeGoodsMapper upgradeGoodsMapper;
@Autowired
private StockAllocateRecordService stockAllocateRecordService; private StockAllocateRecordService stockAllocateRecordService;
@Autowired @Autowired
...@@ -53,7 +59,20 @@ public class StockAllocateDetailService { ...@@ -53,7 +59,20 @@ public class StockAllocateDetailService {
try { try {
Date now = new Date(); Date now = new Date();
List<Integer> collected = list.stream().map(StockAllocateDetail::getGoodsId) List<Integer> collected = list.stream().map(StockAllocateDetail::getGoodsId)
.filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toList());
// 商品id与产品ID(commodity_code)的对应关系
Map<Integer, String> commodityCodeMap = new HashMap<>();
if (!collected.isEmpty()) {
List<UpgradeGoods> upgradeGoodsList = upgradeGoodsMapper.listCommodityCodeByIds(collected);
if (CollectionUtils.isNotEmpty(upgradeGoodsList)) {
for (UpgradeGoods upgradeGoods : upgradeGoodsList) {
if (Objects.nonNull(upgradeGoods.getId())) {
commodityCodeMap.putIfAbsent(upgradeGoods.getId(), upgradeGoods.getCommodityCode());
}
}
}
}
Map<StockKey, MerchantShopGoodsStock> stockIndex = new ConcurrentHashMap<>(); Map<StockKey, MerchantShopGoodsStock> stockIndex = new ConcurrentHashMap<>();
Map<StockKey, MerchantShopGoodsStock> callInStockIndex = new ConcurrentHashMap<>(); Map<StockKey, MerchantShopGoodsStock> callInStockIndex = new ConcurrentHashMap<>();
Integer callOutYqMerchantId = stockAllocateRecordDTO.getCallOutYqMerchantId(); Integer callOutYqMerchantId = stockAllocateRecordDTO.getCallOutYqMerchantId();
...@@ -71,6 +90,7 @@ public class StockAllocateDetailService { ...@@ -71,6 +90,7 @@ public class StockAllocateDetailService {
for (StockAllocateDetail record : list) { for (StockAllocateDetail record : list) {
record.setAllocateCode(stockAllocateRecordDTO.getAllocateCode()); record.setAllocateCode(stockAllocateRecordDTO.getAllocateCode());
record.setInputNumber(BigDecimal.valueOf(0)); record.setInputNumber(BigDecimal.valueOf(0));
record.setUpgradeCommodityCode(commodityCodeMap.get(record.getGoodsId()));
// === 调出库存 === // === 调出库存 ===
StockKey outKey = new StockKey( StockKey outKey = new StockKey(
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
<result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" /> <result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" />
<result column="goods_type" jdbcType="INTEGER" property="goodsType" /> <result column="goods_type" jdbcType="INTEGER" property="goodsType" />
<result column="product_code" jdbcType="VARCHAR" property="productCode"/> <result column="product_code" jdbcType="VARCHAR" property="productCode"/>
<result column="commodity_code" jdbcType="VARCHAR" property="commodityCode"/>
<result column="dclsar_call_out_yq_merchant_id" jdbcType="INTEGER" property="stockAllocateCallOutYqMerchantId" /> <result column="dclsar_call_out_yq_merchant_id" jdbcType="INTEGER" property="stockAllocateCallOutYqMerchantId" />
<result column="specification_data" property="specificationData"/> <result column="specification_data" property="specificationData"/>
<result column="specification_type_sequence" property="specificationTypeSequence"/> <result column="specification_type_sequence" property="specificationTypeSequence"/>
...@@ -90,6 +91,10 @@ ...@@ -90,6 +91,10 @@
<if test="upgradeGoodsName !=null and upgradeGoodsName !=''"> <if test="upgradeGoodsName !=null and upgradeGoodsName !=''">
and dclug.upgrade_goods_name like concat('%', #{upgradeGoodsName}, '%') and dclug.upgrade_goods_name like concat('%', #{upgradeGoodsName}, '%')
</if> </if>
<if test="commodityCode !=null and commodityCode !=''">
and dclug.commodity_code like concat('%', #{commodityCode}, '%')
</if>
<if test="yqMerchantId !=null and yqMerchantId !='' "> <if test="yqMerchantId !=null and yqMerchantId !='' ">
and dclgwi.yq_merchant_id = #{yqMerchantId} and dclgwi.yq_merchant_id = #{yqMerchantId}
</if> </if>
...@@ -165,7 +170,7 @@ ...@@ -165,7 +170,7 @@
delivery_number, yq_merchant_id, yq_merchant_name, shop_type, dclgwi.merchant_id, merchant_name,dclgwi.upgrade_flag, dclgwi.delivery_detail_id, delivery_number, yq_merchant_id, yq_merchant_name, shop_type, dclgwi.merchant_id, merchant_name,dclgwi.upgrade_flag, dclgwi.delivery_detail_id,
dclgwi.purchase_order_goods_id,dclgwi.allocate_order_goods_id, dclgwi.purchase_order_goods_id,dclgwi.allocate_order_goods_id,
dclgwi.created_by, dclgwi.created_date, dclgwi.updated_by, dclgwi.updated_date, dclgwi.deleted_flag, dclgwi.updated_user_name, dclug.type as product_code, dclgwi.created_by, dclgwi.created_date, dclgwi.updated_by, dclgwi.updated_date, dclgwi.deleted_flag, dclgwi.updated_user_name, dclug.type as product_code,
dclug.specification_data,dclug.specification_type_sequence, dclgwi.inventory_type, dclgwi.warehousing_method dclug.specification_data,dclug.specification_type_sequence, dclug.commodity_code, dclgwi.inventory_type, dclgwi.warehousing_method
from dj_car_life_goods_warehousing_info dclgwi from dj_car_life_goods_warehousing_info dclgwi
left join dj_car_life_upgrade_goods dclug on dclgwi.upgrade_goods_id = dclug.id left join dj_car_life_upgrade_goods dclug on dclgwi.upgrade_goods_id = dclug.id
left join dj_car_life_goods_info dclgi on dclgi.deleted_flag = 'N' and dclgi.goods_code = dclug.goods_code left join dj_car_life_goods_info dclgi on dclgi.deleted_flag = 'N' and dclgi.goods_code = dclug.goods_code
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="DTOResultMap" type="cn.com.glsx.dj.smartcarlife.dto.MerchantGoodsStockReduceRecordDTO"> <resultMap extends="BaseResultMap" id="DTOResultMap" type="cn.com.glsx.dj.smartcarlife.dto.MerchantGoodsStockReduceRecordDTO">
<result column="upgrade_goods_name" jdbcType="VARCHAR" property="upgradeGoodsName" /> <result column="upgrade_goods_name" jdbcType="VARCHAR" property="upgradeGoodsName" />
<result column="commodity_code" jdbcType="VARCHAR" property="commodityCode" />
<result column="goods_series" jdbcType="VARCHAR" property="goodsSeries" /> <result column="goods_series" jdbcType="VARCHAR" property="goodsSeries" />
<result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" /> <result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" />
<result column="goods_type" jdbcType="INTEGER" property="goodsType" /> <result column="goods_type" jdbcType="INTEGER" property="goodsType" />
...@@ -82,6 +83,9 @@ ...@@ -82,6 +83,9 @@
<if test="upgradeGoodsName != null and upgradeGoodsName != ''"> <if test="upgradeGoodsName != null and upgradeGoodsName != ''">
and dclug.upgrade_goods_name like CONCAT('%', #{upgradeGoodsName},'%') and dclug.upgrade_goods_name like CONCAT('%', #{upgradeGoodsName},'%')
</if> </if>
<if test="commodityCode != null and commodityCode != ''">
and dclug.commodity_code like CONCAT('%', #{commodityCode},'%')
</if>
<if test="yqMerchantId != null"> <if test="yqMerchantId != null">
and dclmgsrr.yq_merchant_id = #{yqMerchantId} and dclmgsrr.yq_merchant_id = #{yqMerchantId}
</if> </if>
...@@ -127,7 +131,7 @@ ...@@ -127,7 +131,7 @@
reduce_stock_money, business_code,dclmgsrr.upgrade_flag, dclmgsrr.film_roll_no, reduce_stock_money, business_code,dclmgsrr.upgrade_flag, dclmgsrr.film_roll_no,
event_type, dclmgsrr.technician_phone,dclmgsrr.technician_name,dclmgsrr.remark, dclmgsrr.inventory_type, event_type, dclmgsrr.technician_phone,dclmgsrr.technician_name,dclmgsrr.remark, dclmgsrr.inventory_type,
dclmgsrr.created_by, dclmgsrr.created_date, dclmgsrr.updated_by,dclmgsrr.updated_user_name, dclmgsrr.updated_date, dclmgsrr.created_by, dclmgsrr.created_date, dclmgsrr.updated_by,dclmgsrr.updated_user_name, dclmgsrr.updated_date,
dclmgsrr.deleted_flag, dclmgsrr.store_usage, dclmgsrr.order_upgrade_goods_id, dclug.upgrade_goods_name, dclug.type as product_code, dclmgsrr.deleted_flag, dclmgsrr.store_usage, dclmgsrr.order_upgrade_goods_id, dclug.upgrade_goods_name, dclug.commodity_code, dclug.type as product_code,
dclug.specification_data,dclug.specification_type_sequence, dclmgsrr.inventory_type,po.success_date,dclmgsrr.reduce_method dclug.specification_data,dclug.specification_type_sequence, dclmgsrr.inventory_type,po.success_date,dclmgsrr.reduce_method
from dj_car_life_merchant_goods_stock_reduce_record dclmgsrr from dj_car_life_merchant_goods_stock_reduce_record dclmgsrr
left join dj_car_life_upgrade_goods dclug on dclmgsrr.upgrade_goods_id = dclug.id left join dj_car_life_upgrade_goods dclug on dclmgsrr.upgrade_goods_id = dclug.id
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
<result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" /> <result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" />
<result column="product_code" jdbcType="VARCHAR" property="productCode"/> <result column="product_code" jdbcType="VARCHAR" property="productCode"/>
<result column="upgrade_goods_name" jdbcType="VARCHAR" property="upgradeGoodsName" /> <result column="upgrade_goods_name" jdbcType="VARCHAR" property="upgradeGoodsName" />
<result column="commodity_code" jdbcType="VARCHAR" property="commodityCode" />
<result column="partner_merchant_id" jdbcType="INTEGER" property="partnerMerchantId"/> <result column="partner_merchant_id" jdbcType="INTEGER" property="partnerMerchantId"/>
<result column="partner_merchant_name" jdbcType="VARCHAR" property="partnerMerchantName"/> <result column="partner_merchant_name" jdbcType="VARCHAR" property="partnerMerchantName"/>
<result column="warning_value" jdbcType="DECIMAL" property="warningValue" /> <result column="warning_value" jdbcType="DECIMAL" property="warningValue" />
...@@ -47,7 +48,7 @@ ...@@ -47,7 +48,7 @@
dclug.type as product_code, dclgi.goods_name as goods_series, dclgi.goods_type_name, dclug.type as product_code, dclgi.goods_name as goods_series, dclgi.goods_type_name,
dclgi.goods_type, dclmsgs.stock, dclmsgs.created_by, dclmsgs.created_date,dclmsgs.film_roll_no, dclgi.goods_type, dclmsgs.stock, dclmsgs.created_by, dclmsgs.created_date,dclmsgs.film_roll_no,
dclmsgs.updated_by, dclmsgs.updated_date, dclmsgs.deleted_flag, dclmsgs.updated_by, dclmsgs.updated_date, dclmsgs.deleted_flag,
dclug.upgrade_goods_name,dclug.warning_value,dclug.type, dclug.upgrade_goods_name,dclug.warning_value,dclug.type, dclug.commodity_code,
dclug.specification_data,dclug.specification_type_sequence, dclug.specification_data,dclug.specification_type_sequence,
dclyc.partner_merchant_id, dclyc.partner_merchant_name dclyc.partner_merchant_id, dclyc.partner_merchant_name
from dj_car_life_merchant_shop_goods_stock dclmsgs from dj_car_life_merchant_shop_goods_stock dclmsgs
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<result column="goods_type" jdbcType="INTEGER" property="goodsType" /> <result column="goods_type" jdbcType="INTEGER" property="goodsType" />
<result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" /> <result column="goods_type_name" jdbcType="VARCHAR" property="goodsTypeName" />
<result column="upgrade_goods_id" jdbcType="INTEGER" property="upgradeGoodsId" /> <result column="upgrade_goods_id" jdbcType="INTEGER" property="upgradeGoodsId" />
<result column="upgrade_commodity_code" jdbcType="VARCHAR" property="upgradeCommodityCode" />
<result column="purchase_order_goods_id" property="purchaseOrderGoodsId"/> <result column="purchase_order_goods_id" property="purchaseOrderGoodsId"/>
<result column="allocate_order_goods_id" property="allocateOrderGoodsId"/> <result column="allocate_order_goods_id" property="allocateOrderGoodsId"/>
<result column="type" jdbcType="VARCHAR" property="type" /> <result column="type" jdbcType="VARCHAR" property="type" />
...@@ -35,7 +36,7 @@ ...@@ -35,7 +36,7 @@
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, order_delivery_id, order_code, goods_code, goods_name, goods_type, goods_type_name, id, order_delivery_id, order_code, goods_code, goods_name, goods_type, goods_type_name,
upgrade_goods_id,purchase_order_goods_id, allocate_order_goods_id, type, upgrade_goods_name, purchase_goods_name, third_party_code, third_party_name, purchase_number, stock_num, put_status, delivery_remark, created_by, upgrade_goods_id, upgrade_commodity_code, purchase_order_goods_id, allocate_order_goods_id, type, upgrade_goods_name, purchase_goods_name, third_party_code, third_party_name, purchase_number, stock_num, put_status, delivery_remark, created_by,
created_date, updated_by, updated_date, deleted_flag created_date, updated_by, updated_date, deleted_flag
</sql> </sql>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDetailDTO" extends="BaseResultMap"> <resultMap id="DTOResultMap" type="cn.com.glsx.dj.smartcarlife.dto.PurchaseOrderDeliveryDetailDTO" extends="BaseResultMap">
...@@ -65,7 +66,6 @@ ...@@ -65,7 +66,6 @@
<result column="pendingStockCount" property="pendingStockCount" jdbcType="BIGINT"/> <result column="pendingStockCount" property="pendingStockCount" jdbcType="BIGINT"/>
<result column="inStockCount" property="inStockCount" jdbcType="BIGINT"/> <result column="inStockCount" property="inStockCount" jdbcType="BIGINT"/>
<result column="totalCount" property="totalCount" jdbcType="BIGINT"/> <result column="totalCount" property="totalCount" jdbcType="BIGINT"/>
<result column="upgrade_goods_commodity_code" property="upgradeCommodityCode" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
sar.call_out_merchant_id, sar.call_out_merchant_name, sar.call_out_merchant_id, sar.call_out_merchant_name,
sar.call_out_yq_merchant_id, sar.call_out_yq_merchant_name, sar.call_out_yq_merchant_id, sar.call_out_yq_merchant_name,
sad.film_roll_no, sad.film_roll_no,
dclpog.upgrade_goods_commodity_code dclpodd.upgrade_commodity_code
from dj_car_life_purchase_order_delivery_detail dclpodd from dj_car_life_purchase_order_delivery_detail dclpodd
left join dj_car_life_purchase_order_delivery dclpod on dclpodd.order_delivery_id = dclpod.id and dclpod.deleted_flag = 'N' left join dj_car_life_purchase_order_delivery dclpod on dclpodd.order_delivery_id = dclpod.id and dclpod.deleted_flag = 'N'
left join dj_car_life_purchase_order dclpo on dclpo.order_code = dclpodd.order_code and dclpo.deleted_flag = 'N' left join dj_car_life_purchase_order dclpo on dclpo.order_code = dclpodd.order_code and dclpo.deleted_flag = 'N'
...@@ -225,6 +225,18 @@ ...@@ -225,6 +225,18 @@
<if test="orderDeliveryId != null"> <if test="orderDeliveryId != null">
and dclpodd.order_delivery_id = #{orderDeliveryId} and dclpodd.order_delivery_id = #{orderDeliveryId}
</if> </if>
<if test="upgradeCommodityCode != null and upgradeCommodityCode != ''">
and exists (
select 1
from dj_car_life_purchase_order_delivery_detail dd2
where dd2.deleted_flag = 'N'
and dd2.order_delivery_id = dclpodd.order_delivery_id
and dd2.upgrade_commodity_code like CONCAT('%', #{upgradeCommodityCode},'%')
)
</if>
</where> </where>
order by dclpod.delivery_date desc, dclpodd.id desc order by dclpod.delivery_date desc, dclpodd.id desc
</select> </select>
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
<result column="detail_allocate_order_goods_id" jdbcType="INTEGER" property="allocateOrderGoodsId" /> <result column="detail_allocate_order_goods_id" jdbcType="INTEGER" property="allocateOrderGoodsId" />
<result column="detail_type" jdbcType="VARCHAR" property="type" /> <result column="detail_type" jdbcType="VARCHAR" property="type" />
<result column="detail_upgrade_goods_name" jdbcType="VARCHAR" property="upgradeGoodsName" /> <result column="detail_upgrade_goods_name" jdbcType="VARCHAR" property="upgradeGoodsName" />
<result column="detail_upgrade_commodity_code" jdbcType="VARCHAR" property="upgradeCommodityCode" />
<result column="detail_purchase_number" jdbcType="DECIMAL" property="purchaseNumber" /> <result column="detail_purchase_number" jdbcType="DECIMAL" property="purchaseNumber" />
<result column="detail_stock_num" jdbcType="DECIMAL" property="stockNum" /> <result column="detail_stock_num" jdbcType="DECIMAL" property="stockNum" />
<result column="detail_delivery_remark" jdbcType="DECIMAL" property="deliveryRemark" /> <result column="detail_delivery_remark" jdbcType="DECIMAL" property="deliveryRemark" />
...@@ -73,6 +74,7 @@ ...@@ -73,6 +74,7 @@
<result column="detail_purchase_goods_name" jdbcType="VARCHAR" property="purchaseGoodsName" /> <result column="detail_purchase_goods_name" jdbcType="VARCHAR" property="purchaseGoodsName" />
<result column="detail_third_party_code" jdbcType="VARCHAR" property="thirdPartyCode" /> <result column="detail_third_party_code" jdbcType="VARCHAR" property="thirdPartyCode" />
<result column="detail_third_party_name" jdbcType="VARCHAR" property="thirdPartyName" /> <result column="detail_third_party_name" jdbcType="VARCHAR" property="thirdPartyName" />
<result column="detail_upgrade_goods_commodity_code" jdbcType="VARCHAR" property="upgradeCommodityCode" />
</collection> </collection>
</resultMap> </resultMap>
...@@ -108,6 +110,7 @@ ...@@ -108,6 +110,7 @@
dd.upgrade_goods_id as detail_upgrade_goods_id, dd.upgrade_goods_id as detail_upgrade_goods_id,
dd.type as detail_type, dd.type as detail_type,
dd.upgrade_goods_name as detail_upgrade_goods_name, dd.upgrade_goods_name as detail_upgrade_goods_name,
dd.upgrade_commodity_code as detail_upgrade_commodity_code,
dd.purchase_number as detail_purchase_number, dd.purchase_number as detail_purchase_number,
dd.stock_num as detail_stock_num, dd.stock_num as detail_stock_num,
dd.purchase_order_goods_id as detail_purchase_order_goods_id, dd.purchase_order_goods_id as detail_purchase_order_goods_id,
...@@ -116,6 +119,7 @@ ...@@ -116,6 +119,7 @@
dd.purchase_goods_name as detail_purchase_goods_name, dd.purchase_goods_name as detail_purchase_goods_name,
dd.third_party_code as detail_third_party_code, dd.third_party_code as detail_third_party_code,
dd.third_party_name as detail_third_party_name, dd.third_party_name as detail_third_party_name,
dd.upgrade_commodity_code as detail_upgrade_goods_commodity_code,
dclpog.specification_data as detail_specification_data dclpog.specification_data as detail_specification_data
from (select id, from (select id,
order_code, order_code,
...@@ -179,6 +183,7 @@ ...@@ -179,6 +183,7 @@
dd.purchase_goods_name as detail_purchase_goods_name, dd.purchase_goods_name as detail_purchase_goods_name,
dd.third_party_code as detail_third_party_code, dd.third_party_code as detail_third_party_code,
dd.third_party_name as detail_third_party_name, dd.third_party_name as detail_third_party_name,
dd.upgrade_commodity_code as detail_upgrade_goods_commodity_code,
if(main.order_type = 1, sar.remark, po.remark) as purchase_order_remark, if(main.order_type = 1, sar.remark, po.remark) as purchase_order_remark,
concat(ifnull(if(main.order_type = 1, sar.remark, po.remark), ''), ifnull(dd.delivery_remark, '')) as detail_delivery_remark, concat(ifnull(if(main.order_type = 1, sar.remark, po.remark), ''), ifnull(dd.delivery_remark, '')) as detail_delivery_remark,
if(main.order_type = 1, sad.specification_data, dclpog.specification_data) as detail_specification_data, if(main.order_type = 1, sad.specification_data, dclpog.specification_data) as detail_specification_data,
...@@ -254,6 +259,7 @@ ...@@ -254,6 +259,7 @@
sad.specification_data as detail_specification_data, sad.specification_data as detail_specification_data,
dd.purchase_order_goods_id as detail_purchase_order_goods_id, dd.purchase_order_goods_id as detail_purchase_order_goods_id,
dd.allocate_order_goods_id as detail_allocate_order_goods_id, dd.allocate_order_goods_id as detail_allocate_order_goods_id,
dd.upgrade_commodity_code as detail_upgrade_goods_commodity_code,
sar.created_by as allocate_createdBy, sar.created_by as allocate_createdBy,
sar.call_in_merchant_id as allocate_callInMerchantId, sar.call_in_merchant_id as allocate_callInMerchantId,
sar.call_in_merchant_name as allocate_callInMerchantName, sar.call_in_merchant_name as allocate_callInMerchantName,
...@@ -297,6 +303,7 @@ ...@@ -297,6 +303,7 @@
) main ) main
left join dj_car_life_purchase_order_delivery_detail dd on dd.deleted_flag = 'N' and main.id = dd.order_delivery_id left join dj_car_life_purchase_order_delivery_detail dd on dd.deleted_flag = 'N' and main.id = dd.order_delivery_id
left join dj_car_life_stock_allocate_detail sad on sad.deleted_flag = 'N' and sad.allocate_code = dd.order_code and sad.goods_id = dd.upgrade_goods_id left join dj_car_life_stock_allocate_detail sad on sad.deleted_flag = 'N' and sad.allocate_code = dd.order_code and sad.goods_id = dd.upgrade_goods_id
left join dj_car_life_purchase_order_goods dclpog on dclpog.id = dd.purchase_order_goods_id and dclpog.deleted_flag = 'N'
left join dj_car_life_stock_allocate_record sar on sar.allocate_code = sad.allocate_code and sar.deleted_flag = 'N' left join dj_car_life_stock_allocate_record sar on sar.allocate_code = sad.allocate_code and sar.deleted_flag = 'N'
order by main.delivery_date desc order by main.delivery_date desc
/*customLimitPlace*/ /*customLimitPlace*/
......
...@@ -718,6 +718,16 @@ ...@@ -718,6 +718,16 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="commodityCode != null and commodityCode != ''">
and exists(
select 1
from dj_car_life_purchase_order_goods og2
where og2.order_code = po.order_code
and og2.deleted_flag = 'N'
and og2.is_allocate = 0
and og2.upgrade_goods_commodity_code like CONCAT('%', #{commodityCode},'%')
)
</if>
</where> </where>
</sql> </sql>
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<collection property="purchaseOrderGoods" ofType="cn.com.glsx.dj.smartcarlife.model.PurchaseOrderGoods"> <collection property="purchaseOrderGoods" ofType="cn.com.glsx.dj.smartcarlife.model.PurchaseOrderGoods">
<result column="og_id" property="id" jdbcType="INTEGER"/> <result column="og_id" property="id" jdbcType="INTEGER"/>
<result column="upgrade_goods_id" jdbcType="INTEGER" property="upgradeGoodsId" /> <result column="upgrade_goods_id" jdbcType="INTEGER" property="upgradeGoodsId" />
<result column="upgrade_goods_name" property="upgradeGoodsName" jdbcType="VARCHAR" />
<result column="upgrade_goods_commodity_code" property="upgradeGoodsCommodityCode" jdbcType="VARCHAR" /> <result column="upgrade_goods_commodity_code" property="upgradeGoodsCommodityCode" jdbcType="VARCHAR" />
<result column="allocate_code" property="allocateCode" jdbcType="VARCHAR"/> <result column="allocate_code" property="allocateCode" jdbcType="VARCHAR"/>
<result column="call_out_yq_merchant_id" property="callOutYqMerchantId" jdbcType="VARCHAR"/> <result column="call_out_yq_merchant_id" property="callOutYqMerchantId" jdbcType="VARCHAR"/>
...@@ -250,6 +251,15 @@ ...@@ -250,6 +251,15 @@
and dclpog.is_allocate = 1 and dclpog.is_allocate = 1
) )
</if> </if>
<if test="commodityCode != null and commodityCode != ''">
and exists(
select 1
from dj_car_life_purchase_order_goods dclpog
where dclpog.order_code = po.order_code
and dclpog.deleted_flag = 'N'
and dclpog.upgrade_goods_commodity_code like CONCAT('%', #{commodityCode},'%')
)
</if>
</sql> </sql>
<sql id="List_Condition_NoSubquery"> <sql id="List_Condition_NoSubquery">
...@@ -582,7 +592,7 @@ ...@@ -582,7 +592,7 @@
if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address, if(po.province_name is null ,po.contact_address,concat(po.province_name,po.city_name,po.area_name,po.contact_address)) as contact_address,
po.purchasing_pattern, po.send_out_merchant_id, po.send_out_merchant_name, po.remark, po.purchasing_pattern, po.send_out_merchant_id, po.send_out_merchant_name, po.remark,
if(po.purchase_type=1,ifnull(po.delivery_status,1),po.delivery_status) delivery_status, if(po.purchase_type=1,ifnull(po.delivery_status,1),po.delivery_status) delivery_status,
dclpog.upgrade_goods_id, dclpog.upgrade_goods_name, dclpog.type, dclpog.specification_data, dclpog.goods_name, dclpog.upgrade_goods_id, dclpog.upgrade_goods_name, dclpog.upgrade_goods_commodity_code, dclpog.type, dclpog.specification_data, dclpog.goods_name,
dclpog.goods_type, dclpog.goods_type_name, dclpog.goods_number, dclpog.conversion_value, dclpog.purchase_number, dclpog.goods_type, dclpog.goods_type_name, dclpog.goods_number, dclpog.conversion_value, dclpog.purchase_number,
dclpog.input_number, dclpog.goods_total_price,dclpog.remark as pog_remark,dclpog.refund_status, dclpog.input_number, dclpog.goods_total_price,dclpog.remark as pog_remark,dclpog.refund_status,
dclpog.shopping_car_id, dclpog.shopping_car_id,
...@@ -647,6 +657,15 @@ ...@@ -647,6 +657,15 @@
<if test="onlyAllocateOrder != null and onlyAllocateOrder"> <if test="onlyAllocateOrder != null and onlyAllocateOrder">
and dclpog.is_allocate = 1 and dclpog.is_allocate = 1
</if> </if>
<if test="commodityCode != null and commodityCode != ''">
and exists (
select 1
from dj_car_life_purchase_order_goods pog2
where pog2.deleted_flag = 'N'
and pog2.order_code = po.order_code
and pog2.upgrade_goods_commodity_code like concat('%',#{commodityCode},'%')
)
</if>
</where> </where>
order by (case when po.status = 1 then 3 order by (case when po.status = 1 then 3
when po.status in (2,5,8,10) then 2 when po.status in (2,5,8,10) then 2
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<result column="allocate_code" property="allocateCode" jdbcType="VARCHAR" /> <result column="allocate_code" property="allocateCode" jdbcType="VARCHAR" />
<result column="goods_id" property="goodsId" jdbcType="INTEGER" /> <result column="goods_id" property="goodsId" jdbcType="INTEGER" />
<result column="goods_name" property="goodsName" jdbcType="VARCHAR" /> <result column="goods_name" property="goodsName" jdbcType="VARCHAR" />
<result column="upgrade_commodity_code" property="upgradeCommodityCode" jdbcType="VARCHAR" />
<result column="product_code" property="productCode"/> <result column="product_code" property="productCode"/>
<result column="source_material_id" property="sourceMaterialId" jdbcType="INTEGER" /> <result column="source_material_id" property="sourceMaterialId" jdbcType="INTEGER" />
<result column="source_material_name" property="sourceMaterialName" jdbcType="VARCHAR" /> <result column="source_material_name" property="sourceMaterialName" jdbcType="VARCHAR" />
...@@ -32,7 +33,7 @@ ...@@ -32,7 +33,7 @@
</resultMap> </resultMap>
<resultMap id="StockAllocateDetailDTOMap" type="cn.com.glsx.dj.smartcarlife.dto.StockAllocateDetailDTO" extends="BaseResultMap"> <resultMap id="StockAllocateDetailDTOMap" type="cn.com.glsx.dj.smartcarlife.dto.StockAllocateDetailDTO" extends="BaseResultMap">
<result column="commodity_code" property="upgradeGoodsCommodityCode" jdbcType="VARCHAR" /> <result column="upgrade_commodity_code" property="upgradeGoodsCommodityCode" jdbcType="VARCHAR" />
<result column="specification_data" property="specificationData"/> <result column="specification_data" property="specificationData"/>
<result column="specification_type_sequence" property="specificationTypeSequence"/> <result column="specification_type_sequence" property="specificationTypeSequence"/>
</resultMap> </resultMap>
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, allocate_code, goods_id, goods_name,product_code, source_material_id, source_material_name, id, allocate_code, goods_id, goods_name, upgrade_commodity_code, product_code, source_material_id, source_material_name,
goods_type, goods_type_name, allocate_number, deleted_flag, created_by, created_date, goods_type, goods_type_name, allocate_number, deleted_flag, created_by, created_date,
updated_by, updated_date,product_code,conversion_value, delivery_number, delivery_status, upgrade_purchase_price,input_number,specification_data, updated_by, updated_date,product_code,conversion_value, delivery_number, delivery_status, upgrade_purchase_price,input_number,specification_data,
out_stock_qty,in_stock_qty out_stock_qty,in_stock_qty
...@@ -58,7 +59,7 @@ ...@@ -58,7 +59,7 @@
sad.out_stock_qty,sad.in_stock_qty, sad.out_stock_qty,sad.in_stock_qty,
gi.goods_type,gi.goods_type_name,sad.allocate_number,sad.deleted_flag,sad.created_by,sad.created_date, gi.goods_type,gi.goods_type_name,sad.allocate_number,sad.deleted_flag,sad.created_by,sad.created_date,
sad.updated_by, sad.updated_date, sad.film_roll_no, sad.delivery_number, sad.input_number, sad.delivery_status, sad.updated_by, sad.updated_date, sad.film_roll_no, sad.delivery_number, sad.input_number, sad.delivery_status,
ug.specification_data,ug.specification_type_sequence,ug.commodity_code ug.specification_data,ug.specification_type_sequence,sad.upgrade_commodity_code
from dj_car_life_stock_allocate_detail sad from dj_car_life_stock_allocate_detail sad
left join dj_car_life_upgrade_goods ug on sad.goods_id = ug.id and ug.deleted_flag ='N' left join dj_car_life_upgrade_goods ug on sad.goods_id = ug.id and ug.deleted_flag ='N'
left join dj_car_life_goods_info gi on gi.goods_code= ug.goods_code and gi.deleted_flag ='N' left join dj_car_life_goods_info gi on gi.goods_code= ug.goods_code and gi.deleted_flag ='N'
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
<result column="type" jdbcType="VARCHAR" property="productCode"/> <result column="type" jdbcType="VARCHAR" property="productCode"/>
<result column="specification_data" property="specificationData"/> <result column="specification_data" property="specificationData"/>
<result column="specification_type_sequence" property="specificationTypeSequence"/> <result column="specification_type_sequence" property="specificationTypeSequence"/>
<result column="commodity_code" property="commodityCode"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -130,6 +131,16 @@ ...@@ -130,6 +131,16 @@
<if test="purchaseOrderCode != null and purchaseOrderCode != ''"> <if test="purchaseOrderCode != null and purchaseOrderCode != ''">
and ar.purchase_order_code like concat('%',#{purchaseOrderCode},'%') and ar.purchase_order_code like concat('%',#{purchaseOrderCode},'%')
</if> </if>
<if test="commodityCode != null and commodityCode != ''">
and exists (
select 1
from dj_car_life_stock_allocate_detail ad
left join dj_car_life_upgrade_goods ug on ug.id = ad.goods_id and ug.deleted_flag = 'N'
where ad.deleted_flag = 'N'
and ad.allocate_code = ar.allocate_code
and ug.commodity_code like concat('%',#{commodityCode},'%')
)
</if>
</where> </where>
</sql> </sql>
...@@ -161,7 +172,7 @@ ...@@ -161,7 +172,7 @@
ad.goods_type_name as ad_goods_type_name, ad.allocate_number as ad_allocate_number, ad.goods_type_name as ad_goods_type_name, ad.allocate_number as ad_allocate_number,
ad.film_roll_no as ad_film_roll_no, ad.film_roll_no as ad_film_roll_no,
ug.specification_data,ug.specification_type_sequence,ug.type ug.specification_data,ug.specification_type_sequence,ug.type, ug.commodity_code
from dj_car_life_stock_allocate_detail ad from dj_car_life_stock_allocate_detail ad
left join dj_car_life_stock_allocate_record ar on ar.allocate_code = ad.allocate_code and ar.deleted_flag = 'N' left join dj_car_life_stock_allocate_record ar on ar.allocate_code = ad.allocate_code and ar.deleted_flag = 'N'
...@@ -217,9 +228,11 @@ ...@@ -217,9 +228,11 @@
b.address as address, b.address as address,
a.delivery_status as deliveryStatus, a.delivery_status as deliveryStatus,
b.bill_status as billStatus, b.bill_status as billStatus,
b.remark as remark b.remark as remark,
dclpog.commodity_code as commodityCode
from dj_car_life_stock_allocate_detail a from dj_car_life_stock_allocate_detail a
left join dj_car_life_upgrade_goods dclpog on a.goods_id = dclpog.id and dclpog.deleted_flag = 'N'
left join dj_car_life_stock_allocate_record b left join dj_car_life_stock_allocate_record b
on a.allocate_code = b.allocate_code and b.deleted_flag = 'N' on a.allocate_code = b.allocate_code and b.deleted_flag = 'N'
where a.deleted_flag = 'N' where a.deleted_flag = 'N'
...@@ -251,6 +264,16 @@ ...@@ -251,6 +264,16 @@
<if test="purchaseOrderCode != null and purchaseOrderCode != ''"> <if test="purchaseOrderCode != null and purchaseOrderCode != ''">
and a.purchase_order_code like concat('%',#{purchaseOrderCode},'%') and a.purchase_order_code like concat('%',#{purchaseOrderCode},'%')
</if> </if>
<if test="commodityCode !=null and commodityCode !=''">
and exists (
select 1
from dj_car_life_stock_allocate_detail ad2
left join dj_car_life_upgrade_goods ug2 on ad2.goods_id = ug2.id and ug2.deleted_flag = 'N'
where ad2.deleted_flag = 'N'
and ad2.allocate_code = b.allocate_code
and ug2.commodity_code like concat('%', #{commodityCode}, '%')
)
</if>
and b.bill_status in (5, 7) and b.bill_status in (5, 7)
order by b.allocate_time desc order by b.allocate_time desc
</select> </select>
...@@ -327,6 +350,16 @@ ...@@ -327,6 +350,16 @@
<if test="purchaseOrderCode != null and purchaseOrderCode != ''"> <if test="purchaseOrderCode != null and purchaseOrderCode != ''">
and ar.purchase_order_code like concat('%',#{purchaseOrderCode},'%') and ar.purchase_order_code like concat('%',#{purchaseOrderCode},'%')
</if> </if>
<if test="commodityCode != null and commodityCode != ''">
and exists (
select 1
from dj_car_life_stock_allocate_detail ad2
left join dj_car_life_upgrade_goods ug2 on ug2.id = ad2.goods_id and ug2.deleted_flag = 'N'
where ad2.deleted_flag = 'N'
and ad2.allocate_code = ar.allocate_code
and ug2.commodity_code like concat('%',#{commodityCode},'%')
)
</if>
</where> </where>
</sql> </sql>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<result column="operate_time" property="operateTime" jdbcType="TIMESTAMP"/> <result column="operate_time" property="operateTime" jdbcType="TIMESTAMP"/>
<result column="flow_time" property="flowTime" jdbcType="TIMESTAMP"/> <result column="flow_time" property="flowTime" jdbcType="TIMESTAMP"/>
<result column="upgrade_goods_name" property="upgradeGoodsName" jdbcType="VARCHAR"/> <result column="upgrade_goods_name" property="upgradeGoodsName" jdbcType="VARCHAR"/>
<result column="commodity_code" property="commodityCode" jdbcType="VARCHAR"/>
<result column="product_code" property="productCode" jdbcType="VARCHAR"/> <result column="product_code" property="productCode" jdbcType="VARCHAR"/>
<result column="specification_data" property="specificationData" jdbcType="VARCHAR"/> <result column="specification_data" property="specificationData" jdbcType="VARCHAR"/>
<result column="specification_type_sequence" property="specificationTypeSequence" jdbcType="VARCHAR"/> <result column="specification_type_sequence" property="specificationTypeSequence" jdbcType="VARCHAR"/>
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
i.created_date AS flow_time, i.created_date AS flow_time,
i.increase_time AS operate_time, i.increase_time AS operate_time,
ug.upgrade_goods_name, ug.upgrade_goods_name,
ug.commodity_code,
ug.type AS product_code, ug.type AS product_code,
ug.specification_data, ug.specification_data,
ug.specification_type_sequence, ug.specification_type_sequence,
...@@ -71,6 +73,9 @@ ...@@ -71,6 +73,9 @@
<if test="upgradeGoodsName != null and upgradeGoodsName != ''"> <if test="upgradeGoodsName != null and upgradeGoodsName != ''">
AND ug.upgrade_goods_name LIKE CONCAT('%', #{upgradeGoodsName}, '%') AND ug.upgrade_goods_name LIKE CONCAT('%', #{upgradeGoodsName}, '%')
</if> </if>
<if test="commodityCode != null and commodityCode != ''">
AND ug.commodity_code LIKE CONCAT('%', #{commodityCode}, '%')
</if>
<if test="productCode != null and productCode != ''"> <if test="productCode != null and productCode != ''">
AND ug.type LIKE CONCAT('%', #{productCode}, '%') AND ug.type LIKE CONCAT('%', #{productCode}, '%')
</if> </if>
...@@ -99,6 +104,7 @@ ...@@ -99,6 +104,7 @@
r.created_date AS flow_time, r.created_date AS flow_time,
r.reduce_date AS operate_time, r.reduce_date AS operate_time,
ug.upgrade_goods_name, ug.upgrade_goods_name,
ug.commodity_code,
ug.`type` AS product_code, ug.`type` AS product_code,
ug.specification_data, ug.specification_data,
ug.specification_type_sequence, ug.specification_type_sequence,
...@@ -134,6 +140,9 @@ ...@@ -134,6 +140,9 @@
<if test="upgradeGoodsName != null and upgradeGoodsName != ''"> <if test="upgradeGoodsName != null and upgradeGoodsName != ''">
AND ug.upgrade_goods_name LIKE CONCAT('%', #{upgradeGoodsName}, '%') AND ug.upgrade_goods_name LIKE CONCAT('%', #{upgradeGoodsName}, '%')
</if> </if>
<if test="commodityCode != null and commodityCode != ''">
AND ug.commodity_code LIKE CONCAT('%', #{commodityCode}, '%')
</if>
<if test="productCode != null and productCode != ''"> <if test="productCode != null and productCode != ''">
AND ug.type LIKE CONCAT('%', #{productCode}, '%') AND ug.type LIKE CONCAT('%', #{productCode}, '%')
</if> </if>
......
...@@ -1239,5 +1239,16 @@ ...@@ -1239,5 +1239,16 @@
group by ug.id group by ug.id
</select> </select>
<!-- 根据升级商品id批量查询产品ID -->
<select id="listCommodityCodeByIds" resultMap="BaseResultMap">
select ug.id, ug.commodity_code
from dj_car_life_upgrade_goods ug
where ug.deleted_flag = 'N'
and ug.id in
<foreach collection="upgradeGoodsIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper> </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.smartcarlife.mapper.UsedCarProfitRuleMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.smartcarlife.model.UsedCarProfitRule">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="traffic_party_id" property="trafficPartyId" jdbcType="INTEGER"/>
<result column="replace_type" property="replaceType" jdbcType="VARCHAR"/>
<result column="store_profit_scrap_car" property="storeProfitScrapCar" jdbcType="DECIMAL"/>
<result column="profit_type" property="profitType" jdbcType="VARCHAR"/>
<result column="profit_diff_rate" property="profitDiffRate" jdbcType="DECIMAL"/>
<result column="buy_price_range_start" property="buyPriceRangeStart" jdbcType="DECIMAL"/>
<result column="buy_price_range_end" property="buyPriceRangeEnd" jdbcType="DECIMAL"/>
<result column="buy_price_range_profit" property="buyPriceRangeProfit" jdbcType="DECIMAL"/>
<result column="traffic_fee_profit" property="trafficFeeProfit" jdbcType="DECIMAL"/>
<result column="traffic_fee_profit_remark" property="trafficFeeProfitRemark" jdbcType="VARCHAR"/>
<result column="single_car_guarantee_flag" property="singleCarGuaranteeFlag" jdbcType="CHAR"/>
<result column="single_car_guarantee_amount" property="singleCarGuaranteeAmount" jdbcType="DECIMAL"/>
<result column="gm_market_fee_calc_type" property="gmMarketFeeCalcType" jdbcType="VARCHAR"/>
<result column="gm_market_fee" property="gmMarketFee" jdbcType="DECIMAL"/>
<result column="sales_manager_market_fee_calc_type" property="salesManagerMarketFeeCalcType" jdbcType="VARCHAR"/>
<result column="sales_manager_market_fee" property="salesManagerMarketFee" jdbcType="DECIMAL"/>
<result column="frontline_sunshine_calc_type" property="frontlineSunshineCalcType" jdbcType="VARCHAR"/>
<result column="frontline_sunshine_incentive_fee" property="frontlineSunshineIncentiveFee" jdbcType="DECIMAL"/>
<result column="resource_fee_calc_type" property="resourceFeeCalcType" jdbcType="VARCHAR"/>
<result column="resource_fee" property="resourceFee" jdbcType="DECIMAL"/>
<result column="store_total_profit_gross_rate" property="storeTotalProfitGrossRate" jdbcType="DECIMAL"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP"/>
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, traffic_party_id, replace_type, store_profit_scrap_car, profit_type, profit_diff_rate,
buy_price_range_start, buy_price_range_end, buy_price_range_profit, traffic_fee_profit, traffic_fee_profit_remark,
single_car_guarantee_flag, single_car_guarantee_amount, gm_market_fee_calc_type, gm_market_fee,
sales_manager_market_fee_calc_type, sales_manager_market_fee, frontline_sunshine_calc_type,
frontline_sunshine_incentive_fee, resource_fee_calc_type, resource_fee, store_total_profit_gross_rate,
created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="findByTrafficPartyId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM dj_car_life_used_car_profit_rule
WHERE traffic_party_id = #{trafficPartyId, jdbcType=INTEGER}
AND (deleted_flag IS NULL OR deleted_flag != 'Y')
ORDER BY id ASC
</select>
<update id="deleteByTrafficPartyId">
UPDATE dj_car_life_used_car_profit_rule
SET deleted_flag = 'Y',
updated_by = #{updatedBy, jdbcType=VARCHAR},
updated_date = NOW()
WHERE traffic_party_id = #{trafficPartyId, jdbcType=INTEGER}
</update>
<insert id="insertList" parameterType="java.util.List">
INSERT INTO dj_car_life_used_car_profit_rule
(traffic_party_id, replace_type, store_profit_scrap_car, profit_type, profit_diff_rate,
buy_price_range_start, buy_price_range_end, buy_price_range_profit, traffic_fee_profit, traffic_fee_profit_remark,
single_car_guarantee_flag, single_car_guarantee_amount, gm_market_fee_calc_type, gm_market_fee,
sales_manager_market_fee_calc_type, sales_manager_market_fee, frontline_sunshine_calc_type,
frontline_sunshine_incentive_fee, resource_fee_calc_type, resource_fee, store_total_profit_gross_rate,
created_by, created_date, updated_by, updated_date, deleted_flag)
VALUES
<foreach item="item" collection="list" separator=",">
(#{item.trafficPartyId, jdbcType=INTEGER},
#{item.replaceType, jdbcType=VARCHAR},
#{item.storeProfitScrapCar, jdbcType=DECIMAL},
#{item.profitType, jdbcType=VARCHAR},
#{item.profitDiffRate, jdbcType=DECIMAL},
#{item.buyPriceRangeStart, jdbcType=DECIMAL},
#{item.buyPriceRangeEnd, jdbcType=DECIMAL},
#{item.buyPriceRangeProfit, jdbcType=DECIMAL},
#{item.trafficFeeProfit, jdbcType=DECIMAL},
#{item.trafficFeeProfitRemark, jdbcType=VARCHAR},
#{item.singleCarGuaranteeFlag, jdbcType=CHAR},
#{item.singleCarGuaranteeAmount, jdbcType=DECIMAL},
#{item.gmMarketFeeCalcType, jdbcType=VARCHAR},
#{item.gmMarketFee, jdbcType=DECIMAL},
#{item.salesManagerMarketFeeCalcType, jdbcType=VARCHAR},
#{item.salesManagerMarketFee, jdbcType=DECIMAL},
#{item.frontlineSunshineCalcType, jdbcType=VARCHAR},
#{item.frontlineSunshineIncentiveFee, jdbcType=DECIMAL},
#{item.resourceFeeCalcType, jdbcType=VARCHAR},
#{item.resourceFee, jdbcType=DECIMAL},
#{item.storeTotalProfitGrossRate, jdbcType=DECIMAL},
#{item.createdBy, jdbcType=VARCHAR},
#{item.createdDate, jdbcType=TIMESTAMP},
#{item.updatedBy, jdbcType=VARCHAR},
#{item.updatedDate, jdbcType=TIMESTAMP},
#{item.deletedFlag, jdbcType=CHAR})
</foreach>
</insert>
</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.smartcarlife.mapper.UsedCarTrafficTargetMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.smartcarlife.model.UsedCarTrafficTarget">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="traffic_party_id" property="trafficPartyId" jdbcType="INTEGER"/>
<result column="funding_tax_entity" property="fundingTaxEntity" jdbcType="VARCHAR"/>
<result column="brand" property="brand" jdbcType="VARCHAR"/>
<result column="car_model_remark" property="carModelRemark" jdbcType="VARCHAR"/>
<result column="brand_positioning" property="brandPositioning" jdbcType="VARCHAR"/>
<result column="store_rating" property="storeRating" jdbcType="VARCHAR"/>
<result column="new_car_order_target" property="newCarOrderTarget" jdbcType="INTEGER"/>
<result column="target_replace_rate" property="targetReplaceRate" jdbcType="DECIMAL"/>
<result column="recycle_target" property="recycleTarget" jdbcType="INTEGER"/>
<result column="brand_replace_rate" property="brandReplaceRate" jdbcType="DECIMAL"/>
<result column="replace_order_eval_convert_rate" property="replaceOrderEvalConvertRate" jdbcType="DECIMAL"/>
<result column="avg_profit_diff" property="avgProfitDiff" jdbcType="DECIMAL"/>
<result column="premium_rate" property="premiumRate" jdbcType="DECIMAL"/>
<result column="replace_order_eval_rate" property="replaceOrderEvalRate" jdbcType="DECIMAL"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP"/>
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, traffic_party_id, funding_tax_entity, brand, car_model_remark, brand_positioning,
store_rating,
new_car_order_target, target_replace_rate, recycle_target, brand_replace_rate,
replace_order_eval_convert_rate, avg_profit_diff, premium_rate, replace_order_eval_rate,
created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="findByTrafficPartyId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM dj_car_life_used_car_traffic_target
WHERE traffic_party_id = #{trafficPartyId, jdbcType=INTEGER}
AND (deleted_flag IS NULL OR deleted_flag != 'Y')
LIMIT 1
</select>
<insert id="insert" parameterType="cn.com.glsx.dj.smartcarlife.model.UsedCarTrafficTarget"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO dj_car_life_used_car_traffic_target
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="trafficPartyId != null">traffic_party_id,</if>
<if test="fundingTaxEntity != null">funding_tax_entity,</if>
<if test="brand != null">brand,</if>
<if test="carModelRemark != null">car_model_remark,</if>
<if test="brandPositioning != null">brand_positioning,</if>
<if test="storeRating != null">store_rating,</if>
<if test="newCarOrderTarget != null">new_car_order_target,</if>
<if test="targetReplaceRate != null">target_replace_rate,</if>
<if test="recycleTarget != null">recycle_target,</if>
<if test="brandReplaceRate != null">brand_replace_rate,</if>
<if test="replaceOrderEvalConvertRate != null">replace_order_eval_convert_rate,</if>
<if test="avgProfitDiff != null">avg_profit_diff,</if>
<if test="premiumRate != null">premium_rate,</if>
<if test="replaceOrderEvalRate != null">replace_order_eval_rate,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdDate != null">created_date,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedDate != null">updated_date,</if>
<if test="deletedFlag != null">deleted_flag,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="trafficPartyId != null">#{trafficPartyId, jdbcType=INTEGER},</if>
<if test="fundingTaxEntity != null">#{fundingTaxEntity, jdbcType=VARCHAR},</if>
<if test="brand != null">#{brand, jdbcType=VARCHAR},</if>
<if test="carModelRemark != null">#{carModelRemark, jdbcType=VARCHAR},</if>
<if test="brandPositioning != null">#{brandPositioning, jdbcType=VARCHAR},</if>
<if test="storeRating != null">#{storeRating, jdbcType=VARCHAR},</if>
<if test="newCarOrderTarget != null">#{newCarOrderTarget, jdbcType=INTEGER},</if>
<if test="targetReplaceRate != null">#{targetReplaceRate, jdbcType=DECIMAL},</if>
<if test="recycleTarget != null">#{recycleTarget, jdbcType=INTEGER},</if>
<if test="brandReplaceRate != null">#{brandReplaceRate, jdbcType=DECIMAL},</if>
<if test="replaceOrderEvalConvertRate != null">#{replaceOrderEvalConvertRate, jdbcType=DECIMAL},</if>
<if test="avgProfitDiff != null">#{avgProfitDiff, jdbcType=DECIMAL},</if>
<if test="premiumRate != null">#{premiumRate, jdbcType=DECIMAL},</if>
<if test="replaceOrderEvalRate != null">#{replaceOrderEvalRate, jdbcType=DECIMAL},</if>
<if test="createdBy != null">#{createdBy, jdbcType=VARCHAR},</if>
<if test="createdDate != null">#{createdDate, jdbcType=TIMESTAMP},</if>
<if test="updatedBy != null">#{updatedBy, jdbcType=VARCHAR},</if>
<if test="updatedDate != null">#{updatedDate, jdbcType=TIMESTAMP},</if>
<if test="deletedFlag != null">#{deletedFlag, jdbcType=CHAR},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.com.glsx.dj.smartcarlife.model.UsedCarTrafficTarget">
UPDATE dj_car_life_used_car_traffic_target
<set>
<if test="trafficPartyId != null">traffic_party_id = #{trafficPartyId, jdbcType=INTEGER},</if>
<if test="fundingTaxEntity != null">funding_tax_entity = #{fundingTaxEntity, jdbcType=VARCHAR},</if>
<if test="brand != null">brand = #{brand, jdbcType=VARCHAR},</if>
<if test="carModelRemark != null">car_model_remark = #{carModelRemark, jdbcType=VARCHAR},</if>
<if test="brandPositioning != null">brand_positioning = #{brandPositioning, jdbcType=VARCHAR},</if>
<if test="storeRating != null">store_rating = #{storeRating, jdbcType=VARCHAR},</if>
<if test="newCarOrderTarget != null">new_car_order_target = #{newCarOrderTarget, jdbcType=INTEGER},</if>
<if test="targetReplaceRate != null">target_replace_rate = #{targetReplaceRate, jdbcType=DECIMAL},</if>
<if test="recycleTarget != null">recycle_target = #{recycleTarget, jdbcType=INTEGER},</if>
<if test="brandReplaceRate != null">brand_replace_rate = #{brandReplaceRate, jdbcType=DECIMAL},</if>
<if test="replaceOrderEvalConvertRate != null">replace_order_eval_convert_rate = #{replaceOrderEvalConvertRate, jdbcType=DECIMAL},</if>
<if test="avgProfitDiff != null">avg_profit_diff = #{avgProfitDiff, jdbcType=DECIMAL},</if>
<if test="premiumRate != null">premium_rate = #{premiumRate, jdbcType=DECIMAL},</if>
<if test="replaceOrderEvalRate != null">replace_order_eval_rate = #{replaceOrderEvalRate, jdbcType=DECIMAL},</if>
<if test="createdBy != null">created_by = #{createdBy, jdbcType=VARCHAR},</if>
<if test="createdDate != null">created_date = #{createdDate, jdbcType=TIMESTAMP},</if>
<if test="updatedBy != null">updated_by = #{updatedBy, jdbcType=VARCHAR},</if>
<if test="updatedDate != null">updated_date = #{updatedDate, jdbcType=TIMESTAMP},</if>
<if test="deletedFlag != null">deleted_flag = #{deletedFlag, jdbcType=CHAR},</if>
</set>
WHERE id = #{id, jdbcType=BIGINT}
</update>
</mapper>
  • @wangxw1
    commented
    Master

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

    1. Lombok 继承陷阱:子类未显式声明 @EqualsAndHashCode(callSuper = true)

    • 问题描述:在多个继承了父类的 DTO 中(如 CreateBusinessApproveMerchantDTO extends CreateBusinessApproveMerchant、GoodsWarehousingInfoDTO 等),如果类上使用了 Lombok 的 @Data 注解,默认情况下 equals() 和 hashCode() 方法只会包含子类自己声明的属性,而忽略父类的属性。
    • 影响分析:当这些 DTO 对象被放入 Set 集合、作为 Map 的 Key,或者在业务逻辑中进行对象比较(a.equals(b))时,会导致逻辑判定错误,引发难以排查的隐蔽 Bug。
    • 优化建议:在所有继承父类并使用 @Data 的子类上,显式添加 @EqualsAndHashCode(callSuper = true) 注解。 java @Data @EqualsAndHashCode(callSuper = true) public class CreateBusinessApproveMerchantDTO extends CreateBusinessApproveMerchant { // ... }

    2. 违反重要规则风险:Dubbo RPC 传输对象变更与序列化风险

    • 问题描述:本次提交在大量可能用于 Dubbo Remote 接口的 DTO 中新增了字段(如 UsedCarTrafficTargetDTO、commodityCode 等)。虽然新增字段在 Hessian2 序列化下通常是向下兼容的,但部分 DTO(如 StockAllocateDeliveryListDTO、StockFlowDTO)实现了 Serializable 接口却未显式定义 serialVersionUID。
    • 影响分析:
      1. 触发了“Dubbo 服务提供者 Remote 接口中的已有请求参数变更”的危险警告。如果消费端使用了强校验,或者在滚动发布期间 Provider 和 Consumer 的类结构不一致,会导致反序列化异常。
      2. 未定义 serialVersionUID 的类在结构变更后,Java 原生序列化机制会抛出 InvalidClassException,导致 RPC 调用直接失败。
    • 优化建议:
      1. 严格评估此次 DTO 字段扩充是否对现有 Dubbo 消费者产生影响,建议通知调用方同步更新 API 依赖包(版本已升至 5.8.6-SNAPSHOT)。
      2. 为所有实现 Serializable 的 DTO 补充固定的 serialVersionUID。 java public class StockAllocateDeliveryListDTO implements Serializable { private static final long serialVersionUID = 1L; // ... }

    3. 代码完整性与规范一致性问题

    • 问题描述:
      1. UpgradeGoodsMapper.java 文件的末尾出现了未完成的 JavaDoc 注释(@return 后无内容)且缺失方法签名,如果这不是 Diff 截断导致的问题,将直接导致编译失败。
      2. MerchantShopGoodsStockDTO 中新增了 commodityCode 字段,却手动生成了 get/set 方法,而项目中普遍使用的是 Lombok。此外,部分新增的 commodityCode 缺失了 @ApiModelProperty 注解(如 MerchantGoodsStockReduceRecordDTO)。
    • 影响分析:未完成的代码会导致构建失败;混合使用 Lombok 和手动 Get/Set 降低了代码的可维护性和一致性;缺失 Swagger 注解会导致前端接口文档信息不全。
    • 优化建议:
      1. 检查并补全 UpgradeGoodsMapper 中的接口方法定义。
      2. 删除 MerchantShopGoodsStockDTO 中手写的 getCommodityCode() 和 setCommodityCode(),统一交由类级别的 @Data 或 @Getter/@Setter 处理。
      3. 为所有新增字段补齐 @ApiModelProperty 注释。

    二、评分明细

    • 功能实现的正确性与健壮性(32/40分): 核心业务逻辑(新增二手车场景字段、产品ID贯穿全链路)基本正确。扣分主要在于 Lombok 继承类的 equals/hashCode 隐患,以及 Mapper 接口疑似存在未写完的残缺代码,可能影响系统健壮性或导致编译错误。未发现 MyBatis 子查询违规现象。

    • 安全性与潜在风险(28/30分): 未发现 SQL 注入、XSS 等明显安全漏洞。新增的数据模型使用了标准的 ORM 注解。轻微扣分在于涉及金额计算的 BigDecimal 字段在持久化层未明确精度说明,需依赖数据库层面的严谨定义。

    • 最佳实践与可维护性(14/20分): 代码结构清晰,包划分合理。扣分原因:一是部分 DTO 缺失 serialVersionUID 带来 RPC 兼容性隐患;二是 Lombok 与手动 Get/Set 混用破坏了代码风格一致性;三是部分新增字段漏写了 Swagger 注解。

    • 性能与资源利用(5/5分): 本次变动以数据结构的扩充为主,未引入复杂的循环、无意义的对象创建或耗时操作,无明显的性能瓶颈。

    • 提交信息质量(5/5分): Commit 历史非常规范,包含了版本号(5.8.6)、改动类型前缀(feat, fixbug)、详细的改动说明列表以及修改人信息,可追溯性极强,属于优秀的提交记录。

    总分:84分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!