Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java
20230922-ljl-fixBug
qiushengjie 1 year ago
commit 40f3effa90

@ -0,0 +1,9 @@
package com.ms.api.dto.move;
import lombok.Data;
@Data
public class GetRecommendProductListRequestDTO {
private Integer pageNo;
private Integer pageSize;
}

@ -0,0 +1,65 @@
package com.ms.api.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ms.api.common.Ret;
import com.ms.api.paas.StorageService;
import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.api.tool.MoveTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
@Component
@Slf4j
public class DsCatService {
// @Autowired
// private CategoryService categoryService;
@Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate;
@Autowired
private StorageService storageService;
public JSONArray getDSProductCatTree() {
HashMap<String, Object> params = new HashMap<>();
String res = null;
JSONObject resObj = null;
String tosPath = MoveTool.getAllProductCatTreeOssPath();
JSONArray arrayData = null;
try {
Ret getTosContentRet = storageService.getContent(tosPath);
if (getTosContentRet.getResult().equals("success")) {
arrayData = JSONObject.parseArray(getTosContentRet.getData().get("data").toString());
} else {
try {
res = dsJsonRequestTemplate.execute("/move/search_ds_product_cat_tree", params);
log.info(res);
resObj = JSON.parseObject(res);
if (resObj.get("result").equals("success")) {
JSONObject cateTree = resObj.getJSONObject("cateTree");
arrayData = new JSONArray();
arrayData.add(cateTree.values());
try {
storageService.uploadContent(tosPath, JSONObject.toJSONString(arrayData));
} catch (Exception e) {
log.error("商品类目TOS写入操作过程异常", e);
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("strerror2:", e);
}
}
} catch (Exception e) {
log.error("商品类目TOS读取操作过程异常", e);
}
return arrayData;
}
}

@ -201,8 +201,11 @@ public class MoveService {
productDetailBase.put("categoryLeafId", queueMsg.getCid());
// 尺寸模版
Long size = getSizeTemplateId(shopId, Long.parseLong(queueMsg.getCid()));
productDetailBase.put("sizeTemplateId", size);
if(StrUtil.isNotBlank(queueMsg.getCid())){
Long size = getSizeTemplateId(shopId, Long.parseLong(queueMsg.getCid()));
productDetailBase.put("sizeTemplateId", size);
}
// 发货时间
long deliveryDelayDay = condition.getDeliveryDelayDay();

@ -68,6 +68,8 @@ public class MoveProductPublishQueueBO {
private MoveShopSettingBO condition;
private String conditionTxt;
private String cnaliDsDetailId;
private String site;

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List;
import java.util.Set;
import com.doudian.open.core.AccessToken;
import com.ms.api.common.ApiResult;
import com.ms.dal.entity.AfterSale;
@ -30,7 +31,7 @@ public interface AfterSaleService {
Integer tryRsyncAfterSale(String authShopId, Integer priority , Date forceStart);
ApiResult rsyncAfterSaleByAftersaleIds(String authShopId, String aftersaleIds, boolean fromDyCloud);
ApiResult rsyncAfterSaleByAftersaleIds(String authShopId, String aftersaleIds, AccessToken accessToken, boolean fromDyCloud);
boolean processDoudianAftersaleMsg(Long shopId, String msgId);

@ -24,4 +24,6 @@ public interface CategoryShopService {
List<Category> getCategoryListByShopId(long shopId, long maxCid, int stepLen);
Category getCategoryListByCategoryId(Long shopId,Long categoryId);
}

@ -1,6 +1,7 @@
package com.ms.api.service;
import com.ms.dal.entity.PurchaseOrderItem;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
import java.util.List;
@ -31,6 +32,8 @@ public interface PurchaseOrderItemService {
int updateStatusByIds(String status, List<Long> ids);
int updateStatusByPurchaseIds(String status, List<Long> purchaseOrderIds);
List<PurchaseOrderItem> getRelatePurchaseOrderItemsByPurchaseOrderId(Long purchaseOrderId);
int updateStatusByOrderId(Long shopId, String orderId, String status);

@ -27,6 +27,8 @@ import com.doudian.open.api.afterSale_Detail.data.Return;
import com.doudian.open.api.afterSale_Detail.data.SkuOrderInfosItem;
import com.doudian.open.api.afterSale_Detail.data.ValueAddedServicesItem;
import com.doudian.open.api.afterSale_Detail.param.AfterSaleDetailParam;
import com.doudian.open.core.AccessToken;
import com.ms.api.bo.ShopBO;
import com.ms.api.common.ApiResult;
import com.ms.api.consts.AfterSaleConst;
import com.ms.api.consts.LogisticsConst;
@ -34,6 +36,7 @@ import com.ms.api.consts.RedisKeyConst;
import com.ms.api.consts.StatusConst;
import com.ms.api.consts.TblConst;
import com.ms.api.service.AfterSaleService;
import com.ms.api.service.ShopService;
import com.ms.api.tool.CommonTool;
import com.ms.api.util.DdRequestUtil;
import com.ms.dal.entity.AfterSale;
@ -80,7 +83,7 @@ public class AfterSaleServiceImpl implements AfterSaleService {
private final DdAftersaleMsgMapper ddAftersaleMsgMapper;
private final ShopMapper shopMapper;
private final ShopService shopService;
@Override
public int deleteByPrimaryKey(Long id) {
@ -177,7 +180,7 @@ public class AfterSaleServiceImpl implements AfterSaleService {
}
@Override
public ApiResult<Void> rsyncAfterSaleByAftersaleIds(String shopId, String aftersaleIds, boolean fromDyCloud) {
public ApiResult<Void> rsyncAfterSaleByAftersaleIds(String shopId, String aftersaleIds, AccessToken accessToken, boolean fromDyCloud) {
if (ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(aftersaleIds) || ObjectUtil.isEmpty(fromDyCloud)) {
return ApiResult.fail("参数错误");
}
@ -188,7 +191,7 @@ public class AfterSaleServiceImpl implements AfterSaleService {
// // TODO: 2023/9/3 未找到抖店云推送数据
}
if (ObjectUtil.isEmpty(ddRet) || !ddRet.isSuccess()) {
ddRet = getAfterSaleDetailFromDd(aftersaleId);
ddRet = getAfterSaleDetailFromDd(aftersaleId, accessToken);
}
if (!ddRet.isSuccess()) {
return ApiResult.fail(ddRet.getMsg());
@ -407,10 +410,10 @@ public class AfterSaleServiceImpl implements AfterSaleService {
return true;
}
private ApiResult<AfterSaleDetailData> getAfterSaleDetailFromDd(String aftersaleId) {
private ApiResult<AfterSaleDetailData> getAfterSaleDetailFromDd(String aftersaleId, AccessToken accessToken) {
AfterSaleDetailParam param = new AfterSaleDetailParam();
param.setAfterSaleId(aftersaleId);
return DdRequestUtil.getAfterSaleDetailFromDd(param);
return DdRequestUtil.getAfterSaleDetailFromDd(param, accessToken);
}
@Override
@ -437,10 +440,11 @@ public class AfterSaleServiceImpl implements AfterSaleService {
JSONObject msgData = null;
String targetShopId = null;
ShopBO shopInfo = null;
if (isSuccess) {
msgData = StringUtils.isEmpty(aftersaleMsgInfo.getData()) ? new JSONObject() : JSONObject.parseObject(aftersaleMsgInfo.getData());
targetShopId = msgData.getString("shop_id");
Shop shopInfo = shopMapper.selectByPrimaryKey(Long.valueOf(targetShopId));
shopInfo = shopService.getShopInfo(Long.valueOf(targetShopId));
if (shopInfo == null) {
log.info(String.format("shopId[%s] shop is empty", targetShopId));
isSuccess = false;
@ -454,7 +458,7 @@ public class AfterSaleServiceImpl implements AfterSaleService {
afterSaleId = msgData.getString("after_sale_id");
}
log.info(String.format("afterSaleId[%s]", afterSaleId));
ApiResult processRet = rsyncAfterSaleByAftersaleIds(targetShopId, afterSaleId, true);
ApiResult processRet = rsyncAfterSaleByAftersaleIds(targetShopId, afterSaleId, shopInfo.getShopAccessToken(), true);
log.info(String.format("processRet: ", JSONObject.toJSONString(processRet)));
if (!processRet.isSuccess()) {
isSuccess = false;

@ -54,6 +54,10 @@ public class CategoryShopServiceImpl implements CategoryShopService{
return categoryShopMapper.getCategoryListByShopId(shopId, maxCid, stepLen);
}
@Override
public Category getCategoryListByCategoryId(Long shopId,Long categoryId) {
return categoryShopMapper.getCategoryListByCategoryId(shopId, categoryId);
}
}

@ -445,7 +445,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
OpOrder opOrder = orderIdAndOrderMap.get(platformOrder.getPlatformOrderId());
if (purchaseSetting.getIsAutoFillRemark() >= 1) {
String autoFillRemarkTpl = buildRemarkTplHtml(purchaseSetting.getAutoFillRemarkTpl());
platformOrder.setSourceOrderSellerMemo(buildSourceOrderRemarkAndMemo(shop, autoFillRemarkTpl, opOrder));
platformOrder.setSourceOrderBuyerRemark(buildSourceOrderRemarkAndMemo(shop, autoFillRemarkTpl, opOrder));
}
if (purchaseSetting.getIsAutoFillOrderMemo() >= 1) {
String autoFillOrderMemoTpl = buildRemarkTplHtml(purchaseSetting.getAutoFillOrderMemoTpl());
@ -463,6 +463,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
matchRes.appendReplacement(resString, result);
}
matchRes.appendTail(resString);
log.info("appendRemarkTpl: " + appendRemarkTpl);
log.info("buildSourceOrderRemarkAndMemo: " + resString);
return resString.toString();
}
@ -506,8 +508,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
private HashMap<String, String> buildAndUpdateNewPurchaseOrderRemark(ShopBO shopBO, OpOrder opOrder) {
HashMap<String, String> result = new HashMap<>();
PurchaseSetting purchaseSetting = purchaseSettingService.getByShopId(opOrder.getShopId());
log.info("purchaseSetting: " + purchaseSetting);
List<PurchaseOrder> purchaseOrders = purchaseOrderService.getListByOrderId(opOrder.getShopId(), opOrder.getOrderId(), StatusConst.normal,true);
System.out.println("purchaseOrders1" + purchaseOrders);
if (purchaseSetting.getIsAppendShopNote() == 0 && purchaseSetting.getIsAppendShopRemark() == 0 && purchaseSetting.getShopRemarkFlag() > 0) {
return result;
}
@ -534,6 +536,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
if (newSellerWords.equals(oldSellerWords) && String.valueOf(shopRemarkFlag).equals(opOrder.getSellerRemarkStars())) {
return newSellerWords;
}
log.info("shopRemarkFlag: " + shopRemarkFlag);
opOrderService.updateOpOrderSellerRemarkToDb(shopBO, opOrder.getOrderId(), newSellerWords, shopRemarkFlag, false, OrderPrintConst.UPDATE_SELLER_WORD_SOURCE_SINGLE, purchaseOrderRemark);
return newSellerWords;
}
@ -969,7 +972,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}
if (!needCancelPurchaseOrderIds.isEmpty()) {
purchaseOrderService.updateStatusByIds(StatusConst.cancel, needCancelPurchaseOrderIds);
purchaseOrderItemService.updateStatusByIds(StatusConst.cancel, needCancelPurchaseOrderIds);
purchaseOrderItemService.updateStatusByPurchaseIds(StatusConst.cancel, needCancelPurchaseOrderIds);
}
if (!needCancelPurchaseOrderItemIds.isEmpty()) {
purchaseOrderItemService.updateStatusByIds(StatusConst.cancel, needCancelPurchaseOrderItemIds);
@ -1300,7 +1303,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
if (opOrders.isEmpty()) {
throw new RuntimeException("订单不存在");
}
List<Long> shopIds = opOrders.stream().map(OpOrder::getShopId).collect(Collectors.toList());
Set<Long> shopIds = opOrders.stream().map(OpOrder::getShopId).collect(Collectors.toSet());
if (shopIds.size() != 1 || !shopIds.contains(shopId)) {
throw new RuntimeException("订单所属店铺异常");
}
@ -1692,12 +1695,21 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
private void autoPurchaseAfterUpdateDsAutoPurchaseLog(String orderId, List<PlatformOrderItemDTO> items, Map<Long, Long> skuIdAndDsAutoPurchaseLogIdMap, BatchCreateDistributionOrdersResponseDTO dsRet) {
List<PurchaseOrderDTO> relatePurchaseOrderInfos = new ArrayList<>();
for (DsSuccessRetDTO successRet : dsRet.getSuccessList()) {
List<DsErrorRetDTO> errorList = dsRet.getErrorList();
List<DsSuccessRetDTO> successList = dsRet.getSuccessList();
if (errorList == null) {
errorList = new ArrayList<>();
}
if (successList == null) {
successList = new ArrayList<>();
}
for (DsSuccessRetDTO successRet : successList) {
relatePurchaseOrderInfos.addAll(successRet.getRelatePurchaseOrderInfos());
}
Map<String, PurchaseOrderDTO> platformOrderIdAndRelatePurchaseOrderInfoMap = CommonTool.convertListToMap(relatePurchaseOrderInfos, PurchaseOrderDTO::getPlatformOrderId);
Map<String, String> platformOrderIdAndReasonMap = dsRet.getErrorList().stream().collect(Collectors.toMap(DsErrorRetDTO::getPlatformOrderId, DsErrorRetDTO::getReason, (value1, value2) -> value1));
Map<String, String> platformOrderIdAndReasonMap = errorList.stream().collect(Collectors.toMap(DsErrorRetDTO::getPlatformOrderId, DsErrorRetDTO::getReason, (value1, value2) -> value1));
for (PlatformOrderItemDTO platformItemInfo : items) {
PurchaseOrderDTO relatePurchaseOrderInfo = platformOrderIdAndRelatePurchaseOrderInfoMap.get(orderId);

@ -76,6 +76,7 @@ public class MoveProductPublishQueueServiceImpl implements MoveProductPublishQue
lockMsg.setCopyType(moveCollectTask.getCopyType());
MoveShopSettingBO moveShopSetting = JSON.parseObject(moveCollectTask.getCondition(), MoveShopSettingBO.class);
lockMsg.setCondition(moveShopSetting);
lockMsg.setConditionTxt(moveCollectTask.getCondition());
if (!Objects.isNull(lockMsg.getCondition())) {
MoveShopSettingBO moveShopSettingBO = lockMsg.getCondition();
moveShopSettingBO.setIsFastMode(moveCollectTaskDetail.getIsFastMode());

@ -1509,7 +1509,7 @@ public class OpOrderServiceImpl implements OpOrderService {
}
// 添加抖店备注
Boolean addToDs = addOrderSellerRemarkToDs(shopBO, orderId, remark, BeanUtil.isEmpty(flag), flag);
Boolean addToDs = addOrderSellerRemarkToDd(shopBO, orderId, remark, !BeanUtil.isEmpty(flag), flag);
if (BeanUtil.isEmpty(addToDs) || !addToDs) {
throw new RuntimeException("添加抖店备注失败");
}
@ -1518,7 +1518,7 @@ public class OpOrderServiceImpl implements OpOrderService {
updateShopRemarkUpdateLog(updateLogId);
// 最后更新订单的备注
Boolean update = updateOpOrderSellerRemark(shopId, orderId, remark, BeanUtil.isEmpty(flag), flag);
Boolean update = updateOpOrderSellerRemark(shopId, orderId, remark, !BeanUtil.isEmpty(flag), flag);
if (!update) {
throw new RuntimeException("修改备注失败");
}
@ -1587,13 +1587,13 @@ public class OpOrderServiceImpl implements OpOrderService {
* @param star
* @return
*/
private Boolean addOrderSellerRemarkToDs(ShopBO shopBO, String orderId, String remark, Boolean isAddStar, Integer star) {
private Boolean addOrderSellerRemarkToDd(ShopBO shopBO, String orderId, String remark, Boolean isAddStar, Integer star) {
OrderAddOrderRemarkRequest request = new OrderAddOrderRemarkRequest();
OrderAddOrderRemarkParam param = new OrderAddOrderRemarkParam();
param.setOrderId(orderId);
param.setRemark(remark);
if (!BeanUtil.isEmpty(isAddStar) && isAddStar && !BeanUtil.isEmpty(star)) {
param.setIsAddStar(isAddStar ? "true" : "false");
param.setIsAddStar("true");
param.setStar("" + star);
}
request.setParam(param);

@ -71,6 +71,11 @@ public class PurchaseOrderItemServiceImpl implements PurchaseOrderItemService{
return purchaseOrderItemMapper.updateStatusByIds(status, ids);
}
@Override
public int updateStatusByPurchaseIds(String status, List<Long> purchaseOrderIds) {
return purchaseOrderItemMapper.updateStatusByPurchaseIds(status, purchaseOrderIds);
}
@Override
public List<PurchaseOrderItem> getRelatePurchaseOrderItemsByPurchaseOrderId(Long purchaseOrderId) {
return purchaseOrderItemMapper.getRelatePurchaseOrderItemsByPurchaseOrderId(purchaseOrderId);

@ -415,8 +415,9 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
if (ObjectUtil.isNotEmpty(filter.getDsWaitPayStatus())) {
whereConditions.append(String.format(" AND ood.ds_wait_pay_status IN (%s)", CommonTool.intToSQLIN(filter.getDsWaitPayStatus())));
}
if (ObjectUtil.isNotEmpty(filter.getPurchaseOrderStatus())) {
whereConditions.append(String.format(" AND ood.ds_purchase_status IN (%s)", CommonTool.stringToSQLIN(CommonTool.splitWithComma(filter.getPurchaseOrderStatus()))));
if (ObjectUtil.isNotEmpty(filter.getDsPurchaseStatus())) {
List<String> dsPurchaseStatus = filter.getDsPurchaseStatus().stream().map(String::valueOf).collect(Collectors.toList());
whereConditions.append(String.format(" AND ood.ds_purchase_status IN (%s)", CommonTool.stringToSQLIN(dsPurchaseStatus)));
}
if (ObjectUtil.isNotEmpty(filter.getOrderIds())) {
whereConditions.append(String.format(" AND %s.`order_id` IN (%s)", masterTblAlias, CommonTool.stringToSQLIN(filter.getOrderIds())));

@ -25,10 +25,12 @@ import com.ms.api.service.QueueService;
import com.ms.api.tool.CommonTool;
import com.ms.dal.mapper.QueueMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@Service
@Slf4j
@AllArgsConstructor
public class QueueServiceImpl implements QueueService {
@ -58,6 +60,7 @@ public class QueueServiceImpl implements QueueService {
}
private int unlockSolidRedisSkipQueue(String queueName, String status) {
log.info(String.format("unlockSolidRedisSkipQueue start %s", queueName));
String queueRedisKey = RedisKeyConst.getQueueRedisKey(queueName, false);
List<String> redisIds = redisTemplate.opsForList().range(queueRedisKey, 0, -1);
if (ObjectUtil.isEmpty(redisIds)) {
@ -80,7 +83,9 @@ public class QueueServiceImpl implements QueueService {
queueIdWhere.append(where);
}
queueIdWhere.append(String.format(" order by %s asc limit %s", queueIdColumnName, limit));
log.info("whereStr: " + queueIdWhere.toString());
List<Map<String, Object>> queueList = queueMapper.select(queueName, queueIdWhere.toString());
log.info("queueList size: " + queueList.size());
if (ObjectUtil.isEmpty(queueList)) {
break;
}
@ -100,16 +105,21 @@ public class QueueServiceImpl implements QueueService {
Set<String> tempRedisIds = new HashSet<>();
tempRedisIds.addAll(redisIds);
tempRedisIds.addAll(newRedisIds);
log.info("allQueueList count: " + allQueueList.size());
log.info("tempRedisIds count: " + tempRedisIds.size());
for (Map<String, Object> queue : allQueueList) {
Long queueId = (Long) queue.getOrDefault(queueIdColumnName, null);
Long queueId = ((BigInteger)queue.getOrDefault(queueIdColumnName, null)).longValue();
log.info("queueId: " + queueId);
if (ObjectUtil.isNotNull(queueId)) {
String queueIdStr = queueId.toString();
if (redisIds.contains(queueIdStr)) {
continue;
}
log.info("push queueIdStr: " + queueIdStr);
redisTemplate.opsForList().leftPush(queueRedisKey, queueIdStr);
}
}
log.info(String.format("unlockSolidRedisSkipQueue end %s", queueName));
return allQueueList.size();
}
@ -143,7 +153,7 @@ public class QueueServiceImpl implements QueueService {
Map<Long, Map<String, Object>> dataMap = queueMapper.selectShopIdAndCnt(queueName, null);
Map<Long, Long> shopIdAndQueueCntMap = new HashMap<>();
for (Map.Entry<Long, Map<String, Object>> entry : dataMap.entrySet()) {
shopIdAndQueueCntMap.put(entry.getKey(), (Long) entry.getValue().getOrDefault("cnt", 0L));
shopIdAndQueueCntMap.put(entry.getKey(), ((BigInteger) entry.getValue().getOrDefault("cnt", 0L)).longValue());
}
Map<Long, Long> resultMap = new HashMap<>();
for (Map.Entry<Long, Long> entry : shopIdAndCntMap.entrySet()) {
@ -196,7 +206,7 @@ public class QueueServiceImpl implements QueueService {
Map<Long, Map<String, Object>> dataMap = queueMapper.selectShopIdAndCnt(bufferName, whereStr);
for (Map.Entry<Long, Map<String, Object>> entry : dataMap.entrySet()) {
String shopId = String.valueOf(entry.getKey());
result.put(Long.valueOf(shopId), (Long) entry.getValue().getOrDefault("cnt", 0L));
result.put(Long.valueOf(shopId), ((BigInteger) entry.getValue().getOrDefault("cnt", 0L)).longValue());
}
return result;
}
@ -223,7 +233,7 @@ public class QueueServiceImpl implements QueueService {
public int unlockTimeoutQueue(String tableName, int heartbeatExpiredSeconds, String status) {
DateTime deadTime = DateUtil.offsetSecond(new Date(), -heartbeatExpiredSeconds);
String where = String.format(" WHERE locked > 0 AND gmt_last_heartbeat < '%s' ", DateUtil.formatDateTime(deadTime));
if (StrUtil.isBlank(status)) {
if (StrUtil.isNotBlank(status)) {
where = where.concat(String.format(" and `status` = %s ", status));
}
List<Map<String, Object>> queueList = queueMapper.select(tableName, where);

@ -12,9 +12,11 @@ import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.move.GetProductInfoRequestDTO;
import com.ms.api.service.CategoryService;
import com.ms.api.service.CategoryShopService;
import com.ms.api.service.MoveSystemSourceCategoryService;
import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.dal.entity.Category;
import com.ms.dal.entity.CategoryShop;
import com.ms.dal.entity.MoveSystemSourceCategory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -45,6 +47,9 @@ public class GetProductInfoByProductId extends SPIBaseService implements Extensi
@Autowired
private CategoryService categoryService;
@Autowired
private CategoryShopService categoryShopService;
@Override
public BaseResponse<Ret> handle(BaseRequest<GetProductInfoRequestDTO> req) {
// ----逻辑校验----
@ -140,7 +145,7 @@ public class GetProductInfoByProductId extends SPIBaseService implements Extensi
Long categoryId = null;
for (Object key : assocMap.keySet()) {
System.out.println("key:" + key + ", value:" + assocMap.get(key));
Category category = categoryService.selectByPrimaryKey(Long.valueOf(key.toString()));
Category category = categoryShopService.getCategoryListByCategoryId(shopId, (Long.valueOf(key.toString())));
if (!ObjectUtil.isEmpty(category)) {
Double score = this.getJaroWinklerDistance(sourceCateListStr, category.getPath());
if (score > max) {

@ -12,12 +12,14 @@ import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.move.GetProductInfoRequestDTO;
import com.ms.api.service.CategoryService;
import com.ms.api.service.CategoryShopService;
import com.ms.api.service.MoveSystemSourceCategoryService;
import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.api.common.UniqueKeyMultiValueMap;
import com.ms.dal.entity.Category;
import com.ms.dal.entity.MoveSystemSourceCategory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.phprpc.util.AssocArray;
import org.phprpc.util.PHPSerializer;
import org.springframework.beans.factory.annotation.Autowired;
@ -47,6 +49,9 @@ public class GetProductInfoService extends SPIBaseService implements ExtensionSe
@Autowired
private CategoryService categoryService;
@Autowired
private CategoryShopService categoryShopService;
@Override
public BaseResponse<Ret> handle(BaseRequest<GetProductInfoRequestDTO> req) {
initHandle(req);
@ -74,24 +79,26 @@ public class GetProductInfoService extends SPIBaseService implements ExtensionSe
resObj = JSON.parseObject(res);
JSONObject product = resObj.getJSONObject("productInfo");
Long sourceCategoryId = product.getLong("1688cid");
String sourceCateListStr = StringUtils.join(product.getJSONArray("cateList"), ">");
log.info("productInfo:::"+sourceCategoryId.toString());
MoveSystemSourceCategory moveSystemSourceCategory = moveSystemSourceCategoryService.selectBySourceCategoryId(sourceCategoryId.toString());
if (!ObjectUtil.isEmpty(moveSystemSourceCategory)) {
Long moveSystemSourceCategoryId = moveSystemSourceCategory.getMoveSystemSourceCategoryId();
PHPSerializer p = new PHPSerializer();
String content = moveSystemSourceCategory.getMatchCategoryList();
AssocArray assocArray = (AssocArray) p.unserialize(content.getBytes());
Map assocMap = assocArrayToHash(assocArray);
List<String> assocMapKeys = new ArrayList<>(assocMap.keySet());
log.info("assocArrayToHash" + assocMapKeys.get(assocMapKeys.size() - 1));
Long categoryId = Long.valueOf(assocMapKeys.get(assocMapKeys.size() - 1));
List<Long> categoryIds = this.getCategoryIdList(categoryId);
Category category = categoryService.selectByPrimaryKey(Long.valueOf(assocMapKeys.get(assocMapKeys.size() - 1)));
String path = category.getPath();
List<String> pathArr = Arrays.asList(path.split(">"));
product.put("ddCid", categoryIds);
product.put("ddCategoryList", pathArr);
Map<String,Object> assocMap = assocArrayToHash(assocArray);
Long categoryId = this.getBestCategoryId(sourceCateListStr, assocMap);
if (ObjectUtil.isEmpty(categoryId)) {
product.put("ddCid", "");
product.put("ddCategoryList", "");
} else {
List<Long> categoryIds = this.getCategoryIdList(categoryId);
Category category = categoryService.selectByPrimaryKey(categoryId);
String path = category.getPath();
List<String> pathArr = Arrays.asList(path.split(">"));
product.put("ddCid", categoryIds);
product.put("ddCategoryList", pathArr);
}
} else {
product.put("ddCid", "");
product.put("ddCategoryList", "");
@ -143,4 +150,24 @@ public class GetProductInfoService extends SPIBaseService implements ExtensionSe
log.info(result + "result");
return result;
}
private Long getBestCategoryId(String sourceCateListStr, Map assocMap) {
Double max = 0.00;
Long categoryId = null;
for (Object key : assocMap.keySet()) {
System.out.println("key:" + key + ", value:" + assocMap.get(key));
Category category = categoryShopService.getCategoryListByCategoryId(shopId, (Long.valueOf(key.toString())));
if (!ObjectUtil.isEmpty(category)) {
Double score = this.getJaroWinklerDistance(sourceCateListStr, category.getPath());
if (score > max) {
max = score;
categoryId = Long.valueOf(key.toString());
}
}
}
return categoryId;
}
private double getJaroWinklerDistance(String first, String second) {
return StringUtils.getJaroWinklerDistance(first, second);
}
}

@ -0,0 +1,99 @@
package com.ms.api.spi.move;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.biz.DsCatService;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.move.GetRecommendProductListRequestDTO;
import com.ms.api.service.CategoryService;
import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.dal.entity.Category;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
@ExtensionService("getRecommendProductList")
@Slf4j
public class GetRecommendProductListService extends SPIBaseService implements ExtensionServiceHandler<GetRecommendProductListRequestDTO, Ret> {
@Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate;
@Autowired
private DsCatService dsCatService;
@Autowired
private CategoryService categoryService;
@Override
public BaseResponse<Ret> handle(BaseRequest<GetRecommendProductListRequestDTO> req) {
initHandle(req);
getAuthCode();
GetRecommendProductListRequestDTO requestDTO = req.getData();
// 1688类目树
JSONArray arrayData = dsCatService.getDSProductCatTree();
// 获取商家抖店类目列表
List<Category> categoryList = categoryService.getAllLeafProductCatListFromTos(shopId.intValue(), false);
Collections.shuffle(categoryList);
int productCnt = 0;
int categoryIndex = 0;
while (productCnt < requestDTO.getPageSize()) {
categoryIndex++;
}
// HashMap<String, Object> params = new HashMap<>();
//// params.put("keyword",fields.getKeyword());
//// params.put("topCid",fields.getTopCid());
// params.put("cid",fields.getCid());
// params.put("sort", "saleCntDesc");
//// params.put("ruleIds", fields.getRuleIds());
// params.put("isHideMoved", 1);
// params.put("pageNo",requestDTO.getPageNo());
// params.put("pageSize",requestDTO.getPageSize());
// params.put("authCode",authCode);
// log.info(params.toString());
// JSONObject resObj = null;
// String res = null;
// List<Object> products = new LinkedList<>();
//
// try {
// res = dsJsonRequestTemplate.execute("/move/search_choiceness_source_item", params);
// resObj = JSON.parseObject(res);
// if (resObj.get("result").equals("success")) {
// log.info("resObj::"+resObj.toString());
// Map result = new HashMap();
// List<Object> sourceItems = new ArrayList<>();
// JSONArray sourceItemjson = resObj.getJSONArray("sourceItems");
// if (!ObjectUtil.isEmpty(sourceItemjson)) {
// sourceItems = sourceItemjson;
// }
// result.put("result", resObj.getString("result"));
// result.put("sourceItems", sourceItems);
// result.put("total", resObj.getInteger("total"));
// res = JSON.toJSONString(result);
// }
// } catch (Exception e) {
// e.printStackTrace();
// log.error(e.getMessage());
// }
return R.ok(Ret.success());
}
}

@ -1,29 +1,20 @@
package com.ms.api.spi.move;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.biz.DsCatService;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.move.SearchDSProductCatTreeRequestDTO;
import com.ms.api.paas.StorageService;
import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.api.common.UniqueKeyMultiValueMap;
import com.ms.api.tool.MoveTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MultiValueMap;
import java.io.*;
import java.net.URL;
import java.sql.Array;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
/**
*
@ -35,10 +26,7 @@ import java.util.*;
public class SearchDSProductCatTreeService extends SPIBaseService implements ExtensionServiceHandler<SearchDSProductCatTreeRequestDTO, Ret> {
@Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate;
@Autowired
private StorageService storageService;
private DsCatService dsCatService;
@Override
public BaseResponse<Ret> handle(BaseRequest<SearchDSProductCatTreeRequestDTO> req) {
@ -48,37 +36,7 @@ public class SearchDSProductCatTreeService extends SPIBaseService implements Ext
// ----逻辑校验----
// ----业务处理----
HashMap<String, Object> params = new HashMap<>();
String res = null;
JSONObject resObj = null;
String tosPath = MoveTool.getAllProductCatTreeOssPath();
List<Object> arrayData = null;
try {
Ret getTosContentRet = storageService.getContent(tosPath);
if (getTosContentRet.getResult().equals("success")) {
arrayData = JSONObject.parseArray(getTosContentRet.getData().get("data").toString());
} else {
try {
res = dsJsonRequestTemplate.execute("/move/search_ds_product_cat_tree", params);
log.info(res);
resObj = JSON.parseObject(res);
if (resObj.get("result").equals("success")) {
JSONObject cateTree = resObj.getJSONObject("cateTree");
arrayData = new ArrayList<>(cateTree.values());
try {
storageService.uploadContent(tosPath, JSONObject.toJSONString(arrayData));
} catch (Exception e) {
log.error("商品类目TOS写入操作过程异常", e);
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("strerror2:" + e);
}
}
} catch (Exception e) {
log.error("商品类目TOS读取操作过程异常", e);
}
JSONArray arrayData = dsCatService.getDSProductCatTree();
Map<String, Object> result = new HashMap<>();
result.put("data", arrayData.toString());

@ -11,6 +11,7 @@ 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.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -53,6 +54,7 @@ public class DsAutoPurchaseMoveBufferToQueueTaskService extends TaskBaseService
}
@Async("dsAutoPurchaseMoveBufferToQueueTaskPool")
@Scheduled(fixedRate = 10000)
@Override
public void runTask() {
super.runTask();

@ -11,6 +11,7 @@ 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.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -60,6 +61,7 @@ public class DsAutoPurchaseTaskService extends TaskBaseService {
}
@Async("dsAutoPurchaseTaskPool")
@Scheduled(fixedRate = 10000)
@Override
public void runTask() {
super.runTask();

@ -49,7 +49,14 @@ import com.doudian.open.api.product_getCatePropertyV2.data.ProductGetCatePropert
import com.doudian.open.core.AccessToken;
import com.ms.api.biz.MoveService;
import com.ms.api.biz.SaveBatchMoveTaskBizService;
import com.ms.api.bo.*;
import com.ms.api.bo.AttributeBO;
import com.ms.api.bo.CateAttributeResultBO;
import com.ms.api.bo.CategoryBO;
import com.ms.api.bo.MoveProductPublishQueueBO;
import com.ms.api.bo.MoveShopSettingBO;
import com.ms.api.bo.RedisKeyBO;
import com.ms.api.bo.SkuDetailBO;
import com.ms.api.bo.SkuInfoBO;
import com.ms.api.common.ApiResult;
import com.ms.api.common.E;
import com.ms.api.common.Ret;
@ -98,7 +105,6 @@ import com.ms.dal.entity.Shop;
import com.ms.dal.entity.Shop1688DsAuth;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -623,7 +629,6 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
return CommonTool.numFormat(price, 0) + Double.parseDouble("." + strPriceDecimalDiyValue);
}
private List<String> checkHasRepeatSpec(List<String> colorSpecArrCalc, List<String> sizeSpecArrCalc) {
List<String> repeatSpecArr = new ArrayList<>();
@ -777,7 +782,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
ProductGetCatePropertyV2Data attrRetData = (ProductGetCatePropertyV2Data) categoryAttrRet.getData().get("data");
List<DataItem> attributes = attrRetData.getData();
String title = productDetailBase.getString("title");
Map<Long, List<StrObjMap>> productFormatNew = buildProductAttrs(attributes, sourceAttrs, title);
Map<Long, List<StrObjMap>> productFormatNew = buildProductAttrs(attributes, sourceAttrs, title,queueMsg);
productFormatNew = attachBrand2ProductFormatNew(brandId, brandName, productFormatNew);
productDetailBase.put("productFormatNew", productFormatNew);
@ -890,9 +895,17 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
return productFormatNew;
}
private Map<Long, List<StrObjMap>> buildProductAttrs(List<DataItem> attributes, JSONObject sourceAttrs, String title) {
private Map<Long, List<StrObjMap>> buildProductAttrs(List<DataItem> attributes, JSONObject sourceAttrs, String title,MoveProductPublishQueueBO queueMsg) {
JSONObject condition = JSONObject.parseObject(queueMsg.getConditionTxt());
JSONArray presetAttrs = condition.containsKey("presetAttrs") ? condition.getJSONArray("presetAttrs") : new JSONArray();
if (condition.containsKey("taskPresetAttrs")){
presetAttrs.addAll(condition.getJSONArray("taskPresetAttrs"));
}
Map<Long, List<StrObjMap>> matchAttrs = new HashMap<>();
List<String> currAttrName= new ArrayList<>();
for (DataItem attribute : attributes) {
currAttrName.add(attribute.getPropertyName());
long currAid = attribute.getPropertyId();
List<StrObjMap> matchList = matchSourceAttr(attribute, sourceAttrs, title);
if (ObjectUtil.isNotEmpty(matchList)) {
@ -925,9 +938,9 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
if (ObjectUtil.isNotEmpty(matchAttr)) {
for (StrObjMap v : matchAttr) {
StrObjMap item = new StrObjMap();
item.put("name",v.get("name"));
item.put("diy_type",v.get("diy_type"));
item.put("value",100);
item.put("name", v.get("name"));
item.put("diy_type", v.get("diy_type"));
item.put("value", 100);
result.add(item);
// if (v.containsKey("value")) {
@ -950,7 +963,7 @@ 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.isNotEmpty(attribute.getOptions())? attribute.getOptions().get(0).getValue():"";
String maxMatchAttrValue = ObjectUtil.isEmpty(attribute.getOptions()) ? "0" : attribute.getOptions().get(0).getValue();
StrObjMap sourceValueMap = searchSourceValue(sourceAttrs, attribute.getPropertyName());
String sourceValue = (String) sourceValueMap.get("sourceValue");
@ -1537,11 +1550,11 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
private String buildSkuListKey(JSONObject firstAttr, JSONObject secondAttr, List<String> filterWordArray) {
String firstName = firstAttr.getString("newName") != null ? firstAttr.getString("newName") :
(firstAttr.getString("calName") != null ? firstAttr.getString("calName") : firstAttr.getString("name"));
(firstAttr.getString("calName") != null ? firstAttr.getString("calName") : firstAttr.getString("name"));
firstName = filterBanWordsList(filterWordArray, firstName, true);
String secondName = secondAttr.getString("newName") != null ? secondAttr.getString("newName") :
(secondAttr.getString("calName") != null ? secondAttr.getString("calName") : secondAttr.getString("name"));
(secondAttr.getString("calName") != null ? secondAttr.getString("calName") : secondAttr.getString("name"));
secondName = filterBanWordsList(filterWordArray, secondName, true);
if (secondAttr != null && secondName.isEmpty()) {
@ -1562,7 +1575,6 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
return firstName + ";-;" + secondName;
}
private String filterBanWordsList(List<String> filterWordArray, String oriText, boolean isReplace) {
String[] banWords = {"&", "\\", "\r\n", "\r", "\n", "\t"};
for (String word : banWords) {
@ -1637,7 +1649,6 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
return stepStock;
}
private int buildSkuStock(JSONObject skuMap, String cAv, String sAv) {
int stock = 0;
@ -1682,20 +1693,19 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
if (checkBuidSkuCondition) {
String sourceSkuCode = skuInfo.containsKey("skuCode") ? skuInfo.getString("skuCode") : "";
skuCode = skuInfo.containsKey("newSkuCode") ? skuInfo.getString("newSkuCode") :
(skuInfo.containsKey("calSkuCode") ? skuInfo.getString("calSkuCode") : sourceSkuCode);
(skuInfo.containsKey("calSkuCode") ? skuInfo.getString("calSkuCode") : sourceSkuCode);
break;
}
}
return skuCode != null ? skuCode : "";
}
private double buildSkuPrice(JSONObject skuMap, String cAv, String sAv, double defaultPrice) {
double price = 0;
for (Map.Entry entry : skuMap.entrySet()) {
String skuPropStr = (String)entry.getKey();
SkuInfoBO skuInfo = JSONObject.parseObject (JSON.toJSONString(entry.getValue()),SkuInfoBO.class);
String skuPropStr = (String) entry.getKey();
SkuInfoBO skuInfo = JSONObject.parseObject(JSON.toJSONString(entry.getValue()), SkuInfoBO.class);
boolean checkBuildSkuCondition = checkBuildSkuCondition(skuPropStr, cAv, sAv);
if (checkBuildSkuCondition) {
@ -1715,7 +1725,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
}
}
return price > 0 ? CommonTool.numFormat(price,2) : CommonTool.numFormat(defaultPrice,2);
return price > 0 ? CommonTool.numFormat(price, 2) : CommonTool.numFormat(defaultPrice, 2);
}
public boolean checkBuildSkuCondition(String skuPropStr, String cAv, String sAv) {
@ -1727,7 +1737,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
boolean checkSize = false;
skuPropStr = skuPropStr.trim();
sAv = StringUtils.isNotBlank(sAv)? sAv.trim():"";
sAv = StringUtils.isNotBlank(sAv) ? sAv.trim() : "";
if (ObjectUtil.isNotEmpty(sAv) && ObjectUtil.isNotEmpty(skuPropStr)) {
checkSize = true;
} else {
@ -1769,7 +1779,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
price = skuInfo.getDouble("sale_price");
}
priceArr.add(CommonTool.numFormat(price,2));
priceArr.add(CommonTool.numFormat(price, 2));
}
return priceArr.stream().mapToDouble(v -> v).max().orElse(0.0);

@ -1,7 +1,5 @@
package com.ms.api.util;
import java.util.List;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.doudian.open.api.afterSale_Detail.AfterSaleDetailRequest;
@ -58,6 +56,8 @@ import com.ms.api.consts.AppConst;
import com.ms.api.tool.CommonTool;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
@Slf4j
public class DdRequestUtil {
@ -143,7 +143,7 @@ public class DdRequestUtil {
return ApiResult.fail(String.format("抖店请求错误:msg:%s,code:%s,subCode:%s,subMsg:%s,", response.getMsg(), response.getCode(), response.getSubCode(), response.getSubMsg()));
}
public static ApiResult<AfterSaleDetailData> getAfterSaleDetailFromDd(AfterSaleDetailParam param) {
public static ApiResult<AfterSaleDetailData> getAfterSaleDetailFromDd(AfterSaleDetailParam param, AccessToken accessToken) {
String activeProfile = System.getenv("sys-deploy-env");
if (!"Prod".equals(activeProfile)) {
AuthThreadLocalUtil.set(AppConst.TEST_SHOP_ID);
@ -151,7 +151,7 @@ public class DdRequestUtil {
AfterSaleDetailRequest request = new AfterSaleDetailRequest();
request.setParam(param);
log.info("=============Dd请求餐素:{}===================", JSONObject.toJSONString(param));
AfterSaleDetailResponse response = request.execute();
AfterSaleDetailResponse response = ObjectUtil.isNull(accessToken) ? request.execute() : request.execute(accessToken);
log.info("=============Dd请求返回:{}===================", JSONObject.toJSONString(response));
boolean success = CommonTool.checkDdApiRequestIsSuccess(response);
if (success && ObjectUtil.isNotEmpty(response.getData())) {

@ -91,6 +91,6 @@ public class OrderUtil {
afterSaleService.tryRsyncAfterSale(authShopId,100,null);
return ApiResult.ok();
}
return afterSaleService.rsyncAfterSaleByAftersaleIds(authShopId, aftersaleIds,false);
return afterSaleService.rsyncAfterSaleByAftersaleIds(authShopId, aftersaleIds, null, false);
}
}

@ -29,5 +29,7 @@ public interface CategoryShopMapper {
List<Long> selectCategoryIdListByShopId(Integer shopId);
Category getCategoryListByCategoryId(Long shopId,Long categoryId);
int deleteByShopIdAndCategoryIds(@Param("shopId") Integer shopId, @Param("categoryIds") List<Long> categoryIds);
}

@ -36,6 +36,8 @@ public interface PurchaseOrderItemMapper {
int updateStatusByIds(@Param("status") String status, @Param("ids") List<Long> ids);
int updateStatusByPurchaseIds(@Param("status") String status, @Param("purchaseOrderIds") List<Long> purchaseOrderIds);
int updateStatusByOrderId(@Param("shopId") Long shopId, @Param("orderId") String orderId, @Param("status") String status);
List<PurchaseOrderItem> getSkuIdsByOrderId(@Param("orderId") String orderId);

@ -11,6 +11,18 @@
<result property="gmtModified" column="gmt_modified" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="CategoryResultMap" type="com.ms.dal.entity.Category">
<id property="categoryId" column="category_id" jdbcType="BIGINT"/>
<result property="categoryName" column="category_name" jdbcType="VARCHAR"/>
<result property="parentCategoryId" column="parent_category_id" jdbcType="VARCHAR"/>
<result property="path" column="path" jdbcType="VARCHAR"/>
<result property="level" column="level" jdbcType="BOOLEAN"/>
<result property="hasChildren" column="has_children" jdbcType="BOOLEAN"/>
<result property="ts" column="ts" jdbcType="VARCHAR"/>
<result property="gmtCreate" column="gmt_create" jdbcType="TIMESTAMP"/>
<result property="gmtModified" column="gmt_modified" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
shop_id,category_id,gmt_create,
gmt_modified
@ -27,6 +39,17 @@
LIMIT #{stepLen}
</select>
<select id="getCategoryListByCategoryId" resultMap="CategoryResultMap">
SELECT
category.`category_id`, category.`category_name`, category.`path`
FROM category_shop as cs
left join category as category
on category.category_id = cs.category_id
WHERE category.category_id = #{categoryId}
ORDER BY category_id ASC
LIMIT 1
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />

@ -197,6 +197,24 @@
</otherwise>
</choose>
</update>
<update id="updateStatusByPurchaseIds">
update purchase_order_item
set
status = #{status,jdbcType=VARCHAR},
gmt_modified = now()
where 1=1
<choose>
<when test="purchaseOrderIds!=null and purchaseOrderIds.size>0">
and purchase_order_id in
<foreach collection="purchaseOrderIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</when>
<otherwise>
AND 1=0
</otherwise>
</choose>
</update>
<select id="getRelatedPurchaseOrderItems" resultMap="BaseResultMap">
select
poi.ware_id, poi.sku_id, poi.purchase_platform

Loading…
Cancel
Save