getShopSettingSizeTemplateIdByCid

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

@ -105,7 +105,7 @@
<artifactId>sdk-java</artifactId> <artifactId>sdk-java</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>system</scope> <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> </dependency>
</dependencies> </dependencies>

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

Loading…
Cancel
Save