c82fd2a514bf2c26d69fbe6e58cb63b0f7fc6c33.svn-base 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.constValue.StateEnum;
  6. import cn.com.goldenwater.dcproj.dao.*;
  7. import cn.com.goldenwater.dcproj.dto.BisInspRgstrDto;
  8. import cn.com.goldenwater.dcproj.model.AttWtuntBase;
  9. import cn.com.goldenwater.dcproj.model.BisInspAllObj;
  10. import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr;
  11. import cn.com.goldenwater.dcproj.param.*;
  12. import cn.com.goldenwater.dcproj.service.BisInspObjStrategy;
  13. import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrService;
  14. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  15. import cn.com.goldenwater.util.common.InspPblmUtils;
  16. import cn.com.goldenwater.id.util.UuidUtil;
  17. import com.github.pagehelper.PageHelper;
  18. import com.github.pagehelper.PageInfo;
  19. import org.apache.commons.collections.CollectionUtils;
  20. import org.apache.commons.lang3.StringUtils;
  21. import org.springframework.beans.BeanUtils;
  22. import org.springframework.beans.factory.annotation.Autowired;
  23. import org.springframework.beans.factory.annotation.Value;
  24. import org.springframework.stereotype.Service;
  25. import org.springframework.transaction.annotation.Transactional;
  26. import javax.servlet.http.HttpServletResponse;
  27. import java.util.Date;
  28. import java.util.List;
  29. /**
  30. * @author lune
  31. * @date 2020-8-17
  32. */
  33. @Service
  34. @Transactional(rollbackFor = Exception.class)
  35. public class BisInspWtuntRgstrServiceImpl extends AbstractCrudService<BisInspWtuntRgstr, BisInspWtuntRgstrParam> implements BisInspWtuntRgstrService, BisInspObjStrategy {
  36. @Autowired
  37. private BisInspWtuntRgstrDao bisInspWtuntRgstrDao;
  38. @Autowired
  39. private AttWtuntBaseDao attWtuntBaseDao;
  40. @Autowired
  41. private BisInspPblmDao bisInspPblmDao;
  42. @Autowired
  43. private BisInspAllObjDao bisInspAllObjDao;
  44. @Autowired
  45. private BisInspWtuntRgstrSteelDao bisInspWtuntRgstrSteelDao;
  46. @Autowired
  47. private BisInspWtuntRgstrSteelReoDao bisInspWtuntRgstrSteelReoDao;
  48. @Autowired
  49. private BisInspWtuntRgstrCollegeDao bisInspWtuntRgstrCollegeDao;
  50. @Autowired
  51. private BisInspWtuntRgstrHotelDao bisInspWtuntRgstrHotelDao;
  52. @Value("${export.templatePath}")
  53. private String templatePath;
  54. public BisInspWtuntRgstrServiceImpl(BisInspWtuntRgstrDao bisInspWtuntRgstrDao) {
  55. super(bisInspWtuntRgstrDao);
  56. this.bisInspWtuntRgstrDao = bisInspWtuntRgstrDao;
  57. }
  58. @Override
  59. public PageInfo<BisInspWtuntRgstr> findWtuntPage(TypeParam param) {
  60. if (StringUtils.isNotBlank(param.getAdCode())) {
  61. param.setAdCode(String.valueOf(AdLevelUtil.SubAd(param.getAdCode()).get(SplitValue.SUBAD)));
  62. }
  63. if (StringUtils.isNotBlank(param.getAdCodes())) {
  64. param.setAdCodes(AdLevelUtil.getListAddvcd(param.getAdCodes()));
  65. }
  66. PageHelper.startPage(param);
  67. List<BisInspRgstrDto> list = bisInspWtuntRgstrDao.findWtuntPage(param);
  68. list = InspPblmUtils.changeList(list);
  69. return new PageInfo(list);
  70. }
  71. @Override
  72. public PageInfo findObjPageByType(TypeParam typeParam, HttpServletResponse response) {
  73. return this.findWtuntPage(typeParam);
  74. }
  75. @Override
  76. public Object findObjListByType(TypeParam typeParam) {
  77. List<BisInspRgstrDto> list = bisInspWtuntRgstrDao.findWtuntPage(typeParam);
  78. return InspPblmUtils.changeList(list);
  79. }
  80. @Override
  81. public String getType() {
  82. return BisInspEnum.WTUNT.getValue();
  83. }
  84. @Override
  85. public void insertObj(BisInspAllObj bisInspAllObj, String persId) {
  86. AttWtuntBase attWtuntBase = attWtuntBaseDao.get(bisInspAllObj.getCode());
  87. BisInspWtuntRgstr rgstr = new BisInspWtuntRgstr();
  88. BeanUtils.copyProperties(attWtuntBase, rgstr);
  89. rgstr.setId(UuidUtil.uuid());
  90. rgstr.setWtuntId(attWtuntBase.getId());
  91. rgstr.setWtuntStat(StateEnum.NOWASTSTATE.getKey());
  92. rgstr.setObjId(bisInspAllObj.getObjId());
  93. rgstr.setIntm(new Date());
  94. rgstr.setUptm(new Date());
  95. rgstr.setPersId(persId);
  96. bisInspWtuntRgstrDao.insert(rgstr);
  97. }
  98. @Override
  99. public void cleanObjData(String objId) {
  100. BisInspWtuntRgstrParam wtuntRgstrParam = new BisInspWtuntRgstrParam();
  101. wtuntRgstrParam.setObjId(objId);
  102. List<BisInspWtuntRgstr> list = bisInspWtuntRgstrDao.findList(wtuntRgstrParam);
  103. if (CollectionUtils.isNotEmpty(list)) {
  104. String id = list.get(0).getId();
  105. //删除问题
  106. BisInspPblmParam bisInspPblmParam = new BisInspPblmParam();
  107. bisInspPblmParam.setObjId(objId);
  108. bisInspPblmParam.setObjType(BisInspEnum.WINTU.getValue());
  109. this.bisInspPblmDao.deleteBy(bisInspPblmParam);
  110. //删除对象名录表
  111. BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam();
  112. bisInspAllObjParam.setObjId(objId);
  113. this.bisInspAllObjDao.deleteBy(bisInspAllObjParam);
  114. //登记表
  115. bisInspWtuntRgstrDao.delete(id);
  116. //(高校)
  117. BisInspWtuntRgstrCollegeParam collegeParam = new BisInspWtuntRgstrCollegeParam();
  118. collegeParam.setRgstrId(id);
  119. bisInspWtuntRgstrCollegeDao.deleteBy(collegeParam);
  120. //(宾馆)
  121. BisInspWtuntRgstrHotelParam hotelParam = new BisInspWtuntRgstrHotelParam();
  122. hotelParam.setRgstrId(id);
  123. bisInspWtuntRgstrHotelDao.deleteBy(hotelParam);
  124. //(钢铁)
  125. BisInspWtuntRgstrSteelParam steelParam = new BisInspWtuntRgstrSteelParam();
  126. steelParam.setRgstrId(id);
  127. bisInspWtuntRgstrSteelDao.deleteBy(steelParam);
  128. //主要产品产量
  129. BisInspWtuntRgstrSteelReoParam reoParam = new BisInspWtuntRgstrSteelReoParam();
  130. reoParam.setRgstrId(id);
  131. bisInspWtuntRgstrSteelReoDao.deleteBy(reoParam);
  132. }
  133. }
  134. }