Commit 6c812d91 by Water Wang

optimize

parent a148a4ea
...@@ -726,24 +726,30 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -726,24 +726,30 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
Long potentialId = requestVO.getPotentialId(); Long potentialId = requestVO.getPotentialId();
List<AclPractitionerPotential> practitionerPotentialList = aclPractitionerPotentialDALService.findByMobileNo(mobileNo,1); List<AclPractitionerPotential> practitionerPotentialList = aclPractitionerPotentialDALService.findByMobileNo(mobileNo,1);
if(potentialId != null || practitionerPotentialList.isEmpty()){ if(potentialId != null || practitionerPotentialList.isEmpty()){
String remark = requestVO.getRemark();
AclPractitionerPotential practitionerPotential = new AclPractitionerPotential(); AclPractitionerPotential practitionerPotential = new AclPractitionerPotential();
BeanUtils.copyProperties(requestVO,practitionerPotential); BeanUtils.copyProperties(requestVO,practitionerPotential);
practitionerPotential.setCustomerId(customerId); practitionerPotential.setCustomerId(customerId);
practitionerPotential.setPractitionerAssignedIds(practitionerId.toString()); practitionerPotential.setPractitionerAssignedIds(practitionerId.toString());
practitionerPotential.setCreatedAt(new Date());
practitionerPotential.setCreatedBy(practitionerId);
practitionerPotential.setCreatorType(2);
practitionerPotential.setIsActive(1); practitionerPotential.setIsActive(1);
if(potentialId != null){ if(potentialId != null){
practitionerPotential.setId(potentialId); practitionerPotential.setId(potentialId);
practitionerPotential.setUpdatedAt(new Date());
practitionerPotential.setUpdatedBy(practitionerId);
practitionerPotential.setUpdaterType(2);
aclPractitionerPotentialDALService.update(practitionerPotential); aclPractitionerPotentialDALService.update(practitionerPotential);
//更新该经纪人的备注
updateRecruitRemark(potentialId,practitionerId,remark);
}else{ }else{
practitionerPotential.setCreatedAt(new Date());
practitionerPotential.setCreatedBy(practitionerId);
practitionerPotential.setCreatorType(2);
aclPractitionerPotentialDALService.save(practitionerPotential); aclPractitionerPotentialDALService.save(practitionerPotential);
potentialId = practitionerPotential.getId(); potentialId = practitionerPotential.getId();
//如果已经分配团队长,则在追踪表中增加记录 //如果已经分配团队长,则在追踪表中增加记录
List<Long> practitionerPotentialIdList = new ArrayList<>(); List<Long> practitionerPotentialIdList = new ArrayList<>();
practitionerPotentialIdList.add(potentialId); practitionerPotentialIdList.add(potentialId);
addPractitionerPotentialTrack(practitionerPotentialIdList, practitionerId); addPractitionerPotentialTrack(practitionerPotentialIdList, practitionerId,remark);
} }
responseVO.setPotentialCustomerId(customerId); responseVO.setPotentialCustomerId(customerId);
responseVO.setPotentialId(potentialId); responseVO.setPotentialId(potentialId);
...@@ -767,7 +773,24 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -767,7 +773,24 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return responseVO; return responseVO;
} }
private void addPractitionerPotentialTrack(List<Long> practitionerPotentialIdList, Long practitionerId) { /**
* 更新经纪人对增员对备注
* @param potentialId 增员id
* @param practitionerId 团队长id
* @param remark 备注
*/
private void updateRecruitRemark(Long potentialId, Long practitionerId, String remark) {
if(potentialId != null && practitionerId != null && Strings.isNullOrEmpty(remark)){
List<AclPractitionerPotentialAssigneds> assignedsList = aclPractitionerPotentialAssignedsDALService.findByPotentialIdAndPractitionerId(potentialId,practitionerId);
if(assignedsList != null && !assignedsList.isEmpty()){
AclPractitionerPotentialAssigneds assigneds = assignedsList.get(0);
assigneds.setRemark(remark);
aclPractitionerPotentialAssignedsDALService.update(assigneds);
}
}
}
private void addPractitionerPotentialTrack(List<Long> practitionerPotentialIdList, Long practitionerId,String remark) {
if (practitionerId != null && !practitionerPotentialIdList.isEmpty()) { if (practitionerId != null && !practitionerPotentialIdList.isEmpty()) {
List<AclPractitionerPotentialAssignedTrack> potentialAssignedTrackList = new ArrayList<>(); List<AclPractitionerPotentialAssignedTrack> potentialAssignedTrackList = new ArrayList<>();
AclPractitionerPotentialAssignedTrack potentialAssignedTrack; AclPractitionerPotentialAssignedTrack potentialAssignedTrack;
...@@ -798,6 +821,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -798,6 +821,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
potentialAssigneds = new AclPractitionerPotentialAssigneds(); potentialAssigneds = new AclPractitionerPotentialAssigneds();
potentialAssigneds.setAssignedPractitionerId(practitionerId); potentialAssigneds.setAssignedPractitionerId(practitionerId);
potentialAssigneds.setPractitionerPotentialId(potentialId); potentialAssigneds.setPractitionerPotentialId(potentialId);
potentialAssigneds.setRemark(remark);
potentialAssigneds.setIsActive(1); potentialAssigneds.setIsActive(1);
potentialAssigneds.setCreatedAt(new Date()); potentialAssigneds.setCreatedAt(new Date());
potentialAssigneds.setCreatedBy(practitionerId); potentialAssigneds.setCreatedBy(practitionerId);
...@@ -839,21 +863,21 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -839,21 +863,21 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
if(assignedTrackList == null || assignedTrackList.isEmpty()){//3、如果没有,获取增员状态对应的分值, if(assignedTrackList == null || assignedTrackList.isEmpty()){//3、如果没有,获取增员状态对应的分值,
MdDropOptions options = mdDropOptionsDALService.findById(trackStatusId); MdDropOptions options = mdDropOptionsDALService.findById(trackStatusId);
assignedTrack.setTrackScore(options.getDropOptionScore()); assignedTrack.setTrackScore(options.getDropOptionScore());
}else{ assignedTrack.setPractitionerAssignedId(practitionerId);
assignedTrack.setTrackScore(0); assignedTrack.setPractitionerPotentialId(potentialId);
assignedTrack.setTrackStatusId(trackStatusId);
assignedTrack.setNotice(requestVO.getNotice());
assignedTrack.setTrackTime(trackTimeDate);
assignedTrack.setIsActive(1);
assignedTrack.setIsLasted(1);
assignedTrack.setCreatorType(2);
assignedTrack.setCreatedBy(practitionerId);
assignedTrack.setCreatedAt(new Date());
aclPractitionerPotentialAssignedTrackDALService.save(assignedTrack);
responseVO.setTrackId(assignedTrack.getId());
// }else{
// assignedTrack.setTrackScore(0);
} }
assignedTrack.setPractitionerAssignedId(practitionerId);
assignedTrack.setPractitionerPotentialId(potentialId);
assignedTrack.setTrackStatusId(trackStatusId);
assignedTrack.setNotice(requestVO.getNotice());
assignedTrack.setTrackTime(trackTimeDate);
assignedTrack.setIsActive(1);
assignedTrack.setIsLasted(1);
assignedTrack.setCreatorType(2);
assignedTrack.setCreatedBy(practitionerId);
assignedTrack.setCreatedAt(new Date());
aclPractitionerPotentialAssignedTrackDALService.save(assignedTrack);
responseVO.setTrackId(assignedTrack.getId());
responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000"))); responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000")));
}else{ }else{
String [] paras = {"trackStatusId,practitionerId,potentialId,trackTime"}; String [] paras = {"trackStatusId,practitionerId,potentialId,trackTime"};
...@@ -957,18 +981,21 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -957,18 +981,21 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
recruitSourceList.forEach(i->recruitSourceMap.put(i.getId(),i.getDropOptionName())); recruitSourceList.forEach(i->recruitSourceMap.put(i.getId(),i.getDropOptionName()));
List<PractitionerPotentialInfo> potentialInfoList = new ArrayList<>(); List<PractitionerPotentialInfo> potentialInfoList = new ArrayList<>();
Long trackStatusId; Long trackStatusId;
List<AclPractitionerPotentialAssigneds> assignedsList = aclPractitionerPotentialAssignedsDALService.findByPractitionerId(practitionerId);
Map<Long,String> remarkMap = new HashMap<>();
assignedsList.forEach(i->remarkMap.put(i.getPractitionerPotentialId(),i.getRemark()));
for(PractitionerPotentialInfo item : practitionerPotentialInfoList){ for(PractitionerPotentialInfo item : practitionerPotentialInfoList){
trackStatusId = item.getTrackStatusId(); trackStatusId = item.getTrackStatusId();
if(status != null){ if(status != null){
if(status == 1 && trackStatusId.longValue() == firstTrackStatusId){ if(status == 1 && trackStatusId.longValue() == firstTrackStatusId){
getResponseMessage(potentialInfoList,trackStatusMap,recruitSourceMap,item); getResponseMessage(potentialInfoList,trackStatusMap,recruitSourceMap,item,remarkMap);
}else if(status == 3 && trackStatusId.longValue() == LastStatusId){ }else if(status == 3 && trackStatusId.longValue() == LastStatusId){
getResponseMessage(potentialInfoList,trackStatusMap,recruitSourceMap,item); getResponseMessage(potentialInfoList,trackStatusMap,recruitSourceMap,item,remarkMap);
}else if(status == 2 && trackStatusId.longValue() != LastStatusId && trackStatusId.longValue() != firstTrackStatusId){ }else if(status == 2 && trackStatusId.longValue() != LastStatusId && trackStatusId.longValue() != firstTrackStatusId){
getResponseMessage(potentialInfoList,trackStatusMap,recruitSourceMap,item); getResponseMessage(potentialInfoList,trackStatusMap,recruitSourceMap,item,remarkMap);
} }
}else{ }else{
getResponseMessage(potentialInfoList,trackStatusMap,recruitSourceMap,item); getResponseMessage(potentialInfoList,trackStatusMap,recruitSourceMap,item,remarkMap);
} }
} }
responseVO.setPractitionerPotentialInfoList(potentialInfoList); responseVO.setPractitionerPotentialInfoList(potentialInfoList);
...@@ -984,9 +1011,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -984,9 +1011,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
} }
private void getResponseMessage(List<PractitionerPotentialInfo> potentialInfoList, Map<Long, String> trackStatusMap,Map<Long,String> recruitSourceMap, PractitionerPotentialInfo item) { private void getResponseMessage(List<PractitionerPotentialInfo> potentialInfoList, Map<Long, String> trackStatusMap,Map<Long,String> recruitSourceMap, PractitionerPotentialInfo item,Map<Long,String> remarkMap) {
PractitionerPotentialInfo potentialInfo = new PractitionerPotentialInfo(); PractitionerPotentialInfo potentialInfo = new PractitionerPotentialInfo();
BeanUtils.copyProperties(item,potentialInfo); BeanUtils.copyProperties(item,potentialInfo);
potentialInfo.setRemark(remarkMap.get(item.getPotentialId()));
potentialInfo.setTrackStatus(trackStatusMap.get(item.getTrackStatusId())); potentialInfo.setTrackStatus(trackStatusMap.get(item.getTrackStatusId()));
potentialInfo.setResourceDropMasterName(recruitSourceMap.get(item.getResourceDropMasterId())); potentialInfo.setResourceDropMasterName(recruitSourceMap.get(item.getResourceDropMasterId()));
potentialInfoList.add(potentialInfo); potentialInfoList.add(potentialInfo);
......
...@@ -64,6 +64,10 @@ public class AclPractitionerPotentialAssigneds implements Serializable { ...@@ -64,6 +64,10 @@ public class AclPractitionerPotentialAssigneds implements Serializable {
* 创建者类型:1为user id(AGMS),2为本人practitioner id(银盾经纪) * 创建者类型:1为user id(AGMS),2为本人practitioner id(银盾经纪)
*/ */
private Integer creatorType; private Integer creatorType;
/**
* 备注
*/
private String remark;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -19,4 +19,8 @@ public interface AclPractitionerPotentialAssignedsMapper { ...@@ -19,4 +19,8 @@ public interface AclPractitionerPotentialAssignedsMapper {
int updateByPrimaryKey(AclPractitionerPotentialAssigneds record); int updateByPrimaryKey(AclPractitionerPotentialAssigneds record);
void insertList(@Param("potentialAssignedsList") List<AclPractitionerPotentialAssigneds> potentialAssignedsList); void insertList(@Param("potentialAssignedsList") List<AclPractitionerPotentialAssigneds> potentialAssignedsList);
List<AclPractitionerPotentialAssigneds> findByPotentialIdAndPractitionerId(@Param("potentialId")Long potentialId, @Param("practitionerId")Long practitionerId);
List<AclPractitionerPotentialAssigneds> findByPractitionerId(@Param("practitionerId")Long practitionerId);
} }
\ No newline at end of file
...@@ -9,4 +9,10 @@ import java.util.List; ...@@ -9,4 +9,10 @@ import java.util.List;
public interface AclPractitionerPotentialAssignedsDALService { public interface AclPractitionerPotentialAssignedsDALService {
void saveAll(List<AclPractitionerPotentialAssigneds> potentialAssignedsList); void saveAll(List<AclPractitionerPotentialAssigneds> potentialAssignedsList);
List<AclPractitionerPotentialAssigneds> findByPotentialIdAndPractitionerId(Long potentialId, Long practitionerId);
void update(AclPractitionerPotentialAssigneds assigneds);
List<AclPractitionerPotentialAssigneds> findByPractitionerId(Long practitionerId);
} }
...@@ -17,4 +17,19 @@ public class AclPractitionerPotentialAssignedsDALServiceImpl implements AclPract ...@@ -17,4 +17,19 @@ public class AclPractitionerPotentialAssignedsDALServiceImpl implements AclPract
public void saveAll(List<AclPractitionerPotentialAssigneds> potentialAssignedsList) { public void saveAll(List<AclPractitionerPotentialAssigneds> potentialAssignedsList) {
aclPractitionerPotentialAssignedsMapper.insertList(potentialAssignedsList); aclPractitionerPotentialAssignedsMapper.insertList(potentialAssignedsList);
} }
@Override
public List<AclPractitionerPotentialAssigneds> findByPotentialIdAndPractitionerId(Long potentialId, Long practitionerId) {
return aclPractitionerPotentialAssignedsMapper.findByPotentialIdAndPractitionerId(potentialId,practitionerId);
}
@Override
public void update(AclPractitionerPotentialAssigneds assigneds) {
aclPractitionerPotentialAssignedsMapper.updateByPrimaryKeySelective(assigneds);
}
@Override
public List<AclPractitionerPotentialAssigneds> findByPractitionerId(Long practitionerId) {
return aclPractitionerPotentialAssignedsMapper.findByPractitionerId(practitionerId);
}
} }
...@@ -13,10 +13,11 @@ ...@@ -13,10 +13,11 @@
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" /> <result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
<result column="updater_type" jdbcType="INTEGER" property="updaterType" /> <result column="updater_type" jdbcType="INTEGER" property="updaterType" />
<result column="creator_type" jdbcType="INTEGER" property="creatorType" /> <result column="creator_type" jdbcType="INTEGER" property="creatorType" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, assigned_practitioner_id, practitioner_potential_id, time_to_onboarding, is_active, id, assigned_practitioner_id, practitioner_potential_id, time_to_onboarding, is_active,
created_at, created_by, updated_at, updated_by, updater_type, creator_type created_at, created_by, updated_at, updated_by, updater_type, creator_type,remark
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select select
...@@ -24,6 +25,18 @@ ...@@ -24,6 +25,18 @@
from ag_acl_practitioner_potential_assigneds from ag_acl_practitioner_potential_assigneds
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<select id="findByPotentialIdAndPractitionerId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_practitioner_potential_assigneds
where practitioner_potential_id = #{potentialId,jdbcType=BIGINT} and assigned_practitioner_id = #{practitionerId,jdbcType=BIGINT}
</select>
<select id="findByPractitionerId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_practitioner_potential_assigneds
where assigned_practitioner_id = #{practitionerId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ag_acl_practitioner_potential_assigneds delete from ag_acl_practitioner_potential_assigneds
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
...@@ -32,11 +45,11 @@ ...@@ -32,11 +45,11 @@
insert into ag_acl_practitioner_potential_assigneds (assigned_practitioner_id, practitioner_potential_id, insert into ag_acl_practitioner_potential_assigneds (assigned_practitioner_id, practitioner_potential_id,
time_to_onboarding, is_active, created_at, time_to_onboarding, is_active, created_at,
created_by, updated_at, updated_by, created_by, updated_at, updated_by,
updater_type, creator_type) updater_type, creator_type,remark)
values (#{assignedPractitionerId,jdbcType=BIGINT}, #{practitionerPotentialId,jdbcType=BIGINT}, values (#{assignedPractitionerId,jdbcType=BIGINT}, #{practitionerPotentialId,jdbcType=BIGINT},
#{timeToOnboarding,jdbcType=TIMESTAMP}, #{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{timeToOnboarding,jdbcType=TIMESTAMP}, #{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}, #{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT},
#{updaterType,jdbcType=INTEGER}, #{creatorType,jdbcType=INTEGER}) #{updaterType,jdbcType=INTEGER}, #{creatorType,jdbcType=INTEGER},#{remark,jdbcType=VARCHER})
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclPractitionerPotentialAssigneds" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclPractitionerPotentialAssigneds" useGeneratedKeys="true">
insert into ag_acl_practitioner_potential_assigneds insert into ag_acl_practitioner_potential_assigneds
...@@ -71,6 +84,9 @@ ...@@ -71,6 +84,9 @@
<if test="creatorType != null"> <if test="creatorType != null">
creator_type, creator_type,
</if> </if>
<if test="remark != null">
remark,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="assignedPractitionerId != null"> <if test="assignedPractitionerId != null">
...@@ -103,6 +119,9 @@ ...@@ -103,6 +119,9 @@
<if test="creatorType != null"> <if test="creatorType != null">
#{creatorType,jdbcType=INTEGER}, #{creatorType,jdbcType=INTEGER},
</if> </if>
<if test="remark != null">
#{remark,jdbcType=VARCHER},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclPractitionerPotentialAssigneds"> <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclPractitionerPotentialAssigneds">
...@@ -138,6 +157,9 @@ ...@@ -138,6 +157,9 @@
<if test="creatorType != null"> <if test="creatorType != null">
creator_type = #{creatorType,jdbcType=INTEGER}, creator_type = #{creatorType,jdbcType=INTEGER},
</if> </if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHER},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -152,14 +174,15 @@ ...@@ -152,14 +174,15 @@
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}, updated_by = #{updatedBy,jdbcType=BIGINT},
updater_type = #{updaterType,jdbcType=INTEGER}, updater_type = #{updaterType,jdbcType=INTEGER},
creator_type = #{creatorType,jdbcType=INTEGER} creator_type = #{creatorType,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHER}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<insert id="insertList" parameterType="java.util.List" useGeneratedKeys="true"> <insert id="insertList" parameterType="java.util.List" useGeneratedKeys="true">
insert into ag_acl_practitioner_potential_assigneds (assigned_practitioner_id, practitioner_potential_id, insert into ag_acl_practitioner_potential_assigneds (assigned_practitioner_id, practitioner_potential_id,
time_to_onboarding, is_active, created_at, time_to_onboarding, is_active, created_at,
created_by, updated_at, updated_by, created_by, updated_at, updated_by,
updater_type, creator_type) updater_type, creator_type,remark)
values values
<foreach collection="potentialAssignedsList" item="item" index="index" separator=","> <foreach collection="potentialAssignedsList" item="item" index="index" separator=",">
( (
...@@ -172,7 +195,8 @@ ...@@ -172,7 +195,8 @@
#{item.updatedAt}, #{item.updatedAt},
#{item.updatedBy}, #{item.updatedBy},
#{item.updaterType}, #{item.updaterType},
#{item.creatorType} #{item.creatorType},
#{item.remark}
) )
</foreach> </foreach>
</insert> </insert>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment