123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987 |
- /**
- *
- */
- /**
- * @author Administrator
- *
- */
- package com.sinosoft.gps.bgd_mxb.DAO;
- import java.io.Serializable;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import org.apache.log4j.Logger;
- import com.formaction.Parameter;
- import com.mchange.v2.ser.SerializableUtils;
- import com.persistence.DbConnection;
- import com.persistence.service.PersistenceFactory;
- import com.persistence.service.SysPersistence;
- import com.persistence.service.assitant.generator.IdentityGenerator;
- import com.persistence.service.exception.PersistenceException;
- import com.sinosoft.common.util.DateUtil;
- import com.sinosoft.em.alert.report.manage.dao.QueryReportProgrammeDaoImpl;
- import com.sinosoft.em.alert.report.manage.vo.ReportProgress;
- import com.sinosoft.gps.bgd_mxb.vo.BGDBaoBiao;
- import com.sinosoft.gps.bgd_mxb.vo.BGDmingxi;
- import com.sinosoft.gps.bgd_mxb.vo.BaoGongDianTask;
- import com.sinosoft.gps.bgd_mxb.vo.ECMGPSLIST;
- import com.sinosoft.gps.bgd_mxb.vo.ECMGPSLIST2;
- import com.sysmodel.datamodel.xmlmodel.ModelFactory;
- import com.sysmodel.datamodel.xmlmodel.able.SysModel;
- public class ECMGPSLIST_Dao {
-
- private static SysModel sysmodel = ModelFactory.getSysmodel();
- @SuppressWarnings("unused")
- private static SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
- private final static Logger log = Logger.getLogger(QueryReportProgrammeDaoImpl.class);
-
-
- //主键生成方式
- //String fD_OBJECTID = IdentityGenerator.getIdentityGenerator().gerenalIdentity(887);
- //该方法(用于保存两张表)的第一个参数是第一张表的实体类的对象,第二个参数是保存第二张表内容的list集合<泛型>
- // public boolean saveDutyBatch(ECMGPSLIST list1,List<ECMGPSLIST2> list2){
- public boolean saveListBatch(ECMGPSLIST list1,List<ECMGPSLIST2> list2){
- boolean flag=false;
- DbConnection dbConn = new DbConnection();//Java类,链接数据库
-
- Connection conn = null;
- PreparedStatement pstm = null;
- PreparedStatement pstm2 = null;
- /*String dutySQL = "insert into ECM_EM_DUTY(FD_OBJECTID, NAME, DEPT_NAMES, STATE, DUTY_TYPE, OPER_DEPT, OPER_NAME, OPER_TIME, IS_DEL, UPDATEDATE,RELEASE) "
- +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?)";*/
- /*String detailSQL = "insert into ECM_EM_DUTY_DETAIL(FD_OBJECTID, DUTY_ID, NAME, LEADER, LEADER_TEL, DUTY_DATE, START_TIME, END_TIME, TELEPHONE, DUTY_WAY, IS_DEL, UPDATEDATE) "
- +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";*/
- String list1_SQL = "insert into ECM_GPS_LIST(FD_OBJECTID, TASK_NAME, LEVEL, DEPT, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT) "
- +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
- String list2_SQL = "insert into ECM_GPS_LIST_2(FD_OBJECTID, TASK_TIME, INPUT_MEN, INPUT_CAR, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT,CONNECTIONID) "
- +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
- try {
- conn = dbConn.getConnection();
- conn.setAutoCommit(false);
- pstm = conn.prepareStatement(list1_SQL);
- pstm2 = conn.prepareStatement(list2_SQL);
- String fD_OBJECTID = IdentityGenerator.getIdentityGenerator().gerenalIdentity(615);//获取ID
- // pstm.setString(1, fD_OBJECTID);
- pstm.setString(1, fD_OBJECTID);
- pstm.setString(2, list1.getTask_name());
- pstm.setString(3, list1.getLevel());
- pstm.setString(4, list1.getDept());
- pstm.setString(5, "0");//0是未删除,1是删除
- pstm.setString(6, DateUtil.getCurrDateTimeStr());
- pstm.setString(7, list1.getWriter());
- pstm.setString(8, list1.getWrite_time());//这个时间在前台获取了
- pstm.setString(9, list1.getWrite_dept());
- // pstm.setString(9, "0");
- // pstm.setString(10, DateUtil.getCurrDateTimeStr());
- // pstm.setString(11, "0");
- pstm.executeUpdate();//执行SQL语句
- // List<EcmDutyDetail> detailList = duty.getDutyDetailList();
- if(list2!=null && !list2.isEmpty()){
- for(int i=0;i<list2.size();i++){
- ECMGPSLIST2 gpsList2 = list2.get(i);
- String OBJECTID = IdentityGenerator.getIdentityGenerator().gerenalIdentity(616);
- pstm2.setString(1, OBJECTID);
- pstm2.setString(2, gpsList2.getTask_time());
- pstm2.setString(3, gpsList2.getInput_men());
- pstm2.setString(4, gpsList2.getInput_car());
- pstm2.setString(5, "0");//0代表未删除,1代表删除
- pstm2.setString(6, DateUtil.getCurrDateTimeStr());
- pstm2.setString(7, gpsList2.getWriter());
- pstm2.setString(8, DateUtil.getCurrDateTimeStr());
- pstm2.setString(9, gpsList2.getWrite_dept());
- pstm2.setString(10, fD_OBJECTID); //主副表关联
- // pstm2.setString(11, "0");
- // pstm2.setString(12, DateUtil.getCurrDateTimeStr());
- pstm2.addBatch();
- }
- pstm2.executeBatch(); //批量保存
- }
- conn.commit();
- conn.setAutoCommit(true);
- flag=true;
- }catch(Exception e){
- try {
- conn.rollback();
- conn.setAutoCommit(true);
- } catch (SQLException e1) {
- e1.printStackTrace();
- }
- e.printStackTrace();
- }finally{
- try {
- pstm2.close();
- pstm.close();
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return flag;
- }
-
- //第一张表的保存方法(ECM_GPS_LIST)
- // public void saveDuty(EcmEmDuty duty){
- public void saveList(ECMGPSLIST list1){
- DbConnection dbConn = new DbConnection();
-
- Connection conn = null;
- PreparedStatement pstm = null;
- /*String dutySQL = "insert into ECM_EM_DUTY(FD_OBJECTID, NAME, DEPT_NAMES, STATE, DUTY_TYPE, OPER_DEPT, OPER_NAME, OPER_TIME, IS_DEL, UPDATEDATE, RELEASE) "
- +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?)";*/
- String list1SQL = "insert into ECM_GPS_LIST(FD_OBJECTID, TASK_NAME, LEVEL, DEPT, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT) "
- +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ? )";
- try {
- conn = dbConn.getConnection();
- conn.setAutoCommit(false);
- pstm = conn.prepareStatement(list1SQL);
-
- pstm.setString(1, list1.getFd_objectid());
- pstm.setString(2, list1.getTask_name());
- pstm.setString(3, list1.getLevel());
- pstm.setString(4, list1.getDept());
- pstm.setString(5, "0"); //0,未删除;1,删除
- pstm.setString(6, list1.getUpdatedate());
- pstm.setString(7, list1.getWriter());
- pstm.setString(8, list1.getWrite_time());
- pstm.setString(9, list1.getWrite_dept());
- /*pstm.setString(1, duty.getFd_objectid());
- pstm.setString(2, duty.getName());
- pstm.setString(3, duty.getDept_names());
- pstm.setString(4, "0");
- pstm.setString(5, "2"); //duty.getDuty_type()值班类型 1为预警 2为响应
- pstm.setString(6, duty.getOper_dept());
- pstm.setString(7, duty.getOper_name());
- pstm.setString(8, duty.getOper_time());
- pstm.setString(9, "0");
- pstm.setString(10, DateUtil.getCurrDateTimeStr());
- pstm.setString(11, "0");*/
- pstm.executeUpdate();
-
- conn.commit();
- conn.setAutoCommit(true);
- }catch(Exception e){
- try {
- conn.rollback();
- conn.setAutoCommit(true);
- } catch (SQLException e1) {
- e1.printStackTrace();
- }
- e.printStackTrace();
- }finally{
- try {
- pstm.close();
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
-
- //第一张表的修改方法(参数是第一张表实体类的一个对象)
- // public boolean updateDuty(EcmEmDuty duty){
- public boolean updateList1(ECMGPSLIST list1){
- boolean flag = false;
- DbConnection dbConn = new DbConnection();
-
- Connection conn = null;
- PreparedStatement pstm = null;
- /*String dutySQL = "update ECM_EM_DUTY set NAME = ?, DEPT_NAMES = ?, OPER_DEPT = ?, OPER_NAME = ?, OPER_TIME = ? , UPDATEDATE = ? "
- + " where FD_OBJECTID = ?"; */
- String list1SQL = "update ECM_GPS_LIST set TASK_NAME = ?, LEVEL = ?, DEPT = ?, UPDATEDATE = ?, WRITER = ?, WRITE_TIME = ?, WRITE_DEPT = ? where FD_OBJECTID = ?";
- try {
- conn = dbConn.getConnection();
- conn.setAutoCommit(false);
- pstm = conn.prepareStatement(list1SQL);
- pstm.setString(1, list1.getTask_name());
- pstm.setString(2, list1.getLevel());
- pstm.setString(3, list1.getDept());
- pstm.setString(4, DateUtil.getCurrDateTimeStr());
- pstm.setString(5, list1.getWriter());
- pstm.setString(6, DateUtil.getCurrDateTimeStr());
- pstm.setString(7, list1.getWrite_dept());
- pstm.setString(8, list1.getFd_objectid());
- /*pstm = conn.prepareStatement(dutySQL);
- pstm.setString(1, duty.getName());
- pstm.setString(2, duty.getDept_names());
- pstm.setString(3, duty.getOper_dept());
- pstm.setString(4, duty.getOper_name());
- pstm.setString(5, duty.getOper_time());
- pstm.setString(6, DateUtil.getCurrDateTimeStr());
- pstm.setString(7, duty.getFd_objectid());*/
- pstm.executeUpdate();
-
- conn.commit();
- conn.setAutoCommit(true);
- flag = true;
- }catch(Exception e){
- try {
- conn.rollback();
- conn.setAutoCommit(true);
- } catch (SQLException e1) {
- e1.printStackTrace();
- }
- e.printStackTrace();
- }finally{
- try {
- if(pstm!=null)
- pstm.close();
- if(conn!=null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return flag;
- }
-
- /*public EcmEmDuty queryEcmDuty(String fd_objectid){
- EcmEmDuty duty = null;
- return duty;
- }*/
- //第二张表的删除
- // public boolean deleteDetail(String fd_id){
- public boolean deleteList2(String fd_id){
- boolean ret = false;
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- //String delSQL = "delete from ECM_EM_DUTY_DETAIL t where t.FD_OBJECTID = ? ";
- String delSQL = "update ECM_GPS_LIST_2 t set t.IS_DEL = '1' where t.FD_OBJECTID = ? ";
- try{
- conn = dbConn.getConnection();
- conn.setAutoCommit(false);
- pstm = conn.prepareStatement(delSQL);
- pstm.setString(1, fd_id);
- pstm.executeUpdate();
- conn.commit();
- conn.setAutoCommit(true);
- ret = true;
- }catch(Exception e){
- e.printStackTrace();
- }finally{
- try {
- pstm.close();
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return ret;
- }
-
- //第二张表的保存方法(ECM_GPS_LIST_2)
- // public boolean saveDetail(EcmDutyDetail detail){
- public boolean savelist2(ECMGPSLIST2 list2){
- boolean flag = false;
- DbConnection dbConn = new DbConnection();
-
- Connection conn = null;
- PreparedStatement pstm = null;
- // String detailSQL = "insert into ECM_EM_DUTY_DETAIL(FD_OBJECTID, DUTY_ID, NAME, LEADER, LEADER_TEL, DUTY_DATE, START_TIME, END_TIME, TELEPHONE, DUTY_WAY, IS_DEL, UPDATEDATE) "
- // +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
- String list2SQL = "insert into ECM_GPS_LIST_2(FD_OBJECTID, TASK_TIME, INPUT_MEN, INPUT_CAR, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT, CONNECTIONID) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
- try {
- conn = dbConn.getConnection();
- conn.setAutoCommit(false);
- pstm = conn.prepareStatement(list2SQL);
- String OBJECTID = IdentityGenerator.getIdentityGenerator().gerenalIdentity(616);
- pstm.setString(1, OBJECTID);
- pstm.setString(2, list2.getTask_time());
- pstm.setString(3, list2.getInput_men());
- pstm.setString(4, list2.getInput_car());
- pstm.setString(5, "0");
- pstm.setString(6, list2.getUpdatedate());
- pstm.setString(7, list2.getWriter());
- pstm.setString(8, DateUtil.getCurrDateTimeStr());
- pstm.setString(9, list2.getWrite_dept());
- pstm.setString(10, list2.getConnectionid()); //主副表关联
- /*pstm.setString(1, OBJECTID);
- pstm.setString(2, detail.getDuty_id()); //主副表关联
- pstm.setString(3, detail.getName());
- pstm.setString(4, detail.getLeader());
- pstm.setString(5, detail.getLeader_tel());
- pstm.setString(6, detail.getDuty_date());
- pstm.setString(7, detail.getStart_time());
- pstm.setString(8, detail.getEnd_time());
- pstm.setString(9, detail.getTelephone());
- pstm.setString(10, detail.getDuty_way());
- pstm.setString(11, "0");
- pstm.setString(12, DateUtil.getCurrDateTimeStr());*/
- pstm.executeUpdate();
- conn.commit();
- conn.setAutoCommit(true);
- flag = true;
- }catch(Exception e){
- try {
- conn.rollback();
- conn.setAutoCommit(true);
- } catch (SQLException e1) {
- e1.printStackTrace();
- }
- e.printStackTrace();
- }finally{
- try {
- pstm.close();
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return flag;
- }
-
- //修改第二章表(ECM_GPS_LIST_2)
- // public boolean updateDetail(EcmDutyDetail detail){
- public boolean updateList2(ECMGPSLIST2 list2){
- boolean flag = false;
- DbConnection dbConn = new DbConnection();
-
- Connection conn = null;
- PreparedStatement pstm = null;
- /*String detailSQL = "update ECM_EM_DUTY_DETAIL " //DUTY_ID = ?,
- +" set FD_OBJECTID = ?, NAME = ?, LEADER = ?, LEADER_TEL = ?, DUTY_DATE = ?, START_TIME = ?, END_TIME = ?, TELEPHONE = ?, DUTY_WAY = ?, IS_DEL = ?, UPDATEDATE = ? "
- + " where FD_OBJECTID = ?";*/
- String list2SQL = "update ECM_GPS_LIST_2 "
- +" set FD_OBJECTID = ?, TASK_TIME = ?, INPUT_MEN = ?, INPUT_CAR = ?, UPDATEDATE = ?, WRITER = ?, WRITE_TIME = ?, WRITE_DEPT = ?"
- + " where FD_OBJECTID = ?";
- try {
- conn = dbConn.getConnection();
- conn.setAutoCommit(false);
- pstm = conn.prepareStatement(list2SQL);
- pstm.setString(1, list2.getFd_objectid());
- pstm.setString(2, list2.getTask_time());
- pstm.setString(3, list2.getInput_men());
- pstm.setString(4, list2.getInput_car());
- pstm.setString(5, DateUtil.getCurrDateTimeStr());
- pstm.setString(6, list2.getWriter());
- pstm.setString(7, DateUtil.getCurrDateTimeStr());
- pstm.setString(8, list2.getWrite_dept());
- /*pstm = conn.prepareStatement(detailSQL);
- pstm.setString(1, detail.getFd_objectid());
- // pstm.setString(2, detail.getDuty_id()); //主副表关联
- pstm.setString(2, detail.getName());
- pstm.setString(3, detail.getLeader());
- pstm.setString(4, detail.getLeader_tel());
- pstm.setString(5, detail.getDuty_date());
- pstm.setString(6, detail.getStart_time());
- pstm.setString(7, detail.getEnd_time());
- pstm.setString(8, detail.getTelephone());
- pstm.setString(9, detail.getDuty_way());
- pstm.setString(10, "0");
- pstm.setString(11, DateUtil.getCurrDateTimeStr());
- pstm.setString(12, detail.getFd_objectid());*/
- pstm.executeUpdate();
- conn.commit();
- conn.setAutoCommit(true);
- flag = true;
- }catch(Exception e){
- try {
- conn.rollback();
- conn.setAutoCommit(true);
- } catch (SQLException e1) {
- e1.printStackTrace();
- }
- e.printStackTrace();
- }finally{
- try {
- pstm.close();
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return flag;
- }
- //分页查询 达梦分页方式
- @SuppressWarnings("rawtypes")
- // public List queryDetailByDutyid(String dutyid){
- public List queryListByConnectionid(String connectionid){
- //,int pageStart,int pageSize
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- ResultSet rs = null;
- String strSQL = "select FD_OBJECTID, TASK_TIME, INPUT_MEN, INPUT_CAR, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT"
- + " from ECM_GPS_LIST_2 "
- + " where CONNECTIONID = ? and IS_DEL='0' "
- + " order by TASK_TIME desc ";
- /* // String strSQL = "select top "+pageStart+","+pageSize+" FD_OBJECTID,DUTY_ID,NAME,LEADER,LEADER_TEL,DUTY_DATE,START_TIME,END_TIME,TELEPHONE,DUTY_WAY,IS_DEL,UPDATEDATE "
- +" from ECM_EM_DUTY_DETAIL "
- +" where DUTY_ID = ? and IS_DEL='0' "
- +" order by duty_date desc ,start_time desc ";*/
- // List<EcmDutyDetail> detailList = new ArrayList<EcmDutyDetail>();
- List<ECMGPSLIST2> gpsList2 = new ArrayList<ECMGPSLIST2>();
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(strSQL);
- pstm.setString(1, connectionid);
- rs = pstm.executeQuery();
-
- while(rs.next()){
- ECMGPSLIST2 list2 = new ECMGPSLIST2();
- list2.setFd_objectid(rs.getString("FD_OBJECTID"));
- list2.setTask_time(rs.getString("TASK_TIME"));
- list2.setInput_men(rs.getString("INPUT_MEN"));
- list2.setInput_car(rs.getString("INPUT_CAR"));
- list2.setIs_del(rs.getString("IS_DEL"));
- list2.setUpdatedate(rs.getString("UPDATEDATE"));
- list2.setWriter(rs.getString("WRITER"));
- list2.setWrite_time(rs.getString("WRITE_TIME"));
- list2.setWrite_dept(rs.getString("WRITE_DEPT"));
-
-
- gpsList2.add(list2);
- /*EcmDutyDetail detail = new EcmDutyDetail();
- detail.setFd_objectid(rs.getString("FD_OBJECTID"));
- detail.setDuty_id(rs.getString("DUTY_ID"));
- detail.setName(rs.getString("NAME"));
- detail.setLeader(rs.getString("LEADER"));
- detail.setLeader_tel(rs.getString("LEADER_TEL"));
- detail.setDuty_date(rs.getString("DUTY_DATE"));
- detail.setStart_time(rs.getString("START_TIME"));
- detail.setEnd_time(rs.getString("END_TIME"));
- detail.setTelephone(rs.getString("TELEPHONE"));
- detail.setDuty_way(rs.getString("DUTY_WAY"));
- detail.setIs_del(rs.getString("IS_DEL"));
- detail.setUpdatedate(rs.getString("UPDATEDATE"));
-
- detailList.add(detail);*/
- }
- }catch(Exception e){
- e.printStackTrace();
- }finally{
- try {
- rs.close();
- pstm.close();
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return gpsList2;
- }
- //根据id获取第一张表的数据(ECM_GPS_LIST)
- // public EcmEmDuty getDutyById(String dutyid){
- public ECMGPSLIST getListById(String listid){
- String sqlSql = "select FD_OBJECTID, TASK_NAME, LEVEL, DEPT, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT "
- + " from ECM_GPS_LIST where FD_OBJECTID = ? ";
- /*String sqlSql = "select FD_OBJECTID,NAME,DEPT_NAMES,STATE,DUTY_TYPE,OPER_DEPT,OPER_NAME,OPER_TIME,IS_DEL,UPDATEDATE "
- +" from ECM_EM_DUTY where FD_OBJECTID = ? ";*/
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- ResultSet rs = null;
- // EcmEmDuty duty = null;
- ECMGPSLIST list1 = null;
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sqlSql);
- pstm.setString(1, listid);
- rs = pstm.executeQuery();
- while(rs.next()){
- list1 = new ECMGPSLIST();
- list1.setFd_objectid(rs.getString("FD_OBJECTID"));
- list1.setTask_name(rs.getString("TASK_NAME"));
- list1.setLevel(rs.getString("LEVEL"));
- list1.setDept(rs.getString("DEPT"));
- list1.setIs_del(rs.getString("IS_DEL"));
- list1.setUpdatedate(rs.getString("UPDATEDATE"));
- list1.setWriter(rs.getString("WRITER"));
- list1.setWrite_time(rs.getString("WRITE_TIME"));
- list1.setWrite_dept(rs.getString("WRITE_DEPT"));
-
- /*duty = new EcmEmDuty();
- duty.setFd_objectid(rs.getString("FD_OBJECTID"));
- duty.setName(rs.getString("NAME"));
- duty.setDept_names(rs.getString("DEPT_NAMES"));
- duty.setState(rs.getString("STATE"));
- duty.setDuty_type(rs.getString("DUTY_TYPE"));
- duty.setOper_dept(rs.getString("OPER_DEPT"));
- duty.setOper_name(rs.getString("OPER_NAME"));
- duty.setOper_time(rs.getString("OPER_TIME"));
- duty.setIs_del(rs.getString("IS_DEL"));
- duty.setUpdatedate(rs.getString("UPDATEDATE"));*/
- }
-
- }catch(Exception e){
- e.printStackTrace();
- }finally{
- try {
- rs.close();
- pstm.close();
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return list1;
- }
- /*
- public boolean updateStat(String[] fdids,String svalue,String rvalue,String releasetime,String reporttime){
- boolean flag = false;
- int handlestate = 0;
- String strSql = " update ECM_EM_DUTY set STATE = ?, RELEASE = ? where FD_OBJECTID = ?" ;
- if(releasetime!=null){
- handlestate = 1;
- strSql = " update ECM_EM_DUTY set STATE = ?, RELEASE = ?,RELEASE_TIME = ? where FD_OBJECTID = ?" ;
- }
- if(reporttime!=null){
- handlestate = 2;
- strSql = " update ECM_EM_DUTY set STATE = ?, RELEASE = ?,REPORTING_TIME = ? where FD_OBJECTID = ?" ;
- }
- if(releasetime!=null && reporttime!=null){
- handlestate = 3;
- strSql = " update ECM_EM_DUTY set STATE = ?, RELEASE = ?,REPORTING_TIME = ?,RELEASE_TIME = ? where FD_OBJECTID = ?" ;
- }
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- try {
- conn = dbConn.getConnection();
- conn.setAutoCommit(false);
- pstm = conn.prepareStatement(strSql);
- for(int i=0;i<fdids.length;i++){
- pstm.setString(1, svalue);
- pstm.setString(2, rvalue);
- if(handlestate==0){
- pstm.setString(3, fdids[i]);
- }
- if(handlestate==1){
- pstm.setString(3, releasetime);
- pstm.setString(4, fdids[i]);
- }
- if(handlestate==2){
- pstm.setString(3, reporttime);
- pstm.setString(4, fdids[i]);
- }
- if(handlestate==3){
- pstm.setString(3, reporttime);
- pstm.setString(4, releasetime);
- pstm.setString(5, fdids[i]);
- }
- pstm.addBatch();
- }
- pstm.executeBatch();
- conn.commit();
- conn.setAutoCommit(true);
- flag = true;
- }catch(Exception e){
- e.printStackTrace();
- }finally{
- try {
- pstm.close();
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return flag;
-
- }*/
- //首页的删除(删除第一张表信息的同时也删除第二张表对应的信息)--批量删除
- // public boolean deleteDuty(String[] objectIDs){
- public boolean deleteLIST(String[] objectIDs){
- boolean ret = false;
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- PreparedStatement pstm2 = null;
- String delList1 = "update ECM_GPS_LIST t set t.IS_DEL = '1' where t.FD_OBJECTID = ? ";
- String delList2 = "update ECM_GPS_LIST_2 t set t.IS_DEL = '1' where t.CONNECTIONID = ? ";
- try{
- conn = dbConn.getConnection();
- conn.setAutoCommit(false);
- pstm = conn.prepareStatement(delList1);
- pstm2 = conn.prepareStatement(delList2);
- for(int i=0;i<objectIDs.length;i++){
- String fd_id = objectIDs[i];
- pstm.setString(1, fd_id);
- pstm.addBatch();
- pstm2.setString(1, fd_id);
- pstm2.addBatch();
-
- }
- pstm.executeBatch();
- pstm2.executeBatch();
- conn.commit();
- conn.setAutoCommit(true);
- ret = true;
- }catch(Exception e){
- try {
- conn.rollback();
- conn.setAutoCommit(true);
-
- } catch (SQLException e1) {
- e1.printStackTrace();
- }
- e.printStackTrace();
- return ret;
- }finally{
- try {
- pstm2.close();
- pstm.close();
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return ret;
- }
- //首页的删除(删除第一张表信息的同时也删除第二张表对应的信息)--批量删除
- // public boolean deDutyDetail(String[] params){
- public boolean delBothList(String[] params){
- // TODO Auto-generated method stub
- boolean flag=false;
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm1 = null;
- PreparedStatement pstm2 = null;
- String delList1SQL="update ECM_EM_DUTY set IS_DEL ='1' where FD_OBJECTID=?";
- String delList2SQL ="update ECM_EM_DUTY_DETAIL set IS_DEL ='1' where DUTY_ID=?";
- try{
- conn=dbConn.getConnection();
- conn.setAutoCommit(false);
- pstm1=conn.prepareStatement(delList1SQL);
- pstm2=conn.prepareStatement(delList2SQL);
- for(int i=0;i<params.length;i++){
-
- pstm1.setString(1, params[i]);
- pstm2.setString(1, params[i]);
- pstm1.executeUpdate();
- pstm2.executeUpdate();
- }
- conn.commit();
- conn.setAutoCommit(true);
- flag=true;
- //System.out.println(123123123);
-
- }catch(Exception e){
- try {
- conn.rollback();
- conn.setAutoCommit(true);
- } catch (SQLException e1) {
- e1.printStackTrace();
- }
- e.printStackTrace();
-
- }finally{
- try {
- if(pstm1!=null)
- pstm1.close();
- if(pstm2!=null)
- pstm2.close();
- if(conn!=null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
-
-
- return flag;
- }
- public boolean saveBGDmingxi(List<BGDmingxi> gsplist2, String taskId) throws Exception {
- Connection conn = null;
- PreparedStatement st = null;
- DbConnection db = new DbConnection();
- DateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- try {
- String sql = "select PROGRAM_NAME,TO_CHAR(UPDATEDATE,'yyyy-mm-dd hh24:mi:ss'),GPS_LEVEL from ECM_GPS_PROGRAM_MANAGEMENT where FD_OBJECTID='"+taskId+"'";
- log.info("queryTask_sql:"+sql);
- List<String[]> tempList = persistence.getSearchResult(610, sql.toString());
- String taskName = "";
- String taskTime = "";
- String taskLevel = "";
- if(tempList!=null && tempList.size()>0){
- String[] arr = tempList.get(0);
- taskName = arr[0];
- taskTime = arr[1];
- taskLevel = arr[2];
- }
- if("0".equals(taskLevel)){
- taskLevel = "特级";
- }else if("1".equals(taskLevel)){
- taskLevel = "一级";
- }else if("2".equals(taskLevel)){
- taskLevel = "二级";
- }else if("3".equals(taskLevel)){
- taskLevel = "三级";
- }
- String sql1 = "insert into ECM_GPS_JOURNALING ( FD_OBJECTID, INPUT_NAME, INPUT_TIME, INPUT_DEPT, MAN_COUNT, CAR_COUNT, IS_DEL, UPDATEDATE, FD_TASK, FD_TASK_NAME, BGD_FDC, BGD_FDJ, BGD_RW_TIME, BGD_DW ,BGD_LEVEL,XINGHAO,RONGLIANG,CHANJIA,QTZHUNGBEI)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
-
- conn = db.getConnection();
- int num=0;
- conn.setAutoCommit(false);
- //系统当前时间
- Date date=new Date();
- String time=format.format(date);
- st = conn.prepareStatement(sql1);
- for (int i = 0; i < gsplist2.size(); i++) {
- BGDmingxi mx = gsplist2.get(i);
- System.out.println(mx.getFD_OBJECTID());
- String fd_id=IdentityGenerator.getIdentityGenerator().gerenalIdentity(613);
- st.setString(1, fd_id);
- st.setString(2, mx.getINPUT_NAME());
- st.setString(3, time);
- st.setString(4, mx.getINPUT_DEPT());
- st.setString(5, mx.getMAN_COUNT());
- st.setString(6, mx.getCAR_COUNT());
- st.setString(7, "0");
- st.setString(8, time);
- st.setString(9, taskId);
- st.setString(10, taskName);
- st.setString(11, mx.getBGD_FDC());
- st.setString(12, mx.getBGD_FDJ());
- st.setString(13, taskTime);
- st.setString(14, mx.getBGD_DW());
- st.setString(15, taskLevel);
- st.setString(16, mx.getXINGHAO());
- st.setString(17, mx.getRONGLIANG());
- st.setString(18, mx.getCHANJIA());
- st.setString(19, mx.getQTZHUNGBEI());
- st.executeUpdate();
- num++;
- }
- if(num==gsplist2.size()){
- log.info("保存成功");
- conn.commit();
- return true;
- }else{
-
- // st.executeBatch();
- conn.rollback();
- log.info("保存失败");
- return false;
- }
- } catch (Exception e) {
- throw e;
- }finally{
- try {
- if(st!= null)
- st.close();
- if(conn!= null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
- public List<String[]> getBGDCorpByTaskId(String taskId){
- String sql = "select GPS_AREA_NAME from ECM_GPS_PROGRAM_MANAGEMENT where FD_OBJECTID='"+taskId+"'";
- log.info("queryTask_sql:"+sql);
- List<String[]> tempList = null;
- try {
- tempList = persistence.getSearchResult(610, sql.toString());
- } catch (PersistenceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return tempList;
-
- }
-
- public List<String[]> getBGDNumByTaskId(String taskId){
- String sql = "select GPS_TASK_NUMBER,PROGRAM_NAME,START_TIME,END_TIME,GPS_CONTINATION_TIME from ECM_GPS_PROGRAM_MANAGEMENT where FD_OBJECTID='"+taskId+"'";
- log.info("queryTask_sql:"+sql);
- List<String[]> tempList = null;
- try {
- tempList = persistence.getSearchResult(610, sql.toString());
- } catch (PersistenceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return tempList;
-
- }
- public boolean saveBGDBaoBiao(List<BGDBaoBiao> gsplist2, String taskId, String bgdNum, String bgdName) throws Exception {
- Connection conn = null;
- PreparedStatement st = null;
- DbConnection db = new DbConnection();
- DateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- try {
-
- String sql1 = "insert into NWYJ.ECM_GPS_ZIYUANBAOBIAO(FD_OBJECTID, INPUT_UNIT_ID, INPUT_UNIT_NAME, INPUT_NAME, "
- + "INPUT_NAME_ID, UPDATEDATE, INPUT_TIME, IS_DEL, GPS_TASK_NUMBER, GPS_TASK_FDC_DAY, GPS_TASK__FDC_TOTAL,"
- + " GPS_TASK_FDJ_DAY, GPS_TASK_FDJ_TOTAL, GPS_TASK_CAR, GPS_TASK_ZBZHGLRY, GPS_TASK_BDWBZRY, GPS_TASK_ABRY,"
- + " GPS_TASK_WWSCRY, TASK_ID, TASK_NAME) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
-
- conn = db.getConnection();
- int num=0;
- conn.setAutoCommit(false);
- //系统当前时间
- Date date=new Date();
- String time=format.format(date);
- st = conn.prepareStatement(sql1);
- for (int i = 0; i < gsplist2.size(); i++) {
- BGDBaoBiao mx = gsplist2.get(i);
- System.out.println(mx.getFD_OBJECTID());
- String fd_id=IdentityGenerator.getIdentityGenerator().gerenalIdentity(620);
- st.setString(1, fd_id);
- st.setString(2, mx.getINPUT_UNIT_ID());
- st.setString(3, mx.getINPUT_UNIT_NAME());
- st.setString(4, mx.getINPUT_TIME());
- st.setString(5, mx.getINPUT_NAME_ID());
- st.setString(6, time);
- st.setString(7, time);
- st.setString(8, "0");
- st.setString(9, bgdNum);
- st.setString(10, mx.getGPS_TASK_FDC_DAY());
- st.setString(11, mx.getGPS_TASK__FDC_TOTAL());
- st.setString(12, mx.getGPS_TASK_FDJ_DAY());
- st.setString(13, mx.getGPS_TASK_FDJ_TOTAL());
- st.setString(14, mx.getGPS_TASK_CAR());
- st.setString(15, mx.getGPS_TASK_ZBZHGLRY());
- st.setString(16, mx.getGPS_TASK_BDWBZRY());
- st.setString(17, mx.getGPS_TASK_ABRY());
- st.setString(18, mx.getGPS_TASK_WWSCRY());
- st.setString(19, taskId);
- st.setString(20, bgdName);
- st.executeUpdate();
- num++;
- }
- if(num==gsplist2.size()){
- log.info("保存成功");
- conn.commit();
- return true;
- }else{
-
- // st.executeBatch();
- conn.rollback();
- log.info("保存失败");
- return false;
- }
- } catch (Exception e) {
- throw e;
- }finally{
- try {
- if(st!= null)
- st.close();
- if(conn!= null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
- public boolean saveBGDTask(List<BaoGongDianTask> gpsList2) throws Exception {
- boolean flag = false;
- Connection conn = null;
- PreparedStatement st = null;
- DbConnection db = new DbConnection();
- try {
-
- String sql1 = "insert into NWYJ.ECM_GPS_PROGRAM_MANAGEMENT(FD_OBJECTID, PROGRAM_NAME, GPS_LEVEL, GPS_AREA_NAME, "
- + "IMPLEMENT_TIME, PROGRAM_STATE, INPUT_UNIT_ID, INPUT_TIME, INPUT_NAME, START_TIME, END_TIME, COMMENT_TEXT,"
- + " TASK_STATE, UPDATEDATE, IS_DEL, GPS_AREA_ID, INPUT_UNIT_NAME, GPS_AREA_CITY, HAS_DUTY, GPS_YEAR,"
- + " GPS_AREA_ID_FU, ISSUE_DEPT, INPUT_NAME_ID, ISSUE_TIME, PARENT_DEPT_ID, GPS_AREA_CITY_ID, GPS_SM, GPS_SIREL,"
- + " GPS_SIREL_FILE, GPS_TASK_NUMBER, GPS_TASK_PROPERTY, GPS_TASK_TYPE, GPS_TASK_PLAN_TYPE, GPS_TASK_QUYU,"
- + " GPS_TASK_FDC_DAY, GPS_TASK__FDC_TOTAL, GPS_TASK_FDJ_DAY, GPS_TASK_FDJ_TOTAL, GPS_TASK_CAR, GPS_TASK_ZBZHGLRY,"
- + " GPS_TASK_BDWBZRY, GPS_TASK_ABRY, GPS_TASK_WWSCRY, GPS_CONTINATION_TIME) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
-
- conn = db.getConnection();
- conn.setAutoCommit(false);
- //系统当前时间
- Date date=new Date();
- st = conn.prepareStatement(sql1);
- for (int i = 0; i < gpsList2.size(); i++) {
- BaoGongDianTask mx = gpsList2.get(i);
- st.setString(1, mx.getFD_OBJECTID());
- st.setString(2, mx.getPROGRAM_NAME());
- st.setString(3, mx.getGPS_LEVEL());
- st.setString(4, mx.getGPS_AREA_NAME());
- st.setString(5, mx.getIMPLEMENT_TIME());
- st.setString(6, mx.getPROGRAM_STATE());
- st.setString(7, mx.getINPUT_UNIT_ID());
- st.setString(8, mx.getINPUT_TIME());
- st.setString(9, mx.getINPUT_NAME());
- st.setString(10, mx.getSTART_TIME());
- st.setString(11, mx.getEND_TIME());
- st.setString(12, mx.getCOMMENT_TEXT());
- st.setString(13, mx.getTASK_STATE());
- st.setString(14, mx.getUPDATEDATE());
- st.setString(15, mx.getIS_DEL());
- st.setString(16, mx.getGPS_AREA_ID());
- st.setString(17, mx.getINPUT_UNIT_NAME());
- st.setString(18, mx.getGPS_AREA_CITY());
- st.setString(19, mx.getHAS_DUTY());
- st.setString(20, mx.getGPS_YEAR());
- st.setString(21, mx.getGPS_AREA_ID_FU());
- st.setString(22, mx.getISSUE_DEPT());
- st.setString(23, mx.getINPUT_NAME_ID());
- st.setString(24, mx.getISSUE_TIME());
- st.setString(25, mx.getPARENT_DEPT_ID());
- st.setString(26, mx.getGPS_AREA_CITY_ID());
- st.setString(27, mx.getGPS_SM());
- st.setString(28, mx.getGPS_SIREL());
- st.setString(29, mx.getGPS_SIREL_FILE());
- st.setString(30, mx.getGPS_TASK_NUMBER());
- st.setString(31, mx.getGPS_TASK_PROPERTY());
- st.setString(32, mx.getGPS_TASK_TYPE());
- st.setString(33, mx.getGPS_TASK_PLAN_TYPE());
- st.setString(34, mx.getGPS_TASK_QUYU());
- st.setString(35, mx.getGPS_TASK_FDC_DAY());
- st.setString(36, mx.getGPS_TASK__FDC_TOTAL());
- st.setString(37, mx.getGPS_TASK_FDJ_DAY());
- st.setString(38, mx.getGPS_TASK_FDJ_TOTAL());
- st.setString(39, mx.getGPS_TASK_CAR());
- st.setString(40, mx.getGPS_TASK_ZBZHGLRY());
- st.setString(41, mx.getGPS_TASK_BDWBZRY());
- st.setString(42, mx.getGPS_TASK_ABRY());
- st.setString(43, mx.getGPS_TASK_WWSCRY());
- st.setString(44, mx.getGPS_CONTINATION_TIME());
- st.addBatch();
- log.info("saveBGDTask__"+i);
-
- }
- st.executeBatch();
- conn.commit();
- flag = true;
- } catch (Exception e) {
- conn.rollback();
- throw e;
- }finally{
- try {
- if(st!= null)
- st.close();
- if(conn!= null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
-
- return flag;
- }
- }
|