Browse Source

请假申请单调整

koul 1 year ago
parent
commit
b7987d2ff1

+ 18 - 22
uas-office-dingtalk/src/main/java/com/usoftchina/uas/office/dingtalk/service/UasOaService.java

@@ -5,14 +5,12 @@ import com.dingtalk.api.response.OapiAttendanceGetleavestatusResponse;
 import com.dingtalk.api.response.OapiSmartworkHrmEmployeeListdimissionResponse;
 import com.usoftchina.dingtalk.sdk.OaSdk;
 import com.usoftchina.uas.office.dingtalk.core.DateUtil;
-import com.usoftchina.uas.office.dingtalk.util.BaseDao;
-import com.usoftchina.uas.office.dingtalk.util.SqlRowList;
 import com.usoftchina.uas.office.service.AbstractService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -22,11 +20,9 @@ public class UasOaService extends AbstractService {
 
     @Autowired
     private OaSdk oaSdk;
-    @Autowired
-    private BaseDao baseDao;
 
     public void saveOa(String agentCode,int id){
-        SqlRowList rs = baseDao.queryForRowSet("select od_id,od_kind,to_char(od_startdate,'yyyy-MM-dd hh24:mi:ss') startdate,to_char(od_enddate,'yyyy-MM-dd hh24:mi:ss') enddate from OaDingTalklog where od_id=" + id);
+        SqlRowSet rs = jdbcTemplate.queryForRowSet("select od_id,od_kind,to_char(od_startdate,'yyyy-MM-dd hh24:mi:ss') startdate,to_char(od_enddate,'yyyy-MM-dd hh24:mi:ss') enddate from OaDingTalklog where od_id=" + id);
         while (rs.next()){
             String odKind = rs.getString("od_kind");
             String startdate = rs.getString("startdate");
@@ -61,11 +57,11 @@ public class UasOaService extends AbstractService {
                 String projectTitle = openItineraryInfo.getProjectTitle();
                 String projectCode = openItineraryInfo.getProjectCode();
                 String statusDesc = openApplyRs.getStatusDesc()==null?"":openApplyRs.getStatusDesc();
-                int count = baseDao.getCountByCondition("FeePlease", "dp_ddid=" + rsId);
+                Integer count =queryForObject("select count(1) from FeePlease where dp_ddid=" + rsId, Integer.class);
                 if (count<=0&&"已同意".equals(statusDesc)) {
-                    int id = baseDao.getSeqId("FEEPLEASE_SEQ");
-                    String code = baseDao.callProcedure("Sp_GetMaxNumber", new Object[]{"FeePlease!CCSQ!new", 2});
-                    baseDao.execute("insert into FeePlease (fp_id,fp_code,fp_kind,fp_v9,FP_PEOPLE2,fp_recordman,fp_recorddate,fp_statuscode,fp_status,fp_v3,fp_prestartdate,fp_preenddate,fp_n6,dp_ddid,fp_remark,fp_prjcode,fp_prjname) " +
+                    int id = generateId("FEEPLEASE_SEQ");
+                    String code = generateCode("FeePlease!CCSQ!new", 2);
+                    jdbcTemplate.execute("insert into FeePlease (fp_id,fp_code,fp_kind,fp_v9,FP_PEOPLE2,fp_recordman,fp_recorddate,fp_statuscode,fp_status,fp_v3,fp_prestartdate,fp_preenddate,fp_n6,dp_ddid,fp_remark,fp_prjcode,fp_prjname) " +
                             "values (" + id + ",'" + code + "','出差申请单','" + openApplyRs.getDeptName() + "','" + openApplyRs.getUserName() + "','" + openApplyRs.getUserName() + "',to_date('" + inDate + "','yyyy-MM-dd HH24:mi:ss'),'AUDITED','已审核','" + openApplyRs.getTripCause() + "',to_date('" + startDate + "','yyyy-MM-dd HH24:mi:ss'),to_date('" + endDate + "','yyyy-MM-dd HH24:mi:ss')," + openApplyRs.getTripDay() + ","+rsId+",'"+statusDesc+"','"+projectCode+"','"+projectTitle+"')");
                     /*jdbcTemplate.execute("insert into FeePleaseDetail(fpd_id,fpd_fpid,fpd_code,fpd_class,fpd_detno,fpd_d5,fpd_d6,fpd_date1,fpd_date2) " +
                             "values(FeePleaseDetail_seq.nextval,"+id+",'"+code+"','出差申请单',1,'"+projectCode+"','"+projectTitle+"',to_date('" + startDate + "','yyyy-MM-dd HH24:mi:ss'),to_date('" + endDate + "','yyyy-MM-dd HH24:mi:ss'))");*/
@@ -87,12 +83,12 @@ public class UasOaService extends AbstractService {
                 Long lastWorkDay = empDimissionInfoVo.getLastWorkDay();
                 String leaves = DateUtil.format(new Date(lastWorkDay), "yyyy-MM-dd HH:mm:ss");
                 String userid = empDimissionInfoVo.getUserid();
-                int count = baseDao.getCountByCondition("Turnover", "to_dingtalkid='" + userid + "'");
-                int count1 = baseDao.getCountByCondition("employee", "em_ding='" + userid + "'");
+                int count = queryForObject("select count(1) from Turnover where to_dingtalkid='" + userid + "'",Integer.class);
+                int count1 = queryForObject("select count(1) from employee where em_ding='" + userid + "'", Integer.class);
                 if (count<=0&&count1>0){
-                    int id = baseDao.getSeqId("TURNOVER_SEQ");
-                    String code = baseDao.callProcedure("Sp_GetMaxNumber", new Object[]{"Turnover", 2});
-                    baseDao.execute("insert into Turnover (to_id,to_code,to_applymancode,to_applyman,to_leavedate,to_recordor,to_date,to_statuscode,to_status,to_otherreason,to_dingtalkid) " +
+                    int id = generateId("TURNOVER_SEQ");
+                    String code = generateCode("Turnover", 2);
+                    jdbcTemplate.execute("insert into Turnover (to_id,to_code,to_applymancode,to_applyman,to_leavedate,to_recordor,to_date,to_statuscode,to_status,to_otherreason,to_dingtalkid) " +
                             "select " + id + ",'" + code + "',em_code,em_name,to_date('" + leaves + "','yyyy-MM-dd HH24:mi:ss'),em_name,sysdate,'AUDITED','已审核','" + reasonMemo + "','"+userid+"' employee where em_ding='" + userid + "'");
                 }
             }
@@ -103,15 +99,15 @@ public class UasOaService extends AbstractService {
      * 请假申请
      */
     public void saveLeaves(String agentCode, long startTime, long endTime){
-        int count = baseDao.getCountByCondition("employee", "nvl(em_class,' ')<>'离职' and nvl(em_ding,' ')<>' '");
+        int count = queryForObject("select count(1) from employee where nvl(em_class,' ')<>'离职' and nvl(em_ding,' ')<>' '",Integer.class);
         if (count>0){
             int size=100;
             for (int i = 0; i < count/size; i++) {
                 int min=i*size,max=(i+1)*size;
                 List<String> strings = new ArrayList<>();
-                SqlRowList rs = baseDao.queryForRowSet("select em_ding from (select em_ding,rownum rn from employee where nvl(em_class,' ')<>'离职' and nvl(em_ding,' ')<>' ') where rn>"+min+" and rn<="+max);
+                SqlRowSet rs = jdbcTemplate.queryForRowSet("select em_ding from (select em_ding,rownum rn from employee where nvl(em_class,' ')<>'离职' and nvl(em_ding,' ')<>' ') where rn>" + min + " and rn<=" + max);
                 while (rs.next()){
-                    strings.add(rs.getGeneralString("em_ding"));
+                    strings.add(rs.getString("em_ding"));
                 }
                 List<OapiAttendanceGetleavestatusResponse.LeaveStatusVO> leaveStatusVOS = oaSdk.getAllLeaves(agentCode, strings, startTime, endTime);
                 if (!CollectionUtils.isEmpty(leaveStatusVOS)) {
@@ -124,11 +120,11 @@ public class UasOaService extends AbstractService {
                         String userid = leaveStatusVO.getUserid();
                         String startformat = DateUtil.format(new Date(startDate), "yyyy-MM-dd HH:mm:ss");
                         String endformat = DateUtil.format(new Date(endDate), "yyyy-MM-dd HH:mm:ss");
-                        int count1 = baseDao.getCountByCondition("Vacation", "va_dingtalkid='" + userid + "' and to_char(va_startime,'yyyy-MM-dd HH24:mi:ss')='" + startformat + "' and to_char(va_endtime,'yyyy-MM-dd HH24:mi:ss')='" + endformat + "'");
+                        int count1 = queryForObject("select count(1) from Vacation where va_dingtalkid='" + userid + "' and to_char(va_startime,'yyyy-MM-dd HH24:mi:ss')='" + startformat + "' and to_char(va_endtime,'yyyy-MM-dd HH24:mi:ss')='" + endformat + "'",Integer.class);
                         if (count1<=0) {
-                            int id = baseDao.getSeqId("VACATION_SEQ");
-                            String code = baseDao.callProcedure("Sp_GetMaxNumber", new Object[]{"Ask4Leave", 2});
-                            baseDao.execute("insert into Vacation (va_id,va_code,va_statuscode,va_status,va_emcode,va_emname,va_date,va_department,va_position,va_recordor,va_recordorid,va_days,va_alltimes,va_startime,va_endtime,va_remark,va_dingtalkid) " +
+                            int id = generateId("VACATION_SEQ");
+                            String code = generateCode("Ask4Leave", 2);
+                            jdbcTemplate.execute("insert into Vacation (va_id,va_code,va_statuscode,va_status,va_emcode,va_emname,va_date,va_department,va_position,va_recordor,va_recordorid,va_days,va_alltimes,va_startime,va_endtime,va_remark,va_dingtalkid) " +
                                     "select " + id + ",'" + code + "','AUDITED','已审核',em_code,em_name,sysdate,em_depart,em_position,em_name,em_id,case when '" + durationUnit + "'='percent_day' then " + durationPercent + " else 0 end,case when '" + durationUnit + "'='percent_hour' then " + durationPercent + " else 0 end,to_date('" + startformat + "','yyyy-MM-dd hh24:mi:ss'),to_date('" + endformat + "','yyyy-MM-dd hh24:mi:ss'),'钉钉同步','" + userid + "' from employee where em_ding='" + userid + "'");
                         }
                     }

+ 0 - 226
uas-office-dingtalk/src/main/java/com/usoftchina/uas/office/dingtalk/util/BaseDao.java

@@ -1,226 +0,0 @@
-package com.usoftchina.uas.office.dingtalk.util;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.DataAccessException;
-import org.springframework.jdbc.core.CallableStatementCallback;
-import org.springframework.jdbc.core.CallableStatementCreator;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.support.JdbcDaoSupport;
-import org.springframework.jdbc.support.rowset.SqlRowSet;
-import org.springframework.stereotype.Repository;
-
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.List;
-
-@Repository("baseDao")
-public class BaseDao extends JdbcDaoSupport {
-    //创建序列
-    static final String CREATE_SEQ = "CREATE SEQUENCE ? MINVALUE 1 MAXVALUE 99999999999 INCREMENT BY 1 START WITH 3000 CACHE 20 NOORDER NOCYCLE ";
-    @Autowired
-    protected JdbcTemplate jdbcTemplate;
-
-
-    /**
-     * 获取序列号
-     *
-     * @param seq
-     *            指定的序列名
-     */
-    public int getSeqId(String seq) {
-        try {
-            String sql = "select " + seq + ".nextval from dual";
-            SqlRowSet rs = jdbcTemplate.queryForRowSet(sql);
-            if (rs.next()) {
-                return rs.getInt(1);
-            } else {// 如果不存在就创建序列
-                SqlRowSet rowSet = jdbcTemplate.queryForRowSet("select * from user_sequences where Sequence_Name='" + seq.toUpperCase() + "'");
-                if (!rowSet.next()) {
-                    jdbcTemplate.execute(CREATE_SEQ.replace("?", seq));
-                }
-                return getSeqId(seq);
-            }
-        } catch (Exception e) {
-            SqlRowSet rowSet = jdbcTemplate.queryForRowSet("select * from user_sequences where Sequence_Name='" + seq.toUpperCase() + "'");
-            if (!rowSet.next()) {
-                jdbcTemplate.execute(CREATE_SEQ.replace("?", seq));
-            }
-            return getSeqId(seq);
-        }
-    }
-
-    /**
-     * 调用存储过程
-     *
-     * @param procedureName
-     *            存储过程名称
-     * @param args
-     *            参数
-     * @return varchar类型结果
-     */
-    public String callProcedure(final String procedureName, final Object... args) {
-        try {
-            return jdbcTemplate.execute(new CallableStatementCreator() {
-                @Override
-                public CallableStatement createCallableStatement(Connection conn) throws SQLException {
-                    StringBuffer storedProcName = new StringBuffer("{call ");
-                    int i = 0;
-                    storedProcName.append(procedureName + "(");
-                    for (i = 0; i < args.length; i++) {
-                        if (storedProcName.toString().contains("?")) {
-                            storedProcName.append(",");
-                        }
-                        storedProcName.append("?");
-                    }
-                    if (storedProcName.toString().contains("?")) {
-                        storedProcName.append(",");
-                    }
-                    storedProcName.append("?");
-                    storedProcName.append(")}");
-                    CallableStatement cs = conn.prepareCall(storedProcName.toString());
-                    for (i = 0; i < args.length; i++) {
-                        cs.setObject(i + 1, args[i]);
-                    }
-                    cs.registerOutParameter(args.length + 1, java.sql.Types.VARCHAR);
-                    return cs;
-                }
-            }, new CallableStatementCallback<String>() {
-                @Override
-                public String doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
-                    cs.execute();
-                    return cs.getString(args.length + 1);
-                }
-
-            });
-        } catch (Exception e) {
-            e.getMessage();
-        }
-        return null;
-    }
-
-    /**
-     * @param tableName
-     *            对应要查询的表
-     * @param condition
-     *            查询条件
-     * @return Count
-     */
-    public int getCountByCondition(String tableName, String condition) {
-        StringBuffer sql = new StringBuffer("SELECT count(1) FROM ");
-        sql.append(tableName);
-        sql.append(" WHERE ");
-        sql.append(condition);
-        SqlRowList srs = queryForRowSet(sql.toString());
-        if (srs.next()) {
-            return srs.getInt(1);
-        } else {
-            try {
-                throw new Exception("Condition:" + condition + " is wrong!");
-            } catch (Exception e) {
-                return -1;
-            }
-        }
-    }
-
-    /**
-     * 查询结果集
-     *
-     * @param sql
-     *            查询语句
-     */
-    public SqlRowList queryForRowSet(String sql) {
-        SqlRowList rs = new SqlRowList();
-        rs.setResultList(jdbcTemplate.queryForList(sql));
-        return rs;
-    }
-
-    public void execute(String sql) {
-        jdbcTemplate.execute(sql);
-    }
-
-    public synchronized boolean execute(String sql, Object... objs) {
-        try {
-            jdbcTemplate.update(sql, objs);
-            return true;
-        } catch (Exception e) {
-            return false;
-        }
-    }
-
-    public void execute(List<String> sqls) {
-        if (sqls.size() > 0) {
-            StringBuffer sb = new StringBuffer("begin ");
-            for (String sql : sqls) {
-                sb.append("execute immediate '").append(sql.replace("'", "''")).append("';");
-            }
-            sb.append("end;");
-            jdbcTemplate.execute(sb.toString());
-        }
-    }
-
-    /**
-     * @param execSqls
-     *            先执行的sql
-     * @param updateSqls
-     *            校验通过之后的更新语句
-     * @param checkSqls
-     *            校验语句,出错会回滚并返回异常信息
-     * @return
-     */
-    public String executeWithCheck(List<String> execSqls, List<String> updateSqls, String... checkSqls) {
-        if (execSqls.size() > 0) {
-            StringBuffer sb = new StringBuffer("declare v_r varchar2(200);begin ");
-            for (String sql : execSqls) {
-                sb.append("execute immediate '").append(sql.replace("'", "''")).append("';");
-            }
-            for (String checkSql : checkSqls) {
-                sb.append("BEGIN execute immediate '")
-                        .append(checkSql.replace("'", "''"))
-                        .append("' into v_r;if nvl(v_r,' ')<>' ' then rollback;RAISE_APPLICATION_ERROR(-20001,'ERROR_BEGIN'||v_r||'ERROR_END'); end if;exception when no_data_found then v_r := null;END;");
-            }
-            if (updateSqls != null) {
-                for (String sql : updateSqls) {
-                    sb.append("execute immediate '").append(sql.replace("'", "''")).append("';");
-                }
-            }
-            sb.append("end;");
-            try {
-                jdbcTemplate.execute(sb.toString());
-            } catch (Exception e) {
-                if (e.getCause() instanceof java.sql.SQLException) {
-                    String errMsg = e.getCause().getMessage();
-                    if (errMsg.contains("ERROR_BEGIN"))
-                        return errMsg.substring(errMsg.indexOf("ERROR_BEGIN") + 11, errMsg.lastIndexOf("ERROR_END"));
-                }
-                return e.getMessage();
-            }
-        }
-        return null;
-    }
-
-    public void execute(String[] sqls) {
-        if (sqls.length > 0) {
-            StringBuffer sb = new StringBuffer("begin ");
-            for (String sql : sqls) {
-                sb.append("execute immediate '").append(sql.replace("'", "''")).append("';");
-            }
-            sb.append("end;");
-            jdbcTemplate.execute(sb.toString());
-        }
-    }
-
-    public void deleteById(String tablename, String keyField, long id) {
-        deleteByCondition(tablename, keyField + "=" + id);
-    }
-
-    public void deleteByCondition(String tablename, String condition, Object... params) {
-        StringBuffer sb = new StringBuffer();
-        sb.append("DELETE FROM ");
-        sb.append(tablename);
-        sb.append(" WHERE ");
-        sb.append(condition);
-        execute(sb.toString(), params);
-    }
-
-}

+ 0 - 36
uas-office-dingtalk/src/main/java/com/usoftchina/uas/office/dingtalk/util/RowConvert.java

@@ -1,36 +0,0 @@
-package com.usoftchina.uas.office.dingtalk.util;
-
-import org.springframework.util.NumberUtils;
-
-public class RowConvert<T>{
-
-	private Class<T> requiredType;
-
-	public RowConvert(Class<T> requiredType) {
-		this.requiredType = requiredType;
-	}
-
-	@SuppressWarnings("unchecked")
-	protected Object convertValueToRequiredType(Object value, @SuppressWarnings("rawtypes") Class requiredType) {
-		if (String.class.equals(requiredType)) {
-			return value.toString();
-		}
-		if (Number.class.isAssignableFrom(requiredType)) {
-			if (value instanceof Number) {
-				return NumberUtils.convertNumberToTargetClass((Number) value, requiredType);
-			}
-			return NumberUtils.parseNumber(value.toString(), requiredType);
-		}
-		throw new IllegalArgumentException(
-				"Value [" + value + "] is of type [" + value.getClass().getName() +
-						"] and cannot be converted to required type [" + requiredType.getName() + "]");
-	}
-
-	@SuppressWarnings("unchecked")
-	public T convert(Object value) {
-		if (value != null && this.requiredType != null && !this.requiredType.isInstance(value)) {
-			return (T) convertValueToRequiredType(value, this.requiredType);
-		}
-		return (T) value;
-	}
-}

+ 0 - 431
uas-office-dingtalk/src/main/java/com/usoftchina/uas/office/dingtalk/util/SqlRowList.java

@@ -1,431 +0,0 @@
-package com.usoftchina.uas.office.dingtalk.util;
-
-import com.alibaba.fastjson.JSONObject;
-import com.usoftchina.uas.office.dingtalk.core.Constant;
-import com.usoftchina.uas.office.dingtalk.core.DateUtil;
-import com.usoftchina.uas.office.dingtalk.core.NumberUtil;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.*;
-
-/**
- * org.springframework.jdbc.support.rowset.SqlRowSet有jdk版本问题
- * 
- * @author yingp 2013-1-10 11:50:08
- */
-public class SqlRowList {
-
-	private List<Map<String, Object>> resultList;// 结果集
-	private Iterator<Map<String, Object>> iterator;
-	private Map<String, Object> currentMap;// 当前Map
-	private int currentIndex = -1;// 当前index,从0开始
-	private List<String> keys;// 字段名集
-
-	public SqlRowList() {
-		this.resultList = new ArrayList<Map<String, Object>>();
-	}
-
-	public List<Map<String, Object>> getResultList() {
-		return resultList;
-	}
-
-	public int size() {
-		return getResultList().size();
-	}
-
-	public void setResultList(List<Map<String, Object>> resultList) {
-		this.resultList = resultList;
-	}
-
-	public Map<String, Object> getCurrentMap() {
-		return currentMap;
-	}
-
-	public void setCurrentMap(Map<String, Object> currentMap) {
-		this.currentMap = currentMap;
-	}
-
-	public int getCurrentIndex() {
-		return currentIndex;
-	}
-
-	public void setCurrentIndex(int currentIndex) {
-		this.currentIndex = currentIndex;
-	}
-
-	public List<String> getKeys() {
-		if (this.keys == null) {
-			this.keys = new ArrayList<String>();
-			if (this.resultList != null) {
-				Iterator<Map<String, Object>> iterator = resultList.iterator();
-				if (iterator.hasNext()) {
-					Map<String, Object> map = iterator.next();
-					Iterator<String> fields = map.keySet().iterator();
-					while (fields.hasNext()) {
-						this.keys.add(fields.next());
-					}
-				}
-			}
-		}
-		return keys;
-	}
-
-	public void setKeys(List<String> keys) {
-		this.keys = keys;
-	}
-
-	/**
-	 * 取ResultSet的第index条Map
-	 * 
-	 * @param index
-	 * @return
-	 */
-	public Map<String, Object> getAt(int index) {
-		if (this.resultList != null) {
-			Iterator<Map<String, Object>> iterator = resultList.iterator();
-			Map<String, Object> map = null;
-			int idx = 0;
-			while (iterator.hasNext() && (map = iterator.next()) != null) {
-				if (index == idx)
-					return map;
-				idx++;
-			}
-		}
-		return null;
-	}
-
-	public <T> List<T> queryForList(String field, Class<T> requiredType) {
-		if (this.resultList != null) {
-			Iterator<Map<String, Object>> iterator = resultList.iterator();
-			Map<String, Object> map = null;
-			List<T> list = new ArrayList<T>();
-			RowConvert<T> convert = new RowConvert<T>(requiredType);
-			field = field.toUpperCase();
-			while (iterator.hasNext() && (map = iterator.next()) != null) {
-				Object result = map.get(field);
-				if (result != null) {
-					list.add(convert.convert(result));
-				}
-			}
-			return list;
-		}
-		return null;
-	}
-
-	public <T> Set<T> queryForSet(String field, Class<T> requiredType) {
-		if (this.resultList != null) {
-			Iterator<Map<String, Object>> iterator = resultList.iterator();
-			Map<String, Object> map = null;
-			Set<T> set = new java.util.HashSet<T>();
-			RowConvert<T> convert = new RowConvert<T>(requiredType);
-			field = field.toUpperCase();
-			while (iterator.hasNext() && (map = iterator.next()) != null) {
-				Object result = map.get(field);
-				if (result != null) {
-					set.add(convert.convert(result));
-				}
-			}
-			return set;
-		}
-		return null;
-	}
-
-	public boolean hasNext() {
-		if (this.resultList != null) {
-			if (this.iterator == null) {
-				this.iterator = resultList.iterator();
-			}
-			if (this.iterator.hasNext()) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	public boolean next(int count) {
-		for (int i = 0; i < count; i++) {
-			if (!next())
-				return false;
-		}
-		return true;
-	}
-
-	public boolean next() {
-		if (this.resultList != null) {
-			if (this.iterator == null) {
-				this.iterator = resultList.iterator();
-				this.currentIndex = -1;
-			}
-			if (this.iterator.hasNext()) {
-				this.currentMap = iterator.next();
-				this.currentIndex += 1;
-				if (this.keys == null) {
-					this.keys = new ArrayList<String>();
-					Iterator<String> fields = currentMap.keySet().iterator();
-					while (fields.hasNext()) {
-						this.keys.add(fields.next());
-					}
-				}
-				return true;
-			}
-		}
-		return false;
-	}
-
-	public int getInt(int index) {
-		Object obj = getObject(index);
-		return obj == null ? -1 : Integer.parseInt(obj.toString());
-	}
-
-	public int getInt(String field) {
-		Object obj = getObject(field);
-		return obj == null ? -1 : Integer.parseInt(obj.toString());
-	}
-
-	public int getGeneralInt(int index) {
-		Object obj = getObject(index);
-		return obj == null ? 0 : Integer.parseInt(obj.toString());
-	}
-
-	public int getGeneralInt(String field) {
-		Object obj = getObject(field);
-		return obj == null ? 0 : Integer.parseInt(obj.toString());
-	}
-
-	public float getFloat(int index) {
-		Object obj = getObject(index);
-		return obj == null ? -1 : Float.parseFloat(obj.toString());
-	}
-
-	public float getFloat(String field) {
-		Object obj = getObject(field);
-		return obj == null ? -1 : Float.parseFloat(obj.toString());
-	}
-
-	public float getGeneralFloat(int index) {
-		Object obj = getObject(index);
-		return obj == null ? 0 : Float.parseFloat(obj.toString());
-	}
-
-	public float getGeneralFloat(String field) {
-		Object obj = getObject(field);
-		return obj == null ? 0 : Float.parseFloat(obj.toString());
-	}
-
-	public double getDouble(int index) {
-		Object obj = getObject(index);
-		return obj == null ? -1 : Double.parseDouble(obj.toString());
-	}
-
-	public double getDouble(String field) {
-		Object obj = getObject(field);
-		return obj == null ? -1 : Double.parseDouble(obj.toString());
-	}
-
-	public BigDecimal getBigDecimal(int index) {
-		Object obj = getObject(index);
-		return obj == null ? null : BigDecimal.valueOf(Double.parseDouble(obj.toString()));
-	}
-
-	public BigDecimal getBigDecimal(String field) {
-		Object obj = getObject(field);
-		return obj == null ? null : BigDecimal.valueOf(Double.parseDouble(obj.toString()));
-	}
-
-	public double getGeneralDouble(int index) {
-		Object obj = getObject(index);
-		return obj == null ? 0 : Double.parseDouble(obj.toString());
-	}
-
-	/**
-	 * @param index
-	 * @param sub
-	 *            保留小数位数
-	 * @return
-	 */
-	public double getGeneralDouble(int index, int sub) {
-		return NumberUtil.formatDouble(getGeneralDouble(index), sub);
-	}
-
-	public double getGeneralDouble(String field) {
-		Object obj = getObject(field);
-		return obj == null || String.valueOf(obj).trim().equals("") ? 0 : Double.parseDouble(String.valueOf(obj).trim());
-	}
-
-	/**
-	 * @param field
-	 * @param sub
-	 *            保留小数位数
-	 * @return
-	 */
-	public double getGeneralDouble(String field, int sub) {
-		return NumberUtil.formatDouble(getGeneralDouble(field), sub);
-	}
-
-	public BigDecimal getGeneralBigDecimal(int index) {
-		Object obj = getObject(index);
-		return obj == null ? new BigDecimal(0) : BigDecimal.valueOf(Double.parseDouble(obj.toString()));
-	}
-
-	public BigDecimal getGeneralBigDecimal(String field) {
-		Object obj = getObject(field);
-		return obj == null ? new BigDecimal(0) : BigDecimal.valueOf(Double.parseDouble(obj.toString()));
-	}
-
-	public long getLong(int index) {
-		Object obj = getObject(index);
-		return obj == null ? -1 : Long.parseLong(obj.toString());
-	}
-
-	public long getLong(String field) {
-		Object obj = getObject(field);
-		return obj == null ? -1 : Long.parseLong(obj.toString());
-	}
-
-	public long getGeneralLong(int index) {
-		Object obj = getObject(index);
-		return obj == null ? 0 : Long.parseLong(obj.toString());
-	}
-
-	public long getGeneralLong(String field) {
-		Object obj = getObject(field);
-		return obj == null ? 0 : Long.parseLong(obj.toString());
-	}
-
-	public String getString(int index) {
-		Object obj = getObject(index);
-		return obj == null ? null : obj.toString();
-	}
-
-	public String getString(String field) {
-		Object obj = getObject(field);
-		return obj == null ? null : obj.toString();
-	}
-
-	public String getGeneralString(int index) {
-		Object obj = getObject(index);
-		return obj == null ? "" : obj.toString();
-	}
-
-	public String getGeneralString(String field) {
-		Object obj = getObject(field);
-		return obj == null ? "" : obj.toString();
-	}
-
-	public Object getObject(int index) {
-		if (this.iterator == null || this.currentMap == null || this.keys == null || index <= 0 || index > this.keys.size()) {
-			return null;
-		}
-		return this.currentMap.get(this.keys.get(index - 1));
-	}
-
-	public Object getObject(String field) {
-		if (this.iterator == null || this.currentMap == null) {
-			return null;
-		}
-		return this.currentMap.get(field.toUpperCase());
-	}
-
-	/**
-	 * currentMap的JSON格式
-	 */
-	public JSONObject getJSONObject() {
-		if (this.iterator == null || this.currentMap == null) {
-			return null;
-		}
-		JSONObject json = new JSONObject();
-		Object value = null;
-		for (String k : this.keys) {
-			value = parseValue(this.getObject(k));
-			json.put(k, value);
-		}
-		return json;
-	}
-
-	public static Object parseValue(Object value) {
-		if (value != null) {
-			// 以字符串格式表示时间
-			if ("TIMESTAMP".equals(value.getClass().getSimpleName().toUpperCase())) {
-				Timestamp time = (Timestamp) value;
-				value = DateUtil.parseDateToString(new Date(time.getTime()), Constant.YMD_HMS);
-			}
-			// 科学计数法改为js处理
-		}
-		return value;
-	}
-
-	/**
-	 * currentMap的JSONString格式
-	 */
-	public String getJSON() {
-		if (this.iterator == null || this.currentMap == null) {
-			return null;
-		}
-		return getJSONObject().toString();
-	}
-
-	public Date getDate(int index) {
-		Object obj = getObject(index);
-		return obj == null ? null : (Date) obj;
-	}
-
-	public Date getDate(String field) {
-		Object obj = getObject(field);
-		return obj == null ? null : (Date) obj;
-	}
-
-	public Timestamp getTimestamp(int index) {
-		Object obj = getObject(index);
-		return obj == null ? null : (Timestamp) obj;
-	}
-
-	public Timestamp getTimestamp(String field) {
-		Object obj = getObject(field);
-		return obj == null ? null : (Timestamp) obj;
-	}
-
-	public String getGeneralTimestamp(int index, String format) {
-		Timestamp time = getTimestamp(index);
-		if (time != null)
-			return DateUtil.parseDateToString(new Date(time.getTime()), format);
-		return "";
-	}
-
-	public String getGeneralTimestamp(int index) {
-		return getGeneralTimestamp(index, Constant.YMD_HMS);
-	}
-
-	public String getGeneralTimestamp(String field, String format) {
-		Timestamp time = getTimestamp(field);
-		if (time != null)
-			return DateUtil.parseDateToString(new Date(time.getTime()), format);
-		return "";
-	}
-
-	public String getGeneralTimestamp(String field) {
-		return getGeneralTimestamp(field, Constant.YMD_HMS);
-	}
-
-	public double getSummary(String field) {
-		if (hasNext()) {
-			Iterator<Map<String, Object>> iterator = resultList.iterator();
-			Map<String, Object> map = null;
-			double sum = 0;
-			Object obj = null;
-			while ((map = iterator.next()) != null) {
-				obj = map.get(field.toUpperCase());
-				sum += obj == null ? 0 : Double.parseDouble(obj.toString());
-			}
-			return sum;
-		}
-		return 0;
-	}
-
-	public double getSummary(int index) {
-		if (index <= 0 || index > this.getKeys().size()) {
-			return 0;
-		}
-		return getSummary(this.keys.get(index - 1));
-	}
-}