|
@@ -0,0 +1,94 @@
|
|
|
+package com.sooka.sponest.mobile.data.digitalforestController;
|
|
|
+
|
|
|
+import cn.hutool.core.lang.hash.Hash;
|
|
|
+import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.web.page.PageDomain;
|
|
|
+import com.ruoyi.common.core.web.page.TableSupport;
|
|
|
+import com.ruoyi.common.security.utils.DictUtils;
|
|
|
+import com.sooka.sponest.data.api.digitalenvironment.domain.EnvironmentLeaveField;
|
|
|
+import com.sooka.sponest.data.api.digitalenvironment.service.RemoteLeaveFieldService;
|
|
|
+import com.sooka.sponest.data.api.digitalforest.domain.Animal;
|
|
|
+import com.sooka.sponest.data.api.digitalforest.service.RemoteAnimalService;
|
|
|
+import com.sooka.sponest.mobile.system.camera.service.AppCameraService;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author LG
|
|
|
+ * @Date 2023/9/6 - 15:22
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("AppAnimalController")
|
|
|
+public class AnimalController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private RemoteAnimalService animalService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ AppCameraService appCameraService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询秸秆离田管理列表
|
|
|
+ */
|
|
|
+ @GetMapping("/animal/list")
|
|
|
+ public AjaxResult list(Animal animal) {
|
|
|
+ PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
+ Integer pageNum = pageDomain.getPageNum();
|
|
|
+ Integer pageSize = pageDomain.getPageSize();
|
|
|
+ String wildlifeType = animal.getWildlifeType();
|
|
|
+ Map<String, Object> dictCacheToMap = DictUtils.getDictCacheToMap("forest_animal");
|
|
|
+ List<HashMap<String, Object>> rows = (List<HashMap<String, Object>>) animalService.list(pageNum, pageSize, wildlifeType).getRows();
|
|
|
+ if(null != rows){
|
|
|
+ for (HashMap<String, Object> row : rows) {
|
|
|
+ row.put("typeLabel", dictCacheToMap.get(row.get("type")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success(rows);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取污染源管理详细信息
|
|
|
+ */
|
|
|
+ @GetMapping("/animal/edit")
|
|
|
+ public AjaxResult edit(Animal animal) {
|
|
|
+ AjaxResult ajaxResult = animalService.edit(animal.getId());
|
|
|
+ if("200".equals(ajaxResult.get("code").toString())){
|
|
|
+ Map<String, Object> info = (Map<String, Object>) ajaxResult.get("data");
|
|
|
+ Map<String, Object> dictCacheToMap = DictUtils.getDictCacheToMap("forest_animal");
|
|
|
+ info.put("typeLabel",dictCacheToMap.get(info.get("type")));
|
|
|
+ return appCameraService.selectCameraByIds(info);
|
|
|
+ }else{
|
|
|
+ return ajaxResult;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增污染源管理
|
|
|
+ */
|
|
|
+ @PostMapping("/animal")
|
|
|
+ public AjaxResult add(@RequestBody String json) {
|
|
|
+ return animalService.add(json);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改污染源管理
|
|
|
+ */
|
|
|
+ @PostMapping("/animal/put")
|
|
|
+ public AjaxResult put(@RequestBody String json) {
|
|
|
+ return animalService.put(json);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除污染源管理
|
|
|
+ */
|
|
|
+ @GetMapping("/animal/del")
|
|
|
+ public AjaxResult remove(@RequestParam("id") List<String> id) {
|
|
|
+ return animalService.remove(id.toArray(new String[0]));
|
|
|
+ }
|
|
|
+}
|