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} +