Merge #71 into master from cc_20260318_wishlist

feat:订单待确认 审批流去掉

* cc_20260318_wishlist: (22 commits squashed)

  - feat:心愿单接口

  - feat:心愿单接口

  - feat:心愿单接口

  - feat:心愿单接口 查询当前门店铺位绑定的心愿单

  - feat:心愿单接口 状态

  - feat:心愿单接口 状态

  - feat:心愿单接口 状态

  - feat:心愿单接口 状态

  - Merge branch 'master' into cc_20260318_wishlist

  - feat:代码merge 错误处理

  - feat:新增storeType

  - feat:查询逻辑调整

  - feat:新增use_ai 赛选

  - feat:新增use_ai 赛选

  - feat:新增use_ai 赛选

  - feat:心愿单状态筛选

  - feat:查询当前门店铺位绑定的心愿单 mini

  - feat:bug修复

  - feat:类型调整

  - feat:名称

  - feat:订单待确认 审批流去掉

  - feat:订单待确认 审批流去掉

Signed-off-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>
Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>

CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/71
This commit is contained in:
正新
2026-03-23 11:51:20 +00:00
parent d50a31d044
commit a13ba2175c
38 changed files with 908 additions and 242 deletions

View File

@@ -6,6 +6,7 @@ import com.cool.store.request.*;
import com.cool.store.request.point.AddPointFinancialDataRequest;
import com.cool.store.request.point.UpdatePointFinancialDataRequest;
import com.cool.store.vo.LinePointBaseInfoVO;
import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.point.*;
import com.cool.store.vo.shop.RentInfoToDoVO;
import com.cool.store.vo.shop.ShopPointBaseInfoVO;

View File

@@ -31,6 +31,8 @@ public interface ShopService {
*/
Integer initShop(LineInfoDO lineInfo);
Long initAiShop(LineInfoDO lineInfo);
/**
* 获取首页数据
* @param lineId

View File

@@ -326,12 +326,12 @@ public class DeskServiceImpl implements DeskService {
List<Integer> subStageStatusList = new ArrayList<>();
List<Long> userRoleIds = enterpriseUserRoleMapper.getUserRoleIds(user.getUserId());
//两个角色都包含
if (userRoleIds.contains(UserRoleEnum.HEAD_OF_DESIGN.getCode())&&userRoleIds.contains(UserRoleEnum.FINANCE.getCode())){
if (userRoleIds.contains(UserRoleEnum.AI_STORE_TYPE_APPROVE.getCode())&&userRoleIds.contains(UserRoleEnum.FINANCE.getCode())){
subStageStatusList.add(SHOP_SUB_STAGE_STATUS_281.getShopSubStageStatus());
subStageStatusList.add(SHOP_SUB_STAGE_STATUS_282.getShopSubStageStatus());
}
//加盟内勤 待确认
if (userRoleIds.contains(UserRoleEnum.HEAD_OF_DESIGN.getCode())){
//立规 待确认
if (userRoleIds.contains(UserRoleEnum.AI_STORE_TYPE_APPROVE.getCode())){
subStageStatusList.add(SHOP_SUB_STAGE_STATUS_281.getShopSubStageStatus());
}
//如果是财务 待财务确认

View File

@@ -236,6 +236,9 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean skipIntentAgreement(Long lineId, LoginUserInfo user) {
if (user==null){
user = new LoginUserInfo();
}
log.info("skipIntentAgreement lineId:{},操作人:{}", lineId, user.getName());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
if (lineInfo == null) {

View File

@@ -3,6 +3,7 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dao.order.StoreWishlistDAO;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.exception.ServiceException;
@@ -66,6 +67,8 @@ public class JoinIntentionServiceImpl extends LineFlowService implements JoinInt
CommonService commonService;
@Resource
HyPartnerUserInfoDAO hyPartnerUserInfoDAO;
@Resource
StoreWishlistDAO wishlistDAO;
@Override
@@ -147,6 +150,8 @@ public class JoinIntentionServiceImpl extends LineFlowService implements JoinInt
hyPartnerUserInfoDO.setDownstreamSystemSalting(salt);
hyPartnerUserInfoDO.setUpdateTime(new Date());
hyPartnerUserInfoDAO.updatePasswordByPartnerId(hyPartnerUserInfoDO);
log.info("auditPass:大区老总审核通过");
wishlistDAO.updateByLineId(lineInfo.getId());
}
return Boolean.TRUE;
}

View File

@@ -840,6 +840,10 @@ public class PointServiceImpl implements PointService {
@Override
public PageInfo<PointPageVO> getRecommendPointList(RecommendPointPageRequest request) {
if (StringUtils.isEmpty(request.getDevelopmentManager())){
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
request.setDevelopmentManager(lineInfo.getInvestmentManager());
}
List<PointPageVO> resultList = new ArrayList();
Page<PCPointListDTO> pointPage = pointInfoDAO.getRecommendPointList(request);
if (Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())) {

View File

@@ -3,12 +3,16 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dao.order.StoreOrderDAO;
import com.cool.store.dao.store.StoreTypeDAO;
import com.cool.store.dto.OpenInfoDTO;
import com.cool.store.dto.Preparation.PreparationDTO;
import com.cool.store.dto.Preparation.ScheduleDTO;
import com.cool.store.dto.ShopNameAndCodeDTO;
import com.cool.store.dto.UserDTO;
import com.cool.store.entity.*;
import com.cool.store.entity.order.StoreOrderDO;
import com.cool.store.entity.store.StoreTypeDO;
import com.cool.store.enums.*;
import com.cool.store.enums.point.*;
import com.cool.store.enums.point.ShopStatusEnum;
@@ -119,6 +123,9 @@ public class ShopServiceImpl implements ShopService {
ShopAccountService shopAccountService;
@Resource
PushService pushService;
@Autowired
private StoreOrderDAO storeOrderDAO;
private StoreTypeDAO storeTypeDAO;
@Override
@@ -171,6 +178,46 @@ public class ShopServiceImpl implements ShopService {
return result;
}
@Override
public Long initAiShop(LineInfoDO lineInfo) {
if (Objects.isNull(lineInfo)) {
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineInfo.getId());
int shopSize = shopList.size();
List<ShopInfoDO> addShopList = new ArrayList<>();
ShopInfoDO shopInfo = new ShopInfoDO();
shopInfo.setRegionId(lineInfo.getRegionId());
shopInfo.setLineId(lineInfo.getId());
shopInfo.setPartnerId(lineInfo.getPartnerId());
//初始化
shopInfo.setWantShopAreaId(lineInfo.getWantShopAreaId());
shopInfo.setDevelopmentManager(lineInfo.getDevelopmentManager());
shopInfo.setFranchiseBrand(lineInfo.getFranchiseBrand());
shopInfo.setJoinMode(lineInfo.getJoinMode());
shopInfo.setStoreNum(RandomEightCharCodeUtils.getCode());
shopInfo.setSupervisorUserId(lineInfo.getInvestmentManager());
shopInfo.setShopName("AI店铺" + NumberConverter.convertArabicToChinese(shopSize + 1));
shopInfo.setCreateTime(new Date());
shopInfo.setUseStandardStore(lineInfo.getUseStandardStore());
shopInfo.setInvestmentManager(lineInfo.getInvestmentManager());
shopInfo.setInvestRegionId(lineInfo.getInvestRegionId());
addShopList.add(shopInfo);
shopInfoDAO.batchAddShop(addShopList);
List<Long> shopIds = addShopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
Integer result = shopStageInfoDAO.initShopStageInfo(lineInfo, addShopList, true);
//初始化平台账号
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(lineInfo.getPartnerId());
shopAccountDAO.initShopAccount(hyPartnerUserInfoDO, shopIds);
HashMap<String, String> map = new HashMap<>();
map.put("partnerUsername", lineInfo.getUsername());
map.put("partnerMobile", lineInfo.getMobile());
commonService.sendQWMessage(Collections.singletonList(lineInfo.getInvestmentManager()),
MessageEnum.MESSAGE_21,
map);
return shopInfo.getId();
}
/**
* @Auther: wangshuo
* @Date: 2025/1/13
@@ -883,6 +930,7 @@ public class ShopServiceImpl implements ShopService {
case SHOP_SUB_STAGE_STATUS_280:
case SHOP_SUB_STAGE_STATUS_283:
case SHOP_SUB_STAGE_STATUS_284:
case SHOP_SUB_STAGE_STATUS_281_5:
return Collections.singletonList(new UserDTO(lineInfo.getUsername(), lineInfo.getMobile()));
case SHOP_SUB_STAGE_STATUS_11:
@@ -988,7 +1036,7 @@ public class ShopServiceImpl implements ShopService {
case SHOP_SUB_STAGE_STATUS_172:
return getUsersByRoleAndRegion(ORDER_GROUP, shopInfo.getRegionId());
case SHOP_SUB_STAGE_STATUS_281:
return getUsersByRolesAndRegion(Arrays.asList(JOIN_OFFICE), shopInfo.getInvestRegionId());
return getUsersByRole(AI_STORE_TYPE_APPROVE);
default:
return Collections.emptyList();
}

View File

@@ -50,10 +50,15 @@ public interface MiniStoreOrderService {
Boolean deleted(MiniStoreWishlistDelRequest miniStoreWishlistDelRequest,PartnerUserInfoVO userInfoVO);
MiniStoreWishlistDetailVO wishlistDetail(Long storeTypeId,String versionNo, Long lineId);
MiniStoreWishlistDetailVO wishlistDetail(Long wishlistId);
List<MiniStoreWishlistListVO> wishlistList(PartnerUserInfoVO userInfoVO);
PageInfo<MiniStoreWishlistListVO> wishAllList(WishAllListRequest request);
Boolean wishlistBindPoint(WishlistBindPointRequest request);
Boolean wishlistApprove(WishlistAuditRequest request,LoginUserInfo userInfo);
MiniStoreWishlistDetailVO getCurrentShopBindWishlist(Long shopId);
}

View File

@@ -15,9 +15,11 @@ import com.cool.store.dao.order.PreAllocationRecordDAO;
import com.cool.store.dao.order.StoreOrderDAO;
import com.cool.store.dao.order.StoreOrderOptionSnapshotDAO;
import com.cool.store.dao.order.StoreWishlistDAO;
import com.cool.store.dao.order.StoreWishlistOptionDAO;
import com.cool.store.dao.store.StoreTypeDAO;
import com.cool.store.dao.store.StoreTypeOptionDAO;
import com.cool.store.dao.wallet.WalletTradeDAO;
import com.cool.store.dto.PointInfoDTO;
import com.cool.store.entity.*;
import com.cool.store.entity.config.ConfigOptionDO;
import com.cool.store.entity.dict.SysDictTableDO;
@@ -26,6 +28,7 @@ import com.cool.store.entity.order.PreAllocationRecordDO;
import com.cool.store.entity.order.StoreOrderDO;
import com.cool.store.entity.order.StoreOrderOptionSnapshotDO;
import com.cool.store.entity.order.StoreWishlistDO;
import com.cool.store.entity.order.StoreWishlistOptionDO;
import com.cool.store.entity.store.StoreTypeDO;
import com.cool.store.entity.store.StoreTypeOptionDO;
import com.cool.store.entity.wallet.WalletTradeDO;
@@ -33,15 +36,21 @@ import com.cool.store.enums.*;
import com.cool.store.enums.fees.AllocationPayStatusEnum;
import com.cool.store.enums.fees.WalletFeeItemEnum;
import com.cool.store.enums.order.StoreOrderStatusEnum;
import com.cool.store.enums.order.WishlistStatusEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.enums.wallet.WalletTradeModuleEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.dto.wallet.BatchTransferDTO;
import com.cool.store.mapper.ShopAuditInfoMapper;
import com.cool.store.request.PointRecommendLineRequest;
import com.cool.store.request.SelectPointRequest;
import com.cool.store.request.SysRoleRequest;
import com.cool.store.request.order.*;
import com.cool.store.request.dict.DictColumnQueryRequest;
import com.cool.store.request.wallet.BatchTransferRequest;
import com.cool.store.service.OperationLogService;
import com.cool.store.service.PointService;
import com.cool.store.service.ShopService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.service.dict.DictColumnService;
import com.cool.store.service.order.MiniStoreOrderService;
@@ -68,9 +77,11 @@ import io.swagger.models.auth.In;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
@@ -93,6 +104,7 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
private final StoreOrderDAO storeOrderDAO;
private final StoreOrderOptionSnapshotDAO snapshotDAO;
private final StoreWishlistDAO storeWishlistDAO;
private final StoreWishlistOptionDAO storeWishlistOptionDAO;
private final ShopInfoDAO shopInfoDAO;
private final LineInfoDAO lineInfoDAO;
private final StoreTypeDAO storeTypeDAO;
@@ -114,6 +126,10 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
private final OperationLogDAO operationLogDAO;
private final ConfigItemCategoryDAO configItemCategoryDAO;
private final ConfigItemDAO configItemDAO;
private final QualificationsInfoDAO qualificationsInfoDAO;
private final PointService pointService;
private final PointInfoDAO pointInfoDAO;
private final ShopService shopService;
@Override
@@ -329,10 +345,11 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_280, user.getPartnerId(), user.getUsername(),
OperationTypeEnum.OPERATION_TYPE_0, "店型选购提交", OperationStatusEnum.PROCESSED);
List<EnterpriseUserDO> users = userAuthMappingService.getUserIdByRoleEnumAndRegionId(Collections.singletonList(UserRoleEnum.JOIN_OFFICE),
shopInfo.getInvestRegionId());
SysRoleRequest sysRoleRequest = new SysRoleRequest();
sysRoleRequest.setRoleName(AI_STORE_TYPE_APPROVE.getDesc());
List<EnterpriseUserDO> userListByRole = userAuthMappingService.findUserListByRole(sysRoleRequest, false);
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281,
user.getPartnerId(), users,
user.getPartnerId(), userListByRole,
OperationTypeEnum.OPERATION_TYPE_1, "店型选购待立规审批", OperationStatusEnum.NOT_PROCESSED, 1);
return order.getId();
@@ -349,11 +366,14 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(order.getShopId());
StoreTypeDO storeType = storeTypeDAO.getById(order.getStoreTypeId());
MiniStoreOrderDetailVO vo = new MiniStoreOrderDetailVO();
MiniStoreOrderDetailVO.OrderInfoVO orderInfo = new MiniStoreOrderDetailVO.OrderInfoVO();
orderInfo.setStoreType(order.getStoreType());
orderInfo.setStoreTypeId(order.getStoreTypeId());
orderInfo.setStoreTypeName(storeType.getStoreTypeName());
orderInfo.setOrderNo(order.getOrderNo());
orderInfo.setOrderId(order.getId());
orderInfo.setShopId(order.getShopId());
@@ -557,15 +577,6 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
//处理审批记录 通过
handleAudit(order.getShopId(),user,0,request.getRemark(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281);
List<EnterpriseUserDO> users = userAuthMappingService.getUserIdByRoleEnumAndRegionId(Arrays.asList(HEAD_OF_DESIGN), shopInfoDAO.getShopInfo(order.getShopId()).getRegionId());
List<String> userIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(users)) {
userIds = users.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList());
}
operationLogService.addOperationLog(order.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_5,
user.getUserId(), users,
OperationTypeEnum.OPERATION_TYPE_1, "店型选配待招商经理审批", OperationStatusEnum.NOT_PROCESSED);
}
if (INVEST_MANAGER_CONFIRM.getCode().equals(currentStatus)){
order.setStatus(FINANCIAL_CONFIRM.getCode());
@@ -574,9 +585,6 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
//修改阶段数据
shopStageInfoDAO.updateShopStageInfo(order.getShopId(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_282);
//处理审批记录 通过
handleAudit(order.getShopId(),user,0,request.getRemark(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_5);
}
return Boolean.TRUE;
}
@@ -603,12 +611,10 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
ShopSubStageStatusEnum current = null;
if (WAIT_CONFIRM.getCode().equals(currentStatus)){
current = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281;
//处理审批记录
handleAudit(order.getShopId(),userInfo,1,request.getRemark(),current);
}
if (INVEST_MANAGER_CONFIRM.getCode().equals(currentStatus)){
current = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281_5;
}
//处理审批记录
handleAudit(order.getShopId(),userInfo,1,request.getRemark(),current);
return Boolean.TRUE;
}
@@ -825,11 +831,11 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_280, user.getPartnerId(), user.getUsername(),
OperationTypeEnum.OPERATION_TYPE_0, "店型选购提交", OperationStatusEnum.PROCESSED);
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(order.getShopId());
List<EnterpriseUserDO> users = userAuthMappingService.getUserIdByRoleEnumAndRegionId(Collections.singletonList(UserRoleEnum.JOIN_OFFICE),
shopInfo.getInvestRegionId());
SysRoleRequest sysRoleRequest = new SysRoleRequest();
sysRoleRequest.setRoleName(AI_STORE_TYPE_APPROVE.getDesc());
List<EnterpriseUserDO> userListByRole = userAuthMappingService.findUserListByRole(sysRoleRequest, false);
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_281,
user.getPartnerId(), users,
user.getPartnerId(), userListByRole,
OperationTypeEnum.OPERATION_TYPE_1, "店型选购待立规审批", OperationStatusEnum.NOT_PROCESSED, 1);
return order.getId();
@@ -1292,12 +1298,14 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
}
if (request.getVersionNo() != null) {
storeWishlistDAO.softDeleteByLineIdAndStoreTypeAndVersion(userInfoVO.getLineId(), request.getStoreTypeId(), request.getVersionNo());
if (request.getWishlistId() != null) {
MiniStoreWishlistDelRequest miniStoreWishlistDelRequest = new MiniStoreWishlistDelRequest();
miniStoreWishlistDelRequest.setWishlistId(request.getWishlistId());
//删除逻辑
deleted(miniStoreWishlistDelRequest,null);
}
String versionNo = generateOrderNo();
List<StoreWishlistDO> saveList = new ArrayList<>();
BigDecimal totalAmount = BigDecimal.ZERO;
BigDecimal storeFixedAmount = safe(storeType.getFranchiseFee())
@@ -1326,67 +1334,279 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
BigDecimal quantity = selected.getQuantity();
BigDecimal defaultQty = binding.getDefaultQuantity();
BigDecimal amount = BigDecimal.ZERO;
//原价
BigDecimal originalPrice = cfg.getOriginalOptionPrice();
if(quantity.compareTo(defaultQty)<=0){
if (quantity.compareTo(defaultQty) <= 0) {
amount = price.multiply(quantity);
}else {
// 店型优惠价*默认数量 + 原价 *(选择数量-默认数量)
} else {
amount = price.multiply(defaultQty).add(originalPrice.multiply(quantity.subtract(defaultQty)));
}
totalAmount = totalAmount.add(amount);
saveList.add(StoreWishlistDO.builder()
.lineId(userInfoVO.getLineId())
.storeTypeId(request.getStoreTypeId())
.optionId(selected.getOptionId())
.quantity(selected.getQuantity())
.totalAmount(BigDecimal.ZERO)
.versionNo(versionNo)
.deleted(0)
.build());
}
totalAmount = storeFixedAmount.add(totalAmount);
for (StoreWishlistDO row : saveList) {
row.setTotalAmount(totalAmount);
StoreWishlistDO wishlist = StoreWishlistDO.builder()
.lineId(userInfoVO.getLineId())
.storeTypeId(request.getStoreTypeId())
.totalAmount(totalAmount)
.versionNo(versionNo)
.wishlistStatus(getWishlistStatus(userInfoVO.getLineId()))
.deleted(0)
.build();
storeWishlistDAO.insert(wishlist);
List<StoreWishlistOptionDO> optionSaveList = new ArrayList<>();
for (MiniStoreWishlistSaveRequest.SelectedOption selected : request.getSelectedOptions()) {
optionSaveList.add(StoreWishlistOptionDO.builder()
.wishlistId(wishlist.getId())
.optionId(selected.getOptionId())
.quantity(selected.getQuantity())
.deleted(0)
.build());
}
storeWishlistDAO.insertBatch(saveList);
storeWishlistOptionDAO.insertBatch(optionSaveList);
return Boolean.TRUE;
}
/**
* 获取线索阶段
* @param lineId
* @return
*/
private Integer getWishlistStatus(Long lineId){
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
if (lineInfo.getWorkflowSubStageStatus()>=WorkflowSubStageStatusEnum.INTENT_5.getCode()){
return WishlistStatusEnum.COMPLETE_POINT.getCode();
}
return WishlistStatusEnum.AGREE.getCode();
}
@Override
public Boolean deleted(MiniStoreWishlistDelRequest request, PartnerUserInfoVO userInfoVO) {
storeWishlistDAO.softDeleteByLineIdAndStoreTypeAndVersion(userInfoVO.getLineId(),request.getStoreTypeId(),request.getVersionNo());
StoreWishlistDO storewishlist = storeWishlistDAO.getById(request.getWishlistId());
if (storewishlist==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
storewishlist.setDeleted(1);
storeWishlistDAO.updateByExampleSelective(storewishlist);
//更新配置项数据
storeWishlistOptionDAO.softDeleteByWishlistIds(Arrays.asList(request.getWishlistId()));
return Boolean.TRUE;
}
@Override
public MiniStoreWishlistDetailVO wishlistDetail(Long storeTypeId,String versionNo, Long lineId) {
if (lineId == null) {
public MiniStoreWishlistDetailVO wishlistDetail(Long wishlistId) {
StoreWishlistDO storeWishlistDO = storeWishlistDAO.getById(wishlistId);
if (storeWishlistDO==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
return convert(storeWishlistDO);
}
List<StoreWishlistDO> rows = storeWishlistDAO.listByLineIdAndStoreTypeAndVersion(lineId, storeTypeId, versionNo);
if (CollectionUtils.isEmpty(rows)){
@Override
public List<MiniStoreWishlistListVO> wishlistList( PartnerUserInfoVO userInfoVO) {
if (userInfoVO == null || userInfoVO.getLineId() == null) {
return Collections.emptyList();
}
List<MiniStoreWishlistListVO> wishlistList = storeWishlistDAO.listByLineId(userInfoVO.getLineId(), null);
if (CollectionUtils.isEmpty(wishlistList)) {
return Collections.emptyList();
}
List<Long> wishlistIds = wishlistList.stream().map(MiniStoreWishlistListVO::getWishlistId).filter(Objects::nonNull).collect(Collectors.toList());
List<StoreWishlistOptionDO> optionRows = storeWishlistOptionDAO.listByWishlistIds(wishlistIds);
Map<Long, List<StoreWishlistOptionDO>> map = optionRows.stream().collect(Collectors.groupingBy(StoreWishlistOptionDO::getWishlistId));
List<Long> optionIds = optionRows.stream().distinct().map(StoreWishlistOptionDO::getOptionId).collect(Collectors.toList());
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(optionIds)) {
List<ConfigOptionDO> options = configOptionDAO.listActiveByIds(optionIds);
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
}
List<Long> pointList = wishlistList.stream().filter(x -> x.getPointId() != null).map(MiniStoreWishlistListVO::getPointId).collect(Collectors.toList());
List<PointInfoDO> pointDOList = pointInfoDAO.getPointListByIds(pointList);
Map<Long, Long> pointMap = pointDOList.stream().filter(x -> x.getShopId() != null).collect(Collectors.toMap(PointInfoDO::getId, PointInfoDO::getShopId));
for (MiniStoreWishlistListVO item : wishlistList) {
List<StoreWishlistOptionDO> storeWishlistOptionDOS = map.get(item.getWishlistId());
List<MiniStoreWishlistListVO.OptionVO> optionList = new ArrayList<>();
if (item.getPointId()!=null){
item.setShopId(pointMap.get(item.getPointId()));
}
for (StoreWishlistOptionDO row : storeWishlistOptionDOS) {
MiniStoreWishlistListVO.OptionVO vo = new MiniStoreWishlistListVO.OptionVO();
vo.setOptionId(row.getOptionId());
vo.setQuantity(row.getQuantity());
ConfigOptionDO cfg = optionMap.get(row.getOptionId());
if (cfg != null) {
vo.setOptionName(cfg.getOptionName());
vo.setOptionPrice(cfg.getOptionPrice());
vo.setImageUrl(cfg.getImageUrl());
}
optionList.add(vo);
}
item.setOptions(optionList);
}
return wishlistList;
}
@Override
public PageInfo<MiniStoreWishlistListVO> wishAllList(WishAllListRequest request) {
PageHelper.startPage(request.getPageNum(),request.getPageSize());
List<MiniStoreWishlistListVO> wishlist = storeWishlistDAO.listByVersionList(request.getKeyword(), request.getStoreTypeId(),request.getWishlistStatus());
if (CollectionUtils.isEmpty(wishlist)){
return new PageInfo<>();
}
PageInfo<MiniStoreWishlistListVO> result = new PageInfo<>(wishlist);
List<Long> lineIdList = wishlist.stream().map(MiniStoreWishlistListVO::getLineId).collect(Collectors.toList());
List<LineInfoDO> lineList = lineInfoDAO.getByLineIds(lineIdList);
Map<Long, LineInfoDO> map = lineList.stream().collect(Collectors.toMap(LineInfoDO::getId, data -> data));
List<Long> wishlistIds = wishlist.stream().map(MiniStoreWishlistListVO::getWishlistId).filter(Objects::nonNull).collect(Collectors.toList());
List<StoreWishlistOptionDO> optionRows = storeWishlistOptionDAO.listByWishlistIds(wishlistIds);
Map<Long, List<StoreWishlistOptionDO>> wishlistOptionMap = optionRows.stream().collect(Collectors.groupingBy(StoreWishlistOptionDO::getWishlistId));
List<Long> optionIds = optionRows.stream().distinct().map(StoreWishlistOptionDO::getOptionId).collect(Collectors.toList());
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(optionIds)) {
List<ConfigOptionDO> options = configOptionDAO.listActiveByIds(optionIds);
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
}
for (MiniStoreWishlistListVO item : wishlist) {
LineInfoDO lineInfoDO = map.get(item.getLineId());
if (lineInfoDO != null) {
item.setPartnerMobile(lineInfoDO.getMobile());
item.setPartnerName(lineInfoDO.getUsername());
}
List<StoreWishlistOptionDO> storeWishlistOptionDOS = wishlistOptionMap.get(item.getWishlistId());
List<MiniStoreWishlistListVO.OptionVO> optionList = new ArrayList<>();
for (StoreWishlistOptionDO row : storeWishlistOptionDOS) {
MiniStoreWishlistListVO.OptionVO vo = new MiniStoreWishlistListVO.OptionVO();
vo.setOptionId(row.getOptionId());
vo.setQuantity(row.getQuantity());
ConfigOptionDO cfg = optionMap.get(row.getOptionId());
if (cfg != null) {
vo.setOptionName(cfg.getOptionName());
vo.setOptionPrice(cfg.getOptionPrice());
vo.setImageUrl(cfg.getImageUrl());
}
optionList.add(vo);
}
item.setOptions(optionList);
}
return result;
}
@Override
public Boolean wishlistBindPoint(WishlistBindPointRequest request) {
StoreWishlistDO storeWishlist = storeWishlistDAO.getById(request.getWishlistId());
if (!WishlistStatusEnum.COMPLETE_POINT.getCode().equals(storeWishlist.getWishlistStatus())){
throw new ServiceException(ErrorCodeEnum.TASK_STATUS_NOT_ALLOW_OPERATE);
}
//校验铺位是否关联了其他心愿单 且心愿单不是拒绝状态
Integer pointBindWishlistCount = storeWishlistDAO.getPointBindWishlistCount(request.getPointId(), WishlistStatusEnum.REJECT.getCode());
if (pointBindWishlistCount>0){
throw new ServiceException(ErrorCodeEnum.CURRENT_POINT_BIND_OTHER_WISHLIST);
}
storeWishlist.setPointId(request.getPointId());
storeWishlist.setWishlistStatus(WishlistStatusEnum.LI_GUI_APPROVE.getCode());
storeWishlistDAO.updateByExampleSelective(storeWishlist);
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean wishlistApprove(WishlistAuditRequest request, LoginUserInfo userInfo) {
log.info("wishlistApprove:{},审批人:{}",JSONObject.toJSONString(request),userInfo.getName());
//查看心愿单状态
StoreWishlistDO wishlistDO = storeWishlistDAO.getById(request.getWishlistId());
if (wishlistDO==null){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE);
}
if (!WishlistStatusEnum.LI_GUI_APPROVE.getCode().equals(wishlistDO.getWishlistStatus())){
throw new ServiceException(ErrorCodeEnum.TASK_STATUS_NOT_ALLOW_OPERATE);
}
Integer wishlistStatus = null;
//通过
if (request.getAuditStatus()==1){
//查看线索阶段是否完成 如果没有完成 直接跳过意向金和意向协议阶段
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(wishlistDO.getLineId());
if (Objects.isNull(lineInfo.getRegionId())||lineInfo.getRegionId() == 0){
throw new ServiceException(ErrorCodeEnum.LINE_REGION_NOT_EXIST);
}
lineInfo.setWorkflowStage(WorkflowStageEnum.STORE.getCode());
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_125.getCode());
lineInfo.setDevelopmentManager(lineInfo.getInvestmentManager());
lineInfoDAO.updateLineInfo(lineInfo);
//初始化店铺 AI店
lineInfo.setUseStandardStore(1);
Long shopId = shopService.initAiShop(lineInfo);
//选址阶段直接完成
PointRecommendLineRequest recommendLineRequest = new PointRecommendLineRequest();
recommendLineRequest.setShopIds(Arrays.asList(Long.valueOf(shopId)));
recommendLineRequest.setPointId(wishlistDO.getPointId());
recommendLineRequest.setDevelopmentManager(lineInfo.getDevelopmentManager());
//推荐逻辑
pointService.pointRecommendLine(recommendLineRequest);
SelectPointRequest selectPointRequest = new SelectPointRequest();
selectPointRequest.setPointId(wishlistDO.getPointId());
selectPointRequest.setLineId(wishlistDO.getLineId());
selectPointRequest.setShopId(shopId);
//选址
pointService.lineSelectPoint(selectPointRequest);
//修改心愿单状态
wishlistStatus = WishlistStatusEnum.PASS.getCode();
}
if (request.getAuditStatus()==0){
wishlistStatus = WishlistStatusEnum.REJECT.getCode();
}
wishlistDO.setWishlistStatus(wishlistStatus);
wishlistDO.setRemark(request.getRemark());
wishlistDO.setUpdateTime(new Date());
storeWishlistDAO.updateByExampleSelective(wishlistDO);
return Boolean.TRUE;
}
@Override
public MiniStoreWishlistDetailVO getCurrentShopBindWishlist(Long shopId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if (shopInfo == null) {
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE);
}
if (shopInfo.getPointId()==null){
return null;
}
StoreWishlistDO storelistDO = storeWishlistDAO.getByPointId(shopInfo.getLineId(), shopInfo.getPointId());
return convert(storelistDO);
}
private MiniStoreWishlistDetailVO convert(StoreWishlistDO storeWishlistDO){
if (storeWishlistDO==null){
return null;
}
MiniStoreWishlistDetailVO vo = new MiniStoreWishlistDetailVO();
vo.setStoreTypeId(storeTypeId);
vo.setVersionNo(versionNo);
StoreWishlistDO storeWishlistDO = rows.get(0);
if (storeWishlistDO!=null){
vo.setTotalAmount(storeWishlistDO.getTotalAmount());
vo.setCreateTime(storeWishlistDO.getCreateTime());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(storeWishlistDO.getLineId());
if (lineInfo!=null){
vo.setPartnerMobile(lineInfo.getMobile());
vo.setPartnerName(lineInfo.getUsername());
}
vo.setStoreTypeId(storeWishlistDO.getStoreTypeId());
vo.setId(storeWishlistDO.getId());
vo.setVersionNo(storeWishlistDO.getVersionNo());
vo.setTotalAmount(storeWishlistDO.getTotalAmount());
vo.setPointId(storeWishlistDO.getPointId());
vo.setWishlistStatus(storeWishlistDO.getWishlistStatus());
vo.setCreateTime(storeWishlistDO.getCreateTime());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(storeWishlistDO.getLineId());
if (lineInfo != null) {
vo.setPartnerMobile(lineInfo.getMobile());
vo.setPartnerName(lineInfo.getUsername());
}
StoreTypeDO storeTypeDO = storeTypeDAO.getById(storeTypeId);
StoreTypeDO storeTypeDO = storeTypeDAO.getById(storeWishlistDO.getStoreTypeId());
MiniStoreWishlistDetailVO.FeeInfoVO feeInfo = new MiniStoreWishlistDetailVO.FeeInfoVO();
feeInfo.setFranchiseFee(storeTypeDO.getFranchiseFee());
feeInfo.setBrandUsageFee(storeTypeDO.getBrandUsageFee());
@@ -1397,8 +1617,20 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
feeInfo.setFirstOrderFee(storeTypeDO.getFirstOrderFee());
vo.setFeeInfoVO(feeInfo);
vo.setStoreTypeName(storeTypeDO.getStoreTypeName());
vo.setStoreType(storeTypeDO.getStoreType());
List<Long> optionIds = rows.stream().map(StoreWishlistDO::getOptionId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
if (storeWishlistDO.getPointId()!=null){
PointInfoDO pointInfoDO = pointInfoDAO.getPointInfoById(storeWishlistDO.getPointId());
vo.setShopId(pointInfoDO.getShopId());
}
List<StoreWishlistOptionDO> optionRows = storeWishlistOptionDAO.listByWishlistIds(Arrays.asList(storeWishlistDO.getId()));
if (CollectionUtils.isEmpty(optionRows)) {
vo.setOptions(Collections.emptyList());
return vo;
}
List<Long> optionIds = optionRows.stream().map(StoreWishlistOptionDO::getOptionId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
List<ConfigOptionDO> options = new ArrayList<>();
if (CollectionUtils.isNotEmpty(optionIds)) {
@@ -1406,7 +1638,7 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
}
List<StoreTypeOptionDO> bindings = storeTypeOptionDAO.listByStoreTypeId(storeTypeId);
List<StoreTypeOptionDO> bindings = storeTypeOptionDAO.listByStoreTypeId(storeWishlistDO.getStoreTypeId());
Map<Long, StoreTypeOptionDO> bindingMap = bindings.stream()
.collect(Collectors.toMap(StoreTypeOptionDO::getOptionId, Function.identity(), (a, b) -> a));
@@ -1417,7 +1649,7 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
Map<String, String> itemCodeMap = configItemDAO.nameMap(itemCodeList);
List<MiniStoreWishlistDetailVO.OptionVO> list = new ArrayList<>();
for (StoreWishlistDO row : rows) {
for (StoreWishlistOptionDO row : optionRows) {
MiniStoreWishlistDetailVO.OptionVO item = new MiniStoreWishlistDetailVO.OptionVO();
BigDecimal quantity = row.getQuantity();
item.setOptionId(row.getOptionId());
@@ -1431,16 +1663,14 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
item.setCategoryCode(cfg.getCategoryCode());
item.setItemCode(cfg.getItemCode());
}
if (storeTypeOptionDO!=null){
if (storeTypeOptionDO != null && cfg != null) {
BigDecimal price = storeTypeOptionDO.getOptionPrice();
BigDecimal amount = BigDecimal.ZERO;
BigDecimal defaultQty = storeTypeOptionDO.getDefaultQuantity();
//原价
BigDecimal originalPrice = cfg.getOriginalOptionPrice();
if(quantity.compareTo(defaultQty)<=0){
if (quantity.compareTo(defaultQty) <= 0) {
amount = price.multiply(quantity);
}else {
// 店型优惠价*默认数量 + 原价 *(选择数量-默认数量)
} else {
amount = price.multiply(defaultQty).add(originalPrice.multiply(quantity.subtract(defaultQty)));
}
item.setOptionPrice(price);
@@ -1454,100 +1684,6 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
return vo;
}
@Override
public List<MiniStoreWishlistListVO> wishlistList( PartnerUserInfoVO userInfoVO) {
if (userInfoVO == null || userInfoVO.getLineId() == null) {
return Collections.emptyList();
}
List<MiniStoreWishlistListVO> wishlist = storeWishlistDAO.listByLineId(userInfoVO.getLineId(), null);
if (CollectionUtils.isEmpty(wishlist)) {
return Collections.emptyList();
}
for (MiniStoreWishlistListVO item : wishlist) {
List<StoreWishlistDO> rows = storeWishlistDAO.listByLineIdAndStoreTypeAndVersion(userInfoVO.getLineId(), item.getStoreTypeId(), item.getVersionNo());
if (CollectionUtils.isEmpty(rows)) {
item.setOptions(Collections.emptyList());
continue;
}
List<Long> optionIds = rows.stream().map(StoreWishlistDO::getOptionId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(optionIds)) {
List<ConfigOptionDO> options = configOptionDAO.listActiveByIds(optionIds);
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
}
List<MiniStoreWishlistListVO.OptionVO> optionList = new ArrayList<>();
for (StoreWishlistDO row : rows) {
MiniStoreWishlistListVO.OptionVO vo = new MiniStoreWishlistListVO.OptionVO();
vo.setOptionId(row.getOptionId());
vo.setQuantity(row.getQuantity());
ConfigOptionDO cfg = optionMap.get(row.getOptionId());
if (cfg != null) {
vo.setOptionName(cfg.getOptionName());
vo.setOptionPrice(cfg.getOptionPrice());
vo.setImageUrl(cfg.getImageUrl());
}
optionList.add(vo);
}
item.setOptions(optionList);
}
return wishlist;
}
@Override
public PageInfo<MiniStoreWishlistListVO> wishAllList(WishAllListRequest request) {
PageHelper.startPage(request.getPageNum(),request.getPageSize());
List<String> distinctVersion = storeWishlistDAO.getDistinctVersion(request.getKeyword(),request.getStoreTypeId());
if (CollectionUtils.isEmpty(distinctVersion)){
return new PageInfo<>();
}
PageInfo result = new PageInfo<>(distinctVersion);
List<MiniStoreWishlistListVO> wishlist = storeWishlistDAO.listByVersionList(distinctVersion);
List<Long> lineIdList = wishlist.stream().map(MiniStoreWishlistListVO::getLineId).collect(Collectors.toList());
List<LineInfoDO> lineList = lineInfoDAO.getByLineIds(lineIdList);
Map<Long, LineInfoDO> map = lineList.stream().collect(Collectors.toMap(LineInfoDO::getId, data -> data));
for (MiniStoreWishlistListVO item : wishlist) {
LineInfoDO lineInfoDO = map.get(item.getLineId());
if (lineInfoDO!=null){
item.setPartnerMobile(lineInfoDO.getMobile());
item.setPartnerName(lineInfoDO.getUsername());
}
List<StoreWishlistDO> rows = storeWishlistDAO.listByLineIdAndStoreTypeAndVersion(item.getLineId(), item.getStoreTypeId(), item.getVersionNo());
if (CollectionUtils.isEmpty(rows)) {
item.setOptions(Collections.emptyList());
continue;
}
List<Long> optionIds = rows.stream().map(StoreWishlistDO::getOptionId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
Map<Long, ConfigOptionDO> optionMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(optionIds)) {
List<ConfigOptionDO> options = configOptionDAO.listActiveByIds(optionIds);
optionMap = options.stream().collect(Collectors.toMap(ConfigOptionDO::getId, Function.identity(), (a, b) -> a));
}
List<MiniStoreWishlistListVO.OptionVO> optionList = new ArrayList<>();
for (StoreWishlistDO row : rows) {
MiniStoreWishlistListVO.OptionVO vo = new MiniStoreWishlistListVO.OptionVO();
vo.setOptionId(row.getOptionId());
vo.setQuantity(row.getQuantity());
ConfigOptionDO cfg = optionMap.get(row.getOptionId());
if (cfg != null) {
vo.setOptionName(cfg.getOptionName());
vo.setOptionPrice(cfg.getOptionPrice());
vo.setImageUrl(cfg.getImageUrl());
}
optionList.add(vo);
}
item.setOptions(optionList);
}
result.setList(wishlist);
return result;
}
private BigDecimal safe(BigDecimal v) {
return v == null ? BigDecimal.ZERO : v;