test.txt 7.27 KB
 <plugin>
		        <groupId>org.apache.maven.plugins</groupId>
		        <artifactId>maven-surefire-plugin</artifactId>
		        <version>2.18.1</version>
		        <configuration>
		          <skipTests>true</skipTests>
		        </configuration>
		      </plugin>
		      
		      
		    //保存登录动作
                    GrasSysOperationLog grasSysOperationLog=new GrasSysOperationLog();
                    grasSysOperationLog.setUserId(userId);
                    grasSysOperationLog.setOperation("/gras/login/singleLogin?user="+user+"&passWord="+password);
                    grasSysOperationLog.setCreatedUser(userId);
                    grasSysOperationLog.setUpdatedUser(userId);
                    grasSysOperationLog.setPkSerial(NumberUtil.random10());
                    grasSysOperationLog.setOperationDate(new Date());
                    grasSysOperationLogService.addGrasSysOperationLog(grasSysOperationLog);
        
        
        
        String userId

 
 operation 
 operationDate
 pkSerial
 updatedUser
 updatedDate
 createdDate
 createdUser
 
 
 
 

  
  
  /**
     * 自动分单
     */
    @Override
    public void autoAllot() {
        //"0005"——动态分单机构参数 
        GrasSysConfig grasSysConfig=oracleGrasSysConfigService.selectByConfigCode("0005");
        if(grasSysConfig==null || grasSysConfig.getconfigOption()==null){
            //根据3级机构级别查询机构
            assignPolicyByLevel(MyConstant.BRANCH_LEVEL_03);
            //根据2级机构级别查询机构
            assignPolicyByLevel(MyConstant.BRANCH_LEVEL_02);
            //根据1级机构级别查询机构
            assignPolicyByLevel(MyConstant.BRANCH_LEVEL_01);
        }else{
            String[] branchList=grasSysConfig.getconfigOption().split(",");
            for (String branchCode : branchList)
            {
                List<BranchInfo> branchCodeList= branchInfoService.queryBranchByParentBranch(branchCode);
                
                executeAllotByLevel(branchCodeList);
                logUtils.info("自动分单 ————试点机构分单:"+branchCode);
            }
            
        }
        
        
        
        //自动同步
        resultCheckService.autoResultBack();
    }
    private void assignPolicyByLevel(String level){
        
        List<BranchInfo> branchList = branchInfoService.queryBranchByLevel(level);
        executeAllotByLevel(branchList);
        logUtils.info("自动分单-----分单机构级别:"+level);
    }
    
    
       @Override
    public List<JSONObject> testSearch(List<JSONObject> jsonObject){
        
        SearchSourceBuilder searchSourceBuilder=new SearchSourceBuilder();
        BoolQueryBuilder boolQuery=new BoolQueryBuilder();
        //AggregationBuilder aggregationBuilder = AggregationBuilders.cardinality("distinct").field("po_policy_no");

        List<JSONObject> resultList=new ArrayList<JSONObject>();
        for (JSONObject jsonObject2 : jsonObject)
        {
            String policyNos = jsonObject2.getString("policyNo");
            //aggregationBuilder = AggregationBuilders.cardinality("distinct").field("_id");
            boolQuery.filter(QueryBuilders.termsQuery("po_policy_no",policyNos));
            //boolQuery.filter(QueryBuilders.termQuery("pp_prod_seq", "2"));
            SumAggregationBuilder pp_modal_total_prem = AggregationBuilders.sum("pp_modal_total_prem").field("pp_modal_total_prem");
            searchSourceBuilder.query(boolQuery).aggregation(pp_modal_total_prem);
            try{
                Search search=new Search.Builder(searchSourceBuilder.toString())
                        .addIndex("policyproinfo").addType(MyConstant.ES_TYPE)
                        .setParameter(Parameters.SIZE,8000).setParameter(Parameters.SCROLL,"5m")
                        .build();
                //执行查询
                logUtils.info("统计数据查询语句:"+searchSourceBuilder.toString());
                JestResult result = client.execute(search);
               // handleResult(resultList, result);
                System.out.println(result);
                List<JSONObject> selectList = result.getSourceAsObjectList(JSONObject.class);
                //第一次查询的结果要先处理
                for (JSONObject object : selectList) {
                    object.put("service_emp_no", jsonObject2.getString("servicerNo"));
                    object.put("rnpsi_assign_mode", jsonObject2.getString("assignRule"));
                    object.put("rnpsi_last_assign_user", jsonObject2.getString("lastAssignUser"));
                    //object.put("rnpsi_last_assign_date", DateUtil.getDateTimeFormat(jsonObject2.getString("lastAssignDate")));
                    bir=new Date();
                    System.out.println(bir);
                    //object.put("rnpsi_last_assign_date", bir);
                    object.put("rnpsi_orphan_mark", "0");
                    resultList.add(object);
                }
            }catch (Exception e){
                logUtils.error(e);
            }
        }
        System.out.println(insertBulk1(resultList));
        return resultList;
    }
    
    private boolean insertBulk1(Object object)
    {
        //是否批量插入的判断
        if (object.getClass().equals(List.class) || object.getClass().equals(ArrayList.class))
        {
            List<JSONObject> realObj = (List) object;
            //构建批量插入的操作类 bulk  索引根据类名小写  type设定为doc
            //最新的es里面可能会废除type的设定  一个index就装一种类型的对象

            try
            {
                Bulk.Builder bulk = new Bulk.Builder();
                //构造批量数据
                for (JSONObject jsonObject :realObj){
                    System.out.println("参数:"+jsonObject);
                    String id=jsonObject.getString("po_policy_no")+"+"+String.valueOf(jsonObject.getInteger("pp_prod_seq"));
                    System.out.println("id:"+id);
                    Index index = new Index.Builder(jsonObject).index("policyproinfo").type(MyConstant.ES_TYPE).id(id).build();
                    bulk.addAction(index);
                }
                //执行结果
                return client.execute(bulk.build()).isSucceeded();
            }
            catch (IOException e)
            {
                logUtils.error(e.getMessage());
                return false;
            }
        }
        return false;

    }



    
    
    JSONObject jsonObject=new JSONObject();
           List<JSONObject> policyNolist=new ArrayList<JSONObject>();
           for (Object object : paramArray)
           {
               jsonObject=(JSONObject)object;
               for(String policyNo:policys){
                   if(policyNo.equals(jsonObject.get("policyNo"))){
                       policyNolist.add(jsonObject);
                      break; 
                   }
               }
           }
           //更新es
           
           
           testSearch(policyNolist);
        
   rnspi_service_no
   
   service_emp_name
        
        pass:192.168.26.84
ES:http://192.168.26.80:9200
oracle:192.168.26.92:1521



P000000057225826维护给I000000000059079

P000000016509417,P000000046040981,P000000057117527,P000000057563951,P000000057691975 ,P000000016852982


--- 2019-03-21 22:46:06.482045000 Z