9f2ea2581bfb0398f79a0155fdbc11fca59dd54f.svn-base 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. package cn.com.goldenwater.dcproj.service.impl.offline;
  2. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  3. import cn.com.goldenwater.dcproj.dao.*;
  4. import cn.com.goldenwater.dcproj.model.*;
  5. import cn.com.goldenwater.dcproj.param.AttWiuBaseParam;
  6. import cn.com.goldenwater.dcproj.param.BisInspAllObjParam;
  7. import cn.com.goldenwater.dcproj.service.GwComFileService;
  8. import cn.com.goldenwater.dcproj.service.SupervisionPlanService;
  9. import cn.com.goldenwater.id.util.UuidUtil;
  10. import com.fasterxml.jackson.databind.DeserializationFeature;
  11. import com.fasterxml.jackson.databind.ObjectMapper;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.beans.factory.annotation.Value;
  14. import org.springframework.stereotype.Service;
  15. import org.springframework.transaction.annotation.Transactional;
  16. import java.io.IOException;
  17. import java.text.SimpleDateFormat;
  18. import java.util.Date;
  19. import java.util.List;
  20. /**
  21. * 取水口离线填报
  22. *
  23. * @author zhangcheng
  24. * @date 2019/11/27 15:09
  25. */
  26. @Service
  27. @Transactional
  28. public class BisInspOffLineWiuProcess extends BisInspOffLineProcess {
  29. @Autowired
  30. BisInspAllObjDao bisInspAllObjDao;
  31. @Autowired
  32. BisInspPblmDao bisInspPblmDao;//督查问题
  33. @Autowired
  34. BisInspWiuRgstrDao bisInspWiuRgstrDao;
  35. @Autowired
  36. BisInspWiuRgstrIntInfoDao bisInspWiuRgstrIntInfoDao;
  37. @Autowired
  38. AttWiuBaseDao attWiuBaseDao;
  39. @Autowired
  40. private GwComFileService gwComFileService;//文件操作
  41. @Value("${getFile.prefix}")
  42. public String prefix;
  43. @Autowired
  44. SupervisionPlanService supervisionPlanService;
  45. @Override
  46. public BisInspOffLineRet process(BisInspOffLineObj bisInspOffLineObj, String fileDir) throws IOException {
  47. BisInspOffLineRet bisInspOffLineRet = new BisInspOffLineRet();
  48. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  49. ObjectMapper om = new ObjectMapper();
  50. om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  51. //解析水源地填报信息
  52. BisInspOffLineWiuRgeister bisInspOffLineWiuRgeister = om.readValue(bisInspOffLineObj.getRegister(), BisInspOffLineWiuRgeister.class);
  53. //解析水源地对象
  54. if (bisInspOffLineObj.getBase() != null) {
  55. /* if (null == bisInspOffLineObj.getReplace() || bisInspOffLineObj.getReplace()) {
  56. delRgstrData(bisInspOffLineObj);
  57. }*/
  58. //添加到督查任务
  59. String objId = UuidUtil.uuid();
  60. String groupId = bisInspOffLineObj.getGroupId();
  61. BisInspWiuRgstr bisInspWiuRgstr = new BisInspWiuRgstr();
  62. String regId = UuidUtil.uuid();
  63. String persId = bisInspOffLineObj.getPersId();
  64. AttWiuBase attWiuBase = om.readValue(bisInspOffLineObj.getBase(), AttWiuBase.class);
  65. insertBisInspAllObj(bisInspOffLineObj, groupId, objId, attWiuBase);
  66. insertWiuRgstr(attWiuBase, groupId, objId, persId, regId, bisInspWiuRgstr);
  67. //取水口取水及监管情况
  68. insertWiuIntInfo(bisInspOffLineWiuRgeister, regId, persId, bisInspWiuRgstr);
  69. //更新督查 字表状态
  70. bisInspWiuRgstrDao.update(bisInspWiuRgstr);
  71. bisInspOffLineRet.setObjId(objId);
  72. bisInspOffLineRet.setRegId(regId);
  73. }
  74. return bisInspOffLineRet;
  75. }
  76. /**
  77. * 删除任务及登记表信息
  78. *
  79. * @param groupId
  80. * @param nm
  81. */
  82. public void delRgstrData(BisInspOffLineObj bisInspOffLineObj) {
  83. //登记表查找重复数据,然后删除
  84. BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam();
  85. bisInspAllObjParam.setId(bisInspOffLineObj.getGroupId());
  86. bisInspAllObjParam.setNm(bisInspOffLineObj.getNm());
  87. List<BisInspAllObj> bisInspAllObjs = bisInspAllObjDao.findList(bisInspAllObjParam);
  88. for (BisInspAllObj bisInspAllObj : bisInspAllObjs) {
  89. //删除登记表
  90. //删除登记表关联的各个填报表数据
  91. supervisionPlanService.cleanObjDataByObjId(BisInspEnum.WIU.getValue(), bisInspAllObj.getObjId());
  92. }
  93. }
  94. /**
  95. * 添加到督查任务
  96. *
  97. * @param groupId
  98. * @param objId
  99. * @param attSwhsBase
  100. */
  101. public void insertBisInspAllObj(BisInspOffLineObj bisInspOffLineObj, String groupId, String objId, AttWiuBase attWiuBase) {
  102. BisInspAllObj bisInspAllObj = new BisInspAllObj();
  103. bisInspAllObj.setId(groupId);
  104. bisInspAllObj.setObjId(objId);
  105. bisInspAllObj.setNm(attWiuBase.getWiuName());
  106. bisInspAllObj.setCode(attWiuBase.getWiuCode());//非空字段
  107. bisInspAllObj.setLgtd(attWiuBase.getWiuLong());
  108. bisInspAllObj.setLttd(attWiuBase.getWiuLat());
  109. bisInspAllObj.setOrgId(bisInspOffLineObj.getOrgId());
  110. bisInspAllObj.setAdCode(bisInspOffLineObj.getProvince());
  111. bisInspAllObj.setLgtdpc(attWiuBase.getGdX());
  112. bisInspAllObj.setLttdpc(attWiuBase.getGdY());
  113. bisInspAllObj.setPtype("12");
  114. bisInspAllObjDao.insert(bisInspAllObj);
  115. }
  116. /**
  117. * 插入登记表信息
  118. *
  119. * @param bisInspOffLineObj
  120. * @param objId
  121. * @param om
  122. * @param regId
  123. * @param bisInspWiuRgstr
  124. * @throws IOException
  125. */
  126. public void insertWiuRgstr(AttWiuBase attWiuBase, String groupId, String objId, String persId, String regId, BisInspWiuRgstr bisInspWiuRgstr) throws IOException {
  127. bisInspWiuRgstr.setId(regId);
  128. bisInspWiuRgstr.setObjId(objId);
  129. bisInspWiuRgstr.setWiuId(attWiuBase.getWiuCode());
  130. bisInspWiuRgstr.setWiuName(attWiuBase.getWiuName());
  131. bisInspWiuRgstr.setAdName(attWiuBase.getAdName());
  132. bisInspWiuRgstr.setAdCode(attWiuBase.getAdCode());
  133. bisInspWiuRgstr.setWiuLoc(attWiuBase.getWintPos());
  134. bisInspWiuRgstr.setWiuLong(attWiuBase.getWiuLong());
  135. bisInspWiuRgstr.setWiuLat(attWiuBase.getWiuLat());
  136. bisInspWiuRgstr.setGdX(attWiuBase.getGdX());
  137. bisInspWiuRgstr.setGdY(attWiuBase.getGdY());
  138. bisInspWiuRgstr.setWiuContact(attWiuBase.getWiuContact());
  139. bisInspWiuRgstr.setWiuContactTel(attWiuBase.getWiuContactTel());
  140. bisInspWiuRgstr.setState("1");
  141. bisInspWiuRgstr.setDataStat("0");
  142. bisInspWiuRgstr.setPersId(persId);
  143. bisInspWiuRgstr.setGroupId(groupId);
  144. bisInspWiuRgstr.setInTm(new Date());
  145. bisInspWiuRgstr.setUpTm(new Date());
  146. bisInspWiuRgstrDao.insert(bisInspWiuRgstr);
  147. }
  148. /**
  149. * 取水口取水及监管情况检查表
  150. *
  151. * @param bisInspOffLineWiuRgeister
  152. * @param regId
  153. * @param bisInspOffLineObj
  154. * @param bisInspWiuRgstr
  155. */
  156. public void insertWiuIntInfo(BisInspOffLineWiuRgeister bisInspOffLineWiuRgeister, String regId, String persId, BisInspWiuRgstr bisInspWiuRgstr) {
  157. //节水评价情况检查表
  158. BisInspWiuRgstrIntInfo bisInspWiuRgstrIntInfo = new BisInspWiuRgstrIntInfo();
  159. if (bisInspOffLineWiuRgeister.getBisInspWiuRgstrIntInfo() != null) {
  160. bisInspWiuRgstrIntInfo = bisInspOffLineWiuRgeister.getBisInspWiuRgstrIntInfo();
  161. bisInspWiuRgstrIntInfo.setId(UuidUtil.uuid());
  162. bisInspWiuRgstrIntInfo.setRgstrId(regId);
  163. bisInspWiuRgstrIntInfo.setInTm(new Date());
  164. bisInspWiuRgstrIntInfo.setUpTm(new Date());
  165. bisInspWiuRgstrIntInfo.setDataStat("0");
  166. bisInspWiuRgstrIntInfo.setRecPersId(persId);
  167. bisInspWiuRgstrIntInfoDao.insert(bisInspWiuRgstrIntInfo);
  168. bisInspWiuRgstr.setIntInfoStat("2");
  169. } else {
  170. bisInspWiuRgstrIntInfo.setId(UuidUtil.uuid());
  171. bisInspWiuRgstrIntInfo.setRgstrId(regId);
  172. bisInspWiuRgstrIntInfo.setInTm(new Date());
  173. bisInspWiuRgstrIntInfo.setUpTm(new Date());
  174. bisInspWiuRgstrIntInfo.setDataStat("0");
  175. bisInspWiuRgstrIntInfo.setRecPersId(persId);
  176. bisInspWiuRgstrIntInfoDao.insert(bisInspWiuRgstrIntInfo);
  177. bisInspWiuRgstr.setIntInfoStat("1");
  178. }
  179. }
  180. @Override
  181. public BisInspOffLineRetBase getBaseInfo(BisInspOffLine bisInspOffLine) {
  182. BisInspOffLineRetBase bisInspOffLineRetBase = new BisInspOffLineRetBase();
  183. AttWiuBaseParam attWiuBaseParam = new AttWiuBaseParam();
  184. attWiuBaseParam.setWiuName(bisInspOffLine.getName());
  185. attWiuBaseParam.setId(bisInspOffLine.getCode());
  186. bisInspOffLineRetBase.setBase(attWiuBaseDao.findList(attWiuBaseParam));
  187. return bisInspOffLineRetBase;
  188. }
  189. }