AppPersonBasicInfoController.java 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. package com.sooka.sponest.mobile.comprehensive.personBasicInfoController;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.ruoyi.common.core.domain.DictKeys;
  5. import com.ruoyi.common.core.web.domain.AjaxResult;
  6. import com.ruoyi.common.core.web.page.PageDomain;
  7. import com.ruoyi.common.core.web.page.TableDataInfo;
  8. import com.ruoyi.common.core.web.page.TableSupport;
  9. import com.ruoyi.common.security.utils.DictUtils;
  10. import com.sooka.sponest.comprehensive.api.comprehensivePersonBasicInfo.domain.OtherPersonInfo;
  11. import com.sooka.sponest.comprehensive.api.comprehensivePersonBasicInfo.domain.PersonBasicInfo;
  12. import com.sooka.sponest.comprehensive.api.comprehensivePersonBasicInfo.service.RemotePersonBasicInfoService;
  13. import com.sooka.sponest.data.api.digitalenvironment.domain.EnvironmentBiggas;
  14. import org.springframework.web.bind.annotation.*;
  15. import javax.annotation.Resource;
  16. import java.util.*;
  17. import static com.ruoyi.common.security.utils.DictUtils.getComprehensiveDictCacheToMap;
  18. /**
  19. * @Author LG
  20. * @Date 2023/9/8 - 9:38
  21. */
  22. @RestController
  23. @RequestMapping("/AppPersonBasicInfoController")
  24. public class AppPersonBasicInfoController {
  25. @Resource
  26. private RemotePersonBasicInfoService personBasicInfoService;
  27. /**
  28. * 查询人员信息列表
  29. */
  30. @GetMapping("/PersonBasicInfo/list")
  31. public AjaxResult list(PersonBasicInfo info) {
  32. PageDomain pageDomain = TableSupport.buildPageRequest();
  33. Integer pageNum = pageDomain.getPageNum();
  34. Integer pageSize = pageDomain.getPageSize();
  35. Integer delFlag = info.getDelFlag();
  36. List<HashMap<String, Object>> rows = (List<HashMap<String, Object>>) personBasicInfoService.getList(pageNum, pageSize, delFlag).getRows();
  37. Map<String, Object> comprehensiveSexMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX);//性别字典值
  38. Map<String, Object> comprehensiveNationMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_NATION);//民族字典值
  39. Map<String, Object> comprehensiveMaritalStatusMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_MARITAL_STATUS);//婚姻状况字典值
  40. Map<String, Object> comprehensiveEducationalBackgroundMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND);//学历字典值
  41. Map<String, Object> comprehensiveReligiousBeliefMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_RELIGIOUS_BELIEF);//宗教信仰字典值
  42. Map<String, Object> comprehensivePoliticalStatusMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_POLITICAL_STATUS);//政治面貌字典值
  43. Map<String, Object> comprehensiveOccupationalCategoryMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_OCCUPATIONAL_CATEGORY);//职业类别字典值
  44. Map<String, Object> comprehensiveCityCodeMap = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);//2260
  45. for (HashMap<String, Object> row : rows) {
  46. row.put("genderLabel", comprehensiveSexMap.get(row.get("gender")));//性别字典值
  47. row.put("nationLabel", comprehensiveNationMap.get(row.get("nation")));//民族字典值
  48. row.put("maritalStatusLabel", comprehensiveMaritalStatusMap.get(row.get("maritalStatus")));//婚姻状况字典值
  49. row.put("educationLabel", comprehensiveEducationalBackgroundMap.get(row.get("education")));//学历字典值
  50. row.put("religiousBeliefLabel", null == row.get("religiousBelief") ? null : comprehensiveReligiousBeliefMap.get(row.get("religiousBelief")));//宗教信仰字典值
  51. row.put("politicalOutlookLabel", comprehensivePoliticalStatusMap.get(row.get("politicalOutlook")));//政治面貌字典值
  52. row.put("occupationalCategoryLabel", comprehensiveOccupationalCategoryMap.get(row.get("occupationalCategory")));//职业类别字典值
  53. row.put("householdRegistrationLabel", comprehensiveCityCodeMap.get(row.get("householdRegistration")));//户籍地 2260
  54. row.put("nativePlaceLabel", comprehensiveCityCodeMap.get(row.get("nativePlace")));//籍贯 2260
  55. }
  56. return AjaxResult.success(rows);
  57. }
  58. /**
  59. * 查询人员信息详情
  60. */
  61. @GetMapping("/PersonBasicInfo/edit")
  62. public AjaxResult getInfo(EnvironmentBiggas biggas) {
  63. AjaxResult ajaxResult = personBasicInfoService.getEdit(biggas.getId());
  64. if ("200".equals(ajaxResult.get("code").toString())) {
  65. Map<String, Object> data = (Map<String, Object>) ajaxResult.get("data");
  66. HashMap<String, Object> basicInfo = (HashMap<String, Object>) data.get("basicInfo");
  67. setPersonBasicInfo(basicInfo);
  68. List<HashMap<String, Object>> userBinds = (List<HashMap<String, Object>>) basicInfo.get("userBinds");
  69. ArrayList<HashMap<String, Object>> otherInfo = (ArrayList<HashMap<String, Object>>) data.get("otherInfo");
  70. Map<String, Object> result = new HashMap<>();
  71. result.put("basicInfo",data.get("basicInfo"));
  72. userBinds.forEach(bind -> {
  73. otherInfo.stream()
  74. .filter(info -> info.get("id").equals(bind.get("otherPersonId")))
  75. .findFirst()
  76. .ifPresent(info -> setLabel(info, (Integer) bind.get("otherPersonType")));
  77. });
  78. otherInfo.forEach(bind ->{
  79. switch(String.valueOf(bind.get("otherPersonType"))){
  80. case "1":
  81. result.put("registeredPopulation", bind);
  82. break;
  83. case "2":
  84. result.put("floatingPopulation", bind);
  85. break;
  86. case "3":
  87. result.put("leftBehindPerson", bind);
  88. break;
  89. case "4":
  90. result.put("campusAroundPerson", bind);
  91. break;
  92. case "5":
  93. result.put("prisonReleased", bind);
  94. break;
  95. case "6":
  96. result.put("communityCorrectionStaff", bind);
  97. break;
  98. case "7":
  99. result.put("psychosisPopulation", bind);
  100. break;
  101. case "8":
  102. result.put("drugAddict", bind);
  103. break;
  104. case "9":
  105. result.put("aidsRisk", bind);
  106. break;
  107. case "10":
  108. result.put("keyYouth", bind);
  109. break;
  110. }
  111. });
  112. return AjaxResult.success(result);
  113. } else {
  114. return ajaxResult;
  115. }
  116. }
  117. /**
  118. * 根据给定的人员类型,设置字典中文值
  119. */
  120. private void setLabel(HashMap<String, Object> json, Integer type) {
  121. switch (type) {
  122. case 1:
  123. setRegisteredPopulation(json);
  124. break;
  125. case 2:
  126. setFloatingPopulation(json);
  127. break;
  128. case 3:
  129. setLeftBehindPerson(json);
  130. break;
  131. case 4:
  132. setCampusAroundPerson(json);
  133. break;
  134. case 5:
  135. setPrisonReleased(json);
  136. break;
  137. case 6:
  138. setCommunityCorrectionStaff(json);
  139. break;
  140. case 7:
  141. setPsychosisPopulation(json);
  142. break;
  143. case 8:
  144. setDrugAddict(json);
  145. break;
  146. case 9:
  147. setAidsRisk(json);
  148. break;
  149. case 10:
  150. setKeyYouth(json);
  151. break;
  152. }
  153. json.put("otherPersonType", type);
  154. }
  155. /**
  156. * 新增人员信息
  157. */
  158. @PostMapping("/PersonBasicInfo")
  159. public AjaxResult add(@RequestBody String json) {
  160. return personBasicInfoService.add(dataToList(json));
  161. }
  162. /**
  163. * 修改人员信息
  164. */
  165. @PostMapping("/PersonBasicInfo/put")
  166. public AjaxResult edit(@RequestBody String json) {
  167. return personBasicInfoService.edit(dataToList(json));
  168. }
  169. /**
  170. * 数据格式转换,将JSONString类型替换为List
  171. */
  172. private String dataToList(String json){
  173. JSONObject jsonObject = JSONObject.parseObject(json);
  174. Set<String> strings = jsonObject.keySet();
  175. JSONArray list = new JSONArray();
  176. list.add(jsonObject.getJSONObject("basicInfo"));
  177. strings.remove("basicInfo");
  178. for (String string : strings) {
  179. list.add(jsonObject.getJSONObject(string));
  180. }
  181. return JSONArray.toJSONString(list);
  182. }
  183. /**
  184. * 删除人员信息
  185. */
  186. @GetMapping("/PersonBasicInfo/del")
  187. public AjaxResult remove(@RequestParam("id") List<String> id) {
  188. return personBasicInfoService.del(id.toArray(new String[0]));
  189. }
  190. /**
  191. * 审核删除人员信息
  192. * state = 2 通过, state = 1 拒绝
  193. */
  194. @GetMapping("/PersonBasicInfo/delInfo")
  195. public AjaxResult delInfo(@RequestParam("id") String id, @RequestParam("state") String state){
  196. return personBasicInfoService.delInfo(id, state);
  197. }
  198. /**
  199. * 设置人员基础信息字典值
  200. */
  201. private void setPersonBasicInfo(HashMap<String, Object> basicInfo) {//0
  202. Map<String, Object> comprehensiveDictCacheToMap = getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);
  203. basicInfo.put("genderLabel", getDictData(DictKeys.COMPREHENSIVE_SEX, String.valueOf(basicInfo.get("gender"))));//性别字典值
  204. basicInfo.put("nationLabel", getDictData(DictKeys.COMPREHENSIVE_NATION, String.valueOf(basicInfo.get("nation"))));//民族字典值
  205. basicInfo.put("maritalStatusLabel", getDictData(DictKeys.COMPREHENSIVE_MARITAL_STATUS, String.valueOf(basicInfo.get("maritalStatus"))));//婚姻状况字典值
  206. basicInfo.put("educationLabel", getDictData(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND, String.valueOf(basicInfo.get("education"))));//学历字典值
  207. basicInfo.put("religiousBeliefLabel", null == basicInfo.get("religiousBelief") ? null : getDictData(DictKeys.COMPREHENSIVE_RELIGIOUS_BELIEF, String.valueOf(basicInfo.get("religiousBelief"))));//宗教信仰字典值
  208. basicInfo.put("politicalOutlookLabel", getDictData(DictKeys.COMPREHENSIVE_POLITICAL_STATUS, String.valueOf(basicInfo.get("politicalOutlook"))));//政治面貌字典值
  209. basicInfo.put("occupationalCategoryLabel", getDictData(DictKeys.COMPREHENSIVE_OCCUPATIONAL_CATEGORY, String.valueOf(basicInfo.get("occupationalCategory"))));//职业类别字典值
  210. basicInfo.put("householdRegistrationLabel", comprehensiveDictCacheToMap.get(String.valueOf(basicInfo.get("householdRegistration"))));
  211. basicInfo.put("nativePlaceLabel", comprehensiveDictCacheToMap.get(String.valueOf(basicInfo.get("nativePlace"))));
  212. // basicInfo.put("householdRegistrationLabel", getDictData(DictKeys.COMPREHENSIVE_CITY_CODE, String.valueOf(basicInfo.get("householdRegistration"))));//户籍地 2260
  213. // basicInfo.put("nativePlaceLabel", getDictData(DictKeys.COMPREHENSIVE_CITY_CODE, String.valueOf(basicInfo.get("nativePlace"))));//籍贯 2260
  214. }
  215. /**
  216. * 设置户籍人口字典值
  217. */
  218. private void setRegisteredPopulation(HashMap<String, Object> json) {//1
  219. json.put("entryIdentityLabel", getDictData(DictKeys.COMPREHENSIVE_HOUSEHOLDS_IDENTIFICATION, String.valueOf(json.get("entryIdentity"))));//人户一致标识
  220. json.put("accountRelationshipLabel", getDictData(DictKeys.COMPREHENSIVE_RELATION, String.valueOf(json.get("accountRelationship"))));//与户主关系
  221. }
  222. /**
  223. * 设置流动人口字典值
  224. */
  225. private void setFloatingPopulation(HashMap<String, Object> json) {//2
  226. json.put("inflowCauselabel", getDictData(DictKeys.COMPREHENSIVE_INFLOW_REASON, String.valueOf(json.get("inflowCause"))));//流入原因
  227. json.put("focusPeopleLabel", "1".equals(json.get("focusPeople")) ? "是" : "否");//是否重点关注人员
  228. json.put("certificationTypeLabel", null == json.get("certificationType") ? null : getDictData(DictKeys.COMPREHENSIVE_CERTIFICATION_TYPE, String.valueOf(json.get("certificationType"))));//办证类型
  229. json.put("domicileTypeLabel", getDictData(DictKeys.COMPREHENSIVE_RESIDENCE_TYPE, String.valueOf(json.get("domicileType"))));//住所类型
  230. }
  231. /**
  232. * 设置留守人口字典值
  233. */
  234. private void setLeftBehindPerson(HashMap<String, Object> json) {//3
  235. json.put("entryIdentityLabel", getDictData(DictKeys.COMPREHENSIVE_HOUSEHOLDS_IDENTIFICATION, String.valueOf(json.get("entryIdentity"))));//人户一致标识
  236. json.put("leftBehindTypeLabel", getDictData(DictKeys.COMPREHENSIVE_LEFT_BEHIND_PERSONNEL_TYPE, String.valueOf(json.get("leftBehindType"))));//留守人员类型
  237. json.put("healthStatusLabel", null == json.get("healthStatus") ? null : getDictData(DictKeys.COMPREHENSIVE_HEALTH_STATUS, String.valueOf(json.get("healthStatus"))));//健康状况
  238. json.put("leftBehindRelationshipLabel", getDictData(DictKeys.COMPREHENSIVE_RELATION, String.valueOf(json.get("leftBehindRelationship"))));//与留守人员关系
  239. json.put("keyFamilyHealthStatusLabel", null == json.get("keyFamilyHealthStatus") ? null : getDictData(DictKeys.COMPREHENSIVE_HEALTH_STATUS, String.valueOf(json.get("keyFamilyHealthStatus"))));//家庭主要成员健康状况
  240. }
  241. /**
  242. * 设置校园周边重点人员字典值
  243. */
  244. private void setCampusAroundPerson(HashMap<String, Object> json) {//4
  245. json.put("harmLevelLabel", getDictData(DictKeys.COMPREHENSIVE_DEGREE_OF_HARM, String.valueOf(json.get("harmLevel"))));//危害程度
  246. json.put("focusPeopleLabel", "1".equals(json.get("focusPeople")) ? "是" : "否");//是否关注
  247. }
  248. /**
  249. * 设置刑满释放人员字典值
  250. */
  251. private void setPrisonReleased(HashMap<String, Object> json) {//5
  252. json.put("originalChargeLabel", getDictData(DictKeys.COMPREHENSIVE_OFFENCES_CLASSIFICATION, String.valueOf(json.get("originalCharge"))));//原罪名
  253. json.put("recidivismLabel", "1".equals(json.get("recidivism")) ? "是" : "否");//是否累犯
  254. json.put("riskAssessmentTypeLabel", getDictData(DictKeys.COMPREHENSIVE_HAZARD_ASSESSMENT_TYPE, String.valueOf(json.get("riskAssessmentType"))));//危险性评估类型
  255. json.put("linkUpStatusLabel", getDictData(DictKeys.COMPREHENSIVE_CONNECTION, String.valueOf(json.get("linkUpStatus"))));//衔接情况
  256. json.put("placementStatusLabel", getDictData(DictKeys.COMPREHENSIVE_PLACEMENT, String.valueOf(json.get("placementStatus"))));//安置情况
  257. json.put("reoffendLabel", "1".equals(json.get("reoffend")) ? "是" : "否");//是否重新犯罪
  258. }
  259. /**
  260. * 设置社区矫正人员字典值
  261. */
  262. private void setCommunityCorrectionStaff(HashMap<String, Object> json) {//6
  263. json.put("caseCategoryLabel", getDictData(DictKeys.COMPREHENSIVE_CASE_CATEGORY, String.valueOf(json.get("caseCategory"))));//案件类别
  264. json.put("correctiveReleaseTypeLabel", null == json.get("correctiveReleaseType") ? null : getDictData(DictKeys.COMPREHENSIVE_CORRECTIVE_RELEASE_TYPE, String.valueOf(json.get("correctiveReleaseType"))));//矫正解除(终止)类型
  265. json.put("receivingModeLabel", getDictData(DictKeys.COMPREHENSIVE_RECEIVING_METHOD, String.valueOf(json.get("receivingMode"))));//接收方式
  266. json.put("correctionClassLabel", getDictData(DictKeys.COMPREHENSIVE_CORRECTIVE_CATEGORY, String.valueOf(json.get("correctionClass"))));//矫正类别
  267. json.put("tubeLabel", "1".equals(json.get("tube")) ? "是" : "否");//是否有脱管
  268. json.put("leakingPipesLabel", "1".equals(json.get("leakingPipes")) ? "是" : "否");//是否有漏管
  269. json.put("recidivismLabel", null == json.get("recidivism") ? null : "1".equals(json.get("recidivism")) ? "是" : "否");//是否累惯犯
  270. json.put("establishCorrectionTeamLabel", "1".equals(json.get("establishCorrectionTeam")) ? "是" : "否");//是否建立矫正小组
  271. json.put("reoffendLabel", "1".equals(json.get("reoffend")) ? "是" : "否");//是否重新犯罪
  272. json.put("fourHistoriesListLabel", getDictDataList(DictKeys.COMPREHENSIVE_FOUR_HISTORIES_SITUATION, (List<String>) json.get("fourHistoriesList")));//“四史”情况
  273. json.put("threeStepListLabel", getDictDataList(DictKeys.COMPREHENSIVE_THREE_INVOLVED_SITUATION, (List<String>) json.get("threeStepList")));//“三涉”情况
  274. json.put("correctionTeamCompositionListLabel", getDictDataList(DictKeys.COMPREHENSIVE_CORRECTIONS_TEAM_COMPOSITION_TYPE, (List<String>) json.get("correctionTeamCompositionList")));//矫正小组人员组成情况
  275. }
  276. /**
  277. * 设置肇事肇祸及严重精神障碍患者字典值
  278. */
  279. private void setPsychosisPopulation(HashMap<String, Object> json) {//7
  280. json.put("familyEconomicSituationLabel", null == json.get("familyEconomicSituationLabel") ? null : getDictData(DictKeys.COMPREHENSIVE_HOUSEHOLDS_FINANCIAL_SITUATION, String.valueOf(json.get("familyEconomicSituationLabel"))));//家庭经济状况
  281. json.put("subsistenceAllowanceLabel", "1".equals(json.get("subsistenceAllowance")) ? "是" : "否");//是否纳入低保
  282. json.put("diagnosisTypeLabel", getDictData(DictKeys.COMPREHENSIVE_CURRENT_DIAGNOSTIC, String.valueOf(json.get("diagnosisType"))));//目前诊断类型
  283. json.put("historyCausingAccidentsLabel", "1".equals(json.get("historyCausingAccidents")) ? "有" : "无");//有无肇事肇祸史
  284. json.put("riskAssessmentLevelLabel", getDictData(DictKeys.COMPREHENSIVE_HAZARD_ASSESSMENT, String.valueOf(json.get("riskAssessmentLevel"))));//目前危险性评估等级
  285. json.put("treatmentSituationLabel", getDictData(DictKeys.COMPREHENSIVE_TREATMENT_CONDITIONS, String.valueOf(json.get("treatmentSituation"))));//治疗情况
  286. json.put("reasonsHospitalizationListLabel", getDictDataList(DictKeys.COMPREHENSIVE_HOSPITALIZATION_REASONS, (List<String>) json.get("reasonsHospitalizationList")));//实施住院治疗原因
  287. json.put("participatingManagersListLabel", getDictDataList(DictKeys.COMPREHENSIVE_MANAGERS, (List<String>) json.get("participatingManagersList")));//参与管理人员
  288. json.put("assistanceSituationListLabel", getDictDataList(DictKeys.COMPREHENSIVE_HELP_SITUATION, (List<String>) json.get("assistanceSituationList")));//帮扶情况
  289. }
  290. /**
  291. * 设置吸毒人员字典值
  292. */
  293. private void setDrugAddict(HashMap<String, Object> json) {//8
  294. json.put("controlSituationLabel", getDictData(DictKeys.COMPREHENSIVE_GOVERNANCE, String.valueOf(json.get("controlSituation"))));//管控情况
  295. json.put("criminalHistoryLabel", null == json.get("criminalHistory") ? null : "1".equals(json.get("criminalHistory")) ? "有" : "无");//有无犯罪史
  296. json.put("drugUseLabel", getDictData(DictKeys.COMPREHENSIVE_CASE_CONSEQUENCE, String.valueOf(json.get("drugUse"))));//吸毒原因
  297. json.put("drugAbuseLabel", null == json.get("drugAbuse") ? null : getDictData(DictKeys.COMPREHENSIVE_CASE_CONSEQUENCE, String.valueOf(json.get("drugAbuse"))));//吸毒后果
  298. }
  299. /**
  300. * 设置艾滋病危险人员字典值
  301. */
  302. private void setAidsRisk(HashMap<String, Object> json) {//9
  303. json.put("routeInfectionLabel", getDictData(DictKeys.COMPREHENSIVE_ROUTE_OF_INFECTION, String.valueOf(json.get("routeInfection"))));//感染途径
  304. json.put("criminalHistoryLabel", "1".equals(json.get("criminalHistory")) ? "是" : "否");//是否有违法犯罪史
  305. json.put("caseCategoryLabel", null == json.get("caseCategory") ? null : getDictData(DictKeys.COMPREHENSIVE_CASE_CATEGORY, String.valueOf(json.get("caseCategory"))));//案件类别
  306. json.put("concernTypeLabel", getDictData(DictKeys.COMPREHENSIVE_TYPE_OF_CONCERN, String.valueOf(json.get("concernType"))));//关注类型
  307. json.put("admissionSituationLabel", null == json.get("admissionSituation") ? null : getDictData(DictKeys.COMPREHENSIVE_ADMISSION_TO_INERTIA, String.valueOf(json.get("admissionSituation"))));//收治情况
  308. }
  309. /**
  310. * 设置重点青少年字典值
  311. */
  312. private void setKeyYouth(HashMap<String, Object> json) {//10
  313. json.put("personTypeLabel", null == json.get("personType") ? null : getDictData(DictKeys.COMPREHENSIVE_TYPE_OF_PERSON, String.valueOf(json.get("personType"))));//人员类型
  314. json.put("familySituationLabel", getDictData(DictKeys.COMPREHENSIVE_FAMILY_INERTIA, String.valueOf(json.get("familySituation"))));//家庭情况
  315. json.put("guardianRelationLabel", getDictData(DictKeys.COMPREHENSIVE_RELATION, String.valueOf(json.get("guardianRelation"))));//与监护人关系
  316. json.put("reoffendLabel", "1".equals(json.get("reoffend")) ? "是" : "否");//是否违法犯罪
  317. json.put("meansAssistanceLabel", getDictData(DictKeys.COMPREHENSIVE_MEANS_OF_HELP, String.valueOf(json.get("meansAssistance"))));//帮扶手段
  318. }
  319. private String getDictData(String dictKey, String value) {
  320. return DictUtils.getDictDataByValue(dictKey, value);
  321. }
  322. private List<String> getDictDataList(String dictKey, List<String> values) {
  323. return DictUtils.getDictDataListByValue(dictKey, values);
  324. }
  325. /**
  326. * 查询其他人员类型列表
  327. */
  328. @GetMapping("/PersonBasicInfo/getOtherList")
  329. public AjaxResult getOtherList(PersonBasicInfo personBasicInfo){
  330. PageDomain pageDomain = TableSupport.buildPageRequest();
  331. Integer pageNum = pageDomain.getPageNum();
  332. Integer pageSize = pageDomain.getPageSize();
  333. Integer delFlag = personBasicInfo.getDelFlag();
  334. Integer personType = personBasicInfo.getPersonType();
  335. List<HashMap<String, Object>> rows = (List<HashMap<String, Object>>) personBasicInfoService.getOtherList(pageNum, pageSize, delFlag, personType).getRows();
  336. Map<String, Object> comprehensiveSexMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX);//性别字典值
  337. Map<String, Object> comprehensiveNationMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_NATION);//民族字典值
  338. Map<String, Object> comprehensiveMaritalStatusMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_MARITAL_STATUS);//婚姻状况字典值
  339. Map<String, Object> comprehensiveEducationalBackgroundMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND);//学历字典值
  340. Map<String, Object> comprehensiveReligiousBeliefMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_RELIGIOUS_BELIEF);//宗教信仰字典值
  341. Map<String, Object> comprehensivePoliticalStatusMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_POLITICAL_STATUS);//政治面貌字典值
  342. Map<String, Object> comprehensiveOccupationalCategoryMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_OCCUPATIONAL_CATEGORY);//职业类别字典值
  343. Map<String, Object> comprehensiveDictCacheToMap = getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);// 2260
  344. if( null != rows && !rows.isEmpty()){
  345. for (HashMap row : rows) {
  346. row.put("genderLabel", comprehensiveSexMap.get(row.get("gender")));//性别字典值
  347. row.put("nationLabel", comprehensiveNationMap.get(row.get("nation")));//民族字典值
  348. row.put("maritalStatusLabel", comprehensiveMaritalStatusMap.get(row.get("maritalStatus")));//婚姻状况字典值
  349. row.put("educationLabel", comprehensiveEducationalBackgroundMap.get(row.get("education")));//学历字典值
  350. row.put("religiousBeliefLabel", null == row.get("religiousBelief") ? null : comprehensiveReligiousBeliefMap.get(row.get("religiousBelief")));//宗教信仰字典值
  351. row.put("politicalOutlookLabel", comprehensivePoliticalStatusMap.get(row.get("politicalOutlook")));//政治面貌字典值
  352. row.put("occupationalCategoryLabel", comprehensiveOccupationalCategoryMap.get(row.get("occupationalCategory")));//职业类别字典值
  353. row.put("householdRegistrationLabel", comprehensiveDictCacheToMap.get(row.get("householdRegistration")));//户籍地 2260
  354. row.put("nativePlaceLabel", comprehensiveDictCacheToMap.get(row.get("nativePlace")));//籍贯 2260
  355. }
  356. return AjaxResult.success(rows);
  357. }else{
  358. return AjaxResult.error(500, "list is null!");
  359. }
  360. }
  361. /**
  362. * 查询其他类型人员详情
  363. */
  364. @GetMapping("/PersonBasicInfo/getOtherEdit")
  365. public AjaxResult getOtherEdit(OtherPersonInfo otherPersonInfo){
  366. AjaxResult otherEdit = personBasicInfoService.getOtherEdit(otherPersonInfo.getBasicId(), otherPersonInfo.getPersonType());
  367. if ("200".equals(otherEdit.get("code").toString())){
  368. Map<String, Object> comprehensiveDictCacheToMap = getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);// 2260
  369. HashMap<String, HashMap<String, Object>> data = (HashMap<String, HashMap<String, Object>>) otherEdit.get("data");
  370. setPersonBasicInfo(data.get("basicInfo"));
  371. if (!comprehensiveDictCacheToMap.isEmpty()) {
  372. data.computeIfPresent("basicInfo", (key, basicInfo) -> {
  373. basicInfo.put("householdRegistrationLabel", comprehensiveDictCacheToMap.get(basicInfo.get("householdRegistration")));// 户籍地 2260
  374. basicInfo.put("nativePlaceLabel", comprehensiveDictCacheToMap.get(basicInfo.get("nativePlace")));// 籍贯 2260
  375. return basicInfo;
  376. });
  377. }
  378. switch (otherPersonInfo.getPersonType()){
  379. case 1:
  380. setRegisteredPopulation(data.get("otherInfo"));
  381. data.put("registeredPopulation", data.remove("otherInfo"));
  382. break;
  383. case 2:
  384. setFloatingPopulation(data.get("otherInfo"));
  385. data.put("floatingPopulation", data.remove("otherInfo"));
  386. break;
  387. case 3:
  388. setLeftBehindPerson(data.get("otherInfo"));
  389. data.put("leftBehindPerson", data.remove("otherInfo"));
  390. break;
  391. case 4:
  392. setCampusAroundPerson(data.get("otherInfo"));
  393. data.put("campusAroundPerson", data.remove("otherInfo"));
  394. break;
  395. case 5:
  396. setPrisonReleased(data.get("otherInfo"));
  397. data.put("prisonReleased", data.remove("otherInfo"));
  398. break;
  399. case 6:
  400. setCommunityCorrectionStaff(data.get("otherInfo"));
  401. data.put("communityCorrectionStaff", data.remove("otherInfo"));
  402. break;
  403. case 7:
  404. setPsychosisPopulation(data.get("otherInfo"));
  405. data.put("psychosisPopulation", data.remove("otherInfo"));
  406. break;
  407. case 8:
  408. setDrugAddict(data.get("otherInfo"));
  409. data.put("drugAddict", data.remove("otherInfo"));
  410. break;
  411. case 9:
  412. setAidsRisk(data.get("otherInfo"));
  413. data.put("aidsRisk", data.remove("otherInfo"));
  414. break;
  415. case 10:
  416. setKeyYouth(data.get("otherInfo"));
  417. data.put("keyYouth", data.remove("otherInfo"));
  418. break;
  419. default:
  420. break;
  421. }
  422. return AjaxResult.success(data);
  423. }else{
  424. return AjaxResult.error(otherEdit.get("code").toString(), otherEdit.get("msg"));
  425. }
  426. }
  427. /**
  428. * 查询全部有效的用户信息
  429. */
  430. @GetMapping("/PersonBasicInfo/getAllUserInfo")
  431. public AjaxResult getAllUserInfo(PersonBasicInfo personBasicInfo){
  432. AjaxResult allUserInfo = personBasicInfoService.getAllUserInfo(personBasicInfo.getName());
  433. if ("200".equals(allUserInfo.get("code").toString())){
  434. Map<String, Object> comprehensiveDictCacheToMap = getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);// 2260
  435. List<Map<String, Object>> data = (List<Map<String, Object>>) allUserInfo.get("data");
  436. for (Map<String, Object> map : data) {
  437. map.put("householdRegistrationLabel", comprehensiveDictCacheToMap.get(map.get("householdRegistration")));// 户籍地 2260
  438. map.put("nativePlaceLabel", comprehensiveDictCacheToMap.get(map.get("nativePlace")));// 籍贯 2260
  439. map.put("currentResidencePlaceLabel", comprehensiveDictCacheToMap.get(map.get("currentResidencePlace")));// 2260
  440. }
  441. }
  442. return allUserInfo;
  443. }
  444. }