1481a6fc74bd6031e8d9cad2a79caa15422f0219.svn-base 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. package cn.com.goldenwater.dcproj.service.impl;
  2. import cn.com.goldenwater.core.service.AbstractCrudService;
  3. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  4. import cn.com.goldenwater.dcproj.constValue.SplitValue;
  5. import cn.com.goldenwater.dcproj.dao.AttProjectInsuranceDao;
  6. import cn.com.goldenwater.dcproj.dao.AttProjectInsuranceRecordDao;
  7. import cn.com.goldenwater.dcproj.dao.BisInspAnzeRgstrDao;
  8. import cn.com.goldenwater.dcproj.dto.BisInspAnzeRgstrDto;
  9. import cn.com.goldenwater.dcproj.dto.BisInspRgstrDto;
  10. import cn.com.goldenwater.dcproj.exception.ServiceException;
  11. import cn.com.goldenwater.dcproj.model.AttProjectInsurance;
  12. import cn.com.goldenwater.dcproj.model.AttProjectInsuranceRecord;
  13. import cn.com.goldenwater.dcproj.model.BisInspAllObj;
  14. import cn.com.goldenwater.dcproj.model.BisInspAnzeRgstr;
  15. import cn.com.goldenwater.dcproj.param.AttProjectInsuranceRecordParam;
  16. import cn.com.goldenwater.dcproj.param.BisInspAnzeRgstrParam;
  17. import cn.com.goldenwater.dcproj.param.TypeParam;
  18. import cn.com.goldenwater.dcproj.service.BisInspAnzeRgstrService;
  19. import cn.com.goldenwater.dcproj.service.BisInspObjStrategy;
  20. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  21. import cn.com.goldenwater.dcproj.utils.StringUtils;
  22. import cn.com.goldenwater.id.util.UuidUtil;
  23. import cn.com.goldenwater.util.common.InspPblmUtils;
  24. import com.github.pagehelper.PageHelper;
  25. import com.github.pagehelper.PageInfo;
  26. import org.apache.commons.collections4.CollectionUtils;
  27. import org.springframework.beans.BeanUtils;
  28. import org.springframework.beans.factory.annotation.Autowired;
  29. import org.springframework.stereotype.Service;
  30. import org.springframework.transaction.annotation.Transactional;
  31. import javax.servlet.http.HttpServletResponse;
  32. import java.util.Date;
  33. import java.util.List;
  34. import java.util.Optional;
  35. /**
  36. * @author lql
  37. * @date 2026-4-21
  38. */
  39. @Service
  40. @Transactional
  41. public class BisInspAnzeRgstrServiceImpl extends AbstractCrudService<BisInspAnzeRgstr, BisInspAnzeRgstrParam> implements BisInspAnzeRgstrService, BisInspObjStrategy {
  42. @Autowired
  43. private BisInspAnzeRgstrDao bisInspAnzeRgstrDao;
  44. @Autowired
  45. private AttProjectInsuranceDao attProjectInsuranceDao;
  46. @Autowired
  47. private AttProjectInsuranceRecordDao attProjectInsuranceRecordDao;
  48. public BisInspAnzeRgstrServiceImpl(BisInspAnzeRgstrDao bisInspAnzeRgstrDao) {
  49. super(bisInspAnzeRgstrDao);
  50. this.bisInspAnzeRgstrDao = bisInspAnzeRgstrDao;
  51. }
  52. @Override
  53. public int insert(BisInspAnzeRgstr bisInspAnzeRgstr) {
  54. String uuid = UuidUtil.uuid();
  55. bisInspAnzeRgstr.setId(uuid);
  56. return this.bisInspAnzeRgstrDao.insert(bisInspAnzeRgstr);
  57. }
  58. @Override
  59. public int update(BisInspAnzeRgstr bisInspAnzeRgstr) {
  60. bisInspAnzeRgstr.setUptm(new Date());
  61. return this.bisInspAnzeRgstrDao.update(bisInspAnzeRgstr);
  62. }
  63. @Override
  64. public int delete(String id) {
  65. // 删除
  66. return this.bisInspAnzeRgstrDao.delete(id);
  67. }
  68. @Override
  69. public PageInfo<BisInspAnzeRgstrDto> findAnzePage(TypeParam param) {
  70. if (StringUtils.isNotBlank(param.getAdCode())) {
  71. param.setAdCode(String.valueOf(AdLevelUtil.SubAd(param.getAdCode()).get(SplitValue.SUBAD)));
  72. }
  73. if (StringUtils.isNotBlank(param.getAdCodes())) {
  74. param.setAdCodes(AdLevelUtil.getListAddvcd(param.getAdCodes()));
  75. }
  76. PageHelper.startPage(param);
  77. List<BisInspAnzeRgstrDto> list = bisInspAnzeRgstrDao.findPageList(param);
  78. return new PageInfo<>(list);
  79. }
  80. @Override
  81. public AttProjectInsurance getBaseById(String id) {
  82. return bisInspAnzeRgstrDao.getBaseById(id);
  83. }
  84. @Override
  85. public AttProjectInsuranceRecord getRecord(String id) {
  86. AttProjectInsurance attProjectInsurance = bisInspAnzeRgstrDao.getBaseById(id);
  87. Optional.ofNullable(attProjectInsurance).orElseThrow(() -> new ServiceException("未找到数据"));
  88. AttProjectInsuranceRecordParam param = new AttProjectInsuranceRecordParam();
  89. param.setRgstrId(attProjectInsurance.getId());
  90. List<AttProjectInsuranceRecord> list = attProjectInsuranceRecordDao.findList(param);
  91. if (!CollectionUtils.isEmpty(list)) {
  92. return list.get(0);
  93. }
  94. return null;
  95. }
  96. @Override
  97. public void insertObj(BisInspAllObj bisInspAllObj, String persId) {
  98. BisInspAnzeRgstr b = new BisInspAnzeRgstr();
  99. AttProjectInsurance base = attProjectInsuranceDao.get(bisInspAllObj.getCode());
  100. BeanUtils.copyProperties(base, b);
  101. b.setObjId(bisInspAllObj.getObjId());
  102. b.setId(UuidUtil.uuid());
  103. b.setNm(base.getName());
  104. b.setIntm(new Date());
  105. b.setUptm(new Date());
  106. b.setDataStat("0");
  107. b.setState("0");
  108. /* 添加 登记表 */
  109. bisInspAnzeRgstrDao.insert(b);
  110. }
  111. @Override
  112. public String getType() {
  113. return BisInspEnum.ANZE.getValue();
  114. }
  115. @Override
  116. public void cleanObjData(String objId) {
  117. BisInspAnzeRgstrParam rgstrParam = new BisInspAnzeRgstrParam();
  118. rgstrParam.setObjId(objId);
  119. List<BisInspAnzeRgstr> list = this.bisInspAnzeRgstrDao.findList(rgstrParam);
  120. if (list.size() > 0) {
  121. String id = list.get(0).getId();
  122. // 删除登记表
  123. this.bisInspAnzeRgstrDao.delete(id);
  124. }
  125. }
  126. @Override
  127. public PageInfo findObjPageByType(TypeParam typeParam, HttpServletResponse response) {
  128. if (StringUtils.isNotBlank(typeParam.getAdCode())) {
  129. typeParam.setAdCode(String.valueOf(AdLevelUtil.SubAd(typeParam.getAdCode()).get(SplitValue.SUBAD)));
  130. }
  131. PageHelper.startPage(typeParam);
  132. List<BisInspAnzeRgstrDto> list = this.bisInspAnzeRgstrDao.findPageList(typeParam);
  133. return new PageInfo<>(list);
  134. }
  135. @Override
  136. public Object findObjListByType(TypeParam typeParam) {
  137. List<BisInspRgstrDto> list = bisInspAnzeRgstrDao.findAnzeList(typeParam);
  138. return InspPblmUtils.changeList(list);
  139. }
  140. }