AppPersonBasicInfoController.java 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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.constant.HttpStatus;
  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.ruoyi.common.core.domain.DictKeys;
  14. import com.sooka.sponest.data.api.digitalenvironment.domain.EnvironmentBiggas;
  15. import org.springframework.web.bind.annotation.*;
  16. import javax.annotation.Resource;
  17. import java.util.*;
  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. return AjaxResult.success(personBasicInfoService.getList(pageNum, pageSize, delFlag).getRows());
  37. }
  38. /**
  39. * 获取重点企业详细信息
  40. */
  41. @GetMapping("/PersonBasicInfo/edit")
  42. public AjaxResult getInfo(EnvironmentBiggas biggas) {
  43. AjaxResult ajaxResult = personBasicInfoService.getEdit(biggas.getId());
  44. if ("200".equals(ajaxResult.get("code").toString())) {
  45. Map<String, Object> data = (Map<String, Object>) ajaxResult.get("data");
  46. HashMap<String, Object> basicInfo = (HashMap<String, Object>) data.get("basicInfo");
  47. setPersonBasicInfo(basicInfo);
  48. List<HashMap<String, Object>> userBinds = (List<HashMap<String, Object>>) basicInfo.get("userBinds");
  49. ArrayList<HashMap<String, Object>> otherInfo = (ArrayList<HashMap<String, Object>>) data.get("otherInfo");
  50. Map<String, Object> result = new HashMap<>();
  51. result.put("basicInfo",data.get("basicInfo"));
  52. userBinds.forEach(bind -> {
  53. otherInfo.stream()
  54. .filter(info -> info.get("id").equals(bind.get("otherPersonId")))
  55. .findFirst()
  56. .ifPresent(info -> setLabel(info, (Integer) bind.get("otherPersonType")));
  57. });
  58. otherInfo.forEach(bind ->{
  59. switch(String.valueOf(bind.get("otherPersonType"))){
  60. case "1":
  61. result.put("registeredPopulation", bind);
  62. break;
  63. case "2":
  64. result.put("floatingPopulation", bind);
  65. break;
  66. case "3":
  67. result.put("leftBehindPerson", bind);
  68. break;
  69. case "4":
  70. result.put("campusAroundPerson", bind);
  71. break;
  72. case "5":
  73. result.put("prisonReleased", bind);
  74. break;
  75. case "6":
  76. result.put("communityCorrectionStaff", bind);
  77. break;
  78. case "7":
  79. result.put("psychosisPopulation", bind);
  80. break;
  81. case "8":
  82. result.put("drugAddict", bind);
  83. break;
  84. case "9":
  85. result.put("aidsRisk", bind);
  86. break;
  87. case "10":
  88. result.put("keyYouth", bind);
  89. break;
  90. }
  91. });
  92. return AjaxResult.success(result);
  93. } else {
  94. return ajaxResult;
  95. }
  96. }
  97. private void setLabel(HashMap<String, Object> json, Integer type) {
  98. switch (type) {
  99. case 1:
  100. setRegisteredPopulation(json);
  101. break;
  102. case 2:
  103. setFloatingPopulation(json);
  104. break;
  105. case 3:
  106. setLeftBehindPerson(json);
  107. break;
  108. case 4:
  109. setCampusAroundPerson(json);
  110. break;
  111. case 5:
  112. setPrisonReleased(json);
  113. break;
  114. case 6:
  115. setCommunityCorrectionStaff(json);
  116. break;
  117. case 7:
  118. setPsychosisPopulation(json);
  119. break;
  120. case 8:
  121. setDrugAddict(json);
  122. break;
  123. case 9:
  124. setAidsRisk(json);
  125. break;
  126. case 10:
  127. setKeyYouth(json);
  128. break;
  129. }
  130. json.put("otherPersonType", type);
  131. }
  132. /**
  133. * 新增重点企业
  134. */
  135. @PostMapping("/PersonBasicInfo")
  136. public AjaxResult add(@RequestBody String json) {
  137. return personBasicInfoService.add(dataToList(json));
  138. }
  139. /**
  140. * 修改重点企业
  141. */
  142. @PostMapping("/PersonBasicInfo/put")
  143. public AjaxResult edit(@RequestBody String json) {
  144. return personBasicInfoService.edit(dataToList(json));
  145. }
  146. private String dataToList(String json){
  147. JSONObject jsonObject = JSONObject.parseObject(json);
  148. Set<String> strings = jsonObject.keySet();
  149. JSONArray list = new JSONArray();
  150. list.add(jsonObject.getJSONObject("basicInfo"));
  151. strings.remove("basicInfo");
  152. for (String string : strings) {
  153. list.add(jsonObject.getJSONObject(string));
  154. }
  155. return JSONArray.toJSONString(list);
  156. }
  157. /**
  158. * 删除重点企业
  159. */
  160. @GetMapping("/PersonBasicInfo/del")
  161. public AjaxResult remove(@RequestParam("id") List<String> id) {
  162. return personBasicInfoService.del(id.toArray(new String[0]));
  163. }
  164. // private void setPersonBasicInfo(JSONObject basicInfo){
  165. private void setPersonBasicInfo(HashMap<String, Object> basicInfo) {//0
  166. basicInfo.put("genderLabel", getDictData("comprehensive_sex", String.valueOf(basicInfo.get("gender"))));//性别字典值
  167. basicInfo.put("nationLabel", getDictData("comprehensive_nation", String.valueOf(basicInfo.get("nation"))));//民族字典值
  168. basicInfo.put("maritalStatusLabel", getDictData("comprehensive_marital_status", String.valueOf(basicInfo.get("maritalStatus"))));//婚姻状况字典值
  169. basicInfo.put("educationLabel", getDictData("comprehensive_educational_background", String.valueOf(basicInfo.get("education"))));//学历字典值
  170. basicInfo.put("religiousBeliefLabel", null == basicInfo.get("religiousBelief") ? null : getDictData("comprehensive_religious_belief", String.valueOf(basicInfo.get("religiousBelief"))));//宗教信仰字典值
  171. basicInfo.put("politicalOutlookLabel", getDictData("comprehensive_political_status", String.valueOf(basicInfo.get("politicalOutlook"))));//政治面貌字典值
  172. basicInfo.put("occupationalCategoryLabel", getDictData("comprehensive_occupational_category", String.valueOf(basicInfo.get("occupationalCategory"))));//职业类别字典值
  173. }
  174. private void setRegisteredPopulation(HashMap<String, Object> json) {//1
  175. json.put("entryIdentityLabel", getDictData(DictKeys.COMPREHENSIVE_HOUSEHOLDS_IDENTIFICATION, String.valueOf(json.get("entryIdentity"))));//人户一致标识
  176. json.put("accountRelationshipLabel", getDictData("comprehensive_relation", String.valueOf(json.get("accountRelationship"))));//与户主关系
  177. }
  178. private void setFloatingPopulation(HashMap<String, Object> json) {//2
  179. json.put("inflowCauselabel", getDictData("comprehensive_inflow_reason", String.valueOf(json.get("inflowCause"))));//流入原因
  180. json.put("focusPeopleLabel", "1".equals(json.get("focusPeople")) ? "是" : "否");//是否重点关注人员
  181. json.put("certificationTypeLabel", null == json.get("certificationType") ? null : getDictData(DictKeys.COMPREHENSIVE_CERTIFICATION_TYPE, String.valueOf(json.get("certificationType"))));//办证类型
  182. json.put("domicileTypeLabel", getDictData(DictKeys.COMPREHENSIVE_RESIDENCE_TYPE, String.valueOf(json.get("domicileType"))));//住所类型
  183. }
  184. private void setLeftBehindPerson(HashMap<String, Object> json) {//3
  185. json.put("entryIdentityLabel", getDictData(DictKeys.COMPREHENSIVE_HOUSEHOLDS_IDENTIFICATION, String.valueOf(json.get("entryIdentity"))));//人户一致标识
  186. json.put("leftBehindTypeLabel", getDictData(DictKeys.COMPREHENSIVE_LEFT_BEHIND_PERSONNEL_TYPE, String.valueOf(json.get("leftBehindType"))));//留守人员类型
  187. json.put("healthStatusLabel", null == json.get("healthStatus") ? null : getDictData(DictKeys.COMPREHENSIVE_HEALTH_STATUS, String.valueOf(json.get("healthStatus"))));//健康状况
  188. json.put("leftBehindRelationshipLabel", getDictData("comprehensive_relation", String.valueOf(json.get("leftBehindRelationship"))));//与留守人员关系
  189. json.put("keyFamilyHealthStatusLabel", null == json.get("keyFamilyHealthStatus") ? null : getDictData(DictKeys.COMPREHENSIVE_HEALTH_STATUS, String.valueOf(json.get("keyFamilyHealthStatus"))));//家庭主要成员健康状况
  190. }
  191. private void setCampusAroundPerson(HashMap<String, Object> json) {//4
  192. json.put("harmLevelLabel", getDictData(DictKeys.COMPREHENSIVE_DEGREE_OF_HARM, String.valueOf(json.get("harmLevel"))));//危害程度
  193. json.put("focusPeopleLabel", "1".equals(json.get("focusPeople")) ? "是" : "否");//是否关注
  194. }
  195. private void setPrisonReleased(HashMap<String, Object> json) {//5
  196. json.put("originalChargeLabel", getDictData(DictKeys.COMPREHENSIVE_OFFENCES_CLASSIFICATION, String.valueOf(json.get("originalCharge"))));//原罪名
  197. json.put("recidivismLabel", "1".equals(json.get("recidivism")) ? "是" : "否");//是否累犯
  198. json.put("riskAssessmentTypeLabel", getDictData(DictKeys.COMPREHENSIVE_HAZARD_ASSESSMENT_TYPE, String.valueOf(json.get("riskAssessmentType"))));//危险性评估类型
  199. json.put("linkUpStatusLabel", getDictData(DictKeys.COMPREHENSIVE_CONNECTION, String.valueOf(json.get("linkUpStatus"))));//衔接情况
  200. json.put("placementStatusLabel", getDictData(DictKeys.COMPREHENSIVE_PLACEMENT, String.valueOf(json.get("placementStatus"))));//安置情况
  201. json.put("reoffendLabel", "1".equals(json.get("reoffend")) ? "是" : "否");//是否重新犯罪
  202. }
  203. private void setCommunityCorrectionStaff(HashMap<String, Object> json) {//6
  204. json.put("caseCategoryLabel", getDictData("comprehensive_case_category", String.valueOf(json.get("caseCategory"))));//案件类别
  205. json.put("correctiveReleaseTypeLabel", null == json.get("correctiveReleaseType") ? null : getDictData(DictKeys.COMPREHENSIVE_CORRECTIVE_RELEASE_TYPE, String.valueOf(json.get("correctiveReleaseType"))));//矫正解除(终止)类型
  206. json.put("receivingModeLabel", getDictData(DictKeys.COMPREHENSIVE_RECEIVING_METHOD, String.valueOf(json.get("receivingMode"))));//接收方式
  207. json.put("correctionClassLabel", getDictData(DictKeys.COMPREHENSIVE_CORRECTIVE_CATEGORY, String.valueOf(json.get("correctionClass"))));//矫正类别
  208. json.put("tubeLabel", "1".equals(json.get("tube")) ? "是" : "否");//是否有脱管
  209. json.put("leakingPipesLabel", "1".equals(json.get("leakingPipes")) ? "是" : "否");//是否有漏管
  210. json.put("recidivismLabel", null == json.get("recidivism") ? null : "1".equals(json.get("recidivism")) ? "是" : "否");//是否累惯犯
  211. json.put("establishCorrectionTeamLabel", "1".equals(json.get("establishCorrectionTeam")) ? "是" : "否");//是否建立矫正小组
  212. json.put("reoffendLabel", "1".equals(json.get("reoffend")) ? "是" : "否");//是否重新犯罪
  213. json.put("fourHistoriesListLabel", getDictDataList(DictKeys.COMPREHENSIVE_THREE_INVOLVED_SITUATION, (List<String>) json.get("fourHistoriesList")));//“四史”情况
  214. json.put("threeStepListLabel", getDictDataList("comprehensive_three_involved_situation", (List<String>) json.get("threeStepList")));//“三涉”情况
  215. json.put("correctionTeamCompositionListLabel", getDictDataList(DictKeys.COMPREHENSIVE_CORRECTIONS_TEAM_COMPOSITION_TYPE, (List<String>) json.get("correctionTeamCompositionList")));//矫正小组人员组成情况
  216. }
  217. private void setPsychosisPopulation(HashMap<String, Object> json) {//7
  218. json.put("familyEconomicSituationLabel", null == json.get("familyEconomicSituationLabel") ? null : getDictData(DictKeys.COMPREHENSIVE_HOUSEHOLDS_FINANCIAL_SITUATION, String.valueOf(json.get("familyEconomicSituationLabel"))));//家庭经济状况
  219. json.put("subsistenceAllowanceLabel", "1".equals(json.get("subsistenceAllowance")) ? "是" : "否");//是否纳入低保
  220. json.put("diagnosisTypeLabel", getDictData(DictKeys.COMPREHENSIVE_CURRENT_DIAGNOSTIC, String.valueOf(json.get("diagnosisType"))));//目前诊断类型
  221. json.put("historyCausingAccidentsLabel", "1".equals(json.get("historyCausingAccidents")) ? "有" : "无");//有无肇事肇祸史
  222. json.put("riskAssessmentLevelLabel", getDictData(DictKeys.COMPREHENSIVE_HAZARD_ASSESSMENT, String.valueOf(json.get("riskAssessmentLevel"))));//目前危险性评估等级
  223. json.put("treatmentSituationLabel", getDictData(DictKeys.COMPREHENSIVE_TREATMENT_CONDITIONS, String.valueOf(json.get("treatmentSituation"))));//治疗情况
  224. json.put("reasonsHospitalizationListLabel", getDictDataList(DictKeys.COMPREHENSIVE_HOSPITALIZATION_REASONS, (List<String>) json.get("reasonsHospitalizationList")));//实施住院治疗原因
  225. json.put("participatingManagersListLabel", getDictDataList(DictKeys.COMPREHENSIVE_MANAGERS, (List<String>) json.get("participatingManagersList")));//参与管理人员
  226. json.put("assistanceSituationListLabel", getDictDataList(DictKeys.COMPREHENSIVE_HELP_SITUATION, (List<String>) json.get("assistanceSituationList")));//帮扶情况
  227. }
  228. private void setDrugAddict(HashMap<String, Object> json) {//8
  229. json.put("controlSituationLabel", getDictData(DictKeys.COMPREHENSIVE_GOVERNANCE, String.valueOf(json.get("controlSituation"))));//管控情况
  230. json.put("criminalHistoryLabel", null == json.get("criminalHistory") ? null : "1".equals(json.get("criminalHistory")) ? "有" : "无");//有无犯罪史
  231. json.put("drugUseLabel", getDictData("comprehensive_case_consequence", String.valueOf(json.get("drugUse"))));//吸毒原因
  232. json.put("drugAbuseLabel", null == json.get("drugAbuse") ? null : getDictData("comprehensive_case_consequence", String.valueOf(json.get("drugAbuse"))));//吸毒后果
  233. }
  234. private void setAidsRisk(HashMap<String, Object> json) {//9
  235. json.put("routeInfectionLabel", getDictData(DictKeys.COMPREHENSIVE_ROUTE_OF_INFECTION, String.valueOf(json.get("routeInfection"))));//感染途径
  236. json.put("criminalHistoryLabel", "1".equals(json.get("criminalHistory")) ? "是" : "否");//是否有违法犯罪史
  237. json.put("caseCategoryLabel", null == json.get("caseCategory") ? null : getDictData("comprehensive_case_category", String.valueOf(json.get("caseCategory"))));//案件类别
  238. json.put("concernTypeLabel", getDictData(DictKeys.COMPREHENSIVE_TYPE_OF_CONCERN, String.valueOf(json.get("concernType"))));//关注类型
  239. json.put("admissionSituationLabel", null == json.get("admissionSituation") ? null : getDictData(DictKeys.COMPREHENSIVE_ADMISSION_TO_INERTIA, String.valueOf(json.get("admissionSituation"))));//收治情况
  240. }
  241. private void setKeyYouth(HashMap<String, Object> json) {//10
  242. json.put("personTypeLabel", null == json.get("personType") ? null : getDictData(DictKeys.COMPREHENSIVE_TYPE_OF_PERSON, String.valueOf(json.get("personType"))));//人员类型
  243. json.put("familySituationLabel", getDictData(DictKeys.COMPREHENSIVE_FAMILY_INERTIA, String.valueOf(json.get("familySituation"))));//家庭情况
  244. json.put("guardianRelationLabel", getDictData("comprehensive_relation", String.valueOf(json.get("guardianRelation"))));//与监护人关系
  245. json.put("reoffendLabel", "1".equals(json.get("reoffend")) ? "是" : "否");//是否违法犯罪
  246. json.put("meansAssistanceLabel", getDictData(DictKeys.COMPREHENSIVE_MEANS_OF_HELP, String.valueOf(json.get("meansAssistance"))));//帮扶手段
  247. }
  248. private String getDictData(String dictKey, String value) {
  249. return DictUtils.getDictDataByValue(dictKey, value);
  250. }
  251. private List<String> getDictDataList(String dictKey, List<String> values) {
  252. return DictUtils.getDictDataListByValue(dictKey, values);
  253. }
  254. @GetMapping("/PersonBasicInfo/getOtherList")
  255. public AjaxResult getOtherList(PersonBasicInfo personBasicInfo){
  256. PageDomain pageDomain = TableSupport.buildPageRequest();
  257. Integer pageNum = pageDomain.getPageNum();
  258. Integer pageSize = pageDomain.getPageSize();
  259. Integer delFlag = personBasicInfo.getDelFlag();
  260. Integer personType = personBasicInfo.getPersonType();
  261. TableDataInfo list = personBasicInfoService.getOtherList(pageNum, pageSize, delFlag, personType);
  262. if(HttpStatus.SUCCESS == list.getCode()){
  263. return AjaxResult.success(list.getRows());
  264. }else{
  265. return AjaxResult.error(list.getCode(),list.getMsg());
  266. }
  267. }
  268. @GetMapping("/PersonBasicInfo/getOtherEdit")
  269. public AjaxResult getOtherEdit(OtherPersonInfo otherPersonInfo){
  270. return personBasicInfoService.getOtherEdit(otherPersonInfo.getBasicId(), otherPersonInfo.getPersonType());
  271. }
  272. @GetMapping("/PersonBasicInfo/getAllUserInfo")
  273. public AjaxResult getAllUserInfo(PersonBasicInfo personBasicInfo){
  274. return personBasicInfoService.getAllUserInfo(personBasicInfo.getName());
  275. }
  276. }