Merge branch 'master' of codeup.aliyun.com:64d9c5feeceb191898f636d7/honor-dd-light-ds-java

ljl-dsPurchaseOrder
ljl 1 year ago
commit faf4e849f7

@ -1249,6 +1249,7 @@ public class MoveService {
folderId = response.getData().getFolderId();
return folderId;
}
CommonTool.randomSleep();
}
}

@ -447,7 +447,15 @@ public class OpOrderServiceImpl implements OpOrderService {
OpOrder insertOrderData = BeanUtil.toBean(orderInfo, OpOrder.class);
log.info("start insertUpdateOpOrder {}", insertOrderData);
opOrderMapper.insertOrUpdate(insertOrderData);
OpOrder orderObj = opOrderMapper.selectByOrderId(order.getOrderId());
if (orderObj == null) {
opOrderMapper.insertSelective(insertOrderData);
} else {
OpOrder updateOrderData = insertOrderData;
updateOrderData.setGmtCreate(null);
updateOrderData.setOpOrderId(orderObj.getOpOrderId());
opOrderMapper.updateByPrimaryKeySelective(updateOrderData);
}
// TODO: 2023/8/31 op_order_user_open_id
// log.info("start saveOpOrderUserOpenId ");

@ -7,9 +7,7 @@ import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.move.GetCurrentShopMoveSettingRequestDTO;
import com.ms.api.service.MoveShopSettingService;
import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.dal.entity.MoveShopSetting;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,10 +20,8 @@ import java.util.Map;
*/
@ExtensionService("getCurrentShopMoveSetting")
@Slf4j
public class GetCurrentShopMoveSettingService extends SPIBaseService implements ExtensionServiceHandler<Void,Ret> {
public class GetCurrentShopMoveSettingService extends SPIBaseService implements ExtensionServiceHandler<Void, Ret> {
@Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate;
@Autowired
private MoveShopSettingService moveShopSettingService;
@ -35,7 +31,7 @@ public class GetCurrentShopMoveSettingService extends SPIBaseService implements
MoveShopSetting moveShopSettings = moveShopSettingService.getDetailByShopId(shopId);
if(moveShopSettings==null){
if (moveShopSettings == null) {
MoveShopSetting moveShopSettings2 = new MoveShopSetting();
moveShopSettings2.setShopId(shopId);
moveShopSettings2.setMoveOnsaleType(1);

@ -21,13 +21,8 @@ public class AddPlatformItemToSourceItemRelationTimerService extends TimerBaseSe
@Override
public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) {
try {
addPlatformItemToSourceItemRelationTaskService.runTask();
return R.ok(Ret.success());
} catch (Throwable e) {
e.printStackTrace();
return R.ok(Ret.fail(e.getMessage()));
}
addPlatformItemToSourceItemRelationTaskService.runTask();
return R.ok(Ret.success());
}
}

@ -8,7 +8,6 @@ import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.TimerBaseService;
import com.ms.api.dto.ItemDTO;
import com.ms.api.service.OpOrderService;
import com.ms.api.task.AnalysisRelateProductDsOrderTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -20,23 +19,9 @@ public class AnalysisRelateProductDsOrderTimerService extends TimerBaseService i
@Autowired
AnalysisRelateProductDsOrderTaskService analysisRelateProductDsOrderTaskService;
@Autowired
OpOrderService opOrderService;
@Override
public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) {
try {
analysisRelateProductDsOrderTaskService.runTask();
return R.ok(Ret.success());
} catch (Throwable e) {
e.printStackTrace();
return R.ok(Ret.fail(e.getMessage()));
}
// OpOrderRsyncQueue task = analysisRelateProductDsOrderTaskService.lockAnalysisRelateProductDsOrderQueue(0L);
// ApiResult result = analysisRelateProductDsOrderTaskService.doAnalysisRelateProductDsOrderQueue(task);
// result.setData(task);
// opOrderService.clearAnalysisRelateProductDsOrderQueue(task.getOpOrderRsyncQueueId());
// return R.ok(Ret.success());
analysisRelateProductDsOrderTaskService.runTask();
return R.ok(Ret.success());
}
}

@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@Configuration
@ -57,6 +58,7 @@ public class AddPlatformItemToSourceItemRelationTaskService extends TaskBaseServ
return taskPool;
}
@Async("addPlatformItemToSourceItemRelationTaskPool")
@Override
public void runTask() {
super.runTask();

@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -63,6 +64,7 @@ public class AnalysisRelateProductDsOrderTaskService extends TaskBaseService {
return taskPool;
}
@Async("analysisRelateProductDsOrderTaskPool")
@Override
public void runTask() {
super.runTask();

@ -1,6 +1,7 @@
package com.ms.api.task;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.ms.api.bo.MovePublishBufferRandShopIdAndPriorityBO;
import com.ms.api.common.E;
import com.ms.api.common.Ret;
@ -220,17 +221,24 @@ public class MovePublishBufferTaskService extends TaskBaseService {
E.throwMSException("shopIds is empty");
}
// 获取店铺的配置
String curMonth = CommonTool.getCurMonthLastTime();
List<MoveShopConfig> moveConfigList = moveShopConfigService.selectByShopIds(shopIds,curMonth);
if (ObjectUtil.isEmpty(moveConfigList)) {
E.throwMSException("getShopMonthQuotaMap moveConfigList is empty");
}
Map<Long, MoveShopConfig> moveConfigMap = CommonTool.convertListToMap(moveConfigList, MoveShopConfig::getShopId);
if (ObjectUtil.isEmpty(moveConfigMap)) {
E.throwMSException("getShopMonthQuotaMap moveConfigMap is empty");
// 获取店铺的配置 当前版本不需要从配置里面获取数量
// String curMonth = CommonTool.getCurMonthLastTime();
// List<MoveShopConfig> moveConfigList = moveShopConfigService.selectByShopIds(shopIds,curMonth);
// if (ObjectUtil.isEmpty(moveConfigList)) {
// E.throwMSException("getShopMonthQuotaMap moveConfigList is empty");
// }
//
// Map<Long, MoveShopConfig> moveConfigMap = CommonTool.convertListToMap(moveConfigList, MoveShopConfig::getShopId);
// if (ObjectUtil.isEmpty(moveConfigMap)) {
// E.throwMSException("getShopMonthQuotaMap moveConfigMap is empty");
// }
// 先用下面方法替代
Map<Long, MoveShopConfig> moveConfigMap = new HashMap<>();
for (Long shopId : shopIds) {
moveConfigMap.put(shopId,new MoveShopConfig());
}
log.info("get moveConfigMap success:" + JSON.toJSONString(moveConfigMap));
return moveConfigMap;
}

@ -699,12 +699,15 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
JSONObject sourceAttrs = moveBaseData.getJSONObject("sourceAttrs");
ProductGetCatePropertyV2Data attrRetData = (ProductGetCatePropertyV2Data) categoryAttrRet.getData().get("data");
List<DataItem> attributes = attrRetData.getData();
log.info("attributes :" + JSON.toJSONString(attributes));
String title = productDetailBase.getString("title");
// Map<Long, List<StrObjMap>> productFormatNew = buildProductAttrs(attributes, sourceAttrs, title,queueMsg);
// Map<String, List<StrObjMap>> productFormatNew = buildProductAttrs(attributes, sourceAttrs, title,queueMsg);
// log.info("productFormatNew :" + JSON.toJSONString(productFormatNew));
Map<String, List<StrObjMap>> productFormatNew = buildProductAttrsByDd(attributes, sourceAttrs, title, queueMsg);
// log.info("productFormatNew2 :" + JSON.toJSONString(productFormatNew2));
// E.throwMSException("测试");
productFormatNew = attachBrand2ProductFormatNew(brandId, brandName, productFormatNew);
productDetailBase.put("productFormatNew", productFormatNew);
log.info("productFormatNew :" + JSON.toJSONString(productFormatNew));
Ret ret = CommonTool.successResult();
StrObjMap returnData = new StrObjMap();
@ -720,11 +723,14 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
long currAid = attribute.getPropertyId();
List<StrObjMap> matchList = new ArrayList<>();
StrObjMap mStrObjmap = new StrObjMap();
mStrObjmap.put("name", attribute.getPropertyName());
String nameStr = ObjectUtil.isNotEmpty(attribute.getOptions()) ? attribute.getOptions().get(0).getName() : "";
mStrObjmap.put("name", nameStr);
mStrObjmap.put("diy_type", attribute.getDiyType());
String valueStr = ObjectUtil.isNotEmpty(attribute.getOptions()) ? attribute.getOptions().get(0).getValue() : "0";
// Object valueObj = CommonTool.convertToNumericType(valueStr);
mStrObjmap.put("value", Integer.parseInt(valueStr));
// mStrObjmap.put("type", attribute.getType());
// mStrObjmap.put("required", attribute.getRequired());
// mStrObjmap.put("attr", attribute.getPropertyName());
matchList.add(mStrObjmap);
matchAttrs.put(String.valueOf(currAid), matchList);
}
@ -867,12 +873,11 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
TreeMap<Double, Object> matchVids = new TreeMap<>(Collections.reverseOrder());
Map<String, String> matchSourceAttrs = new HashMap<>();
double maxPercent = -1;
String maxMatchAttrValue = ObjectUtil.isEmpty(attribute.getOptions()) ? "0" : attribute.getOptions().get(0).getValue();
String maxMatchAttrValue = attribute.getOptions().get(0).getValue();
StrObjMap sourceValueMap = searchSourceValue(sourceAttrs, attribute.getPropertyName());
String sourceValue = (String) sourceValueMap.get("sourceValue");
sourceValue = getDefaultValueByAttrName(attribute.getPropertyName(), sourceValue);
if (sourceValue != null && !sourceValue.isEmpty()) {
List<String> sourceValueList = splitMultiValueList(sourceValue);
sourceValueList.add(0, sourceValue);
@ -913,7 +918,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
if (matchVids.isEmpty()) {
for (OptionsItem attValue : attribute.getOptions()) {
String name = attValue.getName();
if ((title.contains(name) && (name.length() > 1)) || (CommonTool.checkHasOtherKeyword(name) && !name.toLowerCase().contains("海外"))) {
if ((title.contains(name) && !StringUtils.isNumeric(name) ) || (CommonTool.checkHasOtherKeyword(name) && !name.toLowerCase().contains("海外"))) {
matchVids.put(0D, attValue.getValue());
}
}
@ -961,10 +966,17 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
StrObjMap matchAttr = null;
if (!matchVids.isEmpty()) {
Object vid = matchVids.lastKey();
String name = getValueNameFromAttrOptions(vid, attribute.getOptions(), attribute.getPropertyName());
String value = String.valueOf(vid);
if(StringUtils.isBlank(name)){
name = attribute.getOptions().get(0).getName();
value = attribute.getOptions().get(0).getValue();
}
matchAttr = new StrObjMap();
matchAttr.put("name", getValueNameFromAttrOptions(vid, attribute.getOptions(), attribute.getPropertyName()));
matchAttr.put("diy_type", 0);
matchAttr.put("value", vid);
matchAttr.put("name", name);
matchAttr.put("diy_type", attribute.getDiyType());
matchAttr.put("value", CommonTool.convertStringToInt(value));
matchAttr.put("type",attribute.getType());
}
if (matchSourceAttrs != null && !matchSourceAttrs.isEmpty()) {
@ -980,7 +992,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
return option.getName();
}
}
return propertyName;
return "";
}
private List<StrObjMap> matchProductAttributesByTimeframe(DataItem attribute, JSONObject sourceAttrs, String type) {
@ -1020,6 +1032,8 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
sourceValue = getMockSourceAttrValue((String) attribute.getPropertyName());
}
StrObjMap arr = createTimeframeEntry(sourceValue);
arr.put("type",attribute.getType());
arr.put("required",attribute.getRequired());
return type.equals(MoveConst.attrInputTypeTimestamp) ? new ArrayList<StrObjMap>() {{
add(arr);
}} : new ArrayList<StrObjMap>() {{
@ -1114,6 +1128,8 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
matchAttr.put("name", matchVid.getName());
matchAttr.put("diy_type", 0);
matchAttr.put("value", matchVid.getValue());
matchAttr.put("type",attribute.getType());
matchAttr.put("required",attribute.getRequired());
matchAttrList.add(matchAttr);
}
@ -1191,6 +1207,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
if (sourceAttrs.containsKey(attribute.getPropertyName())) {
sourceAttrs.remove(attribute.getPropertyName());
}
//
// else {
// for (String key : sourceAttrs.keySet()) {
// sourceAttrs.remove(key);
@ -1201,8 +1218,10 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
if (sourceValue != null) {
StrObjMap matchAttr = new StrObjMap();
matchAttr.put("name", sourceValue);
matchAttr.put("diy_type", 0);
matchAttr.put("diy_type", attribute.getDiyType());
matchAttr.put("value", 0);
matchAttr.put("type",attribute.getType());
matchAttr.put("required",attribute.getRequired());
return Collections.singletonList(matchAttr);
}
return null;

@ -1002,4 +1002,22 @@ public class CommonTool {
}
return new String(bytes, 0, i, "Unicode");
}
public static int convertStringToInt(String s) {
if (s == null || s.isEmpty()) {
return 0;
}
try {
// 如果字符串表示的是整数
return Integer.parseInt(s);
} catch (NumberFormatException e) {
try {
// 如果字符串表示的是浮点数,舍去小数部分
return (int) Double.parseDouble(s);
} catch (NumberFormatException e2) {
return 0;
}
}
}
}

@ -1,12 +1,13 @@
#本地端口
server.port=9090
#开发库
#spring.datasource.url=jdbc:mysql://rm-2ze492h01b2j0i718mo.mysql.rds.aliyuncs.com:3306/dd_light_ds_dev2?characterEncoding=utf-8&useSSL=false
#spring.redis.database=10
spring.datasource.url=jdbc:mysql://rm-2ze492h01b2j0i718mo.mysql.rds.aliyuncs.com:3306/dd_light_ds_dev2?characterEncoding=utf-8&useSSL=false
spring.redis.database=10
#测试库
spring.datasource.url=jdbc:mysql://rm-2ze492h01b2j0i718mo.mysql.rds.aliyuncs.com:3306/dd_light_ds_dev?characterEncoding=utf-8&useSSL=false
spring.redis.database=0
#spring.datasource.url=jdbc:mysql://rm-2ze492h01b2j0i718mo.mysql.rds.aliyuncs.com:3306/dd_light_ds_dev?characterEncoding=utf-8&useSSL=false
#spring.redis.database=0
#=================测试环境
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

Loading…
Cancel
Save