qa-prevention-gwj/src/main/java/com/zcloud/controller/mkmj/MkmjRelationController.java

197 lines
5.8 KiB
Java

package com.zcloud.controller.mkmj;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.mkmj.MkmjRelationService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Tools;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.*;
@Controller
@RequestMapping("/mkmjRelation")
public class MkmjRelationController extends BaseController {
@Autowired
private MkmjRelationService mkmjRelationService;
/**新增
* @param
* @throws Exception
*/
@RequestMapping(value="/add")
@RequiresPermissions("mkmjDoor:add")
@ResponseBody
public Object add() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 添加时间
pd.put("CREATOR", Jurisdiction.getUSER_ID()); // 添加人
pd.put("CREATTIME", DateUtil.date2Str(new Date())); // 添加时间
pd.put("ISDELETE", "0"); //是否删除
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));//修改时间
return mkmjRelationService.save(pd);
}
/**删除
* @param
* @throws Exception
*/
@RequestMapping(value="/delete")
@RequiresPermissions("mkmjDoor:del")
@ResponseBody
public Object delete() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
return mkmjRelationService.delete(pd);
}
/**修改
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
@RequiresPermissions("mkmjDoor:edit")
@ResponseBody
public Object edit() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));//修改时间
return mkmjRelationService.edit(pd);
}
/**列表
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
@RequiresPermissions("mkmjDoor: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 = mkmjRelationService.list(page); //列出Coursectk列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping(value="/listAllForArea")
@RequiresPermissions("mkmjDoor:list")
@ResponseBody
public Object listAllForArea() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = mkmjRelationService.listAllForArea(pd); //列出Coursectk列表
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
/**去修改页面获取数据
* @param
* @throws Exception
*/
@RequestMapping(value="/goEdit")
@RequiresPermissions("mkmjDoor:edit")
@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 = mkmjRelationService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**去修改页面获取数据
* @param
* @throws Exception
*/
@RequestMapping(value="/findById")
@RequiresPermissions("mkmjDoor:edit")
@ResponseBody
public Object findById() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = mkmjRelationService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**定位
* @param
* @throws Exception
*/
@RequestMapping(value="/savePosition")
@ResponseBody
public Object savePosition() throws Exception{
PageData pd = new PageData();
pd = this.getPageData();
return mkmjRelationService.savePosition(pd); //根据ID读取
}
/**列表
* @param page
* @throws Exception
*/
@RequestMapping(value="/getInfoList")
@RequiresPermissions("mkmjDoor:list")
@ResponseBody
public Object getInfoList(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
page.setPd(pd);
List<PageData> varList = new ArrayList<>();
varList = mkmjRelationService.getCarAndPeopleInfolistPage(page); //列出人闸机信息列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping(value="/getAllCarAndPeopleInfoCountByArea")
@ResponseBody
public Object getAllCarAndPeopleInfoCountByArea() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = this.getPageData();
List<PageData> varList = mkmjRelationService.getAllCarAndPeopleInfoCountByArea(pd); //列出人闸机信息列表
List<PageData> returnList = new ArrayList<>();
for(PageData pageData:varList){
if(StringUtils.equals(pageData.getString("AREA_NAME"),"辅建区")&&StringUtils.equals(pageData.getString("TYPE"),"person")){
continue;
}
returnList.add(pageData);
}
map.put("varList", returnList);
map.put("result", errInfo);
return map;
}
}