dcf4487d2a78f76ebf85ab2e06d6544af0d1c496.svn-base 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. package cn.com.goldenwater.dcproj.service.impl.offline;
  2. import cn.com.goldenwater.dcproj.dao.*;
  3. import cn.com.goldenwater.dcproj.model.*;
  4. import cn.com.goldenwater.dcproj.param.*;
  5. import cn.com.goldenwater.dcproj.service.GwComFileService;
  6. import cn.com.goldenwater.dcproj.service.SupervisionPlanService;
  7. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  8. import cn.com.goldenwater.id.util.UuidUtil;
  9. import com.fasterxml.jackson.databind.DeserializationFeature;
  10. import com.fasterxml.jackson.databind.ObjectMapper;
  11. import org.apache.commons.lang3.StringUtils;
  12. import org.slf4j.Logger;
  13. import org.slf4j.LoggerFactory;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.beans.factory.annotation.Value;
  16. import org.springframework.stereotype.Service;
  17. import org.springframework.transaction.annotation.Transactional;
  18. import java.io.IOException;
  19. import java.util.Date;
  20. import java.util.List;
  21. /**
  22. * 小水库处理业务逻辑
  23. *
  24. * @author lhc
  25. * @date 2019/11/18 17:00
  26. */
  27. @Service
  28. @Transactional
  29. public class BisInspOffLineRsvrProcess extends BisInspOffLineProcess {
  30. private Logger logger = LoggerFactory.getLogger(getClass());
  31. @Autowired
  32. AttRsBaseDao attRsBaseDao;//水库基本信息
  33. @Autowired
  34. BisInspRsvrRgstrDao bisInspRsvrRgstrDao;//水库登记信息
  35. @Autowired
  36. BisInspBasePresExtDao bisInspBasePresExtDao;//“三个责任人”落实情况
  37. @Autowired
  38. BisInspPresSafeDao bisInspPresSafeDao;//“三个责任人”落实情况
  39. @Autowired
  40. BisInspBaseExtDao bisInspBaseExtDao;//“三项基本要求”落实情况
  41. @Autowired
  42. BisInspSafeExtManageDao bisInspSafeExtManageDao;//安全运行管理情况
  43. @Autowired
  44. BisInspRsvrProjectDao bisInspRsvrProjectDao;//水库工程实体情况
  45. @Autowired
  46. BisInspRsvrBenefitsDao bisInspRsvrBenefitsDao;//水库效益发挥情况
  47. @Autowired
  48. BisInspBaseViewDao bisInspBaseViewDao;//走访情况
  49. @Autowired
  50. BisInspPreListDao bisInspPreListDao;//走访人员
  51. @Autowired
  52. BisInspAllObjDao bisInspAllObjDao;//督查任务
  53. @Autowired
  54. BisInspPblmDao bisInspPblmDao;//督查问题
  55. @Autowired
  56. SupervisionPlanService supervisionPlanService;
  57. @Autowired
  58. private GwComFileService gwComFileService;//文件操作
  59. @Value("${getFile.prefix}")
  60. public String prefix;
  61. @Override
  62. public BisInspOffLineRet process(BisInspOffLineObj bisInspOffLineObj, String fileDir) throws IOException {
  63. BisInspOffLineRet bisInspOffLineRet = new BisInspOffLineRet();
  64. ObjectMapper om = new ObjectMapper();
  65. om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  66. //解析小水库填报信息
  67. BisInspOffLineRsvrRgeister bisInspOffLineRsvrRgeister = om.readValue(bisInspOffLineObj.getRegister(), BisInspOffLineRsvrRgeister.class);
  68. //解析小水库基本信息对象
  69. if (bisInspOffLineObj.getBase() != null) {
  70. BisInspRsvrRgstr bisInspRsvrRgstr = new BisInspRsvrRgstr();
  71. String objId = UuidUtil.uuid();
  72. String regId = objId;
  73. BisInspOffLineRsvr bisInspOffLineRsvr = bisInspOffLineRsvrRgeister.getBisInspOffLineRsvr();
  74. if (null != bisInspOffLineRsvr && StringUtils.isNotBlank(bisInspOffLineRsvr.getRgstrId())) {
  75. bisInspRsvrRgstr.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  76. regId = bisInspOffLineRsvr.getRgstrId();
  77. bisInspRsvrRgstr.setObjId(bisInspOffLineRsvr.getObjId());
  78. objId = bisInspOffLineRsvr.getObjId();
  79. bisInspRsvrRgstr.setState("1");
  80. } else {
  81. //添加到督查任务
  82. String goupId = bisInspOffLineObj.getGroupId();
  83. AttRsBase attRsBase = om.readValue(bisInspOffLineObj.getBase(), AttRsBase.class);
  84. insertBisInspAllObj(bisInspOffLineObj, attRsBase, objId, goupId);
  85. bisInspRsvrRgstr.setRgstrId(regId);
  86. bisInspRsvrRgstr.setObjId(objId);
  87. //插入登记表信息
  88. insertBisInspRsvrRgstr(attRsBase, bisInspRsvrRgstr, om);
  89. }
  90. //插入三个责任人信息
  91. insertBisInspBasePresExt(bisInspOffLineRsvrRgeister, bisInspRsvrRgstr, bisInspOffLineRsvr);
  92. //水库安全管理三级责任人
  93. insertBisInspPresSafe(bisInspOffLineRsvrRgeister, bisInspRsvrRgstr, bisInspOffLineRsvr);
  94. //三个重点环节
  95. insertBisInspBaseExt(bisInspOffLineRsvrRgeister, bisInspRsvrRgstr, bisInspOffLineRsvr);
  96. //运行管理情况
  97. inserBisInspSafeExtManage(bisInspOffLineRsvrRgeister, bisInspRsvrRgstr, bisInspOffLineRsvr);
  98. //工程实体
  99. insertBisInspRsvrProject(bisInspOffLineRsvrRgeister, bisInspRsvrRgstr, bisInspOffLineRsvr);
  100. //插入水库收益情况
  101. insertBisInspRsvrBenefits(bisInspOffLineRsvrRgeister, bisInspRsvrRgstr, bisInspOffLineRsvr);
  102. //插入走访情况
  103. insertBisInspBaseView(bisInspOffLineRsvrRgeister, bisInspRsvrRgstr, bisInspOffLineRsvr);
  104. bisInspRsvrRgstrDao.update(bisInspRsvrRgstr);//更新各个填报项目状态
  105. bisInspOffLineRet.setRegId(regId);
  106. bisInspOffLineRet.setObjId(objId);
  107. }
  108. return bisInspOffLineRet;
  109. }
  110. /**
  111. * 插入小水库督查任务信息
  112. *
  113. * @param attRsBase 对象基本信息
  114. * @param objId 督查对象ID
  115. * @param groupId 督查组ID
  116. */
  117. public void insertBisInspAllObj(BisInspOffLineObj bisInspOffLineObj, AttRsBase attRsBase, String objId, String groupId) {
  118. BisInspAllObj bisInspAllObj = new BisInspAllObj();
  119. bisInspAllObj.setId(groupId);
  120. bisInspAllObj.setObjId(objId);
  121. bisInspAllObj.setNm(attRsBase.getRsName());
  122. bisInspAllObj.setCode(attRsBase.getRsCode());
  123. bisInspAllObj.setPtype("1");
  124. bisInspAllObj.setOrgId(bisInspOffLineObj.getOrgId());
  125. bisInspAllObj.setAdCode(bisInspOffLineObj.getProvince());
  126. bisInspAllObj.setLttd(StringUtils.isNotBlank(attRsBase.getCenterX()) ? Double.parseDouble(attRsBase.getCenterX()) : 0);
  127. bisInspAllObj.setLttd(StringUtils.isNotBlank(attRsBase.getCenterY()) ? Double.parseDouble(attRsBase.getCenterY()) : 0);
  128. bisInspAllObj.setLgtd(StringUtils.isNotBlank(attRsBase.getCenterX()) ? Double.parseDouble(attRsBase.getCenterX()) : 0);
  129. bisInspAllObj.setLttd(StringUtils.isNotBlank(attRsBase.getCenterX()) ? Double.parseDouble(attRsBase.getCenterX()) : 0);
  130. bisInspAllObjDao.insert(bisInspAllObj);
  131. }
  132. /**
  133. * 插入小水库登记信息
  134. *
  135. * @param attRsBase 对象基本信息
  136. * @param bisInspRsvrRgstr 注册信息
  137. * @param om 转换对象
  138. * @throws IOException
  139. */
  140. public void insertBisInspRsvrRgstr(AttRsBase attRsBase, BisInspRsvrRgstr bisInspRsvrRgstr, ObjectMapper om) {
  141. bisInspRsvrRgstr.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  142. bisInspRsvrRgstr.setObjId(bisInspRsvrRgstr.getObjId());
  143. bisInspRsvrRgstr.setRsCode(attRsBase.getRsCode());
  144. bisInspRsvrRgstr.setRsvrNm(attRsBase.getRsName());
  145. bisInspRsvrRgstr.setAdCode(attRsBase.getAdmDiv());
  146. bisInspRsvrRgstr.setCompDateStr(attRsBase.getCompDateStr());
  147. bisInspRsvrRgstr.setHystSite(attRsBase.getLocation());
  148. bisInspRsvrRgstr.setTotCap(attRsBase.getTotCap());
  149. bisInspRsvrRgstr.setCompDateStr(attRsBase.getCompDateStr());
  150. bisInspRsvrRgstr.setLocation(attRsBase.getLocation());
  151. bisInspRsvrRgstr.setIntm(new Date());
  152. bisInspRsvrRgstr.setUptm(new Date());
  153. bisInspRsvrRgstr.setState("1");
  154. bisInspRsvrRgstr.setDamRegCode(attRsBase.getRegCode());//大坝注册登记号*/
  155. bisInspRsvrRgstr.setDataStat("0");
  156. //添加注册登记表
  157. bisInspRsvrRgstrDao.insert(bisInspRsvrRgstr);
  158. }
  159. /**
  160. * 插入三个责任人信息
  161. *
  162. * @param bisInspOffLineRsvrRgeister 三个责任人信息
  163. * @param bisInspRsvrRgstr
  164. */
  165. public void insertBisInspBasePresExt(BisInspOffLineRsvrRgeister bisInspOffLineRsvrRgeister, BisInspRsvrRgstr bisInspRsvrRgstr, BisInspOffLineRsvr bisInspOffLineRsvr) {
  166. if (null != bisInspOffLineRsvr && StringUtils.isNotBlank(bisInspOffLineRsvr.getRgstrId())) {
  167. if (null != bisInspOffLineRsvr.getBasePresExt() && bisInspOffLineRsvr.getBasePresExt()
  168. ) {
  169. if (null != bisInspOffLineRsvrRgeister.getBisInspBasePresExt()) {
  170. BisInspBasePresExt bisInspBasePresExt = bisInspOffLineRsvrRgeister.getBisInspBasePresExt();
  171. bisInspBasePresExt.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  172. BisInspBasePresExtParam bisInspBasePresExtParam = new BisInspBasePresExtParam();
  173. bisInspBasePresExtParam.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  174. List<BisInspBasePresExt> bisInspBasePresExts = bisInspBasePresExtDao.findList(bisInspBasePresExtParam);
  175. //找到dutyId
  176. if (bisInspBasePresExts != null && bisInspBasePresExts.size() > 0) {
  177. bisInspBasePresExt.setDutyId(bisInspBasePresExts.get(0).getDutyId());
  178. bisInspBasePresExtDao.update(bisInspBasePresExt);
  179. } else {
  180. bisInspBasePresExt.setDutyId(UuidUtil.uuid());
  181. bisInspBasePresExtDao.insert(bisInspBasePresExt);
  182. }
  183. //更新状态
  184. bisInspRsvrRgstr.setPresStat("2");
  185. }
  186. }
  187. } else {
  188. BisInspBasePresExt bisInspBasePresExt = null;
  189. if (bisInspOffLineRsvrRgeister.getBisInspBasePresExt() != null) {
  190. bisInspBasePresExt = bisInspOffLineRsvrRgeister.getBisInspBasePresExt();
  191. bisInspRsvrRgstr.setPresStat("2");
  192. } else {
  193. bisInspBasePresExt = new BisInspBasePresExt();
  194. bisInspRsvrRgstr.setPresStat("1");
  195. }
  196. bisInspBasePresExt.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  197. bisInspBasePresExt.setDutyId(UuidUtil.uuid());
  198. bisInspBasePresExtDao.insert(bisInspBasePresExt);
  199. }
  200. }
  201. /**
  202. * 插入水库安全管理三级责任人
  203. *
  204. * @param bisInspOffLineRsvrRgeister 水库安全管理三级责任人
  205. * @param bisInspRsvrRgstr
  206. */
  207. public void insertBisInspPresSafe(BisInspOffLineRsvrRgeister bisInspOffLineRsvrRgeister, BisInspRsvrRgstr bisInspRsvrRgstr, BisInspOffLineRsvr bisInspOffLineRsvr) {
  208. if (null != bisInspOffLineRsvr && StringUtils.isNotBlank(bisInspOffLineRsvr.getRgstrId())) {
  209. if (null != bisInspOffLineRsvr.getPresSafe() && bisInspOffLineRsvr.getPresSafe()
  210. ) {
  211. if (null != bisInspOffLineRsvrRgeister.getBisInspPresSafe()) {
  212. BisInspPresSafe bisInspPresSafe = bisInspOffLineRsvrRgeister.getBisInspPresSafe();
  213. bisInspPresSafe.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  214. BisInspPresSafeParam bisInspPresSafeParam = new BisInspPresSafeParam();
  215. bisInspPresSafeParam.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  216. List<BisInspPresSafe> bisInspPresSafes = bisInspPresSafeDao.findList(bisInspPresSafeParam);
  217. //找到dutyId
  218. if (bisInspPresSafes != null && bisInspPresSafes.size() > 0) {
  219. bisInspPresSafe.setId(bisInspPresSafes.get(0).getId());
  220. bisInspPresSafeDao.update(bisInspPresSafe);
  221. } else {
  222. bisInspPresSafe.setId(UuidUtil.uuid());
  223. bisInspPresSafeDao.insert(bisInspPresSafe);
  224. }
  225. //更新状态
  226. bisInspRsvrRgstr.setSafeStat("2");
  227. }
  228. }
  229. } else {
  230. BisInspPresSafe bisInspPresSafes = null;
  231. if (bisInspOffLineRsvrRgeister.getBisInspPresSafe() != null) {
  232. bisInspPresSafes = bisInspOffLineRsvrRgeister.getBisInspPresSafe();
  233. bisInspRsvrRgstr.setSafeStat("2");
  234. } else {
  235. bisInspPresSafes = new BisInspPresSafe();
  236. bisInspRsvrRgstr.setSafeStat("1");
  237. }
  238. bisInspPresSafes.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  239. bisInspPresSafes.setId(UuidUtil.uuid());
  240. bisInspPresSafeDao.insert(bisInspPresSafes);
  241. }
  242. }
  243. /**
  244. * 三个重点环节
  245. *
  246. * @param bisInspOffLineRsvrRgeister
  247. * @param bisInspRsvrRgstr
  248. */
  249. public void insertBisInspBaseExt(BisInspOffLineRsvrRgeister bisInspOffLineRsvrRgeister, BisInspRsvrRgstr bisInspRsvrRgstr, BisInspOffLineRsvr bisInspOffLineRsvr) {
  250. if (null != bisInspOffLineRsvr && StringUtils.isNotBlank(bisInspOffLineRsvr.getRgstrId())) {
  251. if (null != bisInspOffLineRsvr.getBaseExt() && bisInspOffLineRsvr.getBaseExt() && null != bisInspOffLineRsvrRgeister.getBisInspBaseExt()) {
  252. BisInspBaseExt bisInspBaseExt = bisInspOffLineRsvrRgeister.getBisInspBaseExt();
  253. bisInspBaseExt.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  254. BisInspBaseExtParam bisInspBaseExtParam = new BisInspBaseExtParam();
  255. bisInspBaseExtParam.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  256. List<BisInspBaseExt> bisInspBaseExts = bisInspBaseExtDao.findList(bisInspBaseExtParam);
  257. if (bisInspBaseExts != null && bisInspBaseExts.size() > 0) {
  258. bisInspBaseExt.setThrqId(bisInspBaseExts.get(0).getThrqId());
  259. bisInspBaseExtDao.update(bisInspBaseExt);
  260. } else {
  261. bisInspBaseExt.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  262. bisInspBaseExt.setThrqId(UuidUtil.uuid());
  263. bisInspBaseExtDao.insert(bisInspBaseExt);
  264. }
  265. bisInspRsvrRgstr.setBaseStat("2");
  266. }
  267. } else {
  268. BisInspBaseExt bisInspBaseExt = null;
  269. if (bisInspOffLineRsvrRgeister.getBisInspBaseExt() != null) {
  270. bisInspBaseExt = bisInspOffLineRsvrRgeister.getBisInspBaseExt();
  271. bisInspRsvrRgstr.setBaseStat("2");
  272. } else {
  273. bisInspBaseExt = new BisInspBaseExt();
  274. bisInspRsvrRgstr.setBaseStat("1");
  275. }
  276. bisInspBaseExt.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  277. bisInspBaseExt.setThrqId(UuidUtil.uuid());
  278. bisInspBaseExtDao.insert(bisInspBaseExt);
  279. }
  280. }
  281. /**
  282. * 运行管理情况
  283. *
  284. * @param bisInspOffLineRsvrRgeister
  285. * @param bisInspRsvrRgstr
  286. */
  287. public void inserBisInspSafeExtManage(BisInspOffLineRsvrRgeister bisInspOffLineRsvrRgeister, BisInspRsvrRgstr
  288. bisInspRsvrRgstr, BisInspOffLineRsvr bisInspOffLineRsvr) {
  289. if (null != bisInspOffLineRsvr && StringUtils.isNotBlank(bisInspOffLineRsvr.getRgstrId())) {
  290. if (null != bisInspOffLineRsvrRgeister.getBisInspSafeExtManage()) {
  291. BisInspSafeExtManage bisInspSafeExtManage = bisInspOffLineRsvrRgeister.getBisInspSafeExtManage();
  292. bisInspSafeExtManage.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  293. //找到对应的ID update
  294. BisInspSafeExtManageParam bisInspSafeExtManageParam = new BisInspSafeExtManageParam();
  295. bisInspSafeExtManageParam.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  296. List<BisInspSafeExtManage> bisInspSafeExtManages = bisInspSafeExtManageDao.findList(bisInspSafeExtManageParam);
  297. if (bisInspSafeExtManages != null && bisInspSafeExtManages.size() > 0) {
  298. bisInspSafeExtManage.setMngrnId(bisInspSafeExtManages.get(0).getMngrnId());
  299. if (null != bisInspOffLineRsvr.getSafeExtManage() && bisInspOffLineRsvr.getSafeExtManage()) {
  300. if (StringUtils.isNotBlank(bisInspSafeExtManage.getHasSpeManage())
  301. || StringUtils.isNotBlank(bisInspSafeExtManage.getIsHasMangPers())
  302. || StringUtils.isNotBlank(bisInspSafeExtManage.getHasWdEmnic())
  303. || StringUtils.isNotBlank(bisInspSafeExtManage.getIfManageRegRel())
  304. || StringUtils.isNotBlank(bisInspSafeExtManage.getIfManageReg())
  305. || StringUtils.isNotBlank(bisInspSafeExtManage.getIfDamWarnLogo())
  306. || StringUtils.isNotBlank(bisInspSafeExtManage.getIsClean())
  307. || StringUtils.isNotBlank(bisInspSafeExtManage.getIfFsltdz())
  308. || StringUtils.isNotBlank(bisInspSafeExtManage.getIfFsltdzNo())
  309. || StringUtils.isNotBlank(bisInspSafeExtManage.getIfFsltdzRun())
  310. ) {
  311. bisInspSafeExtManageDao.updateResRun(bisInspSafeExtManage);
  312. }
  313. }
  314. if (null != bisInspOffLineRsvr.getDam() && bisInspOffLineRsvr.getDam()) {
  315. if (StringUtils.isNotBlank(bisInspSafeExtManage.getSafeComment())
  316. ) {
  317. bisInspSafeExtManageDao.updateDam(bisInspSafeExtManage);
  318. }
  319. }
  320. } else {
  321. bisInspSafeExtManage.setMngrnId(UuidUtil.uuid());
  322. bisInspSafeExtManageDao.insert(bisInspSafeExtManage);
  323. }
  324. bisInspRsvrRgstr.setResRunStat("2");
  325. bisInspRsvrRgstr.setDamStat("2");
  326. }
  327. } else {
  328. BisInspSafeExtManage bisInspSafeExtManage = null;
  329. if (bisInspOffLineRsvrRgeister.getBisInspSafeExtManage() != null) {
  330. bisInspSafeExtManage = bisInspOffLineRsvrRgeister.getBisInspSafeExtManage();
  331. bisInspRsvrRgstr.setResRunStat("2");
  332. bisInspRsvrRgstr.setDamStat("2");
  333. } else {
  334. bisInspSafeExtManage = new BisInspSafeExtManage();
  335. bisInspRsvrRgstr.setResRunStat("1");
  336. bisInspRsvrRgstr.setDamStat("1");
  337. }
  338. bisInspSafeExtManage.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  339. bisInspSafeExtManage.setMngrnId(UuidUtil.uuid());
  340. bisInspSafeExtManageDao.insert(bisInspSafeExtManage);
  341. }
  342. }
  343. /**
  344. * 工程实体
  345. *
  346. * @param bisInspOffLineRsvrRgeister
  347. * @param bisInspRsvrRgstr
  348. */
  349. void insertBisInspRsvrProject(BisInspOffLineRsvrRgeister bisInspOffLineRsvrRgeister, BisInspRsvrRgstr
  350. bisInspRsvrRgstr, BisInspOffLineRsvr bisInspOffLineRsvr) {
  351. if (null != bisInspOffLineRsvr && StringUtils.isNotBlank(bisInspOffLineRsvr.getRgstrId())) {
  352. if (null != bisInspOffLineRsvrRgeister.getBisInspRsvrProject()) {
  353. BisInspRsvrProject bisInspRsvrProject = bisInspOffLineRsvrRgeister.getBisInspRsvrProject();
  354. bisInspRsvrProject.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  355. //找到对应的ID update
  356. BisInspRsvrProjectParam bisInspRsvrProjectParam = new BisInspRsvrProjectParam();
  357. bisInspRsvrProjectParam.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  358. List<BisInspRsvrProject> bisInspRsvrProjects = bisInspRsvrProjectDao.findList(bisInspRsvrProjectParam);
  359. if (bisInspRsvrProjects != null && bisInspRsvrProjects.size() > 0) {
  360. bisInspRsvrProject.setId(bisInspRsvrProjects.get(0).getId());
  361. if (null != bisInspOffLineRsvr.getRsvrProject() && bisInspOffLineRsvr.getRsvrProject()) {
  362. if (StringUtils.isNotBlank(bisInspRsvrProject.getReverOrg())
  363. || StringUtils.isNotBlank(bisInspRsvrProject.getReverOrgName())
  364. || StringUtils.isNotBlank(bisInspRsvrProject.getPoorCountry())
  365. || StringUtils.isNotBlank(bisInspRsvrProject.getDiskRunInfo())
  366. || StringUtils.isNotBlank(bisInspRsvrProject.getHasSetMainFl())
  367. || StringUtils.isNotBlank(bisInspRsvrProject.getIsMainFlNormal())
  368. || StringUtils.isNotBlank(bisInspRsvrProject.getHasSetPourFl())
  369. || StringUtils.isNotBlank(bisInspRsvrProject.getPourFyIsNormal())
  370. ) {
  371. bisInspRsvrProjectDao.updateRever(bisInspRsvrProject);
  372. }
  373. }
  374. if (null != bisInspOffLineRsvr.getRein() && bisInspOffLineRsvr.getRein()) {
  375. if (StringUtils.isNotBlank(bisInspRsvrProject.getIfDamSafe())
  376. || StringUtils.isNotBlank(bisInspRsvrProject.getIfDamSafeReq())
  377. || StringUtils.isNotBlank(bisInspRsvrProject.getIfDamSafeRul())
  378. || StringUtils.isNotBlank(bisInspRsvrProject.getIfDamSafeDepRul())
  379. || StringUtils.isNotBlank(bisInspRsvrProject.getIfDamSafeThr())
  380. || StringUtils.isNotBlank(bisInspRsvrProject.getIfReinForce())
  381. || StringUtils.isNotBlank(bisInspRsvrProject.getReinForceRun())
  382. || StringUtils.isNotBlank(bisInspRsvrProject.getReinForceRun2())
  383. || StringUtils.isNotBlank(bisInspRsvrProject.getReinForceRun3())
  384. || StringUtils.isNotBlank(bisInspRsvrProject.getIfReinImpGve())
  385. || StringUtils.isNotBlank(bisInspRsvrProject.getIfReinImpPlan())
  386. ) {
  387. bisInspRsvrProjectDao.updateRein(bisInspRsvrProject);
  388. }
  389. }
  390. } else {
  391. bisInspRsvrProject.setId(UuidUtil.uuid());
  392. bisInspRsvrProjectDao.insert(bisInspRsvrProject);
  393. }
  394. bisInspRsvrRgstr.setReverStat("2");
  395. bisInspRsvrRgstr.setReinStat("2");
  396. }
  397. } else {
  398. BisInspRsvrProject bisInspRsvrProject = null;
  399. if (bisInspOffLineRsvrRgeister.getBisInspRsvrProject() != null) {
  400. bisInspRsvrProject = bisInspOffLineRsvrRgeister.getBisInspRsvrProject();
  401. bisInspRsvrRgstr.setReverStat("2");
  402. bisInspRsvrRgstr.setReinStat("2");
  403. } else {
  404. bisInspRsvrProject = new BisInspRsvrProject();
  405. bisInspRsvrRgstr.setReverStat("1");
  406. bisInspRsvrRgstr.setReinStat("1");
  407. }
  408. bisInspRsvrProject.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  409. bisInspRsvrProject.setId(UuidUtil.uuid());
  410. bisInspRsvrProjectDao.insert(bisInspRsvrProject);
  411. }
  412. }
  413. /**
  414. * 插入水库收益情况
  415. *
  416. * @param bisInspOffLineRsvrRgeister
  417. * @param bisInspRsvrRgstr
  418. */
  419. void insertBisInspRsvrBenefits(BisInspOffLineRsvrRgeister bisInspOffLineRsvrRgeister, BisInspRsvrRgstr
  420. bisInspRsvrRgstr, BisInspOffLineRsvr bisInspOffLineRsvr) {
  421. if (null != bisInspOffLineRsvr && StringUtils.isNotBlank(bisInspOffLineRsvr.getRgstrId())) {
  422. if (null != bisInspOffLineRsvr.getBenefits() && bisInspOffLineRsvr.getBenefits() && null != bisInspOffLineRsvrRgeister.getBisInspRsvrBenefits()) {
  423. BisInspRsvrBenefits bisInspRsvrBenefits = bisInspOffLineRsvrRgeister.getBisInspRsvrBenefits();
  424. bisInspRsvrBenefits.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  425. //找到id update
  426. BisInspRsvrBenefitsParam bisInspRsvrBenefitsParam = new BisInspRsvrBenefitsParam();
  427. bisInspRsvrBenefitsParam.setRgstrId(bisInspOffLineRsvr.getRgstrId());
  428. List<BisInspRsvrBenefits> bisInspRsvrBenefitss = bisInspRsvrBenefitsDao.findList(bisInspRsvrBenefitsParam);
  429. if (bisInspRsvrBenefitss != null && bisInspRsvrBenefitss.size() > 0) {
  430. bisInspRsvrBenefits.setId(bisInspRsvrBenefitss.get(0).getId());
  431. bisInspRsvrBenefitsDao.update(bisInspRsvrBenefits);
  432. } else {
  433. bisInspRsvrBenefits.setId(UuidUtil.uuid());
  434. bisInspRsvrBenefitsDao.insert(bisInspRsvrBenefits);
  435. }
  436. bisInspRsvrRgstr.setBenefitStat("2");
  437. }
  438. } else {
  439. BisInspRsvrBenefits bisInspRsvrBenefits = null;
  440. if (bisInspOffLineRsvrRgeister.getBisInspRsvrBenefits() != null) {
  441. bisInspRsvrBenefits = bisInspOffLineRsvrRgeister.getBisInspRsvrBenefits();
  442. bisInspRsvrRgstr.setBenefitStat("2");
  443. } else {
  444. bisInspRsvrBenefits = new BisInspRsvrBenefits();
  445. bisInspRsvrRgstr.setBenefitStat("1");
  446. }
  447. bisInspRsvrBenefits.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  448. bisInspRsvrBenefits.setId(UuidUtil.uuid());
  449. bisInspRsvrBenefitsDao.insert(bisInspRsvrBenefits);
  450. }
  451. }
  452. /**
  453. * 插入走访情况
  454. *
  455. * @param bisInspOffLineRsvrRgeister
  456. * @param bisInspRsvrRgstr
  457. */
  458. void insertBisInspBaseView(BisInspOffLineRsvrRgeister bisInspOffLineRsvrRgeister, BisInspRsvrRgstr
  459. bisInspRsvrRgstr, BisInspOffLineRsvr bisInspOffLineRsvr) {
  460. if (bisInspOffLineRsvrRgeister.getBisInspBaseView() != null) {
  461. BisInspBaseView bisInspBaseView = new BisInspBaseView();
  462. String viewId = UuidUtil.uuid();
  463. bisInspBaseView.setRgstrId(bisInspRsvrRgstr.getRgstrId());
  464. bisInspBaseView.setViewId(viewId);
  465. bisInspBaseView.setResCode(bisInspRsvrRgstr.getRsCode());
  466. bisInspBaseView.setCreateTime(new Date());
  467. bisInspBaseView.setUpdateTime(new Date());
  468. bisInspBaseView.setStatus("2");
  469. bisInspBaseViewDao.insert(bisInspBaseView);
  470. for (BisInspPreList bisInspPreList : bisInspOffLineRsvrRgeister.getBisInspBaseView()) {
  471. bisInspPreList.setViewId(viewId);
  472. bisInspPreList.setViewPreId(UuidUtil.uuid());
  473. bisInspPreList.setInspTm(new Date());
  474. bisInspPreList.setViewPreName(bisInspPreList.getViewPreName());
  475. bisInspPreList.setKnowResManager(bisInspPreList.getKnowResManager());
  476. bisInspPreList.setManagerComment(bisInspPreList.getManagerComment());
  477. bisInspPreListDao.insert(bisInspPreList);
  478. }
  479. bisInspRsvrRgstr.setViewStat("2");
  480. } else {
  481. bisInspRsvrRgstr.setViewStat("1");
  482. }
  483. }
  484. @Override
  485. public BisInspOffLineRetBase getBaseInfo(BisInspOffLine bisInspOffLine) {
  486. BisInspOffLineRetBase bisInspOffLineRetBase = new BisInspOffLineRetBase();
  487. AttRsBaseParam attRsBaseParam = new AttRsBaseParam();
  488. attRsBaseParam.setRsName(bisInspOffLine.getName());
  489. attRsBaseParam.setAdmDiv(AdLevelUtil.getAddvcd(bisInspOffLine.getAddvcd()));
  490. bisInspOffLineRetBase.setBase(attRsBaseDao.findList(attRsBaseParam));
  491. //判断登记表是否有重复对象
  492. List<BisInspBase> bisInspRsvrRgstrs = bisInspRsvrRgstrDao.getRsvrByIdNm(bisInspOffLine.getGroupId(), bisInspOffLine.getName());
  493. if (null != bisInspRsvrRgstrs && bisInspRsvrRgstrs.size() > 0) {
  494. bisInspOffLineRetBase.setRepeat(true);
  495. bisInspOffLineRetBase.setRepeatList(bisInspRsvrRgstrs);
  496. } else {
  497. bisInspOffLineRetBase.setRepeat(false);
  498. }
  499. return bisInspOffLineRetBase;
  500. }
  501. }