diff --git a/pom.xml b/pom.xml index 8e6f091..504ca08 100644 --- a/pom.xml +++ b/pom.xml @@ -115,12 +115,12 @@ 5.7.20 - - - org.apache.shiro - shiro-spring-boot-starter - 1.11.0 - + + + + + + diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TowerController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TowerController.java index f4abc47..f2320df 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TowerController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TowerController.java @@ -18,6 +18,10 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.apache.shiro.authz.annotation.RequiresRoles; +import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestBody; diff --git a/xymanager_common/pom.xml b/xymanager_common/pom.xml index fbfa642..ba1e0d4 100644 --- a/xymanager_common/pom.xml +++ b/xymanager_common/pom.xml @@ -103,6 +103,13 @@ org.springframework.boot spring-boot-starter-validation + + + + + + + diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java index b037971..90d37a9 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java @@ -110,7 +110,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { if (item.getMediaType() == 0) { photoBean.setPath(photoaddress + item.getPath()); } else { - photoBean.setPath(videoaddress + item.getPath()); if (item.getThumb() != null) { photoBean.setThumb(videoaddress + item.getThumb()); @@ -286,7 +285,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { public ServiceBody getLatestPhoto(TerminalPhotoVo vo) { /* Cma cma = new Cma(server, port);*/ DateTime now = DateTime.now(); - String cmd =Constants.CMD+"capture --cmdid=" + vo.getCmdid() + "\t" + "--channel=" + vo.getChannel() + "\t" + "--preset=255 --type=" + vo.getCaptureType(); + String cmd = Constants.CMD + "capture --cmdid=" + vo.getCmdid() + "\t" + "--channel=" + vo.getChannel() + "\t" + "--preset=255 --type=" + vo.getCaptureType(); ProcessExecUtils.exec(cmd); /* Boolean hasNew = cma.requestCapture(vo.getCmdid(), vo.getChannel(), vo.getPreset(), vo.getCaptureType());*/ return Asserts.success(now); @@ -316,52 +315,54 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { PageUtils.SetPage(pageindex, pagesize); List list = terminalsDao.selectChannelAndTermList(CommonStatus.EFFECTIVE.value()); - - List termidlist = new ArrayList<>(); - for (ChannelAndTermDto item : list) { - Integer termid = item.getTermid(); - termidlist.add(termid); - } - - List lines = linesDao.selectLineByDyId(null, CommonStatus.EFFECTIVE.value()); - - List list2 = terminalPhotoDao.selectTermAndChannelLatestPhotoList(termidlist); List beans = new ArrayList<>(); - for (ChannelAndTermDto item : list) { - TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean(); - photosBean.setTermid(item.getTermid()); - photosBean.setLineid(item.getLineid()); - photosBean.setChannnelname(item.getChannelname()); - photosBean.setChannelid(item.getChannelid()); - photosBean.setDisplayname(item.getDisplayname()); - for (int z = 0; z < lines.size(); z++) { - Lines lines1 = lines.get(z); - if (item.getLineid() == lines1.getId()) { - photosBean.setLinename(lines1.getName()); - break; - } + + if (!CollectionUtil.isEmpty(list)) { + List termidlist = new ArrayList<>(); + for (ChannelAndTermDto item : list) { + Integer termid = item.getTermid(); + termidlist.add(termid); } - for (int y = 0; y < list2.size(); y++) { - TermAndChannelLatestPhotoMapperDto item2 = list2.get(y); - if (item.getTermid().intValue() == item2.getTermid().intValue() && item.getChannelid().intValue() == item2.getChannelid().intValue()) { - photosBean.setPath(item2.getPath()); - BigInteger recvtime = MyDateUtils.TimeSecond2MillSecond(item2.getRecvTime().longValue()); - photosBean.setRecvTime(MyDateUtils.date(recvtime.longValue())); - BigInteger phototime = MyDateUtils.TimeSecond2MillSecond(item2.getPhotoTime().longValue()); - photosBean.setPhotoTime(MyDateUtils.date(phototime.longValue())); - photosBean.setMediatype(item2.getMediatype()); - if (item2.getMediatype().intValue() == 0) { - photosBean.setPath(photoaddress + item2.getPath()); - } else { - photosBean.setPath(videoaddress + item2.getPath()); + List lines = linesDao.selectLineByDyId(null, CommonStatus.EFFECTIVE.value()); + + List list2 = terminalPhotoDao.selectTermAndChannelLatestPhotoList(termidlist); + for (ChannelAndTermDto item : list) { + TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean(); + photosBean.setTermid(item.getTermid()); + photosBean.setLineid(item.getLineid()); + photosBean.setChannnelname(item.getChannelname()); + photosBean.setChannelid(item.getChannelid()); + photosBean.setDisplayname(item.getDisplayname()); + for (int z = 0; z < lines.size(); z++) { + Lines lines1 = lines.get(z); + if (item.getLineid() == lines1.getId()) { + photosBean.setLinename(lines1.getName()); + break; } - photosBean.setOrginalid(item2.getOrginalid()); - photosBean.setPresetId(item2.getPresetId()); - break; } + for (int y = 0; y < list2.size(); y++) { + TermAndChannelLatestPhotoMapperDto item2 = list2.get(y); + if (item.getTermid().intValue() == item2.getTermid().intValue() && item.getChannelid().intValue() == item2.getChannelid().intValue()) { + photosBean.setPath(item2.getPath()); + BigInteger recvtime = MyDateUtils.TimeSecond2MillSecond(item2.getRecvTime().longValue()); + photosBean.setRecvTime(MyDateUtils.date(recvtime.longValue())); + BigInteger phototime = MyDateUtils.TimeSecond2MillSecond(item2.getPhotoTime().longValue()); + photosBean.setPhotoTime(MyDateUtils.date(phototime.longValue())); + photosBean.setMediatype(item2.getMediatype()); + if (item2.getMediatype().intValue() == 0) { + photosBean.setPath(photoaddress + item2.getPath()); + } else { + photosBean.setPath(videoaddress + item2.getPath()); + } + photosBean.setOrginalid(item2.getOrginalid()); + photosBean.setPresetId(item2.getPresetId()); + break; + } + } + beans.add(photosBean); } - beans.add(photosBean); } + model.setList(beans); PageInfo pageData = PageUtils.getPageData(list); int currentpage = pageData.getPageNum(); @@ -401,7 +402,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { span1 = (short) 0; span2 = span; } - String cmd = Constants.CMD+"schedule --flag=1 --cmdid=" + dtoList.get(j).getCmid() + "\t" + "--channel=" + vo.getChannel() + "\t" + String cmd = Constants.CMD + "schedule --flag=1 --cmdid=" + dtoList.get(j).getCmid() + "\t" + "--channel=" + vo.getChannel() + "\t" + "--group=3 --hour1=" + startHour + "\t" + "--min1=" + startMin + "\t" + "--preset1=255 --hour2=" + endTimeHour + "\t" + "--min2=" + endTimeMin + "\t" + "--preset2=255 --hour3=" + span1 + "\t" + "--min3=" + span2 + "\t" + "--preset3=255"; ProcessExecUtils.exec(cmd); @@ -413,7 +414,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { @Override public ServiceBody getPhotoQueryParam(ReturnedPhotoParamsGetVo vo) { GetModel model = new GetModel(); - String cmd = Constants.CMD+"act=imgparams --cmdid=" + vo.getCmdId() + "\t" + "--clientid=10 --reqid=" + Constants.REQUEST_ID + "\t" + "--flag=0 --rf=7 --channel=" + vo.getChannelId(); + String cmd = Constants.CMD + "act=imgparams --cmdid=" + vo.getCmdId() + "\t" + "--clientid=10 --reqid=" + Constants.REQUEST_ID + "\t" + "--flag=0 --rf=7 --channel=" + vo.getChannelId(); ProcessExecUtils.exec(cmd); model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString())); Constants.REQUEST_ID.addAndGet(1); @@ -427,7 +428,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { @Override public ServiceBody addOrUpdatePhotoParams(PhotoParamsVo vo) { - String cmd = Constants.CMD+"imgparams --flag=1 --cmdid=" + vo.getCmdId() + "\t" + "--color=" + vo.getColor() + "\t" + "--resolution=" + vo.getResolution() + "\t" + String cmd = Constants.CMD + "imgparams --flag=1 --cmdid=" + vo.getCmdId() + "\t" + "--color=" + vo.getColor() + "\t" + "--resolution=" + vo.getResolution() + "\t" + "--luminance=" + vo.getLuminance() + "\t" + "-contrast=" + vo.getContrast() + "\t" + "--saturation=" + vo.getSaturation() + "\t" + "--channel=" + vo.getChannelId(); ProcessExecUtils.exec(cmd); return Asserts.success("设置成功"); @@ -455,7 +456,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel(); if (StringUtils.isNotBlank(result)) { JSONObject resultObj = JSONObject.parseObject(result); - if(null!=resultObj.get("groupData")) { + if (null != resultObj.get("groupData")) { List resultDtoList = JSONArray.parseArray(resultObj.get("groupData").toString(), PhotoTimeResultDto.class); List resultList = Lists.newArrayList(); String startTimeStr = resultDtoList.get(0).getHour() + ":" + resultDtoList.get(0).getMinute() + ":00"; @@ -483,7 +484,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { @Override public ServiceBody selectPhotoTimeGet(TerminalPhotoTimeGetVo vo) { GetModel model = new GetModel(); - String cmd = Constants.CMD+"schedule --cmdid=" + vo.getCmdId() + "\t" + "--reqid=" + Constants.REQUEST_ID + "\t" + "--clientid=10 --flag=0 --rf=7 --channel=" + vo.getChannel(); + String cmd = Constants.CMD + "schedule --cmdid=" + vo.getCmdId() + "\t" + "--reqid=" + Constants.REQUEST_ID + "\t" + "--clientid=10 --flag=0 --rf=7 --channel=" + vo.getChannel(); ProcessExecUtils.exec(cmd); Integer requestId = Integer.parseInt(Constants.REQUEST_ID.toString()); model.setRequestId(requestId);