Commit 6c812d91 by Water Wang

optimize

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