dev798
parent
963dacbfe2
commit
6823f81809
|
@ -89,10 +89,40 @@ public class MallProductInfoServiceImpl implements MallProductInfoService
|
||||||
packageDataSeveOrUpdate(mallProductInfo,num,userId);
|
packageDataSeveOrUpdate(mallProductInfo,num,userId);
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* step 步骤,是一个枚举值,代表不同的处理阶段
|
||||||
|
*/
|
||||||
|
public enum Step{
|
||||||
|
STEP_ONE,
|
||||||
|
STEP_TWO,
|
||||||
|
STEP_THREE
|
||||||
|
}
|
||||||
|
// 获取步骤
|
||||||
|
private Step getStep(MallProductInfo mallProductInfo){
|
||||||
|
String step = mallProductInfo.getStep();
|
||||||
|
if(step == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Step.valueOf(step);
|
||||||
|
}
|
||||||
|
// 处理步骤一
|
||||||
|
private void handleStepOne(MallProductInfoForm mallProductInfo){
|
||||||
|
//获取商品信息ID
|
||||||
|
Long productInfoId = mallProductInfo.getId();
|
||||||
|
//清空商品的sku信息列表
|
||||||
|
mallProductInfo.setSkuInfoList(null);
|
||||||
|
// 根据商品信息ID,删除商品信息对应的sku信息
|
||||||
|
mallProductSkuInfoService.deleteMallProductSkuInfoId(productInfoId);
|
||||||
|
}
|
||||||
|
// 处理步骤二
|
||||||
|
private void handleStepTwo(MallProductInfoForm mallProductInfo){
|
||||||
|
// 清空商品的描述信息
|
||||||
|
mallProductInfo.setProductDesc("");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* step 步骤,是一个枚举值,代表不同的处理阶段
|
||||||
* 修改商品信息
|
* 修改商品信息
|
||||||
*
|
|
||||||
* @param mallProductInfo 商品信息
|
* @param mallProductInfo 商品信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
@ -103,19 +133,16 @@ public class MallProductInfoServiceImpl implements MallProductInfoService
|
||||||
String step = mallProductInfo.getStep();
|
String step = mallProductInfo.getStep();
|
||||||
if (step == null) {
|
if (step == null) {
|
||||||
// 在这里处理 step 为 null 的情况,可以抛出异常或者采取其他措施
|
// 在这里处理 step 为 null 的情况,可以抛出异常或者采取其他措施
|
||||||
log.error("Step 参数为空");
|
throw new IllegalArgumentException("Step参数为空");
|
||||||
return 0; // 或者抛出异常
|
|
||||||
}
|
}
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case ProductConstant.STEP_ONE:
|
case ProductConstant.STEP_ONE:
|
||||||
Long productInfoId = mallProductInfo.getId();
|
// 处理步骤一
|
||||||
// 处理步骤一:清除当前产品的SKU信息
|
handleStepOne(mallProductInfo);
|
||||||
mallProductInfo.setSkuInfoList(null);
|
|
||||||
mallProductSkuInfoService.deleteMallProductSkuInfoId(productInfoId);
|
|
||||||
break;
|
break;
|
||||||
case ProductConstant.STEP_TWO:
|
case ProductConstant.STEP_TWO:
|
||||||
// 处理步骤二:清空产品描述
|
// 处理步骤二
|
||||||
mallProductInfo.setProductDesc("");
|
handleStepTwo(mallProductInfo);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// 对于未知步骤,不做任何处理
|
// 对于未知步骤,不做任何处理
|
||||||
|
|
Loading…
Reference in New Issue