package com.sooka.sponest.mobile.comprehensive.actualPeopleController; import com.ruoyi.common.core.constant.HttpStatus; import com.ruoyi.common.core.domain.DictKeys; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageDomain; import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.core.web.page.TableSupport; import com.ruoyi.common.security.utils.DictUtils; import com.sooka.sponest.comprehensive.api.comprehensiveActualPeople.domain.ComprehensiveRhfOverseasPersonInfo; import com.sooka.sponest.comprehensive.api.comprehensiveActualPeople.service.RemoteOverseasPersonInfoService; import org.apache.commons.collections4.MapUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 境外人员App * * @author hanfucheng * @date 2023/9/6 14:57 */ @RestController @RequestMapping("/AppOverseasPersonInfoController") public class AppOverseasPersonInfoController extends BaseController { @Resource RemoteOverseasPersonInfoService remoteOverseasPersonInfoService; /** * 查询境外人员列表 */ @GetMapping("/info/list") public AjaxResult list(ComprehensiveRhfOverseasPersonInfo comprehensiveRhfOverseasPersonInfo) { PageDomain pageDomain = TableSupport.buildPageRequest(); Integer pageNum = pageDomain.getPageNum(); Integer pageSize = pageDomain.getPageSize(); TableDataInfo tableDataInfo = remoteOverseasPersonInfoService.selectComprehensiveRhfOverseasPersonInfoList(pageNum, pageSize, comprehensiveRhfOverseasPersonInfo.getIdentityNumber(), comprehensiveRhfOverseasPersonInfo.getPhone()); if(HttpStatus.SUCCESS == tableDataInfo.getCode()){ List> rows = (List>) tableDataInfo.getRows(); Map comprehensiveCityCode = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE);//2260 Map comprehensiveSex = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX); Map comprehensiveInternation = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_INTERNATION); Map comprehensiveReligiousBelief = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_RELIGIOUS_BELIEF); Map comprehensiveCertificateCode = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_CERTIFICATE_CODE); Map comprehensiveComingToChinaPurpose = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_COMING_TO_CHINA_PURPOSE); Map comprehensiveOccupationalCategory = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_OCCUPATIONAL_CATEGORY); for (Map row : rows) { row.put("genderLabel",comprehensiveSex.get(MapUtils.getString(row,"gender"))); row.put("nativePlaceLabel",comprehensiveInternation.get(MapUtils.getString(row,"nativePlace"))); row.put("religiousBeliefLabel",comprehensiveReligiousBelief.get(MapUtils.getString(row,"religiousBelief"))); row.put("identityCodeLabel",comprehensiveCertificateCode.get(MapUtils.getString(row,"identityCode"))); row.put("purposeComingChinaLabel",comprehensiveComingToChinaPurpose.get(MapUtils.getString(row,"purposeComingChina"))); row.put("occupationalCategoryLabel",comprehensiveOccupationalCategory.get(MapUtils.getString(row,"occupationalCategory"))); row.put("focusPeopleLabel",null == row.get("focusPeople")?"":(MapUtils.getInteger(row,"focusPeople")== 1?"是":"否")); row.put("currentResidencePlaceLabel",comprehensiveCityCode.get(MapUtils.getString(row,"currentResidencePlace"))); } return AjaxResult.success(rows); }else{ return AjaxResult.error(tableDataInfo.getCode(),tableDataInfo.getMsg()); } } /** * 获取境外人员详细信息 */ @GetMapping("/info/edit") public AjaxResult getInfo(String id) { AjaxResult ajaxResult = remoteOverseasPersonInfoService.selectComprehensiveRhfOverseasPersonInfoById(id); if("200".equals(MapUtils.getString(ajaxResult,"code"))){ HashMap comprehensiveRhfOverseasPersonInfo = (HashMap) ajaxResult.get("data"); Map comprehensiveCityCode = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_CITY_CODE); comprehensiveRhfOverseasPersonInfo.put("genderLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_SEX,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"gender"))); comprehensiveRhfOverseasPersonInfo.put("nativePlaceLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_INTERNATION,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"nativePlace"))); comprehensiveRhfOverseasPersonInfo.put("religiousBeliefLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_RELIGIOUS_BELIEF,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"religiousBelief"))); comprehensiveRhfOverseasPersonInfo.put("identityCodeLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_CERTIFICATE_CODE,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"identityCode"))); comprehensiveRhfOverseasPersonInfo.put("purposeComingChinaLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_COMING_TO_CHINA_PURPOSE,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"purposeComingChina"))); comprehensiveRhfOverseasPersonInfo.put("occupationalCategoryLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_OCCUPATIONAL_CATEGORY,MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"occupationalCategory"))); comprehensiveRhfOverseasPersonInfo.put("focusPeopleLabel",null == comprehensiveRhfOverseasPersonInfo.get("focusPeople")?"":(MapUtils.getInteger(comprehensiveRhfOverseasPersonInfo,"focusPeople")== 1?"是":"否")); comprehensiveRhfOverseasPersonInfo.put("currentResidencePlaceLabel",comprehensiveCityCode.get(MapUtils.getString(comprehensiveRhfOverseasPersonInfo,"currentResidencePlace"))); return AjaxResult.success(comprehensiveRhfOverseasPersonInfo); }else{ return AjaxResult.error(MapUtils.getString(ajaxResult,"code"), MapUtils.getString(ajaxResult,"msg")); } } /** * 新增境外人员 */ @PostMapping("/info") public AjaxResult add(@RequestBody String json) { return remoteOverseasPersonInfoService.insertComprehensiveRhfOverseasPersonInfo(json); } /** * 修改境外人员 */ @PostMapping("/info/put") public AjaxResult edit(@RequestBody String json) { return remoteOverseasPersonInfoService.updateComprehensiveRhfOverseasPersonInfo(json); } /** * 删除境外人员 */ @GetMapping("/info/del") public AjaxResult remove(@RequestParam("id") List id) { return remoteOverseasPersonInfoService.deleteComprehensiveRhfOverseasPersonInfoByIds(id.toArray(new String[0])); } }