Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
傅伟强-富德
/
test
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7e20d287
authored
Jan 15, 2019
by
傅伟强-富德
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update test.txt
1 parent
b98fcad7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
156 deletions
test.txt
test.txt
View file @
7e20d28
...
@@ -130,186 +130,126 @@ void setUser(String userName);
...
@@ -130,186 +130,126 @@ void setUser(String userName);
private List<Map<String, String>> quitAssign(List<String> policyNoList, List<JSONObject> policyList)
{
//key:应缴日(1812)年份加月份 value{现服务人员代码,服务人员代码}
Map<String, Map> map = new HashMap<String, Map>();
//{现服务人员代码,服务人员代码}
Map<String, String> policyMap = new HashMap<String, String>();
//最后符合条件的保单信息
List<Map<String, String>> policySuccessList = new ArrayList<>();
Map<String, String> policySuccessMap = null;
Date nowDate = new Date();
//获取当前年份
int nowYear = DateUtil.getYear(nowDate);
int nowMonth = DateUtil.getMonth(nowDate);
Map<String,String> paramMap=new HashMap<String,String>();
for (String item : policyNoList)
{
for (JSONObject policyJson : policyList)
{
String policyNo = policyJson.getString("policyNo");
String servicerNo = policyJson.getString("servicerNo");
try
{
if (item.equals(policyNo))
{
policySuccessMap = new HashMap<>();
/**
* 处理离职交接规则
*/
//根据保单号从数据库取现服务人员
RNPolicyServiceInfo rnPolicyServiceInfo = servicerInfoService.selectByPolicyNo(policyNo);
StaffInfo staffInfo = null;
if (rnPolicyServiceInfo != null)
{
staffInfo = staffInfoService.selectByPrimaryKey(rnPolicyServiceInfo.getServiceNo());
}
int month = 0;
int year = 0;
if (staffInfo != null && staffInfo.getLeaveDate() != null)
{
Date leaveDate = DateUtil.formatDate(staffInfo.getLeaveDate(), "yyyy-MM-dd");
month = DateUtil.getMonth(leaveDate);
year = DateUtil.getYear(leaveDate);
}
//1:先判断该保单的现服务人员是否在当月或者上月离职 人员离职时间:STAFF_INFO.LEAVE_DATE
if (quitTime(nowYear, nowMonth, year, month))
{
//2:离职人员名下所有已实收及未收保单均要交接,并计入新接收人考核; ---这点可以不管,只是解释离职人员名下的保单都可以交接
//3.离职人员名下未收件交接遵循“应缴月为同一个月份的保单只能交接给同一个人,不允许分别交接给多个人员”;未收件:保单缴费状态为1的时候为未收件,即POLICY_PREM_INFO.PREM_STATUS=1
//例如:A人员当月离职,他12月名下有3笔保单,分别为1,2,3,分别会出现两种情况,1:A人员应缴日在12月的保单从未有过交接记录 2:A人员应缴日在12月的保单存在交接记录
//情况1:上传文件中,把1,2,3分别分配给B,C,D,文件格式如下:
//数据库获取保单应缴日,得到应缴月
PolicyPremInfo policyPremInfo = premInfoService.selectByPolicyNo(policyNo);
Date premDueDate = DateUtil.formatDate(policyPremInfo.getPremDueDate(), "yyyy-MM-dd");
int premDueMonth = DateUtil.getMonth(premDueDate);
int premDueYear = DateUtil.getYear(premDueDate);
//那么这种情况,1先分给了B,那根据规则同一月保单只能分配给同一人,那么2,3保单就只能B
//校验如下,校验保单交出服务人员是否和该保单现服务人员相同,若不相同则没有发生保单离职交接记录
//注:数据库获取保单服务人员交接记录表,该保单最近一次交接记录,获取交出服务人员字段 RN_POLICY_SERVICER_CHG_RECORD.EARLIER_AGENT
String startMonths = DateUtil.getPerFirstDayOfDate(policyPremInfo.getPremDueDate(), DateUtil.DATETIME_DEFAULT_FORMAT);
String endMonth = DateUtil.getPerLastDayOfDate(policyPremInfo.getPremDueDate(), DateUtil.DATETIME_DEFAULT_FORMAT);
paramMap.put("sreceiveNo", rnPolicyServiceInfo.getServiceNo());
paramMap.put("startMonths", startMonths);
paramMap.put("endMonth", endMonth);
RNPolicyServicerChgRecord record = changeService.queryLastTimeServicerChg(paramMap);
/**保 原 接收
* p1 H1 H2
* p2 H1 H3
*/
//交出服务人员代码
String outSer = null;
//接收服务人员代码
String receiveSer = null;
//现服务人员代码
RNPolicyServicerChgRecord queryLastTimeServicerChg(Map<String,String> paramMap);
String nowServicerNo = rnPolicyServiceInfo.getServiceNo();
if (record == null
|| DateUtil.compareToDate(staffInfo.getLeaveDate(),
DateUtil.getDateFormat(record.getUpdatedDate())) != -1)
{
//情况一:没有记录,或者离职时间大于调整时间(离职之前交接的保单) 小于根据应缴月从map中取值(应缴月值应该每次去查保单的应缴日),从值中取该保单号的现服务人员,
select * from (
select * from RN_POLICY_SERVICER_CHG_RECORD rnpscr
where rnpscr.policy_no in (
select rpsi.policy_no from rn_policy_service_info rpsi,policy_prem_info ppi
where ppi.policy_no=rpsi.policy_no
and rpsi.service_no=#{sreceiveNo}
and ppi.prem_due_date >= "TO_DATE"(#{startMonths},'yyyy-MM-dd hh24:mi:ss')
and ppi.prem_due_date < "TO_DATE"(#{endMonth},'yyyy-MM-dd hh24:mi:ss')
)
and rnpscr.change_mode='0'
order by rnpscr.UPDATED_DATE DESC
)where rownum = 1
Map<String, String> m = map.get(String.valueOf(premDueYear)
+ String.valueOf(premDueMonth));
//现服务人员代码
String nowServicer = null;
//准备交接的服务人员代码
String servicer = null;
/**
* map H1:H2
*/
if(m!=null){
for (Map.Entry<String, String> s : m.entrySet())
{
if (s.getKey().equals(nowServicerNo))//H1==1
{
nowServicer = s.getKey();
servicer = s.getValue();//H2
}
//人员转岗校验
Map<String,String> map= transferPost(policyNo,servicerNo);
if(map.get("flag").equals(MyConstant.ISPASS_NO)){
failedList.add(policyNo);
policyFailedMap = new HashMap<>();
policyFailedMap.put("policyNo", policyNo);
policyFailedMap.put("servicerNo", servicerNo);
policyFailedMap.put("cause", map.get("msg"));
policyFailedList.add(policyFailedMap);
failedCount += 1;
continue;
}
}
}
//情况1:如果没值,那就符合条件
//情况2:如果有值,根据同月只能分配给同一人员原则,这里就设置为map中的服务人员
if (nowServicer != null)
{
servicerNo = servicer;
}
//服务人员转岗
private Map<String,String> transferPost(String policyNo,String newEmpNo){
Map<String,String> retMap=new HashMap<String,String>();
RNPolicyServiceInfo rnPolicyServiceInfo = servicerInfoService
.selectByPolicyNo(policyNo);
String oldEmpNo=rnPolicyServiceInfo.getServiceNo();
Date nowDate = new Date();
//获取当前年份
int nowYear = DateUtil.getYear(nowDate);
int nowMonth = DateUtil.getMonth(nowDate);
//1:收展服务人员转岗的情况下,该人员在原岗位时已分配的保单不同意调整,
//应由该服务人员继续服务至过保单考核,此类保单次年再按照规则分配给其他相应收展服务人员
if(!surrenderEmp(oldEmpNo,policyNo,nowYear)){
retMap.put("flag", MyConstant.ISPASS_NO);
retMap.put("msg", "该保单原收展服务人员转岗后已分配的保单不能调整");
return retMap;
}
}
else
//收展服务人员转岗当月,可以进行次月应收保单分配
{
if(!receiveEmp(newEmpNo,policyNo,nowYear,nowMonth)){
outSer = record.getEarlierAgent();
retMap.put("flag", MyConstant.ISPASS_NO);
receiveSer = record.getNextAgent();
retMap.put("msg", "该保单原收展服务人员转岗后已分配的保单不能调整");
//情况二:若保单交出服务人员和该保单现服务人员相同,则说明之前有发生过保单离职交接,那根据一个月中只能分给同一个服务人员原则,那只能分配给接收服务人员
return retMap;
//grasSysTemp.setServicerNo(ReceiveSer);
servicerNo = receiveSer;
}
}
policyMap.put(nowServicerNo, servicerNo
);
retMap.put("flag", MyConstant.ISPASS_YES
);
map.put(String.valueOf(premDueYear) + String.valueOf(premDueMonth), policyMap)
;
return retMap
;
}
}
/**
/**
* end
* @param newEmpNo
* @param policyNo
* @param nowYear
* @param nowMonth
*/
*/
private boolean receiveEmp(String newEmpNo, String policyNo, int nowYear, int nowMonth)
policySuccessMap.put("policyNo", policyNo);
policySuccessMap.put("servicerNo", servicerNo);
policySuccessList.add(policySuccessMap);
break;
}
}
catch (Exception e)
{
{
e.printStackTrace();
RenewalStaffChangeHistory newEmpChangeHistory=oracleRenewalStaffChangeHistory.queryTransferPostByEmpNo(newEmpNo);
policySuccessMap.put("policyNo", policyNo);
if(newEmpChangeHistory==null){
policySuccessMap.put("servicerNo", servicerNo);
return true;
policySuccessList.add(policySuccessMap);
break;
}
}
}
}
return policySuccessList;
Date dueMonth=newEmpChangeHistory.getUpdatedDate();
int month = DateUtil.getMonth(dueMonth);
int year = DateUtil.getYear(dueMonth);
//若是当月转岗 可以进行当月之后的应收保单分配
if(year==nowYear && month==nowMonth){
PolicyPremInfo policyPremInfo= premInfoService.selectByPolicyNo(policyNo);
}
Date premDueDate=DateUtil.getDateFormat(policyPremInfo.getPremDueDate());
int premDueDateMonth = DateUtil.getMonth(premDueDate);
int premDueDateYear = DateUtil.getYear(premDueDate);
private boolean quitTime(int nowYear, int nowMonth, int year, int month)
if((year==premDueDateYear && premDueDateMonth>month) || premDueDateYear>year){
{
return true;
//同年--当月&上月
}else{
if (nowYear == year && (nowMonth == month || nowMonth == (month - 1)))
return false;
{
}
}else{
//如果不是当月,那就是之前转岗的,那也符合条件
return true;
return true;
}
}
//去年 ---上月
}
if ((nowYear - year) == 1 && month == 12)
/**
* @param oldEmpNo
* @param policyNo
* @param nowYear
* @param nowMonth
*/
private boolean surrenderEmp(String oldEmpNo, String policyNo, int nowYear)
{
{
//取renewal_staff_change_history表, change_type=4,change_status=3的数据
RenewalStaffChangeHistory oldEmpNoChangeHistory=oracleRenewalStaffChangeHistory.queryTransferPostByEmpNo(oldEmpNo);
if(oldEmpNoChangeHistory==null){
return true;
return true;
}
}
Date dueMonth=oldEmpNoChangeHistory.getUpdatedDate();
int year = DateUtil.getYear(dueMonth);
//原收展服务人员名下的保单,次年才可以交接给其他服务人员
if(year>nowYear){
return true;
}else{
return false;
return false;
}
}
RNPolicyServicerChgRecord queryLastTimeServicerChg(Map<String,String> paramMap);
select * from (
}
select * from RN_POLICY_SERVICER_CHG_RECORD rnpscr
where rnpscr.policy_no in (
select rpsi.policy_no from rn_policy_service_info rpsi,policy_prem_info ppi
where ppi.policy_no=rpsi.policy_no
and rpsi.service_no=#{sreceiveNo}
and ppi.prem_due_date >= "TO_DATE"(#{startMonths},'yyyy-MM-dd hh24:mi:ss')
and ppi.prem_due_date < "TO_DATE"(#{endMonth},'yyyy-MM-dd hh24:mi:ss')
)
and rnpscr.change_mode='0'
order by rnpscr.UPDATED_DATE DESC
)where rownum = 1
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment