123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- package com.sooka.sponest.mobile.comprehensive.comprehensiveconflictdefuseController;
- 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.comprehensiveOrganizationAndInstitution.domain.ComprehensiveRfhGridLeader;
- import com.sooka.sponest.comprehensive.api.comprehensiveOrganizationAndInstitution.service.RemoteRfhGridLeaderService;
- import org.apache.commons.collections4.MapUtils;
- import org.springframework.web.bind.annotation.*;
- import javax.annotation.Resource;
- import java.util.List;
- import java.util.Map;
- import static com.ruoyi.common.security.utils.DictUtils.getComprehensiveDictCacheToMap;
- /**
- * 网格长管理App
- *
- * @author hanfucheng
- * @date 2023/9/6 14:57
- */
- @RestController
- @RequestMapping("/AppGridLeaderController")
- public class AppGridLeaderController extends BaseController {
- @Resource
- RemoteRfhGridLeaderService remoteRfhGridLeaderService;
- /**
- * 查询网格长管理列表
- */
- @GetMapping("/leader/list")
- public AjaxResult list(ComprehensiveRfhGridLeader comprehensiveRfhGridLeader) {
- PageDomain pageDomain = TableSupport.buildPageRequest();
- Integer pageNum = pageDomain.getPageNum();
- Integer pageSize = pageDomain.getPageSize();
- TableDataInfo tableDataInfo = remoteRfhGridLeaderService.selectComprehensiveRfhGridLeaderList(pageNum, pageSize, comprehensiveRfhGridLeader.getUserName(), comprehensiveRfhGridLeader.getMemberName());
- if(HttpStatus.SUCCESS == tableDataInfo.getCode()){
- List<Map<String,Object>> rows = (List<Map<String, Object>>) tableDataInfo.getRows();
- Map<String,Object> map = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX);//性别
- Map<String,Object> map1 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_NATION);//民族
- Map<String,Object> map2 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_POLITICAL_STATUS);//政治面貌
- Map<String,Object> map3 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND);//学历
- for (Map<String, Object> row : rows) {
- row.put("genderLabel",map.get(MapUtils.getString(row,"gender")));
- row.put("nationLabel",map1.get(MapUtils.getString(row,"nation")));
- row.put("politicalOutlookLabel",map2.get(MapUtils.getString(row,"politicalOutlook")));
- row.put("educationLabel",map3.get(MapUtils.getString(row,"education")));
- }
- return AjaxResult.success(tableDataInfo.getRows());
- }else{
- return AjaxResult.error(tableDataInfo.getCode(),tableDataInfo.getMsg());
- }
- }
- @GetMapping("/leader/listAll")
- public AjaxResult listAll(ComprehensiveRfhGridLeader comprehensiveRfhGridLeader) {
- AjaxResult ajaxResult = remoteRfhGridLeaderService.listAll();
- if ("200".equals(ajaxResult.get("code").toString())){
- Map<String,Object> map = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_SEX);//性别
- Map<String,Object> map1 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_NATION);//民族
- Map<String,Object> map2 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_POLITICAL_STATUS);//政治面貌
- Map<String,Object> map3 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND);//学历
- List<Map<String, Object>> data = (List<Map<String, Object>>) ajaxResult.get("data");
- for (Map<String, Object> row : data) {
- row.put("genderLabel",map.get(MapUtils.getString(row,"gender")));
- row.put("nationLabel",map1.get(MapUtils.getString(row,"nation")));
- row.put("politicalOutlookLabel",map2.get(MapUtils.getString(row,"politicalOutlook")));
- row.put("educationLabel",map3.get(MapUtils.getString(row,"education")));
- }
- }
- return ajaxResult;
- }
- /**
- * 获取网格长管理详细信息
- */
- @GetMapping("/leader/edit")
- public AjaxResult getInfo(String id) {
- AjaxResult ajaxResult = remoteRfhGridLeaderService.selectComprehensiveRfhGridLeaderById(id);
- if ("200".equals(ajaxResult.get("code").toString())){
- Map<String, Object> data = (Map<String, Object>) ajaxResult.get("data");
- data.put("genderLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_SEX, MapUtils.getString(data,"gender")));
- data.put("nationLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_NATION, MapUtils.getString(data,"nation")));
- data.put("politicalOutlookLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_POLITICAL_STATUS, MapUtils.getString(data,"politicalOutlook")));
- data.put("educationLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_EDUCATIONAL_BACKGROUND, MapUtils.getString(data,"education")));
- }
- return ajaxResult;
- }
- /**
- * 新增网格长管理
- */
- @PostMapping("/leader")
- public AjaxResult add(@RequestBody String json) {
- return remoteRfhGridLeaderService.insertComprehensiveRfhGridLeader(json);
- }
- /**
- * 修改网格长管理
- */
- @PostMapping("/leader/put")
- public AjaxResult edit(@RequestBody String json) {
- return remoteRfhGridLeaderService.updateComprehensiveRfhGridLeader(json);
- }
- /**
- * 删除网格长管理
- */
- @GetMapping("/leader/del")
- public AjaxResult remove(@RequestParam("id") List<String> id) {
- return remoteRfhGridLeaderService.deleteComprehensiveRfhGridLeaderByIds(id.toArray(new String[0]));
- }
- }
|