人员转岗代码 5.2 KB
 
  @Reference(version = "1.0.0")
    private OracleRenewalStaffChangeHistory oracleRenewalStaffChangeHistory;

 
 //人员转岗校验
                    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;
                    }
 
 
 
 
 
 
 
 
 
 
 
 /**
     * 
     * MethodName:  transferPost
     * Description:  [服务人员转岗校验]  
     *@param policyNo
     *@param newEmpNo
     *@return  Map<String,String>
     * 
     * @author  Mamba
     * @date  2019年1月15日 下午6:34:01
     */
   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);
       try
       {
           //1:收展服务人员转岗的情况下,该人员在原岗位时已分配的保单不同意调整,
           //应由该服务人员继续服务至过保单考核,此类保单次年再按照规则分配给其他相应收展服务人员
           if(!surrenderEmp(oldEmpNo,policyNo,nowYear)){
               retMap.put("flag", MyConstant.ISPASS_NO);
               retMap.put("msg", "该保单原收展服务人员转岗后已分配的保单不能调整(过保单考核后次年才可调整)");
               return retMap;
           }
           //收展服务人员转岗当月,可以进行次月应收保单分配
           if(!receiveEmp(newEmpNo,policyNo,nowYear,nowMonth)){
               retMap.put("flag", MyConstant.ISPASS_NO);
               retMap.put("msg", "该服务人员为当月转岗,只能分配应缴日在次月之后的保单");
               return retMap;
           }
       }
       catch (Exception e)
       {
           e.printStackTrace();
           retMap.put("flag", MyConstant.ISPASS_NO);
           retMap.put("msg", "系统繁忙");
           return retMap;
       }
      retMap.put("flag", MyConstant.ISPASS_YES);
      return retMap;
   }
   
   /**
    * 
    * MethodName:  receiveEmp
    * Description:  [收展服务人员转岗当月,可以进行次月应收保单分配]  
    *@param newEmpNo
    *@param policyNo
    *@param nowYear
    *@param nowMonth
    *@return  boolean
    * 
    * @author  Mamba
    * @date  2019年1月15日 下午6:35:01
    */
   private boolean receiveEmp(String newEmpNo, String policyNo, int nowYear, int nowMonth)
   {
       RenewalStaffChangeHistory newEmpChangeHistory=oracleRenewalStaffChangeHistory.queryTransferPostByEmpNo(newEmpNo);
       if(newEmpChangeHistory==null){
           return true;
       }
       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);
           
           if((year==premDueDateYear && premDueDateMonth>month) || premDueDateYear>year){
               return true;
           }else{
               return false;
           }
       }else{
           //如果不是当月,那就是之前转岗的,那也符合条件
           return true;
       }
       
   }
  /**
   * 
   * MethodName:  surrenderEmp
   * Description:  [收展服务人员转岗的情况下,该人员在原岗位时已分配的保单不同意调整]  
   *@param oldEmpNo
   *@param policyNo
   *@param nowYear
   *@return  boolean
   * 
   * @author  Mamba
   * @date  2019年1月15日 下午6:34:39
   */
   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;
       }
       Date dueMonth=oldEmpNoChangeHistory.getUpdatedDate();
       int year = DateUtil.getYear(dueMonth);
       //1:转岗当年(已测)   2:转岗次年后
       //原收展服务人员名下的保单,次年才可以交接给其他服务人员
       if(nowYear>year){
           return true;
       }else{
           return false;
       }
       
   }