package com.trs.web2frame.myutils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

import com.trs.web2frame.WCMServiceCaller;
import com.trs.web2frame.dispatch.Dispatch;
import com.trs.web2frame.tool.tyjyh.ConnectionUtil;
import com.trs.web2frame.tool.tyjyh.ConnectionUtil2;

public class DelAllDocFromSite {
	public static void main(String[] args) throws Exception {
		int count = 1;
		StringBuilder sb = new StringBuilder("SELECT recid FROM wcmchnldoc WHERE siteid=71  and docstatus>0 and chnlid not in(51620,51621)  order by recid asc");
		Connection connection = null;
		Statement statement = null;
		ResultSet set = null;
		Map<String,String> map = new HashMap<String,String>();
        try {
    		connection = ConnectionUtil2.getConnection();
    		statement = connection.createStatement();
    		set = statement.executeQuery(sb.toString());
    		while (set.next()) {
    			String recid = set.getString("recid");
    	    	Map<String,Object> sysnMap = new HashMap<>();
    	    	sysnMap.put("CurrUserName", "dev");
    	    	sysnMap.put("recids", recid);
    	    	try {
        	    	WCMServiceCaller.Call("gov_webdocument", "remove", sysnMap, true);
        	    	System.out.println("删除数据:"+count++);
    	        }catch(Exception e){
    	        	e.printStackTrace();
    	        }

    		}
        }catch(Exception e){
        	e.printStackTrace();
        } finally {
        	ConnectionUtil2.closeConnection(set, statement, connection);
        }

	}
}
