AppGridLeaderController.java 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. package com.sooka.sponest.mobile.comprehensive.comprehensiveconflictdefuseController;
  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.comprehensiveOrganizationAndInstitution.domain.ComprehensiveRfhGridLeader;
  11. import com.sooka.sponest.comprehensive.api.comprehensiveOrganizationAndInstitution.service.RemoteRfhGridLeaderService;
  12. import org.apache.commons.collections4.MapUtils;
  13. import org.springframework.web.bind.annotation.*;
  14. import javax.annotation.Resource;
  15. import java.util.List;
  16. import java.util.Map;
  17. import static com.ruoyi.common.security.utils.DictUtils.getComprehensiveDictCacheToMap;
  18. /**
  19. * 网格长管理App
  20. *
  21. * @author hanfucheng
  22. * @date 2023/9/6 14:57
  23. */
  24. @RestController
  25. @RequestMapping("/AppGridLeaderController")
  26. public class AppGridLeaderController extends BaseController {
  27. @Resource
  28. RemoteRfhGridLeaderService remoteRfhGridLeaderService;
  29. /**
  30. * 查询网格长管理列表
  31. */
  32. @GetMapping("/leader/list")
  33. public AjaxResult list(ComprehensiveRfhGridLeader comprehensiveRfhGridLeader) {
  34. PageDomain pageDomain = TableSupport.buildPageRequest();
  35. Integer pageNum = pageDomain.getPageNum();
  36. Integer pageSize = pageDomain.getPageSize();
  37. TableDataInfo tableDataInfo = remoteRfhGridLeaderService.selectComprehensiveRfhGridLeaderList(pageNum, pageSize, comprehensiveRfhGridLeader.getUserName(), comprehensiveRfhGridLeader.getMemberName());
  38. if(HttpStatus.SUCCESS == tableDataInfo.getCode()){
  39. List<Map<String,Object>> rows = (List<Map<String, Object>>) tableDataInfo.getRows();
  40. Map<String,Object> map = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX);//性别
  41. Map<String,Object> map1 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_NATION);//民族
  42. Map<String,Object> map2 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_POLITICAL_STATUS);//政治面貌
  43. Map<String,Object> map3 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND);//学历
  44. for (Map<String, Object> row : rows) {
  45. row.put("genderLabel",map.get(MapUtils.getString(row,"gender")));
  46. row.put("nationLabel",map1.get(MapUtils.getString(row,"nation")));
  47. row.put("politicalOutlookLabel",map2.get(MapUtils.getString(row,"politicalOutlook")));
  48. row.put("educationLabel",map3.get(MapUtils.getString(row,"education")));
  49. }
  50. return AjaxResult.success(tableDataInfo.getRows());
  51. }else{
  52. return AjaxResult.error(tableDataInfo.getCode(),tableDataInfo.getMsg());
  53. }
  54. }
  55. @GetMapping("/leader/listAll")
  56. public AjaxResult listAll(ComprehensiveRfhGridLeader comprehensiveRfhGridLeader) {
  57. AjaxResult ajaxResult = remoteRfhGridLeaderService.listAll();
  58. if ("200".equals(ajaxResult.get("code").toString())){
  59. Map<String,Object> map = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX);//性别
  60. Map<String,Object> map1 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_NATION);//民族
  61. Map<String,Object> map2 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_POLITICAL_STATUS);//政治面貌
  62. Map<String,Object> map3 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND);//学历
  63. List<Map<String, Object>> data = (List<Map<String, Object>>) ajaxResult.get("data");
  64. for (Map<String, Object> row : data) {
  65. row.put("genderLabel",map.get(MapUtils.getString(row,"gender")));
  66. row.put("nationLabel",map1.get(MapUtils.getString(row,"nation")));
  67. row.put("politicalOutlookLabel",map2.get(MapUtils.getString(row,"politicalOutlook")));
  68. row.put("educationLabel",map3.get(MapUtils.getString(row,"education")));
  69. }
  70. }
  71. return ajaxResult;
  72. }
  73. /**
  74. * 获取网格长管理详细信息
  75. */
  76. @GetMapping("/leader/edit")
  77. public AjaxResult getInfo(String id) {
  78. AjaxResult ajaxResult = remoteRfhGridLeaderService.selectComprehensiveRfhGridLeaderById(id);
  79. if ("200".equals(ajaxResult.get("code").toString())){
  80. Map<String, Object> data = (Map<String, Object>) ajaxResult.get("data");
  81. data.put("genderLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_SEX, MapUtils.getString(data,"gender")));
  82. data.put("nationLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_NATION, MapUtils.getString(data,"nation")));
  83. data.put("politicalOutlookLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_POLITICAL_STATUS, MapUtils.getString(data,"politicalOutlook")));
  84. data.put("educationLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND, MapUtils.getString(data,"education")));
  85. }
  86. return ajaxResult;
  87. }
  88. /**
  89. * 新增网格长管理
  90. */
  91. @PostMapping("/leader")
  92. public AjaxResult add(@RequestBody String json) {
  93. return remoteRfhGridLeaderService.insertComprehensiveRfhGridLeader(json);
  94. }
  95. /**
  96. * 修改网格长管理
  97. */
  98. @PostMapping("/leader/put")
  99. public AjaxResult edit(@RequestBody String json) {
  100. return remoteRfhGridLeaderService.updateComprehensiveRfhGridLeader(json);
  101. }
  102. /**
  103. * 删除网格长管理
  104. */
  105. @GetMapping("/leader/del")
  106. public AjaxResult remove(@RequestParam("id") List<String> id) {
  107. return remoteRfhGridLeaderService.deleteComprehensiveRfhGridLeaderByIds(id.toArray(new String[0]));
  108. }
  109. }