package com.zcloud.controller.bus; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.bus.ForeignCarService; import com.zcloud.service.bus.OutsidersService; import com.zcloud.service.system.UserExamineService; import com.zcloud.service.system.UsersService; import com.zcloud.util.DateUtil; import com.zcloud.util.Jurisdiction; 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; /** * 说明:门禁现场确认 * 作者:yangming * 官网:www.fhadmin. org */ @Controller @RequestMapping("/sceneconfirm") public class SceneConfirmController extends BaseController { @Autowired private ForeignCarService foreignCarService; @Autowired private UserExamineService userExamineService; @Autowired private UsersService usersService; @Autowired private OutsidersService outsidersService; /**职能部门新增外来车辆申请 * @param * @throws Exception */ @RequestMapping(value="/add") @ResponseBody public Object add() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); String start = pd.getString("APPLICATION_TIME[0]"); String end = pd.getString("APPLICATION_TIME[1]"); pd.put("APPLICATION_TIME",start+","+end); pd.put("STATE",'2');//提交后默认待审核状态 pd.put("DEPARTMENT_ID",Jurisdiction.getDEPARTMENT_ID()); pd.put("FOREIGNCAR_ID", this.get32UUID()); //主键 pd.put("APPLY_SOURCE",Jurisdiction.getUSER_ID()); pd.put("APPLYTIME", DateUtil.date2Str(new Date())); pd.put("CREATOR", Jurisdiction.getUsername()); //添加人 pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("ISDELETE", "0"); //是否删除 1-是 0-否 foreignCarService.save(pd); map.put("result", errInfo); return map; } /**审核通过 * @param * @throws Exception */ @RequestMapping(value="/edit") @ResponseBody public Object edit() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 pd.put("CONFIRM_PEOPLE", Jurisdiction.getName()); //确认人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 if(pd.getString("STATE").equals("4")){ pd.put("TIME_IN",DateUtil.date2Str(new Date())); //进场时间 } else if (pd.getString("STATE").equals("5")){ pd.put("TIME_OUT",DateUtil.date2Str(new Date())); //进场时间 } foreignCarService.editState(pd); map.put("result", errInfo); return map; } /**人员进场 * @param * @throws Exception */ @RequestMapping(value="/editperson") @ResponseBody public Object editperson() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 pd.put("CONFIRM_PEOPLE", Jurisdiction.getName()); //确认人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 if(pd.getString("STATE").equals("4")){ pd.put("TIME_IN",DateUtil.date2Str(new Date())); //进场时间 } else if (pd.getString("STATE").equals("5")){ pd.put("TIME_OUT",DateUtil.date2Str(new Date())); //进场时间 } outsidersService.editState(pd); map.put("result", errInfo); return map; } /**列表 * @param page * @throws Exception */ @RequestMapping(value="/list") @ResponseBody public Object list(Page page) throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("USER_ID", Jurisdiction.getUSER_ID()); pd.put("DEPARTMENT_ID",Jurisdiction.getDEPARTMENT_ID()); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); pd.put("IS_DEPT_CONFIRM",'1'); page.setPd(pd); List varList = foreignCarService.confirmlist(page); map.put("varList", varList); map.put("page", page); map.put("result", errInfo); return map; } /**列表 * @param page * @throws Exception */ @RequestMapping(value="/listperson") @ResponseBody public Object listperson(Page page) throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("USER_ID", Jurisdiction.getUSER_ID()); pd.put("DEPARTMENT_ID",Jurisdiction.getDEPARTMENT_ID()); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); pd.put("IS_DEPT_CONFIRM","1"); pd.put("FIELD_ITEM","IS_DEPT_CONFIRM"); page.setPd(pd); List varList = outsidersService.confirmlist(page); List userList = userExamineService.isManageUser(pd); map.put("varList", varList); map.put("ISCONFIRM", userList.size()>0?"1":"0"); //当前用户是否是现场确认人1.是 2.否 map.put("page", page); map.put("result", errInfo); return map; } }