integrated_traffic/src/main/java/com/zcloud/controller/firefightingMaintain/FirefightingMaintainControl...

157 lines
5.7 KiB
Java
Raw Normal View History

package com.zcloud.controller.firefightingMaintain;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.firefightingMaintain.FirefightingMaintainService;
import com.zcloud.service.maintain.MaintainService;
import com.zcloud.service.system.ImgFilesService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Smb;
import com.zcloud.util.Tools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/firefightingmaintain")
public class FirefightingMaintainController extends BaseController {
@Autowired
private FirefightingMaintainService firefightingMaintainService;
@Autowired
private Smb smb;
@Autowired
private ImgFilesService imgfilesService;
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/add")
@ResponseBody
public Object add() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("FIREFIGHTINGMAINTAIN_ID", this.get32UUID());
pd.put("ISDELETE", "0"); //是否删除(0:有效 1删除)
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人id
pd.put("CREATORNAME", Jurisdiction.getUsername()); //添加人名字
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人id
pd.put("OPERATORNAME", Jurisdiction.getUsername()); // 修改人名字
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间
firefightingMaintainService.save(pd);
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/delete")
@ResponseBody
public Object delete() throws Exception{
Map<String,String> map = new HashMap<String,String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("DELETOR", Jurisdiction.getUSER_ID());
pd.put("DELETORNAME", Jurisdiction.getUsername());
pd.put("DELETTIME", DateUtil.date2Str(new Date()));
firefightingMaintainService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
@ResponseBody
public Object edit() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("ISDELETE", "0"); //是否删除(0:有效 1删除)
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人id
pd.put("CREATORNAME", Jurisdiction.getUsername()); //添加人名字
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人id
pd.put("OPERATORNAME", Jurisdiction.getUsername()); // 修改人名字
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间
firefightingMaintainService.edit(pd);
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/goEdit")
@ResponseBody
public Object goEdit() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = firefightingMaintainService.findById(pd);
pd.put("FOREIGN_KEY", pd.getString("FIREFIGHTINGMAINTAIN_ID"));
pd.put("TYPE",120);
List<PageData> firefightingmaintainImg = imgfilesService.listAll(pd); //设备设施
map.put("firefightingmaintainImg", firefightingmaintainImg);
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
@RequestMapping(value="/list")
@ResponseBody
public Object list(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
page.setPd(pd);
List<PageData> varList = firefightingMaintainService.list(page); //列出MajorDangerSource列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping(value="/findByFirefightingId")
@ResponseBody
public Object getRisByUnitId(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("FIREFIGHTINGFACILITY_ID", pd.getString("FIREFIGHTINGFACILITY_ID"));
page.setPd(pd);
List<PageData> varList = firefightingMaintainService.findByProductionEquipmentFacilityId(page); //列出RiskUnit列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
}