| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- package cn.com.lzt.car.jobImageManagement.controller;
- import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
- import cn.com.lzt.car.jobImageManagement.entity.TBCarShoot;
- import cn.com.lzt.car.jobImageManagement.service.jobImageManagementService;
- import com.alibaba.fastjson.JSONObject;
- import org.apache.commons.lang.xwork.StringUtils;
- import org.apache.log4j.Logger;
- import org.jeecgframework.core.common.controller.BaseController;
- import org.jeecgframework.core.common.exception.BusinessException;
- import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
- import org.jeecgframework.core.common.model.json.AjaxJson;
- import org.jeecgframework.core.common.model.json.DataGrid;
- import org.jeecgframework.core.constant.Globals;
- import org.jeecgframework.core.util.JeecgDataAutorUtils;
- import org.jeecgframework.core.util.MyBeanUtils;
- import org.jeecgframework.core.util.ResourceUtil;
- import org.jeecgframework.core.util.StringUtil;
- import org.jeecgframework.tag.core.easyui.TagUtil;
- import org.jeecgframework.tag.vo.datatable.SortDirection;
- import org.jeecgframework.web.system.pojo.base.TSType;
- import org.jeecgframework.web.system.service.SystemService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.ModelMap;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.servlet.ModelAndView;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * @author LiuMengxiang
- * @version V1.0
- * @Title: Controller
- * @Description: 作业车辆-抓拍图片管理
- * @date 2021年11月11日16:06:49
- */
- @Controller
- @RequestMapping("/imageManagementController")
- public class ImageManagementController extends BaseController {
- /**
- * Logger for this class
- */
- private static final Logger logger = Logger.getLogger(ImageManagementController.class);
- @Resource
- private jobImageManagementService jobImageManagementService;
- @Autowired
- private SystemService systemService;
- /***
- * 页面跳转到抓拍筛选index页面
- * @author 刘梦祥
- * @date 2021年11月12日10:30:08
- * @param request
- * @return ModelAndView
- */
- @RequestMapping(params = "screeningIndex")
- public ModelAndView screeningIndex(HttpServletRequest request) {
- return new ModelAndView("cn/com/lzt/jobimage/management/screeningList");
- }
- /***
- * 页面跳转到抓拍存证index页面
- * @author 刘梦祥
- * @date 2021年11月12日17:46:19
- * @param request
- * @return ModelAndView
- */
- @RequestMapping(params = "depositCertificateIndex")
- public ModelAndView depositCertificateIndex(HttpServletRequest request) {
- return new ModelAndView("cn/com/lzt/jobimage/management/depositCertificateList");
- }
- /***
- * 页面跳转到录像回放index页面
- * @author 刘梦祥
- * @date 2021年11月15日15:37:36
- * @param request
- * @return ModelAndView
- */
- @RequestMapping(params = "videoPlaybackIndex")
- public ModelAndView videoPlaybackIndex(HttpServletRequest request) {
- return new ModelAndView("cn/com/lzt/jobimage/management/videoPlaybackList2");
- }
- /**
- * 初始化请求接口
- *
- * @param tBCarShoot
- * @param request
- * @param response
- * @param dataGrid
- * @author 刘梦祥
- * @date 2021年11月12日10:29:43
- */
- @RequestMapping(params = "datagrid")
- public void datagrid(TBCarShoot tBCarShoot, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
- CriteriaQuery cq = new CriteriaQuery(TBCarShoot.class, dataGrid);
- String plateNo = request.getParameter("plateNo");
- // 查询条件组装器-车牌号
- tBCarShoot.setPlateNo(null);
- if (StringUtils.isNotBlank(plateNo)) {
- cq.like("plateNo", "%" + plateNo + "%");
- }
- String position = request.getParameter("position");
- // 查询条件组装器-抓拍位置
- tBCarShoot.setPosition(null);
- if (StringUtils.isNotBlank(position)) {
- cq.like("position", "%" + position + "%");
- }
- String type = request.getParameter("type");
- // 查询条件组装器-车辆类型
- tBCarShoot.setType(null);
- if (StringUtils.isNotBlank(type)) {
- // 模糊查询
- cq.eq("type", type);
- }
- String camera = request.getParameter("camera");
- // 查询条件组装器-摄像头位置
- if (StringUtils.isNotBlank(camera)) {
- // 模糊查询
- cq.eq("camera", Integer.valueOf(camera));
- tBCarShoot.setCamera(null);
- }
- String status = request.getParameter("status");
- // 查询条件组装器-存证状态
- if (StringUtils.isNotBlank(status)) {
- // 模糊查询
- cq.eq("status", Integer.valueOf(status));
- tBCarShoot.setStatus(null);
- }
- Map<String,Object> map = new HashMap<>();
- map.put("uploadTime", "desc");
- cq.setOrder(map);
- //查询条件组装器
- org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tBCarShoot, request.getParameterMap());
- cq.add();
- this.jobImageManagementService.getDataGridReturn(cq, true);
- List<TBCarShoot> tBCarShootData = dataGrid.getResults();
- // 得到文件服务器地址
- TSType tsType = systemService.getType("JobFileServerIpAddress","serverAddress");
- TSType tsType2 = systemService.getType("JobFileServerPortAddress","serverAddress");
- //查询出所有的车辆类型
- String getAllCarTypeList = "select * from t_s_type where typegroupid = (select id from t_s_typegroup where typegroupcode = \"cartype\");";
- List<Map<String,Object>> allCarTypeList = this.systemService.findForJdbc(getAllCarTypeList);
- Map<String,String> allCarTypeMap = new HashMap<>();
- if(allCarTypeList != null && allCarTypeList.size() > 0){
- for (Map<String,Object> carTypeItem : allCarTypeList){
- if(carTypeItem.containsKey("typecode") && carTypeItem.containsKey("typename") && carTypeItem.get("typecode") != null && carTypeItem.get("typename") != null){
- allCarTypeMap.put(String.valueOf(carTypeItem.get("typecode")),String.valueOf(carTypeItem.get("typename")));
- }
- }
- }
- for (TBCarShoot tbCarShoot : tBCarShootData){
- if(StringUtil.isNotEmpty(tbCarShoot.getType()) && allCarTypeMap.containsKey(tbCarShoot.getType())){
- tbCarShoot.setType(allCarTypeMap.get(tbCarShoot.getType()));
- }else{
- tbCarShoot.setType("未知车辆类型");
- }
- if(StringUtil.isNotEmpty(tbCarShoot.getShoot()) && !tbCarShoot.getShoot().contains("http")){
- tbCarShoot.setShoot(tsType.getTypename().concat(tsType2.getTypename()).concat(tbCarShoot.getShoot()));
- }
- }
- dataGrid.setResults(tBCarShootData);
- TagUtil.datagrid(response, dataGrid);
- }
- /**
- * 车辆抓拍档案存证更新(同时支持批量操作)
- *
- * @param
- * @return AjaxJson
- * @author 刘梦祥
- * @date 2021年11月12日10:30:38
- */
- @RequestMapping(params = "depositCertificate")
- @ResponseBody
- public AjaxJson depositCertificate(TBCarShoot tBCarShoot) {
- String message = null;
- AjaxJson j = new AjaxJson();
- try {
- // 批量对象操作
- if (tBCarShoot.getCheckIds() != null && tBCarShoot.getCheckIds().length() > 0) {
- String[] checkidsList = tBCarShoot.getCheckIds().split(",");
- for (String checkId : checkidsList) {
- TBCarShoot t = jobImageManagementService.get(TBCarShoot.class, checkId);
- // 防止多用户操作同一对象导致重复操作出现异常
- if (t != null) {
- MyBeanUtils.copyBeanNotNull2Bean(tBCarShoot, t);
- t.setStatus(1);
- jobImageManagementService.saveOrUpdate(t);
- message = "车辆抓拍档案更新成功";
- systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
- }
- }
- } else {
- // 单个对象操作
- TBCarShoot t = jobImageManagementService.get(TBCarShoot.class, tBCarShoot.getId());
- MyBeanUtils.copyBeanNotNull2Bean(tBCarShoot, t);
- t.setStatus(1);
- jobImageManagementService.saveOrUpdate(t);
- message = "车辆抓拍档案更新成功";
- systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw new BusinessException(e.getMessage());
- }
- j.setMsg(message);
- return j;
- }
- /**
- * 车辆抓拍档案存证删除(同时支持批量操作)
- *
- * @return AjaxJson
- * @author 刘梦祥
- * @date 2021年11月12日10:31:40
- */
- @RequestMapping(params = "delDepositCertificate")
- @ResponseBody
- public AjaxJson delDepositCertificate(TBCarShoot tBCarShoot) {
- String message = null;
- AjaxJson j = new AjaxJson();
- try {
- // 批量对象操作
- if (tBCarShoot.getCheckIds() != null && tBCarShoot.getCheckIds().length() > 0) {
- String[] checkidsList = tBCarShoot.getCheckIds().split(",");
- for (String checkId : checkidsList) {
- TBCarShoot t = jobImageManagementService.get(TBCarShoot.class, checkId);
- // 防止多用户操作同一对象导致重复操作出现异常
- if (t != null) {
- jobImageManagementService.delete(t);
- message = "车辆抓拍档案删除成功";
- systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
- }
- }
- } else {
- // 单个对象操作
- tBCarShoot = systemService.getEntity(TBCarShoot.class, tBCarShoot.getId());
- jobImageManagementService.delete(tBCarShoot);
- message = "车辆抓拍档案删除成功";
- systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw new BusinessException(e.getMessage());
- }
- j.setMsg(message);
- return j;
- }
- /**
- * 批量导出数据
- *
- * @param tBCarShoot
- * @return
- * @author 刘梦祥
- * @date 2021年11月15日13:17:24
- */
- @RequestMapping(params = "exportXls")
- public String exportXls(TBCarShoot tBCarShoot, HttpServletResponse response, HttpServletRequest request, DataGrid dataGrid, ModelMap modelMap) {
- String pageType = request.getParameter("pageType");
- modelMap.put(NormalExcelConstants.FILE_NAME, "jobImageManagementListTable".equals(pageType) ? "抓拍图片存证管理" : "抓拍录像管理");
- modelMap.put(NormalExcelConstants.CLASS, TBCarShoot.class);
- modelMap.put(NormalExcelConstants.PARAMS, new cn.afterturn.easypoi.excel.entity.ExportParams( "jobImageManagementListTable".equals(pageType) ? "抓拍图片存证管理列表" : "抓拍录像管理列表", "导出人:" + ResourceUtil.getSessionUser().getRealName(),
- "导出信息"));
- //批量对象操作
- List<TBCarShoot> list = new ArrayList<>();
- if (tBCarShoot.getCheckIds() != null && tBCarShoot.getCheckIds().length() > 0) {
- // 得到文件服务器地址
- TSType tsType = systemService.getType("JobFileServerIpAddress","serverAddress");
- TSType tsType2 = systemService.getType("JobFileServerPortAddress","serverAddress");
- //查询出所有的车辆类型
- String getAllCarTypeList = "select * from t_s_type where typegroupid = (select id from t_s_typegroup where typegroupcode = \"cartype\");";
- List<Map<String,Object>> allCarTypeList = this.systemService.findForJdbc(getAllCarTypeList);
- Map<String,String> allCarTypeMap = new HashMap<>();
- if(allCarTypeList != null && allCarTypeList.size() > 0){
- for (Map<String,Object> carTypeItem : allCarTypeList){
- if(carTypeItem.containsKey("typecode") && carTypeItem.containsKey("typename") && carTypeItem.get("typecode") != null && carTypeItem.get("typename") != null){
- allCarTypeMap.put(String.valueOf(carTypeItem.get("typecode")),String.valueOf(carTypeItem.get("typename")));
- }
- }
- }
- String[] checkidsList = tBCarShoot.getCheckIds().split(",");
- for (String checkId : checkidsList) {
- TBCarShoot t = jobImageManagementService.get(TBCarShoot.class, checkId);
- //防止多用户操作同一对象导致重复操作出现异常
- if (t != null) {
- TBCarShoot tBCarShoot1 = JSONObject.parseObject(JSONObject.toJSONString(t), TBCarShoot.class);
- if(tBCarShoot1.getCamera() != null){
- switch (tBCarShoot1.getCamera()){
- case 1:
- tBCarShoot1.setCameraStr("前置");
- break;
- case 2:
- tBCarShoot1.setCameraStr("后置");
- break;
- case 3:
- tBCarShoot1.setCameraStr("驾驶室");
- break;
- default:
- tBCarShoot1.setCameraStr("未知");
- break;
- }
- }
- // 转换车辆类型
- if(StringUtil.isNotEmpty(tBCarShoot1.getType()) && allCarTypeMap.containsKey(tBCarShoot1.getType())){
- tBCarShoot1.setType(allCarTypeMap.get(tBCarShoot1.getType()));
- }else{
- tBCarShoot1.setType("未知车辆类型");
- }
- // 转换文件路径
- if(StringUtil.isNotEmpty(tBCarShoot1.getShoot()) && !tBCarShoot1.getShoot().contains("http")){
- tBCarShoot1.setShoot(tsType.getTypename().concat(tsType2.getTypename()).concat(tBCarShoot1.getShoot()));
- }
- list.add(tBCarShoot1);
- }
- }
- }
- modelMap.put(NormalExcelConstants.DATA_LIST, list);
- return NormalExcelConstants.EASYPOI_EXCEL_VIEW;
- }
- }
|