submitWantShopInfo

This commit is contained in:
wxp01309236
2023-06-26 19:16:12 +08:00
parent 18ef8cc073
commit ed03ed189d
6 changed files with 222 additions and 10 deletions

View File

@@ -1,7 +1,9 @@
package com.cool.store.service;
import com.cool.store.request.BaseUserInfoRequest;
import com.cool.store.request.IndustryCognitionInfoRequest;
import com.cool.store.request.PartnerIntentInfoRequest;
import com.cool.store.request.PartnerWantShopInfoRequest;
import com.cool.store.vo.PartnerIntentApplyInfoVO;
import com.cool.store.vo.PartnerIntentInfoVO;
import com.cool.store.vo.PartnerUserInfoVO;
@@ -41,6 +43,10 @@ public interface HyPartnerIntentInfoService {
String submitPartnerIntentInfo(PartnerIntentInfoRequest partnerIntentInfoRequest);
String submitWantShopInfo(PartnerWantShopInfoRequest request);
String submitIndustryCognitionInfo(IndustryCognitionInfoRequest request);
PartnerIntentInfoVO queryPartnerIntentInfo(PartnerUserInfoVO userInfoVO, Long lineId);
}

View File

@@ -15,7 +15,9 @@ import com.cool.store.enums.WorkflowStageEnum;
import com.cool.store.enums.WorkflowStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.BaseUserInfoRequest;
import com.cool.store.request.IndustryCognitionInfoRequest;
import com.cool.store.request.PartnerIntentInfoRequest;
import com.cool.store.request.PartnerWantShopInfoRequest;
import com.cool.store.service.HyPartnerIntentInfoService;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.StringUtil;
@@ -48,7 +50,6 @@ import java.util.stream.Collectors;
@Service
public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoService {
@Resource
HyPartnerIntentInfoDAO hyPartnerIntentInfoDAO;
@Resource
@@ -131,11 +132,6 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
String cacheKey = MessageFormat.format(RedisConstant.PARTNER_INTENTINFO_CACHE_KEY, request.getPartnerId(), request.getPartnerLineId());
if (StringUtils.isNotBlank(redisUtilPool.getString(cacheKey))) {
PartnerIntentInfoRequest oldRequest = JSONObject.parseObject(redisUtilPool.getString(cacheKey), PartnerIntentInfoRequest.class);
BeanUtil.copyProperties(request, oldRequest);
request = oldRequest;
}
if(!request.getSubmitFlag()){
// 自动保存时
redisUtilPool.setString(cacheKey, JSONObject.toJSONString(request), RedisConstant.ONE_DAY_SECONDS);
@@ -163,6 +159,66 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
return null;
}
@Override
public String submitWantShopInfo(PartnerWantShopInfoRequest request) {
log.info("HyPartnerClerkServiceImpl#submitWantShopInfo request:{}", JSONObject.toJSONString(request));
if (StringUtil.isBlank(request.getPartnerId()) || Objects.isNull(request.getPartnerLineId())){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
String cacheKey = MessageFormat.format(RedisConstant.PARTNER_WANTSHOPINFO_CACHE_KEY, request.getPartnerId(), request.getPartnerLineId());
if(!request.getSubmitFlag()){
// 自动保存时
redisUtilPool.setString(cacheKey, JSONObject.toJSONString(request), RedisConstant.ONE_DAY_SECONDS);
return "";
}
HyPartnerIntentInfoDO intentInfoDO = hyPartnerIntentInfoDAO.getByPartnerIdAndLineId(request.getPartnerId(), request.getPartnerLineId());
if(intentInfoDO == null){
intentInfoDO = new HyPartnerIntentInfoDO();
fillWantShopInfo(intentInfoDO, request);
hyPartnerIntentInfoDAO.insertSelective(intentInfoDO);
}else {
fillWantShopInfo(intentInfoDO, request);
hyPartnerIntentInfoDAO.updateByPrimaryKeySelective(intentInfoDO);
}
redisUtilPool.delKey(cacheKey);
if(StringUtils.isNotBlank(request.getWantShopArea())){
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(request.getPartnerId());
hyPartnerUserInfoDO.setWantShopArea(request.getWantShopArea());
hyPartnerUserInfoDO.setLiveArea(request.getLiveArea());
hyPartnerUserInfoDO.setAcceptAdjustType(request.getAcceptAdjustType());
hyPartnerUserInfoDAO.updateByPrimaryKeySelective(hyPartnerUserInfoDO);
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(Long.valueOf(request.getWantShopArea()));
return hyOpenAreaInfoDO != null ? hyOpenAreaInfoDO.getAreaStatus() : null;
}
return null;
}
@Override
public String submitIndustryCognitionInfo(IndustryCognitionInfoRequest request) {
log.info("HyPartnerClerkServiceImpl#submitPartnerIntentInfo request:{}", JSONObject.toJSONString(request));
if (StringUtil.isBlank(request.getPartnerId()) || Objects.isNull(request.getPartnerLineId())){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
String cacheKey = MessageFormat.format(RedisConstant.PARTNER_INDUSTRYCOGNITIONINFO_CACHE_KEY, request.getPartnerId(), request.getPartnerLineId());
if(!request.getSubmitFlag()){
// 自动保存时
redisUtilPool.setString(cacheKey, JSONObject.toJSONString(request), RedisConstant.ONE_DAY_SECONDS);
return "";
}
HyPartnerIntentInfoDO intentInfoDO = hyPartnerIntentInfoDAO.getByPartnerIdAndLineId(request.getPartnerId(), request.getPartnerLineId());
if(intentInfoDO == null){
intentInfoDO = new HyPartnerIntentInfoDO();
fillIndustryCognitionInfo(intentInfoDO, request);
hyPartnerIntentInfoDAO.insertSelective(intentInfoDO);
}else {
fillIndustryCognitionInfo(intentInfoDO, request);
hyPartnerIntentInfoDAO.updateByPrimaryKeySelective(intentInfoDO);
}
redisUtilPool.delKey(cacheKey);
return null;
}
@Override
public PartnerIntentInfoVO queryPartnerIntentInfo(PartnerUserInfoVO userInfoVO, Long lineId) {
String cacheKey = MessageFormat.format(RedisConstant.PARTNER_INTENTINFO_CACHE_KEY, userInfoVO.getPartnerId(), lineId);
@@ -189,6 +245,38 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
return intentInfoVO;
}
private void fillWantShopInfo(HyPartnerIntentInfoDO intentInfoDO, PartnerWantShopInfoRequest request) {
intentInfoDO.setPartnerId(request.getPartnerId());
intentInfoDO.setPartnerLineId(request.getPartnerLineId());
intentInfoDO.setLiveArea(request.getLiveArea());
intentInfoDO.setWantShopArea(request.getWantShopArea());
intentInfoDO.setAcceptAdjustType(request.getAcceptAdjustType());
intentInfoDO.setIsHaveWantShop(request.getIsHaveWantShop());
if (CollectionUtils.isNotEmpty(request.getWantShopInfo())){
intentInfoDO.setWantShopInfo(JSONObject.toJSONString(request.getWantShopInfo()));
}
intentInfoDO.setMaxBudget(request.getMaxBudget());
intentInfoDO.setMoneySource(request.getMoneySource());
if(CollectionUtils.isNotEmpty(request.getMoneyProve())){
intentInfoDO.setMoneyProve(JSONObject.toJSONString(request.getMoneyProve()));
}
}
private void fillIndustryCognitionInfo(HyPartnerIntentInfoDO intentInfoDO, IndustryCognitionInfoRequest request) {
intentInfoDO.setPartnerId(request.getPartnerId());
intentInfoDO.setPartnerLineId(request.getPartnerLineId());
intentInfoDO.setEducation(request.getEducation());
intentInfoDO.setWorkYear(request.getWorkYear());
intentInfoDO.setIsHaveWorkExp(request.getIsHaveWorkExp());
intentInfoDO.setWorkExp(request.getWorkExp());
intentInfoDO.setIsConsumer(request.getIsConsumer());
intentInfoDO.setOtherBand(request.getOtherBand());
intentInfoDO.setBrandStrength(request.getBrandStrength());
intentInfoDO.setNeedImprove(request.getNeedImprove());
intentInfoDO.setStrength(request.getStrength());
intentInfoDO.setWeakness(request.getWeakness());
}
private void fillIntentInfo(HyPartnerIntentInfoDO intentInfoDO, PartnerIntentInfoRequest request) {
intentInfoDO.setPartnerId(request.getPartnerId());
intentInfoDO.setPartnerLineId(request.getPartnerLineId());