getShopSettingSizeTemplateIdByCid

20230922-ljl-fixBug
daixiaogang 1 year ago
parent da4d804839
commit 4b9a969339

@ -105,7 +105,7 @@
<artifactId>sdk-java</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/doudian-sdk-java-1.1.0-20230910152032.jar</systemPath>
<systemPath>${project.basedir}/../lib/doudian-sdk-java-1.1.0-20230914091533.jar</systemPath>
</dependency>
</dependencies>

@ -1,10 +1,26 @@
package com.ms.api.biz;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.doudian.open.api.product_getCatePropertyV2.ProductGetCatePropertyV2Request;
import com.doudian.open.api.product_getCatePropertyV2.ProductGetCatePropertyV2Response;
import com.doudian.open.api.product_getCatePropertyV2.param.ProductGetCatePropertyV2Param;
import com.doudian.open.api.product_getComponentTemplate.ProductGetComponentTemplateRequest;
import com.doudian.open.api.product_getComponentTemplate.ProductGetComponentTemplateResponse;
import com.doudian.open.api.product_getComponentTemplate.data.ComponentTemplateInfoListItem;
import com.doudian.open.api.product_getComponentTemplate.data.ProductGetComponentTemplateData;
import com.doudian.open.api.product_getComponentTemplate.param.ProductGetComponentTemplateParam;
import com.doudian.open.api.product_getProductUpdateRule.data.FulfillmentRule;
import com.doudian.open.api.product_getProductUpdateRule.data.NormalRule;
import com.doudian.open.api.product_getProductUpdateRule.data.OptionsItem;
@ -34,7 +50,6 @@ import com.ms.dal.entity.MoveProductPublishBuffer;
import com.ms.dal.entity.MoveShopConfig;
import com.ms.dal.entity.MoveShopSetting;
import com.ms.dal.entity.Shop;
import com.ms.dal.entity.*;
import com.ms.dal.mapper.MoveCollectTaskDetailMapper;
import com.ms.dal.mapper.MoveCollectTaskMapper;
import com.ms.dal.mapper.MoveProductPublishBufferMapper;
@ -46,9 +61,6 @@ import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Component
public class MoveService {
@ -73,7 +85,6 @@ public class MoveService {
@Autowired
private MoveShopConfigService moveShopConfigService;
/**
*
*
@ -99,7 +110,7 @@ public class MoveService {
productDetailBase.put("outProductId", moveBaseData.get("source_item_id"));
// 客服电话
productDetailBase.put("mobile","0");
productDetailBase.put("mobile", "0");
// 产品类型
productDetailBase.put("productType", MoveConst.PRODUCT_TYPE_NORMAL);
@ -136,7 +147,7 @@ public class MoveService {
productDetailBase.put("categoryLeafId", queueMsg.getCid());
// 尺寸模版
int size = getSizeTemplateId(shopId, condition, moveBaseData);
Long size = getSizeTemplateId(shopId, condition, moveBaseData);
productDetailBase.put("sizeTemplateId", size);
// 发货时间
@ -315,32 +326,39 @@ public class MoveService {
return title;
}
public int getSizeTemplateId(long shopId, MoveShopSettingBO condition, JSONObject moveBaseData) {
int sizeTemplateId = 0;
public Long getSizeTemplateId(long shopId, MoveShopSettingBO condition, JSONObject moveBaseData) {
Long sizeTemplateId = 0L;
Object sizeTemplateIdObj = moveBaseData.get("size_template_id");
if (Objects.isNull(sizeTemplateIdObj)) {
return sizeTemplateId;
}
if (sizeTemplateIdObj instanceof String) {
long cid = moveBaseData.getLong("cid");
long commonTemplateId = 0;
// TODO 这里可能不需要
sizeTemplateId = getShopSettingSizeTemplateIdByCid(shopId, condition.getMoveShopSettingId(), cid, commonTemplateId);
sizeTemplateId = getShopSettingSizeTemplateIdByCid(cid);
} else {
sizeTemplateId = (int) sizeTemplateIdObj;
sizeTemplateId = (Long) sizeTemplateIdObj;
}
return sizeTemplateId;
}
private int getShopSettingSizeTemplateIdByCid(long shopId, Integer moveShopSettingId, long cid, long commonTemplateId) {
private Long getShopSettingSizeTemplateIdByCid( long cid) {
CategorySizeTemplateSubType categorySizeTemplateSubType = categorySizeTemplateSubTypeService.selectByPrimaryKey(cid);
if (ObjectUtil.isNull(categorySizeTemplateSubType)) {
return 0;
return 0L;
}
// ProductGetComponentTemplateRequest request = new ProductGetComponentTemplateRequest();
// ProductGetComponentTemplateParam param = request.getParam();
return 0;
ProductGetComponentTemplateRequest request = new ProductGetComponentTemplateRequest();
ProductGetComponentTemplateParam param = request.getParam();
param.setTemplateSubType(categorySizeTemplateSubType.getTemplateSubType());
ProductGetComponentTemplateResponse response = request.execute();
if (!CommonTool.checkDdApiRequestIsSuccess(response)) {
return 0L;
}
ProductGetComponentTemplateData data = response.getData();
if (ObjectUtil.isNull(data) || ObjectUtil.isEmpty(data.getComponentTemplateInfoList())){
return 0L;
}
ComponentTemplateInfoListItem componentTemplateInfoListItem = data.getComponentTemplateInfoList().get(0);
return componentTemplateInfoListItem.getTemplateId();
}
public List<String> getMovePublishAllImgs(JSONObject productDetailBase) {
@ -573,14 +591,13 @@ public class MoveService {
}
public void updateMoveCollectTaskDetail(MoveCollectTaskDetail updateMoveCollectTaskDetailData, long shopId, Long detailId) {
if (ObjectUtil.isNull(detailId)){
if (ObjectUtil.isNull(detailId)) {
return;
}
updateMoveCollectTaskDetailData.setMoveCollectTaskDetailId(detailId);
moveCollectTaskDetailMapper.updateByPrimaryKeySelective(updateMoveCollectTaskDetailData);
}
public MoveShopConfigBO getAvailableCopyCount(long shopId) {
Shop shop = shopService.getDetailById(shopId);
if (shop.getGmtExpire().before(new Date())) {

Loading…
Cancel
Save