3def342641da56f8ffc267be5b3115ba35e22843.svn-base 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.CommonLabel;
  5. import cn.com.goldenwater.dcproj.constValue.SplitValue;
  6. import cn.com.goldenwater.dcproj.dao.*;
  7. import cn.com.goldenwater.dcproj.dto.BisInspWrwsRgstrDto;
  8. import cn.com.goldenwater.dcproj.model.*;
  9. import cn.com.goldenwater.dcproj.param.*;
  10. import cn.com.goldenwater.dcproj.service.*;
  11. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  12. import cn.com.goldenwater.id.util.UuidUtil;
  13. import com.github.pagehelper.PageHelper;
  14. import com.github.pagehelper.PageInfo;
  15. import org.apache.commons.lang3.StringUtils;
  16. import org.springframework.beans.BeanUtils;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.stereotype.Service;
  19. import org.springframework.transaction.annotation.Transactional;
  20. import javax.servlet.http.HttpServletResponse;
  21. import java.util.Date;
  22. import java.util.List;
  23. /**
  24. * @author lhc
  25. * @date 2020-9-23
  26. */
  27. @Service
  28. @Transactional
  29. public class BisInspWrwsRgstrServiceImpl extends AbstractCrudService<BisInspWrwsRgstr, BisInspWrwsRgstrParam> implements BisInspWrwsRgstrService, BisInspObjStrategy {
  30. @Autowired
  31. private BisInspWrwsRgstrDao bisInspWrwsRgstrDao;
  32. @Autowired
  33. private AttAdBaseDao attAdBaseDao;
  34. @Autowired
  35. private BisInspWrwsRgstrSvwtcService bisInspWrwsRgstrSvwtcService;
  36. @Autowired
  37. private BisInspWrwsRgstrWgService bisInspWrwsRgstrWgService;
  38. @Autowired
  39. private BisInspWrwsRgstrWtupService bisInspWrwsRgstrWtupService;
  40. @Autowired
  41. private BisInspWrwsRgstrWtutService bisInspWrwsRgstrWtutService;
  42. @Autowired
  43. private BisInspPblmDao bisInspPblmDao;
  44. @Autowired
  45. private BisInspAllObjDao bisInspAllObjDao;
  46. public BisInspWrwsRgstrServiceImpl(BisInspWrwsRgstrDao bisInspWrwsRgstrDao) {
  47. super(bisInspWrwsRgstrDao);
  48. this.bisInspWrwsRgstrDao = bisInspWrwsRgstrDao;
  49. }
  50. @Override
  51. public int insert(BisInspWrwsRgstr bisInspWrwsRgstr) {
  52. String uuid = UuidUtil.uuid(); // 生成uuid
  53. bisInspWrwsRgstr.setId(uuid);
  54. bisInspWrwsRgstr.setIntm(new Date());
  55. bisInspWrwsRgstr.setUptm(new Date());
  56. bisInspWrwsRgstr.setDataStat("0");
  57. return this.bisInspWrwsRgstrDao.insert(bisInspWrwsRgstr);
  58. }
  59. @Override
  60. public int update(BisInspWrwsRgstr bisInspWrwsRgstr) {
  61. bisInspWrwsRgstr.setUptm(new Date());
  62. return this.bisInspWrwsRgstrDao.update(bisInspWrwsRgstr);
  63. }
  64. @Override
  65. public int delete(String id) {
  66. return this.bisInspWrwsRgstrDao.delete(id);
  67. }
  68. @Override
  69. public void insertObj(BisInspAllObj bisInspAllObj, String persId) {
  70. BisInspWrwsRgstr b = new BisInspWrwsRgstr();
  71. AttAdBase base = attAdBaseDao.get(bisInspAllObj.getCode());
  72. BeanUtils.copyProperties(base, b);
  73. // 统一字段 rgstrId, objId
  74. b.setId(UuidUtil.uuid());
  75. b.setObjId(bisInspAllObj.getObjId());
  76. // 日期
  77. Date d = new Date();
  78. b.setIntm(d);
  79. b.setUptm(d);
  80. // 数据状态 默认为 0
  81. b.setDataStat(CommonLabel.INIT_DATA);
  82. // 督查状态(0:未督查;1:督查中;2:已督查)
  83. b.setState(CommonLabel.INIT_DATA);
  84. // 子表状态(0:未督查;1:督查中;2:已督查)
  85. b.setSvwtcState(CommonLabel.INIT_DATA);
  86. b.setWgState(CommonLabel.INIT_DATA);
  87. b.setWtupState(CommonLabel.INIT_DATA);
  88. b.setWtutState(CommonLabel.INIT_DATA);
  89. // 创建人
  90. b.setPersId(persId);
  91. /* 添加 登记表 */
  92. this.bisInspWrwsRgstrDao.insert(b);
  93. /* 添加 子表 */
  94. BisInspWrwsRgstrSvwtc bisInspWrwsRgstrSvwtc = new BisInspWrwsRgstrSvwtc();
  95. bisInspWrwsRgstrSvwtc.setRgstrId(b.getId());
  96. bisInspWrwsRgstrSvwtcService.insert(bisInspWrwsRgstrSvwtc);
  97. BisInspWrwsRgstrWg bisInspWrwsRgstrWg = new BisInspWrwsRgstrWg();
  98. bisInspWrwsRgstrWg.setRgstrId(b.getId());
  99. bisInspWrwsRgstrWgService.insert(bisInspWrwsRgstrWg);
  100. BisInspWrwsRgstrWtup bisInspWrwsRgstrWtup = new BisInspWrwsRgstrWtup();
  101. bisInspWrwsRgstrWtup.setRgstrId(b.getId());
  102. bisInspWrwsRgstrWtupService.insert(bisInspWrwsRgstrWtup);
  103. BisInspWrwsRgstrWtut bisInspWrwsRgstrWtut = new BisInspWrwsRgstrWtut();
  104. bisInspWrwsRgstrWtut.setRgstrId(b.getId());
  105. bisInspWrwsRgstrWtutService.insert(bisInspWrwsRgstrWtut);
  106. }
  107. @Override
  108. public String getType() {
  109. return BisInspEnum.WRWS.getValue();
  110. }
  111. @Override
  112. public void cleanObjData(String objId) {
  113. BisInspWrwsRgstrParam rgstrParam = new BisInspWrwsRgstrParam();
  114. rgstrParam.setObjId(objId);
  115. List<BisInspWrwsRgstr> list = this.bisInspWrwsRgstrDao.findList(rgstrParam);
  116. if (list.size() > 0) {
  117. String id = list.get(0).getId();
  118. // 删除子表
  119. BisInspWrwsRgstrSvwtcParam svwtcParam = new BisInspWrwsRgstrSvwtcParam();
  120. svwtcParam.setRgstrId(id);
  121. bisInspWrwsRgstrSvwtcService.deleteBy(svwtcParam);
  122. BisInspWrwsRgstrWtutParam wtutParam = new BisInspWrwsRgstrWtutParam();
  123. wtutParam.setRgstrId(id);
  124. bisInspWrwsRgstrWtutService.deleteBy(wtutParam);
  125. BisInspWrwsRgstrWgParam wgParam = new BisInspWrwsRgstrWgParam();
  126. wgParam.setRgstrId(id);
  127. bisInspWrwsRgstrWgService.deleteBy(wgParam);
  128. BisInspWrwsRgstrWtupParam wtupParam = new BisInspWrwsRgstrWtupParam();
  129. wtupParam.setRgstrId(id);
  130. bisInspWrwsRgstrWtupService.deleteBy(wtupParam);
  131. // 删除登记表
  132. this.bisInspWrwsRgstrDao.delete(id);
  133. }
  134. // 删除问题
  135. BisInspPblmParam bisInspPblmParam = new BisInspPblmParam();
  136. bisInspPblmParam.setObjId(objId);
  137. bisInspPblmParam.setObjType(BisInspEnum.WRWS.getValue());
  138. bisInspPblmDao.deleteBy(bisInspPblmParam);
  139. // 删除对象名录表
  140. BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam();
  141. bisInspAllObjParam.setObjId(objId);
  142. bisInspAllObjDao.deleteBy(bisInspAllObjParam);
  143. }
  144. @Override
  145. public PageInfo findObjPageByType(TypeParam typeParam, HttpServletResponse response) {
  146. if (StringUtils.isNotBlank(typeParam.getAdCode())) {
  147. typeParam.setAdCode(String.valueOf(AdLevelUtil.SubAd(typeParam.getAdCode()).get(SplitValue.SUBAD)));
  148. }
  149. PageHelper.startPage(typeParam);
  150. List<BisInspWrwsRgstrDto> list = this.bisInspWrwsRgstrDao.findPageList(typeParam);
  151. return (PageInfo<BisInspWrwsRgstrDto>) new PageInfo(list);
  152. }
  153. @Override
  154. public Object findObjListByType(TypeParam typeParam) {
  155. return this.bisInspWrwsRgstrDao.findPageList(typeParam);
  156. }
  157. }