Commit bb196ac4 by 傅伟强-富德

Update test.txt

1 parent 3fd4e93e
Showing with 140 additions and 119 deletions
......@@ -221,30 +221,7 @@ 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{现服务人员代码,服务人员代码}
Map<String, Map> map = new HashMap<String, Map>();
......@@ -257,129 +234,173 @@ order by rnpscr.UPDATED_DATE DESC
//获取当前年份
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");
if (item.equals(policyNo))
try
{
policySuccessMap = new HashMap<>();
/**
* 处理离职交接规则
*/
StaffInfo staffInfo = staffInfoService.selectByPrimaryKey(servicerNo);
int month=0;
int year=0;
if(staffInfo!=null){
Date leaveDate=DateUtil.formatDate(staffInfo.getLeaveDate(),"yyyy-MM-dd");
month = DateUtil.getMonth(leaveDate);
year = DateUtil.getYear(leaveDate);
}
//1:先判断该保单的现服务人员是否在当月或者上月离职 人员离职时间:STAFF_INFO.LEAVE_DATE
if (nowYear==year && (nowMonth==month || nowMonth==(month-1)))
if (item.equals(policyNo))
{
//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,文件格式如下:
//那么这种情况,1先分给了B,那根据规则同一月保单只能分配给同一人,那么2,3保单就只能B
//校验如下,校验保单交出服务人员是否和该保单现服务人员相同,若不相同则没有发生保单离职交接记录
//注:数据库获取保单服务人员交接记录表,该保单最近一次交接记录,获取交出服务人员字段 RN_POLICY_SERVICER_CHG_RECORD.EARLIER_AGENT
RNPolicyServicerChgRecord record =changeService.queryLastTimeServicerChg(policyNo);
/**保 原 接收
* p1 H1 H2
* p2 H1 H3
policySuccessMap = new HashMap<>();
/**
* 处理离职交接规则
*/
//交出服务人员代码
String outSer = 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();
if (record==null)
RNPolicyServiceInfo rnPolicyServiceInfo = servicerInfoService.selectByPolicyNo(policyNo);
StaffInfo staffInfo = null;
if (rnPolicyServiceInfo != null)
{
//情况一:没有记录,根据应缴月从map中取值(应缴月值应该每次去查保单的应缴日),从值中取该保单号的现服务人员,
Map<String, String> m = map.get(String.valueOf(premDueYear)+String.valueOf(premDueMonth));
//现服务人员代码
String nowServicer = null;
//准备交接的服务人员代码
String servicer = null;
/**
* map H1:H2
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
*/
for (Map.Entry<String, String> s : m.entrySet())
//交出服务人员代码
String outSer = null;
//接收服务人员代码
String receiveSer = null;
//现服务人员代码
String nowServicerNo = rnPolicyServiceInfo.getServiceNo();
if (record == null
|| DateUtil.compareToDate(staffInfo.getLeaveDate(),
DateUtil.getDateFormat(record.getUpdatedDate())) != -1)
{
if (s.getKey().equals(nowServicerNo))//H1==1
//情况一:没有记录,或者离职时间大于调整时间(离职之前交接的保单) 小于根据应缴月从map中取值(应缴月值应该每次去查保单的应缴日),从值中取该保单号的现服务人员,
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
}
}
}
//情况1:如果没值,那就符合条件
//情况2:如果有值,根据同月只能分配给同一人员原则,这里就设置为map中的服务人员
if (nowServicer != null)
{
nowServicer = s.getKey();
servicer = s.getValue();//H2
servicerNo = servicer;
}
}
//情况1:如果没值,那就符合条件
//情况2:如果有值,根据同月只能分配给同一人员原则,这里就设置为map中的服务人员
if(nowServicer!=null){
servicerNo = servicer;
else
{
outSer = record.getEarlierAgent();
receiveSer = record.getNextAgent();
//情况二:若保单交出服务人员和该保单现服务人员相同,则说明之前有发生过保单离职交接,那根据一个月中只能分给同一个服务人员原则,那只能分配给接收服务人员
//grasSysTemp.setServicerNo(ReceiveSer);
servicerNo = receiveSer;
}
}
else
{
outSer=record.getEarlierAgent();
receiveSer = record.getNextAgent();
//情况二:若保单交出服务人员和该保单现服务人员相同,则说明之前有发生过保单离职交接,那根据一个月中只能分给同一个服务人员原则,那只能分配给接收服务人员
//grasSysTemp.setServicerNo(ReceiveSer);
servicerNo = receiveSer;
policyMap.put(nowServicerNo, servicerNo);
map.put(String.valueOf(premDueYear) + String.valueOf(premDueMonth), policyMap);
}
policyMap.put(nowServicerNo, servicerNo);
map.put(String.valueOf(premDueYear)+String.valueOf(premDueMonth), policyMap);
/**
* end
*/
policySuccessMap.put("policyNo", policyNo);
policySuccessMap.put("servicerNo", servicerNo);
policySuccessList.add(policySuccessMap);
break;
}
/**
* end
*/
}
catch (Exception e)
{
e.printStackTrace();
policySuccessMap.put("policyNo", policyNo);
policySuccessMap.put("servicerNo", servicerNo);
policySuccessList.add(policySuccessMap);
break;
}
}
}
return policySuccessList;
}
select * from (
select * from RN_POLICY_SERVICER_CHG_RECORD rnpscr
where rnpscr.policy_no in (
select rpsi.policy_no,ppi.prem_due_date from rn_policy_service_info rpsi,policy_prem_info ppi
where ppi.policy_no=rpsi.policy_no
and rpsi.service_no='H000000000026471'
and ppi.prem_due_date>=date'2019-1-1'
and ppi.prem_due_date<date'2019-2-1'
)
and rnpscr.change_mode='0'
order by rnpscr.UPDATED_DATE DESC
)where rownum = 1;
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 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 &lt; "TO_DATE"(#{endMonth},'yyyy-MM-dd hh24:mi:ss')
)
and rnpscr.change_mode='0'
order by rnpscr.UPDATED_DATE DESC
)where rownum = 1
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!