SweepCodeService.java 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. package com.bofeng.service;
  2. import com.bofeng.JwtHelper;
  3. import com.bofeng.dao.MsSuspectedMapper;
  4. import com.bofeng.dao.OutScanEstateMapper;
  5. import com.bofeng.dao.RbMapper;
  6. import com.bofeng.dao.SweepCodeMapper;
  7. import com.bofeng.entity.*;
  8. import com.yvan.PageDb;
  9. import com.yvan.platform.StringUtils;
  10. import org.apache.shiro.util.CollectionUtils;
  11. import org.springframework.beans.BeanUtils;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.stereotype.Service;
  14. import org.springframework.transaction.annotation.Transactional;
  15. import java.text.ParseException;
  16. import java.util.ArrayList;
  17. import java.util.Collection;
  18. import java.util.List;
  19. import java.util.Map;
  20. @Service
  21. @Transactional(readOnly = true)
  22. public class SweepCodeService {
  23. @Autowired
  24. private SweepCodeMapper sweepCodeMapper;
  25. @Autowired
  26. private OutScanEstateMapper outScanEstateMapper;
  27. @Autowired
  28. private RbMapper rbMapper;
  29. @Autowired
  30. private MsSuspectedMapper msSuspectedMapper;
  31. @Autowired
  32. private MsReportService msReportService;
  33. @Autowired
  34. private ScanService scanService;
  35. public List<SysUptownHouse> selectCode(PageDb pageDb, Map<String, Object> queryParam) {
  36. List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.selectCode(pageDb,queryParam);
  37. return sysUptownHouses;
  38. }
  39. // public List<SysUptownHouse> selectLingyunUser(PageDb pageDb, Map<String, Object> queryParam) {
  40. // Long userId = JwtHelper.getUserId();
  41. // if (userId > 7000 && userId < 8000) {
  42. // queryParam.put("unitId", userId);
  43. // }
  44. // queryParam.put("uptownId", 1238790987234L);
  45. // List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.selectLingyunUser(pageDb,queryParam);
  46. // return sysUptownHouses;
  47. // }
  48. public List<ExcelRiBaoLYBM4> selectLingyunUser(PageDb pageDb, Map<String, Object> queryParam, Long uptownId) throws ParseException {
  49. Long userId = JwtHelper.getUserId();
  50. if (userId > 7000 && userId < 8000) {
  51. queryParam.put("unitId", userId);
  52. }
  53. queryParam.put("uptownId", uptownId);
  54. queryParam.put("orderStr", " suu.unit_id asc,suho.linkman ");
  55. List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUserPage(pageDb,queryParam);
  56. if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
  57. String tripDet;
  58. for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
  59. if (excelRiBaoLYBM4.getIsContact() == 0) {
  60. excelRiBaoLYBM4.setIsContactDesc("否");
  61. } else if (excelRiBaoLYBM4.getIsContact() == 1) {
  62. excelRiBaoLYBM4.setIsContactDesc("是");
  63. }
  64. if (excelRiBaoLYBM4.getIsSuspected() == 0) {
  65. excelRiBaoLYBM4.setIsSuspectedDesc("否");
  66. } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
  67. excelRiBaoLYBM4.setIsSuspectedDesc("是");
  68. }
  69. tripDet = "";
  70. //出行详细
  71. List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
  72. if (listDet != null && listDet.size() > 0) {
  73. for (MsTripDet msTripDet : listDet) {
  74. tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
  75. tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
  76. tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
  77. tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
  78. }
  79. excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
  80. }
  81. // 复工
  82. excelRiBaoLYBM4.setReturnWork(scanService.returnWorkLYlist(excelRiBaoLYBM4.getUserId(), excelRiBaoLYBM4.getLinkman(), excelRiBaoLYBM4.getPhone()));
  83. }
  84. }
  85. return sysUptownHouses;
  86. }
  87. public List<ExcelRiBaoLYBM4> selectLingyunUserNotOnJob(PageDb pageDb, Map<String, Object> queryParam,Long notOnJob) throws ParseException {
  88. Long userId = JwtHelper.getUserId();
  89. if (userId > 7000 && userId < 8000) {
  90. queryParam.put("unitId", userId);
  91. }
  92. queryParam.put("notOnJob", notOnJob);
  93. queryParam.put("orderStr", " op.create_at desc ");
  94. List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUserPage(pageDb,queryParam);
  95. if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
  96. String tripDet;
  97. for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
  98. if (excelRiBaoLYBM4.getIsContact() == 0) {
  99. excelRiBaoLYBM4.setIsContactDesc("否");
  100. } else if (excelRiBaoLYBM4.getIsContact() == 1) {
  101. excelRiBaoLYBM4.setIsContactDesc("是");
  102. }
  103. if (excelRiBaoLYBM4.getIsSuspected() == 0) {
  104. excelRiBaoLYBM4.setIsSuspectedDesc("否");
  105. } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
  106. excelRiBaoLYBM4.setIsSuspectedDesc("是");
  107. }
  108. tripDet = "";
  109. //出行详细
  110. List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
  111. if (listDet != null && listDet.size() > 0) {
  112. for (MsTripDet msTripDet : listDet) {
  113. tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
  114. tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
  115. tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
  116. tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
  117. }
  118. excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
  119. }
  120. // 复工
  121. excelRiBaoLYBM4.setReturnWork(scanService.returnWorkLYlist(excelRiBaoLYBM4.getUserId(), excelRiBaoLYBM4.getLinkman(), excelRiBaoLYBM4.getPhone()));
  122. }
  123. }
  124. return sysUptownHouses;
  125. }
  126. public List<ExcelRiBaoLYBM4> HCUser(PageDb pageDb, Map<String, Object> queryParam) {
  127. queryParam.put("uptownId", 100000002L);
  128. List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUserPage(pageDb,queryParam);
  129. if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
  130. String tripDet;
  131. for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
  132. if (excelRiBaoLYBM4.getIsContact() == 0) {
  133. excelRiBaoLYBM4.setIsContactDesc("否");
  134. } else if (excelRiBaoLYBM4.getIsContact() == 1) {
  135. excelRiBaoLYBM4.setIsContactDesc("是");
  136. }
  137. if (excelRiBaoLYBM4.getIsSuspected() == 0) {
  138. excelRiBaoLYBM4.setIsSuspectedDesc("否");
  139. } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
  140. excelRiBaoLYBM4.setIsSuspectedDesc("是");
  141. }
  142. tripDet = "";
  143. //出行详细
  144. List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
  145. if (listDet != null && listDet.size() > 0) {
  146. for (MsTripDet msTripDet : listDet) {
  147. tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
  148. tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
  149. tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
  150. tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
  151. }
  152. excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
  153. }
  154. }
  155. }
  156. return sysUptownHouses;
  157. }
  158. public List<ExcelRiBaoLYBM4> selectLingyunUserHistory(PageDb pageDb, Long userId) {
  159. List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUserHistory(pageDb,userId);
  160. if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
  161. String tripDet;
  162. for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
  163. if (excelRiBaoLYBM4.getIsContact() == 0) {
  164. excelRiBaoLYBM4.setIsContactDesc("否");
  165. } else if (excelRiBaoLYBM4.getIsContact() == 1) {
  166. excelRiBaoLYBM4.setIsContactDesc("是");
  167. }
  168. if (excelRiBaoLYBM4.getIsSuspected() == 0) {
  169. excelRiBaoLYBM4.setIsSuspectedDesc("否");
  170. } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
  171. excelRiBaoLYBM4.setIsSuspectedDesc("是");
  172. }
  173. tripDet = "";
  174. //出行详细
  175. List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
  176. if (listDet != null && listDet.size() > 0) {
  177. for (MsTripDet msTripDet : listDet) {
  178. tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
  179. tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
  180. tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
  181. tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
  182. }
  183. excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
  184. }
  185. }
  186. }
  187. return sysUptownHouses;
  188. }
  189. public List<ExcelRiBaoLYBM4> exSelectLingyunUser(Map<String, Object> queryParam, Long uptownId) throws ParseException {
  190. queryParam.put("uptownId", uptownId);
  191. List<ExcelRiBaoLYBM4> sysUptownHouses = rbMapper.exSelectLingyunUser(queryParam);
  192. if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
  193. String tripDet;
  194. for (ExcelRiBaoLYBM4 excelRiBaoLYBM4 : sysUptownHouses) {
  195. if (excelRiBaoLYBM4.getIsContact() == 0) {
  196. excelRiBaoLYBM4.setIsContactDesc("否");
  197. } else if (excelRiBaoLYBM4.getIsContact() == 1) {
  198. excelRiBaoLYBM4.setIsContactDesc("是");
  199. }
  200. if (excelRiBaoLYBM4.getIsSuspected() == 0) {
  201. excelRiBaoLYBM4.setIsSuspectedDesc("否");
  202. } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
  203. excelRiBaoLYBM4.setIsSuspectedDesc("是");
  204. }
  205. if (excelRiBaoLYBM4.getReportStatus() == 0) {
  206. excelRiBaoLYBM4.setReportStatusDesc("未上报");
  207. } else if (excelRiBaoLYBM4.getMsStatus() == 1) {
  208. excelRiBaoLYBM4.setReportStatusDesc("正常");
  209. } else {
  210. excelRiBaoLYBM4.setReportStatusDesc("异常");
  211. }
  212. if(StringUtils.isNullOrEmpty(excelRiBaoLYBM4.getOldOpenId())){
  213. excelRiBaoLYBM4.setIsBand("否");
  214. }else{
  215. excelRiBaoLYBM4.setIsBand("是");
  216. }
  217. tripDet = "";
  218. //出行详细
  219. List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
  220. if (listDet != null && listDet.size() > 0) {
  221. for (MsTripDet msTripDet : listDet) {
  222. tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
  223. tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
  224. tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
  225. tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
  226. }
  227. excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
  228. }// 复工
  229. excelRiBaoLYBM4.setReturnWork(scanService.returnWorkLYlist(excelRiBaoLYBM4.getUserId(), excelRiBaoLYBM4.getLinkman(), excelRiBaoLYBM4.getPhone()));
  230. if (excelRiBaoLYBM4.getReturnWork() == 1) {
  231. excelRiBaoLYBM4.setReturnWorkMsg("允许复工");
  232. } else {
  233. excelRiBaoLYBM4.setReturnWorkMsg("禁止复工");
  234. }
  235. }
  236. }
  237. return sysUptownHouses;
  238. }
  239. public List<ExcelRiBaoHCBM4> exSelectHCUser(Map<String, Object> queryParam) {
  240. queryParam.put("uptownId", 100000002L);
  241. List<ExcelRiBaoHCBM4> sysUptownHouses = rbMapper.exSelectHCUser(queryParam);
  242. if (sysUptownHouses != null && sysUptownHouses.size() > 0) {
  243. String tripDet;
  244. for (ExcelRiBaoHCBM4 excelRiBaoLYBM4 : sysUptownHouses) {
  245. if (excelRiBaoLYBM4.getIsContact() == 0) {
  246. excelRiBaoLYBM4.setIsContactDesc("否");
  247. } else if (excelRiBaoLYBM4.getIsContact() == 1) {
  248. excelRiBaoLYBM4.setIsContactDesc("是");
  249. }
  250. if (excelRiBaoLYBM4.getIsSuspected() == 0) {
  251. excelRiBaoLYBM4.setIsSuspectedDesc("否");
  252. } else if (excelRiBaoLYBM4.getIsSuspected() == 1) {
  253. excelRiBaoLYBM4.setIsSuspectedDesc("是");
  254. }
  255. tripDet = "";
  256. //出行详细
  257. List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(excelRiBaoLYBM4.getTripId());
  258. if (listDet != null && listDet.size() > 0) {
  259. for (MsTripDet msTripDet : listDet) {
  260. tripDet += "出发地:" + msReportService.getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
  261. tripDet += "目的地:" + msReportService.getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
  262. tripDet += "出行方式:" + msReportService.getTripType(msTripDet.getTripType()) + ",";
  263. tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
  264. }
  265. excelRiBaoLYBM4.setTripDetDesc(tripDet.substring(0, tripDet.length() - 1));
  266. }
  267. }
  268. }
  269. return sysUptownHouses;
  270. }
  271. public List<SysUptownHouse> export(Map<String, Object> queryParam) {
  272. List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.export(queryParam);
  273. if(sysUptownHouses.size() != 0){
  274. for (int i = 0; i < sysUptownHouses.size(); i++) {
  275. if(sysUptownHouses.get(i).getInType() == 1 ){
  276. sysUptownHouses.get(i).setInTypeStr("进入");
  277. }else if(sysUptownHouses.get(i).getInType() == 2 ){
  278. sysUptownHouses.get(i).setInTypeStr("外出");
  279. }
  280. if(sysUptownHouses.get(i).getGoStatus() == 1 ){
  281. sysUptownHouses.get(i).setGoStatusStr("允许");
  282. }else if(sysUptownHouses.get(i).getGoStatus() == -1 ){
  283. sysUptownHouses.get(i).setGoStatusStr("禁止");
  284. }
  285. }
  286. }
  287. return sysUptownHouses;
  288. }
  289. public List<SysUptownHouseLY> selectCodeLY(PageDb pageDb, Map<String, Object> queryParam) {
  290. List<SysUptownHouseLY> sysUptownHouses = sweepCodeMapper.selectCodeLY(pageDb,queryParam);
  291. return sysUptownHouses;
  292. }
  293. public List<SysUptownHouseLY> exportLY(Map<String, Object> queryParam) {
  294. List<SysUptownHouseLY> sysUptownHouses = sweepCodeMapper.exportLY(queryParam);
  295. if(sysUptownHouses.size() != 0){
  296. for (int i = 0; i < sysUptownHouses.size(); i++) {
  297. if(sysUptownHouses.get(i).getInType() == 1 ){
  298. sysUptownHouses.get(i).setInTypeStr("进入");
  299. }else if(sysUptownHouses.get(i).getInType() == 2 ){
  300. sysUptownHouses.get(i).setInTypeStr("外出");
  301. }
  302. if(sysUptownHouses.get(i).getGoStatus() == 1 ){
  303. sysUptownHouses.get(i).setGoStatusStr("允许");
  304. }else if(sysUptownHouses.get(i).getGoStatus() == -1 ){
  305. sysUptownHouses.get(i).setGoStatusStr("禁止");
  306. }
  307. }
  308. }
  309. return sysUptownHouses;
  310. }
  311. public List<SysUptownHouseLY> selectCodeHC(PageDb pageDb, Map<String, Object> queryParam) {
  312. List<SysUptownHouseLY> sysUptownHouses = sweepCodeMapper.selectCodeHC(pageDb,queryParam);
  313. return sysUptownHouses;
  314. }
  315. public List<SysUptownHouseLY> exportHC(Map<String, Object> queryParam) {
  316. List<SysUptownHouseLY> sysUptownHouses = sweepCodeMapper.exportHC(queryParam);
  317. if(sysUptownHouses.size() != 0){
  318. for (int i = 0; i < sysUptownHouses.size(); i++) {
  319. if(sysUptownHouses.get(i).getInType() == 1 ){
  320. sysUptownHouses.get(i).setInTypeStr("进入");
  321. }else if(sysUptownHouses.get(i).getInType() == 2 ){
  322. sysUptownHouses.get(i).setInTypeStr("外出");
  323. }
  324. if(sysUptownHouses.get(i).getGoStatus() == 1 ){
  325. sysUptownHouses.get(i).setGoStatusStr("允许");
  326. }else if(sysUptownHouses.get(i).getGoStatus() == -1 ){
  327. sysUptownHouses.get(i).setGoStatusStr("禁止");
  328. }
  329. }
  330. }
  331. return sysUptownHouses;
  332. }
  333. public List<OutScanClock> selectClockLY(PageDb pageDb, Map<String, Object> queryParam) {
  334. queryParam.put("uptownId", 1238790987234L);
  335. Long userId = JwtHelper.getUserId();
  336. if (userId > 7000 && userId < 8000) {
  337. queryParam.put("unitId", userId);
  338. }
  339. List<OutScanClock> list = sweepCodeMapper.selectClockLY(pageDb,queryParam);
  340. return list;
  341. }
  342. public List<OutScanClock> exSelectClockLY(Map<String, Object> queryParam) {
  343. queryParam.put("uptownId", 1238790987234L);
  344. List<OutScanClock> list = sweepCodeMapper.exSelectClockLY(queryParam);
  345. return list;
  346. }
  347. public List<Clock> exClockCount(Map<String, Object> queryParam) {
  348. return sweepCodeMapper.exClockCount(queryParam);
  349. }
  350. public List<OutScanEstate> selectXunJian(PageDb pageDb, Map<String, Object> queryParam) {
  351. List<OutScanEstate> outScanEstates = outScanEstateMapper.selectXunJian(pageDb,queryParam);
  352. return outScanEstates;
  353. }
  354. public List<OutScanEstate> exportXunJian(Map<String, Object> queryParam) {
  355. List<OutScanEstate> outScanEstates = outScanEstateMapper.exportXunJian(queryParam);
  356. if(outScanEstates.size() != 0){
  357. for (int i = 0; i < outScanEstates.size(); i++) {
  358. if(outScanEstates.get(i).getGoStatus() == 1 ){
  359. outScanEstates.get(i).setGoStatusStr("允许");
  360. }else if(outScanEstates.get(i).getGoStatus() == -1 ){
  361. outScanEstates.get(i).setGoStatusStr("禁止");
  362. }
  363. }
  364. }
  365. return outScanEstates;
  366. }
  367. /**
  368. * 复制list实体 list -> another list
  369. * @param target 目标list实体
  370. * @param soucreList 源list实体
  371. * @param <T>
  372. * @param <F>
  373. * @return
  374. */
  375. public <T, F> List<F> listCopyToAotherList(Class<F> target, List<T> soucreList) {
  376. if (!CollectionUtils.isEmpty(soucreList)) {
  377. List<F> targetList = new ArrayList<>();
  378. for (T t : soucreList) {
  379. try {
  380. F f = target.newInstance();
  381. BeanUtils.copyProperties(t, f);
  382. targetList.add(f);
  383. } catch (Exception e) {
  384. //
  385. }
  386. }
  387. return targetList;
  388. } else {
  389. return null;
  390. }
  391. }
  392. }