AppConflictResolutionController.java 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. package com.sooka.sponest.mobile.comprehensive.conflictDefuseController;
  2. import com.ruoyi.common.core.constant.HttpStatus;
  3. import com.ruoyi.common.core.domain.DictKeys;
  4. import com.ruoyi.common.core.domain.R;
  5. import com.ruoyi.common.core.web.controller.BaseController;
  6. import com.ruoyi.common.core.web.domain.AjaxResult;
  7. import com.ruoyi.common.core.web.page.PageDomain;
  8. import com.ruoyi.common.core.web.page.TableDataInfo;
  9. import com.ruoyi.common.core.web.page.TableSupport;
  10. import com.ruoyi.common.security.utils.DictUtils;
  11. import com.sooka.sponest.comprehensive.api.comprehensiveConflictDefuse.domain.ConflictResolution;
  12. import com.sooka.sponest.comprehensive.api.comprehensiveConflictDefuse.service.RemoteConflictResolutionService;
  13. import org.apache.commons.collections4.MapUtils;
  14. import org.springframework.web.bind.annotation.*;
  15. import javax.annotation.Resource;
  16. import java.util.List;
  17. import java.util.Map;
  18. @RestController
  19. @RequestMapping("/AppConflictResolutionController")
  20. public class AppConflictResolutionController extends BaseController {
  21. @Resource
  22. private RemoteConflictResolutionService remoteConflictResolutionService;
  23. /**
  24. * 查询矛盾纠纷排查化解
  25. */
  26. @GetMapping("/conflict/list")
  27. public AjaxResult list(ConflictResolution conflictResolution) {
  28. PageDomain pageDomain = TableSupport.buildPageRequest();
  29. Integer pageNum = pageDomain.getPageNum();
  30. Integer pageSize = pageDomain.getPageSize();
  31. TableDataInfo tableDataInfo = remoteConflictResolutionService.selectConflictResolutionList(pageNum, pageSize, conflictResolution.getTemp(),conflictResolution.getEventName(),conflictResolution.getMainPersonName(),conflictResolution.getResolutionResponsibleName());
  32. if (HttpStatus.SUCCESS == tableDataInfo.getCode()) {
  33. List<Map<String,Object>> rows = (List<Map<String, Object>>) tableDataInfo.getRows();
  34. Map<String,Object> comprehensiveCertificateCode = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_CERTIFICATE_CODE);
  35. Map<String,Object> comprehensiveSex = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX);
  36. Map<String,Object> comprehensiveNation = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_NATION);
  37. Map<String,Object> comprehensiveEducationalBackground = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND);
  38. Map<String,Object> comprehensiveEventSize = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EVENT_SIZE);
  39. Map<String,Object> comprehensiveEventType = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_EVENT_TYPE);
  40. Map<String,Object> comprehensivePartiesInvolved = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_PARTIES_INVOLVED);
  41. Map<String,Object> comprehensiveWaysResolving = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_WAYS_RESOLVING);
  42. for (Map<String, Object> row : rows) {
  43. row.put("mainPersonIdCodeLabel",MapUtils.getString(comprehensiveCertificateCode,MapUtils.getString(row,"mainPersonIdCode")));
  44. row.put("mainPersonGenderLabel",MapUtils.getString(comprehensiveSex,MapUtils.getString(row,"mainPersonGender")));
  45. row.put("mainPersonNationalityLabel",MapUtils.getString(comprehensiveNation,MapUtils.getString(row,"mainPersonNationality")));
  46. row.put("mainPersonEducationLabel",MapUtils.getString(comprehensiveEducationalBackground,MapUtils.getString(row,"mainPersonEducation")));
  47. row.put("eventScaleLabel",MapUtils.getString(comprehensiveEventSize,MapUtils.getString(row,"eventScale")));
  48. row.put("resolutionSuccessLabel",!MapUtils.getString(row,"resolutionSuccess").isEmpty()?("1".equals(conflictResolution.getResolutionSuccess())?"是":"否"):"");
  49. row.put("eventCategoryLabel",MapUtils.getString(comprehensiveEventType,MapUtils.getString(row,"eventCategory")));
  50. row.put("mainPersonCategoryLabel",MapUtils.getString(comprehensivePartiesInvolved,MapUtils.getString(row,"mainPersonCategory")));
  51. row.put("resolutionMethodLabel",MapUtils.getString(comprehensiveWaysResolving,MapUtils.getString(row,"resolutionMethod")));
  52. }
  53. return AjaxResult.success(rows);
  54. } else {
  55. return AjaxResult.error(tableDataInfo.getCode(), tableDataInfo.getMsg());
  56. }
  57. }
  58. /**
  59. * 获取矛盾纠纷排查化解详细信息
  60. */
  61. @GetMapping("/conflict/edit")
  62. public AjaxResult getInfo(String id) {
  63. R<ConflictResolution> edit = remoteConflictResolutionService.selectConflictResolutionById(id);
  64. if(HttpStatus.SUCCESS == edit.getCode()){
  65. ConflictResolution conflictResolution = edit.getData();
  66. Map<String,Object> comprehensiveEventType = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_EVENT_TYPE);
  67. Map<String,Object> comprehensivePartiesInvolved = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_PARTIES_INVOLVED);
  68. Map<String,Object> comprehensiveWaysResolving = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_WAYS_RESOLVING);
  69. conflictResolution.setMainPersonIdCodeLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_CERTIFICATE_CODE, conflictResolution.getMainPersonIdCode()));
  70. conflictResolution.setMainPersonGenderLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_SEX, conflictResolution.getMainPersonGender()));
  71. conflictResolution.setMainPersonNationalityLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_NATION, conflictResolution.getMainPersonNationality()));
  72. conflictResolution.setMainPersonEducationLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND, conflictResolution.getMainPersonEducation()));
  73. conflictResolution.setEventScaleLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_EVENT_SIZE, conflictResolution.getEventScale()));
  74. conflictResolution.setResolutionSuccessLabel(!conflictResolution.getResolutionSuccess().isEmpty()?("1".equals(conflictResolution.getResolutionSuccess())?"是":"否"):"");
  75. conflictResolution.setEventCategoryLabel(MapUtils.getString(comprehensiveEventType,conflictResolution.getEventCategory()));
  76. conflictResolution.setMainPersonCategoryLabel(MapUtils.getString(comprehensivePartiesInvolved,conflictResolution.getMainPersonCategory()));
  77. conflictResolution.setResolutionMethodLabel(MapUtils.getString(comprehensiveWaysResolving,conflictResolution.getResolutionMethod()));
  78. return AjaxResult.success(conflictResolution);
  79. }else{
  80. return AjaxResult.error(edit.getCode(), edit.getMsg());
  81. }
  82. }
  83. /**
  84. * 新增矛盾纠纷排查化解
  85. */
  86. @PostMapping("/conflict")
  87. public AjaxResult add(@RequestBody String json) {
  88. return remoteConflictResolutionService.insertConflictResolution(json);
  89. }
  90. /**
  91. * 修改矛盾纠纷排查化解
  92. */
  93. @PostMapping("/conflict/put")
  94. public AjaxResult edit(@RequestBody String json) {
  95. return remoteConflictResolutionService.updateConflictResolution(json);
  96. }
  97. /**
  98. * 删除矛盾纠纷排查化解
  99. */
  100. @GetMapping("/conflict/del")
  101. public AjaxResult remove(@RequestParam("id") List<String> id) {
  102. return remoteConflictResolutionService.deleteConflictResolutionByIds(id.toArray(new String[0]));
  103. }
  104. }