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

This commit is contained in:
zhangchenbiao
2024-03-22 16:18:54 +08:00
7 changed files with 250 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
package com.cool.store.mapper;
import com.cool.store.request.JoinIntentionRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface JoinIntentionMapper {
boolean insert(@Param("request") JoinIntentionRequest request);
}

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.JoinIntentionMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.PartnerBaseInfoDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
<result column="line_id" jdbcType="BIGINT" property="lineId"/>
<result column="join_type" jdbcType="TINYINT" property="joinType"/>
<result column="mobile" jdbcType="VARCHAR" property="mobile" />
<result column="sex" jdbcType="TINYINT" property="sex" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="want_shop_area" jdbcType="VARCHAR" property="wantShopArea" />
<result column="area_code" jdbcType="VARCHAR" property="areaCode" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="live_area" jdbcType="VARCHAR" property="liveArea"/>
<result column="live_address" jdbcType="VARCHAR" property="liveAddress"/>
<result column="joining_questionnaire" jdbcType="VARCHAR" property="joiningQuestionnaire"/>
<result column="deleted" jdbcType="TINYINT" property="deleted"/>
</resultMap>
<sql id="Base_Column_List">
id,
partner_id,
line_id,
join_type,
mobile,
sex,
username,
want_shop_area,
area_code,
create_time,
update_time,
live_area,
live_address,
joining_questionnaire,
deleted
</sql>
<insert id="insert" parameterType="com.cool.store.request.JoinIntentionRequest" useGeneratedKeys="true" keyProperty="id">
insert into xfsg_partner_base_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="request.lineId != null">line_id,</if>
<if test="request.partnerId != null">partner_id,</if>
<if test="request.joinType != null">join_type,</if>
<if test="request.userName != null">username,</if>
<if test="request.mobile != null">mobile,</if>
<if test="request.sex != null">sex,</if>
<if test="request.wantShopArea != null">want_shop_area,</if>
<if test="request.areaCode != null">area_code,</if>
<if test="request.liveArea != null">live_area,</if>
<if test="request.liveAddress != null">live_address,</if>
<if test="request.joiningQuestionnaire != null">joining_questionnaire,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="request.lineId != null">#{request.lineId},</if>
<if test="request.partnerId != null">#{request.partnerId},</if>
<if test="request.joinType != null">#{request.joinType},</if>
<if test="request.userName != null">#{request.userName},</if>
<if test="request.mobile != null">#{request.mobile},</if>
<if test="request.sex != null">#{request.sex},</if>
<if test="request.wantShopArea != null">#{request.wantShopArea},</if>
<if test="request.areaCode != null">#{request.areaCode},</if>
<if test="request.liveArea != null">#{request.liveArea},</if>
<if test="request.liveAddress != null">#{request.liveAddress},</if>
<if test="request.joiningQuestionnaire != null">#{request.joiningQuestionnaire},</if>
</trim>
</insert>
</mapper>

View File

@@ -0,0 +1,41 @@
package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class PartnerBaseInfoDO {
private Long id;
private String partnerId;
private Long lineId;
@ApiModelProperty("加盟身份 1个人加盟 2企业加盟")
private Integer joinType;
@ApiModelProperty("姓名")
private String username;
@ApiModelProperty("手机号")
private String mobile;
@ApiModelProperty("1男 2女")
private Integer sex;
@ApiModelProperty("意向加盟区域")
private String wantShopArea;
@ApiModelProperty("意向区域编码")
private String areaCode;
@ApiModelProperty("常驻区域")
private String liveArea;
@ApiModelProperty("常驻区域详细地址")
private String liveAddress;
@ApiModelProperty("加盟问卷长json")
private String joiningQuestionnaire;
private Date createTime;
private Date updateTime;
private Integer deleted;
}

View File

@@ -0,0 +1,39 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
@ApiModel("加盟意向Request")
public class JoinIntentionRequest {
@ApiModelProperty("线索信息表-线索id")
@NotBlank(message = "线索id不能为空")
private Long lineId;
@ApiModelProperty("用户信息表partnerId")
@NotBlank(message = "partnerId不能为空")
private String partnerId;
@ApiModelProperty("加盟身份 1个人加盟 2企业加盟")
private Integer joinType;
@ApiModelProperty("姓名")
private String userName;
@ApiModelProperty("手机号")
private String mobile;
@ApiModelProperty("1男 2女")
private Integer sex;
@ApiModelProperty("意向加盟区域")
private String wantShopArea;
@ApiModelProperty("意向区域编码")
private String areaCode;
@ApiModelProperty("常驻区域")
private String liveArea;
@ApiModelProperty("常驻区域详细地址")
private String liveAddress;
@ApiModelProperty("加盟问卷长json")
private String joiningQuestionnaire;
}

View File

@@ -0,0 +1,12 @@
package com.cool.store.service;
import com.cool.store.request.JoinIntentionRequest;
public interface JoinIntentionService {
/**
* 提交意向加盟申请书
* @param request
*/
boolean submit(JoinIntentionRequest request);
}

View File

@@ -0,0 +1,46 @@
package com.cool.store.service.impl;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.JoinIntentionMapper;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.request.JoinIntentionRequest;
import com.cool.store.service.JoinIntentionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Objects;
@Service
@Slf4j
public class JoinIntentionServiceImpl implements JoinIntentionService {
@Resource
JoinIntentionMapper joinIntentionMapper;
@Resource
LineInfoMapper lineInfoMapper;
@Override
@Transactional
public boolean submit(JoinIntentionRequest request) {
if (Objects.isNull(request)){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
boolean submitStatus = joinIntentionMapper.insert(request);
if (submitStatus){
//更改线索流程子状态为【待审核】
LineInfoDO lineInfoDO = lineInfoMapper.getByPartnerId(request.getPartnerId());
if (Objects.isNull(lineInfoDO)){
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
}
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.INTENT_5.getCode());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
}
return Boolean.TRUE;
}
}

View File

@@ -0,0 +1,32 @@
package com.cool.store.controller.webc;
import com.cool.store.request.JoinIntentionRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.JoinIntentionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
@RestController
@RequestMapping({"/mini/JoinIntention"})
@Slf4j
@Api(tags = "小程序意向加盟")
public class MiniJoinIntentionController {
@Resource
private JoinIntentionService joinIntentionService;
@PostMapping(path = "/getOpenAreaList")
@ApiOperation("填写加盟意向申请书")
public ResponseResult<Boolean> submit(@RequestBody @Valid JoinIntentionRequest request) {
return ResponseResult.success(joinIntentionService.submit(request));
}
}