281 lines
8.9 KiB
Java
281 lines
8.9 KiB
Java
|
package com.zcloud.controller.bus;
|
|||
|
|
|||
|
import com.alibaba.fastjson.JSON;
|
|||
|
import com.alibaba.fastjson.JSONObject;
|
|||
|
import com.zcloud.controller.base.BaseController;
|
|||
|
import com.zcloud.entity.Page;
|
|||
|
import com.zcloud.entity.PageData;
|
|||
|
import com.zcloud.service.bus.*;
|
|||
|
import com.zcloud.service.system.DepartmentService;
|
|||
|
import com.zcloud.service.system.UserExamineService;
|
|||
|
import com.zcloud.util.*;
|
|||
|
import net.sf.json.JSONArray;
|
|||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
|
import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
import org.springframework.stereotype.Controller;
|
|||
|
import org.springframework.transaction.annotation.Transactional;
|
|||
|
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.multipart.MultipartFile;
|
|||
|
import org.springframework.web.servlet.ModelAndView;
|
|||
|
|
|||
|
import javax.servlet.http.HttpServletResponse;
|
|||
|
import java.io.File;
|
|||
|
import java.util.*;
|
|||
|
|
|||
|
/**
|
|||
|
* 说明:外来车辆管理
|
|||
|
* 作者:yangming
|
|||
|
* 时间:2022-03-31
|
|||
|
* 官网:www.zcloudchina.com
|
|||
|
*/
|
|||
|
@Controller
|
|||
|
@RequestMapping("/foreigncar")
|
|||
|
public class ForeignCarController extends BaseController {
|
|||
|
|
|||
|
@Autowired
|
|||
|
private ForeignCarService foreignCarService;
|
|||
|
|
|||
|
@Autowired
|
|||
|
private ForeignCarDetailsService foreignCarDetailsService;
|
|||
|
@Autowired
|
|||
|
private DepartmentService departmentService;
|
|||
|
@Autowired
|
|||
|
private BlackListService blackListService;
|
|||
|
@Autowired
|
|||
|
private UserExamineService userExamineService;
|
|||
|
|
|||
|
/**新增
|
|||
|
* @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("CORPINFO_ID",Jurisdiction.getCORPINFO_ID());
|
|||
|
List<PageData> pageData = blackListService.findByLicensePlate(pd);
|
|||
|
String DEPARTMENT_ID = Jurisdiction.getDEPARTMENT_ID();
|
|||
|
pd.put("DEPARTMENT_ID",DEPARTMENT_ID);
|
|||
|
pd.put("STARTTIME",pd.getString("STARTTIME").trim());
|
|||
|
pd.put("ENDTIME",pd.getString("ENDTIME").trim());
|
|||
|
if(pageData.size()>0){
|
|||
|
errInfo = "fail";
|
|||
|
map.put("msg", "车牌号在黑名单中");
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}else{
|
|||
|
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.getString("PERSONJSON"));
|
|||
|
for (JSONObject json : list) {
|
|||
|
if (json.get("NAME") != null && json.get("NAME") != "" && json.get("PHONO_NUMBER") != null
|
|||
|
&& json.get("PHONO_NUMBER") != "") {
|
|||
|
PageData phono = new PageData();
|
|||
|
phono.put("PHONO_NUMBER",json.get("PHONO_NUMBER"));
|
|||
|
phono.put("CORPINFO_ID",pd.getString("CORPINFO_ID"));
|
|||
|
List<PageData> pageData1 = blackListService.findByPhonoNumber(phono);
|
|||
|
if(pageData1.size() > 0){
|
|||
|
errInfo = "fail";
|
|||
|
map.put("msg", "手机号【"+json.get("PHONO_NUMBER")+"】在黑名单中");
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
String start = pd.getString("APPLICATION_TIME[0]");
|
|||
|
String end = pd.getString("APPLICATION_TIME[1]");
|
|||
|
pd.put("APPLICATION_TIME",start+","+end);
|
|||
|
pd.put("DEPARTMENT_ID",Jurisdiction.getDEPARTMENT_ID());
|
|||
|
pd.put("FOREIGNCAR_ID", this.get32UUID()); //主键
|
|||
|
pd.put("APPLY_SOURCE","PC端");
|
|||
|
pd.put("APPLYTIME", DateUtil.date2Str(new Date()));
|
|||
|
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人
|
|||
|
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
|
|||
|
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人
|
|||
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
|
|||
|
pd.put("ISDELETE", "0"); //是否删除 1-是 0-否
|
|||
|
foreignCarService.save(pd);
|
|||
|
map.put("result", errInfo);
|
|||
|
map.put("pd", pd);
|
|||
|
}
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**去修改页面获取数据
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value="/goAdd")
|
|||
|
@ResponseBody
|
|||
|
public Object goAdd() throws Exception{
|
|||
|
Map<String,Object> map = new HashMap<String,Object>();
|
|||
|
String errInfo = "success";
|
|||
|
// //获取部门下拉树
|
|||
|
// List<PageData> zdepartmentPdList = new ArrayList<PageData>();
|
|||
|
// String ZDEPARTMENT_ID = Jurisdiction.getDEPARTMENT_ID();
|
|||
|
// ZDEPARTMENT_ID = "".equals(ZDEPARTMENT_ID)?"0":ZDEPARTMENT_ID;
|
|||
|
// PageData dept = new PageData();
|
|||
|
// dept.put("DEPARTMENT_ID",ZDEPARTMENT_ID);
|
|||
|
// dept=this.departmentService.findById(dept);
|
|||
|
|
|||
|
//获取部门下拉树
|
|||
|
List<PageData> zdepartmentPdList = new ArrayList<PageData>();
|
|||
|
PageData dept = new PageData();
|
|||
|
dept.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
|||
|
dept=this.departmentService.findByCorpId(dept);
|
|||
|
String ZDEPARTMENT_ID = dept.getString("DEPARTMENT_ID");
|
|||
|
|
|||
|
PageData node = new PageData();
|
|||
|
node.put("id", dept.get("DEPARTMENT_ID"));
|
|||
|
node.put("parentId", dept.get("PARENT_ID"));
|
|||
|
node.put("name", dept.get("NAME"));
|
|||
|
node.put("icon", "../../../assets/images/user.gif");
|
|||
|
zdepartmentPdList.add(node);
|
|||
|
JSONArray arr = JSONArray.fromObject(departmentService.listAllDepartmentToSelect(ZDEPARTMENT_ID,zdepartmentPdList));
|
|||
|
map.put("zTreeNodes", (null == arr ?"":"{\"treeNodes\":" + arr.toString() + "}"));
|
|||
|
|
|||
|
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("OPERATOR", Jurisdiction.getUsername()); //修改人
|
|||
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
|
|||
|
foreignCarService.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();
|
|||
|
if(pd.getString("STATE").equals("6")){
|
|||
|
pd.put("STATE","1");
|
|||
|
}
|
|||
|
String start = pd.getString("APPLICATION_TIME[0]");
|
|||
|
String end = pd.getString("APPLICATION_TIME[1]");
|
|||
|
pd.put("APPLICATION_TIME",start+","+end);
|
|||
|
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
|
|||
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
|
|||
|
pd.put("APPLYTIME",DateUtil.date2Str(new Date()));
|
|||
|
foreignCarService.edit(pd);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**列表
|
|||
|
* @param page
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@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();
|
|||
|
if (!Jurisdiction.getDEPARTMENT_ID().equals(Jurisdiction.getCORPINFO_ID())) {
|
|||
|
pd.put("CREATOR",Jurisdiction.getUSER_ID());
|
|||
|
}
|
|||
|
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
|||
|
page.setPd(pd);
|
|||
|
List<PageData> varList = foreignCarService.list(page); //列出RiskUnit列表
|
|||
|
map.put("varList", varList);
|
|||
|
map.put("page", page);
|
|||
|
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 = foreignCarService.findById(pd); //根据ID读取
|
|||
|
map.put("pd", pd);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**批量删除
|
|||
|
* @param
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value="/deleteAll")
|
|||
|
@ResponseBody
|
|||
|
public Object deleteAll() throws Exception{
|
|||
|
Map<String,Object> map = new HashMap<String,Object>();
|
|||
|
String errInfo = "success";
|
|||
|
String err="";
|
|||
|
PageData pd = new PageData();
|
|||
|
pd = this.getPageData();
|
|||
|
String DATA_IDS = pd.getString("DATA_IDS");
|
|||
|
if(Tools.notEmpty(DATA_IDS)){
|
|||
|
String ArrayDATA_IDS[] = DATA_IDS.split(",");
|
|||
|
for (String id : ArrayDATA_IDS) {
|
|||
|
PageData unit = new PageData();
|
|||
|
unit.put("RISKUNIT_ID", id);
|
|||
|
pd.put("RISKUNIT_ID", id);
|
|||
|
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
|
|||
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
|
|||
|
foreignCarService.delete(pd);
|
|||
|
}
|
|||
|
// riskunitService.deleteAll(ArrayDATA_IDS);
|
|||
|
errInfo = "success";
|
|||
|
}else{
|
|||
|
errInfo = "fail";
|
|||
|
}
|
|||
|
map.put("result", errInfo); //返回结果
|
|||
|
return map;
|
|||
|
}
|
|||
|
|
|||
|
/**列表
|
|||
|
* @param page
|
|||
|
* @throws Exception
|
|||
|
*/
|
|||
|
@RequestMapping(value="/getForeignCarById")
|
|||
|
@ResponseBody
|
|||
|
public Object getForeignCarById(Page page) 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());
|
|||
|
page.setPd(pd);
|
|||
|
List<PageData> varList = foreignCarService.getForeignCarById(page);
|
|||
|
map.put("varList", varList);
|
|||
|
map.put("page", page);
|
|||
|
map.put("result", errInfo);
|
|||
|
return map;
|
|||
|
}
|
|||
|
}
|