73381bdec02a32e3bf790f7a56b4af820c91f6b8.svn-base 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package cn.com.goldenwater.dcproj.service.impl;
  2. import cn.com.goldenwater.dcproj.dao.BisInspWtuntRgstrDao;
  3. import cn.com.goldenwater.dcproj.dao.BisInspWtuntRgstrSteelDao;
  4. import cn.com.goldenwater.dcproj.dao.BisInspWtuntRgstrSteelReoDao;
  5. import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr;
  6. import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstrSteel;
  7. import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstrSteelReo;
  8. import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstrVo;
  9. import cn.com.goldenwater.dcproj.param.BisInspWtuntRgstrSteelParam;
  10. import cn.com.goldenwater.dcproj.param.BisInspWtuntRgstrSteelReoParam;
  11. import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrService;
  12. import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrSteelReoService;
  13. import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrSteelService;
  14. import cn.com.goldenwater.core.service.AbstractCrudService;
  15. import cn.com.goldenwater.dcproj.utils.Constant;
  16. import cn.com.goldenwater.id.util.UuidUtil;
  17. import org.apache.commons.collections.CollectionUtils;
  18. import org.apache.commons.lang3.StringUtils;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.stereotype.Service;
  21. import org.springframework.transaction.annotation.Transactional;
  22. import java.util.Date;
  23. import java.util.List;
  24. /**
  25. * @author lune
  26. * @date 2020-8-17
  27. */
  28. @Service
  29. @Transactional(rollbackFor = Exception.class)
  30. public class BisInspWtuntRgstrSteelServiceImpl extends AbstractCrudService<BisInspWtuntRgstrSteel, BisInspWtuntRgstrSteelParam> implements BisInspWtuntRgstrSteelService {
  31. @Autowired
  32. private BisInspWtuntRgstrSteelDao bisInspWtuntRgstrSteelDao;
  33. @Autowired
  34. private BisInspWtuntRgstrDao bisInspWtuntRgstrDao;
  35. @Autowired
  36. private BisInspWtuntRgstrSteelReoDao bisInspWtuntRgstrSteelReoDao;
  37. public BisInspWtuntRgstrSteelServiceImpl(BisInspWtuntRgstrSteelDao bisInspWtuntRgstrSteelDao) {
  38. super(bisInspWtuntRgstrSteelDao);
  39. this.bisInspWtuntRgstrSteelDao = bisInspWtuntRgstrSteelDao;
  40. }
  41. @Override
  42. public void insertSteel(BisInspWtuntRgstrVo bisInspWtuntRgstrVo) {
  43. //钢铁
  44. BisInspWtuntRgstrSteel bisInspWtuntRgstrSteel = bisInspWtuntRgstrVo.getBisInspWtuntRgstrSteel();
  45. String rgstrId = bisInspWtuntRgstrSteel.getRgstrId();
  46. bisInspWtuntRgstrSteel.setUptm(new Date());
  47. if (StringUtils.isBlank(bisInspWtuntRgstrSteel.getId())) {
  48. BisInspWtuntRgstrSteelParam steelParam = new BisInspWtuntRgstrSteelParam();
  49. steelParam.setRgstrId(rgstrId);
  50. List<BisInspWtuntRgstrSteel> list = bisInspWtuntRgstrSteelDao.findList(steelParam);
  51. if (CollectionUtils.isEmpty(list)) {
  52. bisInspWtuntRgstrSteel.setId(UuidUtil.uuid());
  53. bisInspWtuntRgstrSteel.setIntm(new Date());
  54. bisInspWtuntRgstrSteelDao.insert(bisInspWtuntRgstrSteel);
  55. } else {
  56. bisInspWtuntRgstrSteel.setId(list.get(0).getId());
  57. bisInspWtuntRgstrSteelDao.update(bisInspWtuntRgstrSteel);
  58. }
  59. } else {
  60. bisInspWtuntRgstrSteelDao.update(bisInspWtuntRgstrSteel);
  61. }
  62. List<BisInspWtuntRgstrSteelReo> bisInspWtuntRgstrSteelReoList = bisInspWtuntRgstrVo.getBisInspWtuntRgstrSteelReo();
  63. for (BisInspWtuntRgstrSteelReo bisInspWtuntRgstrSteelReo : bisInspWtuntRgstrSteelReoList) {
  64. bisInspWtuntRgstrSteelReo.setUptm(new Date());
  65. //主要责任
  66. if (StringUtils.isBlank(bisInspWtuntRgstrSteelReo.getId())) {
  67. bisInspWtuntRgstrSteelReo.setId(UuidUtil.uuid());
  68. bisInspWtuntRgstrSteelReo.setRgstrId(rgstrId);
  69. bisInspWtuntRgstrSteelReo.setIntm(new Date());
  70. bisInspWtuntRgstrSteelReoDao.insert(bisInspWtuntRgstrSteelReo);
  71. } else {
  72. bisInspWtuntRgstrSteelReoDao.update(bisInspWtuntRgstrSteelReo);
  73. }
  74. }
  75. //修改登记表督查状态
  76. if (StringUtils.isNotBlank(rgstrId)) {
  77. BisInspWtuntRgstr wtuntRgstr = bisInspWtuntRgstrDao.get(rgstrId);
  78. if (!Constant.STRING_TWO.equals(wtuntRgstr.getState())) {
  79. wtuntRgstr.setUptm(new Date());
  80. wtuntRgstr.setState(Constant.STRING_ONE);
  81. wtuntRgstr.setWtuntStat(bisInspWtuntRgstrSteel.getStatus());
  82. bisInspWtuntRgstrDao.update(wtuntRgstr);
  83. }
  84. }
  85. }
  86. }