检查店铺cid checkTaskDetailCidIsValid

20230922-ljl-fixBug
daixiaogang 1 year ago
parent 8c3dd8b8da
commit be88561d74

@ -74,6 +74,7 @@ import com.ms.api.tool.MoveTool;
import com.ms.api.tool.SecurityTool;
import com.ms.api.util.DdRequestUtil;
import com.ms.dal.entity.Category;
import com.ms.dal.entity.CategoryShop;
import com.ms.dal.entity.MaterialAuditStatusBuffer;
import com.ms.dal.entity.MaterialBizAuditStatusLog;
import com.ms.dal.entity.MaterialBizQueue;
@ -918,7 +919,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
productDetailBase.put("updateSkuMinPriceInfo", updateSkuMinPriceInfo);
// 品牌
Ret matchBrandRet = searchBrandIdByBrandNameFromDd(cid, brandName, accessToken,true);
Ret matchBrandRet = searchBrandIdByBrandNameFromDd(cid, brandName, accessToken, true);
if (CommonTool.isFailRet(matchBrandRet)) {
return matchBrandRet;
}
@ -1321,6 +1322,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
private String getBrandNameFromDdBrand(AuthBrandListItem brand) {
return StrUtil.isBlank(brand.getNameCn()) ? brand.getNameEn() : (StrUtil.isBlank(brand.getNameEn()) ? brand.getNameCn() : brand.getNameEn().concat(".").concat(brand.getNameCn()));
}
private String getBrandNameFromDdBrand(BrandListItem brand) {
return StrUtil.isBlank(brand.getNameCn()) ? brand.getNameEn() : (StrUtil.isBlank(brand.getNameEn()) ? brand.getNameCn() : brand.getNameEn().concat(".").concat(brand.getNameCn()));
}
@ -1544,23 +1546,21 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
private Ret checkTaskDetailCidIsValid(MoveProductPublishQueueBO queueMsg, long shopId) {
// TODO 检查店铺的Cid,假设是成功了
// if ($queueMsg['cnali_ds_detail_id']) {
// return CommonTool::successResult();
// }
//
// $cid = $queueMsg['cid'];
// $ret = $this->shopService->checkTaskDetailCidIsValidByCategoryShop($cid, $shopId);
// if (CommonTool::isSuccessRet($ret)) {
// return CommonTool::successResult();
// }
//
// $cateListAll = $this->rsyncProductService->getAllShopCategorys($shopId);
// $categoryIds = ZcArrayHelper::getSub($cateListAll, 'category_id');
// if(!in_array($cid, $categoryIds)) {
// $this->productPublishLog->info("checkTaskDetailCidIsValid fail cid:" . $cid . ",categoryIds:" . var_export($categoryIds, 1));
// return CommonTool::failResult('店铺分类不存在');
// }
// return CommonTool::successResult();
if (ObjectUtil.isNotNull(queueMsg.getCnaliDsDetailId())) {
return Ret.success();
}
String cid = queueMsg.getCid();
CategoryShop ret = categoryShopService.selectByPrimaryKey(shopId, Long.valueOf(cid));
if (ObjectUtil.isNotNull(ret)) {
return Ret.success();
}
Map<Long, Category> allShopCategorys = getAllLeafProductCatListFromDb(shopId);
Set<Long> categoryIds = allShopCategorys.keySet();
if (!categoryIds.contains(cid)) {
log.info("checkTaskDetailCidIsValid fail cid:" + cid + ",categoryIds:{}", JSON.toJSONString(categoryIds));
return Ret.fail("店铺分类不存在");
}
return Ret.success();
}

Loading…
Cancel
Save