redisUtilPool

This commit is contained in:
guohb
2024-06-04 15:44:55 +08:00
parent 8dc093df2d
commit e67ba6abdb
5 changed files with 88 additions and 90 deletions

View File

@@ -26,6 +26,8 @@ public class CommonConstants {
public static final int AN_HOUR_SECONDS = 3600; public static final int AN_HOUR_SECONDS = 3600;
public static final int TEN_SECONDS = 10;
/** /**
* 跟进任务通知缓存时间 1小时 * 跟进任务通知缓存时间 1小时
*/ */

View File

@@ -36,9 +36,15 @@ public class OpenAcceptanceInfoListVO {
@ApiModelProperty("战区Id") @ApiModelProperty("战区Id")
private Long regionId; private Long regionId;
@ApiModelProperty("所属区域") @ApiModelProperty("所属战区区域")
private String regionNodeName; private String regionNodeName;
@ApiModelProperty("大区Id")
private Long bigRegionId;
@ApiModelProperty("所属大区区域")
private String bigRegionNodeName;
@ApiModelProperty("计划开业时间") @ApiModelProperty("计划开业时间")
private Date planOpenTime; private Date planOpenTime;
@ApiModelProperty("新店开业结束时间") @ApiModelProperty("新店开业结束时间")

View File

@@ -19,6 +19,7 @@ import com.cool.store.response.SubmitLicenseResponse;
import com.cool.store.service.ApplyLicenseService; import com.cool.store.service.ApplyLicenseService;
import com.cool.store.service.CoolStoreStartFlowService; import com.cool.store.service.CoolStoreStartFlowService;
import com.cool.store.service.PreparationService; import com.cool.store.service.PreparationService;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.StringUtil; import com.cool.store.utils.StringUtil;
import com.cool.store.utils.poi.StringUtils; import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants; import com.cool.store.utils.poi.constant.Constants;
@@ -28,13 +29,11 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@@ -84,7 +83,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
LineInfoMapper lineInfoMapper; LineInfoMapper lineInfoMapper;
@Resource @Resource
StringRedisTemplate stringRedisTemplate; RedisUtilPool redisUtilPool;
@Override @Override
@@ -97,13 +96,13 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
String lockKey = "submitLicense:" + request.getShopId(); String lockKey = "submitLicense:" + request.getShopId();
String lockValue = UUID.randomUUID().toString(); String lockValue = UUID.randomUUID().toString();
boolean acquired = Boolean.FALSE; boolean acquired = Boolean.FALSE;
acquired = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 1, TimeUnit.SECONDS); acquired = redisUtilPool.setNxExpire(lockKey, lockValue, 10);
if (!acquired) { if (!acquired) {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION); throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
} }
LicenseTransactDO licenseTransactDO = request.toLicenseTransactDO(); LicenseTransactDO licenseTransactDO = request.toLicenseTransactDO();
//防止一直在页面提交 //防止一直在页面提交
if (licenseTransactDO.getId() == null){ if (licenseTransactDO.getId() == null) {
LicenseTransactDO license = applyLicenseMapper.selectByShopId(request.getShopId()); LicenseTransactDO license = applyLicenseMapper.selectByShopId(request.getShopId());
licenseTransactDO.setId(license.getId()); licenseTransactDO.setId(license.getId());
} }
@@ -138,7 +137,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
List<UserAuthMappingDO> userAuthByMappingIds = userAuthMappingMapper.getUserAuthByMappingIds(Collections.singletonList(String.valueOf(regionId))); List<UserAuthMappingDO> userAuthByMappingIds = userAuthMappingMapper.getUserAuthByMappingIds(Collections.singletonList(String.valueOf(regionId)));
if (CollectionUtils.isNotEmpty(userAuthByMappingIds)) { if (CollectionUtils.isNotEmpty(userAuthByMappingIds)) {
List<String> sendUserIds = userAuthByMappingIds.stream().map(UserAuthMappingDO::getUserId).collect(Collectors.toList()); List<String> sendUserIds = userAuthByMappingIds.stream().map(UserAuthMappingDO::getUserId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sendUserIds)){ if (CollectionUtils.isNotEmpty(sendUserIds)) {
sendUsers = enterpriseUserRoleMapper.getUserIdsByRoleIds(Collections.singletonList("130000000"), sendUserIds); sendUsers = enterpriseUserRoleMapper.getUserIdsByRoleIds(Collections.singletonList("130000000"), sendUserIds);
} }
} }
@@ -209,7 +208,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
submitLicenseResponse.setLicenseLegalPerson(storeDocument.getStoreDirector()); submitLicenseResponse.setLicenseLegalPerson(storeDocument.getStoreDirector());
submitLicenseResponse.setIssueTime(DateUtil.parseDate(storeDocument.getStoreBusinessDate())); submitLicenseResponse.setIssueTime(DateUtil.parseDate(storeDocument.getStoreBusinessDate()));
submitLicenseResponse.setLicenseAddress(storeDocument.getStoreBusinessAdd()); submitLicenseResponse.setLicenseAddress(storeDocument.getStoreBusinessAdd());
submitLicenseResponse.setValidity(storeBusinessValidPeriod ? null : DateUtil.parse(storeDocument.getStoreBusinessValidPeriod(),"yyyy-MM-dd")); submitLicenseResponse.setValidity(storeBusinessValidPeriod ? null : DateUtil.parse(storeDocument.getStoreBusinessValidPeriod(), "yyyy-MM-dd"));
submitLicenseResponse.setValidityType(storeBusinessValidPeriod ? 0 : 1); submitLicenseResponse.setValidityType(storeBusinessValidPeriod ? 0 : 1);
submitLicenseResponse.setOperator(storeDocument.getStoreDirector()); submitLicenseResponse.setOperator(storeDocument.getStoreDirector());
submitLicenseResponse.setFoodLicenseLegalPerson(storeDocument.getStoreFoodLicenseLegalRepresentative()); submitLicenseResponse.setFoodLicenseLegalPerson(storeDocument.getStoreFoodLicenseLegalRepresentative());

View File

@@ -24,14 +24,12 @@ import com.cool.store.vo.BusinessLicenseInfoVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
@Service @Service
@@ -75,10 +73,6 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@Resource @Resource
AliyunService aliyunService; AliyunService aliyunService;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean submit(IntentAgreementSubmitRequest request) { public boolean submit(IntentAgreementSubmitRequest request) {
@@ -150,8 +144,8 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
requestMap.put("partnerUsername", lineInfo.getUsername()); requestMap.put("partnerUsername", lineInfo.getUsername());
requestMap.put("lineId", String.valueOf(lineInfo.getId())); requestMap.put("lineId", String.valueOf(lineInfo.getId()));
requestMap.put("partnerMobile", lineInfo.getMobile()); requestMap.put("partnerMobile", lineInfo.getMobile());
commonService.sendMessage(Collections.singletonList(lineInfo.getInvestmentManager()),MessageEnum.MESSAGE_32,requestMap); commonService.sendMessage(Collections.singletonList(lineInfo.getInvestmentManager()), MessageEnum.MESSAGE_32, requestMap);
commonService.sendSms(lineInfo.getMobile(),SMSMsgEnum.INTENTION_PAYMENT_PASS); commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.INTENTION_PAYMENT_PASS);
} }
//更新auditId //更新auditId
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineInfo.getId()); SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineInfo.getId());
@@ -209,7 +203,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
String lockValue = UUID.randomUUID().toString(); String lockValue = UUID.randomUUID().toString();
boolean acquired = false; boolean acquired = false;
try { try {
acquired = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS); acquired = redisUtilPool.setNxExpire(lockKey, lockValue, 10);
if (Boolean.TRUE.equals(acquired)) { if (Boolean.TRUE.equals(acquired)) {
Map<String, Object> requestMap = new HashMap<>(); Map<String, Object> requestMap = new HashMap<>();
fillSignatureInfo(requestMap); fillSignatureInfo(requestMap);
@@ -231,14 +225,14 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO); lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
return new ResponseResult(200000, initiatingResponse.getMsg(), initiatingResponse.getData()); return new ResponseResult(200000, initiatingResponse.getMsg(), initiatingResponse.getData());
} }
}else { } else {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION); throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
} }
}finally { } finally {
if (Boolean.TRUE.equals(acquired)) { if (Boolean.TRUE.equals(acquired)) {
String currentValue = stringRedisTemplate.opsForValue().get(lockKey); String currentValue = redisUtilPool.getString(lockKey);
if (lockValue.equals(currentValue)) { if (lockValue.equals(currentValue)) {
stringRedisTemplate.delete(lockKey); redisUtilPool.delKey(lockKey);
} }
} }
} }
@@ -272,11 +266,10 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
} }
String lockKey = "saveFranchise:" + request.getLineId(); String lockKey = "saveFranchise:" + request.getLineId();
//流水
String lockValue = UUID.randomUUID().toString(); String lockValue = UUID.randomUUID().toString();
boolean acquired = false; boolean acquired = false;
try { try {
acquired = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS); acquired = redisUtilPool.setNxExpire(lockKey, lockValue, 10);
if (Boolean.TRUE.equals(acquired)) { if (Boolean.TRUE.equals(acquired)) {
Map<String, Object> requestMap = new HashMap<>(); Map<String, Object> requestMap = new HashMap<>();
fillSignatureInfo(requestMap); fillSignatureInfo(requestMap);
@@ -298,15 +291,15 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
if (Objects.isNull(lineInfoDO)) { if (Objects.isNull(lineInfoDO)) {
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST); throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
} }
if (StringUtil.isNotBlank(lineInfoDO.getPartnerNum())){ if (StringUtil.isNotBlank(lineInfoDO.getPartnerNum())) {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION); throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
} }
if (lineInfoDO.getPartnerNum() != null){ if (lineInfoDO.getPartnerNum() != null) {
return new ResponseResult(200000,null,null); return new ResponseResult(200000, null, null);
} }
if ("1".equals(lineInfoDO.getSex())){ if ("1".equals(lineInfoDO.getSex())) {
franchiseeDO.setSex(1); franchiseeDO.setSex(1);
}else if ("2".equals(lineInfoDO.getSex())){ } else if ("2".equals(lineInfoDO.getSex())) {
franchiseeDO.setSex(0); franchiseeDO.setSex(0);
} }
HyOpenAreaInfoDO openAreaInfoDO = openAreaInfoMapper.selectById(lineInfoDO.getWantShopAreaId()); HyOpenAreaInfoDO openAreaInfoDO = openAreaInfoMapper.selectById(lineInfoDO.getWantShopAreaId());
@@ -315,8 +308,8 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
franchiseeDO.setOperator(user.getJobNumber()); franchiseeDO.setOperator(user.getJobNumber());
MemberQuestionDO memberQuestionDO = joinIntentionMapper.getByLineId(lineInfoDO.getId()); MemberQuestionDO memberQuestionDO = joinIntentionMapper.getByLineId(lineInfoDO.getId());
//如果是企业加盟,需要传有效期和法人 //如果是企业加盟,需要传有效期和法人
if (Objects.nonNull(memberQuestionDO) && Constants.TWO_INTEGER.equals(memberQuestionDO.getJoinType())){ if (Objects.nonNull(memberQuestionDO) && Constants.TWO_INTEGER.equals(memberQuestionDO.getJoinType())) {
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null,lineInfoDO.getId()); SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineInfoDO.getId());
BusinessLicenseInfoVO businessLicenseInfo = aliyunService.getBusinessLicenseInfo(signingBaseInfoDO.getBusinessLicense()); BusinessLicenseInfoVO businessLicenseInfo = aliyunService.getBusinessLicenseInfo(signingBaseInfoDO.getBusinessLicense());
franchiseeDO.setBusinessTerm(businessLicenseInfo.getValidPeriod()); franchiseeDO.setBusinessTerm(businessLicenseInfo.getValidPeriod());
franchiseeDO.setLegalPerson(businessLicenseInfo.getLegalPerson()); franchiseeDO.setLegalPerson(businessLicenseInfo.getLegalPerson());
@@ -338,14 +331,14 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
} else { } else {
return new ResponseResult(200000, initiatingResponse.getMessage(), initiatingResponse.getData()); return new ResponseResult(200000, initiatingResponse.getMessage(), initiatingResponse.getData());
} }
}else { } else {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION); throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
} }
}finally { } finally {
if (Boolean.TRUE.equals(acquired)) { if (Boolean.TRUE.equals(acquired)) {
String currentValue = stringRedisTemplate.opsForValue().get(lockKey); String currentValue = redisUtilPool.getString(lockKey);
if (lockValue.equals(currentValue)) { if (lockValue.equals(currentValue)) {
stringRedisTemplate.delete(lockKey); redisUtilPool.delKey(lockKey);
} }
} }
} }
@@ -364,7 +357,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST); throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
} }
String auditResult = redisUtilPool.getString(redisKey); String auditResult = redisUtilPool.getString(redisKey);
if (WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode().equals(lineInfoDO.getWorkflowSubStageStatus())){ if (WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_70.getCode().equals(lineInfoDO.getWorkflowSubStageStatus())) {
//鲜丰系统不稳定会出现调用成功但内部状态未更改的情况这时直接返回true即可 //鲜丰系统不稳定会出现调用成功但内部状态未更改的情况这时直接返回true即可
return true; return true;
} }

View File

@@ -1,8 +1,8 @@
package com.cool.store.service.impl; package com.cool.store.service.impl;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo; import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.ShopStageInfoDAO; import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.entity.*; import com.cool.store.entity.*;
@@ -19,17 +19,16 @@ import com.cool.store.response.ResponseResult;
import com.cool.store.service.CoolStoreStartFlowService; import com.cool.store.service.CoolStoreStartFlowService;
import com.cool.store.service.PreparationService; import com.cool.store.service.PreparationService;
import com.cool.store.service.SignFranchiseService; import com.cool.store.service.SignFranchiseService;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.poi.DateUtils; import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.constant.Constants; import com.cool.store.utils.poi.constant.Constants;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
@Service @Service
@Slf4j @Slf4j
@@ -82,9 +81,8 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
@Resource @Resource
CommonService commonService; CommonService commonService;
@Resource @Resource
private StringRedisTemplate stringRedisTemplate; RedisUtilPool redisUtilPool;
@Override @Override
@@ -148,7 +146,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
boolean acquired = false; boolean acquired = false;
try { try {
//10s过期 //10s过期
acquired = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS); acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (Boolean.TRUE.equals(acquired)) { if (Boolean.TRUE.equals(acquired)) {
SignFranchiseDO signFranchiseDO = request.toSignFranchiseDO(); SignFranchiseDO signFranchiseDO = request.toSignFranchiseDO();
if (Objects.isNull(request.getId())) { if (Objects.isNull(request.getId())) {
@@ -160,7 +158,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(request.getShopId()); ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(request.getShopId());
FranchiseAgreementRequest franchiseAgreementRequest = convertFranchiseAgreement(request, shopInfoDO, user); FranchiseAgreementRequest franchiseAgreementRequest = convertFranchiseAgreement(request, shopInfoDO, user);
MemberQuestionDO memberQuestionDO = joinIntentionMapper.getByLineId(shopInfoDO.getLineId()); MemberQuestionDO memberQuestionDO = joinIntentionMapper.getByLineId(shopInfoDO.getLineId());
log.info("submitSignFranchise franchiseAgreementRequest :{}",JSONObject.toJSONString(franchiseAgreementRequest)); log.info("submitSignFranchise franchiseAgreementRequest :{}", JSONObject.toJSONString(franchiseAgreementRequest));
ResponseResult responseResult = coolStoreStartFlowService.franchiseAgreement(franchiseAgreementRequest, memberQuestionDO.getJoinType()); ResponseResult responseResult = coolStoreStartFlowService.franchiseAgreement(franchiseAgreementRequest, memberQuestionDO.getJoinType());
//更新状态为加盟商 //更新状态为加盟商
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId()); LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId());
@@ -168,15 +166,15 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
lineInfoMapper.insertOrUpdate(lineInfoDO); lineInfoMapper.insertOrUpdate(lineInfoDO);
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_83); shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_83);
return responseResult; return responseResult;
}else { } else {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION); throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
} }
}finally { } finally {
if (Boolean.TRUE.equals(acquired)) { if (Boolean.TRUE.equals(acquired)) {
String currentValue = stringRedisTemplate.opsForValue().get(lockKey); String currentValue = redisUtilPool.getString(lockKey);
if (lockValue.equals(currentValue)) { if (lockValue.equals(currentValue)) {
stringRedisTemplate.delete(lockKey); redisUtilPool.delKey(lockKey);
} }
} }
} }
@@ -192,47 +190,47 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
Long shopId = request.getShopId(); Long shopId = request.getShopId();
//线索信息 //线索信息
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId()); LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId());
if (Objects.isNull(lineInfoDO)){ if (Objects.isNull(lineInfoDO)) {
throw new ServiceException(109014,ApiErrorCodeEnum.getByCode("lineInfoDO").getErrorMessage()); throw new ServiceException(109014, ApiErrorCodeEnum.getByCode("lineInfoDO").getErrorMessage());
} }
//缴费信息 //缴费信息
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(shopId); FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(shopId);
if (Objects.isNull(franchiseFeeDO)){ if (Objects.isNull(franchiseFeeDO)) {
throw new ServiceException(109014,ApiErrorCodeEnum.getByCode("franchiseFeeDO").getErrorMessage()); throw new ServiceException(109014, ApiErrorCodeEnum.getByCode("franchiseFeeDO").getErrorMessage());
} }
//线索id //线索id
Long lineId = shopInfoDO.getLineId(); Long lineId = shopInfoDO.getLineId();
//签约信息 //签约信息
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineId); SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineId);
if (Objects.isNull(signingBaseInfoDO)){ if (Objects.isNull(signingBaseInfoDO)) {
throw new ServiceException(109014,ApiErrorCodeEnum.getByCode("signingBaseInfoDO").getErrorMessage()); throw new ServiceException(109014, ApiErrorCodeEnum.getByCode("signingBaseInfoDO").getErrorMessage());
} }
//缴款信息 //缴款信息
LinePayDO linePayDO = linePayMapper.getByLineIdAndPayTypeAndShopId(lineId, 1, shopId); LinePayDO linePayDO = linePayMapper.getByLineIdAndPayTypeAndShopId(lineId, 1, shopId);
if (Objects.isNull(linePayDO)){ if (Objects.isNull(linePayDO)) {
throw new ServiceException(109014,ApiErrorCodeEnum.getByCode("linePayDO").getErrorMessage()); throw new ServiceException(109014, ApiErrorCodeEnum.getByCode("linePayDO").getErrorMessage());
} }
//铺位信息 //铺位信息
PointInfoDO pointInfoDO = pointInfoMapper.getDataByShopIdAndLineId(lineId, shopId); PointInfoDO pointInfoDO = pointInfoMapper.getDataByShopIdAndLineId(lineId, shopId);
if (Objects.isNull(pointInfoDO)){ if (Objects.isNull(pointInfoDO)) {
throw new ServiceException(109014,ApiErrorCodeEnum.getByCode("pointInfoDO").getErrorMessage()); throw new ServiceException(109014, ApiErrorCodeEnum.getByCode("pointInfoDO").getErrorMessage());
} }
//建店数据 //建店数据
SystemBuildingShopDO systemBuildingShopDO = systemBuildingShopMapper.selectOne(SystemBuildingShopDO.builder().shopId(shopId).lineId(lineId).build()); SystemBuildingShopDO systemBuildingShopDO = systemBuildingShopMapper.selectOne(SystemBuildingShopDO.builder().shopId(shopId).lineId(lineId).build());
if (Objects.isNull(systemBuildingShopDO)){ if (Objects.isNull(systemBuildingShopDO)) {
throw new ServiceException(109014,ApiErrorCodeEnum.getByCode("systemBuildingShopDO").getErrorMessage()); throw new ServiceException(109014, ApiErrorCodeEnum.getByCode("systemBuildingShopDO").getErrorMessage());
} }
//证照办理 //证照办理
LicenseTransactDO licenseTransactDO = applyLicenseMapper.selectByShopId(shopId); LicenseTransactDO licenseTransactDO = applyLicenseMapper.selectByShopId(shopId);
if (Objects.isNull(licenseTransactDO)){ if (Objects.isNull(licenseTransactDO)) {
throw new ServiceException(109014,ApiErrorCodeEnum.getByCode("licenseTransactDO").getErrorMessage()); throw new ServiceException(109014, ApiErrorCodeEnum.getByCode("licenseTransactDO").getErrorMessage());
} }
ThirdDepartmentDO thirdDepartmentDO = new ThirdDepartmentDO(); ThirdDepartmentDO thirdDepartmentDO = new ThirdDepartmentDO();
if (Objects.nonNull(systemBuildingShopDO)) { if (Objects.nonNull(systemBuildingShopDO)) {
//三方部门表 //三方部门表
thirdDepartmentDO = thirdDepartmentMapper.getByName(systemBuildingShopDO.getBigName()); thirdDepartmentDO = thirdDepartmentMapper.getByName(systemBuildingShopDO.getBigName());
if (Objects.isNull(thirdDepartmentDO)){ if (Objects.isNull(thirdDepartmentDO)) {
throw new ServiceException(109014,ApiErrorCodeEnum.getByCode("thirdDepartmentDO").getErrorMessage()); throw new ServiceException(109014, ApiErrorCodeEnum.getByCode("thirdDepartmentDO").getErrorMessage());
} }
} }
//找不到的url统一用这个 //找不到的url统一用这个
@@ -254,12 +252,12 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
.hkbzj(Integer.valueOf(franchiseFeeDO.getLoanMargin())) .hkbzj(Integer.valueOf(franchiseFeeDO.getLoanMargin()))
.hkbzjdx(Integer.valueOf(franchiseFeeDO.getLoanMargin())) .hkbzjdx(Integer.valueOf(franchiseFeeDO.getLoanMargin()))
.hkbzjwb(Convert.digitToChinese(Integer.valueOf(franchiseFeeDO.getLoanMargin()))) .hkbzjwb(Convert.digitToChinese(Integer.valueOf(franchiseFeeDO.getLoanMargin())))
.ht_day(timeUtils(request.getContractStartTime(),"day")) .ht_day(timeUtils(request.getContractStartTime(), "day"))
.ht_day2(timeUtils(request.getContractStartEndTime(),"day")) .ht_day2(timeUtils(request.getContractStartEndTime(), "day"))
.ht_month1(timeUtils(request.getContractStartTime(),"month")) .ht_month1(timeUtils(request.getContractStartTime(), "month"))
.ht_month2(timeUtils(request.getContractStartEndTime(),"month")) .ht_month2(timeUtils(request.getContractStartEndTime(), "month"))
.ht_year1(timeUtils(request.getContractStartTime(),"year")) .ht_year1(timeUtils(request.getContractStartTime(), "year"))
.ht_year2(timeUtils(request.getContractStartEndTime(),"year")) .ht_year2(timeUtils(request.getContractStartEndTime(), "year"))
.idcard_1(Collections.singletonList(signingBaseInfoDO.getIdCardFront())) .idcard_1(Collections.singletonList(signingBaseInfoDO.getIdCardFront()))
.idcard_2(Collections.singletonList(signingBaseInfoDO.getIdCardReverse())) .idcard_2(Collections.singletonList(signingBaseInfoDO.getIdCardReverse()))
.idcard_address(signingBaseInfoDO.getIdCardAddress()) .idcard_address(signingBaseInfoDO.getIdCardAddress())
@@ -276,26 +274,26 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
.jmf2(Integer.valueOf(franchiseFeeDO.getFirstYearFee())) .jmf2(Integer.valueOf(franchiseFeeDO.getFirstYearFee()))
.jmf3(Integer.valueOf(franchiseFeeDO.getSecondYearFee())) .jmf3(Integer.valueOf(franchiseFeeDO.getSecondYearFee()))
.jmf4(Integer.valueOf(franchiseFeeDO.getThirdYearFee())) .jmf4(Integer.valueOf(franchiseFeeDO.getThirdYearFee()))
.jmfday1(timeUtils(franchiseFeeDO.getFirstYearStartTime(),"day")) .jmfday1(timeUtils(franchiseFeeDO.getFirstYearStartTime(), "day"))
.jmfday2(timeUtils(franchiseFeeDO.getFirstYearEndTime(),"day")) .jmfday2(timeUtils(franchiseFeeDO.getFirstYearEndTime(), "day"))
.jmfday3(timeUtils(franchiseFeeDO.getSecondYearStartTime(),"day")) .jmfday3(timeUtils(franchiseFeeDO.getSecondYearStartTime(), "day"))
.jmfday4(timeUtils(franchiseFeeDO.getSecondYearEndTime(),"day")) .jmfday4(timeUtils(franchiseFeeDO.getSecondYearEndTime(), "day"))
.jmfday5(timeUtils(franchiseFeeDO.getThirdYearStartTime(),"day")) .jmfday5(timeUtils(franchiseFeeDO.getThirdYearStartTime(), "day"))
.jmfday6(timeUtils(franchiseFeeDO.getThirdYearEndTime(),"day")) .jmfday6(timeUtils(franchiseFeeDO.getThirdYearEndTime(), "day"))
.jmfdx(Integer.valueOf(franchiseFeeDO.getYearFranchiseFee())) .jmfdx(Integer.valueOf(franchiseFeeDO.getYearFranchiseFee()))
.jmfmonth1(timeUtils(franchiseFeeDO.getFirstYearStartTime(),"month")) .jmfmonth1(timeUtils(franchiseFeeDO.getFirstYearStartTime(), "month"))
.jmfmonth2(timeUtils(franchiseFeeDO.getFirstYearEndTime(),"month")) .jmfmonth2(timeUtils(franchiseFeeDO.getFirstYearEndTime(), "month"))
.jmfmonth3(timeUtils(franchiseFeeDO.getSecondYearStartTime(),"month")) .jmfmonth3(timeUtils(franchiseFeeDO.getSecondYearStartTime(), "month"))
.jmfmonth4(timeUtils(franchiseFeeDO.getSecondYearEndTime(),"month")) .jmfmonth4(timeUtils(franchiseFeeDO.getSecondYearEndTime(), "month"))
.jmfmonth5(timeUtils(franchiseFeeDO.getThirdYearStartTime(),"month")) .jmfmonth5(timeUtils(franchiseFeeDO.getThirdYearStartTime(), "month"))
.jmfmonth6(timeUtils(franchiseFeeDO.getThirdYearEndTime(),"month")) .jmfmonth6(timeUtils(franchiseFeeDO.getThirdYearEndTime(), "month"))
.jmfwb(Convert.digitToChinese(Integer.valueOf(franchiseFeeDO.getYearFranchiseFee()))) .jmfwb(Convert.digitToChinese(Integer.valueOf(franchiseFeeDO.getYearFranchiseFee())))
.jmfyear1(timeUtils(franchiseFeeDO.getFirstYearStartTime(),"year")) .jmfyear1(timeUtils(franchiseFeeDO.getFirstYearStartTime(), "year"))
.jmfyear2(timeUtils(franchiseFeeDO.getFirstYearEndTime(),"year")) .jmfyear2(timeUtils(franchiseFeeDO.getFirstYearEndTime(), "year"))
.jmfyear3(timeUtils(franchiseFeeDO.getSecondYearStartTime(),"year")) .jmfyear3(timeUtils(franchiseFeeDO.getSecondYearStartTime(), "year"))
.jmfyear4(timeUtils(franchiseFeeDO.getSecondYearEndTime(),"year")) .jmfyear4(timeUtils(franchiseFeeDO.getSecondYearEndTime(), "year"))
.jmfyear5(timeUtils(franchiseFeeDO.getThirdYearStartTime(),"year")) .jmfyear5(timeUtils(franchiseFeeDO.getThirdYearStartTime(), "year"))
.jmfyear6(timeUtils(franchiseFeeDO.getThirdYearEndTime(),"year")) .jmfyear6(timeUtils(franchiseFeeDO.getThirdYearEndTime(), "year"))
.jmsdkjt(temp) .jmsdkjt(temp)
.jmsdm(lineInfoDO.getPartnerNum()) .jmsdm(lineInfoDO.getPartnerNum())
.jmshtzt(0) .jmshtzt(0)
@@ -472,7 +470,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean rePay(Long shopId) { public Boolean rePay(Long shopId) {
shopStageInfoDAO.updateShopStageInfo(shopId,ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_74); shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_74);
shopStageInfoDAO.updateShopStageToNotStarted(shopId, ShopSubStageEnum.SHOP_STAGE_8); shopStageInfoDAO.updateShopStageToNotStarted(shopId, ShopSubStageEnum.SHOP_STAGE_8);
return true; return true;
} }
@@ -480,13 +478,13 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
private int timeUtils(Date time, String type) { private int timeUtils(Date time, String type) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(time); calendar.setTime(time);
switch (type){ switch (type) {
case "year": case "year":
return calendar.get(Calendar.YEAR); return calendar.get(Calendar.YEAR);
case "month": case "month":
return calendar.get(Calendar.MONTH) + 1; return calendar.get(Calendar.MONTH) + 1;
case "day": case "day":
return calendar.get(Calendar.DAY_OF_MONTH); return calendar.get(Calendar.DAY_OF_MONTH);
default: default:
return 0; return 0;
} }