integrated_traffic/src/main/java/com/zcloud/controller/system/FHlogController.java

161 lines
5.3 KiB
Java
Raw Normal View History

2024-01-03 09:48:43 +08:00
package com.zcloud.controller.system;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
2024-01-03 11:04:18 +08:00
import com.zcloud.logs.LogAnno;
import com.zcloud.service.system.DepartmentService;
2024-01-03 09:48:43 +08:00
import com.zcloud.service.system.FHlogService;
2024-01-03 11:04:18 +08:00
import com.zcloud.service.system.UsersService;
2024-01-03 09:48:43 +08:00
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Tools;
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.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* luoxiaobao
* www.qdkjchina.com
*/
@Controller
@RequestMapping("/fhlog")
public class FHlogController extends BaseController {
@Autowired
private FHlogService fHlogService;
2024-01-03 11:04:18 +08:00
@Autowired
private UsersService usersService;
@Autowired
private DepartmentService departmentService;
2024-01-03 09:48:43 +08:00
/**
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
// @RequiresPermissions("fhlog:list")
2024-01-03 09:48:43 +08:00
@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());
2024-01-03 11:04:18 +08:00
String STARTTIME = pd.getString("STARTTIME"); //开始时间
2024-01-03 09:48:43 +08:00
String ENDTIME = pd.getString("ENDTIME"); //结束时间
2024-01-03 11:04:18 +08:00
if(Tools.notEmpty(STARTTIME))pd.put("STARTTIME", STARTTIME+" 00:00:00");
2024-01-03 09:48:43 +08:00
if(Tools.notEmpty(ENDTIME))pd.put("ENDTIME", ENDTIME+" 00:00:00");
page.setPd(pd);
List<PageData> varList = fHlogService.list(page); //列出FHlog列表
map.put("varList", varList);
map.put("page", page);
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* @param out
* @throws Exception
*/
@RequestMapping(value="/delete")
// @RequiresPermissions("fhlog:del")
2024-01-03 09:48:43 +08:00
@ResponseBody
public Object delete() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
PageData pd = new PageData();
pd = this.getPageData();
fHlogService.delete(pd);
map.put("result", "success"); //返回结果
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/deleteAll")
// @RequiresPermissions("fhlog:del")
2024-01-03 09:48:43 +08:00
@ResponseBody
public Object deleteAll() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String DATA_IDS = pd.getString("DATA_IDS");
if(null != DATA_IDS && !"".equals(DATA_IDS)){
String ArrayDATA_IDS[] = DATA_IDS.split(",");
fHlogService.deleteAll(ArrayDATA_IDS);
}else{
errInfo = "error";
}
map.put("result", errInfo); //返回结果
return map;
}
/**
* @param page
* @throws Exception
*/
@RequestMapping(value="/getList")
// @RequiresPermissions("fhlog:list")
2024-01-03 09:48:43 +08:00
@ResponseBody
2024-01-03 11:04:18 +08:00
@LogAnno(menuType= "双重预控",menuServer= "离岗管理",instructionsOperate = "登录记录",instructionsType = "列表")
2024-01-03 09:48:43 +08:00
public Object getList(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
2024-01-03 11:04:18 +08:00
PageData npd = new PageData();
2024-01-03 09:48:43 +08:00
pd = this.getPageData();
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
2024-01-03 11:04:18 +08:00
if(Tools.notEmpty(KEYWORDS))npd.put("KEYWORDS", KEYWORDS.trim());
String STARTTIME = pd.getString("STARTTIME"); //开始时间
2024-01-03 09:48:43 +08:00
String ENDTIME = pd.getString("ENDTIME"); //结束时间
2024-01-03 11:04:18 +08:00
if(Tools.notEmpty(STARTTIME))npd.put("STARTTIME", STARTTIME+" 00:00:00");
2024-07-08 08:27:36 +08:00
if(Tools.notEmpty(ENDTIME))npd.put("ENDTIME", ENDTIME+" 23:59:59");
2024-01-03 11:04:18 +08:00
npd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
npd.put("ISMAIN", Jurisdiction.getIS_MAIN());
npd.put("ISSUPERVISE", Jurisdiction.getISSUPERVISE());
npd.put("DEPARTMENT_ID", Jurisdiction.getDEPARTMENT_ID());
2024-01-03 09:48:43 +08:00
String DEPTIDS = pd.getString("DEPTIDS");
if(Tools.notEmpty(DEPTIDS)) {
String DEPT_IDS[] = DEPTIDS.split(",");
2024-01-03 11:04:18 +08:00
npd.put("DEPT_IDS", DEPT_IDS);
2024-01-03 09:48:43 +08:00
}
2024-01-03 11:04:18 +08:00
pd.put("USER_ID",Jurisdiction.getUSER_ID());
PageData cpd = new PageData();
cpd = usersService.findById(pd);
npd.put("ISLEADER", cpd.getString("ISLEADER"));
if(cpd.getString("ISLEADER") != null && cpd.getString("ISLEADER").equals("1")){
String DEPARTMENT_ID = npd.getString("DEPARTMENT_ID");
String ids = departmentService.getDEPARTMENT_IDS(DEPARTMENT_ID);
ids=npd.getString("DEPARTMENT_ID")+","+ids; //把自己部门插入进去
if(ids!=null && Tools.notEmpty(ids)&& ids.lastIndexOf(",")>-1) {
ids = ids.substring(0,ids.lastIndexOf(","));
npd.put("DEPARTMENT_IDS", ids.split(","));
}else {
npd.put("DEPARTMENT_IDS", DEPARTMENT_ID);
}
}else {
if(npd.getString("ISMAIN").equals("0")){
npd.put("USER_ID",Jurisdiction.getUSER_ID());
}
}
page.setPd(npd);
2024-01-03 09:48:43 +08:00
List<PageData> varList = fHlogService.getList(page); //列出FHlog列表
map.put("varList", varList);
map.put("page", page);
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
}