Commit fa021f3a by jianan

【电子报聘】报聘经纪人所属体系规则优化2

parent 327ec488
...@@ -644,7 +644,7 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService ...@@ -644,7 +644,7 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService
//基本信息 //基本信息
AclPractitionerHiringBasicInfo hiringBasicInfo = basicInfoMapper.selectByPrimaryKey(hiringBasicInfoId); AclPractitionerHiringBasicInfo hiringBasicInfo = basicInfoMapper.selectByPrimaryKey(hiringBasicInfoId);
//组织关系 //组织关系
AclPractitionerHiringMembership hiringMemberShip = membershipMapper.selectByHiringBasicInfoId(hiringBasicInfoId); AclPractitionerHiringMembership hiringMemberShip = this.queryHiringMemberShip(hiringBasicInfoId);
//工作经历 //工作经历
List<AclPractitionerHiringWorkingExperience> hiringWorkingExperienceList = workingExperienceMapper.selectByHiringBasicInfoId(hiringBasicInfoId); List<AclPractitionerHiringWorkingExperience> hiringWorkingExperienceList = workingExperienceMapper.selectByHiringBasicInfoId(hiringBasicInfoId);
//申请名目 //申请名目
...@@ -671,6 +671,66 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService ...@@ -671,6 +671,66 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService
return resp; return resp;
} }
private AclPractitionerHiringMembership queryHiringMemberShip(Long hiringBasicInfoId) {
AclPractitionerHiringMembership hiringMemberShip = membershipMapper.selectByHiringBasicInfoId(hiringBasicInfoId);
AclPractitioner mentor = aclPractitionerDALService.findPractitionerById(hiringMemberShip.getMentorPractitionerId());
// 查询并显示“辅导人”所属的S1分部,分部负责人,S2体系,体系负责人,S3纵队,纵队负责人,没有的显示空
List<AclPractitionerSubordinateSystem> subordinateSystemList = aclPractitionerSubordinateSystemDALService.findAll();
Map<Long, AclPractitionerSubordinateSystem> subordinateSystemMap = new HashMap<>();
subordinateSystemList.forEach(i -> subordinateSystemMap.put(i.getId(), i));
Map<Long, AclPractitioner> aclPractitionerMap = aclPractitionerDALService.findAllMap();
//所属体系
AclPractitionerSubordinateSystem subordinateSystem = null;
//体系团队长
AclPractitioner systemOwner = null;
if (mentor.getS1Id() != null) {
subordinateSystem = subordinateSystemMap.get(mentor.getS1Id());
if (subordinateSystem != null) {
hiringMemberShip.setS1SubordinateSystemName(subordinateSystem.getName());
systemOwner = aclPractitionerMap.get(subordinateSystem.getOwnerPractitionerId());
hiringMemberShip.setS1TeamLeaderName(systemOwner != null ? systemOwner.getName() : null);
hiringMemberShip.setS1TeamLeaderId(systemOwner != null ? systemOwner.getId() : null);
}
}
if (null != mentor.getS2Id()) {
subordinateSystem = subordinateSystemMap.get(mentor.getS2Id());
if (subordinateSystem != null) {
hiringMemberShip.setS2SubordinateSystemName(subordinateSystem != null ? subordinateSystem.getName() : null);
systemOwner = aclPractitionerMap.get(subordinateSystem.getOwnerPractitionerId());
hiringMemberShip.setS2TeamLeaderName(systemOwner != null ? systemOwner.getName() : null);
hiringMemberShip.setS2TeamLeaderId(systemOwner != null ? systemOwner.getId() : null);
}
}
if (null != mentor.getS3Id()) {
subordinateSystem = subordinateSystemMap.get(mentor.getS3Id());
if (subordinateSystem != null) {
hiringMemberShip.setS3SubordinateSystemName(subordinateSystem != null ? subordinateSystem.getName() : null);
systemOwner = aclPractitionerMap.get(subordinateSystem.getOwnerPractitionerId());
hiringMemberShip.setS3TeamLeaderName(systemOwner != null ? systemOwner.getName() : null);
hiringMemberShip.setS3TeamLeaderId(systemOwner != null ? systemOwner.getId() : null);
}
}
// 自身所属体系等级
// if (null != mentor.getSubordinateSystemId()) {
// subordinateSystem = subordinateSystemMap.get(mentor.getSubordinateSystemId());
// if (subordinateSystem != null) {
// String systemType = subordinateSystem.getSystemType();
// switch (systemType) {
// case "S1" :hiringMemberShip.getSystemFlag();break;
// }
// }
// }
return hiringMemberShip;
}
@Override @Override
public CommonResultResponseVO saveDigitalSignatures(SaveDigitalSignaturesRequestVO requestVO) { public CommonResultResponseVO saveDigitalSignatures(SaveDigitalSignaturesRequestVO requestVO) {
CommonResultResponseVO resp = new CommonResultResponseVO(); CommonResultResponseVO resp = new CommonResultResponseVO();
...@@ -898,6 +958,8 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService ...@@ -898,6 +958,8 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService
} }
// 计算审批流程 // 计算审批流程
basicInfo.setApproveStatus(this.handleApproveStatus(hiringMemberShip)); basicInfo.setApproveStatus(this.handleApproveStatus(hiringMemberShip));
// 将申请人分配给体系负责人
this.distributeToSubsystemOwner(basicInfoId);
basicInfoMapper.updateByPrimaryKeySelective(basicInfo); basicInfoMapper.updateByPrimaryKeySelective(basicInfo);
...@@ -910,6 +972,27 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService ...@@ -910,6 +972,27 @@ public class PractitionerHiringServiceImpl implements PractitionerHiringService
return resp; return resp;
} }
private void distributeToSubsystemOwner(Long hiringBasicInfoId) {
AclPractitionerHiringMembership hiringMemberShip = this.queryHiringMemberShip(hiringBasicInfoId);
Long s1TeamLeaderId = hiringMemberShip.getS1TeamLeaderId();
Long s2TeamLeaderId = hiringMemberShip.getS2TeamLeaderId();
Long s3TeamLeaderId = hiringMemberShip.getS3TeamLeaderId();
Long approvedBy = hiringMemberShip.getSubsystemOwnerId();
if (s2TeamLeaderId != null) {
approvedBy = s2TeamLeaderId;
} else {
if (s1TeamLeaderId != null) {
approvedBy = s1TeamLeaderId;
} else {
approvedBy = s3TeamLeaderId;
}
}
systemConfigService.putIntoListOfSubsystemOwner(approvedBy, hiringBasicInfoId);
}
private String handleApproveStatus(AclPractitionerHiringMembership hiringMemberShip) { private String handleApproveStatus(AclPractitionerHiringMembership hiringMemberShip) {
// 经纪人报聘职级 // 经纪人报聘职级
String mdDropOptionName = hiringMemberShip.getMdDropOptionName(); String mdDropOptionName = hiringMemberShip.getMdDropOptionName();
......
package com.yd.dal.entity.customer; package com.yd.dal.entity.customer;
import java.util.Date;
import lombok.Data; import lombok.Data;
import java.util.Date;
/** /**
* 報聘经纪人组织关系表 * 報聘经纪人组织关系表
*/ */
...@@ -99,4 +100,18 @@ public class AclPractitionerHiringMembership { ...@@ -99,4 +100,18 @@ public class AclPractitionerHiringMembership {
private Date updatedAt; private Date updatedAt;
private Long updatedBy; private Long updatedBy;
/**
* 辅导人的组织架构信息
*/
private String systemFlag;//系统标志,区分公司营业部和体系,1,分公司,2营业部,3,S1分部,4,S2体系,5,S3纵队
private String s3SubordinateSystemName;//s3所属体系名称
private String s2SubordinateSystemName;//s2所属体系名称
private String s1SubordinateSystemName;//s1所属体系名称
private String s3TeamLeaderName;//S3团队长名称
private String s2TeamLeaderName;//S2团队长名称
private String s1TeamLeaderName;//S1团队长名称
private Long s3TeamLeaderId;//S3团队长Id
private Long s2TeamLeaderId;//S2团队长Id
private Long s1TeamLeaderId;//S1团队长Id
} }
\ No newline at end of file
...@@ -66,9 +66,11 @@ public interface PractitionerHiringMapper { ...@@ -66,9 +66,11 @@ public interface PractitionerHiringMapper {
List<HiringListInfo> queryMentorUnhandledList(Long practitionerId); List<HiringListInfo> queryMentorUnhandledList(Long practitionerId);
List<HiringListInfo> querySystemOwnerUnhandledList(Long practitionerId); List<HiringListInfo> querySystemOwnerUnhandledList(List<Long> list);
String getNextContractNo(); String getNextContractNo();
Map<String, Long> queryS1S2S3(Long practitionerId); Map<String, Long> queryS1S2S3(Long practitionerId);
List<Long> queryBasicInfoIdList(List<Long> list);
} }
...@@ -14,6 +14,7 @@ import com.yd.dal.entity.practitioner.payscale.PayScaleBasicInfo; ...@@ -14,6 +14,7 @@ import com.yd.dal.entity.practitioner.payscale.PayScaleBasicInfo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
@Service("aclPractitionerDALService") @Service("aclPractitionerDALService")
public interface AclPractitionerDALService { public interface AclPractitionerDALService {
...@@ -261,4 +262,6 @@ public interface AclPractitionerDALService { ...@@ -261,4 +262,6 @@ public interface AclPractitionerDALService {
* @author Yan Wenyang * @author Yan Wenyang
*/ */
void updateUnionSales(Long unionSalesId, String ossPath, String signStatus); void updateUnionSales(Long unionSalesId, String ossPath, String signStatus);
Map<Long, AclPractitioner> findAllMap();
} }
...@@ -33,7 +33,10 @@ import org.springframework.web.context.request.RequestContextHolder; ...@@ -33,7 +33,10 @@ import org.springframework.web.context.request.RequestContextHolder;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service("aclPractitionerDALService") @Service("aclPractitionerDALService")
public class AclPractitionerDALServiceImpl implements AclPractitionerDALService { public class AclPractitionerDALServiceImpl implements AclPractitionerDALService {
private static final Logger LOG = Logger.getLogger(AclPractitionerDALServiceImpl.class); private static final Logger LOG = Logger.getLogger(AclPractitionerDALServiceImpl.class);
...@@ -378,4 +381,12 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService ...@@ -378,4 +381,12 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService
aclPractitionerMapper.updateUnionSales(unionSalesId, ossPath, signStatus); aclPractitionerMapper.updateUnionSales(unionSalesId, ossPath, signStatus);
} }
@Override
public Map<Long, AclPractitioner> findAllMap() {
List<AclPractitioner> list = this.findAll();
Map<Long, AclPractitioner> aclPractitionerMap = new HashMap<>();
list.forEach(i -> aclPractitionerMap.put(i.getId(), i));
return aclPractitionerMap;
}
} }
package com.yd.dal.service.practitioner; package com.yd.dal.service.practitioner;
import com.github.pagehelper.PageInfo;
import com.yd.api.practitioner.vo.hiring.PractitionerHiringContractTerms; import com.yd.api.practitioner.vo.hiring.PractitionerHiringContractTerms;
import com.yd.dal.entity.agms.hiring.*;
import com.yd.dal.entity.practitioner.hiring.*; import com.yd.dal.entity.practitioner.hiring.*;
import java.util.List; import java.util.List;
...@@ -98,4 +96,6 @@ public interface PractitionerHiringDALService { ...@@ -98,4 +96,6 @@ public interface PractitionerHiringDALService {
String getApproveStatusByStepSeq(Integer stepSeq); String getApproveStatusByStepSeq(Integer stepSeq);
Integer getNextStepSeqByApproveStatus(String approveStatus); Integer getNextStepSeqByApproveStatus(String approveStatus);
List<Long> queryBasicInfoIdList(List<Long> list);
} }
...@@ -208,41 +208,28 @@ public class PractitionerHiringDALServiceImpl implements PractitionerHiringDALSe ...@@ -208,41 +208,28 @@ public class PractitionerHiringDALServiceImpl implements PractitionerHiringDALSe
private List<HiringListInfo> queryYdLifeHiringinfoList(Long practitionerId) { private List<HiringListInfo> queryYdLifeHiringinfoList(Long practitionerId) {
// 查询审批身份 0.既是辅导人又是团队长 1.辅导人 2.团队长 // 查询审批身份 0.既是辅导人又是团队长 1.辅导人 2.团队长
int approvalIdentity = this.queryApprovalIdentity(practitionerId); int approvalIdentity = this.queryApprovalIdentity(practitionerId);
// 查询当前经纪人的S1,S2,S3体系的团队长practitionerId
Map<String, Long> SystemOwners = practitionerHiringMapper.queryS1S2S3(practitionerId);
List<HiringListInfo> resultList = new ArrayList<>(); List<HiringListInfo> resultList = new ArrayList<>();
if (approvalIdentity == 1) { if (approvalIdentity == 1) {
resultList = practitionerHiringMapper.queryMentorUnhandledList(practitionerId); resultList = practitionerHiringMapper.queryMentorUnhandledList(practitionerId);
} else if (approvalIdentity == 2) { } else if (approvalIdentity == 2) {
resultList = practitionerHiringMapper.querySystemOwnerUnhandledList(practitionerId); resultList = this.querySystemOwnerUnhandledList(practitionerId);
} else { } else {
List<HiringListInfo> list1 = practitionerHiringMapper.queryMentorUnhandledList(practitionerId); List<HiringListInfo> list1 = practitionerHiringMapper.queryMentorUnhandledList(practitionerId);
List<HiringListInfo> list2 = practitionerHiringMapper.querySystemOwnerUnhandledList(practitionerId); List<HiringListInfo> list2 = this.querySystemOwnerUnhandledList(practitionerId);
resultList.addAll(list1); resultList.addAll(list1);
resultList.addAll(list2); resultList.addAll(list2);
} }
return resultList;
}
// resultList = practitionerHiringMapper.querySystemOwnerUnhandledList(practitionerId); private List<HiringListInfo> querySystemOwnerUnhandledList(Long practitionerId) {
List<HiringListInfo> list = new ArrayList<>(); List<HiringListInfo> resultList = new ArrayList<>();
for (HiringListInfo item :resultList) { List<Long> listOfSubsystemOwner = systemConfigService.getListOfSubsystemOwner(practitionerId);
Long s2PractitionerId = item.getS2PractitionerId(); if (CollectionUtils.isNotEmpty(listOfSubsystemOwner)) {
Long s1PractitionerId = item.getS1PractitionerId(); resultList = practitionerHiringMapper.querySystemOwnerUnhandledList(listOfSubsystemOwner);
Long s3PractitionerId = item.getS3PractitionerId();
if(s2PractitionerId != null && practitionerId.equals(s2PractitionerId)){
list.add(item);
continue;
}
if(s2PractitionerId == null && s1PractitionerId != null && practitionerId.equals(s1PractitionerId)){
list.add(item);
continue;
}
if(s2PractitionerId == null && s1PractitionerId == null && practitionerId.equals(s3PractitionerId)){
list.add(item);
}
} }
return resultList;
return list;
} }
private List<HiringListInfo> queryAGMSHiringinfoList(String practitionerMobileNo) { private List<HiringListInfo> queryAGMSHiringinfoList(String practitionerMobileNo) {
...@@ -343,4 +330,9 @@ public class PractitionerHiringDALServiceImpl implements PractitionerHiringDALSe ...@@ -343,4 +330,9 @@ public class PractitionerHiringDALServiceImpl implements PractitionerHiringDALSe
} }
return null; return null;
} }
@Override
public List<Long> queryBasicInfoIdList(List<Long> list) {
return practitionerHiringMapper.queryBasicInfoIdList(list);
}
} }
...@@ -4,10 +4,12 @@ import com.yd.dal.entity.customer.AclInsurerBranch; ...@@ -4,10 +4,12 @@ import com.yd.dal.entity.customer.AclInsurerBranch;
import com.yd.dal.entity.meta.*; import com.yd.dal.entity.meta.*;
import com.yd.dal.service.customer.AclInsurerBranchDALService; import com.yd.dal.service.customer.AclInsurerBranchDALService;
import com.yd.dal.service.meta.*; import com.yd.dal.service.meta.*;
import com.yd.dal.service.practitioner.PractitionerHiringDALService;
import com.yd.rmi.ali.ossinterf.service.AliOssInterfService; import com.yd.rmi.ali.ossinterf.service.AliOssInterfService;
import com.yd.util.CommonUtil; import com.yd.util.CommonUtil;
import net.sf.ehcache.Cache; import net.sf.ehcache.Cache;
import net.sf.ehcache.Element; import net.sf.ehcache.Element;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -37,6 +39,8 @@ public class SystemConfigService implements CommandLineRunner{ ...@@ -37,6 +39,8 @@ public class SystemConfigService implements CommandLineRunner{
private MdDropOptionsDALService mdDropOptionsDALService; private MdDropOptionsDALService mdDropOptionsDALService;
@Autowired @Autowired
private AclInsurerBranchDALService aclInsurerBranchDALService; private AclInsurerBranchDALService aclInsurerBranchDALService;
@Autowired
private PractitionerHiringDALService practitionerHiringDalService;
/** /**
* 保存cache * 保存cache
...@@ -347,4 +351,51 @@ public class SystemConfigService implements CommandLineRunner{ ...@@ -347,4 +351,51 @@ public class SystemConfigService implements CommandLineRunner{
} }
return map; return map;
} }
public void putIntoListOfSubsystemOwner(Long approvedBy, Long hiringBasicInfoId) {
Map<Long, List<Long>> map = null;
Element element = systemConfigCache.get("listOfSubsystemOwner");
if(element != null && element.getObjectValue() != null){
map = (Map<Long, List<Long>>)element.getObjectValue();
}else{
map = new HashMap<>();
element = new Element("listOfSubsystemOwner",map);
systemConfigCache.put(element);
}
if (map != null) {
List<Long> list = map.get(approvedBy);
if (list == null) {
list = new ArrayList<>();
}
list.add(hiringBasicInfoId);
map.put(approvedBy, list);
}
}
public List<Long> getListOfSubsystemOwner(Long approvedBy) {
Map<Long, List<Long>> map = null;
List<Long> list = null;
Element element = systemConfigCache.get("listOfSubsystemOwner");
if(element != null && element.getObjectValue() != null){
map = (Map<Long, List<Long>>)element.getObjectValue();
}else{
map = new HashMap<>();
element = new Element("listOfSubsystemOwner",map);
systemConfigCache.put(element);
}
if (map != null) {
list = map.get(approvedBy);
if (list == null) {
list = new ArrayList<>();
}
// 去除已审核的id
if (CollectionUtils.isNotEmpty(list)) {
list = practitionerHiringDalService.queryBasicInfoIdList(list);
map.put(approvedBy, list);
}
}
return list;
}
} }
...@@ -252,14 +252,11 @@ ...@@ -252,14 +252,11 @@
date_format(b.created_at, '%Y-%m-%d %H:%i:%s') applicationTime, date_format(b.created_at, '%Y-%m-%d %H:%i:%s') applicationTime,
if(m.mentor_practitioner_id = #{practitionerId,jdbcType=BIGINT} and if(m.mentor_practitioner_id = #{practitionerId,jdbcType=BIGINT} and
m.subsystem_owner_id = #{practitionerId,jdbcType=BIGINT}, 0, m.subsystem_owner_id = #{practitionerId,jdbcType=BIGINT}, 0,
if(m.mentor_practitioner_id = #{practitionerId,jdbcType=BIGINT}, 1, 2)) approvalIdentity, if(m.mentor_practitioner_id = #{practitionerId,jdbcType=BIGINT}, 1, 2)) approvalIdentity
(select owner_practitioner_id from ag_acl_practitioner_subordinate_system where id=p.s1_id) as s1PractitionerId,
(select owner_practitioner_id from ag_acl_practitioner_subordinate_system where id=p.s2_id) as s2PractitionerId,
(select owner_practitioner_id from ag_acl_practitioner_subordinate_system where id=p.s3_id) as s3PractitionerId
from ag_acl_practitioner_hiring_basic_info b from ag_acl_practitioner_hiring_basic_info b
left join ag_acl_practitioner_hiring_membership m on b.id = m.hiring_basic_info_id left join ag_acl_practitioner_hiring_membership m on b.id = m.hiring_basic_info_id
left join ag_acl_practitioner p on m.subsystem_owner_id = p.id
where 1=1 where 1=1
and b.id in <foreach collection="list" item="p_id" open="(" separator="," close=")">#{p_id,jdbcType=BIGINT}</foreach>
and b.approve_status = '1' and b.approve_status = '1'
and m.md_drop_option_id != (select id and m.md_drop_option_id != (select id
from ag_md_drop_options from ag_md_drop_options
...@@ -281,4 +278,12 @@ ...@@ -281,4 +278,12 @@
from ag_acl_practitioner p from ag_acl_practitioner p
where p.id = #{practitionerId,jdbcType=BIGINT} where p.id = #{practitionerId,jdbcType=BIGINT}
</select> </select>
<select id="queryBasicInfoIdList" resultType="java.lang.Long">
select b.id
from ag_acl_practitioner_hiring_basic_info b
where 1=1
and b.id in <foreach collection="list" item="p_id" open="(" separator="," close=")">#{p_id,jdbcType=BIGINT}</foreach>
and b.approve_status = '1'
</select>
</mapper> </mapper>
\ No newline at end of file
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