f739199ed9c7c4cd0f2eed2ad1e5b64cb134133d.svn-base 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package cn.com.goldenwater.dcproj.service.impl;
  2. import cn.com.goldenwater.core.service.AbstractCrudService;
  3. import cn.com.goldenwater.dcproj.dao.BisInspRsfcoqhPresDao;
  4. import cn.com.goldenwater.dcproj.model.BisInspRsfcoqhPres;
  5. import cn.com.goldenwater.dcproj.param.BisInspRsfcoqhPresParam;
  6. import cn.com.goldenwater.dcproj.service.BisInspRsfcoqhPresService;
  7. import cn.com.goldenwater.dcproj.service.BisInspRsfcoqhRgstrService;
  8. import cn.com.goldenwater.id.util.UuidUtil;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.stereotype.Service;
  11. import org.springframework.transaction.annotation.Transactional;
  12. import java.util.Date;
  13. import java.util.HashMap;
  14. import java.util.Map;
  15. /**
  16. * @author lhc
  17. * @date 2021-6-10
  18. */
  19. @Service
  20. @Transactional
  21. public class BisInspRsfcoqhPresServiceImpl extends AbstractCrudService<BisInspRsfcoqhPres, BisInspRsfcoqhPresParam> implements BisInspRsfcoqhPresService {
  22. @Autowired
  23. private BisInspRsfcoqhPresDao bisInspRsfcoqhPresDao;
  24. @Autowired
  25. private BisInspRsfcoqhRgstrService bisInspRsfcoqhRgstrService;
  26. public BisInspRsfcoqhPresServiceImpl(BisInspRsfcoqhPresDao bisInspRsfcoqhPresDao) {
  27. super(bisInspRsfcoqhPresDao);
  28. this.bisInspRsfcoqhPresDao = bisInspRsfcoqhPresDao;
  29. }
  30. @Override
  31. public int insert(BisInspRsfcoqhPres bisInspRsfcoqhPres) {
  32. BisInspRsfcoqhPres checkRgstr = bisInspRsfcoqhPresDao.get(bisInspRsfcoqhPres.getRgstrId());
  33. if (checkRgstr != null) {
  34. bisInspRsfcoqhPres.setId(checkRgstr.getId());
  35. return update(bisInspRsfcoqhPres);
  36. }
  37. updateRgstrState(bisInspRsfcoqhPres);
  38. String uuid = UuidUtil.uuid();
  39. bisInspRsfcoqhPres.setId(uuid);
  40. bisInspRsfcoqhPres.setIntm(new Date());
  41. bisInspRsfcoqhPres.setUptm(new Date());
  42. bisInspRsfcoqhPres.setDataStat("0");
  43. return this.bisInspRsfcoqhPresDao.insert(bisInspRsfcoqhPres);
  44. }
  45. @Override
  46. public int update(BisInspRsfcoqhPres bisInspRsfcoqhPres) {
  47. bisInspRsfcoqhPres.setUptm(new Date());
  48. updateRgstrState(bisInspRsfcoqhPres);
  49. return this.bisInspRsfcoqhPresDao.update(bisInspRsfcoqhPres);
  50. }
  51. /**
  52. * 修改登记表状态
  53. * @param bisInspRsfcoqhPres
  54. */
  55. private void updateRgstrState(BisInspRsfcoqhPres bisInspRsfcoqhPres) {
  56. // 更新登记表状态
  57. Map<String, Object> map = new HashMap<>(3);
  58. map.put("rgstrId", bisInspRsfcoqhPres.getRgstrId());
  59. map.put("param", "pres");
  60. map.put("state", bisInspRsfcoqhPres.getState());
  61. bisInspRsfcoqhRgstrService.updateState(map);
  62. }
  63. @Override
  64. public int delete(String id) {
  65. return this.bisInspRsfcoqhPresDao.delete(id);
  66. }
  67. }