| | |
| | | ) |
| | | </if> |
| | | <if test="deviceCode != null and deviceCode!= ''"> |
| | | AND t2.device_code = #{deviceCode} |
| | | AND t1.device_code = #{deviceCode} |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | return ResponseUtil.success(ipVolumeFileService.addFile(fileParam)); |
| | | } |
| | | |
| | | @PostMapping("/delete/{fileId}") |
| | | public ResponseVO<Object> deleteFile(@PathVariable Long fileId) { |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> deleteFile(@RequestBody List<Long> fileIds) { |
| | | if (!permissionConfig.check(MenuEnum.IP_BROADCAST_FILE_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | List<BroadcastV2TaskFile> list = v2TaskFileService.list(Wrappers.lambdaQuery(BroadcastV2TaskFile.class).eq(BroadcastV2TaskFile::getFileId, fileId)); |
| | | List<BroadcastV2TaskFile> list = v2TaskFileService.list(Wrappers.lambdaQuery(BroadcastV2TaskFile.class).in(BroadcastV2TaskFile::getFileId, fileIds)); |
| | | if (list.size() != 0) { |
| | | throw new BusinessException("æ¤æä»¶æ£å¨è¢«å
¶ä»ä»»å¡å ç¨"); |
| | | } |
| | | return ResponseUtil.success(ipVolumeFileService.deleteFile(fileId)); |
| | | return ResponseUtil.success(ipVolumeFileService.deleteFile(fileIds)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.IpVolumeMissionParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.service.IpVolumeMissionService; |
| | | import com.sandu.ximon.dao.domain.IpVolumeMission; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author liuhaonan |
| | |
| | | |
| | | } |
| | | |
| | | @PostMapping("/delete/{taskId}") |
| | | public ResponseVO<Object> deleteMission(@PathVariable Integer taskId) { |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> deleteMission(@RequestBody List<Integer> taskIds) { |
| | | if (!permissionConfig.check(MenuEnum.IP_BROADCAST_TASK_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | // 0ï¼æå 1ï¼ä»»å¡ä¸å¤äºç©ºé²ç¶æ 2:æå¡å¨å é¤å¤±è´¥ |
| | | Integer result = ipVolumeMissionService.deleteMission(taskId); |
| | | Integer result = ipVolumeMissionService.deleteMission(taskIds); |
| | | if (result == 0) { |
| | | return ResponseUtil.success("å 餿å"); |
| | | } else if (result == 1) { |
| | |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | |
| | | return ResponseUtil.successPage(ipVolumeMissionService.missionList(baseConditionVO, keyword,order,seq)); |
| | | return ResponseUtil.successPage(ipVolumeMissionService.missionList(baseConditionVO, keyword, order, seq)); |
| | | } |
| | | |
| | | //è·åä»»å¡è¯¦æ
|
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * LEDèç®å¤ç |
| | | */ |
| | |
| | | } |
| | | |
| | | |
| | | @PostMapping("/delete/{pid}") |
| | | public ResponseVO<Object> deleteLEDProgram(@PathVariable Long pid) { |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> deleteLEDProgram(@RequestBody List<Long> pids) { |
| | | if (!permissionConfig.check(MenuEnum.LED_N_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | return ResponseUtil.success(ledProgramService.deleteProgram(pid)); |
| | | return ResponseUtil.success(ledProgramService.deleteProgram(pids)); |
| | | } |
| | | |
| | | |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author liuhaonan |
| | | * @Date 2021/12/21 11:35 |
| | |
| | | return ResponseUtil.success(ledProgramFileService.addProgramFile(param)); |
| | | } |
| | | |
| | | @PostMapping("/delete/{fileId}") |
| | | public ResponseVO<Object> deleteLEDProgram(@PathVariable Long fileId) { |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> deleteLEDProgram(@RequestBody List<Long> fileIds) { |
| | | if (!permissionConfig.check(MenuEnum.LED_FILE_N_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | return ResponseUtil.success(ledProgramFileService.deleteFile(fileId)); |
| | | return ResponseUtil.success(ledProgramFileService.deleteFile(fileIds)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | |
| | | // return ResponseUtil.success(aliOssFileService.uploadFile(file)); |
| | | } |
| | | |
| | | @PostMapping("/delete/{fileId}") |
| | | public ResponseVO<Object> deleteLEDProgram(@PathVariable Long fileId) { |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> deleteLEDProgram(@RequestBody List<Long> fileIds) { |
| | | if (!permissionConfig.check(MenuEnum.LED_FILE_S_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | return ResponseUtil.success(ledProgramFileService.deleteFile(fileId)); |
| | | return ResponseUtil.success(ledProgramFileService.deleteFile(fileIds)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | |
| | | import com.github.pagehelper.util.StringUtil; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.security.annotation.AnonymousAccess; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A1Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.FrameBuilder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.IRequestFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.A1TernaryCodeReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.MainBoardDataTransparentReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonRequest; |
| | |
| | | import com.sandu.ximon.admin.param.MQTTTestPrarm; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.PoleService; |
| | | import com.sandu.ximon.admin.utils.Base64Util; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.Base64; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * MQTTæµè¯ |
| | |
| | | |
| | | InvokeParam param = new InvokeParam(); |
| | | param.setOperate("1001"); |
| | | param.setFrame(mqttTestPrarm.getFrameStr()); |
| | | //å符串mqttTestPrarm.getFrameStr()转base64 |
| | | String frame = Base64Util.toBase64Frame(mqttTestPrarm.getFrameStr());; |
| | | System.out.println("frame: "+frame); |
| | | param.setFrame(frame); |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(pole.getDeviceCode(), param); |
| | | if (commonFrame == null || !commonFrame.isValidate()) { |
| | | throw new BusinessException("ååºæ°æ®æ ¡éªå¤±è´¥ï¼è¯·éæ°è¯·æ±æ°æ®ï¼"); |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æå头 |
| | | */ |
| | |
| | | //è¿åæ¥è¯¢çæå头信æ¯å表 |
| | | CommonPage commonPage; |
| | | if (monitorParam == null) { |
| | | commonPage = monitorService.listMonitorByKeyword(baseConditionVO,order,seq, new MonitorParam()); |
| | | commonPage = monitorService.listMonitorByKeyword(baseConditionVO, order, seq, new MonitorParam()); |
| | | } else { |
| | | commonPage = monitorService.listMonitorByKeyword(baseConditionVO,order,seq, monitorParam); |
| | | commonPage = monitorService.listMonitorByKeyword(baseConditionVO, order, seq, monitorParam); |
| | | } |
| | | |
| | | return ResponseUtil.success(commonPage); |
| | |
| | | /** |
| | | * å 餿°æ®åºä¸è¤ç³äºæå头 |
| | | * |
| | | * @param id |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/delete/{id}") |
| | | public ResponseVO<Object> deleteMonitor(@PathVariable Long id) { |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> deleteMonitor(@RequestBody List<Long> ids) { |
| | | if (!permissionConfig.check(MenuEnum.MONITOR_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | boolean result = monitorService.deleteMonitor(id); |
| | | boolean result = monitorService.deleteMonitor(ids); |
| | | if (result) { |
| | | return ResponseUtil.success(null); |
| | | } else { |
| | |
| | | return ResponseUtil.success(poleService.updatePole(poleId, param)); |
| | | } |
| | | |
| | | @PostMapping("/delete/{poleId}") |
| | | public ResponseVO<Object> deletePole(@PathVariable Long poleId) { |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> deletePole(@RequestBody List<Long> poleIds) { |
| | | if (!permissionConfig.check(MenuEnum.POLE_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | return ResponseUtil.success(poleService.deletePole(poleId)); |
| | | return ResponseUtil.success(poleService.deletePole(poleIds)); |
| | | } |
| | | |
| | | @PostMapping("/listDetail") |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åç»å表åè½ |
| | | * |
| | |
| | | return ResponseUtil.success(poleGroupService.updateGroup(groupId, param)); |
| | | } |
| | | |
| | | @PostMapping("/delete/{groupId}") |
| | | public ResponseVO<Object> delGroup(@PathVariable Long groupId) { |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> delGroup(@RequestBody List<Long> groupIds) { |
| | | if (!permissionConfig.check(MenuEnum.GROUP_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | return ResponseUtil.success(poleGroupService.deleteGroup(groupId)); |
| | | return ResponseUtil.success(poleGroupService.deleteGroup(groupIds)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | |
| | | /** |
| | | * å é¤èç® |
| | | * |
| | | * @param pid |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/deleteProgram/{pid}") |
| | | public ResponseVO<Object> deleteProgram(@PathVariable Long pid) { |
| | | @PostMapping("/deleteProgram") |
| | | public ResponseVO<Object> deleteProgram(@RequestBody List<Long> pids) { |
| | | if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | return ResponseUtil.success(xiXunPlayerService.deleteProgram(pid)); |
| | | return ResponseUtil.success(xiXunPlayerService.deleteProgram(pids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/deletePushSchedule") |
| | | public ResponseVO<Object> deletePushSchedule( @RequestBody Long[] lightemitIds) { |
| | | public ResponseVO<Object> deletePushSchedule(@RequestBody Long[] lightemitIds) { |
| | | if (!permissionConfig.check(MenuEnum.XIXUN_PLAN_PUSH_SCHEDULE.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | |
| | | return ResponseUtil.success(scheduleService.deleteSchedulePush( lightemitIds)); |
| | | return ResponseUtil.success(scheduleService.deleteSchedulePush(lightemitIds)); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.sandu.ximon.admin.manager.iot.amqp.processor; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightErrorCodeReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5LightHeartbeatReportInnerFrame; |
| | |
| | | import com.sandu.ximon.admin.service.LightReportDataService; |
| | | import com.sandu.ximon.admin.service.LightReportErrorService; |
| | | import com.sandu.ximon.admin.service.LightService; |
| | | import com.sandu.ximon.dao.domain.LightReportError; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | |
| | | log.info("å¿è·³ç¸åº"); |
| | | A5LightHeartbeatReportInnerFrame heartbeatReportInnerFrame = new A5LightHeartbeatReportInnerFrame().transformFrame(frame.getPayload()); |
| | | |
| | | if ("363832544e5008ff1741ffff".equals(deviceName)) { |
| | | System.out.println("å¿è·³å
: " + JSON.toJSONString(heartbeatReportInnerFrame)); |
| | | } |
| | | if (heartbeatReportInnerFrame.isValidate()) { |
| | | SpringContextHolder.getBean(LightReportDataService.class).saveReportData(deviceName, heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | //å¿è·³å
䏿¥ä¸ä¿å硬件设å¤ä¿¡æ¯ |
| | |
| | | return d; |
| | | } |
| | | |
| | | public static final String bytesToHexString(byte[] bArray) { |
| | | StringBuffer sb = new StringBuffer(bArray.length); |
| | | String sTemp; |
| | | for (int i = 0; i < bArray.length; i++) { |
| | | sTemp = Integer.toHexString(0xFF & bArray[i]); |
| | | if (sTemp.length() < 2) |
| | | sb.append(0); |
| | | sb.append(sTemp.toLowerCase()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * å符串转æ¢ä¸º16è¿å¶å符串 |
| | | * |
| | |
| | | return save(file); |
| | | } |
| | | |
| | | public boolean deleteFile(Long fileId) { |
| | | IpVolumeFile byId = getById(fileId); |
| | | String bucketName; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | bucketName = MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName(); |
| | | } else { |
| | | bucketName = MinIoConstant.BROADCAST_FILE.getBucketName() + SecurityUtils.getUserId(); |
| | | } |
| | | if (byId == null) { |
| | | throw new BusinessException("æ¾ä¸å°å¯¹åºæä»¶"); |
| | | } |
| | | boolean b = minIoUtil.deleteFile(bucketName, byId.getFileName()); |
| | | public boolean deleteFile(List<Long> fileIds) { |
| | | fileIds.forEach(fileId -> { |
| | | IpVolumeFile byId = getById(fileId); |
| | | String bucketName; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | bucketName = MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName(); |
| | | } else { |
| | | bucketName = MinIoConstant.BROADCAST_FILE.getBucketName() + SecurityUtils.getUserId(); |
| | | } |
| | | if (byId == null) { |
| | | throw new BusinessException("æ¾ä¸å°å¯¹åºæä»¶"); |
| | | } |
| | | boolean b = minIoUtil.deleteFile(bucketName, byId.getFileName()); |
| | | // if (!b) { |
| | | // throw new BusinessException("æå¡å¨å é¤å¤±è´¥"); |
| | | // } |
| | | /** |
| | | * 鳿±æä»¶å é¤ æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "å 餿件id:" + fileId + "鳿±æä»¶åç§°ï¼" + byId.getFileName() + "ï¼æä»¶å¤§å°ï¼" + byId.getOriginSize() + "ï¼æä»¶è·¯å¾ï¼" + byId.getFileUrl(); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "鳿±æä»¶å é¤", content); |
| | | /** |
| | | * 鳿±æä»¶å é¤ æ¥å¿è®°å½ç»æ |
| | | */ |
| | | /** |
| | | * 鳿±æä»¶å é¤ æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "å 餿件id:" + fileId + "鳿±æä»¶åç§°ï¼" + byId.getFileName() + "ï¼æä»¶å¤§å°ï¼" + byId.getOriginSize() + "ï¼æä»¶è·¯å¾ï¼" + byId.getFileUrl(); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "鳿±æä»¶å é¤", content); |
| | | /** |
| | | * 鳿±æä»¶å é¤ æ¥å¿è®°å½ç»æ |
| | | */ |
| | | |
| | | return removeById(fileId); |
| | | }); |
| | | return removeByIds(fileIds); |
| | | } |
| | | |
| | | public List<IpVolumeFile> ipVolumeFileList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) { |
| | |
| | | /** |
| | | * å é¤ä»»å¡ |
| | | * |
| | | * @param taskId |
| | | * @param taskIds |
| | | * @return0ï¼æå 1ï¼ä»»å¡ä¸å¤äºç©ºé²ç¶æ 2:æå¡å¨å é¤å¤±è´¥ |
| | | */ |
| | | public Integer deleteMission(Integer taskId) { |
| | | Integer del = TaskAPIUtils.delTask(taskId); |
| | | if (del == 0) { |
| | | IpVolumeMission byId = getById(taskId); |
| | | if (byId == null) { |
| | | return -1; |
| | | } |
| | | removeById(taskId); |
| | | broadcastV2TaskFileService.deleteByTaskId(taskId); |
| | | broadcastV2TaskTerminalService.deleteByTaskId(taskId); |
| | | public Integer deleteMission(List<Integer> taskIds) { |
| | | //å é¤å¤±è´¥çéå |
| | | List<Integer> delIds = new ArrayList<Integer>(); |
| | | if (!taskIds.isEmpty()) { |
| | | taskIds.forEach(taskId -> { |
| | | Integer del = TaskAPIUtils.delTask(taskId); |
| | | if (del == 0) { |
| | | IpVolumeMission byId = getById(taskId); |
| | | if (byId == null) { |
| | | return; |
| | | } |
| | | removeById(taskId); |
| | | broadcastV2TaskFileService.deleteByTaskId(taskId); |
| | | broadcastV2TaskTerminalService.deleteByTaskId(taskId); |
| | | // broadcastV2TaskTerminalService.removeById(taskId); |
| | | } else { |
| | | delIds.add(taskId); |
| | | } |
| | | |
| | | /** |
| | | * IP鳿±ä»»å¡å é¤ æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "{å é¤çä»»å¡IDï¼" + taskId |
| | | + "ï¼ä»»å¡å é¤ç»æï¼" + del |
| | | + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "IP鳿±ä»»å¡å é¤", content); |
| | | /** |
| | | * IP鳿±ä»»å¡å é¤ æ¥å¿è®°å½ç»æ |
| | | */ |
| | | }); |
| | | } else { |
| | | throw new BusinessException("ä»»å¡idä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | /** |
| | | * IP鳿±ä»»å¡å é¤ æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "{å é¤çä»»å¡IDï¼" + taskId |
| | | + "ï¼ä»»å¡å é¤ç»æï¼" + del |
| | | + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "IP鳿±ä»»å¡å é¤", content); |
| | | /** |
| | | * IP鳿±ä»»å¡å é¤ æ¥å¿è®°å½ç»æ |
| | | */ |
| | | |
| | | |
| | | return del; |
| | | if (delIds.isEmpty()) { |
| | | return 0; |
| | | } else { |
| | | throw new BusinessException("é¨åå é¤å¤±è´¥,失败çéå为:" + delIds); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class LEDProgramFileService extends BaseServiceImpl<LEDProgramFileMapper, LEDProgramFile> { |
| | |
| | | return save(file); |
| | | } |
| | | |
| | | public boolean deleteFile(Long id) { |
| | | LEDProgramFile byId = getById(id); |
| | | if (byId == null) { |
| | | public boolean deleteFile(List<Long> fileIds) { |
| | | List<LEDProgramFile> ledProgramFiles = listByIds(fileIds); |
| | | if (ledProgramFiles.isEmpty()) { |
| | | throw new BusinessException("æªæ¾å°è¯¥èç®"); |
| | | } |
| | | /** |
| | | * è¯ºç¦æä»¶å é¤ æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "æä»¶id:" + id + "æä»¶å
容:" + JSON.toJSONString(byId); |
| | | String content = "æä»¶id:" + fileIds + "æä»¶å
容:" + JSON.toJSONString(ledProgramFiles); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "è¯ºç¦æä»¶å é¤", content); |
| | | /** |
| | | * è¯ºç¦æä»¶å é¤ æ¥å¿è®°å½ç»æ |
| | | */ |
| | | return removeById(id); |
| | | return removeByIds(fileIds); |
| | | } |
| | | |
| | | public LambdaQueryWrapper<LEDProgramFile> listFile() { |
| | |
| | | } |
| | | |
| | | |
| | | public boolean deleteProgram(Long id) { |
| | | LEDProgram byId = getById(id); |
| | | if (byId == null) { |
| | | public boolean deleteProgram(List<Long> pids) { |
| | | List<LEDProgram> ledPrograms = listByIds(pids); |
| | | if (ledPrograms.isEmpty()) { |
| | | throw new BusinessException("æªæ¾å°è¯¥èç®"); |
| | | } |
| | | |
| | | return removeById(id); |
| | | return removeByIds(pids); |
| | | |
| | | } |
| | | |
| | |
| | | return save(sFile); |
| | | } |
| | | |
| | | public boolean deleteFile(Long id) { |
| | | LedSFile byId = getById(id); |
| | | if (byId == null) { |
| | | public boolean deleteFile(List<Long> fileIds) { |
| | | if (fileIds.isEmpty()) { |
| | | throw new BusinessException("æä»¶idä¸è½ä¸ºç©º"); |
| | | } |
| | | List<LedSFile> ledSFiles = listByIds(fileIds); |
| | | if (ledSFiles.isEmpty()) { |
| | | throw new BusinessException("æªæ¾å°è¯¥èç®"); |
| | | } |
| | | |
| | | /** |
| | | * çæ±æä»¶å é¤ æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "æä»¶å
容id:" + id + "æä»¶å
容:" + JSON.toJSONString(byId); |
| | | String content = "æä»¶å
容id:" + fileIds + "æä»¶å
容:" + JSON.toJSONString(ledSFiles); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "çæ±æä»¶å é¤", content); |
| | | /** |
| | | * çæ±æä»¶å é¤ æ¥å¿è®°å½ç»æ |
| | | */ |
| | | return removeById(id); |
| | | return removeByIds(fileIds); |
| | | } |
| | | |
| | | |
| | |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.dao.bo.LightReportDataBo; |
| | | import com.sandu.ximon.dao.domain.Light; |
| | | import com.sandu.ximon.dao.domain.LightReportData; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | |
| | | if (macCode.isEmpty()) { |
| | | throw new BusinessException("macä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | Light light = SpringContextHolder.getBean(LightService.class) |
| | | .getOne(Wrappers.lambdaQuery(Light.class).eq(Light::getDeviceCode, macCode)); |
| | | if (light == null) { |
| | | throw new BusinessException("ç³»ç»ä¸ä¸åå¨è¯¥åç¯"); |
| | | } |
| | | PageHelper.startPage(conditionVO.getPageNo(), conditionVO.getPageSize()); |
| | | List<LightReportData> list = list(Wrappers.lambdaQuery(LightReportData.class).eq(LightReportData::getDeviceCode, macCode)); |
| | | list.forEach( |
| | |
| | | /** |
| | | * å 餿å头 |
| | | * |
| | | * @param Id |
| | | * @param |
| | | * @return |
| | | */ |
| | | public boolean deleteMonitor(Long Id) { |
| | | Monitor monitor = getById(Id); |
| | | if (monitor == null) { |
| | | throw new BusinessException("æ¾ä¸å°æå头"); |
| | | public boolean deleteMonitor(List<Long> ids) { |
| | | List<Long> idList = new ArrayList<Long>(); |
| | | List<Monitor> monitors = listByIds(ids); |
| | | if (!monitors.isEmpty()) { |
| | | monitors.forEach( |
| | | monitor -> { |
| | | if (monitor == null) { |
| | | throw new BusinessException("æ¾ä¸å°æå头"); |
| | | } |
| | | PoleBinding one = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, monitor.getDeviceSerial())); |
| | | if (one != null) { |
| | | //å 餿å头设å¤åéè¦å
è§£ç» |
| | | poleBindingService.unBindPole(null, monitor.getDeviceSerial()); |
| | | } |
| | | /** |
| | | * å 餿å头æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "{æå头Codeï¼" + monitor.getDeviceSerial() + "ï¼ æå头åç§°ï¼" + monitor.getDeviceName() + " }"; |
| | | List<String> listCode = new ArrayList<>(); |
| | | listCode.add(monitor.getDeviceSerial()); |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "å 餿å头", content); |
| | | /** |
| | | * å 餿å头æ¥å¿è®°å½ç»æ |
| | | */ |
| | | idList.add(monitor.getId()); |
| | | } |
| | | ); |
| | | } |
| | | PoleBinding one = poleBindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, monitor.getDeviceSerial())); |
| | | if (one != null) { |
| | | //å 餿å头设å¤åéè¦å
è§£ç» |
| | | poleBindingService.unBindPole(null, monitor.getDeviceSerial()); |
| | | } |
| | | /** |
| | | * å 餿å头æ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "{æå头Codeï¼" + monitor.getDeviceSerial() + "ï¼ æå头åç§°ï¼" + monitor.getDeviceName() + " }"; |
| | | List<String> listCode = new ArrayList<>(); |
| | | listCode.add(monitor.getDeviceSerial()); |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "å 餿å头", content); |
| | | /** |
| | | * å 餿å头æ¥å¿è®°å½ç»æ |
| | | */ |
| | | return removeById(Id); |
| | | //å
¨é¨å 餿å |
| | | return removeByIds(idList); |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | YSY_AccessTokenDto accessTokenDto = JSON.parseObject(s, YSY_AccessTokenDto.class); |
| | | |
| | | //äºæ¬¡è·å |
| | | if(accessTokenDto == null){ |
| | | if (accessTokenDto == null) { |
| | | log.error("è·åæå头token失败,æ ¼å¼æè¯¯!"); |
| | | s = HttpUtil.post(YSY_URL + ACCESSTOKEN_URL, paramMap); |
| | | accessTokenDto = JSON.parseObject(s, YSY_AccessTokenDto.class); |
| | |
| | | import com.sandu.ximon.dao.mapper.PoleBindingMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean bindPole(Long poleId, PoleBindingParam param) { |
| | | Integer deviceType = param.getDeviceType(); |
| | | |
| | |
| | | return updateById(update); |
| | | } |
| | | |
| | | public boolean deleteGroup(Long groupId) { |
| | | PoleGroup poleGroup = getById(groupId); |
| | | if (poleGroup == null) { |
| | | public boolean deleteGroup(List<Long> groupIds) { |
| | | List<PoleGroup> poleGroups = listByIds(groupIds); |
| | | if (poleGroups.isEmpty()) { |
| | | throw new BusinessException("æªæ¾å°è¯¥åç»"); |
| | | } |
| | | /** |
| | | * åªé¤ |
| | | */ |
| | | poleGroupRelationService.remove(Wrappers.lambdaQuery(PoleGroupRelation.class).eq(PoleGroupRelation::getPoleGroupId, groupId)); |
| | | return removeById(groupId); |
| | | poleGroupRelationService.remove(Wrappers.lambdaQuery(PoleGroupRelation.class).in(PoleGroupRelation::getPoleGroupId, groupIds)); |
| | | return removeByIds(groupIds); |
| | | } |
| | | |
| | | public List<PoleGroup> groupList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) { |
| | |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.io.File; |
| | |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void savePoleLightemit(PoleLightemitEntity poleLightemit) { |
| | | boolean save = this.save(poleLightemit); |
| | | // ç»å®ç¯æ |
| | |
| | | if (save && poleLightemit.getStreetlightId() != null) { |
| | | PoleBindingParam poleBindingParam = new PoleBindingParam(); |
| | | poleBindingParam.setDeviceCode(poleLightemit.getLightemitControlCode()); |
| | | poleBindingParam.setDeviceType(1); |
| | | poleBindingParam.setDeviceType(10); |
| | | poleBindingParam.setDeviceName(poleLightemit.getLightemitName()); |
| | | poleBindingService.bindPole(poleLightemit.getStreetlightId(), poleBindingParam); |
| | | |
| | | if (SpringContextHolder.getBean(PoleService.class).getById(poleLightemit.getStreetlightId()) == null) { |
| | | throw new BusinessException("ç¯æä¸åå¨"); |
| | | } |
| | | boolean b = poleBindingService.bindPole(poleLightemit.getStreetlightId(), poleBindingParam); |
| | | } |
| | | |
| | | /** |
| | |
| | | public boolean deletePoleLightemit(List<Long> ledIds) { |
| | | |
| | | List<PoleLightemitEntity> poleLightemitEntities = listByIds(ledIds); |
| | | if (poleLightemitEntities != null && poleLightemitEntities.size() != 0) { |
| | | if (poleLightemitEntities != null && poleLightemitEntities.size() == 0) { |
| | | throw new BusinessException("设å¤ä¸åå¨"); |
| | | } |
| | | |
| | |
| | | /** |
| | | * å é¤ç¯æ |
| | | */ |
| | | public boolean deletePole(Long poleId) { |
| | | Pole pole = getById(poleId); |
| | | if (pole == null) { |
| | | public boolean deletePole(List<Long> poleIds) { |
| | | List<Pole> poles = listByIds(poleIds); |
| | | if (poles.isEmpty()) { |
| | | throw new BusinessException("æªæ¾å°è¯¥ç¯æ"); |
| | | } |
| | | // å é¤ç¯æç»å®å
³ç³» |
| | | poleBindingService.remove(Wrappers.<PoleBinding>lambdaQuery().eq(PoleBinding::getPoleId, poleId)); |
| | | poleBindingService.remove(Wrappers.<PoleBinding>lambdaQuery().in(PoleBinding::getPoleId, poleIds)); |
| | | SpringContextHolder.getBean(LightTaskPoleRelationService.class) |
| | | .remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getPoleId, poleId)); |
| | | .remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, poleIds)); |
| | | |
| | | /** |
| | | * å é¤ç¯ææ¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "{ç¯æCodeï¼" + pole.getDeviceCode() + "ï¼ ç¯æåç§°ï¼" + pole.getPoleName() + " }"; |
| | | String content = "{ç¯æidï¼" + poles + " }"; |
| | | |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "å é¤ç¯æ", content); |
| | | /** |
| | | * å é¤ç¯ææ¥å¿è®°å½ç»æ |
| | | */ |
| | | return removeById(poleId); |
| | | return removeByIds(poleIds); |
| | | } |
| | | |
| | | |
| | |
| | | return updateResult; |
| | | } |
| | | |
| | | public boolean deleteProgram(Long pid) { |
| | | PoleXixunPlayerEntity byId = getById(pid); |
| | | if (byId == null) { |
| | | public boolean deleteProgram(List<Long> pids) { |
| | | List<PoleXixunPlayerEntity> poleXixunPlayerEntities = listByIds(pids); |
| | | if (poleXixunPlayerEntities.isEmpty()) { |
| | | throw new BusinessException("æªæ¾å°è¯¥èç®"); |
| | | } |
| | | /** |
| | | * çæ±èç®å 餿¥å¿è®°å½å¼å§ |
| | | */ |
| | | String content = "{å é¤çèç®idï¼" + byId.getProgramId() |
| | | + "ï¼ å é¤çèç®åç§°ï¼" + byId.getProgramName() |
| | | String content = "{å é¤çèç®idï¼" + pids |
| | | + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "çæ±èç®å é¤", content); |
| | | /** |
| | | * çæ±èç®å 餿¥å¿è®°å½ç»æ |
| | | */ |
| | | return removeById(pid); |
| | | return removeByIds(pids); |
| | | } |
| | | |
| | | public Object getByPid(Long pid) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils; |
| | | |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.SupplementUtils; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | |
| | | public class Base64Util { |
| | | |
| | | /** |
| | | * å°äºè¿å¶æ°æ®ç¼ç 为BASE64å符串 |
| | | * @param binaryData |
| | | * @return |
| | | */ |
| | | public static String encode(byte[] binaryData) { |
| | | try { |
| | | return new String(Base64.encodeBase64(binaryData)); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å°BASE64å符串æ¢å¤ä¸ºäºè¿å¶æ°æ® |
| | | * @param base64String |
| | | * @return |
| | | */ |
| | | public static byte[] decode(String base64String) { |
| | | try { |
| | | return Base64.decodeBase64(base64String.getBytes()); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | // public static void main(String[] args) { |
| | | // byte[] bytes = "/qUBAAv+AQAD//8yjUBF9xgeI0U=".getBytes(); |
| | | // byte[] bytes1 = Base64.decodeBase64(bytes); |
| | | // System.out.println(SupplementUtils.bytesToHexString(bytes1)); |
| | | // } |
| | | |
| | | |
| | | public static String toBase64Frame (String hexStr) { |
| | | // BigInteger bigInteger = new BigInteger(hexStr, 16); // æ¤æ¹å¼ä¼äº§ç头é¨å¤åºç©ºçä¸åè |
| | | // byte[] bytes = bigInteger.toByteArray(); |
| | | // System.out.println("origin:"+hexStr); |
| | | byte[] bytes = SupplementUtils.hexStringToBytes(hexStr); |
| | | String base64 = encode(bytes); |
| | | return base64; |
| | | } |
| | | } |