Commit 285a9c18 by zhangxingmin

push

parent d33f8040
...@@ -142,6 +142,7 @@ public class ApiProductLaunchServiceImpl implements ApiProductLaunchService { ...@@ -142,6 +142,7 @@ public class ApiProductLaunchServiceImpl implements ApiProductLaunchService {
addRequest.setObjectType(CommonEnum.UID_TYPE_PRODUCT_LAUNCH.getCode()); addRequest.setObjectType(CommonEnum.UID_TYPE_PRODUCT_LAUNCH.getCode());
apiRelObjectCategoryFeignClient.addRelObjectCategoryList(addRequest); apiRelObjectCategoryFeignClient.addRelObjectCategoryList(addRequest);
response.setId(productLaunch.getId());
response.setProductBizId(productBizId); response.setProductBizId(productBizId);
response.setProductLaunchBizId(productLaunch.getProductLaunchBizId()); response.setProductLaunchBizId(productLaunch.getProductLaunchBizId());
return Result.success(response); return Result.success(response);
...@@ -245,25 +246,54 @@ public class ApiProductLaunchServiceImpl implements ApiProductLaunchService { ...@@ -245,25 +246,54 @@ public class ApiProductLaunchServiceImpl implements ApiProductLaunchService {
*/ */
@Override @Override
public Result save(ApiProductLaunchSaveRequest request) { public Result save(ApiProductLaunchSaveRequest request) {
ApiProductLaunchDto apiProductLaunchDto = request.getApiProductLaunchDto(); if (request.getSource() == 1) {
//校验产品上架信息是否存在 //复制来源
Result<ProductLaunch> result = checkProductLaunchIsExist(apiProductLaunchDto.getProductLaunchBizId()); //添加-产品上架类目信息
ProductLaunch productLaunch = result.getData(); ApiProductLaunchCategoryAddRequest addRequest = new ApiProductLaunchCategoryAddRequest();
//更新产品上架主信息 addRequest.setCategoryBizIdList(request.getApiProductLaunchDto().getCategoryBizIdList());
BeanUtils.copyProperties(apiProductLaunchDto,productLaunch); addRequest.setMainUrlsList(request.getApiProductLaunchDto().getMainUrlsList());
productLaunch.setMainUrls(!CollectionUtils.isEmpty(apiProductLaunchDto.getMainUrlsList()) ? String.join(";",apiProductLaunchDto.getMainUrlsList()) : ""); addRequest.setProductBizId(request.getApiProductLaunchDto().getProductBizId());
productLaunch.setDetailUrls(!CollectionUtils.isEmpty(apiProductLaunchDto.getDetailUrlsList()) ? String.join(";",apiProductLaunchDto.getDetailUrlsList()) : ""); addRequest.setProductName(request.getApiProductLaunchDto().getTitle());
productLaunch.setProjectBizIdList(!CollectionUtils.isEmpty(apiProductLaunchDto.getProjectBizIdList()) ? String.join(";",apiProductLaunchDto.getProjectBizIdList()) : ""); Result<ApiProductLaunchCategoryAddResponse> result = addCategory(addRequest);
iProductLaunchService.saveOrUpdate(productLaunch); ApiProductLaunchCategoryAddResponse addResponse = result.getData();
//设置产品上架信息参数列表 ApiProductLaunchDto apiProductLaunchDto = request.getApiProductLaunchDto();
apiAttributeSettingService.save(request.getApiAttributeSettingDtoList(),productLaunch.getProductLaunchBizId()); ProductLaunch productLaunch = new ProductLaunch();
//更新产品上架主信息
BeanUtils.copyProperties(apiProductLaunchDto,productLaunch);
productLaunch.setId(addResponse.getId());
productLaunch.setProductLaunchBizId(addResponse.getProductLaunchBizId());
productLaunch.setMainUrls(!CollectionUtils.isEmpty(apiProductLaunchDto.getMainUrlsList()) ? String.join(";",apiProductLaunchDto.getMainUrlsList()) : "");
productLaunch.setDetailUrls(!CollectionUtils.isEmpty(apiProductLaunchDto.getDetailUrlsList()) ? String.join(";",apiProductLaunchDto.getDetailUrlsList()) : "");
productLaunch.setProjectBizIdList(!CollectionUtils.isEmpty(apiProductLaunchDto.getProjectBizIdList()) ? String.join(";",apiProductLaunchDto.getProjectBizIdList()) : "");
iProductLaunchService.saveOrUpdate(productLaunch);
//保存产品上架规格配置列表 //设置产品上架信息参数列表
apiSpeciesSettingService.save(request.getApiSpeciesSettingDtoList(),productLaunch.getProductLaunchBizId()); apiAttributeSettingService.save(request.getApiAttributeSettingDtoList(),productLaunch.getProductLaunchBizId());
//保存产品上架规格配置列表
apiSpeciesSettingService.save(request.getApiSpeciesSettingDtoList(),productLaunch.getProductLaunchBizId());
//保存规格价格配置列表
apiSpeciesPriceService.save(request.getApiSpeciesPriceDtoList(),productLaunch.getProductLaunchBizId());
}else {
//其他来源
ApiProductLaunchDto apiProductLaunchDto = request.getApiProductLaunchDto();
//校验产品上架信息是否存在
Result<ProductLaunch> result = checkProductLaunchIsExist(apiProductLaunchDto.getProductLaunchBizId());
ProductLaunch productLaunch = result.getData();
//更新产品上架主信息
BeanUtils.copyProperties(apiProductLaunchDto,productLaunch);
productLaunch.setMainUrls(!CollectionUtils.isEmpty(apiProductLaunchDto.getMainUrlsList()) ? String.join(";",apiProductLaunchDto.getMainUrlsList()) : "");
productLaunch.setDetailUrls(!CollectionUtils.isEmpty(apiProductLaunchDto.getDetailUrlsList()) ? String.join(";",apiProductLaunchDto.getDetailUrlsList()) : "");
productLaunch.setProjectBizIdList(!CollectionUtils.isEmpty(apiProductLaunchDto.getProjectBizIdList()) ? String.join(";",apiProductLaunchDto.getProjectBizIdList()) : "");
iProductLaunchService.saveOrUpdate(productLaunch);
//保存规格价格配置列表 //设置产品上架信息参数列表
apiSpeciesPriceService.save(request.getApiSpeciesPriceDtoList(),productLaunch.getProductLaunchBizId()); apiAttributeSettingService.save(request.getApiAttributeSettingDtoList(),productLaunch.getProductLaunchBizId());
//保存产品上架规格配置列表
apiSpeciesSettingService.save(request.getApiSpeciesSettingDtoList(),productLaunch.getProductLaunchBizId());
//保存规格价格配置列表
apiSpeciesPriceService.save(request.getApiSpeciesPriceDtoList(),productLaunch.getProductLaunchBizId());
}
return Result.success(); return Result.success();
} }
......
...@@ -14,13 +14,13 @@ public class ApiProductLaunchDto { ...@@ -14,13 +14,13 @@ public class ApiProductLaunchDto {
/** /**
* 产品上架信息表唯一业务ID * 产品上架信息表唯一业务ID
*/ */
@NotBlank(message = "产品上架信息表唯一业务ID不能为空") // @NotBlank(message = "产品上架信息表唯一业务ID不能为空")
private String productLaunchBizId; private String productLaunchBizId;
/** /**
* 关联产品表唯一业务ID(上架的产品) * 关联产品表唯一业务ID(上架的产品)
*/ */
@NotBlank(message = "关联产品表唯一业务ID不能为空") // @NotBlank(message = "关联产品表唯一业务ID不能为空")
private String productBizId; private String productBizId;
/** /**
......
...@@ -6,14 +6,22 @@ import com.yd.product.feign.dto.ApiSpeciesSettingDto; ...@@ -6,14 +6,22 @@ import com.yd.product.feign.dto.ApiSpeciesSettingDto;
import com.yd.product.feign.response.productlaunch.ApiAttributeSettingDto; import com.yd.product.feign.response.productlaunch.ApiAttributeSettingDto;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
@Data @Data
public class ApiProductLaunchSaveRequest { public class ApiProductLaunchSaveRequest {
/** /**
* 来源 1-复制 null-其他
*/
private Integer source;
/**
* 产品上架主信息 * 产品上架主信息
*/ */
@NotEmpty(message = "产品上架主信息不能为空")
private ApiProductLaunchDto apiProductLaunchDto; private ApiProductLaunchDto apiProductLaunchDto;
/** /**
......
...@@ -6,6 +6,11 @@ import lombok.Data; ...@@ -6,6 +6,11 @@ import lombok.Data;
public class ApiProductLaunchCategoryAddResponse { public class ApiProductLaunchCategoryAddResponse {
/** /**
* 主键ID
*/
private Long id;
/**
* 产品上架信息表唯一业务ID * 产品上架信息表唯一业务ID
*/ */
private String productLaunchBizId; private String productLaunchBizId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment