京东外卖

This commit is contained in:
shuo.wang
2025-05-26 15:36:21 +08:00
parent bafd6d31fc
commit 7baf4804ec
9 changed files with 128 additions and 9 deletions

View File

@@ -16,7 +16,8 @@ public enum AuditTypeEnum {
E_LE_ME(12,"饿了么"), E_LE_ME(12,"饿了么"),
MEI_TUAN_WAI_MAI(13,"美团外卖"), MEI_TUAN_WAI_MAI(13,"美团外卖"),
YING_ZHANG_TONG(14,"营帐通"), YING_ZHANG_TONG(14,"营帐通"),
BUILDINFORMATION(15,"建店资料信息") BUILDINFORMATION(15,"建店资料信息"),
JINg_DONG_WAI_MAI(16,"京东外卖"),
; ;
private Integer code; private Integer code;

View File

@@ -86,6 +86,9 @@ public enum MessageEnum {
MESSAGE_57("您有一个门店测量阶段待分配测量员和设计组,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"), MESSAGE_57("您有一个门店测量阶段待分配测量员和设计组,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"),
MESSAGE_58("您有一个门店设计阶段待分配设计师,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"), MESSAGE_58("您有一个门店设计阶段待分配设计师,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"),
MESSAGE_59("您有一个门店设计阶段报价任务待领取,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"), MESSAGE_59("您有一个门店设计阶段报价任务待领取,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"),
MESSAGE_60("您有一个门店已提交京东建店资料,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"),
MESSAGE_61("您有一个门店京东外卖初审已通过,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"),
; ;
private String title; private String title;

View File

@@ -18,7 +18,7 @@ public enum ShopAccountEnum {
KS("快手团购",OpenStatusEnum.OPENSTATUSENUM_1), KS("快手团购",OpenStatusEnum.OPENSTATUSENUM_1),
MT("美团外卖",OpenStatusEnum.OPENSTATUSENUM_1), MT("美团外卖",OpenStatusEnum.OPENSTATUSENUM_1),
ELM("饿了么外卖",OpenStatusEnum.OPENSTATUSENUM_1), ELM("饿了么外卖",OpenStatusEnum.OPENSTATUSENUM_1),
JINGDONG("京东外卖",OpenStatusEnum.OPENSTATUSENUM_1),
; ;

View File

@@ -64,6 +64,9 @@ public enum UserRoleEnum {
OWN_SHOP_OFFICE(480000000L,"自有店财务"), OWN_SHOP_OFFICE(480000000L,"自有店财务"),
BRAND_HEAD(490000000L,"品牌负责人"), BRAND_HEAD(490000000L,"品牌负责人"),
JING_DONG_OPERATIONS_CUSTOMER(500000000L,"京东运营大区客服"),
JING_DONG_HEADQUARTERS_BUILD_CUSTOMER(510000000L,"京东总部建店客服"),
; ;
private Long code; private Long code;

View File

@@ -55,7 +55,7 @@ public class ShopAccountDAO {
} }
int batchInsert(List<ShopAccountDO> list){ public int batchInsert(List<ShopAccountDO> list){
if (CollectionUtils.isEmpty(list)){ if (CollectionUtils.isEmpty(list)){
return CommonConstants.ZERO; return CommonConstants.ZERO;
} }

View File

@@ -31,5 +31,5 @@ public interface DataHandlerServer {
//处理2024年10-12月数据 //处理2024年10-12月数据
Boolean dataHandlerV20241012(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user, Boolean dataHandlerV20241012(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user,
ImportTaskDO task); ImportTaskDO task);
Integer JingDongStageHandler();
} }

View File

@@ -1,14 +1,12 @@
package com.cool.store.service.impl; package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo; import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.*; import com.cool.store.dao.*;
import com.cool.store.dto.*; import com.cool.store.dto.*;
import com.cool.store.entity.*; import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.*;
import com.cool.store.enums.FileTypeEnum;
import com.cool.store.enums.ImportTaskStatusEnum;
import com.cool.store.enums.PosAndOrderEnum;
import com.cool.store.enums.point.ShopStageEnum; import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.point.ShopSubStageEnum; import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum;
@@ -23,6 +21,7 @@ import com.cool.store.utils.poi.DateUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -911,6 +910,56 @@ public class DataHandlerServerImpl implements DataHandlerServer {
return null; return null;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public Integer JingDongStageHandler() {
List<ShopStageInfoDO> subStages = shopStageInfoDAO.getSubStages(ShopSubStageEnum.SHOP_STAGE_19.getShopSubStage());
Set<Long> lineIds = subStages.stream().map(ShopStageInfoDO::getLineId).collect(Collectors.toSet());
List<LineInfoDO> lineInfoDOS = lineInfoDAO.getByLineIds(new ArrayList<>(lineIds));
Map<Long, LineInfoDO> lineMap = lineInfoDOS.stream().collect(Collectors.toMap(LineInfoDO::getId, line -> line));
List<ShopStageInfoDO> initList = new ArrayList<>();
List<ShopAccountDO> initAccountList = new ArrayList<>();
ShopSubStageEnum shopSubStageEnum = ShopSubStageEnum.SHOP_STAGE_25;
for (ShopStageInfoDO shopStageInfoDO : subStages){
LineInfoDO lineInfoDO = lineMap.get(shopStageInfoDO.getLineId());
if (Objects.isNull(lineInfoDO)){
log.info("线索不存在:{}", shopStageInfoDO.getShopId());
continue;
}
if (shopStageInfoDO.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00.getShopSubStageStatus())){
ShopStageInfoDO shopStageInfo = getShopStageInfoDO(shopSubStageEnum, shopStageInfoDO, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00);
initList.add(shopStageInfo);
}
if ( !shopStageInfoDO.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00.getShopSubStageStatus())){
ShopStageInfoDO shopStageInfo = getShopStageInfoDO(shopSubStageEnum, shopStageInfoDO, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_250);
initList.add(shopStageInfo);
}
ShopAccountDO shopAccountDO = new ShopAccountDO();
shopAccountDO.setShopId(shopStageInfoDO.getShopId());
shopAccountDO.setSystemName(ShopAccountEnum.JINGDONG.getSystemName());
shopAccountDO.setBoundPhone(lineInfoDO.getMobile());
shopAccountDO.setStatus(ShopAccountEnum.JINGDONG.getInitStatus().getCode());
initAccountList.add(shopAccountDO);
}
shopAccountDAO.batchInsert(initAccountList);
return shopStageInfoDAO.batchInsert(initList) ;
}
private static @NotNull ShopStageInfoDO getShopStageInfoDO(ShopSubStageEnum shopSubStageEnum, ShopStageInfoDO shopStageInfoDO, ShopSubStageStatusEnum shopSubStageStatus) {
ShopStageEnum shopStageEnum = shopSubStageEnum.getShopStageEnum();
ShopStageInfoDO shopStageInfo = new ShopStageInfoDO();
shopStageInfo.setLineId(shopStageInfoDO.getLineId());
shopStageInfo.setShopId(shopStageInfoDO.getShopId());
shopStageInfo.setShopStage(shopStageEnum.getShopStage());
shopStageInfo.setShopSubStage(shopSubStageEnum.getShopSubStage());
shopStageInfo.setShopSubStageStatus(shopSubStageStatus.getShopSubStageStatus());
shopStageInfo.setRemark(shopSubStageEnum.getShopSubStageName() + CommonConstants.PATH_BAR + shopSubStageStatus.getShopSubStageStatusName());
shopStageInfo.setIsTerminated(Boolean.FALSE);
shopStageInfo.setPlanCompleteTime(null);
return shopStageInfo;
}
private static boolean check(ImportOaOldShopDataDTO dto, List<ImportOaOldShopDataErrorDTO> errorList) { private static boolean check(ImportOaOldShopDataDTO dto, List<ImportOaOldShopDataErrorDTO> errorList) {
if (StringUtil.isBlank(dto.getShopCode())) { if (StringUtil.isBlank(dto.getShopCode())) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO(); ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();

View File

@@ -231,6 +231,30 @@ public class PlatformBuildServiceImpl implements PlatformBuildService {
return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuild); return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuild);
} }
} }
//京东外卖
if (type.equals(PlatformBuildEnum.JING_DONG_WAI_MAI.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_25);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_250.getShopSubStageStatus())
&& !shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_254.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
List<EnterpriseUserDO> elmUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.JING_DONG_OPERATIONS_CUSTOMER, regionId);
List<String> elmUserIds = new ArrayList<>();
if (Objects.nonNull(elmUser)) {
elmUserIds.addAll(elmUser.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
}
commonService.sendQWMessage(elmUserIds,
MessageEnum.MESSAGE_60,
map);
if (Objects.isNull(platformBuildDO)) {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_250, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_251,
elmUser);
} else {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_254, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_251,
elmUser);
return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuild);
}
}
return platformBuildDAO.insertSelective(platformBuild); return platformBuildDAO.insertSelective(platformBuild);
} }
@@ -377,7 +401,11 @@ public class PlatformBuildServiceImpl implements PlatformBuildService {
ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(platformBuildDO.getAuditId()); ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(platformBuildDO.getAuditId());
doSomething(platformBuildResponse, trial, auditInfo); doSomething(platformBuildResponse, trial, auditInfo);
} else { } else if (type.equals(PlatformBuildEnum.JING_DONG_WAI_MAI.getCode())) {
OperationLogDO trial = operationLogDAO.getByCondition(shopId, SHOP_SUB_STAGE_STATUS_251.getShopSubStageStatus());
ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(platformBuildDO.getAuditId());
doSomething(platformBuildResponse, trial, auditInfo);
}else {
ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(platformBuildDO.getAuditId()); ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(platformBuildDO.getAuditId());
if (Objects.nonNull(auditInfo)) { if (Objects.nonNull(auditInfo)) {
if (auditInfo.getResultType().equals(AuditResultTypeEnum.PASS.getCode())) { if (auditInfo.getResultType().equals(AuditResultTypeEnum.PASS.getCode())) {
@@ -494,6 +522,27 @@ public class PlatformBuildServiceImpl implements PlatformBuildService {
} }
return CommonConstants.ONE; return CommonConstants.ONE;
} }
if (type.equals(PlatformBuildEnum.JING_DONG_WAI_MAI.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_25);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_251.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.JINg_DONG_WAI_MAI);
doThing(platformBuildDO, request, shopAuditInfoDO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_251, SHOP_SUB_STAGE_STATUS_253, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_254);
if (request.getResultType().equals(AuditResultTypeEnum.PASS.getCode())) {
List<EnterpriseUserDO> elmUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.JING_DONG_HEADQUARTERS_BUILD_CUSTOMER, regionId);
List<String> elmUserIds = new ArrayList<>();
if (Objects.nonNull(elmUser)) {
elmUserIds.addAll(elmUser.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
}
operationLogService.addOperationLog(shopId, SHOP_SUB_STAGE_STATUS_253, request.getOperateUserId(),
elmUser, OperationTypeEnum.OPERATION_TYPE_1, null, OperationStatusEnum.NOT_PROCESSED);
commonService.sendQWMessage(elmUserIds,
MessageEnum.MESSAGE_61,
map);
}
return CommonConstants.ONE;
}
return 0; return 0;
} }
@@ -519,6 +568,15 @@ public class PlatformBuildServiceImpl implements PlatformBuildService {
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.MEI_TUAN_WAI_MAI); ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.MEI_TUAN_WAI_MAI);
return doThing(platformBuildDO, request, shopAuditInfoDO, shopId, SHOP_SUB_STAGE_STATUS_193, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_195, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_194); return doThing(platformBuildDO, request, shopAuditInfoDO, shopId, SHOP_SUB_STAGE_STATUS_193, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_195, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_194);
} }
if (type.equals(PlatformBuildEnum.JING_DONG_WAI_MAI.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_25);
if (!shopSubStageInfo.getShopSubStageStatus().equals(SHOP_SUB_STAGE_STATUS_253.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.JINg_DONG_WAI_MAI);
return doThing(platformBuildDO, request, shopAuditInfoDO, shopId, SHOP_SUB_STAGE_STATUS_253, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_255, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_254);
}
return 0; return 0;
} }

View File

@@ -123,4 +123,9 @@ public class DataHandlerController {
dataHandlerServer.dataHandlerV20241012(dataMapList, file.getOriginalFilename(), CurrentUserHolder.getUser(), importTaskDO); dataHandlerServer.dataHandlerV20241012(dataMapList, file.getOriginalFilename(), CurrentUserHolder.getUser(), importTaskDO);
return ResponseResult.success(true); return ResponseResult.success(true);
} }
@GetMapping("/JingDongStageHandler")
@ApiOperation("京东阶段处理")
public ResponseResult<Integer> JingDongStageHandler() {
return ResponseResult.success(dataHandlerServer.JingDongStageHandler());
}
} }