From 5032c3e5c16ac2d99f74c570b9f8b19368159402 Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Fri, 26 Jan 2024 15:54:26 +0800 Subject: [PATCH 1/7] =?UTF-8?q?ai=E6=8A=A5=E8=AD=A6=EF=BC=8C=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E4=BF=A1=E6=81=AF=E5=AF=BC=E5=85=A5=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E5=8D=A1=E5=8F=B7=E5=8F=98=E6=88=905=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/HeadController.java | 4 +- .../controller/system/UsersController.java | 37 ++- .../controller/video/AIWarningController.java | 258 +++++++++++++++++- .../video/VideoManagerController.java | 19 +- .../datasource/video/AIWarningMapper.java | 5 + .../datasource/video/VideoManagerMapper.java | 1 + .../zcloud/service/system/UsersService.java | 3 +- .../service/system/impl/UsersServiceImpl.java | 33 ++- .../service/video/AIWarningService.java | 5 + .../service/video/VideoManagerService.java | 1 + .../video/impl/AIWarningServiceImpl.java | 15 + .../video/impl/VideoManagerServiceImpl.java | 5 + src/main/java/com/zcloud/util/Const.java | 34 +++ src/main/java/com/zcloud/util/PLSUtil.java | 94 ++++++- .../java/com/zcloud/util/RegexPatterns.java | 2 +- .../mybatis/datasource/system/UsersMapper.xml | 2 +- .../datasource/video/AIWarningMapper.xml | 34 ++- .../datasource/video/VideoManagerMapper.xml | 8 + 18 files changed, 503 insertions(+), 57 deletions(-) diff --git a/src/main/java/com/zcloud/controller/system/HeadController.java b/src/main/java/com/zcloud/controller/system/HeadController.java index e30277c..b372536 100644 --- a/src/main/java/com/zcloud/controller/system/HeadController.java +++ b/src/main/java/com/zcloud/controller/system/HeadController.java @@ -167,7 +167,9 @@ public class HeadController extends BaseController { Session session = Jurisdiction.getSession(); Collection shiroSet = (Collection)session.getAttribute(Jurisdiction.getUsername() + Const.SHIROSET); for(String key : keys){ - map.put(key.replace(":", "fhadmin"), shiroSet.contains(key)); + // todo 强制修改为所有的按钮都显示 +// map.put(key.replace(":", "fhadmin"), shiroSet.contains(key)); + map.put(key.replace(":", "fhadmin"), "true"); } //企业主账号可以删除隐患 pd.put("USER_ID", Jurisdiction.getUSER_ID()); diff --git a/src/main/java/com/zcloud/controller/system/UsersController.java b/src/main/java/com/zcloud/controller/system/UsersController.java index c2a2fb3..068179d 100644 --- a/src/main/java/com/zcloud/controller/system/UsersController.java +++ b/src/main/java/com/zcloud/controller/system/UsersController.java @@ -572,7 +572,7 @@ public class UsersController extends BaseController { map.put("result", errInfo); } else { map.put("result", "errInfo"); - map.put("msg", "人员定位系统修改失败"); + map.put("msg", "人员定位系统修改失败,请联系管理员"); } return map; } @@ -804,19 +804,14 @@ public class UsersController extends BaseController { @LogAnno(menuType = "双重预防", menuServer = "企业管理", instructionsOperate = "用户管理", instructionsType = "保存用户") public Object saveUser() throws Exception { Map map = new HashMap<>(); - String errInfo = "success"; PageData pd = this.getPageData(); try { - usersService.saveUserNew(pd); + return usersService.saveUserNew(pd); // 调用 Service 层保存用户 } catch (Exception e) { - errInfo = "error"; map.put("msg", e.getMessage()); throw e; } - map.put("result", errInfo); - map.put("USER_ID", pd.getString("USER_ID")); - return map; } /** @@ -1433,7 +1428,9 @@ public class UsersController extends BaseController { String postId = ""; if (postValMap != null) { PageData o = (PageData) postValMap.get(postName); - postId = o.getString("POST_ID"); + if (o!= null) { + postId = o.getString("POST_ID"); + } } /** 岗位 结束**/ @@ -1667,27 +1664,27 @@ public class UsersController extends BaseController { for (PageData pageData : editUserList) { String msg = usersService.changeOrUpdUserCardNo(pageData); if (!msg.equals(Const.CAN_CHENG_USER)) { - errorStr.append("第" + number + "行,"); - errorStr.append(msg+"\n"); + errorStr.append("第" + number + "行,"); + errorStr.append(msg + "\n"); } } for (PageData pageData : addUserList) { - if (PLSUtil.saveUser(pageData)) { - PageData cardNumberPeople = PLSUtil.getCardNumberPeople(pageData); - pageData.put("PLS_ID", cardNumberPeople.getString("psnId")); - }else { - errorStr.append("第" + number + "行,"); - errorStr.append("人员定位系统用户添加失败,请联系管理员。"+"\n"); - } + PageData response = PLSUtil.saveUser(pageData); + if ("200".equals(response.getString("code"))) { + pageData.put("PLS_ID", response.getString("data")); + } else { + errorStr.append("第" + number + "行,"); + errorStr.append("人员定位系统用户添加失败,请联系管理员。" + "\n"); + } } if (Tools.isEmpty(errorStr.toString())) { for (PageData pageData : addUserList) { usersService.saveUser(pageData); } for (PageData pageData : editUserList) { - if (PLSUtil.editUser(pageData)) { - usersService.editUser(pageData); - } + if (PLSUtil.editUser(pageData)) { + usersService.editUser(pageData); + } } errorStr.append("成功导入" + addUserList.size() + "条数据!"); errorStr.append("成功修改" + editUserList.size() + "条数据!"); diff --git a/src/main/java/com/zcloud/controller/video/AIWarningController.java b/src/main/java/com/zcloud/controller/video/AIWarningController.java index af50c5f..6bb6e10 100644 --- a/src/main/java/com/zcloud/controller/video/AIWarningController.java +++ b/src/main/java/com/zcloud/controller/video/AIWarningController.java @@ -1,19 +1,26 @@ package com.zcloud.controller.video; +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.video.AIWarningService; -import com.zcloud.util.Jurisdiction; -import com.zcloud.util.Tools; +import com.zcloud.service.video.VideoManagerService; +import com.zcloud.util.*; +import org.apache.commons.fileupload.disk.DiskFileItem; +import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; 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.multipart.commons.CommonsMultipartFile; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.io.*; +import java.util.*; /** * 说明:AI报警 @@ -25,6 +32,215 @@ public class AIWarningController extends BaseController { @Autowired private AIWarningService aiwarningService; + @Autowired + private VideoManagerService videoManagerService; + @Autowired + private Smb smb; + /**新增 + * @param + * @throws Exception + */ + @RequestMapping(value="/getAlarmInfo",headers = "content-type=multipart/form-data") + @ResponseBody + public Object getAlarmInfo( + @RequestParam(value = "resultVideo", required = false) MultipartFile resultVideo, @RequestParam("resultMsg") String resultMsg) throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + if(resultMsg!=null && !resultMsg.equals("")) { + JSONObject json = JSONObject.parseObject(resultMsg); + PageData pd = new PageData(); + pd.put("AIWARNING_ID", this.get32UUID()); //主键 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("ISDELETE", 0); //是否删除 + pd.put("TYPE", Const.WARNING_TYPE_MAP.get(json.get("algType"))); //类型 + pd.put("WARNING_TIME", DateUtil.date2Str(new Date(Long.parseLong(json.getString("createTime").substring(0,json.getString("createTime").length()-3))))); //报警时间 + + File img = base64ToFile(json.getString("resultImg")); + MultipartFile file = getMultipartFile(img); + String ffile = DateUtil.getDays(); + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile); + img.delete(); + pd.put("IMG_PATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName); + + String ffile1 = DateUtil.getDays(); + File video = File.createTempFile(resultVideo.getOriginalFilename(), ".mp4"); + resultVideo.transferTo(video); + MultipartFile mvideo = getMultipartFile(video); + String fileName1 = mvideo.getOriginalFilename(); + smb.sshSftp(mvideo, fileName1, Const.FILEPATHFILE + "/" + ffile1); + video.delete(); + pd.put("VIDEO_PATH", Const.FILEPATHFILE + "/" + ffile1 + "/" + fileName1); + + PageData videoPd = new PageData(); + videoPd.put("CODE", json.get("cameraCode")); + videoPd = videoManagerService.findByCode(videoPd); + if(videoPd != null){ + pd.put("VIDEOMANAGER_ID", videoPd.get("VIDEOMANAGER_ID")); //视频ID + pd.put("VIDEOMANAGER_NAME", videoPd.get("VIDEONAME")); //视频名称 + pd.put("OUTSOURCED_ID", videoPd.get("OUTSOURCED_ID")); //重点工程id + } + pd.put("STATUS", 0); //状态0未处置 + pd.put("ISTRUE", 3); //状态3未审核 + aiwarningService.save(pd); + map.put("result", errInfo); + }else{ + map.put("result", "faild"); + map.put("msg", "报警信息为空"); + } + return map; + } + + @RequestMapping(value="/getAlarmInfo2",headers = "content-type=multipart/form-data") + @ResponseBody + public Object getAlarmInfo2( + @RequestParam(value = "resultVideo", required = false) MultipartFile resultVideo, @RequestParam("resultMsg") String resultMsg) throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + System.out.println(resultMsg); + if(resultMsg!=null && !resultMsg.equals("")) { + JSONObject json = JSONObject.parseObject(resultMsg); + PageData pd = new PageData(); + pd.put("AIWARNING_ID", this.get32UUID()); //主键 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("ISDELETE", 0); //是否删除 + pd.put("TYPE",Const.WARNING_TYPE_MAP.get(json.get("algType"))); //类型 + pd.put("WARNING_TIME", DateUtil.date2Str(new Date(Long.parseLong(json.getString("createTime").substring(0,json.getString("createTime").length()-3))))); //报警时间 + + File img = base64ToFile(json.getString("sourceImgBase64")); + MultipartFile file = getMultipartFile(img); + String ffile = DateUtil.getDays(); + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile); + img.delete(); + pd.put("IMG_PATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName); + + String ffile1 = DateUtil.getDays(); + File video = File.createTempFile(resultVideo.getOriginalFilename(), ".mp4"); + resultVideo.transferTo(video); + MultipartFile mvideo = getMultipartFile(video); + String fileName1 = mvideo.getOriginalFilename(); + smb.sshSftp(mvideo, fileName1, Const.FILEPATHFILE + "/" + ffile1); + video.delete(); + pd.put("VIDEO_PATH", Const.FILEPATHFILE + "/" + ffile1 + "/" + fileName1); + + PageData videoPd = new PageData(); + videoPd.put("CODE", json.get("cameraCode")); + videoPd = videoManagerService.findByCode(videoPd); + if(videoPd != null){ + pd.put("VIDEOMANAGER_ID", videoPd.get("VIDEOMANAGER_ID")); //视频ID + pd.put("VIDEOMANAGER_NAME", videoPd.get("VIDEONAME")); //视频名称 + pd.put("OUTSOURCED_ID", videoPd.get("OUTSOURCED_ID")); //重点工程id + } + pd.put("STATUS", 0); //状态0未处置 + pd.put("ISTRUE", 3); //状态3未审核 + + aiwarningService.save(pd); + map.put("result", errInfo); + }else{ + map.put("result", "faild"); + map.put("msg", "报警信息为空"); + } + return map; + } + + @RequestMapping(value="/getAlarmInfo3") + @ResponseBody + public Object getAlarmInfo3(@RequestBody String resultMsg) throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + if(resultMsg!=null && !resultMsg.equals("")) { + JSONObject json = JSONObject.parseObject(resultMsg); + PageData pd = new PageData(); + pd.put("AIWARNING_ID", this.get32UUID()); //主键 + pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("ISDELETE", 0); //是否删除 + pd.put("TYPE",Const.WARNING_TYPE_MAP.get(json.get("algType"))); //类型 + pd.put("WARNING_TIME", DateUtil.date2Str(new Date(Long.parseLong(json.getString("createTime").substring(0,json.getString("createTime").length()-3))))); //报警时间 + + File img = base64ToFile(json.getString("sourceImgBase64")); + MultipartFile file = getMultipartFile(img); + String ffile = DateUtil.getDays(); + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile); + img.delete(); + pd.put("IMG_PATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName); + + PageData videoPd = new PageData(); + videoPd.put("CODE", json.get("cameraCode")); + videoPd = videoManagerService.findByCode(videoPd); + if(videoPd != null){ + pd.put("VIDEOMANAGER_ID", videoPd.get("VIDEOMANAGER_ID")); //视频ID + pd.put("VIDEOMANAGER_NAME", videoPd.get("VIDEONAME")); //视频名称 + pd.put("OUTSOURCED_ID", videoPd.get("OUTSOURCED_ID")); //重点工程id + } + pd.put("STATUS", 0); //状态0未处置 + pd.put("ISTRUE", 3); //状态3未审核 + + aiwarningService.save(pd); + map.put("result", errInfo); + }else{ + map.put("result", "faild"); + map.put("msg", "报警信息为空"); + } + return map; + } + + + private File base64ToFile(String base64) throws IOException { + if(base64.contains("data:image")){ + base64 = base64.substring(base64.indexOf(",")+1); + } + base64 = base64.toString().replace("\r\n", ""); + //创建文件目录 + String prefix=".jpg"; + File file = File.createTempFile(get32UUID(), prefix); + BufferedOutputStream bos = null; + FileOutputStream fos = null; + try { + byte[] bytes = Base64.getDecoder().decode(base64); + fos = new FileOutputStream(file); + bos = new BufferedOutputStream(fos); + bos.write(bytes); + }finally { + if (bos != null) { + try { + bos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (fos != null) { + try { + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return file; + } + + public static MultipartFile getMultipartFile(File file) { + DiskFileItem item = new DiskFileItem("file" + , MediaType.MULTIPART_FORM_DATA_VALUE + , true + , file.getName() + , (int)file.length() + , file.getParentFile()); + try { + OutputStream os = item.getOutputStream(); + os.write(FileUtils.readFileToByteArray(file)); + } catch (IOException e) { + e.printStackTrace(); + } + return new CommonsMultipartFile(item); + } + + /**列表 * @param page * @throws Exception @@ -63,5 +279,35 @@ public class AIWarningController extends BaseController { map.put("result", errInfo); return map; } - + /** + * @Description: 修改 + * @Author: dearLin + * @Date: 2024/1/26/026 15:27 + * @Param: [] [] + * @Return: java.lang.Object + */ + @RequestMapping(value="/edit") + @ResponseBody + public Object edit() throws Exception{ + PageData pd = this.getPageData(); + pd.put("OPERATOR",Jurisdiction.getUSER_ID()); + pd.put("OPERATTIME",DateUtil.date2Str(new Date())); + aiwarningService.edit(pd); //根据ID读取 + return ReturnMap.ok(); + } + /** + * @Description: 批量删除 + * @Author: dearLin + * @Date: 2024/1/26/026 15:27 + * @Param: [] [] + * @Return: java.lang.Object + */ + @RequestMapping(value="/removeByIds") + @ResponseBody + public Object removeByIds() throws Exception{ + PageData pd = this.getPageData(); + String[] aiwarningIds = pd.getString("AIWARNING_IDS").split(","); + aiwarningService.deleteAll(aiwarningIds); //根据ID读取 + return ReturnMap.ok(); + } } diff --git a/src/main/java/com/zcloud/controller/video/VideoManagerController.java b/src/main/java/com/zcloud/controller/video/VideoManagerController.java index cd661b2..5949891 100644 --- a/src/main/java/com/zcloud/controller/video/VideoManagerController.java +++ b/src/main/java/com/zcloud/controller/video/VideoManagerController.java @@ -1,15 +1,13 @@ package com.zcloud.controller.video; +import com.alibaba.fastjson.JSONObject; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.logs.LogAnno; import com.zcloud.service.video.TokenService; import com.zcloud.service.video.VideoManagerService; -import com.zcloud.util.DateUtil; -import com.zcloud.util.Jurisdiction; -import com.zcloud.util.ObjectExcelView; -import com.zcloud.util.Tools; +import com.zcloud.util.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -51,6 +49,11 @@ public class VideoManagerController extends BaseController { pd.put("OPDATE", DateUtil.date2Str(new Date())); //操作日期 pd.put("OPUSER", Jurisdiction.getUsername()); //操作人 pd.put("ISDELETE", "0"); //是否删除 + JSONObject jsonObject = PLSUtil.saveCamera(Jurisdiction.getCORPINFO_ID(), pd); + if (!"200".equals(jsonObject.getString("code"))) { + return ReturnMap.error("三方系统摄像头对接失败"); + } + pd.put("PLS_ID", jsonObject.get("data")); videomanagerService.save(pd); map.put("result", errInfo); return map; @@ -69,6 +72,10 @@ public class VideoManagerController extends BaseController { String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); + JSONObject jsonObject = PLSUtil.removeCamera(Jurisdiction.getCORPINFO_ID(), pd); + if (!"200".equals(jsonObject.getString("code"))) { + return ReturnMap.error("三方系统摄像头对接失败"); + } videomanagerService.delete(pd); map.put("result", errInfo); //返回结果 return map; @@ -116,6 +123,10 @@ public class VideoManagerController extends BaseController { String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); + JSONObject jsonObject = PLSUtil.editCamera(Jurisdiction.getCORPINFO_ID(), pd); + if (!"200".equals(jsonObject.getString("code"))) { + return ReturnMap.error("三方系统摄像头对接失败,禁止修改"); + } videomanagerService.edit(pd); map.put("result", errInfo); return map; diff --git a/src/main/java/com/zcloud/mapper/datasource/video/AIWarningMapper.java b/src/main/java/com/zcloud/mapper/datasource/video/AIWarningMapper.java index d04823e..572467b 100644 --- a/src/main/java/com/zcloud/mapper/datasource/video/AIWarningMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/video/AIWarningMapper.java @@ -33,5 +33,10 @@ public interface AIWarningMapper { */ PageData findById(PageData pd); + void save(PageData pd); + + void edit(PageData pd); + + void deleteAll(String[] aiwarningIds); } diff --git a/src/main/java/com/zcloud/mapper/datasource/video/VideoManagerMapper.java b/src/main/java/com/zcloud/mapper/datasource/video/VideoManagerMapper.java index e4f0256..1cc065d 100644 --- a/src/main/java/com/zcloud/mapper/datasource/video/VideoManagerMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/video/VideoManagerMapper.java @@ -65,5 +65,6 @@ public interface VideoManagerMapper { */ void deleteAll(String[] ArrayDATA_IDS); + PageData findByCode(PageData videoPd); } diff --git a/src/main/java/com/zcloud/service/system/UsersService.java b/src/main/java/com/zcloud/service/system/UsersService.java index 2885800..1d22c4c 100644 --- a/src/main/java/com/zcloud/service/system/UsersService.java +++ b/src/main/java/com/zcloud/service/system/UsersService.java @@ -3,6 +3,7 @@ package com.zcloud.service.system; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.entity.system.User; +import com.zcloud.util.ReturnMap; import java.io.IOException; import java.util.List; @@ -266,7 +267,7 @@ public interface UsersService { void editUserState(PageData pageData)throws Exception; - void saveUserNew(PageData pd) throws Exception; + ReturnMap saveUserNew(PageData pd) throws Exception; /**通过USERID查监管端用户 * @param pd diff --git a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java index 88929a0..92933d5 100644 --- a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java +++ b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java @@ -250,23 +250,24 @@ public class UsersServiceImpl implements UsersService { @Override public String changeOrUpdUserCardNo(PageData nowuser) throws Exception { PageData oldUser = usersMapper.findById(nowuser); + // 此人原来无卡号 // 先判断人员新的定位卡号是否有变化,没变化直接可以修改 - if (oldUser.getString("CARDNO") == null || oldUser.getOrDefault("CARDNO","").equals(nowuser.getString("CARDNO"))) { + if (oldUser.getString("CARDNO") != null && oldUser.getOrDefault("CARDNO", "").equals(nowuser.getString("CARDNO"))) { return Const.CAN_CHENG_USER; } // 有变化看库里是否有人在用这个新卡号 PageData getCordNo = new PageData(); getCordNo.putAll(nowuser); - getCordNo.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID()); + getCordNo.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); PageData usedCardNo = usersMapper.findByCardNo(getCordNo); // 卡号被本系统中他人使用了 if (usedCardNo != null) { - return Const.CARD_ALREADY_BEEN_USED+usedCardNo.getString("NAME"); + return Const.CARD_ALREADY_BEEN_USED + usedCardNo.getString("NAME"); } PageData cardNumberPeople = PLSUtil.getCardNumberPeople(nowuser); // 这个新卡号其他系统中绑定人了 if (cardNumberPeople != null) { - return "人员定位系统中"+Const.CARD_ALREADY_BEEN_USED+cardNumberPeople.getString("name"); + return "人员定位系统中" + Const.CARD_ALREADY_BEEN_USED + cardNumberPeople.getString("name"); } return Const.CAN_CHENG_USER; } @@ -277,14 +278,14 @@ public class UsersServiceImpl implements UsersService { } @Override - public void saveUserNew(PageData pd) throws Exception { + public ReturnMap saveUserNew(PageData pd) throws Exception { pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); pd.put("WORKSTATUS", "1"); pd.put("WORKPERIOD", "1"); pd.put("RIGHTS", "788664966448"); // 先判断这个人定位卡号与姓名是否对的上 if (!PLSUtil.hasCardNumber(pd)) { - throw new Exception(pd.getString("CARDNO") + "定位卡已经存在"); + return ReturnMap.error(pd.getString("CARDNO") + "定位卡已经存在"); } if (pd.get("USERAVATARURL") != null && !pd.getString("USERAVATARURL").equals("")) { @@ -310,7 +311,7 @@ public class UsersServiceImpl implements UsersService { pd.put("SKIN", "pcoded-navbar navbar-image-3, navbar pcoded-header navbar-expand-lg navbar-light header-dark"); pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("USERNAME"), "666666").toString()); - if (usersMapper.findByUsername(pd) == null && PLSUtil.saveUser(pd)) { + if (usersMapper.findByUsername(pd) == null) { if ("true".equals(pd.getString("ISSTUDENT"))) { if ("select".equals(pd.getString("letDutiesType"))) { pd.put("DUTIES", pd.getString("DUTIES")); @@ -344,13 +345,19 @@ public class UsersServiceImpl implements UsersService { } userInfoService.save(pd); } - PageData cardNumberPeople = PLSUtil.getCardNumberPeople(pd); - pd.put("PLS_ID", cardNumberPeople.getString("psnId")); - usersMapper.saveUser(pd); - FHLOG.save(Jurisdiction.getUsername(), "新增用户:" + pd.getString("USERNAME")); - } else { - throw new Exception("请检查定位卡号与用户名是否重复"); + PageData response = PLSUtil.saveUser(pd); + if ("200".equals(response.getString("code"))) { + pd.put("PLS_ID", response.getString("data")); + usersMapper.saveUser(pd); + FHLOG.save(Jurisdiction.getUsername(), "新增用户:" + pd.getString("USERNAME")); + return ReturnMap.ok(); + } + return ReturnMap.error(response.getString("msg")); } + return ReturnMap.error("保存失败"); +// PageData cardNumberPeople = PLSUtil.getCardNumberPeople(pd); +// pd.put("PLS_ID", cardNumberPeople.getString("psnId")); +// usersMapper.saveUser(pd); } diff --git a/src/main/java/com/zcloud/service/video/AIWarningService.java b/src/main/java/com/zcloud/service/video/AIWarningService.java index d2cf33c..ac6a7e8 100644 --- a/src/main/java/com/zcloud/service/video/AIWarningService.java +++ b/src/main/java/com/zcloud/service/video/AIWarningService.java @@ -32,5 +32,10 @@ public interface AIWarningService { */ public PageData findById(PageData pd)throws Exception; + void save(PageData pd); + + void edit(PageData pd); + + void deleteAll(String[] aiwarningIds); } diff --git a/src/main/java/com/zcloud/service/video/VideoManagerService.java b/src/main/java/com/zcloud/service/video/VideoManagerService.java index 51d9812..ae74d83 100644 --- a/src/main/java/com/zcloud/service/video/VideoManagerService.java +++ b/src/main/java/com/zcloud/service/video/VideoManagerService.java @@ -65,5 +65,6 @@ public interface VideoManagerService { */ public void deleteAll(String[] ArrayDATA_IDS)throws Exception; + PageData findByCode(PageData videoPd); } diff --git a/src/main/java/com/zcloud/service/video/impl/AIWarningServiceImpl.java b/src/main/java/com/zcloud/service/video/impl/AIWarningServiceImpl.java index cc9f3a5..f98a98e 100644 --- a/src/main/java/com/zcloud/service/video/impl/AIWarningServiceImpl.java +++ b/src/main/java/com/zcloud/service/video/impl/AIWarningServiceImpl.java @@ -47,5 +47,20 @@ public class AIWarningServiceImpl implements AIWarningService { public PageData findById(PageData pd)throws Exception{ return aiwarningMapper.findById(pd); } + + @Override + public void save(PageData pd) { + aiwarningMapper.save(pd); + } + + @Override + public void edit(PageData pd) { + aiwarningMapper.edit(pd); + } + + @Override + public void deleteAll(String[] aiwarningIds) { + aiwarningMapper.deleteAll(aiwarningIds); + } } diff --git a/src/main/java/com/zcloud/service/video/impl/VideoManagerServiceImpl.java b/src/main/java/com/zcloud/service/video/impl/VideoManagerServiceImpl.java index 411d3fc..b059111 100644 --- a/src/main/java/com/zcloud/service/video/impl/VideoManagerServiceImpl.java +++ b/src/main/java/com/zcloud/service/video/impl/VideoManagerServiceImpl.java @@ -94,5 +94,10 @@ public class VideoManagerServiceImpl implements VideoManagerService { videomanagerMapper.deleteAll(ArrayDATA_IDS); } + @Override + public PageData findByCode(PageData videoPd) { + return videomanagerMapper.findByCode(videoPd); + } + } diff --git a/src/main/java/com/zcloud/util/Const.java b/src/main/java/com/zcloud/util/Const.java index c2472db..1700b56 100644 --- a/src/main/java/com/zcloud/util/Const.java +++ b/src/main/java/com/zcloud/util/Const.java @@ -1,5 +1,8 @@ package com.zcloud.util; +import java.util.HashMap; +import java.util.Map; + /** * 说明:常量 * 作者:luoxiaobao @@ -73,4 +76,35 @@ public class Const { // 修改用户相关 public static final String CAN_CHENG_USER="SUCCEEDS"; public static final String CARD_ALREADY_BEEN_USED="当前卡号已经被使用。使用人:"; + public static final Map WARNING_TYPE_MAP = new HashMap() {{ + put("blockingmonitoring", "占道"); + put("chefhatmonitoring", "厨师帽检测"); + put("chefuniformmonitoring", "厨师服检测"); + put("elevatorebikemonitoring", "电摩入梯"); + put("empty", "空算法"); + put("example", "示例算法"); + put("facemaskmonitoring", "口罩检测"); + put("faceset", "人脸识别(人脸库)"); + put("fireextinguisherdetection", "灭火器"); + put("gluedtophonemonitoring", "玩手机检测"); + put("helmetwearingmonitoring", "安全帽"); + put("intrusionmonitoring", "入侵检测(越界)"); + put("intrusionmonitoringplus", "陌生人入侵"); + put("mnpmonitoring", "机非人"); + put("mousedetection", "老鼠检测"); + put("nlprdetection", "车牌检测(车牌库)"); + put("ondutymonitoring", "离岗检测"); + put("peoplecountingcrossing", "过线人数统计"); + put("peoplecrossingmonitoring", "过线检测"); + put("peopledensitydetection", "人员密度检测"); + put("peoplefalldetection", "人员跌倒检测"); + put("peoplequeuemonitoring", "排队长度检测(排队统计)"); + put("safetyvestmonitoring", "反光衣检测"); + put("sleepingondutymonitoring", "睡岗"); + put("smokefiremonitoring", "烟火检测"); + put("smokingcallmonitoring", "抽烟打电话"); + put("uniformnn", "工服(工服库)"); + put("wastebinmonitoring", "垃圾桶检测"); + }}; + } diff --git a/src/main/java/com/zcloud/util/PLSUtil.java b/src/main/java/com/zcloud/util/PLSUtil.java index 19caedb..05ef2e4 100644 --- a/src/main/java/com/zcloud/util/PLSUtil.java +++ b/src/main/java/com/zcloud/util/PLSUtil.java @@ -1,10 +1,6 @@ package com.zcloud.util; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.zcloud.entity.Camera; -import com.zcloud.entity.Card; -import com.zcloud.entity.EmployeeData; import com.zcloud.entity.PageData; import com.zcloud.service.corp.CorpPlsInfoService; import com.zcloud.service.system.UsersService; @@ -12,17 +8,17 @@ import okhttp3.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; import javax.annotation.PostConstruct; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.*; @Component @@ -42,6 +38,77 @@ public class PLSUtil { restTemplate = restTemplatebean; } + /** + * @Description: 添加摄像头 + * @Author: dearLin + * @Date: 2024/1/25/025 14:37 + * @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount] + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject saveCamera(String CORPINFO_ID, PageData camera) throws Exception { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", getToken(CORPINFO_ID)); + headers.setContentType(org.springframework.http.MediaType.valueOf("application/json")); + JSONObject uriVariables = new JSONObject(); + uriVariables.put("camNo",camera.getString("CODE")); + uriVariables.put("camName",camera.getString("VIDEONAME")); + uriVariables.put("camIp","127.0.0.1"); + uriVariables.put("type","0"); + uriVariables.put("port",""); + uriVariables.put("camUserName","1"); + uriVariables.put("camPassword","1"); + uriVariables.put("lon",""); + uriVariables.put("lat",""); + uriVariables.put("alt",""); + HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); +// HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); +// ResponseEntity jsonObjectResponseEntity = restTemplate.postForEntity(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera", +// httpEntity, JSONObject.class); + + + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera", + HttpMethod.POST, + httpEntity, + JSONObject.class); + return exchange.getBody(); + } + /** + * @Description: 修改摄像头 + * @Author: dearLin + * @Date: 2024/1/25/025 14:37 + * @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount] + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject editCamera(String CORPINFO_ID, PageData camera) throws Exception { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", getToken(CORPINFO_ID)); + headers.setContentType(org.springframework.http.MediaType.valueOf("application/json")); + JSONObject uriVariables = new JSONObject(); + uriVariables.put("camNo",camera.getString("CODE")); + uriVariables.put("camName",camera.getString("VIDEONAME")); + uriVariables.put("camId",camera.getString("PLS_ID")); + HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera", + HttpMethod.PUT, httpEntity, + JSONObject.class,uriVariables); + return exchange.getBody(); + } + /** + * @Description: 删除摄像头 + * @Author: dearLin + * @Date: 2024/1/25/025 14:37 + * @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount] + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject removeCamera(String CORPINFO_ID, PageData camera) throws Exception { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", getToken(CORPINFO_ID)); + HttpEntity httpEntity = new HttpEntity<>(headers); + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera/"+Integer.parseInt(camera.getString("PLS_ID")), HttpMethod.DELETE, httpEntity, JSONObject.class); + return exchange.getBody(); + } + + /** * @Description: 电子围栏列表 * @Author: dearLin @@ -175,7 +242,7 @@ public class PLSUtil { * @Param: [com.zcloud.entity.PageData] [user] * @Return: void */ - public static boolean saveUser(PageData user) throws Exception { + public static PageData saveUser(PageData user) throws Exception { String url = BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/deploy/psnmgt/insertPsnIfon"; JSONObject loginPayload = new JSONObject(); loginPayload.put("name", user.getString("NAME")); @@ -197,8 +264,8 @@ public class PLSUtil { loginPayload.put("deptName", ""); loginPayload.put("deptId", ""); loginPayload.put("avatar", ""); - PageData response = sendPostHttpRequest(url, loginPayload.toJSONString(), getToken(Jurisdiction.getCORPINFO_ID())); - return "200".equals(response.getString("code")); + return sendPostHttpRequest(url, loginPayload.toJSONString(), getToken(Jurisdiction.getCORPINFO_ID())); + } /** @@ -209,6 +276,15 @@ public class PLSUtil { * @Return: void */ public static boolean editUser(PageData user) throws Exception { + // 这个人没有卡号与人id的话 + if (!Tools.notEmpty(user.getString("PLS_ID"))) { + PageData response = saveUser(user); + if ("200".equals(response.getString("code"))) { + user.put("PLS_ID", response.getString("data")); + return true; + } + return false; + } String url = BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/deploy/psnmgt/updPsnInfoById"; JSONObject loginPayload = new JSONObject(); loginPayload.put("name", user.getString("NAME")); diff --git a/src/main/java/com/zcloud/util/RegexPatterns.java b/src/main/java/com/zcloud/util/RegexPatterns.java index ba5be80..2a80383 100644 --- a/src/main/java/com/zcloud/util/RegexPatterns.java +++ b/src/main/java/com/zcloud/util/RegexPatterns.java @@ -23,7 +23,7 @@ public class RegexPatterns { * 验证码正则, 6位数字或字母 */ public static final String VERIFY_CODE_REGEX = "^[a-zA-Z\\d]{6}$"; - public static final String VERIFY_CARDNO_REGEX = "^[0-9]{4}$"; + public static final String VERIFY_CARDNO_REGEX = "^[0-9]{5}$"; /** * 身份证号正则, 15位或者18位,最后一位可以为字母 */ diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index 4255f56..c951fa2 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -213,7 +213,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID left join SYS_POST p on p.POST_ID=f.POST_ID where - USER_ID = #{USER_ID} + USER_ID = #{USER_ID} and f.ISDELETE = 0 diff --git a/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml b/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml index 90506a3..330d7b1 100644 --- a/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml +++ b/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml @@ -65,13 +65,44 @@ #{HASHIDDEN}, #{AIWARNING_ID} - + + insert into + + ( + + ) values ( + + ) + + + update + + set + OPERATOR = #{OPERATOR}, + OPERATTIME = #{OPERATTIME}, + STATUS = #{STATUS}, + ISTRUE = #{ISTRUE}, + HASHIDDEN = #{HASHIDDEN} + where + AIWARNING_ID = #{AIWARNING_ID} + + + update + + set ISDELETE = '1' + where + AIWARNING_ID in + + #{str} + + + From 99a4514737765ca694dc3dfce8f274a72fd1c135 Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Sat, 27 Jan 2024 11:29:26 +0800 Subject: [PATCH 2/7] ai bajing --- .../controller/mapApi/MapController.java | 64 +++++++++++++++++ src/main/java/com/zcloud/util/PLSUtil.java | 68 ++++++++++++++----- .../datasource/video/AIWarningMapper.xml | 5 +- 3 files changed, 119 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/zcloud/controller/mapApi/MapController.java diff --git a/src/main/java/com/zcloud/controller/mapApi/MapController.java b/src/main/java/com/zcloud/controller/mapApi/MapController.java new file mode 100644 index 0000000..8df8716 --- /dev/null +++ b/src/main/java/com/zcloud/controller/mapApi/MapController.java @@ -0,0 +1,64 @@ +package com.zcloud.controller.mapApi; + +import com.zcloud.controller.base.BaseController; +import com.zcloud.entity.PageData; +import com.zcloud.service.system.UsersService; +import com.zcloud.util.Jurisdiction; +import com.zcloud.util.PLSUtil; +import com.zcloud.util.ReturnMap; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * 说明:TODO + * 作者:wangxuan + * 官网:www.zcloudchina.com + */ +@Controller +@RequestMapping("/map") +public class MapController extends BaseController { + @Autowired + private UsersService usersService; + + + /** + * @Description: 人员类型统计 告警类型统计 + * @Author: dearLin + * @Date: 2024/1/26/026 16:42 + * @Param: [] [] + * @Return: java.lang.String + */ + @RequestMapping(value = "/getPersonnelTypeCount") + public ReturnMap getPersonnelTypeCount() throws Exception { + PageData pageData = getPageData(); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + int userCount = usersService.getUserCount(pageData); + return ReturnMap.ok().put("userCount", userCount); + } + + /** + * @Description: 告警类型统计 来自人员定位系统 + * @Author: dearLin + * @Date: 2024/1/26/026 16:43 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getAlarmTypeCount") + public ReturnMap getAlarmTypeCount() throws Exception { + return ReturnMap.ok().put("data", PLSUtil.getAlarmTypeCount(Jurisdiction.getCORPINFO_ID())); + } + + /** + * @Description: 人员定位情况 来自人员定位系统 + * @Author: dearLin + * @Date: 2024/1/26/026 16:43 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getPersonnelPositioningCount") + public ReturnMap getPersonnelPositioningCount() throws Exception { +// return ReturnMap.ok().put("data", PLSUtil.getPersonnelPositioningCount(Jurisdiction.getCORPINFO_ID())); + return ReturnMap.error(); + } +} diff --git a/src/main/java/com/zcloud/util/PLSUtil.java b/src/main/java/com/zcloud/util/PLSUtil.java index 05ef2e4..2692161 100644 --- a/src/main/java/com/zcloud/util/PLSUtil.java +++ b/src/main/java/com/zcloud/util/PLSUtil.java @@ -31,6 +31,19 @@ public class PLSUtil { public static HashMap BAKEADDR = new HashMap<>(); private static RestTemplate restTemplate; + public static Object getPersonnelPositioningCount(String CORPINFO_ID, Integer currentPage, Integer showCount) throws Exception { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", getToken(CORPINFO_ID)); + HttpEntity httpEntity = new HttpEntity<>(headers); + ResponseEntity exchange = restTemplate.exchange( + PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/deploy/card/list?sortThePowerLevel=1&pageNum=" + + currentPage + + "&pageSize=" + showCount, + HttpMethod.GET, httpEntity, + JSONObject.class); + return exchange.getBody(); + } + @Autowired public void setCorpplsinfoService(CorpPlsInfoService corpplsinfoServicebean, UsersService usersServicebean, RestTemplate restTemplatebean) { corpplsinfoService = corpplsinfoServicebean; @@ -38,6 +51,25 @@ public class PLSUtil { restTemplate = restTemplatebean; } + /** + * @Description: 告警类型统计 + * @Author: dearLin + * @Date: 2024/1/25/025 14:37 + * @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount] + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject getAlarmTypeCount(String CORPINFO_ID) throws Exception { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", getToken(CORPINFO_ID)); + HttpEntity httpEntity = new HttpEntity<>(headers); + ResponseEntity exchange = restTemplate.exchange( + PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/region/alarm/alarmStatistics?type=day", + HttpMethod.GET, httpEntity, + JSONObject.class); + return exchange.getBody(); + } + + /** * @Description: 添加摄像头 * @Author: dearLin @@ -50,17 +82,17 @@ public class PLSUtil { headers.set("Authorization", getToken(CORPINFO_ID)); headers.setContentType(org.springframework.http.MediaType.valueOf("application/json")); JSONObject uriVariables = new JSONObject(); - uriVariables.put("camNo",camera.getString("CODE")); - uriVariables.put("camName",camera.getString("VIDEONAME")); - uriVariables.put("camIp","127.0.0.1"); - uriVariables.put("type","0"); - uriVariables.put("port",""); - uriVariables.put("camUserName","1"); - uriVariables.put("camPassword","1"); - uriVariables.put("lon",""); - uriVariables.put("lat",""); - uriVariables.put("alt",""); - HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); + uriVariables.put("camNo", camera.getString("CODE")); + uriVariables.put("camName", camera.getString("VIDEONAME")); + uriVariables.put("camIp", "127.0.0.1"); + uriVariables.put("type", "0"); + uriVariables.put("port", ""); + uriVariables.put("camUserName", "1"); + uriVariables.put("camPassword", "1"); + uriVariables.put("lon", ""); + uriVariables.put("lat", ""); + uriVariables.put("alt", ""); + HttpEntity httpEntity = new HttpEntity<>(uriVariables, headers); // HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); // ResponseEntity jsonObjectResponseEntity = restTemplate.postForEntity(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera", // httpEntity, JSONObject.class); @@ -72,6 +104,7 @@ public class PLSUtil { JSONObject.class); return exchange.getBody(); } + /** * @Description: 修改摄像头 * @Author: dearLin @@ -84,15 +117,16 @@ public class PLSUtil { headers.set("Authorization", getToken(CORPINFO_ID)); headers.setContentType(org.springframework.http.MediaType.valueOf("application/json")); JSONObject uriVariables = new JSONObject(); - uriVariables.put("camNo",camera.getString("CODE")); - uriVariables.put("camName",camera.getString("VIDEONAME")); - uriVariables.put("camId",camera.getString("PLS_ID")); - HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); + uriVariables.put("camNo", camera.getString("CODE")); + uriVariables.put("camName", camera.getString("VIDEONAME")); + uriVariables.put("camId", camera.getString("PLS_ID")); + HttpEntity httpEntity = new HttpEntity<>(uriVariables, headers); ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera", HttpMethod.PUT, httpEntity, - JSONObject.class,uriVariables); + JSONObject.class, uriVariables); return exchange.getBody(); } + /** * @Description: 删除摄像头 * @Author: dearLin @@ -104,7 +138,7 @@ public class PLSUtil { HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getToken(CORPINFO_ID)); HttpEntity httpEntity = new HttpEntity<>(headers); - ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera/"+Integer.parseInt(camera.getString("PLS_ID")), HttpMethod.DELETE, httpEntity, JSONObject.class); + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera/" + Integer.parseInt(camera.getString("PLS_ID")), HttpMethod.DELETE, httpEntity, JSONObject.class); return exchange.getBody(); } diff --git a/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml b/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml index 330d7b1..ffc2a10 100644 --- a/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml +++ b/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml @@ -135,8 +135,11 @@ and c.CORPINFO_ID = #{pd.CORPINFO_ID} + + and f.ISTRUE = #{pd.ISTRUE} + - and f.STATUS = #{STATUS} + and f.STATUS = #{pd.STATUS} and DATE_FORMAT(f.CREATTIME,'%Y-%m-%d %H:%i') From 7d60a3c2cdb13c64b631e545696b05c3a7b775b7 Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Mon, 29 Jan 2024 09:07:29 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8D=A1=E5=8F=B7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BA=BA=E5=91=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zcloud/controller/system/UsersController.java | 12 +++++++++++- .../zcloud/mapper/datasource/system/UsersMapper.java | 2 ++ .../java/com/zcloud/service/system/UsersService.java | 9 +++++++++ .../zcloud/service/system/impl/UsersServiceImpl.java | 5 +++++ .../mybatis/datasource/system/UsersMapper.xml | 8 ++++++++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/zcloud/controller/system/UsersController.java b/src/main/java/com/zcloud/controller/system/UsersController.java index 068179d..86bcfd8 100644 --- a/src/main/java/com/zcloud/controller/system/UsersController.java +++ b/src/main/java/com/zcloud/controller/system/UsersController.java @@ -72,6 +72,16 @@ public class UsersController extends BaseController { @Autowired private ImgFilesService imgfilesService; + + @RequestMapping("/getUserByCardNo") + @ResponseBody + public Object getUserByCardNo() { + PageData pageData = getPageData(); + pageData.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID()); + PageData pd = usersService.getUserByCardNo(pageData); + return ReturnMap.ok().put("pd",usersService.getUserByCardNo(pageData)); + } + /** * 用户列表 * @@ -1428,7 +1438,7 @@ public class UsersController extends BaseController { String postId = ""; if (postValMap != null) { PageData o = (PageData) postValMap.get(postName); - if (o!= null) { + if (o != null) { postId = o.getString("POST_ID"); } } diff --git a/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java b/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java index 0cf781d..0e009e1 100644 --- a/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java @@ -255,4 +255,6 @@ public interface UsersMapper { PageData findByCardNo(PageData getCordNo); List getUserCardNoAll(PageData departPd); + + PageData getUserByCardNo(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/system/UsersService.java b/src/main/java/com/zcloud/service/system/UsersService.java index 1d22c4c..7be1c69 100644 --- a/src/main/java/com/zcloud/service/system/UsersService.java +++ b/src/main/java/com/zcloud/service/system/UsersService.java @@ -292,4 +292,13 @@ public interface UsersService { String changeOrUpdUserCardNo(PageData pd) throws Exception; List getUserCardNoAll(PageData departPd); + + /** + * @Description: 根据id查卡号 + * @Author: dearLin + * @Date: 2024/1/29/029 9:05 + * @Param: [com.zcloud.entity.PageData] [pageData] + * @Return: com.zcloud.entity.PageData + */ + PageData getUserByCardNo(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java index 92933d5..fb7a54a 100644 --- a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java +++ b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java @@ -277,6 +277,11 @@ public class UsersServiceImpl implements UsersService { return usersMapper.getUserCardNoAll(departPd); } + @Override + public PageData getUserByCardNo(PageData pageData) { + return usersMapper.getUserByCardNo(pageData); + } + @Override public ReturnMap saveUserNew(PageData pd) throws Exception { pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index c951fa2..9fef58d 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -1394,5 +1394,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where CORPINFO_ID = #{CORPINFO_ID} and ISDELETE = 0 + From d6adfe9c42c6ec2545cc9cc17d27ed6c9e12142a Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Mon, 29 Jan 2024 09:07:57 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8D=A1=E5=8F=B7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BA=BA=E5=91=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/zcloud/controller/system/UsersController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/zcloud/controller/system/UsersController.java b/src/main/java/com/zcloud/controller/system/UsersController.java index 86bcfd8..fdfe1c7 100644 --- a/src/main/java/com/zcloud/controller/system/UsersController.java +++ b/src/main/java/com/zcloud/controller/system/UsersController.java @@ -78,7 +78,6 @@ public class UsersController extends BaseController { public Object getUserByCardNo() { PageData pageData = getPageData(); pageData.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID()); - PageData pd = usersService.getUserByCardNo(pageData); return ReturnMap.ok().put("pd",usersService.getUserByCardNo(pageData)); } From c353987bd2290309b85cf0934bc32c84da32cddc Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Mon, 29 Jan 2024 09:08:29 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8D=A1=E5=8F=B7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BA=BA=E5=91=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zcloud/controller/system/UsersController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/zcloud/controller/system/UsersController.java b/src/main/java/com/zcloud/controller/system/UsersController.java index fdfe1c7..08be169 100644 --- a/src/main/java/com/zcloud/controller/system/UsersController.java +++ b/src/main/java/com/zcloud/controller/system/UsersController.java @@ -72,7 +72,13 @@ public class UsersController extends BaseController { @Autowired private ImgFilesService imgfilesService; - + /** + * 根据卡号找人信息 + * + * @param page + * @return + * @throws Exception + */ @RequestMapping("/getUserByCardNo") @ResponseBody public Object getUserByCardNo() { From 771d0f04e7f2b5b219f57c302489d2e20cd09ea3 Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Mon, 29 Jan 2024 10:18:20 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8D=A1=E5=8F=B7=E6=9F=A5=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/mapApi/MapController.java | 12 +- .../controller/mapApi/MapEightController.java | 266 ++++++++++++++++++ src/main/java/com/zcloud/util/PLSUtil.java | 2 +- .../mybatis/datasource/system/UsersMapper.xml | 19 +- 4 files changed, 289 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/zcloud/controller/mapApi/MapEightController.java diff --git a/src/main/java/com/zcloud/controller/mapApi/MapController.java b/src/main/java/com/zcloud/controller/mapApi/MapController.java index 8df8716..a11c261 100644 --- a/src/main/java/com/zcloud/controller/mapApi/MapController.java +++ b/src/main/java/com/zcloud/controller/mapApi/MapController.java @@ -1,6 +1,8 @@ package com.zcloud.controller.mapApi; +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.system.UsersService; import com.zcloud.util.Jurisdiction; @@ -9,6 +11,7 @@ import com.zcloud.util.ReturnMap; 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; /** * 说明:TODO @@ -30,6 +33,7 @@ public class MapController extends BaseController { * @Return: java.lang.String */ @RequestMapping(value = "/getPersonnelTypeCount") + @ResponseBody public ReturnMap getPersonnelTypeCount() throws Exception { PageData pageData = getPageData(); pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); @@ -45,6 +49,7 @@ public class MapController extends BaseController { * @Return: com.zcloud.util.ReturnMap */ @RequestMapping(value = "/getAlarmTypeCount") + @ResponseBody public ReturnMap getAlarmTypeCount() throws Exception { return ReturnMap.ok().put("data", PLSUtil.getAlarmTypeCount(Jurisdiction.getCORPINFO_ID())); } @@ -57,8 +62,9 @@ public class MapController extends BaseController { * @Return: com.zcloud.util.ReturnMap */ @RequestMapping(value = "/getPersonnelPositioningCount") - public ReturnMap getPersonnelPositioningCount() throws Exception { -// return ReturnMap.ok().put("data", PLSUtil.getPersonnelPositioningCount(Jurisdiction.getCORPINFO_ID())); - return ReturnMap.error(); + @ResponseBody + public ReturnMap getPersonnelPositioningCount(Page page) throws Exception { + JSONObject personnelPositioningCount = PLSUtil.getPersonnelPositioningCount(Jurisdiction.getCORPINFO_ID(), page.getCurrentPage(), page.getShowCount()); + return ReturnMap.ok().put("data", personnelPositioningCount); } } diff --git a/src/main/java/com/zcloud/controller/mapApi/MapEightController.java b/src/main/java/com/zcloud/controller/mapApi/MapEightController.java new file mode 100644 index 0000000..c4a131e --- /dev/null +++ b/src/main/java/com/zcloud/controller/mapApi/MapEightController.java @@ -0,0 +1,266 @@ +package com.zcloud.controller.mapApi; + +import com.zcloud.controller.base.BaseController; +import com.zcloud.entity.Page; +import com.zcloud.entity.PageData; +import com.zcloud.util.ReturnMap; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +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.client.RestTemplate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 说明:实时地图八项工作内容 + * 官网:www.zcloudchina.com + */ +@Controller +@RequestMapping("/map/Eight") +public class MapEightController extends BaseController { + +// @Autowired +// private MapEightService mapEightService; +// +// @Autowired +// private RestTemplate restTemplate; +// +// /** +// * @return +// * @throws Exception +// */ +// @RequestMapping(value = "/getEcharts") +// @ResponseBody +// public Object getEcharts() throws Exception { +// PageData pd = new PageData(); +// pd = this.getPageData(); +// return mapEightService.getEchartsOrder(pd); +// } +// +// /** +// * 可视化首页统计数据 +// * +// * @param +// * @throws Exception +// */ +// @RequestMapping(value = "/findFormCount") +// @ResponseBody +// public Object findFormCount() throws Exception { +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = this.getPageData(); +// +// PageData data = mapEightService.statisticsHighRiskWorkByStateOrder(pd); +// map.put("pd", data); +// map.put("result", errInfo); +// return map; +// } +// +// /** +// * 作业实时情况展示(最新18条) +// * +// * @param +// * @throws Exception +// */ +// @RequestMapping(value = "/listHighRiskWork") +// @ResponseBody +// public Object listHighRiskWork(Page page) throws Exception { +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// List varList = new ArrayList<>(); +// //根据条件增加参数或减少参数 都没有 直接返回空 +// if (StringUtils.isBlank(pd.getString("CORPINFO_ID"))) { +// List ArrayDATA_IDS = mapEightService.getCorpinfoIds(pd); +// if (ArrayDATA_IDS.size() == 0) { +// map.put("result", errInfo); +// return map; +// } +// pd.put("ids", ArrayDATA_IDS); +// pd.remove("CORPINFO_ID"); +// } +// page.setPd(pd); +// varList = mapEightService.listHighRiskWorkOrder(page); +// map.put("varList", varList); +// map.put("result", errInfo); +// return map; +// } +// +// /** +// * 获取所有高危作业的位置坐标(有坐标数据) +// * +// * @param +// * @throws Exception +// */ +// @RequestMapping(value = "/listAllHighRiskWorkLocation") +// @ResponseBody +// public Object listAllHighRiskWorkLocation(@RequestParam(value = "CORPINFO_ID") String CORPINFO_ID, @RequestParam("TYPE") String type, @RequestParam("GANGKOU") String GANGKOU, @RequestParam("AREA") String AREA) throws Exception { +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = new PageData(); +// pd = this.getPageData(); +// //pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 企业 +// List varList = new ArrayList<>(); +// //根据条件增加参数或减少参数 都没有 直接返回空 +// varList = mapEightService.listAllHighRiskWorkLocationOrder(pd); +// map.put("varList", varList); +// map.put("result", errInfo); +// return map; +// } +// +// /** +// * 根据id以及类型获取数据 一公司 +// * +// * @param id 数据id +// * @param type 数据类型 动火 等等 +// * @return +// */ +// @RequestMapping(value = "/getById") +// @ResponseBody +// public Object getById(@RequestParam(value = "id") String id, @RequestParam("TYPE") String type) throws Exception { +// PageData pd = this.getPageData(); +// return mapEightService.getById(pd); +// } +// +// /** +// * 根据id以及类型获取数据 其他公司 +// * +// * @param id 数据id +// * @param type 数据类型 动火 等等 +// * @return +// */ +// @RequestMapping(value = "/getByIdOrder") +// @ResponseBody +// public Object getByIdOrder(@RequestParam(value = "id") String id, @RequestParam("TYPE") String type) throws Exception { +// PageData pd = new PageData(); +// pd = this.getPageData(); +// return mapEightService.getByIdOrder(pd); +// +// } +// +// /** +// * 列表 +// * +// * @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(); +// List varList = mapEightService.listAll(pd); //列出HotWorkApplicationDelayed列表 +// map.put("varList", varList); +// map.put("page", page); +// map.put("result", errInfo); +// return map; +// } +// +// /** +// * 获取动火防护措施 +// * +// * @param +// * @throws Exception +// */ +// @RequestMapping(value = "/listAllMeasures") +// @ResponseBody +// public Object listAllMeasures() throws Exception { +// Map map = new HashMap(); +// String errInfo = "success"; +// PageData pd = this.getPageData(); +// +// List varList = mapEightService.listAllMeasures(pd); //根据ID读取 +// map.put("varList", varList); +// map.put("result", errInfo); +// return map; +// } +// +// +// /** +// * 根据id以及类型获取数据 //曹妃甸东 +// * +// * @param id 数据id +// * @param type 数据类型 动火 等等 +// * @return +// */ +// @RequestMapping(value = "/getByIdCfdD") +// @ResponseBody +// public Object getByIdCfdD(@RequestParam(value = "id") String id, @RequestParam("TYPE") String type) throws Exception { +// PageData pd = this.getPageData(); +// MultiValueMap paramMap = new LinkedMultiValueMap(); +// paramMap.add("id", pd.getString("id")); +// paramMap.add("TYPE", pd.getString("TYPE")); +// paramMap.add("HOTWORK_ID", pd.getString("HOTWORK_ID")); +// Map result = +// restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getByIdOrder", paramMap, Map.class); +// return result; +// } +// +// /*曹妃甸专用接口-开始*/ +// +// /** +// * @Description: 获取八项作业所有作业人员 +// * @Date: 2023/9/23/023 9:04 +// * @Param: +// * @Return: +// */ +// @RequestMapping("/getAllWorkUserCards") +// @ResponseBody +// public ReturnMap getAllWorkUserCards() { +// PageData pageData = this.getPageData(); +// MultiValueMap paramMap = new LinkedMultiValueMap(); +// Map result = +// restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getAllWorkUserCards", paramMap, Map.class); +// return ReturnMap.ok(result); +// } +// +// /** +// * @Description: 获取八项作业所有作业人员 +// * @Date: 2023/9/23/023 9:04 +// * @Param: +// * @Return: +// */ +// @RequestMapping("/getAllTickets") +// @ResponseBody +// public ReturnMap getAllTickets() { +// PageData pageData = this.getPageData(); +// MultiValueMap paramMap = new LinkedMultiValueMap(); +// Map result = +// restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getAllTickets", paramMap, Map.class); +// return ReturnMap.ok(result); +// } +// +// /** +// * @Description: 获取八项作业所有作业人员 +// * @Date: 2023/9/23/023 9:04 +// * @Param: +// * @Return: +// */ +// @RequestMapping("/findEightsByUserId") +// @ResponseBody +// public ReturnMap findEightsByUserId() { +// PageData pageData = this.getPageData(); +// MultiValueMap paramMap = new LinkedMultiValueMap(); +// paramMap.add("empNo", pageData.getString("empNo")); +// paramMap.add("TYPE", pageData.getString("TYPE")); +// Map result = +// restTemplate.postForObject(cfdUrl + "/sync/map/Eight/findEightsByUserId", paramMap, Map.class); +// return ReturnMap.ok(result); +// } + + + /*曹妃甸专用接口-结束*/ + +} diff --git a/src/main/java/com/zcloud/util/PLSUtil.java b/src/main/java/com/zcloud/util/PLSUtil.java index 2692161..b33417f 100644 --- a/src/main/java/com/zcloud/util/PLSUtil.java +++ b/src/main/java/com/zcloud/util/PLSUtil.java @@ -31,7 +31,7 @@ public class PLSUtil { public static HashMap BAKEADDR = new HashMap<>(); private static RestTemplate restTemplate; - public static Object getPersonnelPositioningCount(String CORPINFO_ID, Integer currentPage, Integer showCount) throws Exception { + public static JSONObject getPersonnelPositioningCount(String CORPINFO_ID, Integer currentPage, Integer showCount) throws Exception { HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getToken(CORPINFO_ID)); HttpEntity httpEntity = new HttpEntity<>(headers); diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index 9fef58d..3fb259c 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -1395,12 +1395,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where CORPINFO_ID = #{CORPINFO_ID} and ISDELETE = 0 From 0b707e926171e92c73a28b8b8d253b2ebda43213 Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Mon, 29 Jan 2024 17:35:59 +0800 Subject: [PATCH 7/7] =?UTF-8?q?bi=E9=A1=B5=E4=BA=BA=E5=91=98=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=EF=BC=8Cai=E8=A7=86=E9=A2=91=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/mapApi/MapController.java | 126 + .../controller/mapApi/MapEightController.java | 313 +- .../video/VideoManagerController.java | 13 +- .../mapper/datasource/map/MapEightMapper.java | 441 ++ .../datasource/video/VideoManagerMapper.java | 8 + .../zcloud/service/map/MapEightService.java | 99 + .../service/map/impl/MapEightServiceImpl.java | 576 +++ .../service/video/VideoManagerService.java | 9 + .../video/impl/VideoManagerServiceImpl.java | 39 + src/main/java/com/zcloud/util/DateUtil.java | 1501 +++---- .../mybatis/datasource/bus/MapEightMapper.xml | 3765 +++++++++++++++++ .../datasource/video/VideoManagerMapper.xml | 401 +- 12 files changed, 6156 insertions(+), 1135 deletions(-) create mode 100644 src/main/java/com/zcloud/mapper/datasource/map/MapEightMapper.java create mode 100644 src/main/java/com/zcloud/service/map/MapEightService.java create mode 100644 src/main/java/com/zcloud/service/map/impl/MapEightServiceImpl.java create mode 100644 src/main/resources/mybatis/datasource/bus/MapEightMapper.xml diff --git a/src/main/java/com/zcloud/controller/mapApi/MapController.java b/src/main/java/com/zcloud/controller/mapApi/MapController.java index a11c261..043ad75 100644 --- a/src/main/java/com/zcloud/controller/mapApi/MapController.java +++ b/src/main/java/com/zcloud/controller/mapApi/MapController.java @@ -5,6 +5,8 @@ import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.system.UsersService; +import com.zcloud.service.video.VideoManagerService; +import com.zcloud.util.DateUtil; import com.zcloud.util.Jurisdiction; import com.zcloud.util.PLSUtil; import com.zcloud.util.ReturnMap; @@ -13,6 +15,10 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; + /** * 说明:TODO * 作者:wangxuan @@ -23,7 +29,10 @@ import org.springframework.web.bind.annotation.ResponseBody; public class MapController extends BaseController { @Autowired private UsersService usersService; + @Autowired + private VideoManagerService videomanagerService; +// ----------人员定位相关-------------// /** * @Description: 人员类型统计 告警类型统计 @@ -67,4 +76,121 @@ public class MapController extends BaseController { JSONObject personnelPositioningCount = PLSUtil.getPersonnelPositioningCount(Jurisdiction.getCORPINFO_ID(), page.getCurrentPage(), page.getShowCount()); return ReturnMap.ok().put("data", personnelPositioningCount); } + // ----------摄像头相关-------------// + + // 摄像头告警数 disposed + @RequestMapping(value = "/getCameraTopToShow") + @ResponseBody + public ReturnMap getCameraTopToShow() { + PageData pageData = getPageData(); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + PageData cameraCount = videomanagerService.getCameraTopToShow(pageData); + return ReturnMap.ok().put("pd", cameraCount); + } + /** + * @Description: 摄像头告警数 + * @Author: dearLin + * @Date: 2024/1/29/029 15:35 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getCameraAlarmCount") + @ResponseBody + public ReturnMap getCameraAlarmCount() { + PageData pageData = getPageData(); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + List cameraCount = videomanagerService.getCameraAlarmCount(pageData); + return ReturnMap.ok().put("CameraAlarmCount", cameraCount); + } + /** + * @Description: 摄像头报警类型 + * @Author: dearLin + * @Date: 2024/1/29/029 10:52 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getCameraAlarmTypeCount") + @ResponseBody + public ReturnMap getCameraAlarmTypeCount() { + PageData pageData = getPageData(); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + List cameraCount = videomanagerService.getCameraAlarmTypeCount(pageData); + return ReturnMap.ok().put("varList", cameraCount); + } + + /** + * @Description: 摄像头告警时间趋势 + * @Author: dearLin + * @Date: 2024/1/29/029 10:51 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getCameraAlarmTimeCount") + @ResponseBody + public ReturnMap getCameraAlarmTimeCount() throws Exception { + PageData pageData = getPageData(); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + List> generateTimeArraySevenMonth = DateUtil.generateTimeArraySevenMonth(6); + pageData.put("generateTimeArray", generateTimeArraySevenMonth); + return ReturnMap.ok().put("varList", videomanagerService.getCameraAlarmTimeCount(pageData)); + } + + /** + * @Description: 摄像头告警来源 + * @Author: dearLin + * @Date: 2024/1/29/029 10:51 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getCameraAlarmSourceCount") + @ResponseBody + public ReturnMap getCameraAlarmSourceCount() throws Exception { + PageData pageData = getPageData(); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + int cameraCount = usersService.getUserCount(pageData); + return ReturnMap.ok().put("cameraCount", cameraCount); + } + // -----------------------// + + public static List> generateTimeArray() { + List> timeArray = new ArrayList<>(); + Calendar calendar = Calendar.getInstance(); + + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + for (int i = 6; i >= 0; i--) { + Map monthInfo = new HashMap<>(); + + int year = calendar.get(Calendar.YEAR); + int month = calendar.get(Calendar.MONTH) + 1; + + String monthString = String.format(year+"-%02d", month); + String firstDayOfMonth = String.format("%04d-%02d-01 00:00:00", year, month); + calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + String lastDayOfMonth = dateFormat.format(calendar.getTime()); + + monthInfo.put("month", monthString); + monthInfo.put("dateBegin", firstDayOfMonth); + monthInfo.put("dateEnd", lastDayOfMonth); + + timeArray.add(monthInfo); + + calendar.add(Calendar.MONTH, -1); // Go to the previous month + } + + // Reverse the timeArray to have the order from past to present + Collections.reverse(timeArray); + + return timeArray; + } + + public static void main(String[] args) { + List> timeArray = generateTimeArray(); + for (Map monthInfo : timeArray) { + System.out.println(monthInfo); + } + } } diff --git a/src/main/java/com/zcloud/controller/mapApi/MapEightController.java b/src/main/java/com/zcloud/controller/mapApi/MapEightController.java index c4a131e..ae73ce9 100644 --- a/src/main/java/com/zcloud/controller/mapApi/MapEightController.java +++ b/src/main/java/com/zcloud/controller/mapApi/MapEightController.java @@ -3,6 +3,8 @@ package com.zcloud.controller.mapApi; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; +import com.zcloud.service.map.MapEightService; +import com.zcloud.util.Jurisdiction; import com.zcloud.util.ReturnMap; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -28,239 +30,86 @@ import java.util.Map; @RequestMapping("/map/Eight") public class MapEightController extends BaseController { -// @Autowired -// private MapEightService mapEightService; -// -// @Autowired -// private RestTemplate restTemplate; -// -// /** -// * @return -// * @throws Exception -// */ -// @RequestMapping(value = "/getEcharts") -// @ResponseBody -// public Object getEcharts() throws Exception { -// PageData pd = new PageData(); -// pd = this.getPageData(); -// return mapEightService.getEchartsOrder(pd); -// } -// -// /** -// * 可视化首页统计数据 -// * -// * @param -// * @throws Exception -// */ -// @RequestMapping(value = "/findFormCount") -// @ResponseBody -// public Object findFormCount() throws Exception { -// Map map = new HashMap(); -// String errInfo = "success"; -// PageData pd = this.getPageData(); -// -// PageData data = mapEightService.statisticsHighRiskWorkByStateOrder(pd); -// map.put("pd", data); -// map.put("result", errInfo); -// return map; -// } -// -// /** -// * 作业实时情况展示(最新18条) -// * -// * @param -// * @throws Exception -// */ -// @RequestMapping(value = "/listHighRiskWork") -// @ResponseBody -// public Object listHighRiskWork(Page page) throws Exception { -// Map map = new HashMap(); -// String errInfo = "success"; -// PageData pd = new PageData(); -// pd = this.getPageData(); -// List varList = new ArrayList<>(); -// //根据条件增加参数或减少参数 都没有 直接返回空 -// if (StringUtils.isBlank(pd.getString("CORPINFO_ID"))) { -// List ArrayDATA_IDS = mapEightService.getCorpinfoIds(pd); -// if (ArrayDATA_IDS.size() == 0) { -// map.put("result", errInfo); -// return map; -// } -// pd.put("ids", ArrayDATA_IDS); -// pd.remove("CORPINFO_ID"); -// } -// page.setPd(pd); -// varList = mapEightService.listHighRiskWorkOrder(page); -// map.put("varList", varList); -// map.put("result", errInfo); -// return map; -// } -// -// /** -// * 获取所有高危作业的位置坐标(有坐标数据) -// * -// * @param -// * @throws Exception -// */ -// @RequestMapping(value = "/listAllHighRiskWorkLocation") -// @ResponseBody -// public Object listAllHighRiskWorkLocation(@RequestParam(value = "CORPINFO_ID") String CORPINFO_ID, @RequestParam("TYPE") String type, @RequestParam("GANGKOU") String GANGKOU, @RequestParam("AREA") String AREA) throws Exception { -// Map map = new HashMap(); -// String errInfo = "success"; -// PageData pd = new PageData(); -// pd = this.getPageData(); -// //pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 企业 -// List varList = new ArrayList<>(); -// //根据条件增加参数或减少参数 都没有 直接返回空 -// varList = mapEightService.listAllHighRiskWorkLocationOrder(pd); -// map.put("varList", varList); -// map.put("result", errInfo); -// return map; -// } -// -// /** -// * 根据id以及类型获取数据 一公司 -// * -// * @param id 数据id -// * @param type 数据类型 动火 等等 -// * @return -// */ -// @RequestMapping(value = "/getById") -// @ResponseBody -// public Object getById(@RequestParam(value = "id") String id, @RequestParam("TYPE") String type) throws Exception { -// PageData pd = this.getPageData(); -// return mapEightService.getById(pd); -// } -// -// /** -// * 根据id以及类型获取数据 其他公司 -// * -// * @param id 数据id -// * @param type 数据类型 动火 等等 -// * @return -// */ -// @RequestMapping(value = "/getByIdOrder") -// @ResponseBody -// public Object getByIdOrder(@RequestParam(value = "id") String id, @RequestParam("TYPE") String type) throws Exception { -// PageData pd = new PageData(); -// pd = this.getPageData(); -// return mapEightService.getByIdOrder(pd); -// -// } -// -// /** -// * 列表 -// * -// * @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(); -// List varList = mapEightService.listAll(pd); //列出HotWorkApplicationDelayed列表 -// map.put("varList", varList); -// map.put("page", page); -// map.put("result", errInfo); -// return map; -// } -// -// /** -// * 获取动火防护措施 -// * -// * @param -// * @throws Exception -// */ -// @RequestMapping(value = "/listAllMeasures") -// @ResponseBody -// public Object listAllMeasures() throws Exception { -// Map map = new HashMap(); -// String errInfo = "success"; -// PageData pd = this.getPageData(); -// -// List varList = mapEightService.listAllMeasures(pd); //根据ID读取 -// map.put("varList", varList); -// map.put("result", errInfo); -// return map; -// } -// -// -// /** -// * 根据id以及类型获取数据 //曹妃甸东 -// * -// * @param id 数据id -// * @param type 数据类型 动火 等等 -// * @return -// */ -// @RequestMapping(value = "/getByIdCfdD") -// @ResponseBody -// public Object getByIdCfdD(@RequestParam(value = "id") String id, @RequestParam("TYPE") String type) throws Exception { -// PageData pd = this.getPageData(); -// MultiValueMap paramMap = new LinkedMultiValueMap(); -// paramMap.add("id", pd.getString("id")); -// paramMap.add("TYPE", pd.getString("TYPE")); -// paramMap.add("HOTWORK_ID", pd.getString("HOTWORK_ID")); -// Map result = -// restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getByIdOrder", paramMap, Map.class); -// return result; -// } -// -// /*曹妃甸专用接口-开始*/ -// -// /** -// * @Description: 获取八项作业所有作业人员 -// * @Date: 2023/9/23/023 9:04 -// * @Param: -// * @Return: -// */ -// @RequestMapping("/getAllWorkUserCards") -// @ResponseBody -// public ReturnMap getAllWorkUserCards() { -// PageData pageData = this.getPageData(); -// MultiValueMap paramMap = new LinkedMultiValueMap(); -// Map result = -// restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getAllWorkUserCards", paramMap, Map.class); -// return ReturnMap.ok(result); -// } -// -// /** -// * @Description: 获取八项作业所有作业人员 -// * @Date: 2023/9/23/023 9:04 -// * @Param: -// * @Return: -// */ -// @RequestMapping("/getAllTickets") -// @ResponseBody -// public ReturnMap getAllTickets() { -// PageData pageData = this.getPageData(); -// MultiValueMap paramMap = new LinkedMultiValueMap(); -// Map result = -// restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getAllTickets", paramMap, Map.class); -// return ReturnMap.ok(result); -// } -// -// /** -// * @Description: 获取八项作业所有作业人员 -// * @Date: 2023/9/23/023 9:04 -// * @Param: -// * @Return: -// */ -// @RequestMapping("/findEightsByUserId") -// @ResponseBody -// public ReturnMap findEightsByUserId() { -// PageData pageData = this.getPageData(); -// MultiValueMap paramMap = new LinkedMultiValueMap(); -// paramMap.add("empNo", pageData.getString("empNo")); -// paramMap.add("TYPE", pageData.getString("TYPE")); -// Map result = -// restTemplate.postForObject(cfdUrl + "/sync/map/Eight/findEightsByUserId", paramMap, Map.class); -// return ReturnMap.ok(result); -// } + @Autowired + private MapEightService mapEightService; + + + /** + * @return + * @throws Exception + */ + @RequestMapping(value = "/getEcharts") + @ResponseBody + public Object getEcharts() throws Exception { + PageData pd = new PageData(); + pd = this.getPageData(); + return mapEightService.getEchartsOrder(pd); + } + + /** + * 可视化首页统计数据 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/findFormCount") + @ResponseBody + public Object findFormCount() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + PageData data = mapEightService.statisticsHighRiskWorkByStateOrder(pd); + map.put("pd", data); + map.put("result", errInfo); + return map; + } + + /** + * 作业实时情况展示(最新18条) + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/listHighRiskWork") + @ResponseBody + public Object listHighRiskWork(Page page) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + List varList = new ArrayList<>(); + //根据条件增加参数或减少参数 都没有 直接返回空 + page.setPd(pd); + varList = mapEightService.listHighRiskWorkOrder(page); + map.put("varList", varList); + map.put("result", errInfo); + return map; + } + + /** + * 获取所有高危作业的位置坐标(有坐标数据) + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/listAllHighRiskWorkLocation") + @ResponseBody + public Object listAllHighRiskWorkLocation(@RequestParam(value = "CORPINFO_ID") String CORPINFO_ID, @RequestParam("TYPE") String type, @RequestParam("GANGKOU") String GANGKOU, @RequestParam("AREA") String AREA) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + //pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 企业 + List varList = new ArrayList<>(); + //根据条件增加参数或减少参数 都没有 直接返回空 + varList = mapEightService.listAllHighRiskWorkLocationOrder(pd); + map.put("varList", varList); + map.put("result", errInfo); + return map; + } + - /*曹妃甸专用接口-结束*/ } diff --git a/src/main/java/com/zcloud/controller/video/VideoManagerController.java b/src/main/java/com/zcloud/controller/video/VideoManagerController.java index 5949891..c5b1f1f 100644 --- a/src/main/java/com/zcloud/controller/video/VideoManagerController.java +++ b/src/main/java/com/zcloud/controller/video/VideoManagerController.java @@ -92,18 +92,9 @@ public class VideoManagerController extends BaseController { public Object editZhiding() throws Exception{ Map map = new HashMap(); String errInfo = "success"; - PageData pd = new PageData(); - if(Tools.isEmpty(Jurisdiction.getCORPINFO_ID())) { - pd.put("CORPINFO_TYPE", "2"); - }else { - pd.put("CORPINFO_TYPE", "1"); - pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); - } - pd.put("ISSHOW", "0");//重置置顶信息。把所有的数据全部取消置顶 - videomanagerService.editZhiding(pd); - pd = new PageData(); - pd = this.getPageData(); + PageData pd = this.getPageData(); pd.put("ISSHOW", "1"); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); videomanagerService.editZhiding(pd);//置顶信息 map.put("pd", pd); map.put("result", errInfo); diff --git a/src/main/java/com/zcloud/mapper/datasource/map/MapEightMapper.java b/src/main/java/com/zcloud/mapper/datasource/map/MapEightMapper.java new file mode 100644 index 0000000..49fe8a4 --- /dev/null +++ b/src/main/java/com/zcloud/mapper/datasource/map/MapEightMapper.java @@ -0,0 +1,441 @@ +package com.zcloud.mapper.datasource.map; + +import com.zcloud.entity.Page; +import com.zcloud.entity.PageData; + +import java.util.List; +import java.util.Map; + +/** + * 说明:重点工程处罚 + * 作者:luoxiaobao + * 时间:2022-09-21 + * 官网:www.zcloudchina.com + */ +public interface MapEightMapper { + + + List getCorpinfoIds(String[] ArrayDATA_IDS); + + /** + * 获取柱状图 + * @param pd + * @return + */ + List> getEcharts(PageData pd); + + + /** + * 获取高危作业统计数据(申请数[COUNTAPPLY],审批中[COUNTAPPROVE],归档[COUNTARCHIVE]) + * @param pd + * @return + * @throws Exception + */ + PageData statisticsHighRiskWorkByState(PageData pd); + + + /** + * 作业实时情况展示 + * @param page + * @return + * @throws Exception + */ + List realTimeHighRiskWorklistPage(Page page); + + + /**动火查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getHOTWORKHighRiskWorkLocation(PageData pd); + + /**临时用电查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getELECTRICITYHighRiskWorkLocation(PageData pd); + + /**盲板查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getBLINDBOARDHighRiskWorkLocation(PageData pd); + + /**高处作业查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getHIGHWORKHighRiskWorkLocation(PageData pd); + + /**有限空间作业查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getCONFINEDSPACEHighRiskWorkLocation(PageData pd); + + /**吊装作业查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getHOISTINGHighRiskWorkLocation(PageData pd); + + + + + + + + /**动火查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdHOTWORK(PageData pd); + + /** + * 动火数据 + * @param pd + * @return + */ + List listAlldelayed(PageData pd); + + /** + * 动火数据 + * @param pd + * @return + */ + List listAllcuoshiHOTWORK(PageData pd); + /**动火措施查询 + * @param pd + * @return + */ + List listAllMeasuresHOTWORK(PageData pd); + + /**动火 + * @param pd + * @throws Exception + */ + List listAll(PageData pd); + + /**动火审批详情 + * @param pd + * @throws Exception + */ + List getList(PageData pd); + + + /**动火 + * @param pd + * @throws Exception + */ + List listAllMeasures(PageData pd); + + /**动火查询数据列表 + * @param pd + * @throws Exception + */ + List listAllHOTWORK(PageData pd); + + /**临时用电查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdELECTRICITY(PageData pd); + + /**临时用电措施查询 + * @param pd + * @return + */ + List listAllMeasuresELECTRICITY(PageData pd); + + /**盲板查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdBLINDBOARD(PageData pd); + + /**通过id数据经纬度 盲板 + * @param pd + * @throws Exception + */ + PageData findByIdJWD(PageData pd); + + /**盲板图片查询 + * @param pd + * @return + */ + List listAllBLINDBOARD(PageData pd); + + /**高处作业查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdHIGHWORK(PageData pd); + + /**高处作业措施查询 + * @param pd + * @throws Exception + */ + List listAllMeasuresHIGHWORK(PageData pd); + + /**有限空间作业查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdCONFINEDSPACE(PageData pd); + + /**有限空间作业措施查询 + * @param pd + * @throws Exception + */ + List listAllMeasuresCONFINEDSPACE(PageData pd); + + /**有限空间作业 + * @param pd + * @throws Exception + */ + List listAllCONFINEDSPACE(PageData pd); + + /**吊装作业查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdHOISTING(PageData pd); + + /**吊装作业措施查询 + * @param pd + * @throws Exception + */ + List listAllMeasuresHOISTING(PageData pd); + + + /** + * 获取其他公司柱状图 + * @param pd + * @return + */ + List> getEchartsOrder(PageData pd); + + + /** + * 其他公司获取高危作业统计数据(申请数[COUNTAPPLY],审批中[COUNTAPPROVE],归档[COUNTARCHIVE]) + * @param pd + * @return + * @throws Exception + */ + PageData statisticsHighRiskWorkByStateOrder(PageData pd); + + /** + * 其他公司作业实时情况展示 + * @param page + * @return + * @throws Exception + */ + List realTimeHighRiskWorklistPageOrder(Page page); + + /**临时用电查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getELECTRICITYHighRiskWorkLocationOrder(PageData pd); + + /**盲板查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getBLINDBOARDHighRiskWorkLocationOrder(PageData pd); + + /**高处作业查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getHIGHWORKHighRiskWorkLocationOrder(PageData pd); + + /**有限空间作业查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getCONFINEDSPACEHighRiskWorkLocationOrder(PageData pd); + + /**吊装作业查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getHOISTINGHighRiskWorkLocationOrder(PageData pd); + + /**破土作业查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getBREAKGROUNDHighRiskWorkLocationOrder(PageData pd); + + + /**断路作业查询数据(有坐标数据) + * @param pd + * @throws Exception + */ + List getCUTROADHighRiskWorkLocationOrder(PageData pd); + + /**临时用电查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdELECTRICITYOrder(PageData pd); + + /**临时用电措施查询 + * @param pd + * @return + */ + List listAllMeasuresELECTRICITYOrder(PageData pd); + + + List listAllGasELECTRICTITYOrder(PageData pd); + + /**盲板查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdBLINDBOARDOrder(PageData pd); + + /**通过id数据经纬度 盲板 + * @param pd + * @throws Exception + */ + PageData findByIdJWDOrder(PageData pd); + + + /** + * 获取盲板安全措施数据 + * @param pd + * @return + */ + List listAllMeasuresBLINDBOARDOrder(PageData pd); + + + /**高处作业查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdHIGHWORKOrder(PageData pd); + + /**高处作业措施查询 + * @param pd + * @throws Exception + */ + List listAllMeasuresHIGHWORKOrder(PageData pd); + + /**吊装作业查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdHOISTINGOrder(PageData pd); + + /**吊装作业措施查询 + * @param pd + * @throws Exception + */ + List listAllMeasuresHOISTINGOrder(PageData pd); + + /**破土作业查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdBREAKGROUNDOrder(PageData pd); + + /**破土作业措施查询 + * @param pd + * @throws Exception + */ + List listAllMeasuresBREAKGROUNDOrder(PageData pd); + + /**断路作业查询数据 + * @param pd + * @throws Exception + */ + PageData findByIdCUTROADOrder(PageData pd); + + /**断路作业措施查询 + * @param pd + * @throws Exception + */ + List listAllMeasuresCUTROADOrder(PageData pd); + + /** + * 动火获取字典展示 + * @param shuzu + * @return + */ + List getListDongHuo(List shuzu); + + /** + * 获取cfd动火作业高危作业坐标统计 + * @param pd + * @return + */ + List getHOTWORKHighRiskWorkLocationCfd(PageData pd); + + + List findByELECTRICTITYAcceptuserId(PageData pd); + + List findByELECTRICTITYAcceptuserIds(PageData pd); + + List findByBLINDBOARDAcceptuserId(PageData pd); + + List findByBLINDBOARDAcceptuserIds(PageData pd); + + List findByCUTROADAcceptuserId(PageData pd); + + List findByCUTROADAcceptuserIds(PageData pd); + + List findByBREAKGROUNDAcceptuserId(PageData pd); + + List findByBREAKGROUNDAcceptuserIds(PageData pd); + + List findByHIGHWORKAcceptuserId(PageData pd); + + List findByHIGHWORKAcceptuserIds(PageData pd); + + List findByHOISTINGAcceptuserId(PageData pd); + + List findByHOISTINGAcceptuserIds(PageData pd); + + /**有限空间作业查询 + * @param pd + * @throws Exception + */ + PageData findByIdCONFINEDSPACEOrder(PageData pd); + + /**有限空间作业措施查询 + * @param pd + * @throws Exception + */ + List listAllMeasuresCONFINEDSPACEOrder(PageData pd); + + /** + * 有限空间 + * @param pd + * @return + */ + List listAllCONFINEDSPACEOrder(PageData pd); + + /** + * 有限空间 + * @param pd + * @return + */ + List findByIdCONFINEDSPACEAcceptuser(PageData pd); + + /** + * 有限空间 + * @param pd + * @return + */ + List findByIdCONFINEDSPACEAcceptusers(PageData pd); + + /** + * 有限空间气体检测 + * @param pd + * @return + */ + PageData findByIdCONFINEDSPACEGasWH(PageData pd); +} + diff --git a/src/main/java/com/zcloud/mapper/datasource/video/VideoManagerMapper.java b/src/main/java/com/zcloud/mapper/datasource/video/VideoManagerMapper.java index 1cc065d..ec919b5 100644 --- a/src/main/java/com/zcloud/mapper/datasource/video/VideoManagerMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/video/VideoManagerMapper.java @@ -66,5 +66,13 @@ public interface VideoManagerMapper { void deleteAll(String[] ArrayDATA_IDS); PageData findByCode(PageData videoPd); + + List getCameraAlarmCount(PageData pageData); + + List getCameraAlarmTypeCount(PageData pageData); + + List getCameraAlarmTimeCount(PageData pageData); + + PageData getCameraTopToShow(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/map/MapEightService.java b/src/main/java/com/zcloud/service/map/MapEightService.java new file mode 100644 index 0000000..079e284 --- /dev/null +++ b/src/main/java/com/zcloud/service/map/MapEightService.java @@ -0,0 +1,99 @@ +package com.zcloud.service.map; + +import com.zcloud.entity.Page; +import com.zcloud.entity.PageData; + +import java.util.List; +import java.util.Map; + +/** + * 说明:实施地图八项作业 + * 作者:luoxiaobao + * 时间:2022-09-21 + * 官网:www.zcloudchina.com + */ +public interface MapEightService { + + List getCorpinfoIds(PageData pd); + + Object getEcharts(PageData pd); + + PageData statisticsHighRiskWorkByState(PageData pd)throws Exception; + + /** + * 作业实时情况展示 + * @param page + * @return + * @throws Exception + */ + List listHighRiskWork(Page page)throws Exception; + + + /** + * 获取所有高危作业的位置坐标(有坐标数据) + * @param pd + * @return + * @throws Exception + */ + List listAllHighRiskWorkLocation(PageData pd)throws Exception; + + + /**动火 + * @param pd + * @throws Exception + */ + List listAll(PageData pd); + + /**动火 + * @param pd + * @throws Exception + */ + List listAllMeasures(PageData pd); + + /** + * 根据id获取数据 + * @param pd + * @return + */ + Map getById (PageData pd); + + /** + * 获取其他公司柱状图 + * @param pd + * @return + */ + Object getEchartsOrder(PageData pd); + + /** + * 其他公司获取统计数据 + * @param pd + * @return + * @throws Exception + */ + PageData statisticsHighRiskWorkByStateOrder(PageData pd)throws Exception; + + /** + * 其他作业实时情况展示 + * @param page + * @return + * @throws Exception + */ + List listHighRiskWorkOrder(Page page)throws Exception; + + + /** + * 获取所有高危作业的位置坐标(有坐标数据) + * @param pd + * @return + * @throws Exception + */ + List listAllHighRiskWorkLocationOrder(PageData pd)throws Exception; + + /** + * 获取其他公司详细数据 + * @param pd + * @return + */ + Map getByIdOrder(PageData pd); +} + diff --git a/src/main/java/com/zcloud/service/map/impl/MapEightServiceImpl.java b/src/main/java/com/zcloud/service/map/impl/MapEightServiceImpl.java new file mode 100644 index 0000000..de82f6f --- /dev/null +++ b/src/main/java/com/zcloud/service/map/impl/MapEightServiceImpl.java @@ -0,0 +1,576 @@ +package com.zcloud.service.map.impl; + +import com.zcloud.entity.Page; +import com.zcloud.entity.PageData; +import com.zcloud.mapper.datasource.map.MapEightMapper; +import com.zcloud.service.map.MapEightService; +import com.zcloud.util.Tools; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 说明:实时地图八项工作 + * 作者:luoxiaobao + * 时间:2022-09-21 + * 官网:www.zcloudchina.com + */ +@Service +@Transactional //开启事物 +public class MapEightServiceImpl implements MapEightService { + + @Autowired + private MapEightMapper mapEightMapper; + + @Override + public List getCorpinfoIds(PageData pd) { + String area = pd.getString("AREA"); + if (StringUtils.isNotBlank(area)) { + String[] ArrayDATA_IDS = area.split(","); + return mapEightMapper.getCorpinfoIds(ArrayDATA_IDS); + } + String gangkou = pd.getString("GANGKOU"); + if (StringUtils.equals("00003", gangkou)) { + String[] ArrayDATA_IDS = new String[]{"1", "2"}; + return mapEightMapper.getCorpinfoIds(ArrayDATA_IDS); + } + return new ArrayList<>(); + } + + @Override + public Object getEcharts(PageData pd) { + Map returnMap = new HashMap<>(); + String errInfo = "success"; + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + calendar.add(Calendar.DAY_OF_MONTH, -4); + String dateStr = sdf.format(calendar.getTime()); + List> list = mapEightMapper.getEcharts(pd); + List clickDate = new ArrayList<>(); + List dhzyCount = new ArrayList<>(); + List dbzyCount = new ArrayList<>(); + List yxgjzyCount = new ArrayList<>(); + List gczyCount = new ArrayList<>(); + List dzzyCount = new ArrayList<>(); + List lsydCount = new ArrayList<>(); + //用于排序,并整理数据 + for (int i = 0; i < 5; i++) { + for (Map map : list) { + if (StringUtils.equals(dateStr, map.get("clickDate").toString())) { + clickDate.add(map.get("clickDate").toString()); + dhzyCount.add(map.get("dhzyCount").toString()); + dbzyCount.add(map.get("dbzyCount").toString()); + yxgjzyCount.add(map.get("yxgjzyCount").toString()); + gczyCount.add(map.get("gczyCount").toString()); + dzzyCount.add(map.get("dzzyCount").toString()); + lsydCount.add(map.get("lsydCount").toString()); + } + } + calendar.add(Calendar.DAY_OF_MONTH, +1); + dateStr = sdf.format(calendar.getTime()); + } + List name = new ArrayList<>(); + List> date = new ArrayList<>(); + name.add("动火作业"); + date.add(dhzyCount); + name.add("盲板作业"); + date.add(dbzyCount); + name.add("有限空间作业"); + date.add(yxgjzyCount); + name.add("高处作业"); + date.add(gczyCount); + name.add("吊装作业"); + date.add(dzzyCount); + name.add("临时用电"); + date.add(lsydCount); + returnMap.put("clickDate", clickDate); + returnMap.put("name", name); + returnMap.put("date", date); + returnMap.put("result", errInfo); + return returnMap; + } + + @Override + public PageData statisticsHighRiskWorkByState(PageData pd) throws Exception { + return mapEightMapper.statisticsHighRiskWorkByState(pd); + } + + @Override + public List listHighRiskWork(Page page) throws Exception { + return mapEightMapper.realTimeHighRiskWorklistPage(page); + } + + @Override + public List listAllHighRiskWorkLocation(PageData pd) throws Exception { + List r = new ArrayList<>(); + String typeStr = pd.getString("TYPE"); + //动火 + if (StringUtils.equals(typeStr, "HOTWORK")) { +// r = mapEightMapper.getHOTWORKHighRiskWorkLocation(pd); + r = mapEightMapper.getHOTWORKHighRiskWorkLocationCfd(pd); + //临时用电 + } else if (StringUtils.equals(typeStr, "ELECTRICITY")) { + r = mapEightMapper.getELECTRICITYHighRiskWorkLocationOrder(pd); + //盲板 + } else if (StringUtils.equals(typeStr, "BLINDBOARD")) { + r = mapEightMapper.getBLINDBOARDHighRiskWorkLocationOrder(pd); + // 高处 + } else if (StringUtils.equals(typeStr, "HIGHWORK")) { + r = mapEightMapper.getHIGHWORKHighRiskWorkLocationOrder(pd); + //有限空间 + } else if (StringUtils.equals(typeStr, "CONFINEDSPACE")) { + r = mapEightMapper.getCONFINEDSPACEHighRiskWorkLocationOrder(pd); + //吊装 + } else if (StringUtils.equals(typeStr, "HOISTING")) { + r = mapEightMapper.getHOISTINGHighRiskWorkLocationOrder(pd); + } + return r; + } + + + @Override + public List listAll(PageData pd) { + return mapEightMapper.listAll(pd); + } + + @Override + public List listAllMeasures(PageData pd) { + return mapEightMapper.listAllMeasures(pd); + } + + + @Override + public Map getById(PageData pd) { + Map map = new HashMap(); + String errInfo = "success"; + String typeStr = pd.getString("TYPE"); + String idStr = pd.getString("id"); + List pageDataList = new ArrayList<>(); + if (StringUtils.equals(typeStr, "HOTWORK")) { + pd.put("HOTWORKAPPLICATION_ID", idStr); + pd = mapEightMapper.findByIdHOTWORK(pd); + pd = dianhuo(pd); + List list = mapEightMapper.getList(pd); + //这里封装前台要的参数 + pd = shenpi(pd, list); + map.put("measuresList", mapEightMapper.listAllMeasuresHOTWORK(pd)); + map.put("gasList", mapEightMapper.listAllHOTWORK(pd)); + List safetymethodrecordList = mapEightMapper.listAllcuoshiHOTWORK(pd);//其它安全措施明细集合 + map.put("safetymethodrecordList", safetymethodrecordList); + List delayedList = mapEightMapper.listAlldelayed(pd); + map.put("delayedList", delayedList); + } else if (StringUtils.equals(typeStr, "ELECTRICITY")) { + pd.put("ELECTRICITY_ID", idStr); + pd = mapEightMapper.findByIdELECTRICITY(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresELECTRICITY(pd)); + } else if (StringUtils.equals(typeStr, "BLINDBOARD")) { + pd.put("BLINDBOARD_ID", idStr); + pd = mapEightMapper.findByIdBLINDBOARD(pd); + PageData Info = mapEightMapper.findByIdJWD(pd); + pd.put("TYPE", 105);//盲板位置图 + pd.put("FOREIGN_KEY", pd.getString("BLINDBOARD_ID")); + List ImgList = mapEightMapper.listAllBLINDBOARD(pd); + map.put("Info", Info);//获取经纬度 + map.put("ImgList", ImgList); + } else if (StringUtils.equals(typeStr, "HIGHWORK")) { + pd.put("HIGHWORK_ID", idStr); + pd = mapEightMapper.findByIdHIGHWORK(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresHIGHWORK(pd)); + } else if (StringUtils.equals(typeStr, "CONFINEDSPACE")) { + pd.put("CONFINEDSPACE_ID", idStr); + pd = mapEightMapper.findByIdCONFINEDSPACE(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresCONFINEDSPACE(pd)); + map.put("gasList", mapEightMapper.listAllCONFINEDSPACE(pd)); + } else if (StringUtils.equals(typeStr, "HOISTING")) { + pd.put("HOISTING_ID", idStr); + pd = mapEightMapper.findByIdHOISTING(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresHOISTING(pd)); + } + map.put("pd", pd); + map.put("result", errInfo); + return map; + } + + @Override + public Object getEchartsOrder(PageData pd) { + Map returnMap = new HashMap<>(); + String errInfo = "success"; + + //根据条件增加参数或减少参数 都没有 直接返回空 + if (StringUtils.isBlank(pd.getString("CORPINFO_ID"))) { + List ArrayDATA_IDS = getCorpinfoIds(pd); + if (ArrayDATA_IDS.size() == 0) { + returnMap.put("result", errInfo); + return returnMap; + } else { + pd.put("ids", ArrayDATA_IDS); + pd.remove("CORPINFO_ID"); + } + } + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + calendar.add(Calendar.DAY_OF_MONTH, -4); + String dateStr = sdf.format(calendar.getTime()); + List> list = mapEightMapper.getEchartsOrder(pd); + List clickDate = new ArrayList<>(); + List dhzyCount = new ArrayList<>(); + List dbzyCount = new ArrayList<>(); + List yxgjzyCount = new ArrayList<>(); + List gczyCount = new ArrayList<>(); + List dzzyCount = new ArrayList<>(); + List lsydCount = new ArrayList<>(); + List dtzyCount = new ArrayList<>(); + List dlzyCount = new ArrayList<>(); + //用于排序,并整理数据 + for (int i = 0; i < 5; i++) { + for (Map map : list) { + if (StringUtils.equals(dateStr, map.get("clickDate").toString())) { + clickDate.add(map.get("clickDate").toString()); + dhzyCount.add(map.get("dhzyCount").toString()); + dbzyCount.add(map.get("dbzyCount").toString()); + yxgjzyCount.add(map.get("yxgjzyCount").toString()); + gczyCount.add(map.get("gczyCount").toString()); + dzzyCount.add(map.get("dzzyCount").toString()); + lsydCount.add(map.get("lsydCount").toString()); + dtzyCount.add(map.get("dtzyCount").toString()); + dlzyCount.add(map.get("dlzyCount").toString()); + } + } + calendar.add(Calendar.DAY_OF_MONTH, +1); + dateStr = sdf.format(calendar.getTime()); + } + List name = new ArrayList<>(); + List> date = new ArrayList<>(); + name.add("动火作业"); + date.add(dhzyCount); + name.add("盲板作业"); + date.add(dbzyCount); + name.add("有限空间作业"); + date.add(yxgjzyCount); + name.add("高处作业"); + date.add(gczyCount); + name.add("吊装作业"); + date.add(dzzyCount); + name.add("临时用电"); + date.add(lsydCount); + name.add("动土作业"); + date.add(dtzyCount); + name.add("断路作业"); + date.add(dlzyCount); + returnMap.put("clickDate", clickDate); + returnMap.put("name", name); + returnMap.put("date", date); + returnMap.put("result", errInfo); + return returnMap; + } + + @Override + public PageData statisticsHighRiskWorkByStateOrder(PageData pd) throws Exception { + //根据条件增加参数或减少参数 都没有 直接返回空 + + return mapEightMapper.statisticsHighRiskWorkByStateOrder(pd); + } + + @Override + public List listHighRiskWorkOrder(Page page) throws Exception { + return mapEightMapper.realTimeHighRiskWorklistPageOrder(page); + } + + @Override + public List listAllHighRiskWorkLocationOrder(PageData pd) throws Exception { + List r = new ArrayList<>(); + String typeStr = pd.getString("TYPE"); + //动火 + if (StringUtils.equals(typeStr, "HOTWORK")) { + r = mapEightMapper.getHOTWORKHighRiskWorkLocation(pd); + //临时用电 + } else if (StringUtils.equals(typeStr, "ELECTRICITY")) { + r = mapEightMapper.getELECTRICITYHighRiskWorkLocationOrder(pd); + //盲板 + } else if (StringUtils.equals(typeStr, "BLINDBOARD")) { + r = mapEightMapper.getBLINDBOARDHighRiskWorkLocationOrder(pd); + // 高处 + } else if (StringUtils.equals(typeStr, "HIGHWORK")) { + r = mapEightMapper.getHIGHWORKHighRiskWorkLocationOrder(pd); + //有限空间 + } else if (StringUtils.equals(typeStr, "CONFINEDSPACE")) { + r = mapEightMapper.getCONFINEDSPACEHighRiskWorkLocationOrder(pd); + //吊装 + } else if (StringUtils.equals(typeStr, "HOISTING")) { + r = mapEightMapper.getHOISTINGHighRiskWorkLocationOrder(pd); + //动土 + } else if (StringUtils.equals(typeStr, "BREAKGROUND")) { + r = mapEightMapper.getBREAKGROUNDHighRiskWorkLocationOrder(pd); + //断路 + } else if (StringUtils.equals(typeStr, "CUTROAD")) { + r = mapEightMapper.getCUTROADHighRiskWorkLocationOrder(pd); + } + return r; + } + + @Override + public Map getByIdOrder(PageData pd) { + Map map = new HashMap(); + String errInfo = "success"; + String typeStr = pd.getString("TYPE"); + String idStr = pd.getString("id"); + List pageDataList = new ArrayList<>(); + if (StringUtils.equals(typeStr, "HOTWORK")) { + pd.put("HOTWORKAPPLICATION_ID", idStr); + pd = mapEightMapper.findByIdHOTWORK(pd); + pd = dianhuo(pd); + List list = mapEightMapper.getList(pd); + //这里封装前台要的参数 + pd = shenpi(pd, list); + map.put("measuresList", mapEightMapper.listAllMeasuresHOTWORK(pd)); + map.put("gasList", mapEightMapper.listAllHOTWORK(pd)); + } else if (StringUtils.equals(typeStr, "ELECTRICITY")) { + pd.put("ELECTRICITY_ID", idStr); + pd = mapEightMapper.findByIdELECTRICITYOrder(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresELECTRICITYOrder(pd)); + map.put("gasList", mapEightMapper.listAllGasELECTRICTITYOrder(pd)); + map.put("imgList1", mapEightMapper.findByELECTRICTITYAcceptuserId(pd)); + map.put("imgList", mapEightMapper.findByELECTRICTITYAcceptuserIds(pd)); + } else if (StringUtils.equals(typeStr, "BLINDBOARD")) { + pd.put("BLINDBOARD_ID", idStr); + pd = mapEightMapper.findByIdBLINDBOARDOrder(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresBLINDBOARDOrder(pd)); + PageData Info = mapEightMapper.findByIdJWDOrder(pd); + pd.put("TYPE", 105);//盲板位置图 + pd.put("FOREIGN_KEY", pd.getString("BLINDBOARD_ID")); + List ImgList = mapEightMapper.listAllBLINDBOARD(pd); + map.put("Info", Info);//获取经纬度 + map.put("ImgList", ImgList); + map.put("imgList1", mapEightMapper.findByBLINDBOARDAcceptuserId(pd)); + map.put("imgList", mapEightMapper.findByBLINDBOARDAcceptuserIds(pd)); + } else if (StringUtils.equals(typeStr, "HIGHWORK")) { + pd.put("HIGHWORK_ID", idStr); + pd = mapEightMapper.findByIdHIGHWORKOrder(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresHIGHWORKOrder(pd)); + map.put("imgList1", mapEightMapper.findByHIGHWORKAcceptuserId(pd)); + map.put("imgList", mapEightMapper.findByHIGHWORKAcceptuserIds(pd)); + } else if (StringUtils.equals(typeStr, "CONFINEDSPACE")) { + pd.put("CONFINEDSPACE_ID", idStr); + pd = mapEightMapper.findByIdCONFINEDSPACEOrder(pd); //根据ID读取 + map.put("measuresList", mapEightMapper.listAllMeasuresCONFINEDSPACEOrder(pd)); + map.put("gasList", mapEightMapper.listAllCONFINEDSPACEOrder(pd)); + map.put("gas", mapEightMapper.findByIdCONFINEDSPACEGasWH(pd)); + map.put("imgList", mapEightMapper.findByIdCONFINEDSPACEAcceptusers(pd)); + map.put("imgList1", mapEightMapper.findByIdCONFINEDSPACEAcceptuser(pd)); + } else if (StringUtils.equals(typeStr, "HOISTING")) { + pd.put("HOISTING_ID", idStr); + pd = mapEightMapper.findByIdHOISTINGOrder(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresHOISTINGOrder(pd)); + map.put("imgList1", mapEightMapper.findByHOISTINGAcceptuserId(pd)); + map.put("imgList", mapEightMapper.findByHOISTINGAcceptuserIds(pd)); + } else if (StringUtils.equals(typeStr, "BREAKGROUND")) { + pd.put("BREAKGROUND_ID", idStr); + pd = mapEightMapper.findByIdBREAKGROUNDOrder(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresBREAKGROUNDOrder(pd)); + map.put("imgList1", mapEightMapper.findByBREAKGROUNDAcceptuserId(pd)); + map.put("imgList", mapEightMapper.findByBREAKGROUNDAcceptuserIds(pd)); + } else if (StringUtils.equals(typeStr, "CUTROAD")) { + pd.put("CUTROAD_ID", idStr); + pd = mapEightMapper.findByIdCUTROADOrder(pd); + map.put("measuresList", mapEightMapper.listAllMeasuresCUTROADOrder(pd)); + map.put("imgList1", mapEightMapper.findByCUTROADAcceptuserId(pd)); + map.put("imgList", mapEightMapper.findByCUTROADAcceptuserIds(pd)); + } + map.put("pd", pd); + map.put("result", errInfo); + return map; + } + + private PageData shenpi(PageData pd, List list) { + List specialUserList = new ArrayList<>(); + for (PageData userPageData : list) { + String type = userPageData.get("STATE").toString(); + if ("0".equals(type)) { // 申请办理人 + pd.put("APPLY_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("APPLY_USER_NAME", userPageData.getString("userName")); + pd.put("APPLY_USER_ID", userPageData.getString("USER_ID")); + } else if ("1".equals(type)) { // 动火单位确认人 + pd.put("HOT_WORK_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("HOT_WORK_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("HOT_WORK_USER_ID", userPageData.getString("USER_ID")); + pd.put("HOT_WORK_USER_NAME", userPageData.getString("userName")); + pd.put("HOT_WORK_USER_PHONE", userPageData.getString("userPhone")); + pd.put("HOT_WORK_USER_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("HOT_WORK_USER_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("2".equals(type)) { // 项目发包单位 + pd.put("PROJECT_UNIT_LEADER_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("PROJECT_UNIT_LEADER_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("PROJECT_UNIT_LEADER_ID", userPageData.getString("USER_ID")); + pd.put("PROJECT_UNIT_LEADER_NAME", userPageData.getString("userName")); + pd.put("PROJECT_UNIT_LEADER_PHONE", userPageData.getString("userPhone")); + pd.put("PROJECT_UNIT_LEADER_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("PROJECT_UNIT_LEADER_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("3".equals(type)) { // 现场管辖单位负责人 + pd.put("UNIT_LEADER_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("UNIT_LEADER_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("UNIT_LEADER_ID", userPageData.getString("USER_ID")); + pd.put("UNIT_LEADER_NAME", userPageData.getString("userName")); + pd.put("UNIT_LEADER_PHONE", userPageData.getString("userPhone")); + pd.put("UNIT_LEADER_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("UNIT_LEADER_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("4".equals(type)) { //动火许可签发单位负责人 + pd.put("ISSUING_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("ISSUING_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("ISSUING_USER_ID", userPageData.getString("USER_ID")); + pd.put("ISSUING_USER_NAME", userPageData.getString("userName")); + pd.put("ISSUING_USER_PHONE", userPageData.getString("userPhone")); + pd.put("ISSUING_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("ISSUING_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("5".equals(type)) { // 安全总监审批 + pd.put("SAFETY_DIRECTOR_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("SAFETY_DIRECTOR_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("SAFETY_DIRECTOR_USER_ID", userPageData.getString("USER_ID")); + pd.put("SAFETY_DIRECTOR_USER_NAME", userPageData.getString("userName")); + pd.put("SAFETY_DIRECTOR_PHONE", userPageData.getString("userPhone")); + pd.put("SAFETY_DIRECTOR_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("SAFETY_DIRECTOR_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("6".equals(type)) { // 现场负责人接收 + pd.put("SITE_LEADER_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("SITE_LEADER_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("SITE_LEADER_ID", userPageData.getString("USER_ID")); + pd.put("SITE_LEADER_NAME", userPageData.getString("userName")); + pd.put("SITE_LEADER_PHONE", userPageData.getString("userPhone")); + pd.put("SITE_DIRECTOR_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("SITE_DIRECTOR_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("7".equals(type)) { // 动火前 + pd.put("HOT_WORK_PERSON_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("HOT_WORK_PERSON_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("HOT_WORK_PERSON_USER_NAME", userPageData.getString("userName")); + pd.put("HOT_WORK_PERSON_PHONE", userPageData.getString("userPhone")); + pd.put("HOT_WORK_PERSON_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("HOT_WORK_PERSON_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("8".equals(type)) { // 现在负责人 + pd.put("PERSON_CONFIRM_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("PERSON_CONFIRM_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("PERSON_CONFIRM_USER_NAME", userPageData.getString("userName")); + pd.put("PERSON_CONFIRM_PHONE", userPageData.getString("userPhone")); + pd.put("PERSON_CONFIRM_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("PERSON_CONFIRM_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("9".equals(type)) { // 动火后 + pd.put("HOT_WORK_AFTER_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("HOT_WORK_AFTER_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("HOT_WORK_AFTER_USER_NAME", userPageData.getString("userName")); + pd.put("HOT_WORK_AFTER_PHONE", userPageData.getString("userPhone")); + pd.put("HOT_WORK_AFTER_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("HOT_WORK_AFTER_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("10".equals(type)) { // 延时监火 + pd.put("TIME_LAPSE_FIREMAN_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("TIME_LAPSE_FIREMAN_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("TIME_LAPSE_FIREMAN_NAME", userPageData.getString("userName")); + pd.put("TIME_LAPSE_FIREMAN_PHONE", userPageData.getString("userPhone")); + pd.put("TIME_LAPSE_FIREMAN_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("TIME_LAPSE_FIREMAN_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("21".equals(type)) { // 动火操作人 + String userName = userPageData.getString("userName2") + ","; + String oldName = Tools.isEmpty(pd.get("HOT_WORK_OPERATOR_NAME")) ? "" : pd.get("HOT_WORK_OPERATOR_NAME").toString(); + pd.put("HOT_WORK_OPERATOR_NAME", oldName + userName); + } else if ("22".equals(type)) { // 动火操作人 + pd.put("SUPERVISOR_OF_HOT_WORK_UNIT", userPageData.getString("USER_ID")); + String userName = userPageData.getString("userName2") + ","; + String oldName = Tools.isEmpty(pd.get("HOT_WORK_OPERATOR_NAME")) ? "" : pd.get("HOT_WORK_OPERATOR_NAME").toString(); + pd.put("SUPERVISOR_OF_HOT_WORK_UNIT_NAME", oldName + userName); + } else if ("24".equals(type)) { // 需要气体检测 + pd.put("GAS_TESTING_DEPARTMENT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("GAS_TESTING_DEPARTMENT_NAME", userPageData.getString("deptName")); + pd.put("GAS_TESTING_USER_ID", userPageData.getString("USER_ID")); + pd.put("GAS_TESTING_USER_NAME", userPageData.getString("userName")); + pd.put("GAS_TESTING_USER_PHONE", userPageData.getString("userPhone")); + pd.put("GAS_TESTING_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("GAS_TESTING_PRINCIPAL_TIME", userPageData.getString("OPERATTIME")); + } else if ("30".equals(type)) { // 特级动火 动火负责人确认 + pd.put("projectCompetent_DEPT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("projectCompetent_DEPT_NAME", userPageData.getString("deptName")); + pd.put("projectCompetent_USER_NAME", userPageData.getString("userName")); + pd.put("projectCompetent_USER_ID", userPageData.getString("USER_ID")); + pd.put("projectCompetent_PHONE", userPageData.getString("userPhone")); + pd.put("projectCompetent_OPERATTIME", userPageData.getString("OPERATTIME")); + pd.put("projectCompetent_TYPE", userPageData.getString("TYPE")); + // APP回显使用 + + pd.put("CHARGECONFIRM_DEPT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("CHARGECONFIRM_DEPT_NAME", userPageData.getString("deptName")); + pd.put("CHARGECONFIRM_USER_ID", userPageData.getString("USER_ID")); + pd.put("CHARGECONFIRM_USER_NAME", userPageData.getString("userName")); + pd.put("CHARGECONFIRM_USER_PHONE", userPageData.getString("userPhone")); + } else if ("31".equals(type)) { // 特级动火 动火负责人确认 + pd.put("projectSupervisor_DEPT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("projectSupervisor_DEPT_NAME", userPageData.getString("deptName")); + pd.put("projectSupervisor_USER_NAME", userPageData.getString("userName")); + pd.put("projectSupervisor_PHONE", userPageData.getString("userPhone")); + pd.put("projectCompetent_OPERATTIME", userPageData.getString("OPERATTIME")); + pd.put("projectSupervisor_TYPE", userPageData.getString("TYPE")); + } else if ("32".equals(type)) { // 特级动火 动火负责人确认 + pd.put("projectPreliminarily_DEPT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("projectPreliminarily_DEPT_NAME", userPageData.getString("deptName")); + pd.put("projectPreliminarily_USER_NAME", userPageData.getString("userName")); + pd.put("projectPreliminarily_PHONE", userPageData.getString("userPhone")); + pd.put("projectPreliminarily_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("projectPreliminarily_OPERATTIME", userPageData.getString("OPERATTIME")); + pd.put("projectPreliminarily_TYPE", userPageData.getString("TYPE")); + } else if ("33".equals(type)) { // 特级动火 动火负责人确认 + pd.put("inspectorGeneral_DEPT_ID", userPageData.getString("DEPARTMENT_ID")); + pd.put("inspectorGeneral_DEPT_NAME", userPageData.getString("deptName")); + pd.put("inspectorGeneral_USER_NAME", userPageData.getString("userName")); + pd.put("inspectorGeneral_PHONE", userPageData.getString("userPhone")); + pd.put("inspectorGeneral_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("inspectorGeneral_OPERATTIME", userPageData.getString("OPERATTIME")); + pd.put("inspectorGeneral_TYPE", userPageData.getString("TYPE")); + } else if ("34".equals(type)) { //分公司主要负责人 + pd.put("OFFICE_RESPOMSIBLE_DEPT_NAME", userPageData.getString("REGULATORY_DEPT_NAME")); + pd.put("OFFICE_RESPOMSIBLE_USER_NAME", userPageData.getString("REGULATORY_USER_NAME")); + pd.put("OFFICE_RESPOMSIBLE_PHONE", userPageData.getString("userPhone")); + pd.put("OFFICE_RESPOMSIBLE_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("OFFICE_RESPOMSIBLE_OPERATTIME", userPageData.getString("OPERATTIME")); + pd.put("OFFICE_RESPOMSIBLE_TYPE", userPageData.getString("TYPE")); + } else if ("35".equals(type)) { // 特级动火 安全监督部初审 + pd.put("SUPERVISION_DEPARTMENT_DEPT_NAME", userPageData.getString("REGULATORY_DEPT_NAME")); + pd.put("SUPERVISION_DEPARTMENT_USER_NAME", userPageData.getString("REGULATORY_USER_NAME")); + pd.put("SUPERVISION_DEPARTMENT_PHONE", userPageData.getString("userPhone")); + pd.put("SUPERVISION_DEPARTMENT_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("SUPERVISION_DEPARTMENT_OPERATTIME", userPageData.getString("OPERATTIME")); + pd.put("SUPERVISION_DEPARTMENT_TYPE", userPageData.getString("TYPE")); + } else if ("36".equals(type)) { // 特级动火 安委会办公室审批 + pd.put("SECURITY_COMMITTEE_DEPT_NAME", userPageData.getString("REGULATORY_DEPT_NAME")); + pd.put("SECURITY_COMMITTEE_USER_NAME", userPageData.getString("REGULATORY_USER_NAME")); + pd.put("SECURITY_COMMITTEE_PHONE", userPageData.getString("userPhone")); + pd.put("SECURITY_COMMITTEE_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("SECURITY_COMMITTEE_OPERATTIME", userPageData.getString("OPERATTIME")); + pd.put("SECURITY_COMMITTEE_TYPE", userPageData.getString("TYPE")); + } else if ("37".equals(type)) { // 特级动火 安全总监签批 + pd.put("SAFETY_DIRECTOR_DEPT_NAME", userPageData.getString("REGULATORY_DEPT_NAME")); + pd.put("SAFETY_DIRECTOR_USER_NAME", userPageData.getString("REGULATORY_USER_NAME")); + pd.put("SAFETY_DIRECTOR_PHONE", userPageData.getString("userPhone")); + pd.put("SAFETY_DIRECTOR_PRINCIPAL", userPageData.getString("AUTOGRAPH")); + pd.put("SAFETY_DIRECTOR_OPERATTIME", userPageData.getString("OPERATTIME")); + pd.put("SAFETY_DIRECTOR_TYPE", userPageData.getString("TYPE")); + } + } + pd.put("specialUserList", specialUserList); + return pd; + } + + private PageData dianhuo(PageData pd) { + if (StringUtils.isBlank(pd.getString("HOT_WORK_METHOD_NAME"))) { + String zidian = pd.getString("HOT_WORK_METHOD_ID"); + List shuzu = Arrays.asList(zidian.split(",")); + List wenzi = mapEightMapper.getListDongHuo(shuzu); + String pinjie = String.join(",", wenzi); + pd.put("HOT_WORK_METHOD_NAME", pinjie); + } + return pd; + } +} + diff --git a/src/main/java/com/zcloud/service/video/VideoManagerService.java b/src/main/java/com/zcloud/service/video/VideoManagerService.java index ae74d83..b111640 100644 --- a/src/main/java/com/zcloud/service/video/VideoManagerService.java +++ b/src/main/java/com/zcloud/service/video/VideoManagerService.java @@ -4,6 +4,7 @@ import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import java.util.List; +import java.util.Map; /** * 说明:视频管理 @@ -66,5 +67,13 @@ public interface VideoManagerService { public void deleteAll(String[] ArrayDATA_IDS)throws Exception; PageData findByCode(PageData videoPd); + + List getCameraAlarmCount(PageData pageData); + + List getCameraAlarmTypeCount(PageData pageData); + + PageData getCameraAlarmTimeCount(PageData pageData); + + PageData getCameraTopToShow(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/video/impl/VideoManagerServiceImpl.java b/src/main/java/com/zcloud/service/video/impl/VideoManagerServiceImpl.java index b059111..dc30044 100644 --- a/src/main/java/com/zcloud/service/video/impl/VideoManagerServiceImpl.java +++ b/src/main/java/com/zcloud/service/video/impl/VideoManagerServiceImpl.java @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.List; /** @@ -99,5 +100,43 @@ public class VideoManagerServiceImpl implements VideoManagerService { return videomanagerMapper.findByCode(videoPd); } + @Override + public List getCameraAlarmCount(PageData pageData) { + return videomanagerMapper.getCameraAlarmCount(pageData); + } + + @Override + public List getCameraAlarmTypeCount(PageData pageData) { + return videomanagerMapper.getCameraAlarmTypeCount(pageData); + } + + @Override + public PageData getCameraAlarmTimeCount(PageData pageData) { + List cameraAlarmTimeCount = videomanagerMapper.getCameraAlarmTimeCount(pageData); + int leijicont = 0; + // 月份集合 + List monthStrList = new ArrayList<>(); + // 当月数据 + List monthList = new ArrayList<>(); + // 累计数据 + List accumulatedList = new ArrayList<>(); + for (PageData item : cameraAlarmTimeCount) { + monthStrList.add(item.getString("MONTH")); + monthList.add(Integer.parseInt(item.getString("MONTH_COUNT"))); + leijicont += Integer.parseInt(item.getString("MONTH_COUNT")); + accumulatedList.add(leijicont); + } + PageData valuePd = new PageData(); + valuePd.put("monthStrList",monthStrList); + valuePd.put("monthList",monthList); + valuePd.put("accumulatedList",accumulatedList); + return valuePd; + } + + @Override + public PageData getCameraTopToShow(PageData pageData) { + return videomanagerMapper.getCameraTopToShow(pageData); + } + } diff --git a/src/main/java/com/zcloud/util/DateUtil.java b/src/main/java/com/zcloud/util/DateUtil.java index f0d3321..6153fe1 100644 --- a/src/main/java/com/zcloud/util/DateUtil.java +++ b/src/main/java/com/zcloud/util/DateUtil.java @@ -3,10 +3,7 @@ package com.zcloud.util; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; +import java.util.*; /** * 说明:日期处理 @@ -15,782 +12,864 @@ import java.util.List; */ public class DateUtil { - private final static SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy"); - private final static SimpleDateFormat sdfMonth = new SimpleDateFormat("MM"); - private final static SimpleDateFormat sdfOnlyDay = new SimpleDateFormat("dd"); - private final static SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd"); - private final static SimpleDateFormat sdfMDay = new SimpleDateFormat("yyyy-M-d"); - private final static SimpleDateFormat sdfDays = new SimpleDateFormat("yyyyMMdd"); - private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - private final static SimpleDateFormat sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss"); + private final static SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy"); + private final static SimpleDateFormat sdfMonth = new SimpleDateFormat("MM"); + private final static SimpleDateFormat sdfOnlyDay = new SimpleDateFormat("dd"); + private final static SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd"); + private final static SimpleDateFormat sdfMDay = new SimpleDateFormat("yyyy-M-d"); + private final static SimpleDateFormat sdfDays = new SimpleDateFormat("yyyyMMdd"); + private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + private final static SimpleDateFormat sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss"); - /** - * 获取YYYY格式 - * @return - */ - public static String getSdfTimes() { - return sdfTimes.format(new Date()); - } + /** + * 获取YYYY格式 + * + * @return + */ + public static String getSdfTimes() { + return sdfTimes.format(new Date()); + } - /** - * 获取YYYY格式 - * @return - */ - public static String getYear() { - return sdfYear.format(new Date()); - } - public static String getYear(Date date) { - return sdfYear.format(date); - } - public static String getMonth() { - return sdfMonth.format(new Date()); - } + /** + * 获取YYYY格式 + * + * @return + */ + public static String getYear() { + return sdfYear.format(new Date()); + } - /** - * 获取DD格式 - * @return - */ - public static String getOnlyDay() { - return sdfOnlyDay.format(new Date()); - } + public static String getYear(Date date) { + return sdfYear.format(date); + } - /** - * 获取YYYY-MM-DD格式 - * @return - */ - public static String getDay() { - return sdfDay.format(new Date()); - } - public static String MDay() { - return sdfMDay.format(new Date()); - } + public static String getMonth() { + return sdfMonth.format(new Date()); + } - /** - * 获取YYYYMMDD格式 - * @return - */ - public static String getDays(){ - return sdfDays.format(new Date()); - } + /** + * 获取DD格式 + * + * @return + */ + public static String getOnlyDay() { + return sdfOnlyDay.format(new Date()); + } - /** - * 获取YYYY-MM-DD HH:mm:ss格式 - * @return - */ - public static String getTime() { - return sdfTime.format(new Date()); - } + /** + * 获取YYYY-MM-DD格式 + * + * @return + */ + public static String getDay() { + return sdfDay.format(new Date()); + } - /** - * @Title: compareDate - * @Description: TODO(日期比较,如果s>=e 返回true 否则返回false) - * @param s - * @param e - * @return boolean - * @throws - * @author fh - */ - public static boolean compareDate(String s, String e) { - if(fomatDate(s)==null||fomatDate(e)==null){ - return false; - } - return fomatDate(s).getTime() >=fomatDate(e).getTime(); - } + public static String MDay() { + return sdfMDay.format(new Date()); + } - /** - * 格式化日期 - * @return - */ - public static Date fomatDate(String date) { - DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); - try { - return fmt.parse(date); - } catch (ParseException e) { - e.printStackTrace(); - return null; - } - } + /** + * 获取YYYYMMDD格式 + * + * @return + */ + public static String getDays() { + return sdfDays.format(new Date()); + } - /** - * 格式化日期 - * @return - */ - public static Date fomatDateTime(String date) { - DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - try { - return fmt.parse(date); - } catch (ParseException e) { - e.printStackTrace(); - return null; - } - } + /** + * 获取YYYY-MM-DD HH:mm:ss格式 + * + * @return + */ + public static String getTime() { + return sdfTime.format(new Date()); + } - /** - * 校验日期是否合法 - * @return - */ - public static boolean isValidDate(String s) { - DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); - try { - fmt.parse(s); - return true; - } catch (Exception e) { - return false; // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 - } - } + /** + * @param s + * @param e + * @return boolean + * @throws + * @Title: compareDate + * @Description: TODO(日期比较 , 如果s > = e 返回true 否则返回false) + * @author fh + */ + public static boolean compareDate(String s, String e) { + if (fomatDate(s) == null || fomatDate(e) == null) { + return false; + } + return fomatDate(s).getTime() >= fomatDate(e).getTime(); + } - /** - * @param startTime - * @param endTime - * @return - */ - public static int getDiffYear(String startTime,String endTime) { - DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); - try { - int years=(int) (((fmt.parse(endTime).getTime()-fmt.parse(startTime).getTime())/ (1000 * 60 * 60 * 24))/365); - return years; - } catch (Exception e) { - return 0; // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 - } - } + /** + * 格式化日期 + * + * @return + */ + public static Date fomatDate(String date) { + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + try { + return fmt.parse(date); + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } - /** - *
  • 功能描述:时间相减得到天数 - * @param beginDateStr - * @param endDateStr - * @return - * long - * @author Administrator - */ - public static long getDaySub(String beginDateStr,String endDateStr){ - long day=0; - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - Date beginDate = null; - Date endDate = null; - try { - beginDate = format.parse(beginDateStr); - endDate= format.parse(endDateStr); - } catch (ParseException e) { - e.printStackTrace(); - } - day=(endDate.getTime()-beginDate.getTime())/(24*60*60*1000); - //System.out.println("相隔的天数="+day); - return day; - } + /** + * 格式化日期 + * + * @return + */ + public static Date fomatDateTime(String date) { + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + return fmt.parse(date); + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } - /** - * 得到n天之后的日期 - * @param days - * @return - */ - public static String getAfterDayDate(String days) { - int daysInt = Integer.parseInt(days); - Calendar canlendar = Calendar.getInstance(); // java.util包 - canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 - Date date = canlendar.getTime(); - SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String dateStr = sdfd.format(date); - return dateStr; - } + /** + * 校验日期是否合法 + * + * @return + */ + public static boolean isValidDate(String s) { + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + try { + fmt.parse(s); + return true; + } catch (Exception e) { + return false; // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 + } + } - /** - * 当前时间加n小时之后的时间 - * @param days - * @return - */ - public static String getAfterHourDate(String hours) { - int hoursInt = Integer.parseInt(hours); - Calendar canlendar = Calendar.getInstance(); // java.util包 - canlendar.add(Calendar.HOUR, hoursInt); // 日期减 如果不够减会将月变动 - Date date = canlendar.getTime(); - SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String dateStr = sdfd.format(date); - return dateStr; - } + /** + * @param startTime + * @param endTime + * @return + */ + public static int getDiffYear(String startTime, String endTime) { + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + try { + int years = (int) (((fmt.parse(endTime).getTime() - fmt.parse(startTime).getTime()) / (1000 * 60 * 60 * 24)) / 365); + return years; + } catch (Exception e) { + return 0; // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 + } + } - /** - * 得到n天之后是周几 - * @param days - * @return - */ - public static String getAfterDayWeek(String days) { - int daysInt = Integer.parseInt(days); - Calendar canlendar = Calendar.getInstance(); // java.util包 - canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 - Date date = canlendar.getTime(); - SimpleDateFormat sdf = new SimpleDateFormat("E"); - String dateStr = sdf.format(date); - return dateStr; - } + /** + *
  • 功能描述:时间相减得到天数 + * + * @param beginDateStr + * @param endDateStr + * @return long + * @author Administrator + */ + public static long getDaySub(String beginDateStr, String endDateStr) { + long day = 0; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Date beginDate = null; + Date endDate = null; + try { + beginDate = format.parse(beginDateStr); + endDate = format.parse(endDateStr); + } catch (ParseException e) { + e.printStackTrace(); + } + day = (endDate.getTime() - beginDate.getTime()) / (24 * 60 * 60 * 1000); + //System.out.println("相隔的天数="+day); + return day; + } - /** - * 按照yyyy-MM-dd HH:mm:ss的格式,日期转字符串 - * @param date - * @return yyyy-MM-dd HH:mm:ss - */ - public static String date2Str(Date date){ - return date2Str(date,"yyyy-MM-dd HH:mm:ss"); - } - public static String date3Str(Date date){ - return date2Str(date,"yyyy-M-d"); - } + /** + * 得到n天之后的日期 + * + * @param days + * @return + */ + public static String getAfterDayDate(String days) { + int daysInt = Integer.parseInt(days); + Calendar canlendar = Calendar.getInstance(); // java.util包 + canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 + Date date = canlendar.getTime(); + SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateStr = sdfd.format(date); + return dateStr; + } - /** - * 按照yyyy-MM-dd HH:mm:ss的格式,字符串转日期 - * @param date - * @return - */ - public static Date str2Date(String date){ - if(Tools.notEmpty(date)){ - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - try { - return sdf.parse(date); - } catch (ParseException e) { - e.printStackTrace(); - } - return new Date(); - }else{ - return null; - } - } + /** + * 当前时间加n小时之后的时间 + * + * @param days + * @return + */ + public static String getAfterHourDate(String hours) { + int hoursInt = Integer.parseInt(hours); + Calendar canlendar = Calendar.getInstance(); // java.util包 + canlendar.add(Calendar.HOUR, hoursInt); // 日期减 如果不够减会将月变动 + Date date = canlendar.getTime(); + SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateStr = sdfd.format(date); + return dateStr; + } - /** - * 把时间根据时、分、秒转换为时间段 - * @param StrDate - */ - public static String getTimes(String StrDate){ - String resultTimes = ""; - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Date now; - try { - now = new Date(); - Date date=df.parse(StrDate); - long times = now.getTime()-date.getTime(); - long day = times/(24*60*60*1000); - long hour = (times/(60*60*1000)-day*24); - long min = ((times/(60*1000))-day*24*60-hour*60); - long sec = (times/1000-day*24*60*60-hour*60*60-min*60); + /** + * 得到n天之后是周几 + * + * @param days + * @return + */ + public static String getAfterDayWeek(String days) { + int daysInt = Integer.parseInt(days); + Calendar canlendar = Calendar.getInstance(); // java.util包 + canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 + Date date = canlendar.getTime(); + SimpleDateFormat sdf = new SimpleDateFormat("E"); + String dateStr = sdf.format(date); + return dateStr; + } - StringBuffer sb = new StringBuffer(); - //sb.append("发表于:"); - if(hour>0 ){ - sb.append(hour+"小时前"); - } else if(min>0){ - sb.append(min+"分钟前"); - } else{ - sb.append(sec+"秒前"); - } - resultTimes = sb.toString(); - } catch (ParseException e) { - e.printStackTrace(); - } - return resultTimes; - } + /** + * 按照yyyy-MM-dd HH:mm:ss的格式,日期转字符串 + * + * @param date + * @return yyyy-MM-dd HH:mm:ss + */ + public static String date2Str(Date date) { + return date2Str(date, "yyyy-MM-dd HH:mm:ss"); + } - /** - * 按照参数format的格式,日期转字符串 - * @param date - * @param format - * @return - */ - public static String date2Str(Date date,String format){ - if(date!=null){ - SimpleDateFormat sdf = new SimpleDateFormat(format); - return sdf.format(date); - }else{ - return ""; - } - } + public static String date3Str(Date date) { + return date2Str(date, "yyyy-M-d"); + } - /** - * 获取当年的第一天 - * @param year - * @author zhangyue - * @return - */ - public static String getCurrYearFirst(){ - Calendar currCal=Calendar.getInstance(); - int currentYear = currCal.get(Calendar.YEAR); - Calendar calendar = Calendar.getInstance(); - calendar.clear(); - calendar.set(Calendar.YEAR, currentYear); - Date currYearFirst = calendar.getTime(); - return sdfDay.format(currYearFirst); - } + /** + * 按照yyyy-MM-dd HH:mm:ss的格式,字符串转日期 + * + * @param date + * @return + */ + public static Date str2Date(String date) { + if (Tools.notEmpty(date)) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + return sdf.parse(date); + } catch (ParseException e) { + e.printStackTrace(); + } + return new Date(); + } else { + return null; + } + } - /** - * 获取当年的最后一天 - * @param year - * @author zhangyue - * @return - */ - public static String getCurrYearLast(){ - Calendar currCal=Calendar.getInstance(); - int currentYear = currCal.get(Calendar.YEAR); - Calendar calendar = Calendar.getInstance(); - calendar.clear(); - calendar.set(Calendar.YEAR, currentYear); - calendar.roll(Calendar.DAY_OF_YEAR, -1); - Date currYearLast = calendar.getTime(); - return sdfDay.format(currYearLast); - } + /** + * 把时间根据时、分、秒转换为时间段 + * + * @param StrDate + */ + public static String getTimes(String StrDate) { + String resultTimes = ""; + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date now; + try { + now = new Date(); + Date date = df.parse(StrDate); + long times = now.getTime() - date.getTime(); + long day = times / (24 * 60 * 60 * 1000); + long hour = (times / (60 * 60 * 1000) - day * 24); + long min = ((times / (60 * 1000)) - day * 24 * 60 - hour * 60); + long sec = (times / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60); + + StringBuffer sb = new StringBuffer(); + //sb.append("发表于:"); + if (hour > 0) { + sb.append(hour + "小时前"); + } else if (min > 0) { + sb.append(min + "分钟前"); + } else { + sb.append(sec + "秒前"); + } + resultTimes = sb.toString(); + } catch (ParseException e) { + e.printStackTrace(); + } + return resultTimes; + } + + /** + * 按照参数format的格式,日期转字符串 + * + * @param date + * @param format + * @return + */ + public static String date2Str(Date date, String format) { + if (date != null) { + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(date); + } else { + return ""; + } + } + + /** + * 获取当年的第一天 + * + * @param year + * @return + * @author zhangyue + */ + public static String getCurrYearFirst() { + Calendar currCal = Calendar.getInstance(); + int currentYear = currCal.get(Calendar.YEAR); + Calendar calendar = Calendar.getInstance(); + calendar.clear(); + calendar.set(Calendar.YEAR, currentYear); + Date currYearFirst = calendar.getTime(); + return sdfDay.format(currYearFirst); + } + + /** + * 获取当年的最后一天 + * + * @param year + * @return + * @author zhangyue + */ + public static String getCurrYearLast() { + Calendar currCal = Calendar.getInstance(); + int currentYear = currCal.get(Calendar.YEAR); + Calendar calendar = Calendar.getInstance(); + calendar.clear(); + calendar.set(Calendar.YEAR, currentYear); + calendar.roll(Calendar.DAY_OF_YEAR, -1); + Date currYearLast = calendar.getTime(); + return sdfDay.format(currYearLast); + } + /** + * 获取当前季度第一天 + * + * @return + * @author zhangyue + */ + public static String quarterStart() { + Date dBegin = new Date(); + Calendar calBegin = Calendar.getInstance(); + calBegin.setTime(dBegin); + int remainder = calBegin.get(Calendar.MONTH) % 3; + int month = remainder != 0 ? calBegin.get(Calendar.MONTH) - remainder : calBegin.get(Calendar.MONTH); - /** - * 获取当前季度第一天 - * @author zhangyue - * @return - */ - public static String quarterStart() { - Date dBegin = new Date(); - Calendar calBegin = Calendar.getInstance(); - calBegin.setTime(dBegin); - int remainder = calBegin.get(Calendar.MONTH) % 3; - int month = remainder != 0 ? calBegin.get(Calendar.MONTH) - remainder: calBegin.get(Calendar.MONTH); + calBegin.set(Calendar.MONTH, month); + calBegin.set(Calendar.DAY_OF_MONTH, calBegin.getActualMinimum(Calendar.DAY_OF_MONTH)); - calBegin.set(Calendar.MONTH, month); - calBegin.set(Calendar.DAY_OF_MONTH, calBegin.getActualMinimum(Calendar.DAY_OF_MONTH)); + calBegin.setTime(calBegin.getTime()); + return sdfDay.format(calBegin.getTime()); + } - calBegin.setTime(calBegin.getTime()); - return sdfDay.format(calBegin.getTime()); - } + /** + * 获取当前季度最后一天 + * + * @return + * @author zhangyue + */ + public static String quarterEnd() { + Date dEnd = new Date(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(dEnd); + int remainder = (calendar.get(Calendar.MONTH) + 1) % 3; + int month = remainder != 0 ? calendar.get(Calendar.MONTH) + (3 - remainder) : calendar.get(Calendar.MONTH); + calendar.set(Calendar.MONTH, month); + calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); + calendar.setTime(calendar.getTime()); + return sdfDay.format(calendar.getTime()); + } - /** - * 获取当前季度最后一天 - * @author zhangyue - * @return - */ - public static String quarterEnd() { - Date dEnd = new Date(); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(dEnd); - int remainder = (calendar.get(Calendar.MONTH) + 1) % 3; - int month = remainder != 0 ? calendar.get(Calendar.MONTH) + (3 - remainder) : calendar.get(Calendar.MONTH); - calendar.set(Calendar.MONTH, month); - calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); - calendar.setTime(calendar.getTime()); - return sdfDay.format(calendar.getTime()); - } + /** + * 获取本月第一天日期 + * + * @return + */ + public static String getMonthFirstDay() { + Calendar thisMonthFirstDateCal = Calendar.getInstance(); + thisMonthFirstDateCal.set(Calendar.DAY_OF_MONTH, 1); + String thisMonthFirstTime = sdfDay.format(thisMonthFirstDateCal.getTime()); + return thisMonthFirstTime; + } - /** - * 获取本月第一天日期 - * @return - */ - public static String getMonthFirstDay() { - Calendar thisMonthFirstDateCal = Calendar.getInstance(); - thisMonthFirstDateCal.set(Calendar.DAY_OF_MONTH, 1); - String thisMonthFirstTime = sdfDay.format(thisMonthFirstDateCal.getTime()); - return thisMonthFirstTime; - } + /** + * 获取本月最后一天日期 + * + * @return + */ + public static String getMonthEndDay() { + Calendar thisMonthEndDateCal = Calendar.getInstance(); + thisMonthEndDateCal.set(Calendar.DAY_OF_MONTH, thisMonthEndDateCal.getActualMaximum(Calendar.DAY_OF_MONTH)); + String thisMonthEndTime = sdfDay.format(thisMonthEndDateCal.getTime()); + return thisMonthEndTime; + } - /** - * 获取本月最后一天日期 - * @return - */ - public static String getMonthEndDay() { - Calendar thisMonthEndDateCal = Calendar.getInstance(); - thisMonthEndDateCal.set(Calendar.DAY_OF_MONTH, thisMonthEndDateCal.getActualMaximum(Calendar.DAY_OF_MONTH)); - String thisMonthEndTime = sdfDay.format(thisMonthEndDateCal.getTime()); - return thisMonthEndTime; - } - public static boolean timeCalendar(Date nowTime, Date amBeginTime, Date amEndTime) { - //设置当前时间 - Calendar date = Calendar.getInstance(); - date.setTime(nowTime); - //设置开始时间 - Calendar amBegin = Calendar.getInstance(); - amBegin.setTime(amBeginTime);//上午开始时间 - //设置结束时间 - Calendar amEnd = Calendar.getInstance(); - amEnd.setTime(amEndTime);//上午结束时间 - //处于开始时间之后,和结束时间之前的判断 - if ((date.after(amBegin) && date.before(amEnd))) { - return true; - } else { - return false; - } - } + public static boolean timeCalendar(Date nowTime, Date amBeginTime, Date amEndTime) { + //设置当前时间 + Calendar date = Calendar.getInstance(); + date.setTime(nowTime); + //设置开始时间 + Calendar amBegin = Calendar.getInstance(); + amBegin.setTime(amBeginTime);//上午开始时间 + //设置结束时间 + Calendar amEnd = Calendar.getInstance(); + amEnd.setTime(amEndTime);//上午结束时间 + //处于开始时间之后,和结束时间之前的判断 + if ((date.after(amBegin) && date.before(amEnd))) { + return true; + } else { + return false; + } + } - /** - * 获取本周的第一天 - * @return String - * **/ - public static String getWeekStart(){ + /** + * 获取本周的第一天 + * + * @return String + **/ + public static String getWeekStart() { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 设置时间格式 - Calendar cal = Calendar.getInstance(); - // Calendar c = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_MONTH, 0); - // cal.setTime(time); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 设置时间格式 + Calendar cal = Calendar.getInstance(); + // Calendar c = Calendar.getInstance(); + cal.add(Calendar.DAY_OF_MONTH, 0); + // cal.setTime(time); - // 判断要计算的日期是否是周日,如果是则减一天计算周六的,否则会出问题,计算到下一周去了 - int dayWeek = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天 - if (1 == dayWeek) { - cal.add(Calendar.DAY_OF_MONTH, -1); - } + // 判断要计算的日期是否是周日,如果是则减一天计算周六的,否则会出问题,计算到下一周去了 + int dayWeek = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天 + if (1 == dayWeek) { + cal.add(Calendar.DAY_OF_MONTH, -1); + } - cal.setFirstDayOfWeek(Calendar.MONDAY);// 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一 + cal.setFirstDayOfWeek(Calendar.MONDAY);// 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一 - int day = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天 - cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);// 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值 - /* - * cal.add(Calendar.DATE, 6); - * System.out.println("所在周星期日的日期:"+sdf.format(cal.getTime())); - */ + int day = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天 + cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);// 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值 + /* + * cal.add(Calendar.DATE, 6); + * System.out.println("所在周星期日的日期:"+sdf.format(cal.getTime())); + */ - return new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()) + " 00:00:00"; - } - /** - * 获取本周的最后一天 - * @return String - * **/ - public static String getWeekEnd(){ + return new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()) + " 00:00:00"; + } - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 设置时间格式 - Calendar cal = Calendar.getInstance(); - // Calendar c = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_MONTH, 0); - // cal.setTime(time); + /** + * 获取本周的最后一天 + * + * @return String + **/ + public static String getWeekEnd() { - // 判断要计算的日期是否是周日,如果是则减一天计算周六的,否则会出问题,计算到下一周去了 - int dayWeek = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天 - if (1 == dayWeek) { - cal.add(Calendar.DAY_OF_MONTH, -1); - } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 设置时间格式 + Calendar cal = Calendar.getInstance(); + // Calendar c = Calendar.getInstance(); + cal.add(Calendar.DAY_OF_MONTH, 0); + // cal.setTime(time); - cal.setFirstDayOfWeek(Calendar.MONDAY);// 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一 + // 判断要计算的日期是否是周日,如果是则减一天计算周六的,否则会出问题,计算到下一周去了 + int dayWeek = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天 + if (1 == dayWeek) { + cal.add(Calendar.DAY_OF_MONTH, -1); + } - int day = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天 - cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);// 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值 + cal.setFirstDayOfWeek(Calendar.MONDAY);// 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一 - cal.add(Calendar.DATE, 6); + int day = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天 + cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);// 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值 - return new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()) + " 23:59:59"; - } + cal.add(Calendar.DATE, 6); + + return new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()) + " 23:59:59"; + } + /** + * 判断时间格式 格式必须为“YYYY-MM-dd” + * 2004-2-30 是无效的 + * 2003-2-29 是无效的 + * + * @param sDate + * @return + */ + public static boolean isLegalDate(String sDate) { + int legalLen = 10; + if ((sDate == null) || (sDate.length() != legalLen)) { + return false; + } - /** - * 判断时间格式 格式必须为“YYYY-MM-dd” - * 2004-2-30 是无效的 - * 2003-2-29 是无效的 - * @param sDate - * @return - */ - public static boolean isLegalDate(String sDate) { - int legalLen = 10; - if ((sDate == null) || (sDate.length() != legalLen)) { - return false; - } + DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date date = formatter.parse(sDate); + return sDate.equals(formatter.format(date)); + } catch (Exception e) { + return false; + } + } - DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - try { - Date date = formatter.parse(sDate); - return sDate.equals(formatter.format(date)); - } catch (Exception e) { - return false; - } - } + /** + * 时间比较 + * + * @param amBeginTime + * @param amEndTime + * @return + */ + public static boolean timeCompare(Date amBeginTime, Date amEndTime) { + //设置开始时间 + Calendar amBegin = Calendar.getInstance(); + amBegin.setTime(amBeginTime);//上午开始时间 + //设置结束时间 + Calendar amEnd = Calendar.getInstance(); + amEnd.setTime(amEndTime);//上午结束时间 + //开始时间是否早于结束时间 + if (amBegin.before(amEnd)) { + return true; + } else { + return false; + } + } - /** - * 时间比较 - * @param amBeginTime - * @param amEndTime - * @return - */ - public static boolean timeCompare(Date amBeginTime, Date amEndTime) { - //设置开始时间 - Calendar amBegin = Calendar.getInstance(); - amBegin.setTime(amBeginTime);//上午开始时间 - //设置结束时间 - Calendar amEnd = Calendar.getInstance(); - amEnd.setTime(amEndTime);//上午结束时间 - //开始时间是否早于结束时间 - if (amBegin.before(amEnd)) { - return true; - } else { - return false; - } - } + /** + * 获取6个月内月份日期 + * + * @param flag 结果是否显示年份 + * @return + */ + public static List getHalfYearMonth(boolean flag) { + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, -4); + String before_six = c.get(Calendar.YEAR) + "-" + c.get(Calendar.MONTH);// 六个月前 + List result = new ArrayList(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");// 格式化为年月 + Calendar min = Calendar.getInstance(); + Calendar max = Calendar.getInstance(); + try { + min.setTime(sdf.parse(before_six)); + min.set(min.get(Calendar.YEAR), min.get(Calendar.MONTH), 1); + max.setTime(sdf.parse(sdf.format(new Date()))); - /** - * 获取6个月内月份日期 - * @param flag 结果是否显示年份 - * @return - */ - public static List getHalfYearMonth(boolean flag) { - Calendar c = Calendar.getInstance(); - c.add(Calendar.MONTH, -4); - String before_six = c.get(Calendar.YEAR) + "-" + c.get(Calendar.MONTH);// 六个月前 - List result = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");// 格式化为年月 - Calendar min = Calendar.getInstance(); - Calendar max = Calendar.getInstance(); - try { - min.setTime(sdf.parse(before_six)); - min.set(min.get(Calendar.YEAR), min.get(Calendar.MONTH), 1); - max.setTime(sdf.parse(sdf.format(new Date()))); - - //不含当前月 + //不含当前月 /* int month = max.get(Calendar.MONTH); max.set(Calendar.MONTH, month-1); */ - } catch (ParseException e) { - e.printStackTrace(); - } - max.set(max.get(Calendar.YEAR), max.get(Calendar.MONTH), 2); - Calendar curr = min; - while (curr.before(max)) { - if (flag) { - result.add(sdf.format(curr.getTime())); - } else { - result.add(curr.get(Calendar.MONTH) + 1 + "月"); - } - curr.add(Calendar.MONTH, 1); - } - return result; - } + } catch (ParseException e) { + e.printStackTrace(); + } + max.set(max.get(Calendar.YEAR), max.get(Calendar.MONTH), 2); + Calendar curr = min; + while (curr.before(max)) { + if (flag) { + result.add(sdf.format(curr.getTime())); + } else { + result.add(curr.get(Calendar.MONTH) + 1 + "月"); + } + curr.add(Calendar.MONTH, 1); + } + return result; + } - //根据当前日期获得最近n周的日期区间(不包含本周) - public static String getFromToDate(SimpleDateFormat sdf, Date date, int n, int option, int k) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1; - int offset = 0 == option ? 1 - dayOfWeek : 7 - dayOfWeek; - int amount = 0 == option ? offset - (n - 1 + k) * 7 : offset - k * 7; - calendar.add(Calendar.DATE, amount); - return sdf.format(calendar.getTime()); - } - public static SimpleDateFormat sdf() { - return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - } - // 获取上周的开始时间 - public static String getBeginDayOfLastWeek() { - //上周日期 - SimpleDateFormat sdf = sdf(); - String beginDate = getFromToDate(sdf, new Date(), 1, 0, 1); + //根据当前日期获得最近n周的日期区间(不包含本周) + public static String getFromToDate(SimpleDateFormat sdf, Date date, int n, int option, int k) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1; + int offset = 0 == option ? 1 - dayOfWeek : 7 - dayOfWeek; + int amount = 0 == option ? offset - (n - 1 + k) * 7 : offset - k * 7; + calendar.add(Calendar.DATE, amount); + return sdf.format(calendar.getTime()); + } - Calendar calendar = Calendar.getInstance(); - try { - calendar.setTime(sdf.parse(beginDate)); - }catch (Exception e){ - e.printStackTrace(); - } - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - calendar.set(Calendar.MILLISECOND, 0); - return sdf.format(calendar.getTime()); - } + public static SimpleDateFormat sdf() { + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + } - // 获取上周的结束时间 - public static String getEndDayOfLastWeek() { - //上周日期 - SimpleDateFormat sdf = sdf(); - String endDate = getFromToDate(sdf, new Date(), 1, 1, 1); + // 获取上周的开始时间 + public static String getBeginDayOfLastWeek() { + //上周日期 + SimpleDateFormat sdf = sdf(); + String beginDate = getFromToDate(sdf, new Date(), 1, 0, 1); - Calendar calendar = Calendar.getInstance(); - try { - calendar.setTime(sdf.parse(endDate)); - }catch (Exception e){ - e.printStackTrace(); - } - calendar.set(Calendar.HOUR_OF_DAY, 23); - calendar.set(Calendar.MINUTE, 59); - calendar.set(Calendar.SECOND, 59); - return sdf.format(calendar.getTime()); - } + Calendar calendar = Calendar.getInstance(); + try { + calendar.setTime(sdf.parse(beginDate)); + } catch (Exception e) { + e.printStackTrace(); + } + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return sdf.format(calendar.getTime()); + } - // 获得上月第一天0点时间 - public static String getTimesLastMonthmorning() { - //上月日期 - Calendar c=Calendar.getInstance(); - c.add(Calendar.MONTH, -1); - SimpleDateFormat sdf = sdf(); - String gtimelast = sdf.format(c.getTime()); //上月 - int lastMonthMaxDay=c.getActualMaximum(Calendar.DAY_OF_MONTH); - c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), lastMonthMaxDay, 23, 59, 59); + // 获取上周的结束时间 + public static String getEndDayOfLastWeek() { + //上周日期 + SimpleDateFormat sdf = sdf(); + String endDate = getFromToDate(sdf, new Date(), 1, 1, 1); - //按格式输出 - SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-01 00:00:00"); - String gtime = sdf2.format(c.getTime()); //上月第一天 - return gtime; - } - // 获得上月最后一天24点时间 - public static String getTimesLastMonthnight() { - //上月日期 - Calendar c=Calendar.getInstance(); - c.add(Calendar.MONTH, -1); - SimpleDateFormat sdf = sdf(); - String gtimelast = sdf.format(c.getTime()); //上月 - int lastMonthMaxDay=c.getActualMaximum(Calendar.DAY_OF_MONTH); - c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), lastMonthMaxDay, 23, 59, 59); + Calendar calendar = Calendar.getInstance(); + try { + calendar.setTime(sdf.parse(endDate)); + } catch (Exception e) { + e.printStackTrace(); + } + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + return sdf.format(calendar.getTime()); + } - //按格式输出 - String gtime = sdf.format(c.getTime()); //上月最后一天 - return gtime; - } - /** - * 获取上一季度 开始和结束时间 - * - * @return - */ - public static String[] getLastQuarter() { - SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd"); - String[] range = new String[2]; - Calendar startCalendar = Calendar.getInstance(); - startCalendar.set(Calendar.MONTH, ((int) startCalendar.get(Calendar.MONTH) / 3 - 1) * 3); - startCalendar.set(Calendar.DAY_OF_MONTH, 1); - Date startDate = startCalendar.getTime(); - range[0] = sdfd.format(startDate); + // 获得上月第一天0点时间 + public static String getTimesLastMonthmorning() { + //上月日期 + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, -1); + SimpleDateFormat sdf = sdf(); + String gtimelast = sdf.format(c.getTime()); //上月 + int lastMonthMaxDay = c.getActualMaximum(Calendar.DAY_OF_MONTH); + c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), lastMonthMaxDay, 23, 59, 59); - Calendar endCalendar = Calendar.getInstance(); - endCalendar.set(Calendar.MONTH, ((int) endCalendar.get(Calendar.MONTH) / 3 - 1) * 3 + 2); - endCalendar.set(Calendar.DAY_OF_MONTH, endCalendar.getActualMaximum(Calendar.DAY_OF_MONTH)); - Date endDate = endCalendar.getTime(); - range[1] = sdfd.format(endDate); - return range; - } + //按格式输出 + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-01 00:00:00"); + String gtime = sdf2.format(c.getTime()); //上月第一天 + return gtime; + } + + // 获得上月最后一天24点时间 + public static String getTimesLastMonthnight() { + //上月日期 + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, -1); + SimpleDateFormat sdf = sdf(); + String gtimelast = sdf.format(c.getTime()); //上月 + int lastMonthMaxDay = c.getActualMaximum(Calendar.DAY_OF_MONTH); + c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), lastMonthMaxDay, 23, 59, 59); + + //按格式输出 + String gtime = sdf.format(c.getTime()); //上月最后一天 + return gtime; + } + + /** + * 获取上一季度 开始和结束时间 + * + * @return + */ + public static String[] getLastQuarter() { + SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd"); + String[] range = new String[2]; + Calendar startCalendar = Calendar.getInstance(); + startCalendar.set(Calendar.MONTH, ((int) startCalendar.get(Calendar.MONTH) / 3 - 1) * 3); + startCalendar.set(Calendar.DAY_OF_MONTH, 1); + Date startDate = startCalendar.getTime(); + range[0] = sdfd.format(startDate); + + Calendar endCalendar = Calendar.getInstance(); + endCalendar.set(Calendar.MONTH, ((int) endCalendar.get(Calendar.MONTH) / 3 - 1) * 3 + 2); + endCalendar.set(Calendar.DAY_OF_MONTH, endCalendar.getActualMaximum(Calendar.DAY_OF_MONTH)); + Date endDate = endCalendar.getTime(); + range[1] = sdfd.format(endDate); + return range; + } + + /** + * 获取当日期前/后某个月的所有日期 0 本月 负数 之前的月份 。正数 之后的月份 + * + * @param months + * @return + */ + public static List getDayListOfMonth(Integer months) { + List list = new ArrayList<>(); + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) + months); + int month = cal.get(Calendar.MONTH) + 1; + String monthStr = month < 10 ? "0" + month : String.valueOf(month); + int year = cal.get(Calendar.YEAR); + int day = cal.getActualMaximum(Calendar.DATE); + for (int i = 1; i <= day; i++) { + String d = String.valueOf(i); + if (i < 10) { + d = "0" + d; + } + list.add(year + "-" + monthStr + "-" + d); + } + return list; + } + + /** + * 计算两个日期之间相差的天数 + * + * @param smdate 较小的时间 + * @param bdate 较大的时间 + * @return 相差天数 + * @throws ParseException + */ + public static int daysBetween(Date smdate, Date bdate) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + try { + smdate = sdf.parse(sdf.format(smdate)); + bdate = sdf.parse(sdf.format(bdate)); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Calendar cal = Calendar.getInstance(); + cal.setTime(smdate); + long time1 = cal.getTimeInMillis(); + cal.setTime(bdate); + long time2 = cal.getTimeInMillis(); + long between_days = (time2 - time1) / (1000 * 3600 * 24); + + return Integer.parseInt(String.valueOf(between_days)); + } + + /** + * 字符串的日期格式的计算 + */ + public static int daysBetween(String smdate, String bdate) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Calendar cal = Calendar.getInstance(); + long time1 = 0; + long time2 = 0; + try { + cal.setTime(sdf.parse(smdate)); + time1 = cal.getTimeInMillis(); + cal.setTime(sdf.parse(bdate)); + time2 = cal.getTimeInMillis(); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + long between_days = (time2 - time1) / (1000 * 3600 * 24); + + return Integer.parseInt(String.valueOf(between_days)); + } + + /** + * 得到几天前的时间 + * + * @param d + * @param day + * @return + */ + public static Date getDateBefore(Date d, int day) { + Calendar now = Calendar.getInstance(); + now.setTime(d); + now.set(Calendar.DATE, now.get(Calendar.DATE) - day); + return now.getTime(); + } + + /** + * 得到几天后的时间 + * + * @param d + * @param day + * @return + */ + public static Date getDateAfter(Date d, int day) { + Calendar now = Calendar.getInstance(); + now.setTime(d); + now.set(Calendar.DATE, now.get(Calendar.DATE) + day - 1); + return now.getTime(); + } + + + /** + * 格式化日期 + * + * @return + */ + public static Date fomatDateByNian(String date) { + DateFormat fmt = new SimpleDateFormat("yyyy年MM月dd日"); + try { + return fmt.parse(date); + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + public static void main(String[] args) { + String afterHourDate = DateUtil.getAfterHourDate("12"); + System.out.println(afterHourDate); + + } + + /** + * 时间换算(秒级) + */ + public static String calculateDateSecond(String dateStr, int second) { + Date date = str2Date(dateStr); + if (date != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.SECOND, second); + SimpleDateFormat sdf = sdf(); + return sdf.format(calendar.getTime()); + } + return ""; + } /** - * 获取当日期前/后某个月的所有日期 0 本月 负数 之前的月份 。正数 之后的月份 - * - * @param months - * @return + * @Description: 返回从当前月份到指定月份的开始和结束时间 + * {dateBegin=2023-07-01 00:00:00, month=2023-07, dateEnd=2023-07-31 23:59:59} + * {dateBegin=2023-08-01 00:00:00, month=2023-08, dateEnd=2023-08-31 23:59:59} + * {dateBegin=2023-09-01 00:00:00, month=2023-09, dateEnd=2023-09-30 23:59:59} + * {dateBegin=2023-10-01 00:00:00, month=2023-10, dateEnd=2023-10-31 23:59:59} + * {dateBegin=2023-11-01 00:00:00, month=2023-11, dateEnd=2023-11-30 23:59:59} + * {dateBegin=2023-12-01 00:00:00, month=2023-12, dateEnd=2023-12-31 23:59:59} + * {dateBegin=2024-01-01 00:00:00, month=2024-01, dateEnd=2024-01-31 23:59:59} + * @Author: dearLin + * @Date: 2024/1/29/029 14:12 + * @Param: [] [] + * @Return: java.util.List> */ - public static List getDayListOfMonth(Integer months) { - List list = new ArrayList<>(); - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) + months); - int month = cal.get(Calendar.MONTH) + 1; - String monthStr = month < 10 ? "0" + month : String.valueOf(month); - int year = cal.get(Calendar.YEAR); - int day = cal.getActualMaximum(Calendar.DATE); - for (int i = 1; i <= day; i++) { - String d = String.valueOf(i); - if (i < 10) { - d = "0" + d; - } - list.add(year + "-" + monthStr + "-" + d); - } - return list; - } + public static List> generateTimeArraySevenMonth(int monthIndex) { + List> timeArray = new ArrayList<>(); + Calendar calendar = Calendar.getInstance(); - /** - * 计算两个日期之间相差的天数 - * - * @param smdate 较小的时间 - * @param bdate 较大的时间 - * @return 相差天数 - * @throws ParseException - */ - public static int daysBetween(Date smdate, Date bdate) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - try { - smdate = sdf.parse(sdf.format(smdate)); - bdate = sdf.parse(sdf.format(bdate)); - } catch (ParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - Calendar cal = Calendar.getInstance(); - cal.setTime(smdate); - long time1 = cal.getTimeInMillis(); - cal.setTime(bdate); - long time2 = cal.getTimeInMillis(); - long between_days = (time2 - time1) / (1000 * 3600 * 24); + for (int i = monthIndex; i >= 0; i--) { + Map monthInfo = new HashMap<>(); - return Integer.parseInt(String.valueOf(between_days)); - } + int year = calendar.get(Calendar.YEAR); + int month = calendar.get(Calendar.MONTH) + 1; - /** - * 字符串的日期格式的计算 - */ - public static int daysBetween(String smdate, String bdate) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - Calendar cal = Calendar.getInstance(); - long time1 = 0; - long time2 = 0; - try { - cal.setTime(sdf.parse(smdate)); - time1 = cal.getTimeInMillis(); - cal.setTime(sdf.parse(bdate)); - time2 = cal.getTimeInMillis(); - } catch (ParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + String monthString = String.format(year + "-%02d", month); + String firstDayOfMonth = String.format("%04d-%02d-01 00:00:00", year, month); + calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + String lastDayOfMonth = dateFormat.format(calendar.getTime()); - long between_days = (time2 - time1) / (1000 * 3600 * 24); + monthInfo.put("month", monthString); + monthInfo.put("dateBegin", firstDayOfMonth); + monthInfo.put("dateEnd", lastDayOfMonth); - return Integer.parseInt(String.valueOf(between_days)); - } + timeArray.add(monthInfo); - /** - * 得到几天前的时间 - * - * @param d - * @param day - * @return - */ - public static Date getDateBefore(Date d, int day) { - Calendar now = Calendar.getInstance(); - now.setTime(d); - now.set(Calendar.DATE, now.get(Calendar.DATE) - day); - return now.getTime(); - } - - /** - * 得到几天后的时间 - * - * @param d - * @param day - * @return - */ - public static Date getDateAfter(Date d, int day) { - Calendar now = Calendar.getInstance(); - now.setTime(d); - now.set(Calendar.DATE, now.get(Calendar.DATE) + day -1); - return now.getTime(); - } - - - /** - * 格式化日期 - * @return - */ - public static Date fomatDateByNian(String date) { - DateFormat fmt = new SimpleDateFormat("yyyy年MM月dd日"); - try { - return fmt.parse(date); - } catch (ParseException e) { - e.printStackTrace(); - return null; - } - } - - public static void main(String[] args) { - String afterHourDate = DateUtil.getAfterHourDate("12"); - System.out.println(afterHourDate); - - } - - /** - * 时间换算(秒级) - */ - public static String calculateDateSecond(String dateStr, int second) { - Date date = str2Date(dateStr); - if (date != null) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - calendar.add(Calendar.SECOND, second); - SimpleDateFormat sdf = sdf(); - return sdf.format(calendar.getTime()); - } - return ""; - } + calendar.add(Calendar.MONTH, -1); // Go to the previous month + } + Collections.reverse(timeArray); + return timeArray; + } } diff --git a/src/main/resources/mybatis/datasource/bus/MapEightMapper.xml b/src/main/resources/mybatis/datasource/bus/MapEightMapper.xml new file mode 100644 index 0000000..e38d2a3 --- /dev/null +++ b/src/main/resources/mybatis/datasource/bus/MapEightMapper.xml @@ -0,0 +1,3765 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mybatis/datasource/video/VideoManagerMapper.xml b/src/main/resources/mybatis/datasource/video/VideoManagerMapper.xml index 8984275..5206e23 100644 --- a/src/main/resources/mybatis/datasource/video/VideoManagerMapper.xml +++ b/src/main/resources/mybatis/datasource/video/VideoManagerMapper.xml @@ -2,19 +2,22 @@ - - - BUS_VIDEOMANAGER - + + + BUS_VIDEOMANAGER + - - - SYS_DICTIONARIES - + + + SYS_DICTIONARIES + - - - f.CORPINFO_ID, + + + f + . + CORPINFO_ID + , f.VIDEONAME, f.VIDEOURL, f.OPDATE, @@ -25,11 +28,12 @@ f.VIDEOMANAGER_ID, f.PLS_ID, f.CODE - + - - - CORPINFO_ID, + + + CORPINFO_ID + , VIDEONAME, VIDEOURL, OPDATE, @@ -39,183 +43,218 @@ VIDEOMANAGER_ID, PLS_ID, CODE - + - - - #{CORPINFO_ID}, - #{VIDEONAME}, - #{VIDEOURL}, - #{OPDATE}, - #{OPUSER}, - #{ISDELETE}, - #{ISSHOW}, - #{VIDEOMANAGER_ID}, - #{PLS_ID}, - #{CODE} - + + + #{CORPINFO_ID} + , + #{VIDEONAME}, + #{VIDEOURL}, + #{OPDATE}, + #{OPUSER}, + #{ISDELETE}, + #{ISSHOW}, + #{VIDEOMANAGER_ID}, + #{PLS_ID}, + #{CODE} + - - - insert into - - ( - - ) values ( - - ) - + + + insert into + + ( + + ) values ( + + ) + - - - update - - set - ISDELETE = '1' - where - VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} - + + + update + + set + ISDELETE = '1' + where + VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} + - - - update - - set - - CORPINFO_ID = #{CORPINFO_ID}, - - - VIDEONAME = #{VIDEONAME}, - - - VIDEOURL = #{VIDEOURL}, - - - ISSHOW = #{ISSHOW}, - - - CODE = #{CODE}, - + + + update + + set + + CORPINFO_ID = #{CORPINFO_ID}, + + + VIDEONAME = #{VIDEONAME}, + + + VIDEOURL = #{VIDEOURL}, + + + ISSHOW = #{ISSHOW}, + + + CODE = #{CODE}, + - VIDEOMANAGER_ID = VIDEOMANAGER_ID - where - VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} - + VIDEOMANAGER_ID = VIDEOMANAGER_ID + where + VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} + - - - update - - set - PLS_ID = #{PLS_ID} - where - VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} - + + + update + + set + PLS_ID = #{PLS_ID} + where + VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} + - - update - - set ISSHOW= #{ISSHOW} - where - CORPINFO_ID = #{CORPINFO_ID} - - - update - - set ISSHOW= #{ISSHOW} - where - VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} - - - + + update + + set ISSHOW= #{ISSHOW} + where + CORPINFO_ID = #{CORPINFO_ID} + + + update + + set ISSHOW= #{ISSHOW} + where + VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} + + + - - + select + , + c.CORP_NAME + from + + f left join bus_CORP_INFO c on f.CORPINFO_ID=c.CORPINFO_ID + where f.ISDELETE = '0' + + and f.CORPINFO_ID=#{pd.CORPINFO_ID} + + + and + ( + VIDEONAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%') + - ) - - order by f.ISSHOW desc - + ) + + order by f.ISSHOW desc + - - - + + + + + + + - - - update - - set - ISDELETE = '1' - where - VIDEOMANAGER_ID in - - #{item} - - - - - update - - set - ISSHOW = #{ISSHOW} - where - 1=1 - - and VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} - - - and CORPINFO_ID = #{CORPINFO_ID} - - - + + + update + + set + ISDELETE = '1' + where + VIDEOMANAGER_ID in + + #{item} + + + + + UPDATE bus_videomanager + SET ISSHOW = (CASE WHEN VIDEOMANAGER_ID = #{VIDEOMANAGER_ID} THEN 1 ELSE 0 END) + where CORPINFO_ID = #{CORPINFO_ID} +