aedf56eb9eae52bad0d41ead17c8b362d91eedfb.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package cn.com.goldenwater.dcproj.service.impl.zhejiang;
  2. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  3. import cn.com.goldenwater.dcproj.constValue.SplitValue;
  4. import cn.com.goldenwater.dcproj.constValue.StateEnum;
  5. import cn.com.goldenwater.dcproj.dao.AttZhejiangJgBaseDao;
  6. import cn.com.goldenwater.dcproj.dao.BisInspAllObjDao;
  7. import cn.com.goldenwater.dcproj.dao.BisInspPblmDao;
  8. import cn.com.goldenwater.dcproj.dao.BisZhejiangJgRgstrDao;
  9. import cn.com.goldenwater.dcproj.dto.BisInspRgstrDto;
  10. import cn.com.goldenwater.dcproj.model.AttZhejiangJgBase;
  11. import cn.com.goldenwater.dcproj.model.BisInspAllObj;
  12. import cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr;
  13. import cn.com.goldenwater.dcproj.param.BisInspPblmParam;
  14. import cn.com.goldenwater.dcproj.param.BisZhejiangJgRgstrParam;
  15. import cn.com.goldenwater.dcproj.service.BisInspObjStrategy;
  16. import cn.com.goldenwater.dcproj.service.BisZhejiangJgRgstrService;
  17. import cn.com.goldenwater.core.service.AbstractCrudService;
  18. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  19. import cn.com.goldenwater.id.util.UuidUtil;
  20. import com.github.pagehelper.PageHelper;
  21. import com.github.pagehelper.PageInfo;
  22. import org.apache.commons.collections.CollectionUtils;
  23. import org.apache.commons.lang3.StringUtils;
  24. import org.springframework.beans.factory.annotation.Autowired;
  25. import org.springframework.stereotype.Service;
  26. import org.springframework.transaction.annotation.Transactional;
  27. import javax.servlet.http.HttpServletResponse;
  28. import java.util.Date;
  29. import java.util.List;
  30. import cn.com.goldenwater.dcproj.param.TypeParam;
  31. /**
  32. * @author lune
  33. * @date 2020-5-12
  34. */
  35. @Service
  36. @Transactional
  37. public class BisZhejiangJgRgstrServiceImpl extends AbstractCrudService<BisZhejiangJgRgstr, BisZhejiangJgRgstrParam> implements BisZhejiangJgRgstrService,BisInspObjStrategy {
  38. private static final Integer INT_TWO = 2;
  39. private static final Integer INT_THREE = 3;
  40. @Autowired
  41. private AttZhejiangJgBaseDao attZhejiangJgBaseDao;
  42. @Autowired
  43. private BisInspAllObjDao bisInspAllObjDao;
  44. @Autowired
  45. private BisInspPblmDao bisInspPblmDao;
  46. @Autowired
  47. private BisZhejiangJgRgstrDao bisZhejiangJgRgstrDao;
  48. public BisZhejiangJgRgstrServiceImpl(BisZhejiangJgRgstrDao bisZhejiangJgRgstrDao) {
  49. super(bisZhejiangJgRgstrDao);
  50. this.bisZhejiangJgRgstrDao = bisZhejiangJgRgstrDao;
  51. }
  52. /**
  53. * 获取浙江强监管分页列表
  54. * @param typeParam 传参对象
  55. * @return
  56. */
  57. @Override
  58. public PageInfo<BisInspRgstrDto> getZhejiangJgRegstrInfo(TypeParam typeParam) {
  59. PageHelper.startPage(typeParam);
  60. return new PageInfo<BisInspRgstrDto>(getResult(typeParam));
  61. }
  62. private List<BisInspRgstrDto> getResult(TypeParam typeParam){
  63. if (StringUtils.isNotBlank(typeParam.getAdCode())) {
  64. typeParam.setAdCode(String.valueOf(AdLevelUtil.SubAd(typeParam.getAdCode()).get(SplitValue.SUBAD)));
  65. }
  66. List<BisInspRgstrDto> bisInspRgstrList = bisZhejiangJgRgstrDao.getZhejiangJgRegstrInfo(typeParam);
  67. if(CollectionUtils.isNotEmpty(bisInspRgstrList)){
  68. bisInspRgstrList.stream().forEach(bisInspRgstrDto -> {
  69. if(bisInspRgstrDto.getLocation() != null && bisInspRgstrDto.getLocation().contains(SplitValue.HENG_SPLIT)){
  70. String[] split = bisInspRgstrDto.getLocation().split(SplitValue.HENG_SPLIT);
  71. if (split.length == INT_THREE) {
  72. bisInspRgstrDto.setProvince(split[0]);
  73. bisInspRgstrDto.setCity(split[1]);
  74. bisInspRgstrDto.setCountry(split[2]);
  75. }
  76. if (split.length == INT_TWO) {
  77. bisInspRgstrDto.setProvince(split[0]);
  78. bisInspRgstrDto.setCity(split[1]);
  79. bisInspRgstrDto.setCountry("");
  80. }else{
  81. bisInspRgstrDto.setProvince( bisInspRgstrDto.getLocation());
  82. }
  83. }
  84. });
  85. }
  86. return bisInspRgstrList;
  87. }
  88. @Override
  89. public void insertObj(BisInspAllObj bisInspAllObj, String persId) {
  90. AttZhejiangJgBase attAdXBase = attZhejiangJgBaseDao.get(bisInspAllObj.getCode());
  91. BisZhejiangJgRgstr bisZhejiangJgRgstr = new BisZhejiangJgRgstr();
  92. bisZhejiangJgRgstr.setId(UuidUtil.uuid());
  93. bisZhejiangJgRgstr.setAdCode(attAdXBase.getAdCode());
  94. bisZhejiangJgRgstr.setAdFullName(attAdXBase.getAdFullName());
  95. bisZhejiangJgRgstr.setLgtd(attAdXBase.getLgtd());
  96. bisZhejiangJgRgstr.setLttd(attAdXBase.getLttd());
  97. bisZhejiangJgRgstr.setLgtdpc(attAdXBase.getLgtdpc());
  98. bisZhejiangJgRgstr.setDepartId(bisInspAllObj.getCode());
  99. bisZhejiangJgRgstr.setLttdpc(attAdXBase.getLttdpc());
  100. bisZhejiangJgRgstr.setState("0");
  101. bisZhejiangJgRgstr.setIntm(new Date());
  102. bisZhejiangJgRgstr.setUptm(new Date());
  103. bisZhejiangJgRgstr.setPersId(persId);
  104. bisZhejiangJgRgstr.setObjId(bisInspAllObj.getObjId());
  105. bisZhejiangJgRgstr.setRegsNm(attAdXBase.getDepartNm());
  106. bisZhejiangJgRgstr.setJgState(StateEnum.NOWASTSTATE.getKey());
  107. bisZhejiangJgRgstr.setNote(attAdXBase.getNote());
  108. bisZhejiangJgRgstrDao.insert(bisZhejiangJgRgstr);
  109. }
  110. @Override
  111. public String getType() {
  112. return BisInspEnum.BIS_ZHEJIANG_JG_RGSTR.getValue();
  113. }
  114. @Override
  115. public void cleanObjData(String objId) {
  116. BisZhejiangJgRgstrParam param = new BisZhejiangJgRgstrParam();
  117. param.setObjId(objId);
  118. List<BisZhejiangJgRgstr> list = bisZhejiangJgRgstrDao.findList(param);
  119. if (list.size() > 0) {
  120. String id = list.get(0).getId();
  121. bisZhejiangJgRgstrDao.delete(id);
  122. BisInspPblmParam bisInspPblmParam = new BisInspPblmParam();
  123. bisInspPblmParam.setRegid(id);
  124. this.bisInspPblmDao.deleteBy(bisInspPblmParam);
  125. this.bisInspAllObjDao.delete(objId);
  126. }
  127. }
  128. @Override
  129. public PageInfo findObjPageByType(TypeParam typeParam, HttpServletResponse response) {
  130. return getZhejiangJgRegstrInfo(typeParam);
  131. }
  132. @Override
  133. public Object findObjListByType(TypeParam typeParam) {
  134. return getResult(typeParam);
  135. }
  136. }