f3eb030ed9eeb58294bd0e3a8239db3297b2cdf8.svn-base 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package com.sinosoft.am.duty.records.dao;
  2. import java.sql.Connection;
  3. import java.sql.PreparedStatement;
  4. import java.sql.SQLException;
  5. import com.persistence.DbConnection;
  6. import com.sinosoft.em.gps.vo.GPSDutyMsg;
  7. import com.sinosoft.am.duty.records.service.DutyImport;
  8. import com.sinosoft.am.duty.records.vo.EcmDutyDetail1;
  9. public class DutyTaskDao {
  10. public boolean saveDuty(EcmDutyDetail1 detail) {
  11. boolean flag = false;
  12. DbConnection dbConn = new DbConnection();
  13. Connection conn = null;
  14. PreparedStatement pstm = null;
  15. String detailSQL = "update ECM_GPS_DUTY "
  16. +" set start_time = ?, end_time = ?, leader = ?, leader_tel = ?, name=?, "
  17. + "duty_way = ?, UPDATEDATE = ? "
  18. + " where FD_OBJECTID = ?";
  19. int num = 0 ;
  20. try {
  21. conn = dbConn.getConnection();
  22. conn.setAutoCommit(false);
  23. pstm = conn.prepareStatement(detailSQL);
  24. pstm.setString(1, detail.getStart_time());
  25. pstm.setString(2, detail.getEnd_time());
  26. pstm.setString(3, detail.getLeader());
  27. pstm.setString(4, detail.getLeader_tel());
  28. pstm.setString(5, detail.getName());
  29. pstm.setString(6, detail.getDuty_way());
  30. pstm.setString(7, detail.getUpdatedate());
  31. pstm.setString(8, detail.getFd_objectid());
  32. num = pstm.executeUpdate();
  33. conn.commit();
  34. flag = true;
  35. }catch(Exception e){
  36. try {
  37. conn.rollback();
  38. } catch (SQLException e1) {
  39. e1.printStackTrace();
  40. }
  41. e.printStackTrace();
  42. }finally{
  43. try {
  44. pstm.close();
  45. conn.close();
  46. } catch (SQLException e) {
  47. e.printStackTrace();
  48. }
  49. }
  50. return flag;
  51. }
  52. }