|
|
|
@ -10,6 +10,7 @@ import com.ms.api.common.R;
|
|
|
|
|
import com.ms.api.common.Ret;
|
|
|
|
|
import com.ms.api.common.SPIBaseService;
|
|
|
|
|
import com.ms.api.common.StrObjMap;
|
|
|
|
|
import com.ms.api.consts.CommonConst;
|
|
|
|
|
import com.ms.api.consts.StatusConst;
|
|
|
|
|
import com.ms.api.dto.move.SaveBatchMoveTaskRequestDTO;
|
|
|
|
|
import com.ms.api.service.MoveCollectTaskDetailService;
|
|
|
|
@ -30,7 +31,7 @@ import java.util.*;
|
|
|
|
|
*/
|
|
|
|
|
@ExtensionService("saveBatchMoveTask")
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class SaveBatchMoveTaskService extends SPIBaseService implements ExtensionServiceHandler<SaveBatchMoveTaskRequestDTO, Void> {
|
|
|
|
|
public class SaveBatchMoveTaskService extends SPIBaseService implements ExtensionServiceHandler<SaveBatchMoveTaskRequestDTO, Ret> {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MoveCollectTaskService moveCollectTaskService;
|
|
|
|
@ -42,7 +43,7 @@ public class SaveBatchMoveTaskService extends SPIBaseService implements Extensio
|
|
|
|
|
private MoveCollectTaskDetailService moveCollectTaskDetailService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse<Void> handle(BaseRequest<SaveBatchMoveTaskRequestDTO> req) {
|
|
|
|
|
public BaseResponse<Ret> handle(BaseRequest<SaveBatchMoveTaskRequestDTO> req) {
|
|
|
|
|
initHandle(req);
|
|
|
|
|
// ----参数校验----
|
|
|
|
|
SaveBatchMoveTaskRequestDTO fields = req.getData();
|
|
|
|
@ -68,23 +69,59 @@ public class SaveBatchMoveTaskService extends SPIBaseService implements Extensio
|
|
|
|
|
shopMoveConditionMap = (StrObjMap) checkAndFormatRet.getData().get("shopMoveConditionMap");
|
|
|
|
|
|
|
|
|
|
log.info("shopId " + shopId + " start allocShopProductsByAuthShop");
|
|
|
|
|
StrObjMap shopProducts = allocShopProductsByAuthShop(needMoveShopIds,curProductDetails);
|
|
|
|
|
StrObjMap shopProducts = allocShopProductsByAuthShop(needMoveShopIds, curProductDetails);
|
|
|
|
|
|
|
|
|
|
Ret checkDsValidRet = checkDsValid(needMoveShopIds, shopProducts);
|
|
|
|
|
if (CommonTool.isFailRet(checkDsValidRet)) {
|
|
|
|
|
R.ok(checkDsValidRet);
|
|
|
|
|
}
|
|
|
|
|
// addCollectTask(shopId, "copyType", "name",null);
|
|
|
|
|
|
|
|
|
|
log.info("shopId " + shopId + " start saveTaskByAuthShop");
|
|
|
|
|
Ret saveRet = saveTaskByAuthShop(shopId, copyType, shopMoveConditionMap, shopConditions, shopProducts, shopPreviewCateAttr);
|
|
|
|
|
if (CommonTool.isFailRet(saveRet)) {
|
|
|
|
|
R.ok(saveRet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String shopTaskId = (String)saveRet.getData().get("taskId");
|
|
|
|
|
log.info("shopId "+shopId+" session shopId saveTask success, shopTaskId" + shopTaskId);
|
|
|
|
|
int submitCnt = ((List)shopProducts.get(shopId)).size();
|
|
|
|
|
if (submitCnt == 0) {
|
|
|
|
|
Ret ret = new Ret();
|
|
|
|
|
ret.setResult(CommonConst.FAIL);
|
|
|
|
|
ret.setReason("提交商品数为0,请检查是否正常提交商品");
|
|
|
|
|
StrObjMap retData = new StrObjMap();
|
|
|
|
|
retData.put("taskId",shopTaskId);
|
|
|
|
|
retData.put("submitCnt",submitCnt);
|
|
|
|
|
ret.setData(retData);
|
|
|
|
|
R.ok(ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if ($_POST['sameType']) {
|
|
|
|
|
// $this->moveService->saveSameProductCopyLog($_POST['sameType'], $_POST['searchSameProductMap'], $shopId, $copyType == MoveConst::collectDsCopy);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// ----结果返回----
|
|
|
|
|
return R.ok();
|
|
|
|
|
Ret ret = new Ret();
|
|
|
|
|
ret.setResult(CommonConst.SUCCESS);
|
|
|
|
|
StrObjMap retData = new StrObjMap();
|
|
|
|
|
retData.put("taskId",shopTaskId);
|
|
|
|
|
retData.put("submitCnt",submitCnt);
|
|
|
|
|
ret.setData(retData);
|
|
|
|
|
return R.ok(ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Ret checkAndFormatData(Long shopId, StrObjMap needMoveShopIds, StrObjMap shopMoveConditionMap, StrObjMap shopPreviewCateAttr, StrObjMap productSimpleDetails, String copyType) {
|
|
|
|
|
productSimpleDetails = getProductSimpleDetails(productSimpleDetails,shopId);
|
|
|
|
|
StrObjMap curProductDetails = (StrObjMap)productSimpleDetails.get(String.valueOf(shopId));
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private StrObjMap getProductSimpleDetails(StrObjMap productSimpleDetails, Long shopId) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private StrObjMap allocShopProductsByAuthShop(StrObjMap needMoveShopIds, StrObjMap curProductDetails) {
|
|
|
|
|
|
|
|
|
|
return needMoveShopIds;
|
|
|
|
@ -94,8 +131,9 @@ public class SaveBatchMoveTaskService extends SPIBaseService implements Extensio
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveTaskByAuthShop() {
|
|
|
|
|
private Ret saveTaskByAuthShop(Long shopId, String copyType, StrObjMap shopMoveConditionMap, StrObjMap shopConditions, StrObjMap shopProducts, StrObjMap shopPreviewCateAttr) {
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// private Map<String, Object> saveTaskByAuthShop(int shopId, String copyType, Map<String, Object> shopMoveConditionMap, Map<String, Object> shopMoveSettingOperateLogMap, Map<String, Object> shopConditions, Map<String, Object> shopProducts, Map<String, Object> shopPreviewCateAttr, String hostname, String operateSource, int isFromLtaoRank) {
|
|
|
|
|