Merge #17 into master from cc_20251218_opening

Merge branch 'master' into cc_20251218_opening

* cc_20251218_opening: (11 commits squashed)

  - fix:信发查询bug

  - fix:信发查询bug

  - fix:测试

  - fix:老店新开不需要开业验收

  - feat:开业验收数据处理

  - fix:开业验收bug修复

  - fix:开业验收bug修复

  - fix:云流水权限开通

  - feat:开业验收数据处理

  - feat:开业验收数据处理

  - Merge branch 'master' into cc_20251218_opening

Signed-off-by: 苏竹红 <570057076@qq.com>
Merged-by: 苏竹红 <570057076@qq.com>

CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/17
This commit is contained in:
2025-12-25 10:50:38 +00:00
parent 32ae1b7315
commit e97c147fac
31 changed files with 824 additions and 13 deletions

View File

@@ -90,4 +90,11 @@ public interface DataHandlerServer {
*/
void dataHandlerPushHqt();
/**
* 开业验收
* 数据处理 每个门店新增开业验收
* @return
*/
Boolean openingAcceptanceDataHandle();
}

View File

@@ -171,6 +171,12 @@ public interface DeskService {
*/
PageInfo<PreparationCommonPendingVO> buildInformationPendingList(DeskRequest deskRequest, LoginUserInfo user );
/**
* 开业验收
*/
PageInfo<PreparationCommonPendingVO> openingAcceptance(DeskRequest deskRequest, LoginUserInfo user );
/**
* 测量阶段

View File

@@ -18,5 +18,12 @@ public interface PosAndOrderInfoService {
PosAndOrderResponse get(Long shopId, Integer type);
/**
* 云流水权限开通
* @param shopId
* @return
*/
Boolean openYlsAuth(Long shopId);
Boolean skip(Long shopId, Integer type);
}

View File

@@ -1275,6 +1275,59 @@ public class DataHandlerServerImpl implements DataHandlerServer {
}
}
}
@Override
public Boolean openingAcceptanceDataHandle() {
Integer pageSize = 100;
Integer pageNum = 1;
// 方式1使用while循环获取所有页数据
boolean hasNextPage = true;
while (hasNextPage) {
// 开启分页
PageHelper.startPage(pageNum, pageSize);
// 执行查询
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectByIdOrSelectAll(null);
// 处理当前页数据
if (CollectionUtils.isNotEmpty(shopInfoDOS)) {
for (ShopInfoDO shopInfoDO : shopInfoDOS) {
//查询装修阶段 是否完成 完成=开业阶段完成 未完成=开业阶段未开始
ShopStageInfoDO stage = shopStageInfoDAO.getByShopIdAndSubStage(shopInfoDO.getId(), ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage());
if (stage == null) {
log.info("装修阶段数据不存在 shopId:{}",shopInfoDO.getId());
continue;
}
ShopStageInfoDO stage27 = shopStageInfoDAO.getByShopIdAndSubStage(shopInfoDO.getId(), ShopSubStageEnum.SHOP_STAGE_27.getShopSubStage());
if (stage27 == null) {
ShopStageInfoDO shopStageInfo = null;
if (stage.getIsTerminated()){
shopStageInfo = getShopStageInfoDO(ShopSubStageEnum.SHOP_STAGE_27, stage, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_276);
}else {
shopStageInfo = getShopStageInfoDO(ShopSubStageEnum.SHOP_STAGE_27, stage, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00);
}
shopStageInfoDAO.batchInsert(Arrays.asList(shopStageInfo));
}
}
// 判断是否还有下一页
if (shopInfoDOS.size() < pageSize) {
hasNextPage = false; // 当前页数据不足一页,说明是最后一页
} else {
pageNum++; // 继续查询下一页
}
} else {
hasNextPage = false; // 没有数据,结束循环
}
// 清除分页参数(重要!防止影响其他查询)
PageHelper.clearPage();
}
return Boolean.TRUE;
}
public HqtBuildRequest getHqtBuildRequest(Long shopId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfo.getLineId());

View File

@@ -280,7 +280,7 @@ public class DecorationDesignInfoServiceImpl implements DecorationDesignInfoServ
acceptanceInfoDAO.updateAcceptanceInfo(acceptanceInfoDO);
}
if (shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_122.getShopSubStageStatus())) {
shopStageInfoDAO.updateShopStageInfo(shopInfoDO.getId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_123);
shopStageInfoDAO.batchUpdateShopStageStatus(shopInfoDO.getId(),Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_123,ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_270));
preparationService.buildStoreAndDecorationComplete(shopInfoDO.getId());
}
// 覆盖建店资料中的门头照和内景照

View File

@@ -849,7 +849,7 @@ public class DecorationServiceImpl implements DecorationService {
if (CommonConstants.ONE == request.getOperationsAcceptance().getResult()
&& CommonConstants.ONE == partner.getResult()) {
//更新阶段状态验收完毕
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_123, null);
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(),Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_123,ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_270));
preparationService.updateShopStatus(request.getShopId());
preparationService.buildStoreAndDecorationComplete(request.getShopId());
} else {

View File

@@ -345,9 +345,16 @@ public class DeskServiceImpl implements DeskService {
@Override
public PageInfo<PreparationCommonPendingVO> orderSysPendingList(DeskRequest deskRequest, LoginUserInfo user) {
List<Long> userRoleIds = enterpriseUserRoleMapper.getUserRoleIds(user.getUserId());
//订单组 只查询待授权的数据
if (userRoleIds.contains(UserRoleEnum.ORDER_GROUP.getCode())) {
//只查管辖的待授权的数据
return commonPendingVOPageInfo(deskRequest, null, ShopSubStageEnum.SHOP_STAGE_17,
Collections.singletonList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_172.getShopSubStageStatus()), Boolean.TRUE);
}
//其他角色能看到
return commonPendingVOPageInfo(deskRequest, null, ShopSubStageEnum.SHOP_STAGE_17,
Collections.singletonList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_170.getShopSubStageStatus()), Boolean.FALSE);
}
@Override
@@ -532,6 +539,22 @@ public class DeskServiceImpl implements DeskService {
return commonPendingVOPage(deskRequest, isAdmin ? null : user, ShopSubStageEnum.SHOP_STAGE_15, subStageStatusList, isAdmin ? Boolean.FALSE : Boolean.TRUE, ownShopFlag);
}
@Override
public PageInfo<PreparationCommonPendingVO> openingAcceptance(DeskRequest deskRequest, LoginUserInfo user) {
List<Long> userRoleIds = enterpriseUserRoleMapper.getUserRoleIds(user.getUserId());
//如果是督导
List<Integer> stageList = new ArrayList<>();
Boolean flag = Boolean.FALSE;
if (userRoleIds.contains(UserRoleEnum.QW_SUPERVISION.getCode()) || userRoleIds.contains(UserRoleEnum.SUPERVISION.getCode())) {
stageList.addAll(Arrays.asList(SHOP_SUB_STAGE_STATUS_270.getShopSubStageStatus(),SHOP_SUB_STAGE_STATUS_274.getShopSubStageStatus()));
}
if (userRoleIds.contains(UserRoleEnum.OPERATION_GENERAL_CONSULTANT.getCode()) ) {
stageList.add(SHOP_SUB_STAGE_STATUS_272.getShopSubStageStatus());
flag = Boolean.TRUE;
}
return commonPendingVOPageInfo(deskRequest, user, ShopSubStageEnum.SHOP_STAGE_27, stageList, flag);
}
@Override
public PageInfo<PreparationCommonPendingVO> measurePendingList(DeskRequest deskRequest, LoginUserInfo user) {
List<Long> userRoleIds = enterpriseUserRoleMapper.getUserRoleIds(user.getUserId());

View File

@@ -58,7 +58,15 @@ public class PosAndOrderInfoServiceImpl implements PosAndOrderInfoService {
if (request.getType().equals(PosAndOrderEnum.POS.getCode())) {
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_163);
} else if (request.getType().equals(PosAndOrderEnum.ORDER.getCode())) {
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_173);
//校验培训是否完成 培训完成 账号->待授权 培训没完成 ->等待培训中
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(request.getShopId(), ShopSubStageEnum.SHOP_STAGE_5);
ShopSubStageStatusEnum subStageStatus = null;
if (shopSubStageInfo.getIsTerminated()){
subStageStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_172;
}else {
subStageStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_171;
}
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), subStageStatus);
} else if (request.getType().equals(PosAndOrderEnum.XIN_FA_SYS.getCode())) {
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_235);
} else if (request.getType().equals(PosAndOrderEnum.TENT_PASS.getCode())) {
@@ -98,6 +106,12 @@ public class PosAndOrderInfoServiceImpl implements PosAndOrderInfoService {
return response;
}
@Override
public Boolean openYlsAuth(Long shopId) {
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_173);
return Boolean.TRUE;
}
@Override
public Boolean skip(Long shopId, Integer type) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_24);

View File

@@ -822,6 +822,9 @@ public class ShopServiceImpl implements ShopService {
case SHOP_SUB_STAGE_STATUS_140:
case SHOP_SUB_STAGE_STATUS_141:
case SHOP_SUB_STAGE_STATUS_142:
case SHOP_SUB_STAGE_STATUS_171:
case SHOP_SUB_STAGE_STATUS_270:
case SHOP_SUB_STAGE_STATUS_274:
return getUserFromInvestmentManager(shopInfo.getInvestmentManager());
case SHOP_SUB_STAGE_STATUS_122:
case SHOP_SUB_STAGE_STATUS_110:
@@ -907,7 +910,10 @@ public class ShopServiceImpl implements ShopService {
return getUsersByRoleAndRegion(UserRoleEnum.JING_DONG_OPERATIONS_CUSTOMER, shopInfo.getRegionId());
case SHOP_SUB_STAGE_STATUS_253:
return getUsersByRoleAndRegion(UserRoleEnum.JING_DONG_HEADQUARTERS_BUILD_CUSTOMER, shopInfo.getRegionId());
case SHOP_SUB_STAGE_STATUS_272:
return getUsersByRoleAndRegion(OPERATION_GENERAL_CONSULTANT, shopInfo.getRegionId());
case SHOP_SUB_STAGE_STATUS_172:
return getUsersByRoleAndRegion(ORDER_GROUP, shopInfo.getRegionId());
default:
return Collections.emptyList();
}

View File

@@ -484,7 +484,8 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
if (shopInfoDO.getShopDecorationAttributes().equals(ShopDecorationAttributesEnum.OLD_NEW_OPEN.getCode())) {
//老店新开时装修与开业直接完成
shopStageInfoDAO.batchUpdateByShopIdsAndSubStageStatus(Arrays.asList(shopId), Arrays.asList(
SHOP_SUB_STAGE_STATUS_863, SHOP_SUB_STAGE_STATUS_91, SHOP_SUB_STAGE_STATUS_112, SHOP_SUB_STAGE_STATUS_123, SHOP_SUB_STAGE_STATUS_143
SHOP_SUB_STAGE_STATUS_863, SHOP_SUB_STAGE_STATUS_91, SHOP_SUB_STAGE_STATUS_112, SHOP_SUB_STAGE_STATUS_123, SHOP_SUB_STAGE_STATUS_143,
SHOP_SUB_STAGE_STATUS_276
));
}else{
//,加盟公司自有店->加盟公司建店 不推送数据 再crm中完成

View File

@@ -197,14 +197,21 @@ public class TempUserDetailServiceImpl implements TempUserDetailService {
@Override
public void registrationCompleted(Long shopId) {
ShopStageInfoDO shopStageInfoDO = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_5);
if (shopStageInfoDO == null) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
if (!shopStageInfoDO.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_50.getShopSubStageStatus())){
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
if(shopStageInfoDO != null){
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_51);
//状态结束
preparationService.whetherToOpenForAcceptance(shopId);
preparationService.updateShopStatus(shopId);
//不能放到下面
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_51);
//状态结束
preparationService.whetherToOpenForAcceptance(shopId);
preparationService.updateShopStatus(shopId);
//培训完成,将订货状态为等待培训中的切为待授权
ShopStageInfoDO shopStage = shopStageInfoDAO.getByShopIdAndSubStage(shopId, ShopSubStageEnum.SHOP_STAGE_17.getShopSubStage());
if (shopStage!=null&&shopStage.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_171.getShopSubStageStatus())){
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_172);
}
}

View File

@@ -0,0 +1,42 @@
package com.cool.store.service.opening;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.AuditApproveRequest;
import com.cool.store.request.opening.OpeningAcceptanceRequest;
import com.cool.store.vo.opening.OpeningAcceptanceDetailVO;
/**
* @Auther zx_szh
* @Date 2025/12/22 09:28
* @Version 1.0
*/
public interface OpeningAcceptanceService {
/**
* 提交门店验收
* @param request
* @return
*/
Boolean addOpeningAcceptance(OpeningAcceptanceRequest request, LoginUserInfo user);
/**
* 验收详情
* @param shopId
* @return
*/
OpeningAcceptanceDetailVO getAcceptanceDetail(Long shopId);
/**
* 审批数据
* @param request
* @param user
* @return
*/
Boolean auditOpeningAcceptance(AuditApproveRequest request, LoginUserInfo user);
}

View File

@@ -0,0 +1,154 @@
package com.cool.store.service.opening.impl;
import com.aliyun.ons20190214.models.OnsMessageTraceRequest;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.OpeningAcceptanceMapperDAO;
import com.cool.store.dao.OperationLogDAO;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.entity.OpeningAcceptanceDO;
import com.cool.store.entity.OperationLogDO;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.*;
import com.cool.store.enums.opening.AcceptanceStatusEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.OpeningAcceptanceMapper;
import com.cool.store.mapper.ShopAuditInfoMapper;
import com.cool.store.request.AuditApproveRequest;
import com.cool.store.request.opening.OpeningAcceptanceRequest;
import com.cool.store.service.OperationLogService;
import com.cool.store.service.PreparationService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.service.opening.OpeningAcceptanceService;
import com.cool.store.utils.BeanUtil;
import com.cool.store.utils.poi.constant.Constants;
import com.cool.store.vo.opening.OpeningAcceptanceDetailVO;
import com.sun.xml.bind.v2.TODO;
import org.apache.commons.collections.ArrayStack;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.sql.rowset.serial.SerialException;
import java.util.*;
import static com.cool.store.enums.UserRoleEnum.BRAND_HEAD;
import static com.cool.store.enums.UserRoleEnum.VICE_PRESIDENT_IN_CHARGE;
/**
* @Auther zx_szh
* @Date 2025/12/22 10:00
* @Version 1.0
*/
@Service
public class OpeningAcceptanceServiceImpl implements OpeningAcceptanceService {
@Resource
private OpeningAcceptanceMapperDAO openingAcceptanceMapperDAO;
@Resource
OperationLogService operationLogService;
@Resource
ShopStageInfoDAO shopStageInfoDAO;
@Resource
ShopAuditInfoMapper shopAuditInfoMapper;
@Resource
OperationLogDAO operationLogDAO;
@Resource
PreparationService preparationService;
@Resource
UserAuthMappingService userAuthMappingService;
@Resource
ShopInfoDAO shopInfoDAO;
@Override
public Boolean addOpeningAcceptance(OpeningAcceptanceRequest request,LoginUserInfo user) {
//新增开店验收数据
if (request.getId()==null) {
OpeningAcceptanceDO openingAcceptanceDO = new OpeningAcceptanceDO();
openingAcceptanceDO.setStatus(AcceptanceStatusEnum.PENDING_ACCEPTANCE.getCode());
openingAcceptanceDO.setCreateUser(user.getUserId());
BeanUtil.copyProperties(request,openingAcceptanceDO);
openingAcceptanceMapperDAO.addOpeningAcceptance(openingAcceptanceDO);
}else {
OpeningAcceptanceDO openingAcceptanceDO = new OpeningAcceptanceDO();
openingAcceptanceDO.setStatus(AcceptanceStatusEnum.PENDING_ACCEPTANCE.getCode());
openingAcceptanceDO.setUpdateUser(user.getUserId());
openingAcceptanceDO.setUpdateTime(new Date());
BeanUtil.copyProperties(request,openingAcceptanceDO);
openingAcceptanceMapperDAO.updateOpeningAcceptance(openingAcceptanceDO);
}
//阶段状态变更
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(), Collections.singletonList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_272));
//新增审核记录
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_270, user.getUserId(), user.getName(),
OperationTypeEnum.OPERATION_TYPE_0, "开业验收提交", OperationStatusEnum.PROCESSED);
//片区总顾问审核
List<EnterpriseUserDO> users = userAuthMappingService.getUserIdByRoleEnumAndRegionId(Collections.singletonList(UserRoleEnum.OPERATION_GENERAL_CONSULTANT), shopInfoDAO.getShopInfo(request.getShopId()).getRegionId());
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_272,
user.getUserId(), users,
OperationTypeEnum.OPERATION_TYPE_1, "加盟签约合同审批", OperationStatusEnum.NOT_PROCESSED);
return Boolean.TRUE;
}
@Override
public OpeningAcceptanceDetailVO getAcceptanceDetail(Long shopId) {
if (shopId==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
OpeningAcceptanceDO opening = openingAcceptanceMapperDAO.getOpeningAcceptanceByShopId(shopId);
OpeningAcceptanceDetailVO openingAcceptanceDetailVO = new OpeningAcceptanceDetailVO();
BeanUtil.copyProperties(opening,openingAcceptanceDetailVO);
return openingAcceptanceDetailVO;
}
@Override
public Boolean auditOpeningAcceptance(AuditApproveRequest request, LoginUserInfo user) {
OpeningAcceptanceDO open = openingAcceptanceMapperDAO.getOpeningAcceptanceByShopId(request.getShopId());
if (open==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
Integer status = open.getStatus();
ShopSubStageStatusEnum nextStage = null;
Integer resultType = null;
if (Constants.ZERO_INTEGER.equals(request.getAuditResult())) {
//驳回
status = AcceptanceStatusEnum.ACCEPTANCE_IS_UNQUALIFIED.getCode();
nextStage = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_274;
resultType = Constants.ONE_INTEGER;
}else {
//通过
status = AcceptanceStatusEnum.ACCEPTED.getCode();
nextStage = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_276;
resultType = Constants.ZERO_INTEGER;
}
open.setStatus(status);
open.setUpdateUser(user.getUserId());
open.setUpdateTime(new Date());
openingAcceptanceMapperDAO.updateOpeningAcceptance(open);
//阶段
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(), Arrays.asList(nextStage));
ShopAuditInfoDO shopAuditInfoDO = new ShopAuditInfoDO();
shopAuditInfoDO.setShopId(request.getShopId());
shopAuditInfoDO.setAuditType(AuditTypeEnum.OPENING_ACCEPTANCE.getCode());
shopAuditInfoDO.setSubmittedUserId(user.getUserId());
shopAuditInfoDO.setSubmittedUserName(user.getName());
shopAuditInfoDO.setResultType(resultType);
shopAuditInfoDO.setRejectReason(request.getCause());
shopAuditInfoMapper.insertSelective(shopAuditInfoDO);
Long auditId = shopAuditInfoDO.getId();
List<OperationLogDO> operationLogs = operationLogDAO.getBySubStageStatusEnumAndsStatus(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_272, OperationTypeEnum.OPERATION_TYPE_1.getCode());
operationLogService.batchUpdateProcessed(operationLogs, auditId, user.getUserId(), request.getCause());
//开业验收完成之后 看门店整个流程是否完成
if (status == AcceptanceStatusEnum.ACCEPTED.getCode()){
preparationService.updateShopStatus(request.getShopId());
}
return Boolean.TRUE;
}
}