Merge branch 'master' into cc_20250609_takeoutBuild

# Conflicts:
#	coolstore-partner-service/src/main/java/com/cool/store/service/impl/BuildInformationServiceImpl.java
This commit is contained in:
shuo.wang
2025-06-10 15:44:00 +08:00
57 changed files with 1602 additions and 160 deletions

View File

@@ -1,6 +1,7 @@
package com.cool.store.service;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dto.BatchStatusRefreshDTO;
import com.cool.store.entity.ImportTaskDO;
import java.util.List;
@@ -20,20 +21,59 @@ public interface DataHandlerServer {
* @description: 导入OA旧数据
*/
Boolean importOaOldShopData(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user,
ImportTaskDO task);
ImportTaskDO task);
//数据处理阶段完成 某些阶段数据处理
Boolean dataStageHandler(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user, ImportTaskDO task,Boolean flag);
/**
* @Auther: wangshuo
* @Date: 2025/6/9
* @description: //数据处理阶段完成 某些阶段数据处理
*/
Boolean dataStageHandler(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user, ImportTaskDO task, Boolean flag);
//装修数据初始化
/**
* @Auther: wangshuo
* @Date: 2025/6/9
* @description: //装修数据初始化
*/
Boolean decorationDataInit();
//处理2024年10-12月数据
/**
* @Auther: wangshuo
* @Date: 2025/6/9
* @description: //处理2024年10-12月数据
*/
Boolean dataHandlerV20241012(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user,
ImportTaskDO task);
Integer JingDongStageHandler();
//处理测量 设计 施工 验收 完成
/**
* @Auther: wangshuo
* @Date: 2025/6/9
* //处理测量 设计 施工 验收 完成
*/
Boolean dataHandlerV2025029(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user,
ImportTaskDO task);
ImportTaskDO task);
/**
* @Auther: wangshuo
* @Date: 2025/6/9
* @description: //处理加盟费阶段
*/
Boolean franchiseFeeStageDateHandler();
/**
* @Auther: wangshuo
* @Date: 2025/6/9
* @description:处理加盟费缴费信息历史数据
*/
Boolean franchiseFeeDateHandler(Integer pageSize, Integer pageNum);
/**
* @Auther: wangshuo
* @Date: 2025/5/23
* @description:不是对外回调接口针对于已经在oa走完数据的我们手动调用接口批量修改数据只做云流水别的别用
*/
Boolean batchStatusRefreshYls(BatchStatusRefreshDTO batchStatusRefreshDTO);
}

View File

@@ -3,7 +3,9 @@ package com.cool.store.service;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.AuditFranchiseFeeRequest;
import com.cool.store.request.FranchiseFeeRequest;
import com.cool.store.request.xgj.FranchiseFeeCallBackRequest;
import com.cool.store.response.FranchiseFeeResponse;
import com.cool.store.response.bigdata.ApiResponse;
public interface FranchiseFeeService {
/**
@@ -22,4 +24,6 @@ public interface FranchiseFeeService {
FranchiseFeeResponse getDetail(Long shopId);
Boolean auditFranchiseFee(AuditFranchiseFeeRequest request, LoginUserInfo user);
ApiResponse<Boolean> changePaymentStatus(FranchiseFeeCallBackRequest request);
}

View File

@@ -3,10 +3,16 @@ package com.cool.store.service;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dto.AmountDTO;
import com.cool.store.entity.LinePayDO;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.request.xgj.ReceiptCallBackRequest;
import com.cool.store.response.FranchiseFeePayInfoResponse;
import com.cool.store.response.bigdata.ApiResponse;
import com.cool.store.vo.LinePayVO;
import com.cool.store.vo.PartnerUserInfoVO;
import java.util.List;
/**
* @Author wxp
* @Date 2024/3/25 13:45
@@ -27,5 +33,25 @@ public interface LinePayService {
Long submitPayInfo(LinePaySubmitRequest followLog, PartnerUserInfoVO partnerUser);
Long submitFranchiseFeePayInfo(LinePaySubmitRequest request, String userId);
String getPaymentReceiptCode();
List<FranchiseFeePayInfoResponse> getFranchiseFeePayInfoList(Long shopId);
Boolean deleteFranchiseFeePayInfo(Long id,String userId);
FranchiseFeePayInfoResponse getById(Long id);
/**
* 推送数据到新管家
* @param shopId
* @param linePayDO
* @return
*/
Boolean pushPayInfo(Long shopId, LinePayDO linePayDO);
ApiResponse<Boolean> ReceiptCallBack(ReceiptCallBackRequest request);
}

View File

@@ -2,6 +2,9 @@ package com.cool.store.service;
import com.cool.store.dto.BatchStatusRefreshDTO;
import com.cool.store.dto.StatusRefreshDTO;
import com.cool.store.request.xgj.FranchiseFeeCallBackRequest;
import com.cool.store.request.xgj.ReceiptCallBackRequest;
import com.cool.store.response.bigdata.ApiResponse;
/**
* @Author suzhuhong
@@ -18,11 +21,9 @@ public interface OpenApiService {
*/
Boolean statusRefresh(StatusRefreshDTO statusRefreshDTO);
/**
* @Auther: wangshuo
* @Date: 2025/5/23
* @description:不是对外回调接口针对于已经在oa走完数据的我们手动调用接口批量修改数据只做云流水别的别用
*/
Boolean batchStatusRefreshYls(BatchStatusRefreshDTO batchStatusRefreshDTO);
ApiResponse<Boolean> changeReceiptStatus(ReceiptCallBackRequest request);
ApiResponse<Boolean> changePaymentStatus(FranchiseFeeCallBackRequest request);
}

View File

@@ -5,6 +5,9 @@ import com.cool.store.dto.ModifyPasswordDTO;
import com.cool.store.dto.XgjOrganizationDTO;
import com.cool.store.request.AuditRequest;
import com.cool.store.request.ZxjpApiRequest;
import com.cool.store.request.xgj.PushFranchiseFeeRequest;
import com.cool.store.request.xgj.ReceiptRequest;
import com.cool.store.response.XgjAccessTokenDTO;
import java.util.List;
@@ -23,6 +26,20 @@ public interface PushService {
*/
Boolean pushDataToXGJ(ZxjpApiRequest zxjpApiRequest);
/**
* 推送加盟账单到新管家
* @param request
* @return
*/
Boolean pushFranchiseFeeToXGJ(PushFranchiseFeeRequest request);
/**
* 推送收款单到新管家
* @param receiptRequest
* @return
*/
Boolean pushReceiptToXGJ(ReceiptRequest receiptRequest);
/**
* 推送数据到下游系统 POS
* @param zxjpApiRequest
@@ -62,6 +79,12 @@ public interface PushService {
List<XgjOrganizationDTO> getXgjOrganization(String parentId);
/**
* 获取新管家token
* @return
*/
XgjAccessTokenDTO getXgjAccessToken();

View File

@@ -132,4 +132,6 @@ public interface ShopService {
* @return
*/
List<UserDTO> getSubStageHandle(Long shopId,Integer subStage);
ShopStageInfoVO getShopStageStatus(Long shopId, Integer subStage);
}

View File

@@ -4,10 +4,7 @@ package com.cool.store.service.impl;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.MessageEnum;
import com.cool.store.enums.OrderSysTypeEnum;
import com.cool.store.enums.UserRoleEnum;
import com.cool.store.enums.*;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
@@ -17,6 +14,7 @@ import com.cool.store.request.BuildSettlerRequest;
import com.cool.store.response.BuildInformationResponse;
import com.cool.store.service.BuildInformationService;
import com.cool.store.mapper.BuildInformationMapper;
import com.cool.store.service.EnumInfoService;
import com.cool.store.service.PreparationService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.RedisConstantUtil;
@@ -32,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author EDY
@@ -43,6 +42,8 @@ public class BuildInformationServiceImpl implements BuildInformationService {
@Resource
private PlatformBuildDAO platformBuildDAO;
@Resource
private EnumInfoService enumInfoService;
@Resource
private RedisConstantUtil redisConstantUtil;
@Resource
private RedisUtilPool redisUtilPool;
@@ -119,9 +120,17 @@ public class BuildInformationServiceImpl implements BuildInformationService {
response.setDeclareGoodsType(orderSysInfoDO.getDeclareGoodsType());
}
if (StringUtils.isBlank(response.getXgjVicePresident())) {
EnterpriseUserDO user = userAuthMappingService.getUserByRoleEnumAndRegionId(UserRoleEnum.VICE_PRESIDENT_IN_CHARGE, shopInfo.getRegionId());
if (Objects.nonNull(user)) {
response.setXgjVicePresident(user.getName());
List<EnterpriseUserDO> userList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.VICE_PRESIDENT_IN_CHARGE, shopInfo.getRegionId());
if (CollectionUtils.isNotEmpty(userList)) {
List<EnumInfoDO> xgjVicePresidentList = enumInfoService.getByTypeCode(ZxjpEnum.XGJ_VICE_PRESIDENT.getCode());
List<String> userNameSet = userList.stream().map(EnterpriseUserDO::getName).collect(Collectors.toList());
List<String> xgjVicePresidentNameList = xgjVicePresidentList.stream().map(EnumInfoDO::getSysValue).collect(Collectors.toList());
List<String> resultUserNameList = userNameSet.stream()
.filter(xgjVicePresidentNameList::contains)
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(resultUserNameList)){
response.setXgjVicePresident(resultUserNameList.get(0));
}
}
}
//根据映射关系默认带出新管家组织

View File

@@ -1,5 +1,6 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo;
@@ -7,26 +8,28 @@ import com.cool.store.dao.*;
import com.cool.store.dto.*;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.*;
import com.cool.store.service.DataHandlerServer;
import com.cool.store.service.FranchiseFeeService;
import com.cool.store.service.PreparationService;
import com.cool.store.service.*;
import com.cool.store.utils.StringUtil;
import com.cool.store.utils.easyExcel.EasyExcelUtil;
import com.cool.store.utils.poi.DateUtils;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -43,6 +46,12 @@ import static com.cool.store.utils.poi.DateUtils.YYYY_MM_DD;
@Service
@Slf4j
public class DataHandlerServerImpl implements DataHandlerServer {
@Resource
private LinePayService linePayService;
@Resource
private OpenApiService openApiService;
@Resource
private LinePayDAO linePayDAO;
@Resource
private AcceptanceInfoDAO acceptanceInfoDAO;
@Resource
@@ -924,7 +933,7 @@ public class DataHandlerServerImpl implements DataHandlerServer {
ShopSubStageEnum shopSubStageEnum = ShopSubStageEnum.SHOP_STAGE_25;
List<Long> shopIds = shopAccountDAO.getShopId();
for (ShopStageInfoDO shopStageInfoDO : subStages) {
if (jdStageShopIds.contains(shopStageInfoDO.getShopId())){
if (jdStageShopIds.contains(shopStageInfoDO.getShopId())) {
continue;
}
LineInfoDO lineInfoDO = lineMap.get(shopStageInfoDO.getLineId());
@@ -980,12 +989,12 @@ public class DataHandlerServerImpl implements DataHandlerServer {
if (CollectionUtils.isEmpty(shopInfoList)) {
log.info("导入数据根据shopCode 未找到数据");
}
List<Long> shopIds = shopInfoList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
List<Long> shopIds = shopInfoList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
Map<String, List<ShopInfoDO>> shopMapByCode = shopInfoList.stream().collect(Collectors.groupingBy(ShopInfoDO::getShopCode));
//装修验收数据
List<AcceptanceInfoDO> acceptanceInfoDOList = acceptanceInfoDAO.selectByShopIds(shopIds);
Map<Long, AcceptanceInfoDO> acceptanceInfoMap = acceptanceInfoDOList.stream().collect(Collectors.toMap(AcceptanceInfoDO::getShopId, item -> item));
//合同阶段
//合同阶段
List<ShopStageInfoDO> signFranchiseStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
Map<Long, ShopStageInfoDO> signFranchiseStageMap = signFranchiseStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
//装修阶段需要变更的shopId
@@ -995,23 +1004,23 @@ public class DataHandlerServerImpl implements DataHandlerServer {
for (ImportOaOldShopDataDTO dto : list) {
String shopCode = dto.getShopCode();
List<ShopInfoDO> shopInfoDOS = shopMapByCode.get(shopCode);
if (CollectionUtils.isEmpty(shopInfoDOS)){
if (CollectionUtils.isEmpty(shopInfoDOS)) {
errorList.add(new ImportOaOldShopDataErrorDTO(dto.getShopCode(), "门店编码未找到"));
continue;
}
if (shopInfoDOS.size() > 1){
if (shopInfoDOS.size() > 1) {
errorList.add(new ImportOaOldShopDataErrorDTO(dto.getShopCode(), "门店编码重复"));
continue;
}
ShopInfoDO shopInfoDO = shopInfoDOS.get(0);
Long shopId = shopInfoDO.getId();
ShopStageInfoDO signFranchiseStage = signFranchiseStageMap.get(shopId);
if (!signFranchiseStage.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84.getShopSubStageStatus())){
if (!signFranchiseStage.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84.getShopSubStageStatus())) {
errorList.add(new ImportOaOldShopDataErrorDTO(dto.getShopCode(), "合同阶段未完成"));
continue;
}
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoMap.get(shopId);
if (Objects.isNull(acceptanceInfoDO)){
if (Objects.isNull(acceptanceInfoDO)) {
initFitmentShopIdList.add(shopId);
}
fitmentFhopIdList.add(shopId);
@@ -1021,7 +1030,7 @@ public class DataHandlerServerImpl implements DataHandlerServer {
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);
//装修表初始化
//装修表初始化
acceptanceInfoDAO.initAcceptanceInfo(initFitmentShopIdList);
if (!errorList.isEmpty()) {
task.setStatus(ImportTaskStatusEnum.ERROR.getCode());
@@ -1043,6 +1052,97 @@ public class DataHandlerServerImpl implements DataHandlerServer {
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean franchiseFeeStageDateHandler() {
//处理加盟费阶段待审核(对账中)
List<ShopStageInfoDO> waitAuditStageList = shopStageInfoDAO.getShopStageInfoByShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus());
log.info("waitAuditStageList:{}", JSONObject.toJSONString(waitAuditStageList));
List<Long> waitAuditShopIdList = waitAuditStageList.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
// shopStageInfoDAO.dataUpdateStatus(waitAuditShopIdList,ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_73);
franchiseFeeDAO.batchUpdateXgjCollectionStatus(waitAuditShopIdList, XGJCollectionStatusEnum.WAIT_PAY.getCode());
// linePayDAO.updateXgjClaimStatus(waitAuditShopIdList, ClaimStatusEnum.TO_BE_CLAIMED.getCode(), PayBusinessTypeEnum.FRANCHISE_FEE.getCode());
//已缴费 修改新管家回调状态
List<ShopStageInfoDO> isPaidStageList = shopStageInfoDAO.getShopStageInfoByShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_73.getShopSubStageStatus());
List<Long> isPaidShopId = isPaidStageList.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
List<FranchiseFeeDO> franchiseFeeByShopIds = franchiseFeeMapper.getFranchiseFeeByShopIds(isPaidShopId);
List<FranchiseFeeStageDateDTO> franchiseFeeStageDateDTOList = new ArrayList<>();
for (FranchiseFeeDO franchiseFeeDO : franchiseFeeByShopIds){
FranchiseFeeStageDateDTO dto = new FranchiseFeeStageDateDTO();
dto.setShopId(franchiseFeeDO.getShopId());
dto.setXgjCollectionStatus(XGJCollectionStatusEnum.COMPLETED.getCode());
dto.setXgjFeesPaid(dto.getXgjFeesPaid()
.add(new BigDecimal(franchiseFeeDO.getYearFranchiseFee()))
.add(new BigDecimal(franchiseFeeDO.getLoanMargin()))
.add(new BigDecimal(franchiseFeeDO.getFirstYearManageFee()))
.add(new BigDecimal(franchiseFeeDO.getPerformanceBond()))
.add(new BigDecimal(franchiseFeeDO.getFirstYearFee()))
);
franchiseFeeStageDateDTOList.add(dto);
}
franchiseFeeDAO.batchUpdateXgjCollectionStatusAndXgjFeesPaid(franchiseFeeStageDateDTOList);
// linePayDAO.updateXgjClaimStatus(isPaidShopId, ClaimStatusEnum.CLAIMED.getCode(), PayBusinessTypeEnum.FRANCHISE_FEE.getCode());
//待加盟商缴费阶段
List<ShopStageInfoDO> waitPayStageList = shopStageInfoDAO.getShopStageInfoByShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_71.getShopSubStageStatus());
List<Long> waitPayShopIds = waitPayStageList.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
franchiseFeeDAO.batchUpdateXgjCollectionStatus(waitPayShopIds, XGJCollectionStatusEnum.WAIT_PAY.getCode());
//审批拒绝阶段
List<ShopStageInfoDO> refuseStageList = shopStageInfoDAO.getShopStageInfoByShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_74.getShopSubStageStatus());
List<Long> refuseShopIds = refuseStageList.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
franchiseFeeDAO.batchUpdateXgjCollectionStatus(refuseShopIds, XGJCollectionStatusEnum.WAIT_PAY.getCode());
linePayDAO.deleteByShopId(refuseShopIds);
shopStageInfoDAO.dataUpdateStatus(refuseShopIds,ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_71);
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean franchiseFeeDateHandler(Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
List<LinePayDO> dateHandler = linePayDAO.getDateHandler();
List<ShopStageInfoDO> waitAuditStageList = shopStageInfoDAO.getShopStageInfoByShopSubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus());
log.info("waitAuditStageList:{}", JSONObject.toJSONString(waitAuditStageList));
List<Long> waitAuditShopIdList = waitAuditStageList.stream().map(ShopStageInfoDO::getShopId).collect(Collectors.toList());
for (LinePayDO linePayDO : dateHandler) {
JSONArray jsonArray = JSONObject.parseArray(linePayDO.getCombinedField());
JSONObject jsonObject = jsonArray.getJSONObject(0);
linePayDO.setPayTime(jsonObject.getDate("payTime"));
linePayDO.setPayPic(jsonObject.getString("payPic"));
if (waitAuditShopIdList.contains(linePayDO.getShopId())) {
linePayDO.setXgjClaimStatus(ClaimStatusEnum.TO_BE_CLAIMED.getCode());
if (StringUtils.isBlank(linePayDO.getPaymentReceiptCode())) {
linePayDO.setPaymentReceiptCode(linePayService.getPaymentReceiptCode());
}
} else {
linePayDO.setXgjClaimStatus(ClaimStatusEnum.CLAIMED.getCode());
}
}
linePayDAO.dataUpdateLinePay(dateHandler);
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean batchStatusRefreshYls(BatchStatusRefreshDTO batchStatusRefreshDTO) {
if (CollectionUtils.isEmpty(batchStatusRefreshDTO.getShopCode())) {
log.info("数据处理 门店编码为空");
return null;
}
for (String shopCode : batchStatusRefreshDTO.getShopCode()) {
StatusRefreshDTO statusRefreshDTO = new StatusRefreshDTO();
statusRefreshDTO.setShopCode(shopCode);
statusRefreshDTO.setSystemSource(batchStatusRefreshDTO.getSystemSource());
statusRefreshDTO.setOpenStatus(batchStatusRefreshDTO.getOpenStatus());
openApiService.statusRefresh(statusRefreshDTO);
}
List<String> shopCodeList = new ArrayList<>();
for (String shopCode : batchStatusRefreshDTO.getShopCode()) {
shopCodeList.add(StringUtils.substringAfter(shopCode, "_"));
}
posAndOrderInfoDAO.batchUpdateYlsRemarkByShopCode(shopCodeList, batchStatusRefreshDTO.getRemark());
return true;
}
private static @NotNull ShopStageInfoDO getShopStageInfoDO(ShopSubStageEnum shopSubStageEnum, ShopStageInfoDO shopStageInfoDO, ShopSubStageStatusEnum shopSubStageStatus) {
ShopStageEnum shopStageEnum = shopSubStageEnum.getShopStageEnum();
ShopStageInfoDO shopStageInfo = new ShopStageInfoDO();

View File

@@ -263,14 +263,11 @@ public class DeskServiceImpl implements DeskService {
//督导代填
if (userRoleIds.contains(UserRoleEnum.QW_SUPERVISION.getCode()) || userRoleIds.contains(UserRoleEnum.SUPERVISION.getCode())) {
pageInfo = commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_7,
Arrays.asList(SHOP_SUB_STAGE_STATUS_71.getShopSubStageStatus(), SHOP_SUB_STAGE_STATUS_74.getShopSubStageStatus()), Boolean.FALSE,keyword);
Arrays.asList(SHOP_SUB_STAGE_STATUS_71.getShopSubStageStatus(), SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus()), Boolean.FALSE,keyword);
} else {
if (userRoleIds.contains(UserRoleEnum.JOIN_OFFICE.getCode()) || userRoleIds.contains(UserRoleEnum.REGION_OFFICE.getCode())) {
subStageStatusList.add(SHOP_SUB_STAGE_STATUS_70.getShopSubStageStatus());
}
if (userRoleIds.contains(UserRoleEnum.BRANCH_OFFICE.getCode()) || userRoleIds.contains(UserRoleEnum.REGION_OFFICE.getCode())) {
subStageStatusList.add(SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus());
}
if (!subStageStatusList.isEmpty()) {
pageInfo = commonPendingVOPageInfo(pageNum, pageSize, user, ShopSubStageEnum.SHOP_STAGE_7,
subStageStatusList, Boolean.TRUE,keyword);

View File

@@ -13,8 +13,12 @@ import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.*;
import com.cool.store.request.AuditFranchiseFeeRequest;
import com.cool.store.request.FranchiseFeeRequest;
import com.cool.store.request.xgj.FranchiseFeeCallBackRequest;
import com.cool.store.request.xgj.PushFranchiseFeeRequest;
import com.cool.store.response.FranchiseFeeResponse;
import com.cool.store.response.bigdata.ApiResponse;
import com.cool.store.service.FranchiseFeeService;
import com.cool.store.service.PushService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.poi.constant.Constants;
import lombok.extern.slf4j.Slf4j;
@@ -57,6 +61,8 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
CommonService commonService;
@Resource
UserAuthMappingService userAuthMappingService;
@Resource
PushService pushService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -76,21 +82,38 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
if (Objects.nonNull(isExist)){
throw new ServiceException(ErrorCodeEnum.UNISSUED_STATEMENT_2);
}
franchiseFeeDO.setXgjCollectionStatus(XGJCollectionStatusEnum.WAIT_PAY.getCode());
franchiseFeeDO.setCreateTime(new Date());
franchiseFeeMapper.insertSelective(franchiseFeeDO);
}
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(request.getShopId());
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId());
commonService.sendSms(lineInfoDO.getMobile(), SMSMsgEnum.PAY_FRANCHISE_FEES);
//推送加盟费信息到新管家
PushFranchiseFeeRequest feeRequest = new PushFranchiseFeeRequest(shopInfoDO.getId(), lineInfoDO.getUsername(), franchiseFeeDO);
pushService.pushFranchiseFeeToXGJ(feeRequest);
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean update(FranchiseFeeRequest request) {
ShopStageInfoDO shopStageInfo = shopStageInfoDAO.getShopSubStageInfo(request.getShopId(), ShopSubStageEnum.SHOP_STAGE_7);
if (shopStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_73.getShopSubStageStatus())){
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
FranchiseFeeDO franchiseFeeDO = request.toFranchiseFeeDO();
FranchiseFeeDO franchiseFeeDO1 = franchiseFeeMapper.selectByShopId(request.getShopId());
if (Objects.nonNull(franchiseFeeDO1)) {
franchiseFeeDO.setId(franchiseFeeDO1.getId());
franchiseFeeMapper.updateByPrimaryKeySelective(franchiseFeeDO);
//推送数据
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(request.getShopId());
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId());
//推送加盟费信息到新管家
franchiseFeeDO.setCreateTime(franchiseFeeDO1.getCreateTime());
PushFranchiseFeeRequest feeRequest = new PushFranchiseFeeRequest(shopInfoDO.getId(), lineInfoDO.getUsername(), franchiseFeeDO);
pushService.pushFranchiseFeeToXGJ(feeRequest);
return true;
}
return false;
@@ -103,22 +126,6 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
return new FranchiseFeeResponse();
}
FranchiseFeeResponse resp = FranchiseFeeResponse.from(result);
LinePayDO linePayDO = linePayMapper.selectByPrimaryKey(result.getPayId());
if (Objects.nonNull(linePayDO)) {
FranchiseFeeResponse.LinePay linePayResult = FranchiseFeeResponse.LinePay.from(linePayDO);
if (Objects.nonNull(linePayDO.getLineId())){
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(linePayDO.getLineId());
linePayResult.setPartnerName(lineInfoDO.getUsername());
}
linePayResult.setAmount(new BigDecimal(result.getPerformanceBond()).add(new BigDecimal(result.getFirstYearFee())).add(new BigDecimal(result.getFirstYearManageFee()))
.add(new BigDecimal(result.getYearFranchiseFee())).add(new BigDecimal(result.getLoanMargin())).toString());
if (Objects.nonNull(result.getAuditId())) {
ShopAuditInfoDO shopAuditInfoDO = shopAuditInfoMapper.selectByPrimaryKey(result.getAuditId());
linePayResult.setStatus(shopAuditInfoDO.getResultType());
linePayResult.setResult(shopAuditInfoDO.getResultType() == 0 ? shopAuditInfoDO.getPassReason() : shopAuditInfoDO.getRejectReason());
}
resp.setLinePayDO(linePayResult);
}
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(shopId);
if (shopInfoDO.getPointId() != null ){
PointInfoDO pointInfoDO = pointInfoDAO.getPointInfoById(shopInfoDO.getPointId());
@@ -191,4 +198,25 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
// commonService.sendMessage(Collections.singletonList(lineInfoDO.getInvestmentManager()), MessageEnum.MESSAGE_18, requestMap);
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public ApiResponse<Boolean> changePaymentStatus(FranchiseFeeCallBackRequest request) {
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(request.getShopId());
if (Objects.isNull(shopInfoDO)){
return ApiResponse.error(ErrorCodeEnum.SHOP_ID_NOT_EXIST);
}
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(request.getShopId());
if (XGJCollectionStatusEnum.COMPLETED.getCode().equals(franchiseFeeDO.getXgjCollectionStatus())){
return ApiResponse.error(ErrorCodeEnum.XGJ_COLLECTION_STATUS_COMPLETE);
}
franchiseFeeDO.setXgjCollectionStatus(request.getPaymentStatus());
franchiseFeeDO.setXgjRemainderPayableAmount(request.getRemainingFee());
franchiseFeeDO.setXgjFeesPaid(request.getPaidFees());
franchiseFeeMapper.updateByPrimaryKeySelective(franchiseFeeDO);
if (XGJCollectionStatusEnum.COMPLETED.getCode().equals(request.getPaymentStatus())){
shopStageInfoDAO.updateShopStageInfo(request.getShopId(),ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_73);
}
return ApiResponse.success(Boolean.TRUE);
}
}

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.constants.RedisConstant;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.HyPartnerUserInfoDAO;
import com.cool.store.dao.LineInfoDAO;
@@ -14,21 +15,32 @@ import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.enums.point.PayTypeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.FranchiseFeeMapper;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.ShopInfoMapper;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.request.xgj.ReceiptCallBackRequest;
import com.cool.store.request.xgj.ReceiptRequest;
import com.cool.store.response.FranchiseFeePayInfoResponse;
import com.cool.store.response.bigdata.ApiResponse;
import com.cool.store.service.LinePayService;
import com.cool.store.service.PushService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.RedisConstantUtil;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.UUIDUtils;
import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants;
import com.cool.store.vo.LinePayVO;
import com.cool.store.vo.PartnerUserInfoVO;
import jdk.nashorn.internal.codegen.types.BooleanType;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -38,9 +50,14 @@ import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.cool.store.utils.poi.DateUtils.SPECIAL_DATE_START;
import static com.cool.store.utils.poi.DateUtils.YYYY_MM_DD_HH_MM_SS;
/**
* @Author wxp
* @Date 2024/3/28 13:48
@@ -50,6 +67,7 @@ import java.util.stream.Collectors;
@Slf4j
public class LinePayServiceImpl implements LinePayService {
@Value("${mybatis.configuration.variables.enterpriseId}")
private String eid;
@Resource
@@ -73,6 +91,10 @@ public class LinePayServiceImpl implements LinePayService {
private RedisUtilPool redisUtilPool;
@Resource
private UserAuthMappingService userAuthMappingService;
@Resource
RedisConstantUtil redisConstantUtil;
@Resource
PushService pushService;
@Override
public LinePayVO getLinePayInfo(Long lineId, Integer businessType, Long shopId) {
@@ -132,6 +154,204 @@ public class LinePayServiceImpl implements LinePayService {
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long submitFranchiseFeePayInfo(LinePaySubmitRequest request, String userId) {
log.info("submitPayInfo request{}userId{}", JSONObject.toJSONString(request), JSONObject.toJSONString(userId));
if (!checkSubmitFranchiseFeePayRequest(request)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
if (StringUtils.isBlank(userId)) {
throw new ServiceException(ErrorCodeEnum.ACCESS_TOKEN_INVALID);
}
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(request.getShopId());
//判断付款人最多2人可重复
List<LinePayDO> list = linePayDAO.getFranchiseFeePayInfoByShopId(request.getShopId());
Map<Long, LinePayDO> payIdMap = list.stream().collect(Collectors.toMap(LinePayDO::getId, Function.identity()));
if (request.getId()!=null){
payIdMap.remove(request.getId());
}
//判断缴费金额不能大于未缴费金额
BigDecimal total = payIdMap.values().stream()
.map(LinePayDO::getAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
//应缴金额
BigDecimal amountDue = new BigDecimal(franchiseFeeDO.getYearFranchiseFee())
.add(new BigDecimal(franchiseFeeDO.getLoanMargin()))
.add(new BigDecimal(franchiseFeeDO.getFirstYearFee()))
.add(new BigDecimal(franchiseFeeDO.getFirstYearManageFee()))
.add(new BigDecimal(franchiseFeeDO.getPerformanceBond()));
//未缴费金额
BigDecimal amountUnpaid = amountDue.subtract(total);
if( request.getAmount().compareTo(amountUnpaid) > 0 ){
throw new ServiceException(ErrorCodeEnum.PAY_AMOUNT_ERROR);
}
Set<String> payUserList = list.stream().map(LinePayDO::getPayUserName).collect(Collectors.toSet());
if (!payUserList.contains(request.getPayUserName()) && payUserList.size() >= 2) {
throw new ServiceException(ErrorCodeEnum.PAY_USER_NAME_ERROR);
}
if (request.getId() != null) {
LinePayDO linePayById = linePayDAO.getById(request.getId());
if (linePayById == null) {
throw new ServiceException(ErrorCodeEnum.UPDATE_ERROR);
}
if (linePayById.getXgjClaimStatus().equals(ClaimStatusEnum.CLAIMED.getCode())) {
throw new ServiceException(ErrorCodeEnum.CLAIM_STATUS_ERROR);
}
}
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(request.getShopId(), ShopSubStageEnum.SHOP_STAGE_7);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus())
&& !shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_71.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
String lockKey = "submitFranchiseFeePayInfo:lineId" + request.getLineId() + "shopId" + request.getShopId();
//流水
String lockValue = UUID.randomUUID().toString();
boolean acquired = false;
try {
//10s过期
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (Boolean.TRUE.equals(acquired)) {
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
LinePayDO linePayDO = LinePaySubmitRequest.convertFranchiseFee(request);
linePayDO.setPartnerId(lineInfo.getPartnerId());
linePayDO.setCreateUserId(userId);
linePayDO.setCreateTime(new Date());
if (linePayDO.getId() != null) {
LinePayDO linePayById = linePayDAO.getById(linePayDO.getId());
if (linePayById == null) {
log.info("linePayById is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_ERROR);
} else {
linePayDAO.updateLinePay(linePayDO);
}
linePayDO.setPaymentReceiptCode(linePayById.getPaymentReceiptCode());
} else {
linePayDO.setPaymentReceiptCode(getPaymentReceiptCode());
Long payId = linePayDAO.addLinePay(linePayDO);
linePayDO.setId(payId);
}
if (shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_71.getShopSubStageStatus())) {
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72);
}
//推送数据
this.pushPayInfo(request.getShopId(), linePayDO);
return linePayDO.getId();
} else {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
}
} finally {
if (Boolean.TRUE.equals(acquired)) {
String currentValue = redisUtilPool.getString(lockKey);
if (lockValue.equals(currentValue)) {
redisUtilPool.delKey(lockKey);
}
}
}
}
@Override
public String getPaymentReceiptCode() {
//当前日期
String today = CoolDateUtils.getToday();
String redisKey = redisConstantUtil.getPaymentReceiptCode(today);
Long sequence = redisUtilPool.incrby(redisKey, 1);
//第一次设置过期时间 一天
if (sequence == 1) {
redisUtilPool.expire(redisKey, RedisConstant.ONE_DAY_SECONDS);
}
return "12" + today + String.format("%04d", sequence);
}
@Override
public List<FranchiseFeePayInfoResponse> getFranchiseFeePayInfoList(Long shopId) {
List<LinePayDO> list = linePayDAO.getFranchiseFeePayInfoByShopId(shopId);
List<FranchiseFeePayInfoResponse> result = new ArrayList<>();
if (CollectionUtils.isEmpty(list)) {
return result;
}
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(shopId);
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId());
String username = lineInfoDO.getUsername();
for (LinePayDO linePayDO : list) {
FranchiseFeePayInfoResponse response = new FranchiseFeePayInfoResponse();
BeanUtil.copyProperties(linePayDO, response);
response.setPayTime(DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, linePayDO.getPayTime()));
response.setPartnerName(username);
result.add(response);
}
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteFranchiseFeePayInfo(Long id, String userId) {
LinePayDO linePay = linePayDAO.getById(id);
if (linePay == null) {
throw new ServiceException(ErrorCodeEnum.DELETE_ERROR);
}
if (linePay.getXgjClaimStatus().equals(ClaimStatusEnum.CLAIMED.getCode())) {
throw new ServiceException(ErrorCodeEnum.CLAIM_STATUS_ERROR);
}
linePayDAO.deleteById(id, userId);
//置为删除状态
linePay.setDeleted(Boolean.TRUE);
//推送数据
this.pushPayInfo(linePay.getShopId(), linePay);
return Boolean.TRUE;
}
@Override
public Boolean pushPayInfo(Long shopId, LinePayDO linePayDO) {
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(shopId);
ReceiptRequest receiptRequest = new ReceiptRequest(shopId, franchiseFeeDO.getId().intValue(), linePayDO);
//推送缴费单数据到新管家
pushService.pushReceiptToXGJ(receiptRequest);
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public ApiResponse<Boolean> ReceiptCallBack(ReceiptCallBackRequest request) {
LinePayDO linePayDO = linePayDAO.selectByPaymentReceiptCode(request.getReceiptId());
if (Objects.isNull(linePayDO)) {
return ApiResponse.error(ErrorCodeEnum.RECEIPT_NOT_EXIST);
}
linePayDO.setXgjClaimStatus(request.getClaimStatus());
linePayDAO.updateLinePay(linePayDO);
return ApiResponse.success(Boolean.TRUE);
}
@Override
public FranchiseFeePayInfoResponse getById(Long id) {
if (id == null) {
return null;
}
LinePayDO linePay = linePayDAO.getById(id);
if (linePay == null) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
FranchiseFeePayInfoResponse response = new FranchiseFeePayInfoResponse();
BeanUtil.copyProperties(linePay, response);
return response;
}
private Boolean checkSubmitFranchiseFeePayRequest(LinePaySubmitRequest request) {
if (StringUtils.isAnyBlank(request.getPayUserName(), request.getPayAccount(), request.getBankName(), request.getBranchBankName(),
request.getPayTime(), request.getPayPic())) {
return Boolean.FALSE;
}
if (Objects.isNull(request.getPayType()) || request.getLineId() == null || request.getShopId() == null) {
return Boolean.FALSE;
}
if (!request.getPayBusinessType().equals(PayBusinessTypeEnum.FRANCHISE_FEE.getCode())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long submitPayInfo(LinePaySubmitRequest request, PartnerUserInfoVO partnerUser) {
@@ -139,45 +359,44 @@ public class LinePayServiceImpl implements LinePayService {
if (Objects.isNull(request.getPayBusinessType())) {
request.setPayBusinessType(Constants.ZERO_INTEGER);
}
if (request.getPayBusinessType().equals(PayBusinessTypeEnum.FRANCHISE_FEE.getCode())) {
throw new ServiceException(ErrorCodeEnum.API_CALL_ERROR);
}
LineInfoDO lineInfo = new LineInfoDO();
if (request.getLineId() != null) {
lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
}
// //缴纳加盟费检验缴费人必须是加盟商
// if(PayBusinessTypeEnum.FRANCHISE_FEE.getCode().equals(request.getPayBusinessType()) && !lineInfo.getUsername().trim().equals(request.getPayUserName().trim())){
// throw new ServiceException(ErrorCodeEnum.CHECK_PAYER_ERROR);
// }
LinePayDO linePayDO = linePayDAO.getByLineIdAndPayTypeAndShopId(request.getLineId(), request.getPayBusinessType(), request.getShopId());
linePayDO = checkAndFill(linePayDO, request, partnerUser);
Long payId = linePayDO.getId();
if (PayBusinessTypeEnum.FRANCHISE_FEE.getCode().equals(request.getPayBusinessType()) && payId != null) {
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(request.getShopId());
if (Objects.isNull(franchiseFeeDO)) {
throw new ServiceException(ErrorCodeEnum.UNISSUED_STATEMENT);
}
franchiseFeeDO.setPayId(payId);
franchiseFeeMapper.updateByPrimaryKeySelective(franchiseFeeDO);
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72);
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(franchiseFeeDO.getShopId());
Set<String> auditFranchiseFeeUsers = new HashSet<>();
List<EnterpriseUserDO> branchUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.BRANCH_OFFICE, shopInfoDO.getRegionId());
if (Objects.nonNull(branchUser)) {
Set<String> branchUserIds = branchUser.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toSet());
auditFranchiseFeeUsers.addAll(branchUserIds);
}
List<EnterpriseUserDO> regionUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.REGION_OFFICE, shopInfoDO.getRegionId());
if (Objects.nonNull(regionUser)) {
Set<String> regionUserIds = regionUser.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toSet());
auditFranchiseFeeUsers.addAll(regionUserIds);
}
HashMap<String, String> map = new HashMap<>();
map.put("partnerUsername", lineInfo.getUsername());
map.put("partnerMobile", lineInfo.getMobile());
map.put("storeName", shopInfoDO.getShopName());
commonService.sendQWMessage(new ArrayList<>(auditFranchiseFeeUsers),
MessageEnum.MESSAGE_18,
map);
}
// if (PayBusinessTypeEnum.FRANCHISE_FEE.getCode().equals(request.getPayBusinessType()) && payId != null) {
// FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(request.getShopId());
// if (Objects.isNull(franchiseFeeDO)) {
// throw new ServiceException(ErrorCodeEnum.UNISSUED_STATEMENT);
// }
// franchiseFeeDO.setPayId(payId);
// franchiseFeeMapper.updateByPrimaryKeySelective(franchiseFeeDO);
// shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72);
// ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(franchiseFeeDO.getShopId());
// Set<String> auditFranchiseFeeUsers = new HashSet<>();
// List<EnterpriseUserDO> branchUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.BRANCH_OFFICE, shopInfoDO.getRegionId());
// if (Objects.nonNull(branchUser)) {
// Set<String> branchUserIds = branchUser.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toSet());
// auditFranchiseFeeUsers.addAll(branchUserIds);
// }
// List<EnterpriseUserDO> regionUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.REGION_OFFICE, shopInfoDO.getRegionId());
// if (Objects.nonNull(regionUser)) {
// Set<String> regionUserIds = regionUser.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toSet());
// auditFranchiseFeeUsers.addAll(regionUserIds);
// }
// HashMap<String, String> map = new HashMap<>();
// map.put("partnerUsername", lineInfo.getUsername());
// map.put("partnerMobile", lineInfo.getMobile());
// map.put("storeName", shopInfoDO.getShopName());
// commonService.sendQWMessage(new ArrayList<>(auditFranchiseFeeUsers),
// MessageEnum.MESSAGE_18,
// map);
// }
if (PayBusinessTypeEnum.INTENT_MONEY.getCode().equals(request.getPayBusinessType())) {
lineInfo.setWorkflowSubStage(WorkflowSubStageEnum.PAY_DEPOSIT.getCode());
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.PAY_DEPOSIT_50.getCode());
@@ -218,7 +437,7 @@ public class LinePayServiceImpl implements LinePayService {
linePayDO.setBranchBankName(request.getBranchBankName());
if (Objects.nonNull(request.getPayTime())) {
linePayDO.setPayTime(DateUtils.dateTime("yyyy-MM-dd HH:mm:ss", request.getPayTime()));
}else {
} else {
linePayDO.setPayTime(null);
}
linePayDO.setPayPic(request.getPayPic());
@@ -252,4 +471,5 @@ public class LinePayServiceImpl implements LinePayService {
}
}

View File

@@ -15,6 +15,11 @@ import com.cool.store.enums.ShopAccountEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.PostAndOrderRequest;
import com.cool.store.request.xgj.FranchiseFeeCallBackRequest;
import com.cool.store.request.xgj.ReceiptCallBackRequest;
import com.cool.store.response.bigdata.ApiResponse;
import com.cool.store.service.FranchiseFeeService;
import com.cool.store.service.LinePayService;
import com.cool.store.service.OpenApiService;
import com.cool.store.service.PosAndOrderInfoService;
import lombok.extern.slf4j.Slf4j;
@@ -49,6 +54,10 @@ public class OpenApiServiceImpl implements OpenApiService {
PosAndOrderInfoService posAndOrderInfoService;
@Resource
PosAndOrderInfoDAO posAndOrderInfoDAO;
@Resource
LinePayService linePayService;
@Resource
FranchiseFeeService franchiseFeeService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -87,25 +96,14 @@ public class OpenApiServiceImpl implements OpenApiService {
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean batchStatusRefreshYls(BatchStatusRefreshDTO batchStatusRefreshDTO) {
if (CollectionUtils.isEmpty(batchStatusRefreshDTO.getShopCode())){
log.info("数据处理 门店编码为空");
return null;
}
for (String shopCode : batchStatusRefreshDTO.getShopCode()){
StatusRefreshDTO statusRefreshDTO = new StatusRefreshDTO();
statusRefreshDTO.setShopCode(shopCode);
statusRefreshDTO.setSystemSource(batchStatusRefreshDTO.getSystemSource());
statusRefreshDTO.setOpenStatus(batchStatusRefreshDTO.getOpenStatus());
this.statusRefresh(statusRefreshDTO);
}
List<String> shopCodeList = new ArrayList<>();
for (String shopCode : batchStatusRefreshDTO.getShopCode()){
shopCodeList.add(StringUtils.substringAfter(shopCode, "_"));
}
posAndOrderInfoDAO.batchUpdateYlsRemarkByShopCode(shopCodeList,batchStatusRefreshDTO.getRemark());
return true;
public ApiResponse<Boolean> changeReceiptStatus(ReceiptCallBackRequest request) {
return linePayService.ReceiptCallBack(request);
}
@Override
public ApiResponse<Boolean> changePaymentStatus(FranchiseFeeCallBackRequest request) {
return franchiseFeeService.changePaymentStatus(request);
}
}

View File

@@ -7,6 +7,9 @@ import com.cool.store.dto.XgjOrganizationDTO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.ZxjpApiRequest;
import com.cool.store.request.xgj.PushFranchiseFeeRequest;
import com.cool.store.request.xgj.ReceiptRequest;
import com.cool.store.response.XgjAccessTokenDTO;
import com.cool.store.response.XgjBaseResponse;
import com.cool.store.response.XgjOrganizationResponse;
import com.cool.store.response.huoma.ShopBaseInfoResponse;
@@ -25,13 +28,14 @@ import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -60,6 +64,9 @@ public class PushServiceImpl implements PushService {
@Value("${xgj.api.auth.url}")
private String xgjUrl;
@Value("${xgj.api.token.url}")
private String xgjTokenUrl;
@Value("${xgj.api.auth.username}")
private String xgjUsername;
@@ -89,13 +96,33 @@ public class PushServiceImpl implements PushService {
@Value("${mybatis.configuration.variables.enterpriseId}")
private String eid;
@PostConstruct
public void init() {
okHttpClient = okHttpClient.newBuilder()
.connectTimeout(10, TimeUnit.SECONDS) // 连接超时
.readTimeout(30, TimeUnit.SECONDS) // 读取超时
.writeTimeout(30, TimeUnit.SECONDS) // 写入超时
.build();
}
@Override
public Boolean pushDataToXGJ(ZxjpApiRequest zxjpApiRequest) {
String apiUrl = xgjUrl + "/open/addStore";
String apiUrl = xgjUrl + "/dmp/one-id/open/addStore";
return executeApiCall(apiUrl, zxjpApiRequest, Boolean.class, xgjUsername, xgjSecret);
}
@Override
public Boolean pushFranchiseFeeToXGJ(PushFranchiseFeeRequest request) {
String apiUrl = xgjUrl + "/dmp/dmp-join/open/franchiseeBill";
return executePostApiCall(apiUrl, request, Boolean.class, xgjUsername, xgjSecret,getXgjAccessToken().getAccess_token());
}
@Override
public Boolean pushReceiptToXGJ(ReceiptRequest request) {
String apiUrl = xgjUrl + "/dmp/dmp-join/open/franchiseeReceipts";
return executePostApiCall(apiUrl, request, Boolean.class, xgjUsername, xgjSecret,getXgjAccessToken().getAccess_token());
}
@Override
public Boolean pushDataToPOS(ZxjpApiRequest zxjpApiRequest) {
String apiUrl = url + "/dzgV1/zxcrm/shop/upsert";
@@ -103,7 +130,7 @@ public class PushServiceImpl implements PushService {
}
private Boolean modifyXGJPassword(ModifyPasswordDTO dto) {
String apiUrl = xgjUrl + "/open/updateStorePassword";
String apiUrl = xgjUrl + "/dmp/one-id/open/updateStorePassword";
return executeApiCall(apiUrl, dto, Boolean.class, xgjUsername, xgjSecret);
}
@@ -113,6 +140,7 @@ public class PushServiceImpl implements PushService {
}
@Override
public Boolean modifyDownstreamSystem(ModifyPasswordDTO modifyPasswordDTO) {
this.modifyPosPassword(modifyPasswordDTO);
@@ -145,7 +173,7 @@ public class PushServiceImpl implements PushService {
String key = active+"_XgjOrganization_" + eid;
String resObject = redisUtilPool.getString(key);
if (StringUtils.isBlank(resObject)) {
String apiUrl = xgjUrl + "/open/organization";
String apiUrl = xgjUrl + "/dmp/one-id/open/organization";
resObject = JSONObject.toJSONString(executeApiGetCall(apiUrl, null, Object.class, xgjUsername, xgjSecret));
redisUtilPool.setNxExpire(key, resObject, 7200000);
}
@@ -168,13 +196,46 @@ public class PushServiceImpl implements PushService {
}
@Override
public XgjAccessTokenDTO getXgjAccessToken() {
String apiUrl = xgjTokenUrl + "/oauth2/token?grant_type=client_credentials&scope=server";
String clientId = "dmp-join";
String clientSecret = "dmp20250528";
String auth = clientId + ":" + clientSecret;
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes(StandardCharsets.UTF_8));
byte[] bytes = new byte[0];
Request request = new Request.Builder()
.url(apiUrl)
.post(RequestBody.create(MediaType.parse("application/json; charset=UTF-8"),bytes))
.header("Authorization", "Basic " + encodedAuth)
.build();
try (Response response = okHttpClient.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,
"HTTP请求失败状态码: " + response.code());
}
String responseBody = response.body().string();
XgjAccessTokenDTO xgjAccessTokenDTO = objectMapper.readValue(responseBody, XgjAccessTokenDTO.class);
return xgjAccessTokenDTO;
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
log.error("API调用异常 - URL: {}, 错误: {}", url, e.getMessage(), e);
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR, "接口调用异常: " + e.getMessage());
}
}
private <T> T executeApiCall(String url, Object requestBody, Class<T> responseType, String username, String secret) {
private <T> T executeApiCall(String url, Object requestBody, Class<T> responseType, String username, String secret){
return executePostApiCall(url,requestBody,responseType,username,secret,null);
}
private <T> T executePostApiCall(String url, Object requestBody, Class<T> responseType, String username, String secret,String accessToken) {
// 1. 打印请求前日志
logRequest(url, requestBody);
try {
Request request = buildRequest(requestBody, url, username, secret);
Request request = buildRequest(requestBody, url, username, secret,accessToken);
request.headers().names().forEach(x->{
log.info(x+": {}",request.header(x));
@@ -261,7 +322,7 @@ public class PushServiceImpl implements PushService {
}
private Request buildRequest(Object requestBody, String url, String username, String secret) {
private Request buildRequest(Object requestBody, String url, String username, String secret,String accessToken) {
try {
Map<String, String> authHeaders = HmacSigner.generateHeaders(
@@ -279,9 +340,13 @@ public class PushServiceImpl implements PushService {
.addHeader("Accept", "application/json")
.addHeader("x-Date", authHeaders.get("x-Date"))
.addHeader("Digest", authHeaders.get("Digest"));
if (!url.contains("get-token-byshopcode")){
if (!url.contains("get-token-byshopcode")&&StringUtils.isEmpty(accessToken)){
builder.addHeader("Authorization", authHeaders.get("Authorization"));
}
//新管家特定接口
if (StringUtils.isNotEmpty(accessToken)){
builder.addHeader("Authorization", "Bearer "+accessToken);
}
return builder.build();
} catch (Exception e) {
throw new ServiceException(ErrorCodeEnum.THIRD_API_SIGN_ERROR);

View File

@@ -781,7 +781,7 @@ public class ShopServiceImpl implements ShopService {
case SHOP_SUB_STAGE_STATUS_85:
return getUsersByRolesAndRegion(Arrays.asList(REGION_OFFICE, JOIN_OFFICE), shopInfo.getRegionId());
case SHOP_SUB_STAGE_STATUS_72:
// case SHOP_SUB_STAGE_STATUS_72:
case SHOP_SUB_STAGE_STATUS_83:
return getUsersByRolesAndRegion(Arrays.asList(REGION_OFFICE, BRANCH_OFFICE), shopInfo.getRegionId());
@@ -860,6 +860,18 @@ public class ShopServiceImpl implements ShopService {
}
}
@Override
public ShopStageInfoVO getShopStageStatus(Long shopId, Integer subStage) {
if(shopId == null|| subStage == null ){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
ShopStageInfoDO stage = shopStageInfoDAO.getByShopIdAndSubStage(shopId, subStage);
if (stage!=null){
return new ShopStageInfoVO(stage.getShopStage(), stage.getShopSubStage(), stage.getShopSubStageStatus(),stage.getIsTerminated());
}
return null;
}
/**
* 获取招商经理信息
* @param

View File

@@ -100,6 +100,18 @@ public class StoreServiceImpl implements StoreService {
case ONLINE_ORDER_NAME:
dto.setOrderMiniProgramName(entry.getValue());
break;
case TEST_JOIN_MODE:
case ONLINE_JOIN_MODE:
dto.setJoinMode(entry.getValue());
break;
case TEST_STORE_TYPE:
case ONLINE_STORE_TYPE:
dto.setStoreType(entry.getValue());
break;
case TEST_BRAND:
case ONLINE_BRAND:
dto.setBrand(entry.getValue());
break;
}
}
}

View File

@@ -71,6 +71,7 @@ public class SyncDataServiceImpl implements SyncDataService {
@Override
public ZxjpApiRequest getData(Long shopId, DownSystemTypeEnum systemType) {
ZxjpApiRequest request = new ZxjpApiRequest();
request.setShopId(shopId);
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if (shopInfo == null) {
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);