3f54fb9dfc422ecb78de24d46d805836661f7ad4.svn-base 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package cn.com.goldenwater.dcproj.service.impl.swhs;
  2. import cn.com.goldenwater.core.service.AbstractCrudService;
  3. import cn.com.goldenwater.dcproj.dao.BisInspLogDao;
  4. import cn.com.goldenwater.dcproj.dao.BisInspSwhsRgstrMeasuresDao;
  5. import cn.com.goldenwater.dcproj.model.BisInspLog;
  6. import cn.com.goldenwater.dcproj.model.BisInspSwhsRgstrMeasures;
  7. import cn.com.goldenwater.dcproj.param.BisInspLogParam;
  8. import cn.com.goldenwater.dcproj.param.BisInspSwhsRgstrMeasuresParam;
  9. import cn.com.goldenwater.dcproj.service.BisInspSwhsRgstrMeasuresService;
  10. import net.sf.json.JSONObject;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Service;
  13. import org.springframework.transaction.annotation.Transactional;
  14. import java.sql.Date;
  15. import java.util.List;
  16. /**
  17. * @author lune
  18. * @date 2019-8-7
  19. */
  20. @Service
  21. @Transactional
  22. public class BisInspSwhsRgstrMeasuresServiceImpl extends AbstractCrudService<BisInspSwhsRgstrMeasures, BisInspSwhsRgstrMeasuresParam> implements BisInspSwhsRgstrMeasuresService {
  23. @Autowired
  24. private BisInspSwhsRgstrMeasuresDao bisInspSwhsRgstrMeasuresDao;
  25. @Autowired
  26. private BisInspLogDao bisInspLogDao;
  27. public BisInspSwhsRgstrMeasuresServiceImpl(BisInspSwhsRgstrMeasuresDao bisInspSwhsRgstrMeasuresDao) {
  28. super(bisInspSwhsRgstrMeasuresDao);
  29. this.bisInspSwhsRgstrMeasuresDao = bisInspSwhsRgstrMeasuresDao;
  30. }
  31. @Override
  32. public boolean reData() {
  33. boolean bol = true;
  34. BisInspLogParam bisInspLogParam = new BisInspLogParam();
  35. bisInspLogParam.setPath("http://sv.goldenwater.com.cn/bis/insp/swhs/rgstr/measures");
  36. List<BisInspLog> bisInspLogList = bisInspLogDao.findLogList(bisInspLogParam);
  37. for (BisInspLog inspLog : bisInspLogList) {
  38. String resp = inspLog.getResponseBody();
  39. net.sf.json.JSONObject jsonobject = JSONObject.fromObject(resp);
  40. JSONObject data = jsonobject.getJSONObject("data");
  41. String id = data.getString("id");
  42. String rgstrId = data.getString("rgstrId");
  43. String annInflow = data.getString("annInflow");
  44. String annInflowDry = data.getString("annInflowDry");
  45. String isAmwqiadtfad = data.getString("isAmwqiadtfad");
  46. String isEcgbacws = data.getString("isEcgbacws");
  47. String isEowqoms = data.getString("isEowqoms");
  48. String isHasIwba = data.getString("isHasIwba");
  49. String isHasProject = data.getString("isHasProject");
  50. String isPzfdwsad = data.getString("isPzfdwsad");
  51. String isSwqiowstswrmisar = data.getString("isSwqiowstswrmisar");
  52. String isTcowqmWtmiafmtr = data.getString("isTcowqmWtmiafmtr");
  53. String recPersId = data.getString("recPersId");
  54. String inTm = data.getString("inTm");
  55. Long inTmL = Long.parseLong(inTm);
  56. String upTm = data.getString("upTm");
  57. Long upTmL = Long.parseLong(upTm);
  58. BisInspSwhsRgstrMeasures inspSwhsRgstrMeasures = new BisInspSwhsRgstrMeasures();
  59. inspSwhsRgstrMeasures.setId(id);
  60. inspSwhsRgstrMeasures.setRgstrId(rgstrId);
  61. inspSwhsRgstrMeasures.setAnnInflow(annInflow);
  62. inspSwhsRgstrMeasures.setAnnInflowDry(annInflowDry);
  63. inspSwhsRgstrMeasures.setIsAmwqiadtfad(isAmwqiadtfad);
  64. inspSwhsRgstrMeasures.setIsEcgbacws(isEcgbacws);
  65. inspSwhsRgstrMeasures.setIsEowqoms(isEowqoms);
  66. inspSwhsRgstrMeasures.setIsHasIwba(isHasIwba);
  67. inspSwhsRgstrMeasures.setIsHasProject(isHasProject);
  68. inspSwhsRgstrMeasures.setIsPzfdwsad(isPzfdwsad);
  69. inspSwhsRgstrMeasures.setIsSwqiowstswrmisar(isSwqiowstswrmisar);
  70. inspSwhsRgstrMeasures.setIsTcowqmWtmiafmtr(isTcowqmWtmiafmtr);
  71. inspSwhsRgstrMeasures.setRecPersId(recPersId);
  72. inspSwhsRgstrMeasures.setInTm(new Date(inTmL));
  73. inspSwhsRgstrMeasures.setUpTm(new Date(upTmL));
  74. BisInspSwhsRgstrMeasures swhsRgstrMeasures = bisInspSwhsRgstrMeasuresDao.get(id);
  75. if (swhsRgstrMeasures != null) {
  76. bisInspSwhsRgstrMeasuresDao.update(inspSwhsRgstrMeasures);
  77. } else {
  78. bisInspSwhsRgstrMeasuresDao.insert(inspSwhsRgstrMeasures);
  79. }
  80. }
  81. return bol;
  82. }
  83. }