8188a34214a7f76dc2736a4a6e04df477f094428.svn-base 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package cn.com.goldenwater.dcproj.service.impl.stnd;
  2. import cn.com.goldenwater.dcproj.dao.BisInspStndMgamtDao;
  3. import cn.com.goldenwater.dcproj.dao.BisInspStndRgstrDao;
  4. import cn.com.goldenwater.dcproj.model.BisInspStndDtymin;
  5. import cn.com.goldenwater.dcproj.model.BisInspStndMgamt;
  6. import cn.com.goldenwater.dcproj.model.BisInspStndRgstr;
  7. import cn.com.goldenwater.dcproj.param.BisInspStndDtyminParam;
  8. import cn.com.goldenwater.dcproj.param.BisInspStndMgamtParam;
  9. import cn.com.goldenwater.dcproj.service.BisInspStndMgamtService;
  10. import cn.com.goldenwater.core.service.AbstractCrudService;
  11. import com.github.pagehelper.PageHelper;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.stereotype.Service;
  14. import org.springframework.transaction.annotation.Transactional;
  15. import cn.com.goldenwater.id.util.UuidUtil;
  16. import java.util.List;
  17. import java.util.Date;
  18. /**
  19. * @author lhc
  20. * @date 2020-3-25
  21. */
  22. @Service
  23. @Transactional
  24. public class BisInspStndMgamtServiceImpl extends AbstractCrudService<BisInspStndMgamt, BisInspStndMgamtParam> implements BisInspStndMgamtService {
  25. @Autowired
  26. private BisInspStndMgamtDao bisInspStndMgamtDao;
  27. @Autowired
  28. private BisInspStndRgstrDao bisInspStndRgstrDao;
  29. public BisInspStndMgamtServiceImpl(BisInspStndMgamtDao bisInspStndMgamtDao) {
  30. super(bisInspStndMgamtDao);
  31. this.bisInspStndMgamtDao = bisInspStndMgamtDao;
  32. }
  33. @Override
  34. public int insert(BisInspStndMgamt bisInspStndMgamt) {
  35. String uuid = UuidUtil.uuid(); // 生成uuid
  36. bisInspStndMgamt.setId(uuid);
  37. bisInspStndMgamt.setIntm(new Date());
  38. bisInspStndMgamt.setUptm(new Date());
  39. bisInspStndMgamt.setDataStat("0");
  40. //查询是否添加过同样的regId
  41. BisInspStndMgamtParam bisInspStndMgamtParam = new BisInspStndMgamtParam();
  42. bisInspStndMgamtParam.setRgstrId(bisInspStndMgamt.getRgstrId());
  43. BisInspStndMgamt bisInspStndMgamtTemp = bisInspStndMgamtDao.getBy(bisInspStndMgamtParam);
  44. if (null == bisInspStndMgamtTemp) {
  45. BisInspStndRgstr bisInspStndRgstr = new BisInspStndRgstr();
  46. bisInspStndRgstr.setId(bisInspStndMgamt.getRgstrId());
  47. bisInspStndRgstr.setMgamtState(bisInspStndMgamt.getStatus());
  48. bisInspStndRgstr.setState("1");
  49. bisInspStndRgstrDao.update(bisInspStndRgstr);
  50. return this.bisInspStndMgamtDao.insert(bisInspStndMgamt);
  51. }
  52. return 0;
  53. }
  54. @Override
  55. public int update(BisInspStndMgamt bisInspStndMgamt) {
  56. if (null != bisInspStndMgamt.getRgstrId()) {
  57. BisInspStndRgstr bisInspStndRgstr = new BisInspStndRgstr();
  58. bisInspStndRgstr.setId(bisInspStndMgamt.getRgstrId());
  59. bisInspStndRgstr.setMgamtState(bisInspStndMgamt.getStatus());
  60. bisInspStndRgstr.setState("1");
  61. bisInspStndRgstrDao.update(bisInspStndRgstr);
  62. }
  63. bisInspStndMgamt.setUptm(new Date());
  64. return this.bisInspStndMgamtDao.update(bisInspStndMgamt);
  65. }
  66. @Override
  67. public int delete(String id) {
  68. return this.bisInspStndMgamtDao.delete(id);
  69. }
  70. @Override
  71. public BisInspStndMgamt getByRegId(String regId) {
  72. BisInspStndMgamtParam bisInspStndMgamtParam = new BisInspStndMgamtParam();
  73. bisInspStndMgamtParam.setRgstrId(regId);
  74. return bisInspStndMgamtDao.getBy(bisInspStndMgamtParam);
  75. }
  76. }