消防器材功能迁移至企业端 #11
|
@ -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<String, Object> map = new HashMap<String, Object>();
|
||||||
|
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<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||||||
|
paramMap.add("FIRERESOURCES_NAME", pd.getString("FIRERESOURCES_NAME"));
|
||||||
|
paramMap.add("FIRERESOURCES_TYPE", pd.getString("FIRERESOURCES_TYPE"));
|
||||||
|
Map<String, Object> result =
|
||||||
|
restTemplate.postForObject(cfdUrl + "/sync/map/fireResources/list", paramMap, Map.class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
//获取当前人的公司id
|
||||||
|
List<PageData> 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<String, Object> map = new HashMap<String, Object>();
|
||||||
|
String errInfo = "success";
|
||||||
|
PageData pddata = this.getPageData();
|
||||||
|
if ("00004".equals(pddata.getString("GANGKOU"))) {
|
||||||
|
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||||||
|
paramMap.add("FIRERESOURCES_ID", pddata.getString("FIRERESOURCES_ID"));
|
||||||
|
Map<String, Object> 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<String, Object> map = new HashMap<String, Object>();
|
||||||
|
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<String, Object> map = new HashMap<String, Object>();
|
||||||
|
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<String, Object> map = new HashMap<String, Object>();
|
||||||
|
String errInfo = "success";
|
||||||
|
PageData pd = new PageData();
|
||||||
|
pd = this.getPageData();
|
||||||
|
fireResourcesService.delete(pd);
|
||||||
|
map.put("result", errInfo);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue