6dc0d17db9ad394d6d34aa0636acb89732ffe059.svn-base 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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.BisInspAllObjParam;
  6. import cn.com.goldenwater.dcproj.param.BisInspWintRgstrParam;
  7. import cn.com.goldenwater.dcproj.service.GwComFileService;
  8. import cn.com.goldenwater.dcproj.service.SupervisionPlanService;
  9. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  10. import cn.com.goldenwater.id.util.UuidUtil;
  11. import com.fasterxml.jackson.databind.DeserializationFeature;
  12. import com.fasterxml.jackson.databind.ObjectMapper;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.beans.factory.annotation.Value;
  15. import org.springframework.stereotype.Service;
  16. import org.springframework.transaction.annotation.Transactional;
  17. import java.io.IOException;
  18. import java.text.SimpleDateFormat;
  19. import java.util.Date;
  20. import java.util.List;
  21. /**
  22. * 分水及管控离线填报
  23. *
  24. * @author zhangcheng
  25. * @date 2019/11/25 17:33
  26. */
  27. @Service
  28. @Transactional
  29. public class BisInspOffLineWintProcess extends BisInspOffLineProcess {
  30. @Autowired
  31. BisInspAllObjDao bisInspAllObjDao;
  32. @Autowired
  33. BisInspPblmDao bisInspPblmDao;//督查问题
  34. @Autowired
  35. BisInspWintRgstrIntInfoDao bisInspWintRgstrIntInfoDao;
  36. @Autowired
  37. BisInspWintRgstrDao bisInspWintRgstrDao;
  38. @Autowired
  39. AttAdBaseDao attAdBaseDao;
  40. @Autowired
  41. SupervisionPlanService supervisionPlanService;
  42. @Autowired
  43. private GwComFileService gwComFileService;//文件操作
  44. @Value("${getFile.prefix}")
  45. public String prefix;
  46. @Override
  47. public BisInspOffLineRet process(BisInspOffLineObj bisInspOffLineObj, String fileDir) throws IOException {
  48. BisInspOffLineRet bisInspOffLineRet = new BisInspOffLineRet();
  49. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  50. ObjectMapper om = new ObjectMapper();
  51. om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  52. //解析分水及管控填报信息
  53. BisInspOffLineWintRgeister bisInspOffLineWintRgeister = om.readValue(bisInspOffLineObj.getRegister(), BisInspOffLineWintRgeister.class);
  54. //解析分水及管控基本信息对象
  55. if (bisInspOffLineObj.getBase() != null) {
  56. /* if (null == bisInspOffLineObj.getReplace() || bisInspOffLineObj.getReplace()) {
  57. delRgstrData(bisInspOffLineObj);
  58. }*/
  59. //添加到督查任务
  60. String objId = UuidUtil.uuid();
  61. String groupId = bisInspOffLineObj.getGroupId();
  62. BisInspWintRgstr bisInspWintRgstr = new BisInspWintRgstr();
  63. String regId = objId;
  64. String persId = bisInspOffLineObj.getPersId();
  65. BisInspWintRgstr bisInspWiuRgstrBase = om.readValue(bisInspOffLineObj.getBase(), BisInspWintRgstr.class);
  66. insertBisInspAllObj(bisInspOffLineObj, groupId, objId, bisInspWiuRgstrBase);
  67. insertWintRgstr(bisInspWiuRgstrBase, groupId, objId, persId, regId, bisInspWintRgstr);
  68. //年度水量分配及取用水管控情况抽查表
  69. insertWintIntInfo(bisInspOffLineWintRgeister, regId, persId, bisInspWintRgstr);
  70. //更新督查 字表状态
  71. bisInspWintRgstrDao.update(bisInspWintRgstr);
  72. bisInspOffLineRet.setRegId(regId);
  73. bisInspOffLineRet.setObjId(objId);
  74. }
  75. return bisInspOffLineRet;
  76. }
  77. /**
  78. * 删除任务及登记表信息
  79. *
  80. * @param groupId
  81. * @param nm
  82. */
  83. public void delRgstrData(BisInspOffLineObj bisInspOffLineObj) {
  84. //登记表查找重复数据,然后删除
  85. BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam();
  86. bisInspAllObjParam.setId(bisInspOffLineObj.getGroupId());
  87. bisInspAllObjParam.setNm(bisInspOffLineObj.getNm());
  88. List<BisInspAllObj> bisInspAllObjs = bisInspAllObjDao.findList(bisInspAllObjParam);
  89. for (BisInspAllObj bisInspAllObj : bisInspAllObjs) {
  90. //删除登记表
  91. //删除登记表关联的各个填报表数据
  92. supervisionPlanService.cleanObjDataByObjId(BisInspEnum.WIU.getValue(), bisInspAllObj.getObjId());
  93. }
  94. }
  95. /**
  96. * 添加到督查任务
  97. *
  98. * @param groupId
  99. * @param objId
  100. * @param bisInspWintRgstr
  101. */
  102. public void insertBisInspAllObj(BisInspOffLineObj bisInspOffLineObj, String groupId, String objId, BisInspWintRgstr bisInspWintRgstr) {
  103. BisInspAllObj bisInspAllObj = new BisInspAllObj();
  104. bisInspAllObj.setId(groupId);
  105. bisInspAllObj.setObjId(objId);
  106. bisInspAllObj.setNm(bisInspWintRgstr.getAdName());
  107. bisInspAllObj.setCode(bisInspWintRgstr.getAdCode());//非空字段
  108. bisInspAllObj.setPtype("14");
  109. bisInspAllObj.setOrgId(bisInspOffLineObj.getOrgId());
  110. bisInspAllObj.setAdCode(bisInspOffLineObj.getProvince());
  111. bisInspAllObj.setLgtd(bisInspWintRgstr.getPcX());
  112. bisInspAllObj.setLttd(bisInspWintRgstr.getPcY());
  113. bisInspAllObj.setLgtdpc(bisInspWintRgstr.getGdX());
  114. bisInspAllObj.setLttdpc(bisInspWintRgstr.getGdY());
  115. bisInspAllObjDao.insert(bisInspAllObj);
  116. }
  117. /**
  118. * 插入登记表信息
  119. *
  120. * @param bisInspOffLineObj
  121. * @param objId
  122. * @param om
  123. * @param regId
  124. * @param bisInspWintRgstr
  125. * @throws IOException
  126. */
  127. public void insertWintRgstr(BisInspWintRgstr bisInspWintRgstrBase, String groupId, String objId, String persId, String regId, BisInspWintRgstr bisInspWintRgstr) throws IOException {
  128. bisInspWintRgstr.setId(regId);
  129. bisInspWintRgstr.setObjId(objId);
  130. bisInspWintRgstr.setAdName(bisInspWintRgstrBase.getAdName());
  131. bisInspWintRgstr.setAdCode(bisInspWintRgstrBase.getAdCode());
  132. bisInspWintRgstr.setLoc(bisInspWintRgstrBase.getLoc());
  133. bisInspWintRgstr.setBChkUnit(bisInspWintRgstrBase.getBChkUnit());
  134. bisInspWintRgstr.setContact(bisInspWintRgstrBase.getContact());
  135. bisInspWintRgstr.setContactTel(bisInspWintRgstrBase.getContactTel());
  136. bisInspWintRgstr.setPrincipal(bisInspWintRgstrBase.getPrincipal());
  137. bisInspWintRgstr.setPrincipalTel(bisInspWintRgstrBase.getPrincipalTel());
  138. bisInspWintRgstr.setNote(bisInspWintRgstrBase.getNote());
  139. bisInspWintRgstr.setChkUnit(bisInspWintRgstrBase.getChkUnit());
  140. bisInspWintRgstr.setChkPers(bisInspWintRgstrBase.getChkPers());
  141. bisInspWintRgstr.setChkTm(bisInspWintRgstrBase.getChkTm());
  142. bisInspWintRgstr.setState("1");
  143. bisInspWintRgstr.setDataStat("0");
  144. bisInspWintRgstr.setPersId(persId);
  145. bisInspWintRgstr.setGroupId(groupId);
  146. bisInspWintRgstr.setGdX(bisInspWintRgstrBase.getGdX());
  147. bisInspWintRgstr.setGdY(bisInspWintRgstrBase.getGdY());
  148. bisInspWintRgstr.setPcX(bisInspWintRgstrBase.getPcX());
  149. bisInspWintRgstr.setPcY(bisInspWintRgstrBase.getPcY());
  150. bisInspWintRgstr.setInTm(new Date());
  151. bisInspWintRgstr.setUpTm(new Date());
  152. bisInspWintRgstrDao.insert(bisInspWintRgstr);
  153. }
  154. /**
  155. * 插入水量分配及取用水管控情况
  156. *
  157. * @param bisInspOffLineWintRgeister
  158. * @param regId
  159. * @param bisInspOffLineObj
  160. * @param bisInspWintRgstr
  161. */
  162. public void insertWintIntInfo(BisInspOffLineWintRgeister bisInspOffLineWintRgeister, String regId, String persId, BisInspWintRgstr bisInspWintRgstr) {
  163. //水量分配及取用水管控情况
  164. BisInspWintRgstrIntInfo bisInspWintRgstrIntInfo = new BisInspWintRgstrIntInfo();
  165. if (bisInspOffLineWintRgeister.getBisInspWintRgstrIntInfo() != null) {
  166. bisInspWintRgstrIntInfo = bisInspOffLineWintRgeister.getBisInspWintRgstrIntInfo();
  167. bisInspWintRgstrIntInfo.setId(UuidUtil.uuid());
  168. bisInspWintRgstrIntInfo.setRgstrId(regId);
  169. bisInspWintRgstrIntInfo.setInTm(new Date());
  170. bisInspWintRgstrIntInfo.setUpTm(new Date());
  171. bisInspWintRgstrIntInfo.setDataStat("0");
  172. bisInspWintRgstrIntInfo.setPersId(persId);
  173. bisInspWintRgstrIntInfoDao.insert(bisInspWintRgstrIntInfo);
  174. bisInspWintRgstr.setIntInfoStat("2");
  175. } else {
  176. bisInspWintRgstrIntInfo.setId(UuidUtil.uuid());
  177. bisInspWintRgstrIntInfo.setRgstrId(regId);
  178. bisInspWintRgstrIntInfo.setInTm(new Date());
  179. bisInspWintRgstrIntInfo.setUpTm(new Date());
  180. bisInspWintRgstrIntInfo.setDataStat("0");
  181. bisInspWintRgstrIntInfo.setPersId(persId);
  182. bisInspWintRgstrIntInfoDao.insert(bisInspWintRgstrIntInfo);
  183. bisInspWintRgstr.setIntInfoStat("1");
  184. }
  185. }
  186. @Override
  187. public BisInspOffLineRetBase getBaseInfo(BisInspOffLine bisInspOffLine) {
  188. BisInspOffLineRetBase bisInspOffLineRetBase = new BisInspOffLineRetBase();
  189. BisInspWintRgstrParam bisInspWintRgstrParam = new BisInspWintRgstrParam();
  190. bisInspWintRgstrParam.setAdName(bisInspOffLine.getName());
  191. bisInspWintRgstrParam.setAdCode(AdLevelUtil.getAddvcd(bisInspOffLine.getAddvcd()));
  192. bisInspOffLineRetBase.setBase(bisInspWintRgstrDao.findList(bisInspWintRgstrParam));
  193. return bisInspOffLineRetBase;
  194. }
  195. }