Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java
#	ms-deploy/src/main/java/com/ms/deploy/MsApplication.java
20230922-ljl-fixBug
qiushengjie 1 year ago
commit 4c8bc4db2e

@ -5,7 +5,7 @@ curl --location --request POST 'localhost:8080/base/cloud/spi' \
--data-raw '{
"appId":"7264840234423027259",
"authId":"4463798",
"method":"batchDeleteTaskDetail",
"method":"searchDSProductCatTree",
"data":"{\"moveCollectTaskDetailIds\":[26],\"deleteOnSaleProduct\":0,\"deleteProduct\":0}"
}'

@ -1,5 +1,6 @@
package com.ms.api.bo;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import java.util.Date;
@ -86,5 +87,12 @@ public class MoveProductPublishQueueBO {
private String itemNum;
private int price;
private Integer price;
private Boolean hasSaveNotes;
private String notes;
private JSONObject skus;
}

@ -162,4 +162,5 @@ public class MoveShopSettingBO {
private JSONObject price;
private JSONObject desc;
}

@ -6,7 +6,7 @@ import java.util.List;
public class CommonConst {
public static final String SUCCESS = "success";
public static final String FAIL = "fail";
public static final String PLATFORM = "dd";
public static final String PLATFORM = "ddmicroapp";
public static final String BIZ_MOVE = "move";
public static final int MATERIAL_AUDIT_STATUS_QUEUE_MAX_CNT = 5000;
public static final String COLLECT_TASK_SOURCE_1688 = "1688";

@ -66,4 +66,8 @@ public class MoveConst {
public static Integer noBrandId = 596120136; // 无品牌ID
public static String noBrandChinaName = "无品牌";
public static Integer brandAuditStatusSuccess = 2; // 品牌审核通过
public static final String descCopyTypeCopy = "copy";
public static final String descCopyTypeNoCopy = "noCopy";
public static final String descCopyTypeUseMainImage = "useMainImage";
}

@ -34,7 +34,7 @@ import java.util.Objects;
*/
@ExtensionService("memberAuthCallBack")
@Slf4j
public class MemberAuthCallback extends SPIBaseService implements ExtensionServiceHandler<MemberAuthCallBackRequestDTO, Ret> {
public class MemberAuthCallbackService extends SPIBaseService implements ExtensionServiceHandler<MemberAuthCallBackRequestDTO, Ret> {
@Autowired
private Shop1688DsAuthService shop1688DsAuthService;
@Autowired

@ -7,6 +7,7 @@ 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.SaveBatchMoveTaskBizService;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
@ -34,10 +35,11 @@ import java.util.Objects;
public class MoveAgainDetailService extends SPIBaseService implements ExtensionServiceHandler<MoveAgainDetailRequestDTO, Ret> {
@Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate;
private SaveBatchMoveTaskBizService saveBatchMoveTaskBizService;
@Autowired
private MoveCollectTaskDetailService moveCollectTaskDetailService;
@Autowired
private ShopService shopService;
@ -52,13 +54,13 @@ public class MoveAgainDetailService extends SPIBaseService implements ExtensionS
int size = taskDetailIds.size();
if (size == 1) {
Long lastDetails = taskDetailIds.get(0);
int newDetailId = this.moveAgainDetailsByDetailId(shopId, lastDetails, false);
if (newDetailId == 1) {
Integer newDetailId = this.moveAgainDetailsByDetailId(shopId, lastDetails, null);
if (newDetailId != null && newDetailId != 0) {
JSONObject retObj = new JSONObject();
retObj.put("processCount", 1);
return R.ok(Ret.success(retObj));
} else {
return R.fail("当前商品数据已失效,暂不支持操作,如有疑问请联系客服");
return R.ok(Ret.fail("当前商品数据已失效,暂不支持操作,如有疑问请联系客服"));
}
} else {
for (int i = 0; i < size; i++) {
@ -69,64 +71,29 @@ public class MoveAgainDetailService extends SPIBaseService implements ExtensionS
return R.fail("111");
}
private int moveAgainDetailsByDetailId(Long shopId, Long lastDetails, Boolean cnaliDetailId) {
MoveCollectTaskDetail moveCollectTaskDetail = moveCollectTaskDetailService.getMoveCollectTaskDetail(shopId, lastDetails);
private Integer moveAgainDetailsByDetailId(Long shopId, Long detailId, Long cnaliDetailId) {
MoveCollectTaskDetail moveCollectTaskDetail = moveCollectTaskDetailService.getMoveCollectTaskDetail(shopId, detailId);
if (moveCollectTaskDetail == null) {
// return 0;
return null;
}
int needAddCnt = 1;
if (!BeanUtil.isEmpty(cnaliDetailId)) {
if (cnaliDetailId != null) {
needAddCnt = 0;
}
BaseResponse checkAndGetConfigIdRet = this.checkAvailableCopyAndGetMoveConfigId(shopId, needAddCnt);
//检验失败 返回0
if (!Objects.equals(checkAndGetConfigIdRet.getCode(), "10000")) {
return 0;
Ret checkAndGetConfigIdRet = saveBatchMoveTaskBizService.checkAvailableCopyAndGetMoveConfigId(shopId, needAddCnt);
if (checkAndGetConfigIdRet.getResult().equals("fail")) {
return null;
}
Integer moveShopConfigId = Integer.valueOf(checkAndGetConfigIdRet.getData().get("moveShopConfigId").toString());
return 0;
}
// todo checkIsNeedMoveAgainForDsApi相关判断逻辑 用不上,跳过
private Boolean checkShopIsExpire(Long shopId) {
try {
Shop shop = shopService.getDetailById(shopId);
long nowTime = System.currentTimeMillis()/1000;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = sdf.format(shop.getGmtExpire());
long targetTimeOri=CommonTool.getTimeStampByDateStr(dateString);
long targetTime = targetTimeOri / 1000;
if (nowTime >= targetTime) {
return true;
}
} catch (Exception e) {
return true;
}
return false;
}
private BaseResponse<Void> checkAvailableCopyAndGetMoveConfigId(Long shopId,Integer needAddCnt){
Boolean shopIsExpire=this.checkShopIsExpire(shopId);
if(shopIsExpire){
return R.fail("shopId "+shopId+" 店铺已过期,请先续费");
}
// $moveConfig = $this->getAvailableCopyCount($shopId);
// $moveShopConfigId = $moveConfig['move_shop_config_id'];
// $availableCopy = $moveConfig['available_total'];
// if ($needAddCnt > 0 && $needAddCnt > $availableCopy) {
// return CommonTool::failResult("搬家额度不足,请先充值");
// }
//
// return CommonTool::successResult('moveShopConfigId', $moveShopConfigId);
return R.ok();
return null;
}
// private JSON getAvailableCopyCount(Long shopId){
//
// }
}

@ -35,6 +35,18 @@ import com.ms.api.service.*;
import com.ms.api.tool.*;
import com.ms.api.util.DdRequestUtil;
import com.ms.dal.entity.*;
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;
import com.ms.dal.entity.MaterialBizToMaterial;
import com.ms.dal.entity.MoveCollectTaskDetail;
import com.ms.dal.entity.MoveProductPublishQueue;
import com.ms.dal.entity.MoveProductPublishToPicQueue;
import com.ms.dal.entity.RsyncCategoryQueue;
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.springframework.beans.factory.annotation.Autowired;
@ -2049,23 +2061,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();
}
@ -2252,40 +2262,41 @@ public class ProcessProductPublishTaskService extends TaskBaseService {
private Ret checkMoveDataCompletion(MoveProductPublishQueueBO taskDetail, JSONObject sourceProductData) {
// TODO 检查数据完整性 先都成功
// if (empty($taskDetail['condition'])) {
// return CommonTool::failResult("配置信息丢失,请联系客服");
// }
// if(empty($sourceProductData['title'])){
// return CommonTool::failResult("商品标题必填,检查源商品是否下架");
// }
// if(empty($taskDetail['cid'])){
// return CommonTool::failResult("类目ID必填~~");
// }
// if($taskDetail['has_save_notes']) {
// if(empty($taskDetail['notes'])) {
// return CommonTool::failResult("商品描述必填~~");
// }
// } elseif(empty($sourceProductData['notes']) && $taskDetail['condition']['desc']['descCopyType'] == MoveConst::descCopyTypeCopy){
// return CommonTool::failResult("商品描述必填~~");
// }
//
// if(empty($sourceProductData['price'])){
// return CommonTool::failResult("获取价格为空,请重试或联系客服~~");
// }
// if(empty($sourceProductData['image_paths'])){
// return CommonTool::failResult("图片信息必填~~");
// }
// if ($taskDetail['is_fast_mode']) {
// return CommonTool::successResult();
// }
//
// if (empty($taskDetail['price'])) {
// return CommonTool::failResult("搬家价格不完整,请联系客服");
// }
//
// if (empty($taskDetail['skus']['skuMap']) && !empty($sourceProductData['skuMap'])) {
// return CommonTool::failResult("搬家SKU不完整请复制来源链接重新复制商品");
// }
if (ObjectUtil.isNull(taskDetail.getCondition())) {
return CommonTool.failResult("配置信息丢失,请联系客服");
}
if (sourceProductData.getString("title") == null || sourceProductData.getString("title").isEmpty()) {
return CommonTool.failResult("商品标题必填,检查源商品是否下架");
}
if (StrUtil.isBlank(taskDetail.getCid())) {
return CommonTool.failResult("类目ID必填~~");
}
if (ObjectUtil.isNotNull(taskDetail.getHasSaveNotes()) && taskDetail.getHasSaveNotes()) {
if (StrUtil.isBlank(taskDetail.getNotes())) {
return CommonTool.failResult("商品描述必填~~");
}
} else if (sourceProductData.getString("notes") == null || sourceProductData.getString("notes").isEmpty() &&
taskDetail.getCondition().getDesc().getString("descCopyType").equals(MoveConst.descCopyTypeCopy)) {
return CommonTool.failResult("商品描述必填~~");
}
if (sourceProductData.getBigDecimal("price") == null) {
return CommonTool.failResult("获取价格为空,请重试或联系客服~~");
}
if (sourceProductData.getJSONArray("image_paths") == null || sourceProductData.getJSONArray("image_paths").isEmpty()) {
return CommonTool.failResult("图片信息必填~~");
}
if (ObjectUtil.isNotNull(taskDetail.getIsFastMode()) && taskDetail.getIsFastMode() != 0) {
return CommonTool.successResult();
}
if (taskDetail.getPrice() == null) {
return CommonTool.failResult("搬家价格不完整,请联系客服");
}
if (taskDetail.getSkus().getJSONObject("skuMap").isEmpty() && !sourceProductData.getJSONObject("skuMap").isEmpty()) {
return CommonTool.failResult("搬家SKU不完整请复制来源链接重新复制商品");
}
return CommonTool.successResult();
}

@ -1,11 +1,14 @@
package com.ms.web;
import com.alibaba.fastjson.JSON;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.dto.auth.MemberAuthCallBackRequestDTO;
import com.ms.api.dto.move.DsRelationRequestDTO;
import com.ms.api.service.ProductToDsItemService;
import com.ms.api.spi.callback.MemberAuthCallbackService;
import com.ms.api.tool.CommonTool;
import com.ms.dal.entity.ProductToDsItem;
import lombok.extern.slf4j.Slf4j;
@ -23,6 +26,9 @@ public class MoveController {
@Autowired
ProductToDsItemService productToDsItemService;
@Autowired
private MemberAuthCallbackService memberAuthCallbackService;
@GetMapping("/testDsRelation")
public BaseResponse<Ret> testDsRelation(@ModelAttribute DsRelationRequestDTO dto) {
if(StringUtils.isBlank(dto.getPlatformItemId())){
@ -46,5 +52,15 @@ public class MoveController {
}
return R.ok(CommonTool.successResult("data", JSON.toJSONString(productToDsItem)));
}
@PostMapping("/memberAuthCallBack")
public BaseResponse<Ret> memberAuthCallBack(@RequestBody MemberAuthCallBackRequestDTO request) {
try {
BaseRequest<MemberAuthCallBackRequestDTO> baseRequest =new BaseRequest<>();
baseRequest.setData(request);
memberAuthCallbackService.handle(baseRequest);
return R.ok(CommonTool.successResult());
} catch (RuntimeException e) {
return R.ok(Ret.fail(e.getMessage()));
}
}
}

Loading…
Cancel
Save