AppOverseasPersonInfoController.java 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. package com.sooka.sponest.mobile.comprehensive.actualPeopleController;
  2. import com.ruoyi.common.core.constant.HttpStatus;
  3. import com.ruoyi.common.core.domain.DictKeys;
  4. import com.ruoyi.common.core.web.controller.BaseController;
  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.comprehensiveActualPeople.domain.ComprehensiveRhfOverseasPersonInfo;
  11. import com.sooka.sponest.comprehensive.api.comprehensiveActualPeople.service.RemoteOverseasPersonInfoService;
  12. import org.apache.commons.collections4.MapUtils;
  13. import org.springframework.web.bind.annotation.*;
  14. import javax.annotation.Resource;
  15. import java.util.HashMap;
  16. import java.util.List;
  17. import java.util.Map;
  18. /**
  19. * 境外人员App
  20. *
  21. * @author hanfucheng
  22. * @date 2023/9/6 14:57
  23. */
  24. @RestController
  25. @RequestMapping("/AppOverseasPersonInfoController")
  26. public class AppOverseasPersonInfoController extends BaseController {
  27. @Resource
  28. RemoteOverseasPersonInfoService remoteOverseasPersonInfoService;
  29. /**
  30. * 查询境外人员列表
  31. */
  32. @GetMapping("/info/list")
  33. public AjaxResult list(ComprehensiveRhfOverseasPersonInfo comprehensiveRhfOverseasPersonInfo) {
  34. PageDomain pageDomain = TableSupport.buildPageRequest();
  35. Integer pageNum = pageDomain.getPageNum();
  36. Integer pageSize = pageDomain.getPageSize();
  37. TableDataInfo tableDataInfo = remoteOverseasPersonInfoService.selectComprehensiveRhfOverseasPersonInfoList(pageNum, pageSize, comprehensiveRhfOverseasPersonInfo.getIdentityNumber(), comprehensiveRhfOverseasPersonInfo.getPhone());
  38. if(HttpStatus.SUCCESS == tableDataInfo.getCode()){
  39. List<Map<String,Object>> rows = (List<Map<String, Object>>) tableDataInfo.getRows();
  40. Map<String,Object> comprehensiveCityCode = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);//2260
  41. Map<String,Object> comprehensiveSex = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX);
  42. Map<String,Object> comprehensiveInternation = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_INTERNATION);
  43. Map<String,Object> comprehensiveReligiousBelief = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_RELIGIOUS_BELIEF);
  44. Map<String,Object> comprehensiveCertificateCode = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_CERTIFICATE_CODE);
  45. Map<String,Object> comprehensiveComingToChinaPurpose = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_COMING_TO_CHINA_PURPOSE);
  46. Map<String,Object> comprehensiveOccupationalCategory = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_OCCUPATIONAL_CATEGORY);
  47. for (Map<String, Object> row : rows) {
  48. row.put("genderLabel",comprehensiveSex.get(MapUtils.getString(row,"gender")));
  49. row.put("nativePlaceLabel",comprehensiveInternation.get(MapUtils.getString(row,"nativePlace")));
  50. row.put("religiousBeliefLabel",comprehensiveReligiousBelief.get(MapUtils.getString(row,"religiousBelief")));
  51. row.put("identityCodeLabel",comprehensiveCertificateCode.get(MapUtils.getString(row,"identityCode")));
  52. row.put("purposeComingChinaLabel",comprehensiveComingToChinaPurpose.get(MapUtils.getString(row,"purposeComingChina")));
  53. row.put("occupationalCategoryLabel",comprehensiveOccupationalCategory.get(MapUtils.getString(row,"occupationalCategory")));
  54. row.put("focusPeopleLabel",null == row.get("focusPeople")?"":(MapUtils.getInteger(row,"focusPeople")== 1?"是":"否"));
  55. row.put("currentResidencePlaceLabel",comprehensiveCityCode.get(MapUtils.getString(row,"currentResidencePlace")));
  56. }
  57. return AjaxResult.success(rows);
  58. }else{
  59. return AjaxResult.error(tableDataInfo.getCode(),tableDataInfo.getMsg());
  60. }
  61. }
  62. /**
  63. * 获取境外人员详细信息
  64. */
  65. @GetMapping("/info/edit")
  66. public AjaxResult getInfo(String id) {
  67. AjaxResult ajaxResult = remoteOverseasPersonInfoService.selectComprehensiveRhfOverseasPersonInfoById(id);
  68. if("200".equals(MapUtils.getString(ajaxResult,"code"))){
  69. HashMap<String,Object> comprehensiveRhfOverseasPersonInfo = (HashMap<String, Object>) ajaxResult.get("data");
  70. Map<String,Object> comprehensiveCityCode = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);
  71. comprehensiveRhfOverseasPersonInfo.put("genderLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_SEX,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"gender")));
  72. comprehensiveRhfOverseasPersonInfo.put("nativePlaceLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_INTERNATION,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"nativePlace")));
  73. comprehensiveRhfOverseasPersonInfo.put("religiousBeliefLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_RELIGIOUS_BELIEF,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"religiousBelief")));
  74. comprehensiveRhfOverseasPersonInfo.put("identityCodeLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_CERTIFICATE_CODE,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"identityCode")));
  75. comprehensiveRhfOverseasPersonInfo.put("purposeComingChinaLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_COMING_TO_CHINA_PURPOSE,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"purposeComingChina")));
  76. comprehensiveRhfOverseasPersonInfo.put("occupationalCategoryLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_OCCUPATIONAL_CATEGORY,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"occupationalCategory")));
  77. comprehensiveRhfOverseasPersonInfo.put("focusPeopleLabel",null == comprehensiveRhfOverseasPersonInfo.get("focusPeople")?"":(MapUtils.getInteger(comprehensiveRhfOverseasPersonInfo,"focusPeople")== 1?"是":"否"));
  78. comprehensiveRhfOverseasPersonInfo.put("currentResidencePlaceLabel",comprehensiveCityCode.get(MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"currentResidencePlace")));
  79. return AjaxResult.success(comprehensiveRhfOverseasPersonInfo);
  80. }else{
  81. return AjaxResult.error(MapUtils.getString(ajaxResult,"code"), MapUtils.getString(ajaxResult,"msg"));
  82. }
  83. }
  84. /**
  85. * 新增境外人员
  86. */
  87. @PostMapping("/info")
  88. public AjaxResult add(@RequestBody String json) {
  89. return remoteOverseasPersonInfoService.insertComprehensiveRhfOverseasPersonInfo(json);
  90. }
  91. /**
  92. * 修改境外人员
  93. */
  94. @PostMapping("/info/put")
  95. public AjaxResult edit(@RequestBody String json) {
  96. return remoteOverseasPersonInfoService.updateComprehensiveRhfOverseasPersonInfo(json);
  97. }
  98. /**
  99. * 删除境外人员
  100. */
  101. @GetMapping("/info/del")
  102. public AjaxResult remove(@RequestParam("id") List<String> id) {
  103. return remoteOverseasPersonInfoService.deleteComprehensiveRhfOverseasPersonInfoByIds(id.toArray(new String[0]));
  104. }
  105. }