From a79a9292a212c40b21cc2827f983701c7aad6034 Mon Sep 17 00:00:00 2001 From: liujun Date: Wed, 24 Jan 2024 11:43:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=98=B2=E5=99=A8=E6=9D=90=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E8=BF=81=E7=A7=BB=E8=87=B3=E4=BC=81=E4=B8=9A=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../firemanager/FireResourcesController.java | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 src/main/java/com/zcloud/controller/firemanager/FireResourcesController.java diff --git a/src/main/java/com/zcloud/controller/firemanager/FireResourcesController.java b/src/main/java/com/zcloud/controller/firemanager/FireResourcesController.java new file mode 100644 index 00000000..6592bb22 --- /dev/null +++ b/src/main/java/com/zcloud/controller/firemanager/FireResourcesController.java @@ -0,0 +1,124 @@ +package com.zcloud.controller.firemanager; + +import com.zcloud.controller.base.BaseController; +import com.zcloud.entity.Page; +import com.zcloud.entity.PageData; +import com.zcloud.service.map.FireResourcesService; +import com.zcloud.util.DateUtil; +import com.zcloud.util.Jurisdiction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@RequestMapping("/fireResources") +public class FireResourcesController extends BaseController { + + @Resource + private FireResourcesService fireResourcesService; + @RequestMapping(value = "/list") + @ResponseBody + public Object page(Page page) { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + page.setPd(pd); + if ("00004".equals(pd.getString("GANGKOU"))) { + MultiValueMap paramMap = new LinkedMultiValueMap(); + paramMap.add("FIRERESOURCES_NAME", pd.getString("FIRERESOURCES_NAME")); + paramMap.add("FIRERESOURCES_TYPE", pd.getString("FIRERESOURCES_TYPE")); + Map result = + restTemplate.postForObject(cfdUrl + "/sync/map/fireResources/list", paramMap, Map.class); + return result; + } + //获取当前人的公司id + List varList = fireResourcesService.datalistPage(page); + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } + + @Value("${cfd.prevention.api.url}") + private String cfdUrl; + @Autowired + private RestTemplate restTemplate; + @RequestMapping(value = "/getById") + @ResponseBody + public Object getById() { + Map map = new HashMap(); + String errInfo = "success"; + PageData pddata = this.getPageData(); + if ("00004".equals(pddata.getString("GANGKOU"))) { + MultiValueMap paramMap = new LinkedMultiValueMap(); + paramMap.add("FIRERESOURCES_ID", pddata.getString("FIRERESOURCES_ID")); + Map result = + restTemplate.postForObject(cfdUrl + "/sync/map/fireResources/getById", paramMap, Map.class); + return result; + } + //获取当前人的公司id + PageData pd = fireResourcesService.getDataById(pddata); + map.put("pd", pd); + map.put("result", errInfo); + return map; + } + + @RequestMapping(value = "/add") + @ResponseBody + public Object add(@RequestParam(value="FFILE",required=false) MultipartFile[] files) throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + String FIRERESOURCES_ID = this.get32UUID(); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + pd.put("FIRERESOURCES_ID", FIRERESOURCES_ID); + pd.put("CREATIME", DateUtil.date2Str(new Date())); + pd.put("OPERATIME", DateUtil.date2Str(new Date())); + pd.put("ISDELETE", "0"); + fireResourcesService.save(pd,files); + map.put("result", errInfo); + return map; + } + + @RequestMapping(value = "/edit") + @ResponseBody + public Object edit(@RequestParam(value="FFILE",required=false) MultipartFile[] files) throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + pd.put("OPERATIME", DateUtil.date2Str(new Date())); + pd.put("ISDELETE", "0"); + fireResourcesService.edit(pd,files); + map.put("result", errInfo); + return map; + } + + @RequestMapping(value = "/delete") + @ResponseBody + public Object delete(Page page) { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + fireResourcesService.delete(pd); + map.put("result", errInfo); + return map; + } +}