Merge branch 'cc_20250516_dataHandler' into 'master'

Cc 20250516 data handler

See merge request hangzhou/java/custom_zxjp!88
This commit is contained in:
苏竹红
2025-05-19 10:33:21 +00:00
6 changed files with 399 additions and 39 deletions

View File

@@ -21,7 +21,7 @@ public enum FileTypeEnum {
IMPORT_OA_OLD_SHOP_DATA_ERROR("OaOldShopDataError", "导入OA旧数据错误列表"),
IMPORT_OA_OLD_SHOP_DATA("importOaOldShopData", "导入OA旧数据"),
ZXJP_OPEN_SHOP_REPORT("zxjpOpenShopReport","正新鸡排开店"),
IMPORT_OA_OLD_SHOP_STAGE_DATA("importOaOldShopStageData", "导入OA旧数据"),
IMPORT_OA_OLD_SHOP_STAGE_DATA("importOaOldShopStageData", "导入OA旧阶段数据"),
IMPORT_OA_OLD_SHOP_STAGE_DATA_ERROR("OaOldShopStageDataError", "导入OA旧数据阶段错误列表"),
;
private String fileType;

View File

@@ -66,6 +66,9 @@ public class AcceptanceInfoDAO {
}
public Integer initAcceptanceInfo(List<Long> shopIds){
if (CollectionUtils.isEmpty(shopIds)){
return CommonConstants.ZERO;
}
return acceptanceInfoMapper.initAcceptanceInfo(shopIds);
}
}

View File

@@ -192,7 +192,7 @@
<foreach collection="list" item="shopId" open="(" close=")" separator=",">
#{shopId}
</foreach>
and system_name in ('火码POS','云流水','新掌柜')
and system_name in ('火码POS','云流水','新掌柜') and status !=5
</update>

View File

@@ -27,4 +27,9 @@ public interface DataHandlerServer {
//装修数据初始化
Boolean decorationDataInit();
//处理2024年10-12月数据
Boolean dataHandlerV20241012(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user,
ImportTaskDO task);
}

View File

@@ -111,6 +111,9 @@ public class DataHandlerServerImpl implements DataHandlerServer {
Map<String, ShopInfoDO> shopInfoByCodeMap = shopInfoList.stream().collect(Collectors.toMap(ShopInfoDO::getShopCode, item -> item));
List<Long> shopIds = shopInfoList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
List<Long> lineIdList = shopInfoList.stream().map(ShopInfoDO::getLineId).collect(Collectors.toList());
//装修验收数据
List<AcceptanceInfoDO> acceptanceInfoDOList = acceptanceInfoDAO.selectByShopIds(shopIds);
Map<Long, AcceptanceInfoDO> acceptanceInfoMap = acceptanceInfoDOList.stream().collect(Collectors.toMap(AcceptanceInfoDO::getShopId, item -> item));
//手机号
Map<Long, String> lineMobileMap = lineInfoDAO.getLineMobileMap(lineIdList);
@@ -160,6 +163,8 @@ public class DataHandlerServerImpl implements DataHandlerServer {
List<Long> fitmentFhopIdList = new ArrayList<>();
//建店阶段完成时间
List<BuildStageDTO> updateBuildStageList = new ArrayList<>();
//装修验收表需要初始化的门店
List<Long> initFitmentShopIdList = new ArrayList<>();
for (ImportOaOldShopDataDTO dto : list) {
if (!check(dto, errorList)) {
continue;
@@ -248,7 +253,7 @@ public class DataHandlerServerImpl implements DataHandlerServer {
signFranchiseDO.setProtectiveDistance((int) Double.parseDouble(dto.getProtectionDistance().trim()));
}
ShopStageInfoDO buildStage = bulidStageMap.get(shopId);
//建店资料完成
//建店资料完成时间
BuildStageDTO buildStageDTO = new BuildStageDTO();
buildStageDTO.setShopId(shopId);
buildStageDTO.setEndTime(dto.getBuildEndTime() + " 00:00:00");
@@ -336,6 +341,10 @@ public class DataHandlerServerImpl implements DataHandlerServer {
posDO.setCreateTime(new Date());
addPosAndOrderInfoList.add(posDO);
}
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoMap.get(shopId);
if (Objects.isNull(acceptanceInfoDO)) {
initFitmentShopIdList.add(shopId);
}
}
shopInfoDAO.updateShopCity(shopInfoList);
pointInfoDAO.updateAddress(pointListByIds);
@@ -346,15 +355,16 @@ public class DataHandlerServerImpl implements DataHandlerServer {
orderSysInfoDAO.batchInsertSpecific(addOrderSysInfoList);
franchiseFeeDAO.updateBill(franchiseFeeByShopIds);
buildInformationDAO.batchInsertSpecific(addBuildList);
if (CollectionUtils.isNotEmpty(updateBuildStageList)) {
List<Long> updateStageShopIds = updateBuildStageList.stream().map(BuildStageDTO::getShopId).collect(Collectors.toList());
//pos阶段完成
shopStageInfoDAO.dataUpdateStatus(updateStageShopIds, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_163);
// 订货阶段 完成
shopStageInfoDAO.dataUpdateStatus(updateStageShopIds, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_173);
//数据处理用平台账号 火马,云流水,新掌柜状态改为已完成
shopAccountDAO.updateStatusDataHandle(updateStageShopIds);
}
//装修表初始化
acceptanceInfoDAO.initAcceptanceInfo(initFitmentShopIdList);
List<Long> updateStageShopIds = updateBuildStageList.stream().map(BuildStageDTO::getShopId).collect(Collectors.toList());
//pos阶段完成
shopStageInfoDAO.dataUpdateStatus(updateStageShopIds, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_163);
// 订货阶段 完成
shopStageInfoDAO.dataUpdateStatus(updateStageShopIds, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_173);
//数据处理用平台账号 火马,云流水,新掌柜状态改为已完成
shopAccountDAO.updateStatusDataHandle(updateStageShopIds);
//表中4月20号后的数据数据录入系统新店装修阶段状态不变更 其他时间的数据状态改为已完成 不包括装修验收
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_863);
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91);
@@ -548,20 +558,359 @@ public class DataHandlerServerImpl implements DataHandlerServer {
List<Long> allShopIds = acceptanceInfoDAO.getAllShopIds();
//需要处理的门店
List<Long> addShopIds = new ArrayList<>();
for (ShopStageInfoDO subStage : subStages){
if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112.getShopSubStageStatus().equals(subStage.getShopSubStageStatus())){
if (!allShopIds.contains(subStage.getShopId())){
for (ShopStageInfoDO subStage : subStages) {
if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112.getShopSubStageStatus().equals(subStage.getShopSubStageStatus())) {
if (!allShopIds.contains(subStage.getShopId())) {
addShopIds.add(subStage.getShopId());
}
}
}
if (CollectionUtils.isEmpty(addShopIds)){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
if (CollectionUtils.isEmpty(addShopIds)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
acceptanceInfoDAO.initAcceptanceInfo(addShopIds);
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean dataHandlerV20241012(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user, ImportTaskDO task) {
List<ImportOaOldShopDataDTO> list = new ArrayList<>();
List<ImportOaOldShopDataErrorDTO> errorList = new ArrayList<>();
ListUtils.emptyIfNull(dataMapList)
.forEach(data -> {
try {
ImportOaOldShopDataDTO dto = buildColumn(data);
list.add(dto);
} catch (Exception e) {
log.info("dataHandlerV20241012 转化dto error:{}", JSONObject.toJSONString(data));
}
});
log.info("导入数据条数:{}", list.size());
if (CollectionUtils.isEmpty(list)) {
log.info("导入数据转化为空");
return false;
}
List<String> shopCodeList = list.stream().map(ImportOaOldShopDataDTO::getShopCode).collect(Collectors.toList());
Map<String, ImportOaOldShopDataDTO> dotMap = list.stream().collect(Collectors.toMap(ImportOaOldShopDataDTO::getShopCode, item -> item));
List<ShopInfoDO> shopInfoList = shopInfoDAO.selectByShopCodeList(shopCodeList);
if (CollectionUtils.isEmpty(shopInfoList)) {
log.info("导入数据根据shopCode 未找到数据");
}
Map<String, ShopInfoDO> shopInfoByCodeMap = shopInfoList.stream().collect(Collectors.toMap(ShopInfoDO::getShopCode, item -> item));
List<Long> shopIds = shopInfoList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
List<Long> lineIdList = shopInfoList.stream().map(ShopInfoDO::getLineId).collect(Collectors.toList());
//装修验收数据
List<AcceptanceInfoDO> acceptanceInfoDOList = acceptanceInfoDAO.selectByShopIds(shopIds);
Map<Long, AcceptanceInfoDO> acceptanceInfoMap = acceptanceInfoDOList.stream().collect(Collectors.toMap(AcceptanceInfoDO::getShopId, item -> item));
//手机号
Map<Long, String> lineMobileMap = lineInfoDAO.getLineMobileMap(lineIdList);
//铺位列表
List<Long> pointIds = shopInfoList.stream().map(ShopInfoDO::getPointId).filter(Objects::nonNull).collect(Collectors.toList());
List<PointInfoDO> pointListByIds = pointInfoDAO.getPointListByIds(pointIds);
Map<Long, PointInfoDO> pointMap = pointListByIds.stream().collect(Collectors.toMap(PointInfoDO::getId, Function.identity()));
//铺位详情
List<PointDetailInfoDO> pointDetailInfoDOList = pointDetailInfoDAO.getByPointIdList(pointIds);
Map<Long, PointDetailInfoDO> pointDetailMap = pointDetailInfoDOList.stream().collect(Collectors.toMap(PointDetailInfoDO::getPointId, Function.identity()));
//合同列表
List<SignFranchiseDO> signFranchiseDOS = signFranchiseMapper.selectAllByShopIds(shopIds);
Map<Long, SignFranchiseDO> signFranchiseMap = signFranchiseDOS.stream().collect(Collectors.toMap(SignFranchiseDO::getShopId, Function.identity()));
//订货信息和总部订货收款账户表
List<OrderSysInfoDO> orderSysInfoDOS = orderSysInfoDAO.selectByShopIdList(shopIds);
Map<Long, OrderSysInfoDO> orderSysInfoMap = orderSysInfoDOS.stream().collect(Collectors.toMap(OrderSysInfoDO::getShopId, Function.identity()));
//合同阶段
List<ShopStageInfoDO> signFranchiseStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
Map<Long, ShopStageInfoDO> signFranchiseStageMap = signFranchiseStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
//建店资料收集阶段
List<ShopStageInfoDO> bulidStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage());
Map<Long, ShopStageInfoDO> bulidStageMap = bulidStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
//加盟费阶段
List<ShopStageInfoDO> franchiseFeeStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage());
Map<Long, ShopStageInfoDO> franchiseFeeStageMap = franchiseFeeStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
//加盟费账单
List<FranchiseFeeDO> franchiseFeeByShopIds = franchiseFeeMapper.getFranchiseFeeByShopIds(shopIds);
Map<Long, FranchiseFeeDO> franchiseFeeMap = franchiseFeeByShopIds.stream().collect(Collectors.toMap(FranchiseFeeDO::getShopId, Function.identity()));
//建店资料
List<BuildInformationDO> buildInformationDOList = buildInformationDAO.getSpecificByShopIdList(shopIds);
Map<Long, BuildInformationDO> buildInformationMap = buildInformationDOList.stream().collect(Collectors.toMap(BuildInformationDO::getShopId, Function.identity()));
//初始化建店资料
List<Long> addBuildList = new ArrayList<>();
//初始化订货信息和总部订货收款账户表
List<OrderSysInfoDO> addOrderSysInfoList = new ArrayList<>();
//报货仓库
List<WarehouseInfoDO> warehouseInfoMapperAll = warehouseInfoMapper.getAll();
Map<String, String> warehouseInfoMap = warehouseInfoMapperAll.stream().collect(Collectors.toMap(WarehouseInfoDO::getWarehouseName, WarehouseInfoDO::getWarehouseCode));
//订货系统
List<PosAndOrderInfoDO> orderSysInfoDOList = posAndOrderInfoDAO.selectListByShopIdAndType(shopIds, PosAndOrderEnum.ORDER.getCode());
Map<Long, PosAndOrderInfoDO> orderSysInfoDOMap = orderSysInfoDOList.stream().collect(Collectors.toMap(PosAndOrderInfoDO::getShopId, Function.identity()));
List<PosAndOrderInfoDO> addPosAndOrderInfoList = new ArrayList<>();
//pos系统
List<PosAndOrderInfoDO> posSysInfoDOList = posAndOrderInfoDAO.selectListByShopIdAndType(shopIds, PosAndOrderEnum.POS.getCode());
Map<Long, PosAndOrderInfoDO> posSysInfoDOMap = posSysInfoDOList.stream().collect(Collectors.toMap(PosAndOrderInfoDO::getShopId, Function.identity()));
//新发系统
List<PosAndOrderInfoDO> xfSysDOList = posAndOrderInfoDAO.selectListByShopIdAndType(shopIds, PosAndOrderEnum.XIN_FA_SYS.getCode());
Map<Long, PosAndOrderInfoDO> xfSysInfoDOMap = xfSysDOList.stream().collect(Collectors.toMap(PosAndOrderInfoDO::getShopId, Function.identity()));
//营帐通系统
List<PosAndOrderInfoDO> tentPassInfoDOList = posAndOrderInfoDAO.selectListByShopIdAndType(shopIds, PosAndOrderEnum.TENT_PASS.getCode());
Map<Long, PosAndOrderInfoDO> tentPassInfoDOMap = tentPassInfoDOList.stream().collect(Collectors.toMap(PosAndOrderInfoDO::getShopId, Function.identity()));
//装修阶段需要变更的shopId
List<Long> fitmentFhopIdList = new ArrayList<>();
//建店阶段完成时间
List<BuildStageDTO> updateBuildStageList = new ArrayList<>();
//装修验收表需要初始化的门店
List<Long> initFitmentShopIdList = new ArrayList<>();
for (ImportOaOldShopDataDTO dto : list) {
if (!check(dto, errorList)) {
continue;
}
ShopInfoDO shopInfoDO = shopInfoByCodeMap.get(dto.getShopCode().trim());
if (Objects.isNull(shopInfoDO)) {
log.info("门店不存在,门店编码:{}", dto.getShopCode());
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
errorDTO.setErrorReason("门店编码不存在");
errorList.add(errorDTO);
continue;
}
Long shopId = shopInfoDO.getId();
ShopStageInfoDO franchiseFeeStage = franchiseFeeStageMap.get(shopId);
if (!franchiseFeeStage.getIsTerminated()) {
log.info("门店未完成加盟费阶段,门店编码:{}", dto.getShopCode());
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
errorDTO.setErrorReason("门店未完成加盟费阶段");
errorList.add(errorDTO);
continue;
}
ShopStageInfoDO signStage = signFranchiseStageMap.get(shopId);
if (!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84.getShopSubStageStatus().equals(signStage.getShopSubStageStatus())) {
log.info("门店未完成合同签约,门店编码:{}", dto.getShopCode());
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
errorDTO.setErrorReason("门店未完成合同签约");
errorList.add(errorDTO);
continue;
}
Date buildEndTime = DateUtils.toDate(YYYY_MM_DD, dto.getBuildEndTime());
if (Objects.isNull(buildEndTime)) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
errorDTO.setErrorReason("建店资料时间转化失败");
errorList.add(errorDTO);
continue;
}
//合同
SignFranchiseDO signFranchiseDO = signFranchiseMap.get(shopId);
if (signFranchiseDO == null) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
errorDTO.setErrorReason("合同DO不存在");
errorList.add(errorDTO);
continue;
}
FranchiseFeeDO franchiseFeeDO = franchiseFeeMap.get(shopId);
if (franchiseFeeDO == null) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
errorDTO.setErrorReason("加盟费DO不存在");
errorList.add(errorDTO);
continue;
}
if (StringUtil.isNotBlank(dto.getPartnershipSignatorySecond())) {
signFranchiseDO.setPartnershipSignatorySecond(dto.getPartnershipSignatorySecond().trim());
}
if (StringUtil.isNotBlank(dto.getPartnershipSignatorySecondMobile())) {
signFranchiseDO.setPartnershipSignatorySecondMobile(dto.getPartnershipSignatorySecondMobile().trim());
}
if (StringUtil.isNotBlank(dto.getPartnershipSignatorySecondIdNumber())) {
signFranchiseDO.setPartnershipSignatorySecondIdNumber(dto.getPartnershipSignatorySecondIdNumber());
}
if (StringUtil.isNotBlank(dto.getContractStartDate())) {
signFranchiseDO.setContractStartTime(DateUtils.toDate(YYYY_MM_DD, dto.getContractStartDate().trim()));
}
if (StringUtil.isNotBlank(dto.getContractEndDate())) {
signFranchiseDO.setContractEndTime(DateUtils.toDate(YYYY_MM_DD, dto.getContractEndDate().trim()));
}
if ((StringUtil.isNotBlank(dto.getIntroducer()) && !"0".equals(dto.getIntroducer()))) {
signFranchiseDO.setIntroducer(dto.getIntroducer());
}
if (StringUtil.isNotBlank(dto.getIntroduceStore()) && !"0".equals(dto.getIntroduceStore())) {
signFranchiseDO.setIntroduceStore(dto.getIntroduceStore());
}
if (StringUtil.isNotBlank(dto.getIntroductionAward())) {
signFranchiseDO.setIntroductionAward(dto.getIntroductionAward());
}
if (StringUtil.isNotBlank(dto.getContractCode()) && dto.getContractCode().trim().startsWith("ZX") && !"0".equals(dto.getContractCode().trim())) {
signFranchiseDO.setContractCode(dto.getContractCode().trim());
}
if (StringUtil.isNotBlank(dto.getProtectionDistance())) {
signFranchiseDO.setProtectiveDistance((int) Double.parseDouble(dto.getProtectionDistance().trim()));
}
ShopStageInfoDO buildStage = bulidStageMap.get(shopId);
//建店资料未完成
BuildStageDTO buildStageDTO = new BuildStageDTO();
buildStageDTO.setShopId(shopId);
buildStageDTO.setEndTime(dto.getBuildEndTime() + " 00:00:00");
updateBuildStageList.add(buildStageDTO);
//建店资料阶段处理
shopStageInfoDAO.dataUpdateShopStageInfo(Collections.singletonList(buildStageDTO), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_156);
if (!ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_156.getShopSubStageStatus().equals(buildStage.getShopSubStageStatus())) {
//初始化数据
preparationService.licenseCompleted(shopId);
preparationService.sysStoreCompleted(shopId);
preparationService.buildStoreAndDecorationComplete(shopId);
preparationService.selectSiteAndBuildStoreComplete(shopId);
preparationService.buildStoreComplete(shopId);
}
fitmentFhopIdList.add(shopId);
BuildInformationDO buildInformationDO = buildInformationMap.get(shopId);
if (Objects.isNull(buildInformationDO)) {
addBuildList.add(shopId);
}
OrderSysInfoDO orderSysInfoDO = orderSysInfoMap.get(shopId);
//报货物流仓库
String warehouseCode = warehouseInfoMap.get(dto.getDeclareGoodsLogisticsWarehouseName().trim());
if (Objects.isNull(orderSysInfoDO)) {
orderSysInfoDO = new OrderSysInfoDO();
orderSysInfoDO.setShopId(shopId);
orderSysInfoDO.setOrderCreateTime(new Date());
orderSysInfoDO.setReceivingCreateTime(new Date());
setOrderInfo(dto, orderSysInfoDO, warehouseCode);
addOrderSysInfoList.add(orderSysInfoDO);
} else {
setOrderInfo(dto, orderSysInfoDO, warehouseCode);
}
//shopInfo
shopInfoDO.setShopName(dto.getShopName().trim());
shopInfoDO.setProvince(dto.getProvince().trim());
shopInfoDO.setCity(dto.getCity().trim());
shopInfoDO.setDistrict(dto.getDistrict().trim());
shopInfoDO.setDetailAddress(dto.getShopAddress().trim());
//point
PointInfoDO pointInfoDO = pointMap.get(shopInfoDO.getPointId());
if (pointInfoDO != null) {
pointInfoDO.setProvince(dto.getProvince().trim());
pointInfoDO.setCity(dto.getCity().trim());
pointInfoDO.setDistrict(dto.getDistrict().trim());
pointInfoDO.setAddress(dto.getShopAddress().trim());
pointInfoDO.setPointArea(dto.getPointArea().trim());
}
PointDetailInfoDO pointDetailInfoDO = pointDetailMap.get(shopInfoDO.getPointId());
if (pointDetailInfoDO != null) {
if (StringUtil.isNotBlank(dto.getMonthRent())) {
pointDetailInfoDO.setMonthRent(dto.getMonthRent().trim());
}
}
// 更新加盟费账单
franchiseFeeDO.setYearFranchiseFee(dto.getYearFranchiseFee().trim());
franchiseFeeDO.setLoanMargin(dto.getLoanMargin().trim());
franchiseFeeDO.setFirstYearFee(dto.getFirstYearFee().trim());
franchiseFeeDO.setFirstYearManageFee(dto.getFirstYearManageFee().trim());
franchiseFeeDO.setPerformanceBond(dto.getPerformanceBond().trim());
franchiseFeeDO.setDiscountReason(dto.getDiscountReason().trim());
//订货系统
PosAndOrderInfoDO order = orderSysInfoDOMap.get(shopId);
if (StringUtil.isNotBlank(dto.getYlsAccount())) {
if (Objects.isNull(order)) {
order = new PosAndOrderInfoDO();
order.setShopId(shopId);
order.setType(PosAndOrderEnum.ORDER.getCode());
order.setRemark("已为您开通订货系统账号和密码密码已加密初始密码为888888可通过加盟小程序修改密码");
order.setAccount(dto.getYlsAccount().trim());
order.setPassword("888888");
order.setCreateTime(new Date());
addPosAndOrderInfoList.add(order);
}
}
//pos
PosAndOrderInfoDO posDO = posSysInfoDOMap.get(shopId);
if (Objects.isNull(posDO)) {
posDO = new PosAndOrderInfoDO();
posDO.setShopId(shopId);
posDO.setType(PosAndOrderEnum.POS.getCode());
posDO.setAccount(lineMobileMap.getOrDefault(shopInfoDO.getLineId(), ""));
posDO.setRemark("已为您开通POS系统账号和密码");
posDO.setCreateTime(new Date());
addPosAndOrderInfoList.add(posDO);
}
//xf
PosAndOrderInfoDO xf = xfSysInfoDOMap.get(shopId);
if (Objects.isNull(xf)) {
order = new PosAndOrderInfoDO();
order.setShopId(shopId);
order.setType(PosAndOrderEnum.XIN_FA_SYS.getCode());
order.setRemark("已为您开通信发系统账号和授权码请妥善保管");
order.setAccount(dto.getShopCode().trim());
order.setCreateTime(new Date());
addPosAndOrderInfoList.add(order);
}
//营帐通
PosAndOrderInfoDO yzt = tentPassInfoDOMap.get(shopId);
if (Objects.isNull(yzt)) {
order = new PosAndOrderInfoDO();
order.setShopId(shopId);
order.setType(PosAndOrderEnum.TENT_PASS.getCode());
order.setRemark("已为您开通营帐通");
order.setCreateTime(new Date());
addPosAndOrderInfoList.add(order);
}
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoMap.get(shopId);
if (Objects.isNull(acceptanceInfoDO)) {
initFitmentShopIdList.add(shopId);
}
}
shopInfoDAO.updateShopCity(shopInfoList);
pointInfoDAO.updateAddress(pointListByIds);
pointDetailInfoDAO.updateMonthRent(pointDetailInfoDOList);
signFranchiseDAO.updateSpecific(signFranchiseDOS);
posAndOrderInfoDAO.batchInsert(addPosAndOrderInfoList);
orderSysInfoDAO.batchUpdateSpecific(orderSysInfoDOS);
orderSysInfoDAO.batchInsertSpecific(addOrderSysInfoList);
franchiseFeeDAO.updateBill(franchiseFeeByShopIds);
buildInformationDAO.batchInsertSpecific(addBuildList);
List<Long> updateStageShopIds = updateBuildStageList.stream().map(BuildStageDTO::getShopId).collect(Collectors.toList());
//pos阶段完成
shopStageInfoDAO.dataUpdateStatus(updateStageShopIds, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_163);
//xf
shopStageInfoDAO.dataUpdateStatus(updateStageShopIds, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_235);
//yzt
shopStageInfoDAO.dataUpdateStatus(updateStageShopIds, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_245);
// 订货阶段 完成
shopStageInfoDAO.dataUpdateStatus(updateStageShopIds, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_173);
//数据处理用平台账号 火马,云流水,新掌柜状态改为已完成
shopAccountDAO.updateStatusDataHandle(updateStageShopIds);
//装修stage
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_863);
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91);
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112);
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_123);
//train
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_51);
//openPlan
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_143);
//装修表初始化
acceptanceInfoDAO.initAcceptanceInfo(initFitmentShopIdList);
if (!errorList.isEmpty()) {
task.setStatus(ImportTaskStatusEnum.ERROR.getCode());
String url = null;
try {
url = easyExcelUtil.exportExcel(ImportOaOldShopDataErrorDTO.class, errorList, null,
FileTypeEnum.IMPORT_OA_OLD_SHOP_DATA_ERROR.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()),
FileTypeEnum.IMPORT_OA_OLD_SHOP_DATA_ERROR.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()));
} catch (Exception e) {
log.info("导出失败列表失败 errorList:{}", JSONObject.toJSONString(errorList));
}
task.setFileUrl(url);
} else {
task.setStatus(ImportTaskStatusEnum.SUCCESS.getCode());
}
task.setTotalNum(dataMapList.size());
task.setSuccessNum(dataMapList.size() - errorList.size());
importTaskMapper.update(eid, task);
return null;
}
private static boolean check(ImportOaOldShopDataDTO dto, List<ImportOaOldShopDataErrorDTO> errorList) {
if (StringUtil.isBlank(dto.getShopCode())) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
@@ -612,20 +961,6 @@ public class DataHandlerServerImpl implements DataHandlerServer {
errorList.add(errorDTO);
return false;
}
if (StringUtil.isBlank(dto.getMonthRent())) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
errorDTO.setErrorReason("租金不能为空");
errorList.add(errorDTO);
return false;
}
if (StringUtil.isBlank(dto.getPointArea())) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
errorDTO.setErrorReason("场地实际面积不能为空");
errorList.add(errorDTO);
return false;
}
if (StringUtil.isBlank(dto.getContractStartDate())) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
@@ -675,13 +1010,6 @@ public class DataHandlerServerImpl implements DataHandlerServer {
errorList.add(errorDTO);
return false;
}
if (StringUtil.isBlank(dto.getDiscountReason())) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());
errorDTO.setErrorReason("加盟费优惠原因不能为空");
errorList.add(errorDTO);
return false;
}
if (StringUtil.isBlank(dto.getDeclareGoodsLogisticsWarehouseName())) {
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
errorDTO.setShopCode(dto.getShopCode());

View File

@@ -69,7 +69,7 @@ public class DataHandlerController {
@PostMapping("/dataStageHandler")
@ApiOperation("阶段处理")
public ResponseResult<Boolean> importOaOldShopData(MultipartFile file, @RequestParam("flag") Boolean flag) {
public ResponseResult<Boolean> dataStageHandler(MultipartFile file, @RequestParam("flag") Boolean flag) {
ExcelReader reader = null;
try {
reader = ExcelUtil.getReader(file.getInputStream());
@@ -99,4 +99,28 @@ public class DataHandlerController {
dataHandlerServer.decorationDataInit();
return ResponseResult.success(true);
}
@PostMapping("/dataHandlerV20241012")
@ApiOperation("导入OA202410-12旧数据")
public ResponseResult<Boolean> dataHandlerV20241012(MultipartFile file) {
ExcelReader reader = null;
try {
reader = ExcelUtil.getReader(file.getInputStream());
} catch (IOException e) {
log.error("read file error:", e);
}
assert reader != null;
List<Map<String, Object>> dataMapList = reader.read(0, 1, Integer.MAX_VALUE);
ImportTaskDO importTaskDO = new ImportTaskDO();
importTaskDO.setFileName(file.getOriginalFilename());
importTaskDO.setFileType(FileTypeEnum.IMPORT_OA_OLD_SHOP_DATA.getFileType());
importTaskDO.setIsImport(true);
importTaskDO.setStatus(ImportTaskStatusEnum.PROGRESS.getCode());
importTaskDO.setCreateUserId(CurrentUserHolder.getUserId());
importTaskDO.setCreateName(CurrentUserHolder.getUser().getName());
importTaskDO.setCreateTime(System.currentTimeMillis());
importTaskMapper.insert(eid, importTaskDO);
dataHandlerServer.dataHandlerV20241012(dataMapList, file.getOriginalFilename(), CurrentUserHolder.getUser(), importTaskDO);
return ResponseResult.success(true);
}
}