Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner

This commit is contained in:
pserimal
2023-06-25 18:28:45 +08:00
19 changed files with 155 additions and 45 deletions

View File

@@ -66,7 +66,7 @@ public class CoolDateUtils {
LocalDate today = LocalDate.now();
LocalDate thirdDay = today.plusDays(day);
LocalDateTime thirdDayMidnight = LocalDateTime.of(thirdDay, LocalTime.MIDNIGHT);
LocalDateTime thirdDay235959 = thirdDayMidnight.with(LocalTime.MAX);
LocalDateTime thirdDay235959 = thirdDayMidnight.with(LocalTime.MIN);
ZonedDateTime zonedDateTime = ZonedDateTime.of(thirdDay235959, ZoneId.systemDefault());
return Date.from(zonedDateTime.toInstant());
}

View File

@@ -0,0 +1,30 @@
package com.cool.store.dao;
import com.cool.store.entity.HyPartnerTaskInfoLogDO;
import com.cool.store.mapper.HyPartnerTaskInfoLogMapper;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
/**
* @Author wxp
* @Date 2023/6/25 19:41
* @Version 1.0
*/
@Repository
public class HyPartnerTaskInfoLogDAO {
@Resource
HyPartnerTaskInfoLogMapper hyPartnerTaskInfoLogMapper;
public int updateByPrimaryKeySelective(HyPartnerTaskInfoLogDO hyPartnerTaskInfoLogDO){
return hyPartnerTaskInfoLogMapper.updateByPrimaryKeySelective(hyPartnerTaskInfoLogDO);
}
public int insertSelective( HyPartnerTaskInfoLogDO record){
return hyPartnerTaskInfoLogMapper.insertSelective(record);
}
}

View File

@@ -238,6 +238,7 @@
<update id="updateByPartnerId">
update hy_partner_base_info
<set>
update_time=now(),
<if test="userName != null and userName!=''">
username = #{userName},
</if>

View File

@@ -264,7 +264,7 @@
b.want_shop_area as wantShopArea,
b.accept_adjust_type as acceptAdjustType,
b.deadline as deadline
from hy_partner_intent_info b left join hy_partner_line_info a on a.id = b.partner_line_id
from hy_partner_line_info a right join hy_partner_intent_info b on a.id = b.partner_line_id
<where>
<if test="userId!=null and userId!=''">
and a.investment_manager = #{userId}

View File

@@ -315,15 +315,11 @@
b.interviewer as interviewer,
b.create_time as createTime,
b.room_id as roomId
from hy_partner_interview a inner join hy_partner_interview_plan b on a.interview_plan_id = b.id
<where>
<if test="userId!=null and userId!=''">
and a.interviewer = #{userId}
</if>
<if test="workflowStatus!=null and workflowStatus!=''">
and a.status = #{workflowStatus}
</if>
</where>
from hy_partner_interview a left join hy_partner_interview_plan b on a.interview_plan_id = b.id
where a.status = #{workflowStatus}
<if test="userId!=null and userId!=''">
and a.interviewer = #{userId}
</if>
</select>
<select id="getInterviewList" resultType="com.cool.store.vo.interview.InterviewVO">

View File

@@ -265,7 +265,7 @@
select
IFNULL(sum(if(workflow_stage=1 and workflow_status = 1,1,0)),0) as intentApplyApproveCount,
IFNULL(sum(if(workflow_stage=2 and workflow_status = 1,1,0)),0) as reservationInterviewCount,
IFNULL(sum(if(workflow_stage=3 and workflow_status = 3,1,0)),0) as qualifiedInterviewCount
IFNULL(sum(if(workflow_stage=3 and workflow_status = 4,1,0)),0) as qualifiedInterviewCount
from hy_partner_line_info
<where>
<if test="userId!=null and userId!=''">
@@ -277,9 +277,9 @@
<select id="selectStageFollowCount" resultType="com.cool.store.dto.partner.StageCountDTO">
select
IFNULL(sum(if(workflow_stage=1 and workflow_status = 1,1,0)),0) as intentApplyApproveCount,
IFNULL(sum(if(workflow_stage=1 and workflow_status = 0,1,0)),0) as intentApplyApproveCount,
IFNULL(sum(if(workflow_stage=2 and workflow_status = 0,1,0)),0) as reservationInterviewCount,
IFNULL(sum(if(workflow_stage=3 and workflow_status = 4,1,0)),0) as qualifiedInterviewCount
IFNULL(sum(if(workflow_stage=3 and workflow_status = 5,1,0)),0) as qualifiedInterviewCount
from hy_partner_line_info
<where>
<if test="userId!=null and userId!=''">

View File

@@ -11,7 +11,7 @@
<result column="message" jdbcType="VARCHAR" property="message" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="partner_id" jdbcType="BIGINT" property="partnerId" />
<result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.HyPartnerTaskInfoLogDO">
<result column="field_copy" jdbcType="LONGVARCHAR" property="fieldCopy" />

View File

@@ -46,8 +46,18 @@ public class HyPartnerTaskInfoLogDO implements Serializable {
private Date updateTime;
@ApiModelProperty("hy_partner_user_info.partner_id")
private Long partnerId;
private String partnerId;
@ApiModelProperty("字段备份")
private String fieldCopy;
public HyPartnerTaskInfoLogDO(String partnerId, Long partnerLineId, String workflowStage, String workflowStatus, String operateUserId, String operateUsername, String message) {
this.partnerId = partnerId;
this.partnerLineId = partnerLineId;
this.workflowStage = workflowStage;
this.workflowStatus = workflowStatus;
this.operateUserId = operateUserId;
this.operateUsername = operateUsername;
this.message = message;
}
}

View File

@@ -29,7 +29,7 @@ public class BaseUserInfoRequest {
private String wantShopArea;
@ApiModelProperty("意向开店区域Name")
private Long wantShopAreaName;
private String wantShopAreaName;
@ApiModelProperty("0不接受调剂、1全国调剂、2省内调剂、3市内调剂")
private Integer acceptAdjustType;

View File

@@ -1,5 +1,6 @@
package com.cool.store.vo;
import com.cool.store.request.WantShopInfoRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -27,7 +28,7 @@ public class PartnerIntentInfoVO {
private String workflowStage;
private String workflowStauts;
private String workflowStatus;
@ApiModelProperty("加盟商手机号")
private String partnerUserPhone;
@@ -51,7 +52,7 @@ public class PartnerIntentInfoVO {
private Integer isHaveWantShop;
@ApiModelProperty("意向铺位信息,json字段,最多5个")
private String wantShopInfo;
private List<WantShopInfoVO> wantShopInfo;
@ApiModelProperty("最大预算")
private String maxBudget;

View File

@@ -0,0 +1,43 @@
package com.cool.store.vo;
import com.cool.store.request.WantShopInfoRequest;
import lombok.Data;
/**
* @Author suzhuhong
* @Date 2023/6/25 15:53
* @Version 1.0
*/
@Data
public class WantShopInfoVO {
private ShopInfoVO shopInfo;
private String uuid;
@Data
static class ShopInfoVO{
private ShopAddressVO shopAddress;
private String storeIsTakeDown;
private String takeDown;
}
@Data
static class ShopAddressVO{
private String address;
private String longitude;
private String latitude;
}
}

View File

@@ -68,9 +68,8 @@ public class WechatRest {
return accessToken;
}
String reqUrl = String.format(ACCESS_TOKEN, appId, secret);
JSONObject jsonObject = null;
try {
jsonObject = httpRestTemplateService.getForObject(reqUrl, JSONObject.class, new HashMap());
JSONObject jsonObject = httpRestTemplateService.getForObject(reqUrl, JSONObject.class, new HashMap());
log.info("WechatRest#getAccessToken, reqUrl:{}, response:{}", reqUrl, JSONObject.toJSONString(jsonObject));
String token = jsonObject.getString("access_token");
if (StringUtils.isBlank(token)) {

View File

@@ -22,7 +22,7 @@ public interface HyPartnerBaseInfoService {
*/
Boolean addTags(AddTagsRequest addTagsRequest);
Boolean submitPartnerBaseInfo(PartnerBaseInfoRequest request);
Boolean submitPartnerBaseInfo(PartnerBaseInfoRequest request, PartnerUserInfoVO currentUser);
PartnerBaseInfoVO queryPartnerBaseInfo(String partnerId, Long lineId);

View File

@@ -5,9 +5,11 @@ import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.RedisConstant;
import com.cool.store.dao.HyPartnerBaseInfoDAO;
import com.cool.store.dao.HyPartnerLineInfoDAO;
import com.cool.store.dao.HyPartnerTaskInfoLogDAO;
import com.cool.store.dao.HyPartnerUserInfoDAO;
import com.cool.store.entity.HyPartnerBaseInfoDO;
import com.cool.store.entity.HyPartnerLineInfoDO;
import com.cool.store.entity.HyPartnerTaskInfoLogDO;
import com.cool.store.entity.HyPartnerUserInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.LineStatusEnum;
@@ -53,6 +55,10 @@ public class HyPartnerBaseInfoServiceImpl implements HyPartnerBaseInfoService {
@Resource
private RedisUtilPool redisUtilPool;
@Resource
HyPartnerTaskInfoLogDAO hyPartnerTaskInfoLogDAO;
@Override
public Boolean addTags(AddTagsRequest addTagsRequest) {
HyPartnerBaseInfoDO hyPartnerBaseInfoDO = new HyPartnerBaseInfoDO();
@@ -69,7 +75,7 @@ public class HyPartnerBaseInfoServiceImpl implements HyPartnerBaseInfoService {
* @return
*/
@Override
public Boolean submitPartnerBaseInfo(PartnerBaseInfoRequest request) {
public Boolean submitPartnerBaseInfo(PartnerBaseInfoRequest request, PartnerUserInfoVO currentUser) {
String cacheKey = MessageFormat.format(RedisConstant.PARTNER_BASEINFO_CACHE_KEY, request.getPartnerId(), request.getPartnerLineId());
if(!request.getSubmitFlag()){
// 自动保存时
@@ -94,6 +100,10 @@ public class HyPartnerBaseInfoServiceImpl implements HyPartnerBaseInfoService {
HyPartnerBaseInfoDO hyPartnerBaseInfoDO = hyPartnerBaseInfoDAO.getByPartnerIdAndLineId(request.getPartnerId(), request.getPartnerLineId());
hyPartnerBaseInfoDO.setStatus(Integer.valueOf(WorkflowStatusEnum.INTENT_1.getCode()));
hyPartnerBaseInfoDAO.updateByPrimaryKeySelective(hyPartnerBaseInfoDO);
HyPartnerTaskInfoLogDO logDO = new HyPartnerTaskInfoLogDO(request.getPartnerId(), request.getPartnerLineId(), WorkflowStageEnum.INTENT.getCode(), WorkflowStatusEnum.INTENT_1.getCode(), currentUser.getPartnerId(), currentUser.getUsername(), null);
hyPartnerTaskInfoLogDAO.insertSelective(logDO);
}
// 清空暂存信息
redisUtilPool.delKey(cacheKey);

View File

@@ -12,6 +12,7 @@ import com.cool.store.service.HyPartnerClerkService;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.StringUtil;
import com.cool.store.vo.PartnerClerkVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
@@ -29,6 +30,7 @@ import java.util.stream.Collectors;
* @Date 2023/6/14 21:37
* @Version 1.0
*/
@Slf4j
@Service
public class HyPartnerClerkServiceImpl implements HyPartnerClerkService {
@@ -57,6 +59,7 @@ public class HyPartnerClerkServiceImpl implements HyPartnerClerkService {
@Override
public Boolean submitPartnerClerkInfo(PartnerClerkInfoRequest request) {
log.info("HyPartnerClerkServiceImpl#submitPartnerClerkInfo request:{}", JSONObject.toJSONString(request));
String cacheKey = MessageFormat.format(RedisConstant.PARTNER_CLERKINFO_CACHE_KEY, request.getPartnerId(), request.getPartnerLineId());
if(!request.getSubmitFlag()){
// 自动保存时

View File

@@ -1,12 +1,10 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.core.bean.BeanUtil;
import com.cool.store.constants.CommonConstants;
import com.cool.store.constants.RedisConstant;
import com.cool.store.dao.*;
import com.cool.store.dto.partner.PartnerIntentApplyInfoDTO;
import com.cool.store.dto.partner.PrivateSeaLineDTO;
import com.cool.store.entity.HyOpenAreaInfoDO;
import com.cool.store.entity.HyPartnerIntentInfoDO;
import com.cool.store.entity.HyPartnerLineInfoDO;
@@ -23,9 +21,11 @@ import com.cool.store.utils.StringUtil;
import com.cool.store.vo.PartnerIntentApplyInfoVO;
import com.cool.store.vo.PartnerIntentInfoVO;
import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.WantShopInfoVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@@ -43,6 +43,7 @@ import java.util.stream.Collectors;
* @Date 2023/6/9 15:00
* @Version 1.0
*/
@Slf4j
@Service
public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoService {
@@ -115,7 +116,7 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(hyPartnerIntentInfoDO.getPartnerId());
partnerIntentInfoVO.setPartnerUserName(hyPartnerUserInfoDO.getUsername());
partnerIntentInfoVO.setWorkflowStage(hyPartnerLineInfoDO.getWorkflowStage());
partnerIntentInfoVO.setWorkflowStauts(hyPartnerLineInfoDO.getWorkflowStatus());
partnerIntentInfoVO.setWorkflowStatus(hyPartnerLineInfoDO.getWorkflowStatus());
partnerIntentInfoVO.setPartnerUserPhone(hyPartnerUserInfoDO.getMobile());
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(Long.valueOf(hyPartnerUserInfoDO.getWantShopArea()));
partnerIntentInfoVO.setWantShopAreaName(hyOpenAreaInfoDO.getAreaName());
@@ -124,6 +125,7 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
@Override
public String submitPartnerIntentInfo(PartnerIntentInfoRequest request) {
log.info("HyPartnerClerkServiceImpl#submitPartnerIntentInfo request:{}", JSONObject.toJSONString(request));
if (StringUtil.isBlank(request.getPartnerId()) || Objects.isNull(request.getPartnerLineId())){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
@@ -158,12 +160,20 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
return intentInfoVO;
}
HyPartnerIntentInfoDO intentInfoDO = hyPartnerIntentInfoDAO.getByPartnerIdAndLineId(userInfoVO.getPartnerId(), lineId);
PartnerIntentInfoVO intentInfoVO = new PartnerIntentInfoVO();
intentInfoVO.setWantShopArea(userInfoVO.getWantShopArea());
if (intentInfoDO != null){
BeanUtil.copyProperties(intentInfoDO, intentInfoVO);
PartnerIntentInfoVO intentInfoVO = convertPartnerIntentApplyInfoDOToVO(intentInfoDO);
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;
}
return intentInfoVO;
return null;
}
private void fillIntentInfo(HyPartnerIntentInfoDO intentInfoDO, PartnerIntentInfoRequest request) {
@@ -223,7 +233,9 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
partnerIntentInfoVO.setOtherBand(hyPartnerIntentInfoDO.getOtherBand());
partnerIntentInfoVO.setStrength(hyPartnerIntentInfoDO.getStrength());
partnerIntentInfoVO.setNeedImprove(hyPartnerIntentInfoDO.getNeedImprove());
partnerIntentInfoVO.setWantShopInfo(hyPartnerIntentInfoDO.getWantShopInfo());
if(StringUtils.isNotEmpty(hyPartnerIntentInfoDO.getWantShopInfo())){
partnerIntentInfoVO.setWantShopInfo(JSONObject.parseArray(hyPartnerIntentInfoDO.getWantShopInfo(), WantShopInfoVO.class));
}
return partnerIntentInfoVO;
}

View File

@@ -81,18 +81,7 @@ public class PartnerUserInfoServiceImpl implements PartnerUserInfoService {
throw new ServiceException(ErrorCodeEnum.PARTNER_USER_NOT_EXIST);
}
ApplyBaseInfoVO applyBaseInfoVO = new ApplyBaseInfoVO();
hyPartnerUserInfoDO.setUsername(partnerUserInfoRequest.getUsername());
hyPartnerUserInfoDO.setMobile(partnerUserInfoRequest.getMobile());
hyPartnerUserInfoDO.setLiveArea(partnerUserInfoRequest.getLiveArea());
hyPartnerUserInfoDO.setWantShopArea(partnerUserInfoRequest.getWantShopArea());
hyPartnerUserInfoDO.setAcceptAdjustType(partnerUserInfoRequest.getAcceptAdjustType());
hyPartnerUserInfoDO.setInviteCode(partnerUserInfoRequest.getInviteCode());
hyPartnerUserInfoDO.setShopCode(partnerUserInfoRequest.getShopCode());
hyPartnerUserInfoDO.setShopName(partnerUserInfoRequest.getShopName());
hyPartnerUserInfoDO.setShopId(partnerUserInfoRequest.getShopId());
hyPartnerUserInfoDO.setRecommendPartnerId(partnerUserInfoRequest.getRecommendPartnerId());
hyPartnerUserInfoDO.setRecommendPartnerName(partnerUserInfoRequest.getRecommendPartnerName());
hyPartnerUserInfoDO.setRecommendPartnerMobile(partnerUserInfoRequest.getRecommendPartnerMobile());
fillUserInfoDOByRequest(hyPartnerUserInfoDO, partnerUserInfoRequest);
hyPartnerUserInfoDAO.updateByPrimaryKeySelective(hyPartnerUserInfoDO);
// 生成一条线索
HyPartnerLineInfoDO hyPartnerLineInfoDO = hyPartnerLineInfoService.generateDefaultLineInfo(hyPartnerUserInfoDO.getPartnerId(), partnerUserInfoRequest.getWantShopArea(), partnerUserInfoRequest.getAcceptAdjustType());
@@ -112,4 +101,19 @@ public class PartnerUserInfoServiceImpl implements PartnerUserInfoService {
}
return applyBaseInfoVO;
}
private void fillUserInfoDOByRequest(HyPartnerUserInfoDO hyPartnerUserInfoDO, PartnerUserInfoRequest partnerUserInfoRequest) {
hyPartnerUserInfoDO.setUsername(partnerUserInfoRequest.getUsername());
hyPartnerUserInfoDO.setMobile(partnerUserInfoRequest.getMobile());
hyPartnerUserInfoDO.setLiveArea(partnerUserInfoRequest.getLiveArea());
hyPartnerUserInfoDO.setWantShopArea(partnerUserInfoRequest.getWantShopArea());
hyPartnerUserInfoDO.setAcceptAdjustType(partnerUserInfoRequest.getAcceptAdjustType());
hyPartnerUserInfoDO.setInviteCode(partnerUserInfoRequest.getInviteCode());
hyPartnerUserInfoDO.setShopCode(partnerUserInfoRequest.getShopCode());
hyPartnerUserInfoDO.setShopName(partnerUserInfoRequest.getShopName());
hyPartnerUserInfoDO.setShopId(partnerUserInfoRequest.getShopId());
hyPartnerUserInfoDO.setRecommendPartnerId(partnerUserInfoRequest.getRecommendPartnerId());
hyPartnerUserInfoDO.setRecommendPartnerName(partnerUserInfoRequest.getRecommendPartnerName());
hyPartnerUserInfoDO.setRecommendPartnerMobile(partnerUserInfoRequest.getRecommendPartnerMobile());
}
}

View File

@@ -45,7 +45,7 @@ public class RegionController {
@ApiOperation("查询所有被绑定战区的组织机构")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "intent-意向区域 development 开发区域", required = false)
@ApiImplicitParam(name = "type", value = "intent-意向区域 dev 开发区域", required = false)
})
@GetMapping("/queryAllBingZoneRegionList")
public ResponseResult<List<String>> queryAllBingZoneRegionList(@RequestParam(value = "type",required = false)String type){

View File

@@ -96,7 +96,8 @@ public class PartnerController {
public ResponseResult<Boolean> submitPartnerBaseInfo(@RequestBody PartnerBaseInfoRequest baseInfoRequest){
//前提 未提交加盟申请
//成功 意向区域变更成功 失败 您已进入意向申请流程,当前不可变更意向区域
return ResponseResult.success(hyPartnerBaseInfoService.submitPartnerBaseInfo(baseInfoRequest));
PartnerUserInfoVO currentUser = PartnerUserHolder.getUser();
return ResponseResult.success(hyPartnerBaseInfoService.submitPartnerBaseInfo(baseInfoRequest, currentUser));
}
@PostMapping(path = "/submitPartnerClerkInfo")