实训体验

This commit is contained in:
guohb
2024-03-26 16:40:27 +08:00
parent e98fcf626d
commit 4416f8aef5
18 changed files with 448 additions and 8 deletions

View File

@@ -0,0 +1,33 @@
package com.cool.store.enums;
public enum ExperienceStatusEnum {
DONE(0,"完成体验"),
ABANDON(1,"放弃体验"),
;
private Integer experienceStatus;
private String message;
ExperienceStatusEnum(Integer experienceStatus, String message) {
this.experienceStatus = experienceStatus;
this.message = message;
}
public Integer getExperienceStatus() {
return experienceStatus;
}
public void setExperienceStatus(Integer experienceStatus) {
this.experienceStatus = experienceStatus;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View File

@@ -9,4 +9,7 @@ import org.apache.ibatis.annotations.Param;
public interface IntentAgreementMapper { public interface IntentAgreementMapper {
boolean insert(@Param("request") SigningBaseInfoDO request); boolean insert(@Param("request") SigningBaseInfoDO request);
SigningBaseInfoDO selectByPartnerIdOrLineId(@Param("partnerId") String partnerId,
@Param("lineId") Long lineId);
} }

View File

@@ -6,4 +6,6 @@ import tk.mybatis.mapper.common.Mapper;
public interface LineInfoMapper extends Mapper<LineInfoDO> { public interface LineInfoMapper extends Mapper<LineInfoDO> {
LineInfoDO getByPartnerId(@Param("partnerId") String partnerId); LineInfoDO getByPartnerId(@Param("partnerId") String partnerId);
LineInfoDO getByLineId(@Param("lineId") Long lineId);
} }

View File

@@ -0,0 +1,17 @@
package com.cool.store.mapper;
import com.cool.store.entity.LeaseBaseInfoDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import javax.websocket.server.PathParam;
@Mapper
public interface TrainingExperienceMapper {
void insert(@Param("entity") LeaseBaseInfoDO toLeaseBaseInfoDO);
void updateStatus(@Param("lineId") Long lineId,
@Param("status") Integer status,
@Param("abandonCause") String abandonCause);
}

View File

@@ -3,7 +3,8 @@
<mapper namespace="com.cool.store.mapper.IntentAgreementMapper"> <mapper namespace="com.cool.store.mapper.IntentAgreementMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.SigningBaseInfoDO"> <resultMap id="BaseResultMap" type="com.cool.store.entity.SigningBaseInfoDO">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="partner_base_info_id" jdbcType="VARCHAR" property="partnerBaseInfoId" /> <result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
<result column="line_id" jdbcType="BIGINT" property="lineId" />
<result column="sign_name" jdbcType="VARCHAR" property="signName" /> <result column="sign_name" jdbcType="VARCHAR" property="signName" />
<result column="mobile" jdbcType="VARCHAR" property="mobile" /> <result column="mobile" jdbcType="VARCHAR" property="mobile" />
<result column="sex" jdbcType="TINYINT" property="sex" /> <result column="sex" jdbcType="TINYINT" property="sex" />
@@ -22,7 +23,8 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, id,
partner_base_info_id, partner_id,
line_id,
sign_name sign_name
mobile, mobile,
sex, sex,
@@ -74,6 +76,20 @@
<if test="request.businessLicenseAddress != null">#{request.businessLicenseAddress},</if> <if test="request.businessLicenseAddress != null">#{request.businessLicenseAddress},</if>
</trim> </trim>
</insert> </insert>
<select id="selectByPartnerIdOrLineId" resultType="com.cool.store.entity.SigningBaseInfoDO">
select
<include refid="Base_Column_List"/>
from xfsg_signing_base_info
<where>
deleted = 0
<if test="partnerId != null and partnerId != ''">
and partner_id = #{partnerId}
</if>
<if test="lineId != null">
and line_id = #{lineId}
</if>
</where>
</select>
</mapper> </mapper>

View File

@@ -48,7 +48,7 @@
<if test="request.areaCode != null">area_code,</if> <if test="request.areaCode != null">area_code,</if>
<if test="request.liveArea != null">live_area,</if> <if test="request.liveArea != null">live_area,</if>
<if test="request.liveAddress != null">live_address,</if> <if test="request.liveAddress != null">live_address,</if>
<if test="request.joiningQuestionnaire != null">joining_questionnaire,</if> <if test="request.joiningQuestionnaire != null">joining_questionnaire,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="request.lineId != null">#{request.lineId},</if> <if test="request.lineId != null">#{request.lineId},</if>

View File

@@ -34,5 +34,8 @@
<select id="getByPartnerId" resultMap="BaseResultMap"> <select id="getByPartnerId" resultMap="BaseResultMap">
select * from xfsg_line_info where partner_id = #{partnerId} and deleted = 0 select * from xfsg_line_info where partner_id = #{partnerId} and deleted = 0
</select> </select>
<select id="getByLineId" resultType="com.cool.store.entity.LineInfoDO">
select * from xfsg_line_info where id = #{lineId} and deleted = 0
</select>
</mapper> </mapper>

View File

@@ -0,0 +1,65 @@
<?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.TrainingExperienceMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.LeaseBaseInfoDO">
<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="store_name" jdbcType="VARCHAR" property="storeName"/>
<result column="store_id" jdbcType="VARCHAR" property="storeId"/>
<result column="experience_start_time" jdbcType="TIMESTAMP" property="experienceStartTime"/>
<result column="experience_end_time" jdbcType="TIMESTAMP" property="experienceEndTime"/>
<result column="experience_status" jdbcType="TINYINT" property="experienceStatus"/>
<result column="abandon_cause" jdbcType="VARCHAR" property="abandonCause"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="deleted" jdbcType="TINYINT" property="deleted"/>
</resultMap>
<sql id="Base_Column_List">
id,
partner_id,
line_id,
store_name,
store_id,
experience_start_time,
experience_end_time,
experience_status,
abandon_cause,
create_time,
update_time,
deleted
</sql>
<insert id="insert">
insert into xfsg_lease_base_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="entity.partnerId != null">partner_id,</if>
<if test="entity.lineId != null">line_id,</if>
<if test="entity.storeName != null">store_name,</if>
<if test="entity.storeId != null">store_id,</if>
<if test="entity.experienceStartTime != null">experience_start_time,</if>
<if test="entity.experienceEndTime != null">experience_end_time,</if>
<if test="entity.experienceStatus != null">experience_status,</if>
<if test="entity.abandonCause != null">abandon_cause,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="entity.partnerId != null">#{request.partnerId},</if>
<if test="entity.lineId != null">#{request.lineId},</if>
<if test="entity.storeName != null">#{request.storeName},</if>
<if test="entity.storeId != null">#{request.storeId},</if>
<if test="entity.experienceStartTime != null">#{request.experienceStartTime},</if>
<if test="entity.experienceEndTime != null">#{request.experienceEndTime},</if>
<if test="entity.experienceStatus != null">#{request.experienceStatus},</if>
<if test="entity.abandonCause != null">#{request.abandonCause},</if>
</trim>
</insert>
<update id="updateStatus">
update
xfsg_lease_base_info
set
experience_status = #{status},
abandon_cause=#{abandonCause}
where line_id = #{lineId}
</update>
</mapper>

View File

@@ -0,0 +1,34 @@
package com.cool.store.entity;
import lombok.Data;
import java.util.Date;
@Data
public class LeaseBaseInfoDO {
private Long id;
private String partnerId;
private Long lineId;
private String storeName;
private String storeId;
private Date experienceStartTime;
private Date experienceEndTime;
private Integer experienceStatus;
private String abandonCause;
private Date createTime;
private Date updateTime;
private Integer deleted;
}

View File

@@ -10,8 +10,9 @@ import javax.validation.constraints.NotBlank;
@ApiModel("加盟意向Request") @ApiModel("加盟意向Request")
public class JoinIntentionRequest { public class JoinIntentionRequest {
private Long id;
@ApiModelProperty("线索信息表-线索id") @ApiModelProperty("线索信息表-线索id")
@NotBlank(message = "线索id不能为空")
private Long lineId; private Long lineId;
@ApiModelProperty("用户信息表partnerId") @ApiModelProperty("用户信息表partnerId")

View File

@@ -0,0 +1,37 @@
package com.cool.store.request;
import com.cool.store.entity.LeaseBaseInfoDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.Date;
@Data
public class TrainingExperienceDistributionRequest {
@ApiModelProperty("线索信息表-线索id")
private Long lineId;
@ApiModelProperty("用户信息表partnerId")
private String partnerId;
@ApiModelProperty("体验门店id")
private String storeId;
@ApiModelProperty("门店名")
private String storeName;
@ApiModelProperty("开始体验时间")
private Date experienceStartTime;
@ApiModelProperty("结束体验时间")
private Date experienceEndTime;
public LeaseBaseInfoDO toLeaseBaseInfoDO() {
LeaseBaseInfoDO leaseBaseInfoDO = new LeaseBaseInfoDO();
leaseBaseInfoDO.setLineId(this.lineId);
leaseBaseInfoDO.setStoreName(this.storeName);
leaseBaseInfoDO.setStoreId(this.storeId);
leaseBaseInfoDO.setExperienceStartTime(this.experienceStartTime);
leaseBaseInfoDO.setExperienceEndTime(this.experienceEndTime);
leaseBaseInfoDO.setPartnerId(this.partnerId);
return leaseBaseInfoDO;
}
}

View File

@@ -0,0 +1,71 @@
package com.cool.store.response;
import com.cool.store.entity.SigningBaseInfoDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class SigningBaseInfoResponse {
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("加盟商id")
private String partnerId;
@ApiModelProperty("线索id")
private Long lineId;
@ApiModelProperty("签名")
private String signName;
@ApiModelProperty("手机号")
private String mobile;
@ApiModelProperty("性别 1男 2女")
private Integer sex;
@ApiModelProperty("身份证正面url")
private String idCardFront;
@ApiModelProperty("身份证反面url")
private String idCardReverse;
@ApiModelProperty("身份证号")
private String idCardNo;
@ApiModelProperty("身份证地址")
private String idCardAddress;
@ApiModelProperty("当前地址")
private String currentResidence;
@ApiModelProperty("地址详情")
private String addressDetail;
@ApiModelProperty("证照url")
private String businessLicense;
@ApiModelProperty("证照码")
private String businessLicenseCode;
@ApiModelProperty("证照地址")
private String businessLicenseAddress;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date updateTime;
public static SigningBaseInfoResponse from(SigningBaseInfoDO signingBaseInfoDO) {
if (signingBaseInfoDO == null) {
return null;
}
SigningBaseInfoResponse signingBaseInfoResponse = new SigningBaseInfoResponse();
signingBaseInfoResponse.setId(signingBaseInfoDO.getId());
signingBaseInfoResponse.setPartnerId(signingBaseInfoDO.getPartnerId());
signingBaseInfoResponse.setLineId(signingBaseInfoDO.getLineId());
signingBaseInfoResponse.setSignName(signingBaseInfoDO.getSignName());
signingBaseInfoResponse.setMobile(signingBaseInfoDO.getMobile());
signingBaseInfoResponse.setSex(signingBaseInfoDO.getSex());
signingBaseInfoResponse.setIdCardFront(signingBaseInfoDO.getIdCardFront());
signingBaseInfoResponse.setIdCardReverse(signingBaseInfoDO.getIdCardReverse());
signingBaseInfoResponse.setIdCardNo(signingBaseInfoDO.getIdCardNo());
signingBaseInfoResponse.setIdCardAddress(signingBaseInfoDO.getIdCardAddress());
signingBaseInfoResponse.setCurrentResidence(signingBaseInfoDO.getCurrentResidence());
signingBaseInfoResponse.setAddressDetail(signingBaseInfoDO.getAddressDetail());
signingBaseInfoResponse.setBusinessLicense(signingBaseInfoDO.getBusinessLicense());
signingBaseInfoResponse.setBusinessLicenseCode(signingBaseInfoDO.getBusinessLicenseCode());
signingBaseInfoResponse.setBusinessLicenseAddress(signingBaseInfoDO.getBusinessLicenseAddress());
signingBaseInfoResponse.setCreateTime(signingBaseInfoDO.getCreateTime());
signingBaseInfoResponse.setUpdateTime(signingBaseInfoDO.getUpdateTime());
return signingBaseInfoResponse;
}
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.service; package com.cool.store.service;
import com.cool.store.request.IntentAgreementSubmitRequest; import com.cool.store.request.IntentAgreementSubmitRequest;
import com.cool.store.response.SigningBaseInfoResponse;
public interface IntentAgreementService { public interface IntentAgreementService {
/** /**
@@ -10,4 +11,11 @@ public interface IntentAgreementService {
*/ */
boolean submit(IntentAgreementSubmitRequest request); boolean submit(IntentAgreementSubmitRequest request);
/**
* 根据线索id或者加盟商id查询意向协议信息
* @param partnerId
* @param lineId
* @return
*/
SigningBaseInfoResponse getMiniIntentAgreement(String partnerId, Long lineId);
} }

View File

@@ -0,0 +1,21 @@
package com.cool.store.service;
import com.cool.store.request.TrainingExperienceDistributionRequest;
public interface TrainingExperienceService {
/**
* 实训分配
* @param request
* @return
*/
boolean distribution(TrainingExperienceDistributionRequest request);
/**
* 实训状态变更
* @param lineId
* @param status
* @param abandonCause
*/
void experienceStatusChange(Long lineId, Integer status, String abandonCause);
}

View File

@@ -8,13 +8,19 @@ import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.IntentAgreementMapper; import com.cool.store.mapper.IntentAgreementMapper;
import com.cool.store.mapper.LineInfoMapper; import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.request.IntentAgreementSubmitRequest; import com.cool.store.request.IntentAgreementSubmitRequest;
import com.cool.store.response.SigningBaseInfoResponse;
import com.cool.store.service.IntentAgreementService; import com.cool.store.service.IntentAgreementService;
import com.cool.store.utils.StringUtil;
import com.cool.store.utils.poi.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Objects; import java.util.Objects;
import static com.cool.store.enums.ErrorCodeEnum.PARAMS_VALIDATE_ERROR;
@Service @Service
@Slf4j @Slf4j
public class IntentAgreementServiceImpl implements IntentAgreementService { public class IntentAgreementServiceImpl implements IntentAgreementService {
@@ -28,6 +34,7 @@ public class IntentAgreementServiceImpl implements IntentAgreementService {
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean submit(IntentAgreementSubmitRequest request) { public boolean submit(IntentAgreementSubmitRequest request) {
SigningBaseInfoDO signingBaseInfoDO = request.toSigningBaseInfoDO(); SigningBaseInfoDO signingBaseInfoDO = request.toSigningBaseInfoDO();
boolean submitStatus = intentAgreementMapper.insert(signingBaseInfoDO); boolean submitStatus = intentAgreementMapper.insert(signingBaseInfoDO);
@@ -43,4 +50,18 @@ public class IntentAgreementServiceImpl implements IntentAgreementService {
} }
return false; return false;
} }
@Override
public SigningBaseInfoResponse getMiniIntentAgreement(String partnerId, Long lineId) {
if (StringUtil.isBlank(partnerId) && lineId == null){
throw new ServiceException(PARAMS_VALIDATE_ERROR);
}
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(partnerId, lineId);
if (Objects.isNull(signingBaseInfoDO)){
log.info("getMiniIntentAgreement signingBaseInfoDO IS NULL......");
return null;
}
SigningBaseInfoResponse response = SigningBaseInfoResponse.from(signingBaseInfoDO);
return response;
}
} }

View File

@@ -0,0 +1,59 @@
package com.cool.store.service.impl;
import com.cool.store.entity.LeaseBaseInfoDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.ExperienceStatusEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.TrainingExperienceMapper;
import com.cool.store.request.TrainingExperienceDistributionRequest;
import com.cool.store.service.TrainingExperienceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.annotation.Tainted;
import java.util.Objects;
import static com.cool.store.enums.ErrorCodeEnum.INTERVIEW_LINE_ID_IS_NULL;
@Service
@Slf4j
public class TrainingExperienceServiceImpl implements TrainingExperienceService {
@Resource
TrainingExperienceMapper trainingExperienceMapper;
@Resource
LineInfoMapper lineInfoMapper;
@Override
public boolean distribution(TrainingExperienceDistributionRequest request) {
if (Objects.isNull(request)) {
return Boolean.FALSE;
}
if (Objects.isNull(request.getLineId())) {
throw new ServiceException(INTERVIEW_LINE_ID_IS_NULL);
}
trainingExperienceMapper.insert(request.toLeaseBaseInfoDO());
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void experienceStatusChange(Long lineId, Integer status, String abandonCause) {
trainingExperienceMapper.updateStatus(lineId,status,abandonCause);
if (ExperienceStatusEnum.DONE.getExperienceStatus().equals(status)){
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(lineId);
if (Objects.isNull(lineInfoDO)){
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
}
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_100.getCode());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
}
}
}

View File

@@ -0,0 +1,42 @@
package com.cool.store.controller.webb;
import com.cool.store.enums.ExperienceStatusEnum;
import com.cool.store.request.TrainingExperienceDistributionRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.TrainingExperienceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.websocket.server.PathParam;
@RestController
@RequestMapping("/pc/training/experience/")
@Api(tags = "PC端-实训体验")
@Slf4j
public class TrainingExperienceController {
@Resource
TrainingExperienceService trainingExperienceService;
@ApiOperation("实训体验分配")
@PostMapping("/distribution")
public ResponseResult<Boolean> distribution(@RequestBody TrainingExperienceDistributionRequest request) {
return ResponseResult.success(trainingExperienceService.distribution(request));
}
@ApiOperation("实训体验状态变更")
@GetMapping("/experience/{status}")
public ResponseResult experienceStatusChange(@ApiParam(value = "实训体验状态 DONE:完成 ABANDON:放弃") @PathVariable(value = "status") ExperienceStatusEnum statusEnum,
@ApiParam(value = "线索id")@RequestParam(value = "lineId") Long lineId,
@ApiParam(value = "放弃原因状态为ABANDON才填写")@RequestParam(value = "abandonCause",required = false)String abandonCause) {
trainingExperienceService.experienceStatusChange(lineId,statusEnum.getExperienceStatus(),abandonCause);
return ResponseResult.success();
}
}

View File

@@ -3,14 +3,12 @@ package com.cool.store.controller.webc;
import com.cool.store.request.IntentAgreementSubmitRequest; import com.cool.store.request.IntentAgreementSubmitRequest;
import com.cool.store.request.JoinIntentionRequest; import com.cool.store.request.JoinIntentionRequest;
import com.cool.store.response.ResponseResult; import com.cool.store.response.ResponseResult;
import com.cool.store.response.SigningBaseInfoResponse;
import com.cool.store.service.IntentAgreementService; import com.cool.store.service.IntentAgreementService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
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.annotation.Resource;
@@ -29,4 +27,13 @@ public class MiniIntentAgreementController {
boolean resp = intentAgreementService.submit(request); boolean resp = intentAgreementService.submit(request);
return ResponseResult.success(resp); return ResponseResult.success(resp);
} }
@PostMapping(path = "/get")
@ApiOperation("查询意向协议信息")
public ResponseResult<SigningBaseInfoResponse> getMiniIntentAgreement(
@RequestParam(value = "partnerId",required = false) String partnerId,
@RequestParam(value = "lineId",required = false) Long lineId) {
SigningBaseInfoResponse resp = intentAgreementService.getMiniIntentAgreement(partnerId,lineId);
return ResponseResult.success(resp);
}
} }