package com.sooka.sponest.mobile.comprehensive.conflictDefuseController; import com.ruoyi.common.core.constant.HttpStatus; import com.ruoyi.common.core.domain.DictKeys; import com.ruoyi.common.core.domain.R; 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.comprehensiveConflictDefuse.domain.ConflictResolution; import com.sooka.sponest.comprehensive.api.comprehensiveConflictDefuse.service.RemoteConflictResolutionService; import org.apache.commons.collections4.MapUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; import java.util.Map; @RestController @RequestMapping("/AppConflictResolutionController") public class AppConflictResolutionController extends BaseController { @Resource private RemoteConflictResolutionService remoteConflictResolutionService; /** * 查询矛盾纠纷排查化解 */ @GetMapping("/conflict/list") public AjaxResult list(ConflictResolution conflictResolution) { PageDomain pageDomain = TableSupport.buildPageRequest(); Integer pageNum = pageDomain.getPageNum(); Integer pageSize = pageDomain.getPageSize(); TableDataInfo tableDataInfo = remoteConflictResolutionService.selectConflictResolutionList(pageNum, pageSize, conflictResolution.getTemp(),conflictResolution.getEventName(),conflictResolution.getMainPersonName(),conflictResolution.getResolutionResponsibleName()); if (HttpStatus.SUCCESS == tableDataInfo.getCode()) { List> rows = (List>) tableDataInfo.getRows(); Map comprehensiveCertificateCode = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_CERTIFICATE_CODE); Map comprehensiveSex = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX); Map comprehensiveNation = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_NATION); Map comprehensiveEducationalBackground = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND); Map comprehensiveEventSize = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EVENT_SIZE); Map comprehensiveEventType = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_EVENT_TYPE); Map comprehensivePartiesInvolved = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_PARTIES_INVOLVED); Map comprehensiveWaysResolving = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_WAYS_RESOLVING); for (Map row : rows) { row.put("mainPersonIdCodeLabel",MapUtils.getString(comprehensiveCertificateCode,MapUtils.getString(row,"mainPersonIdCode"))); row.put("mainPersonGenderLabel",MapUtils.getString(comprehensiveSex,MapUtils.getString(row,"mainPersonGender"))); row.put("mainPersonNationalityLabel",MapUtils.getString(comprehensiveNation,MapUtils.getString(row,"mainPersonNationality"))); row.put("mainPersonEducationLabel",MapUtils.getString(comprehensiveEducationalBackground,MapUtils.getString(row,"mainPersonEducation"))); row.put("eventScaleLabel",MapUtils.getString(comprehensiveEventSize,MapUtils.getString(row,"eventScale"))); row.put("resolutionSuccessLabel",!MapUtils.getString(row,"resolutionSuccess").isEmpty()?("1".equals(conflictResolution.getResolutionSuccess())?"是":"否"):""); row.put("eventCategoryLabel",MapUtils.getString(comprehensiveEventType,MapUtils.getString(row,"eventCategory"))); row.put("mainPersonCategoryLabel",MapUtils.getString(comprehensivePartiesInvolved,MapUtils.getString(row,"mainPersonCategory"))); row.put("resolutionMethodLabel",MapUtils.getString(comprehensiveWaysResolving,MapUtils.getString(row,"resolutionMethod"))); } return AjaxResult.success(rows); } else { return AjaxResult.error(tableDataInfo.getCode(), tableDataInfo.getMsg()); } } /** * 获取矛盾纠纷排查化解详细信息 */ @GetMapping("/conflict/edit") public AjaxResult getInfo(String id) { R edit = remoteConflictResolutionService.selectConflictResolutionById(id); if(HttpStatus.SUCCESS == edit.getCode()){ ConflictResolution conflictResolution = edit.getData(); Map comprehensiveEventType = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_EVENT_TYPE); Map comprehensivePartiesInvolved = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_PARTIES_INVOLVED); Map comprehensiveWaysResolving = DictUtils.getComprehensiveDictCacheToMap(DictKeys.COMPREHENSIVE_WAYS_RESOLVING); conflictResolution.setMainPersonIdCodeLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_CERTIFICATE_CODE, conflictResolution.getMainPersonIdCode())); conflictResolution.setMainPersonGenderLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_SEX, conflictResolution.getMainPersonGender())); conflictResolution.setMainPersonNationalityLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_NATION, conflictResolution.getMainPersonNationality())); conflictResolution.setMainPersonEducationLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND, conflictResolution.getMainPersonEducation())); conflictResolution.setEventScaleLabel(DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_EVENT_SIZE, conflictResolution.getEventScale())); conflictResolution.setResolutionSuccessLabel(!conflictResolution.getResolutionSuccess().isEmpty()?("1".equals(conflictResolution.getResolutionSuccess())?"是":"否"):""); conflictResolution.setEventCategoryLabel(MapUtils.getString(comprehensiveEventType,conflictResolution.getEventCategory())); conflictResolution.setMainPersonCategoryLabel(MapUtils.getString(comprehensivePartiesInvolved,conflictResolution.getMainPersonCategory())); conflictResolution.setResolutionMethodLabel(MapUtils.getString(comprehensiveWaysResolving,conflictResolution.getResolutionMethod())); return AjaxResult.success(conflictResolution); }else{ return AjaxResult.error(edit.getCode(), edit.getMsg()); } } /** * 新增矛盾纠纷排查化解 */ @PostMapping("/conflict") public AjaxResult add(@RequestBody String json) { return remoteConflictResolutionService.insertConflictResolution(json); } /** * 修改矛盾纠纷排查化解 */ @PostMapping("/conflict/put") public AjaxResult edit(@RequestBody String json) { return remoteConflictResolutionService.updateConflictResolution(json); } /** * 删除矛盾纠纷排查化解 */ @GetMapping("/conflict/del") public AjaxResult remove(@RequestParam("id") List id) { return remoteConflictResolutionService.deleteConflictResolutionByIds(id.toArray(new String[0])); } }