Commit 969b63bd by zhangxingmin

push

parent ac1ca667
......@@ -87,5 +87,15 @@ public class ApiProductLaunchController implements ApiProductLaunchFeignClient {
return apiProductLaunchService.editStatus(request);
}
/**
* 批量更新-产品全简体标题/短标题
* @param request
* @return
*/
@Override
public Result batchUpdateScTitle(ApiProductLaunchBatchUpdateScTitleRequest request) {
return apiProductLaunchService.batchUpdateScTitle(request);
}
}
......@@ -21,5 +21,7 @@ public interface ApiProductLaunchService {
Result editStatus(ApiProductLaunchEditStatusRequest request);
Result batchUpdateScTitle(ApiProductLaunchBatchUpdateScTitleRequest request);
Result<ProductLaunch> checkProductLaunchIsExist(String productLaunchBizId);
}
......@@ -136,13 +136,17 @@ public class ApiProductLaunchServiceImpl implements ApiProductLaunchService {
//添加产品上架信息
ProductLaunch productLaunch = new ProductLaunch();
//标题
productLaunch.setTitle(request.getProductName());
//标题转全简->全简体标题
productLaunch.setTitleSc(ChineseTextConverter.traditionalToSimplified(productLaunch.getTitle()));
productLaunch.setMainUrls(String.join(";",request.getMainUrlsList()));
productLaunch.setProductBizId(productBizId);
//产品上架信息表唯一业务ID
productLaunch.setProductLaunchBizId(RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_PRODUCT_LAUNCH.getCode()));
//待审核
productLaunch.setStatus(ProductCommonEnum.PRODUCT_LAUNCH_STATUS_DSH.getItemValue());
iProductLaunchService.saveOrUpdate(productLaunch);
//添加产品上架对象分类关系信息
ApiRelObjectCategoryListAddRequest addRequest = new ApiRelObjectCategoryListAddRequest();
......@@ -302,6 +306,10 @@ public class ApiProductLaunchServiceImpl implements ApiProductLaunchService {
productLaunch.setDetailUrls(!CollectionUtils.isEmpty(apiProductLaunchDto.getDetailUrlsList()) ? String.join(";",apiProductLaunchDto.getDetailUrlsList()) : "");
productLaunch.setProjectBizIdList(!CollectionUtils.isEmpty(apiProductLaunchDto.getProjectBizIdList()) ? String.join(";",apiProductLaunchDto.getProjectBizIdList()) : "");
productLaunch.setStatus(ProductCommonEnum.PRODUCT_LAUNCH_STATUS_DSH.getItemValue());
productLaunch.setTitle(apiProductLaunchDto.getTitle());
productLaunch.setTitleSc(ChineseTextConverter.traditionalToSimplified(apiProductLaunchDto.getTitle()));
productLaunch.setShortTitle(apiProductLaunchDto.getShortTitle());
productLaunch.setShortTitleSc(ChineseTextConverter.traditionalToSimplified(apiProductLaunchDto.getShortTitle()));
iProductLaunchService.saveOrUpdate(productLaunch);
//设置产品上架信息参数列表
......@@ -323,6 +331,10 @@ public class ApiProductLaunchServiceImpl implements ApiProductLaunchService {
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()) : "");
productLaunch.setTitle(apiProductLaunchDto.getTitle());
productLaunch.setTitleSc(ChineseTextConverter.traditionalToSimplified(apiProductLaunchDto.getTitle()));
productLaunch.setShortTitle(apiProductLaunchDto.getShortTitle());
productLaunch.setShortTitleSc(ChineseTextConverter.traditionalToSimplified(apiProductLaunchDto.getShortTitle()));
iProductLaunchService.saveOrUpdate(productLaunch);
//设置产品上架信息参数列表
......@@ -475,6 +487,28 @@ public class ApiProductLaunchServiceImpl implements ApiProductLaunchService {
}
/**
* 批量更新-产品全简体标题/短标题
* @param request
* @return
*/
@Override
public Result batchUpdateScTitle(ApiProductLaunchBatchUpdateScTitleRequest request) {
List<ProductLaunch> productLaunchList = iProductLaunchService.queryAll();
if (CollectionUtils.isEmpty(productLaunchList)) {
return Result.success();
}
productLaunchList = productLaunchList.stream().map(dto -> {
//标题——>繁体转简体
dto.setTitleSc(ChineseTextConverter.traditionalToSimplified(dto.getTitle()));
//短标题——>繁体转简体
dto.setShortTitleSc(ChineseTextConverter.traditionalToSimplified(dto.getShortTitle()));
return dto;
}).collect(Collectors.toList());
iProductLaunchService.saveOrUpdateBatch(productLaunchList);
return Result.success();
}
/**
* 校验产品上架信息是否存在
* @param productLaunchBizId
* @return
......
......@@ -63,4 +63,12 @@ public interface ApiProductLaunchFeignClient {
*/
@PutMapping("/edit/status")
Result editStatus(@Validated @RequestBody ApiProductLaunchEditStatusRequest request);
/**
* 批量更新-产品全简体标题/短标题
* @param request
* @return
*/
@PostMapping("/batch/update/sc/title")
Result batchUpdateScTitle(@Validated @RequestBody ApiProductLaunchBatchUpdateScTitleRequest request);
}
......@@ -47,6 +47,11 @@ public class ApiProductLaunchFeignFallbackFactory implements FallbackFactory<Api
public Result editStatus(ApiProductLaunchEditStatusRequest request) {
return null;
}
@Override
public Result batchUpdateScTitle(ApiProductLaunchBatchUpdateScTitleRequest request) {
return null;
}
};
}
}
package com.yd.product.feign.request.productlaunch;
import lombok.Data;
import java.util.List;
@Data
public class ApiProductLaunchBatchUpdateScTitleRequest {
/**
* 产品上架信息表唯一业务ID
*/
private List<String> productLaunchBizIdList;
}
......@@ -50,12 +50,24 @@ public class ProductLaunch implements Serializable {
private String title;
/**
* 全简体标题
*/
@TableField("title_sc")
private String titleSc;
/**
* 短标题
*/
@TableField("short_title")
private String shortTitle;
/**
* 全简短标题
*/
@TableField("short_title_sc")
private String shortTitleSc;
/**
* 主图url(多个url用分号分隔)
*/
@TableField("main_urls")
......
......@@ -7,6 +7,8 @@ import com.yd.product.feign.response.productlaunch.ApiProductLaunchPageResponse;
import com.yd.product.service.model.ProductLaunch;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 产品上架信息表(新表) 服务类
......@@ -21,4 +23,6 @@ public interface IProductLaunchService extends IService<ProductLaunch> {
ApiProductLaunchPageRequest request);
ProductLaunch queryOne(String productLaunchBizId);
List<ProductLaunch> queryAll();
}
......@@ -11,6 +11,8 @@ import com.yd.product.service.service.IProductLaunchService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 产品上架信息表(新表) 服务实现类
......@@ -32,4 +34,9 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
public ProductLaunch queryOne(String productLaunchBizId) {
return this.getOne(new LambdaQueryWrapper<ProductLaunch>().eq(ProductLaunch::getProductLaunchBizId,productLaunchBizId));
}
@Override
public List<ProductLaunch> queryAll() {
return this.baseMapper.selectList(null);
}
}
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