diff --git a/coolstore-partner-common/src/main/java/com/cool/store/constants/RedisConstant.java b/coolstore-partner-common/src/main/java/com/cool/store/constants/RedisConstant.java index 58c08cc73..6f27bf41c 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/constants/RedisConstant.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/constants/RedisConstant.java @@ -220,6 +220,11 @@ public class RedisConstant { public static final String PARTNER_INTENTINFO_CACHE_KEY = "partnerIntentInfoCache:{0}:{1}"; + public static final String PARTNER_WANTSHOPINFO_CACHE_KEY = "partnerWantShopInfoCache:{0}:{1}"; + + public static final String PARTNER_INDUSTRYCOGNITIONINFO_CACHE_KEY = "partnerIndustryCognitionInfoCache:{0}:{1}"; + + public static final String DEVICE_OPEN_TOKEN = "device_open_token:{0}:{1}:{2}"; public static final String PHONE_NUMBER= "phone_number_"; diff --git a/coolstore-partner-model/src/main/java/com/cool/store/request/IndustryCognitionInfoRequest.java b/coolstore-partner-model/src/main/java/com/cool/store/request/IndustryCognitionInfoRequest.java new file mode 100644 index 000000000..f72bfd05b --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/request/IndustryCognitionInfoRequest.java @@ -0,0 +1,57 @@ +package com.cool.store.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Author suzhuhong + * @Date 2023/5/30 15:14 + * @Version 1.0 + */ +@Data +@ApiModel +public class IndustryCognitionInfoRequest { + + @ApiModelProperty("线索表ID") + private Long partnerLineId; + + @ApiModelProperty("加盟商C端用户表ID partnerId ") + private String partnerId; + + @ApiModelProperty("学历") + private String education; + + @ApiModelProperty("工作年限") + private String workYear; + + @ApiModelProperty("是否具有工作经验") + private Integer isHaveWorkExp; + + @ApiModelProperty("工作或经商经验") + private String workExp; + + @ApiModelProperty("是否是消费者") + private Integer isConsumer; + + @ApiModelProperty("其他品牌") + private String otherBand; + + @ApiModelProperty("品牌优势") + private String brandStrength; + + @ApiModelProperty("需要改进") + private String needImprove; + + @ApiModelProperty("优势") + private String strength; + + @ApiModelProperty("劣势") + private String weakness; + + @ApiModelProperty("提交标识 提交-true 暂存-false") + private Boolean submitFlag; + +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/request/PartnerWantShopInfoRequest.java b/coolstore-partner-model/src/main/java/com/cool/store/request/PartnerWantShopInfoRequest.java new file mode 100644 index 000000000..38c63882e --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/request/PartnerWantShopInfoRequest.java @@ -0,0 +1,51 @@ +package com.cool.store.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Author wxp + * @Date 2023/5/30 15:14 + * @Version 1.0 + */ +@Data +@ApiModel +public class PartnerWantShopInfoRequest { + + @ApiModelProperty("线索表ID") + private Long partnerLineId; + + @ApiModelProperty("加盟商C端用户表ID partnerId ") + private String partnerId; + + @ApiModelProperty("常驻区域") + private String liveArea; + + @ApiModelProperty("意向开店区域") + private String wantShopArea; + + @ApiModelProperty("0不接受调剂、1全国调剂、2省内调剂、3市内调剂") + private Integer acceptAdjustType; + + @ApiModelProperty("是否有意向铺位") + private Integer isHaveWantShop; + + @ApiModelProperty("意向铺位信息,json字段,最多5个") + private List wantShopInfo; + + @ApiModelProperty("最大预算") + private String maxBudget; + + @ApiModelProperty("资金来源 1自有资金;2借贷资金;3部分自有、部分借代;4部分自有、部分亲友借代") + private String moneySource; + + @ApiModelProperty("资金证明") + private List moneyProve; + + @ApiModelProperty("提交标识 提交-true 暂存-false") + private Boolean submitFlag; + +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/HyPartnerIntentInfoService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/HyPartnerIntentInfoService.java index 07ec60356..918510f83 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/HyPartnerIntentInfoService.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/HyPartnerIntentInfoService.java @@ -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,15 @@ public interface HyPartnerIntentInfoService { String submitPartnerIntentInfo(PartnerIntentInfoRequest partnerIntentInfoRequest); + String submitWantShopInfo(PartnerWantShopInfoRequest request); + + String submitIndustryCognitionInfo(IndustryCognitionInfoRequest request); + PartnerIntentInfoVO queryPartnerIntentInfo(PartnerUserInfoVO userInfoVO, Long lineId); + PartnerIntentInfoVO queryWantShopInfo(PartnerUserInfoVO userInfoVO, Long lineId); + + PartnerIntentInfoVO queryIndustryCognitionInfo(PartnerUserInfoVO userInfoVO, Long lineId); + + } diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyPartnerIntentInfoServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyPartnerIntentInfoServiceImpl.java index 1fc22153b..4c82da4a6 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyPartnerIntentInfoServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyPartnerIntentInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.cool.store.service.impl; +import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSONObject; import com.cool.store.constants.CommonConstants; import com.cool.store.constants.RedisConstant; @@ -14,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; @@ -47,7 +50,6 @@ import java.util.stream.Collectors; @Service public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoService { - @Resource HyPartnerIntentInfoDAO hyPartnerIntentInfoDAO; @Resource @@ -157,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); @@ -183,6 +245,79 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic return intentInfoVO; } + @Override + public PartnerIntentInfoVO queryWantShopInfo(PartnerUserInfoVO userInfoVO, Long lineId) { + String cacheKey = MessageFormat.format(RedisConstant.PARTNER_WANTSHOPINFO_CACHE_KEY, userInfoVO.getPartnerId(), lineId); + if (StringUtils.isNotBlank(redisUtilPool.getString(cacheKey))) { + PartnerIntentInfoVO intentInfoVO = JSONObject.parseObject(redisUtilPool.getString(cacheKey), PartnerIntentInfoVO.class); + return intentInfoVO; + } + HyPartnerIntentInfoDO intentInfoDO = hyPartnerIntentInfoDAO.getByPartnerIdAndLineId(userInfoVO.getPartnerId(), lineId); + PartnerIntentInfoVO intentInfoVO = null; + if (intentInfoDO != null){ + intentInfoVO = convertPartnerIntentApplyInfoDOToVO(intentInfoDO); + }else { + intentInfoVO = new PartnerIntentInfoVO(); + } + if(StringUtils.isBlank(intentInfoVO.getLiveArea())){ + intentInfoVO.setLiveArea(userInfoVO.getLiveArea()); + } + if(StringUtils.isBlank(intentInfoVO.getWantShopArea())){ + intentInfoVO.setWantShopArea(userInfoVO.getWantShopArea()); + } + if(Objects.isNull(intentInfoVO.getAcceptAdjustType())){ + intentInfoVO.setAcceptAdjustType(userInfoVO.getAcceptAdjustType()); + } + return intentInfoVO; + } + + @Override + public PartnerIntentInfoVO queryIndustryCognitionInfo(PartnerUserInfoVO userInfoVO, Long lineId) { + String cacheKey = MessageFormat.format(RedisConstant.PARTNER_INDUSTRYCOGNITIONINFO_CACHE_KEY, userInfoVO.getPartnerId(), lineId); + if (StringUtils.isNotBlank(redisUtilPool.getString(cacheKey))) { + PartnerIntentInfoVO intentInfoVO = JSONObject.parseObject(redisUtilPool.getString(cacheKey), PartnerIntentInfoVO.class); + return intentInfoVO; + } + HyPartnerIntentInfoDO intentInfoDO = hyPartnerIntentInfoDAO.getByPartnerIdAndLineId(userInfoVO.getPartnerId(), lineId); + PartnerIntentInfoVO intentInfoVO = null; + if (intentInfoDO != null){ + intentInfoVO = convertPartnerIntentApplyInfoDOToVO(intentInfoDO); + } + 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()); diff --git a/coolstore-partner-webc/src/main/java/com/cool/store/controller/PartnerController.java b/coolstore-partner-webc/src/main/java/com/cool/store/controller/PartnerController.java index 7c6e9d064..d799f3609 100644 --- a/coolstore-partner-webc/src/main/java/com/cool/store/controller/PartnerController.java +++ b/coolstore-partner-webc/src/main/java/com/cool/store/controller/PartnerController.java @@ -110,11 +110,16 @@ public class PartnerController { return ResponseResult.success(hyPartnerClerkService.submitPartnerClerkInfo(partnerClerkInfoRequest)); } + @PostMapping(path = "/submitWantShopInfo") + @ApiOperation("提意向书意向信息") + public ResponseResult submitWantShopInfo(@RequestBody PartnerWantShopInfoRequest request){ + return ResponseResult.success(hyPartnerIntentInfoService.submitWantShopInfo(request)); + } - @PostMapping(path = "/submitPartnerIntentInfo") - @ApiOperation("提意向书意向信息/行业认知") - public ResponseResult submitPartnerIntentInfo(@RequestBody PartnerIntentInfoRequest partnerIntentInfoRequest){ - return ResponseResult.success(hyPartnerIntentInfoService.submitPartnerIntentInfo(partnerIntentInfoRequest)); + @PostMapping(path = "/submitIndustryCognitionInfo") + @ApiOperation("提意向书行业认知") + public ResponseResult submitIndustryCognitionInfo(@RequestBody IndustryCognitionInfoRequest request){ + return ResponseResult.success(hyPartnerIntentInfoService.submitIndustryCognitionInfo(request)); } @PostMapping(path = "/changePartnerClerkInfo") @@ -172,14 +177,24 @@ public class PartnerController { } - @GetMapping(path = "/queryPartnerIntentInfo") - @ApiOperation("查看意向申请书-意向信息/行业信息") + @GetMapping(path = "/queryWantShopInfo") + @ApiOperation("查看意向申请书-意向信息") @ApiImplicitParams({ @ApiImplicitParam(name = "lineId", value = "线索ID", required = false), }) - public ResponseResult queryPartnerIntentInfo(@RequestParam(value = "lineId",required = false)Long lineId){ + public ResponseResult queryWantShopInfo(@RequestParam(value = "lineId",required = false)Long lineId){ PartnerUserInfoVO userInfoVO = PartnerUserHolder.getUser(); - return ResponseResult.success(hyPartnerIntentInfoService.queryPartnerIntentInfo(userInfoVO, lineId)); + return ResponseResult.success(hyPartnerIntentInfoService.queryWantShopInfo(userInfoVO, lineId)); + } + + @GetMapping(path = "/queryIndustryCognitionInfo") + @ApiOperation("查看意向申请书-行业信息") + @ApiImplicitParams({ + @ApiImplicitParam(name = "lineId", value = "线索ID", required = false), + }) + public ResponseResult queryIndustryCognitionInfo(@RequestParam(value = "lineId",required = false)Long lineId){ + PartnerUserInfoVO userInfoVO = PartnerUserHolder.getUser(); + return ResponseResult.success(hyPartnerIntentInfoService.queryIndustryCognitionInfo(userInfoVO, lineId)); } @GetMapping(path = "/completeJoinNotice")