bd516f72c5dcce434b6eeadd9a70aa9153825a57.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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.AttWuntBaseParam;
  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/26 17:54
  25. */
  26. @Service
  27. @Transactional
  28. public class BisInspOffLineWuntProcess extends BisInspOffLineProcess {
  29. @Autowired
  30. BisInspAllObjDao bisInspAllObjDao;
  31. @Autowired
  32. BisInspPblmDao bisInspPblmDao;//督查问题
  33. @Autowired
  34. BisInspSvwtWuntRgstrWsuswDao bisInspSvwtWuntRgstrWsuswDao;
  35. @Autowired
  36. BisInspSvwtWuntRgstrWuuswDao bisInspSvwtWuntRgstrWuuswDao;
  37. @Autowired
  38. BisInspSvwtWuntRgstrDao bisInspSvwtWuntRgstrDao;
  39. @Autowired
  40. AttWuntBaseDao attWuntBaseDao;
  41. @Autowired
  42. SupervisionPlanService supervisionPlanService;
  43. @Autowired
  44. private GwComFileService gwComFileService;//文件操作
  45. @Value("${getFile.prefix}")
  46. public String prefix;
  47. @Override
  48. public BisInspOffLineRet process(BisInspOffLineObj bisInspOffLineObj, String fileDir) throws IOException {
  49. BisInspOffLineRet bisInspOffLineRet = new BisInspOffLineRet();
  50. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  51. ObjectMapper om = new ObjectMapper();
  52. om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  53. //解析用水单位填报信息
  54. BisInspOffLineWuntRgeister bisInspOffLineWuntRgeister = om.readValue(bisInspOffLineObj.getRegister(), BisInspOffLineWuntRgeister.class);
  55. //解析用水单位基本信息对象c
  56. if (bisInspOffLineObj.getBase() != null) {
  57. /* if (null == bisInspOffLineObj.getReplace() || bisInspOffLineObj.getReplace()) {
  58. delRgstrData(bisInspOffLineObj);
  59. }*/
  60. //添加到督查任务
  61. String objId = UuidUtil.uuid();
  62. String groupId = bisInspOffLineObj.getGroupId();
  63. BisInspSvwtWuntRgstr bisInspSvwtWuntRgstr = new BisInspSvwtWuntRgstr();
  64. String regId = objId;
  65. String persId = bisInspOffLineObj.getPersId();
  66. AttWuntBase attWuntBase = om.readValue(bisInspOffLineObj.getBase(), AttWuntBase.class);
  67. if (attWuntBase.getId() != null && !"".equals(attWuntBase.getId()) && attWuntBaseDao.get(attWuntBase.getId()) != null) {
  68. attWuntBaseDao.update(attWuntBase);
  69. } else {
  70. attWuntBase.setId(UuidUtil.uuid());
  71. attWuntBase.setUtCode(UuidUtil.uuid());
  72. attWuntBaseDao.insert(attWuntBase);
  73. }
  74. insertBisInspAllObj(bisInspOffLineObj, groupId, objId, attWuntBase);
  75. insertWuntRgstr(attWuntBase, groupId, objId, persId, regId, bisInspSvwtWuntRgstr);
  76. //用水单位节约用水情况
  77. insertWuntWuuswInfo(bisInspOffLineWuntRgeister, regId, persId, bisInspSvwtWuntRgstr);
  78. //节水型单位节约用水情况
  79. insertWuntWsuswInfo(bisInspOffLineWuntRgeister, regId, persId, bisInspSvwtWuntRgstr);
  80. //更新督查 字表状态
  81. bisInspSvwtWuntRgstrDao.update(bisInspSvwtWuntRgstr);
  82. bisInspOffLineRet.setRegId(regId);
  83. bisInspOffLineRet.setObjId(objId);
  84. }
  85. return bisInspOffLineRet;
  86. }
  87. /**
  88. * 删除任务及登记表信息
  89. *
  90. * @param groupId
  91. * @param nm
  92. */
  93. public void delRgstrData(BisInspOffLineObj bisInspOffLineObj) {
  94. //登记表查找重复数据,然后删除
  95. BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam();
  96. bisInspAllObjParam.setId(bisInspOffLineObj.getGroupId());
  97. bisInspAllObjParam.setNm(bisInspOffLineObj.getNm());
  98. List<BisInspAllObj> bisInspAllObjs = bisInspAllObjDao.findList(bisInspAllObjParam);
  99. for (BisInspAllObj bisInspAllObj : bisInspAllObjs) {
  100. //删除登记表
  101. //删除登记表关联的各个填报表数据
  102. supervisionPlanService.cleanObjDataByObjId(BisInspEnum.WUNT.getValue(), bisInspAllObj.getObjId());
  103. }
  104. }
  105. /**
  106. * 添加到督查任务
  107. *
  108. * @param groupId
  109. * @param objId
  110. * @param attAdBase
  111. */
  112. public void insertBisInspAllObj(BisInspOffLineObj bisInspOffLineObj, String groupId, String objId, AttWuntBase attWuntBase) {
  113. BisInspAllObj bisInspAllObj = new BisInspAllObj();
  114. bisInspAllObj.setId(groupId);
  115. bisInspAllObj.setObjId(objId);
  116. bisInspAllObj.setNm(attWuntBase.getUtName());
  117. bisInspAllObj.setCode(attWuntBase.getUtCode());//非空字段
  118. bisInspAllObj.setPtype("16");
  119. bisInspAllObj.setOrgId(bisInspOffLineObj.getOrgId());
  120. bisInspAllObj.setAdCode(bisInspOffLineObj.getProvince());
  121. bisInspAllObj.setLgtd(attWuntBase.getPcX());
  122. bisInspAllObj.setLttd(attWuntBase.getPcY());
  123. bisInspAllObj.setLgtdpc(attWuntBase.getGdX());
  124. bisInspAllObj.setLttdpc(attWuntBase.getGdY());
  125. bisInspAllObjDao.insert(bisInspAllObj);
  126. }
  127. /**
  128. * 插入登记表信息
  129. *
  130. * @param bisInspOffLineObj
  131. * @param objId
  132. * @param om
  133. * @param regId
  134. * @param bisInspSvwtWuntRgstr
  135. * @throws IOException
  136. */
  137. public void insertWuntRgstr(AttWuntBase attWuntBase, String groupId, String objId, String persId, String regId, BisInspSvwtWuntRgstr bisInspSvwtWuntRgstr) throws IOException {
  138. bisInspSvwtWuntRgstr.setId(regId);
  139. bisInspSvwtWuntRgstr.setObjId(objId);
  140. bisInspSvwtWuntRgstr.setUtName(attWuntBase.getUtName());
  141. bisInspSvwtWuntRgstr.setUtCode(attWuntBase.getUtCode());
  142. bisInspSvwtWuntRgstr.setUtType(attWuntBase.getUtType());
  143. bisInspSvwtWuntRgstr.setUtPpt(attWuntBase.getUtPpt());
  144. bisInspSvwtWuntRgstr.setOpenName(attWuntBase.getOpenName());
  145. bisInspSvwtWuntRgstr.setUtCont(attWuntBase.getUtCont());
  146. bisInspSvwtWuntRgstr.setSignAddr(attWuntBase.getSignAddr());
  147. bisInspSvwtWuntRgstr.setUtAddr(attWuntBase.getUtAddr());
  148. bisInspSvwtWuntRgstr.setTrdType(attWuntBase.getTrdType());
  149. bisInspSvwtWuntRgstr.setGreenArea(attWuntBase.getGreenArea());
  150. bisInspSvwtWuntRgstr.setWsTw(attWuntBase.getWsTw());
  151. bisInspSvwtWuntRgstr.setWsBw(attWuntBase.getWsBw());
  152. bisInspSvwtWuntRgstr.setWsOth(attWuntBase.getWsOth());
  153. bisInspSvwtWuntRgstr.setPayWb(attWuntBase.getPayWb());
  154. bisInspSvwtWuntRgstr.setWbPer(attWuntBase.getWbPer());
  155. bisInspSvwtWuntRgstr.setHotlLev(attWuntBase.getHotlLev());
  156. bisInspSvwtWuntRgstr.setBedNum(attWuntBase.getBedNum() == null || "".equals(attWuntBase.getBedNum()) ? null : attWuntBase.getBedNum().longValue());
  157. bisInspSvwtWuntRgstr.setOccRate(attWuntBase.getOccRate());
  158. bisInspSvwtWuntRgstr.setWuUnit(attWuntBase.getWuUnit());
  159. bisInspSvwtWuntRgstr.setWuUnitOut(attWuntBase.getWuUnitOut());
  160. bisInspSvwtWuntRgstr.setMainPrd(attWuntBase.getMainPrd());
  161. bisInspSvwtWuntRgstr.setWipaa(attWuntBase.getWipaa());
  162. bisInspSvwtWuntRgstr.setHasWrmrms(attWuntBase.getHasWrmrms());
  163. bisInspSvwtWuntRgstr.setIsKmwuul(attWuntBase.getIsKmwuul());
  164. bisInspSvwtWuntRgstr.setKmwuulLev(attWuntBase.getKmwuulLev());
  165. bisInspSvwtWuntRgstr.setWuUt(attWuntBase.getWuUt());
  166. bisInspSvwtWuntRgstr.setWuUtAttn(attWuntBase.getWuUtAttn());
  167. bisInspSvwtWuntRgstr.setWuUtCont(attWuntBase.getWuUtCont());
  168. bisInspSvwtWuntRgstr.setUtPersNum(attWuntBase.getUtPersNum() == null || "".equals(attWuntBase.getUtPersNum()) ? null : attWuntBase.getUtPersNum().longValue());
  169. bisInspSvwtWuntRgstr.setWorkNum(attWuntBase.getWorkNum() == null || "".equals(attWuntBase.getWorkNum()) ? null : attWuntBase.getWorkNum().longValue());
  170. bisInspSvwtWuntRgstr.setWorkNotNum(attWuntBase.getWorkNotNum() == null || "".equals(attWuntBase.getWorkNotNum()) ? null : attWuntBase.getWorkNotNum().longValue());
  171. bisInspSvwtWuntRgstr.setTotArea(attWuntBase.getTotArea());
  172. bisInspSvwtWuntRgstr.setBuldArea(attWuntBase.getBuldArea());
  173. bisInspSvwtWuntRgstr.setSchCla(attWuntBase.getSchCla());
  174. bisInspSvwtWuntRgstr.setUniCla(attWuntBase.getUniCla());
  175. bisInspSvwtWuntRgstr.setTeachNum(attWuntBase.getTeachNum() == null || "".equals(attWuntBase.getTeachNum()) ? null : attWuntBase.getTeachNum().longValue());
  176. bisInspSvwtWuntRgstr.setTeachLvNum(attWuntBase.getTeachLvNum() == null || "".equals(attWuntBase.getTeachLvNum()) ? null : attWuntBase.getTeachLvNum().longValue());
  177. bisInspSvwtWuntRgstr.setStuNum(attWuntBase.getStuNum() == null || "".equals(attWuntBase.getStuNum()) ? null : attWuntBase.getStuNum().longValue());
  178. bisInspSvwtWuntRgstr.setStuLvNum(attWuntBase.getStuLvNum() == null || "".equals(attWuntBase.getStuLvNum()) ? null : attWuntBase.getStuLvNum().longValue());
  179. bisInspSvwtWuntRgstr.setIsLchCwsm(attWuntBase.getIsLchCwsm());
  180. bisInspSvwtWuntRgstr.setState("1");
  181. bisInspSvwtWuntRgstr.setDataStat("0");
  182. bisInspSvwtWuntRgstr.setPersId(persId);
  183. bisInspSvwtWuntRgstr.setGroupId(groupId);
  184. bisInspSvwtWuntRgstr.setGdX(attWuntBase.getGdX());
  185. bisInspSvwtWuntRgstr.setGdY(attWuntBase.getGdY());
  186. bisInspSvwtWuntRgstr.setPcX(attWuntBase.getPcX());
  187. bisInspSvwtWuntRgstr.setPcY(attWuntBase.getPcY());
  188. bisInspSvwtWuntRgstr.setInTm(new Date());
  189. bisInspSvwtWuntRgstr.setUpTm(new Date());
  190. bisInspSvwtWuntRgstr.setChkTm(new Date());
  191. bisInspSvwtWuntRgstrDao.insert(bisInspSvwtWuntRgstr);
  192. }
  193. /**
  194. * 插入用水单位节约用水情况
  195. *
  196. * @param bisInspOffLineWuntRgeister
  197. * @param regId
  198. * @param bisInspOffLineObj
  199. * @param bisInspSvwtWuntRgstr
  200. */
  201. public void insertWuntWuuswInfo(BisInspOffLineWuntRgeister bisInspOffLineWuntRgeister, String regId, String persId, BisInspSvwtWuntRgstr bisInspSvwtWuntRgstr) {
  202. //用水单位节约用水情况
  203. BisInspSvwtWuntRgstrWuusw bisInspSvwtWuntRgstrWuusw = new BisInspSvwtWuntRgstrWuusw();
  204. if (bisInspOffLineWuntRgeister.getBisInspSvwtWuntRgstrWuusw() != null) {
  205. bisInspSvwtWuntRgstrWuusw = bisInspOffLineWuntRgeister.getBisInspSvwtWuntRgstrWuusw();
  206. bisInspSvwtWuntRgstrWuusw.setId(UuidUtil.uuid());
  207. bisInspSvwtWuntRgstrWuusw.setRgstrId(regId);
  208. bisInspSvwtWuntRgstrWuusw.setInTm(new Date());
  209. bisInspSvwtWuntRgstrWuusw.setUpTm(new Date());
  210. bisInspSvwtWuntRgstrWuusw.setDataStat("0");
  211. bisInspSvwtWuntRgstrWuusw.setPersId(persId);
  212. bisInspSvwtWuntRgstrWuuswDao.insert(bisInspSvwtWuntRgstrWuusw);
  213. bisInspSvwtWuntRgstr.setWuuswInfoStat("2");
  214. } else {
  215. bisInspSvwtWuntRgstrWuusw.setId(UuidUtil.uuid());
  216. bisInspSvwtWuntRgstrWuusw.setRgstrId(regId);
  217. bisInspSvwtWuntRgstrWuusw.setInTm(new Date());
  218. bisInspSvwtWuntRgstrWuusw.setUpTm(new Date());
  219. bisInspSvwtWuntRgstrWuusw.setDataStat("0");
  220. bisInspSvwtWuntRgstrWuusw.setPersId(persId);
  221. bisInspSvwtWuntRgstrWuuswDao.insert(bisInspSvwtWuntRgstrWuusw);
  222. bisInspSvwtWuntRgstr.setWuuswInfoStat("1");
  223. }
  224. }
  225. /**
  226. * 插入节水型单位节约用水情况
  227. *
  228. * @param bisInspOffLineWuntRgeister
  229. * @param regId
  230. * @param bisInspOffLineObj
  231. * @param bisInspSvwtWuntRgstr
  232. */
  233. public void insertWuntWsuswInfo(BisInspOffLineWuntRgeister bisInspOffLineWuntRgeister, String regId, String persId, BisInspSvwtWuntRgstr bisInspSvwtWuntRgstr) {
  234. //节水型单位节约用水情况
  235. BisInspSvwtWuntRgstrWsusw bisInspSvwtWuntRgstrWsusw = new BisInspSvwtWuntRgstrWsusw();
  236. if (bisInspOffLineWuntRgeister.getBisInspSvwtWuntRgstrWsusw() != null) {
  237. bisInspSvwtWuntRgstrWsusw = bisInspOffLineWuntRgeister.getBisInspSvwtWuntRgstrWsusw();
  238. bisInspSvwtWuntRgstrWsusw.setId(UuidUtil.uuid());
  239. bisInspSvwtWuntRgstrWsusw.setRgstrId(regId);
  240. bisInspSvwtWuntRgstrWsusw.setInTm(new Date());
  241. bisInspSvwtWuntRgstrWsusw.setUpTm(new Date());
  242. bisInspSvwtWuntRgstrWsusw.setDataStat("0");
  243. bisInspSvwtWuntRgstrWsusw.setPersId(persId);
  244. bisInspSvwtWuntRgstrWsuswDao.insert(bisInspSvwtWuntRgstrWsusw);
  245. bisInspSvwtWuntRgstr.setWsuswInfoStat("2");
  246. } else {
  247. bisInspSvwtWuntRgstrWsusw.setId(UuidUtil.uuid());
  248. bisInspSvwtWuntRgstrWsusw.setRgstrId(regId);
  249. bisInspSvwtWuntRgstrWsusw.setInTm(new Date());
  250. bisInspSvwtWuntRgstrWsusw.setUpTm(new Date());
  251. bisInspSvwtWuntRgstrWsusw.setDataStat("0");
  252. bisInspSvwtWuntRgstrWsusw.setPersId(persId);
  253. bisInspSvwtWuntRgstrWsuswDao.insert(bisInspSvwtWuntRgstrWsusw);
  254. bisInspSvwtWuntRgstr.setWsuswInfoStat("1");
  255. }
  256. }
  257. @Override
  258. public BisInspOffLineRetBase getBaseInfo(BisInspOffLine bisInspOffLine) {
  259. BisInspOffLineRetBase bisInspOffLineRetBase = new BisInspOffLineRetBase();
  260. AttWuntBaseParam attWuntBaseParam = new AttWuntBaseParam();
  261. attWuntBaseParam.setUtName(bisInspOffLine.getName());
  262. attWuntBaseParam.setUtCode(bisInspOffLine.getCode());
  263. bisInspOffLineRetBase.setBase(attWuntBaseDao.findList(attWuntBaseParam));
  264. return bisInspOffLineRetBase;
  265. }
  266. }