Commit bb196ac4 by 傅伟强-富德

Update test.txt

1 parent 3fd4e93e
Showing with 78 additions and 57 deletions
...@@ -221,29 +221,6 @@ void setUser(String userName); ...@@ -221,29 +221,6 @@ void setUser(String userName);
select * from (
select * from RN_POLICY_SERVICER_CHG_RECORD rnpscr
where rnpscr.policy_no='0046001110026725'
order by rnpscr.UPDATED_DATE DESC
)where rownum <= 1
/**
* MethodName: quitAssign
* Description: [保单离职交接规则]
*@param grasSysTempList
*@return String
*
* @author Mamba
* @date 2019年1月8日 下午2:26:28
*/
private List<Map<String, String>> quitAssign(List<String> policyNoList, List<JSONObject> policyList) private List<Map<String, String>> quitAssign(List<String> policyNoList, List<JSONObject> policyList)
{ {
//key:应缴日(1812)年份加月份 value{现服务人员代码,服务人员代码} //key:应缴日(1812)年份加月份 value{现服务人员代码,服务人员代码}
...@@ -257,29 +234,38 @@ order by rnpscr.UPDATED_DATE DESC ...@@ -257,29 +234,38 @@ order by rnpscr.UPDATED_DATE DESC
//获取当前年份 //获取当前年份
int nowYear = DateUtil.getYear(nowDate); int nowYear = DateUtil.getYear(nowDate);
int nowMonth = DateUtil.getMonth(nowDate); int nowMonth = DateUtil.getMonth(nowDate);
Map<String,String> paramMap=new HashMap<String,String>();
for (String item : policyNoList) for (String item : policyNoList)
{ {
for (JSONObject policyJson : policyList) for (JSONObject policyJson : policyList)
{ {
String policyNo = policyJson.getString("policyNo"); String policyNo = policyJson.getString("policyNo");
String servicerNo = policyJson.getString("servicerNo"); String servicerNo = policyJson.getString("servicerNo");
try
{
if (item.equals(policyNo)) if (item.equals(policyNo))
{ {
policySuccessMap = new HashMap<>(); policySuccessMap = new HashMap<>();
/** /**
* 处理离职交接规则 * 处理离职交接规则
*/ */
StaffInfo staffInfo = staffInfoService.selectByPrimaryKey(servicerNo); //根据保单号从数据库取现服务人员
int month=0; RNPolicyServiceInfo rnPolicyServiceInfo = servicerInfoService.selectByPolicyNo(policyNo);
int year=0; StaffInfo staffInfo = null;
if(staffInfo!=null){ if (rnPolicyServiceInfo != null)
Date leaveDate=DateUtil.formatDate(staffInfo.getLeaveDate(),"yyyy-MM-dd"); {
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); month = DateUtil.getMonth(leaveDate);
year = DateUtil.getYear(leaveDate); year = DateUtil.getYear(leaveDate);
} }
//1:先判断该保单的现服务人员是否在当月或者上月离职 人员离职时间:STAFF_INFO.LEAVE_DATE //1:先判断该保单的现服务人员是否在当月或者上月离职 人员离职时间:STAFF_INFO.LEAVE_DATE
if (nowYear==year && (nowMonth==month || nowMonth==(month-1))) if (quitTime(nowYear, nowMonth, year, month))
{ {
//2:离职人员名下所有已实收及未收保单均要交接,并计入新接收人考核; ---这点可以不管,只是解释离职人员名下的保单都可以交接 //2:离职人员名下所有已实收及未收保单均要交接,并计入新接收人考核; ---这点可以不管,只是解释离职人员名下的保单都可以交接
...@@ -287,11 +273,21 @@ order by rnpscr.UPDATED_DATE DESC ...@@ -287,11 +273,21 @@ order by rnpscr.UPDATED_DATE DESC
//例如:A人员当月离职,他12月名下有3笔保单,分别为1,2,3,分别会出现两种情况,1:A人员应缴日在12月的保单从未有过交接记录 2:A人员应缴日在12月的保单存在交接记录 //例如:A人员当月离职,他12月名下有3笔保单,分别为1,2,3,分别会出现两种情况,1:A人员应缴日在12月的保单从未有过交接记录 2:A人员应缴日在12月的保单存在交接记录
//情况1:上传文件中,把1,2,3分别分配给B,C,D,文件格式如下: //情况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 //那么这种情况,1先分给了B,那根据规则同一月保单只能分配给同一人,那么2,3保单就只能B
//校验如下,校验保单交出服务人员是否和该保单现服务人员相同,若不相同则没有发生保单离职交接记录 //校验如下,校验保单交出服务人员是否和该保单现服务人员相同,若不相同则没有发生保单离职交接记录
//注:数据库获取保单服务人员交接记录表,该保单最近一次交接记录,获取交出服务人员字段 RN_POLICY_SERVICER_CHG_RECORD.EARLIER_AGENT //注:数据库获取保单服务人员交接记录表,该保单最近一次交接记录,获取交出服务人员字段 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);
RNPolicyServicerChgRecord record =changeService.queryLastTimeServicerChg(policyNo); paramMap.put("sreceiveNo", rnPolicyServiceInfo.getServiceNo());
paramMap.put("startMonths", startMonths);
paramMap.put("endMonth", endMonth);
RNPolicyServicerChgRecord record = changeService.queryLastTimeServicerChg(paramMap);
/**保 原 接收 /**保 原 接收
* p1 H1 H2 * p1 H1 H2
* p2 H1 H3 * p2 H1 H3
...@@ -301,21 +297,19 @@ order by rnpscr.UPDATED_DATE DESC ...@@ -301,21 +297,19 @@ order by rnpscr.UPDATED_DATE DESC
String outSer = null; String outSer = null;
//接收服务人员代码 //接收服务人员代码
String receiveSer = null; String receiveSer = null;
//数据库获取保单应缴日,得到应缴月
PolicyPremInfo policyPremInfo= premInfoService.selectByPolicyNo(policyNo);
Date premDueDate=DateUtil.formatDate(policyPremInfo.getPremDueDate(),"yyyy-MM-dd");
int premDueMonth = DateUtil.getMonth(premDueDate);
int premDueYear = DateUtil.getYear(premDueDate);
//根据保单号从数据库取现服务人员
RNPolicyServiceInfo rnPolicyServiceInfo=servicerInfoService.selectByPolicyNo(policyNo);
//现服务人员代码 //现服务人员代码
String nowServicerNo=rnPolicyServiceInfo.getServiceNo(); String nowServicerNo = rnPolicyServiceInfo.getServiceNo();
if (record==null)
if (record == null
|| DateUtil.compareToDate(staffInfo.getLeaveDate(),
DateUtil.getDateFormat(record.getUpdatedDate())) != -1)
{ {
//情况一:没有记录,根据应缴月从map中取值(应缴月值应该每次去查保单的应缴日),从值中取该保单号的现服务人员, //情况一:没有记录,或者离职时间大于调整时间(离职之前交接的保单) 小于根据应缴月从map中取值(应缴月值应该每次去查保单的应缴日),从值中取该保单号的现服务人员,
Map<String, String> m = map.get(String.valueOf(premDueYear)+String.valueOf(premDueMonth)); Map<String, String> m = map.get(String.valueOf(premDueYear)
+ String.valueOf(premDueMonth));
//现服务人员代码 //现服务人员代码
String nowServicer = null; String nowServicer = null;
//准备交接的服务人员代码 //准备交接的服务人员代码
...@@ -323,6 +317,7 @@ order by rnpscr.UPDATED_DATE DESC ...@@ -323,6 +317,7 @@ order by rnpscr.UPDATED_DATE DESC
/** /**
* map H1:H2 * map H1:H2
*/ */
if(m!=null){
for (Map.Entry<String, String> s : m.entrySet()) for (Map.Entry<String, String> s : m.entrySet())
{ {
if (s.getKey().equals(nowServicerNo))//H1==1 if (s.getKey().equals(nowServicerNo))//H1==1
...@@ -332,23 +327,25 @@ order by rnpscr.UPDATED_DATE DESC ...@@ -332,23 +327,25 @@ order by rnpscr.UPDATED_DATE DESC
} }
} }
}
//情况1:如果没值,那就符合条件 //情况1:如果没值,那就符合条件
//情况2:如果有值,根据同月只能分配给同一人员原则,这里就设置为map中的服务人员 //情况2:如果有值,根据同月只能分配给同一人员原则,这里就设置为map中的服务人员
if(nowServicer!=null){ if (nowServicer != null)
{
servicerNo = servicer; servicerNo = servicer;
} }
} }
else else
{ {
outSer=record.getEarlierAgent(); outSer = record.getEarlierAgent();
receiveSer = record.getNextAgent(); receiveSer = record.getNextAgent();
//情况二:若保单交出服务人员和该保单现服务人员相同,则说明之前有发生过保单离职交接,那根据一个月中只能分给同一个服务人员原则,那只能分配给接收服务人员 //情况二:若保单交出服务人员和该保单现服务人员相同,则说明之前有发生过保单离职交接,那根据一个月中只能分给同一个服务人员原则,那只能分配给接收服务人员
//grasSysTemp.setServicerNo(ReceiveSer); //grasSysTemp.setServicerNo(ReceiveSer);
servicerNo = receiveSer; servicerNo = receiveSer;
} }
policyMap.put(nowServicerNo, servicerNo); policyMap.put(nowServicerNo, servicerNo);
map.put(String.valueOf(premDueYear)+String.valueOf(premDueMonth), policyMap); map.put(String.valueOf(premDueYear) + String.valueOf(premDueMonth), policyMap);
} }
/** /**
* end * end
...@@ -361,25 +358,49 @@ order by rnpscr.UPDATED_DATE DESC ...@@ -361,25 +358,49 @@ order by rnpscr.UPDATED_DATE DESC
} }
} }
catch (Exception e)
{
e.printStackTrace();
policySuccessMap.put("policyNo", policyNo);
policySuccessMap.put("servicerNo", servicerNo);
policySuccessList.add(policySuccessMap);
break;
}
}
} }
return policySuccessList; return policySuccessList;
} }
private boolean quitTime(int nowYear, int nowMonth, int year, int month)
{
//同年--当月&上月
if (nowYear == year && (nowMonth == month || nowMonth == (month - 1)))
{
return true;
}
//去年 ---上月
if ((nowYear - year) == 1 && month == 12)
{
return true;
}
return false;
}
RNPolicyServicerChgRecord queryLastTimeServicerChg(Map<String,String> paramMap);
select * from ( select * from (
select * from RN_POLICY_SERVICER_CHG_RECORD rnpscr select * from RN_POLICY_SERVICER_CHG_RECORD rnpscr
where rnpscr.policy_no in ( where rnpscr.policy_no in (
select rpsi.policy_no,ppi.prem_due_date from rn_policy_service_info rpsi,policy_prem_info ppi select rpsi.policy_no from rn_policy_service_info rpsi,policy_prem_info ppi
where ppi.policy_no=rpsi.policy_no where ppi.policy_no=rpsi.policy_no
and rpsi.service_no='H000000000026471' and rpsi.service_no=#{sreceiveNo}
and ppi.prem_due_date>=date'2019-1-1' and ppi.prem_due_date >= "TO_DATE"(#{startMonths},'yyyy-MM-dd hh24:mi:ss')
and ppi.prem_due_date<date'2019-2-1' and ppi.prem_due_date &lt; "TO_DATE"(#{endMonth},'yyyy-MM-dd hh24:mi:ss')
) )
and rnpscr.change_mode='0' and rnpscr.change_mode='0'
order by rnpscr.UPDATED_DATE DESC order by rnpscr.UPDATED_DATE DESC
)where rownum = 1; )where rownum = 1
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!