Commit da86f32d by guojuxing

添加导购同步微盟队列任务

parent f56ffbd3
......@@ -130,14 +130,20 @@ public class WmStoreSyncController {
* @param wmMallStoreId 店铺逐渐ID
* @param headStoreId 总店ID
* @param storeIds
 分店IDs
* @param isBranch 是否是添加分店入口场景
* @return com.gic.commons.webapi.reponse.RestResponse


*/
@RequestMapping("sync-head-store")
public RestResponse syncHeadStore(Integer wmMallStoreId, Integer headStoreId, String storeIds) {
public RestResponse syncHeadStore(Integer wmMallStoreId, Integer headStoreId, String storeIds, Boolean isBranch) {
if (!validWmMode(wmMallStoreId)) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(),
"非" + MallModeEnum.SMART_RETAIL.getMsg() + "不能同步门店");
}
if (isBranch == null) {
isBranch = false;
}
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
//查询总店
ServiceResponse<StoreDTO> storeResponse = storeApiService.getStoreById(enterpriseId, headStoreId);
......@@ -161,7 +167,13 @@ public class WmStoreSyncController {
.addWeimobVirtualStore(wmMallStoreId, enterpriseId, weimobPhysicalStoreDTO, subStoreList);
if (wmResult.isSuccess()) {
wmStoreSyncLogApiService.saveWmStoreSyncLog(Arrays.asList(headStoreId), wmMallStoreId, 1, enterpriseId);
//todo 同步导购
//同步导购
List<Integer> storeIdList = new ArrayList<>();
if (isBranch) {
storeIdList.add(headStoreId);
}
storeIdList.addAll(getListByStr(storeIds));
clerkApiService.syncClerkToWeimob(wmMallStoreId, storeIdList, enterpriseId);
return RestResponse.success();
}
return RestResponse.failure(wmResult.getCode(), wmResult.getMessage());
......@@ -273,7 +285,9 @@ public class WmStoreSyncController {
this.wmStoreSyncLogApiService.saveWmStoreSyncLog(wmResult.getResult(),
wmMallStoreId, 2, enterpriseId);
//todo 导购同步
//导购同步 成功部分门店进行导购同步
clerkApiService.syncClerkToWeimob(wmMallStoreId, wmResult.getResult(), enterpriseId);
StringBuilder errorMessageResult = new StringBuilder();
List<StoreDTO> hasSuccessStoreList = getStoreList(errorIds.toString(), true);
hasSuccessStoreList.forEach(e -> errorMessageResult.append(e.getRegionId() + "-" + e.getStoreCode()).append(
......@@ -282,7 +296,8 @@ public class WmStoreSyncController {
} else {
this.wmStoreSyncLogApiService.saveWmStoreSyncLog(storeList.stream().map(e -> e.getStoreId()).collect(Collectors.toList()),
wmMallStoreId, 2, enterpriseId);
//todo 导购同步
//导购同步
clerkApiService.syncClerkToWeimob(wmMallStoreId, getListByStr(storeIds), enterpriseId);
}
return RestResponse.success();
}
......@@ -481,8 +496,9 @@ public class WmStoreSyncController {
//同步过的记录日志,不能再次同步
this.wmStoreSyncLogApiService.saveWmStoreSyncLog(Arrays.asList(storeDTO.getStoreId()),
wmMallStoreId, 2, enterpriseId);
//todo 导购同步
// 导购同步
rMap.put(regionName + "-" + storeCode, "微盟侧已存在");
clerkApiService.syncClerkToWeimob(wmMallStoreId, Arrays.asList(storeDTO.getStoreId()), enterpriseId);
} else {
LOGGER.info("实体门店同步到微盟的参数:{}", JSON.toJSONString(list));
ServiceResponse<List<Integer>> weimobResult = this.weimobStoreSiteService
......@@ -498,7 +514,8 @@ public class WmStoreSyncController {
errorMessage.put(entry.getKey(), entry.getValue());
}
//todo 导购同步
//因为是一条一条处理,所以失败了,就不会有成功的,不用 导购同步逻辑
List<StoreDTO> hasSuccessStoreList = getStoreList(errorIds.toString());
hasSuccessStoreList.forEach(e -> rMap.put(e.getRegionId() + "-" + e.getStoreCode(),
errorMessage.get(storeDTO.getStoreInfoId())));
......@@ -507,7 +524,8 @@ public class WmStoreSyncController {
//同步过的记录日志,不能再次同步
this.wmStoreSyncLogApiService.saveWmStoreSyncLog(Arrays.asList(storeDTO.getStoreId()),
wmMallStoreId, 2, enterpriseId);
//todo 导购同步
// 导购同步
clerkApiService.syncClerkToWeimob(wmMallStoreId, Arrays.asList(storeDTO.getStoreId()), enterpriseId);
}
}
......@@ -552,8 +570,9 @@ public class WmStoreSyncController {
//新增企业侧日志
this.wmStoreSyncLogApiService.saveWmStoreSyncLog(Arrays.asList(headerStoreId), wmMallStoreId, 1, enterpriseId);
}
tempStoreId.add(storeDTO.getStoreInfoId());
//todo 导购同步
tempStoreId.add(storeDTO.getStoreId());
// 导购同步
clerkApiService.syncClerkToWeimob(wmMallStoreId, tempStoreId, enterpriseId);
}
}
}
......@@ -865,4 +884,15 @@ public class WmStoreSyncController {
}
return result;
}
private static List<Integer> getListByStr(String storeIds) {
List<Integer> storeIdList = new ArrayList<>();
if (StringUtils.isNotBlank(storeIds)) {
String[] arr = storeIds.split(",");
for(String s : arr){
storeIdList.add(Integer.parseInt(s));
}
}
return storeIdList;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment