12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- package com.sooka.sponest.mobile.comprehensive.RoadCaseController;
- import com.ruoyi.common.core.constant.HttpStatus;
- 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.comprehensiveRoadCase.domain.ComprehensiveRoadProtection;
- import com.sooka.sponest.comprehensive.api.comprehensiveRoadCase.service.RemoteRoadProtectionService;
- import com.ruoyi.common.core.domain.DictKeys;
- 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;
- @RestController
- @RequestMapping("/AppRoadProtectionController")
- public class AppRoadProtectionController extends BaseController {
- @Resource
- private RemoteRoadProtectionService remoteRoadProtectionService;
- /**
- * 查询护路护线
- */
- @GetMapping("/RoadProtection/list")
- public AjaxResult list(ComprehensiveRoadProtection comprehensiveRoadProtection) {
- PageDomain pageDomain = TableSupport.buildPageRequest();
- Integer pageNum = pageDomain.getPageNum();
- Integer pageSize = pageDomain.getPageSize();
- TableDataInfo tableDataInfo = remoteRoadProtectionService.selectComprehensiveRoadProtectionList(pageNum, pageSize, comprehensiveRoadProtection.getName());
- if (HttpStatus.SUCCESS == tableDataInfo.getCode()) {
- List<HashMap<String, Object>> rows = (List<HashMap<String, Object>>) tableDataInfo.getRows();
- Map<String, Object> dictCacheToMap = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_LINE_TYPE);
- Map<String, Object> dictCacheToMap1 = DictUtils.getDictCacheToMap(DictKeys.COMPREHENSIVE_POLICING_LEVEL);
- if (!rows.isEmpty()) {
- for (HashMap<String, Object> row : rows) {
- row.put("routeTypeLabel", dictCacheToMap.get(row.get("routeType")));
- row.put("publicSecurityHazardLevelLabel", dictCacheToMap1.get(row.get("publicSecurityHazardLevel")));
- }
- }
- return AjaxResult.success(tableDataInfo.getRows());
- } else {
- return AjaxResult.error(tableDataInfo.getCode(), tableDataInfo.getMsg());
- }
- }
- /**
- * 获取护路护线详细信息
- */
- @GetMapping("/RoadProtection/edit")
- public AjaxResult getInfo(String id) {
- AjaxResult ajaxResult = remoteRoadProtectionService.selectComprehensiveRoadProtectionById(id);
- if("200".equals(MapUtils.getString(ajaxResult,"code"))){
- HashMap<String,Object> comprehensiveRoadProtection = (HashMap<String, Object>) ajaxResult.get("data");
- comprehensiveRoadProtection.put("routeTypeLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_LINE_TYPE, MapUtils.getString(comprehensiveRoadProtection,"routeType")));
- comprehensiveRoadProtection.put("publicSecurityHazardLevelLabel",DictUtils.getDictDataByValue(DictKeys.COMPREHENSIVE_POLICING_LEVEL,MapUtils.getString(comprehensiveRoadProtection,"publicSecurityHazardLevel")));
- return AjaxResult.success(comprehensiveRoadProtection);
- }else{
- return AjaxResult.error(MapUtils.getString(ajaxResult,"code"), MapUtils.getString(ajaxResult,"msg"));
- }
- }
- /**
- * 新增护路护线
- */
- @PostMapping("/RoadProtection")
- public AjaxResult add(@RequestBody String json) {
- return remoteRoadProtectionService.insertComprehensiveRoadProtection(json);
- }
- /**
- * 修改护路护线
- */
- @PostMapping("/RoadProtection/put")
- public AjaxResult edit(@RequestBody String json) {
- return remoteRoadProtectionService.updateComprehensiveRoadProtection(json);
- }
- /**
- * 删除护路护线
- */
- @GetMapping("/RoadProtection/del")
- public AjaxResult remove(@RequestParam("id") List<String> id) {
- return remoteRoadProtectionService.deleteComprehensiveRoadProtectionByIds(id.toArray(new String[0]));
- }
- }
|