From cd086cf692a2d19d3f4fd2758c29273648e17ca6 Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期一, 28 二月 2022 15:17:40 +0800
Subject: [PATCH] 功能完善

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/Task.java           |   44 ++++
 ximon-admin/src/main/java/com/sandu/ximon/admin/param/LEDScheduleParam_xixun.java |   45 ++++
 dao/src/main/java/com/sandu/ximon/dao/domain/PoleXixunPlayerEntity.java           |    1 
 dao/src/main/resources/mapper/LedScheduleEntityMapper.xml                         |   27 ++
 ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java   |  145 ++++++++++++++
 dao/src/main/resources/mapper/PoleXixunPlayerEntityMapper.xml                     |    1 
 dao/src/main/java/com/sandu/ximon/dao/domain/LedScheduleEntity.java               |   79 +++++++
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedScheduleService.java   |  133 +++++++++++++
 ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/TaskSchedules.java  |   16 +
 ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java         |    8 
 ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/GetVolume.java      |    7 
 ximon-admin/src/main/java/com/sandu/ximon/admin/param/SetVolumeParam.java         |   17 +
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java   |    5 
 dao/src/main/java/com/sandu/ximon/dao/mapper/LedScheduleEntityMapper.java         |   17 +
 ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/Schedules.java      |   33 +++
 15 files changed, 567 insertions(+), 11 deletions(-)

diff --git a/dao/src/main/java/com/sandu/ximon/dao/domain/LedScheduleEntity.java b/dao/src/main/java/com/sandu/ximon/dao/domain/LedScheduleEntity.java
new file mode 100644
index 0000000..b39d7af
--- /dev/null
+++ b/dao/src/main/java/com/sandu/ximon/dao/domain/LedScheduleEntity.java
@@ -0,0 +1,79 @@
+package com.sandu.ximon.dao.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+
+/**
+ * led鐔欒浠诲姟琛�
+ * @TableName led_schedule_xixun
+ */
+@TableName(value ="led_schedule_xixun")
+@Data
+public class LedScheduleEntity implements Serializable {
+    /**
+     * 
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 
+     */
+    private Long userId;
+
+    /**
+     * 
+     */
+    private Long clientId;
+
+    /**
+     * 寮�濮嬫椂闂�
+     */
+    private String startTime;
+
+    /**
+     * 缁撴潫鏃堕棿
+     */
+    private String endTime;
+
+    /**
+     * 寮�濮嬫椂鏈�
+     */
+    private String startDate;
+
+    /**
+     * 缁撴潫鏃ユ湡
+     */
+    private String endDate;
+
+    /**
+     * 浠诲姟鍚嶇О
+     */
+    private String name;
+
+    /**
+     * 鍒涘缓鏃堕棿
+     */
+    private LocalDateTime createDate;
+
+    /**
+     * 浠诲姟鏁版嵁
+     */
+    @JsonIgnore
+    private String schedule;
+
+    /**
+     * 
+     */
+    private String week;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/dao/src/main/java/com/sandu/ximon/dao/domain/PoleXixunPlayerEntity.java b/dao/src/main/java/com/sandu/ximon/dao/domain/PoleXixunPlayerEntity.java
index cfaa48e..e5c60ef 100644
--- a/dao/src/main/java/com/sandu/ximon/dao/domain/PoleXixunPlayerEntity.java
+++ b/dao/src/main/java/com/sandu/ximon/dao/domain/PoleXixunPlayerEntity.java
@@ -63,6 +63,7 @@
      * 
      */
     private Long createUserId;
+    private Long clientId;
 
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
diff --git a/dao/src/main/java/com/sandu/ximon/dao/mapper/LedScheduleEntityMapper.java b/dao/src/main/java/com/sandu/ximon/dao/mapper/LedScheduleEntityMapper.java
new file mode 100644
index 0000000..a1002a9
--- /dev/null
+++ b/dao/src/main/java/com/sandu/ximon/dao/mapper/LedScheduleEntityMapper.java
@@ -0,0 +1,17 @@
+package com.sandu.ximon.dao.mapper;
+
+import com.sandu.ximon.dao.domain.LedScheduleEntity;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Entity com.sandu.ximon.dao.domain.LedScheduleEntity
+ */
+@Mapper
+public interface LedScheduleEntityMapper extends BaseMapper<LedScheduleEntity> {
+
+}
+
+
+
+
diff --git a/dao/src/main/resources/mapper/LedScheduleEntityMapper.xml b/dao/src/main/resources/mapper/LedScheduleEntityMapper.xml
new file mode 100644
index 0000000..293be17
--- /dev/null
+++ b/dao/src/main/resources/mapper/LedScheduleEntityMapper.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sandu.ximon.dao.mapper.LedScheduleEntityMapper">
+
+    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LedScheduleEntity">
+            <id property="id" column="id" jdbcType="INTEGER"/>
+            <result property="userId" column="user_id" jdbcType="BIGINT"/>
+            <result property="clientId" column="client_id" jdbcType="BIGINT"/>
+            <result property="startTime" column="start_time" jdbcType="VARCHAR"/>
+            <result property="endTime" column="end_time" jdbcType="VARCHAR"/>
+            <result property="startDate" column="start_date" jdbcType="VARCHAR"/>
+            <result property="endDate" column="end_date" jdbcType="VARCHAR"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="schedule" column="schedule" jdbcType="VARCHAR"/>
+            <result property="week" column="week" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,user_id,client_id,
+        start_time,end_time,start_date,
+        end_date,name,create_date,
+        schedule,week
+    </sql>
+</mapper>
diff --git a/dao/src/main/resources/mapper/PoleXixunPlayerEntityMapper.xml b/dao/src/main/resources/mapper/PoleXixunPlayerEntityMapper.xml
index 156650e..a329766 100644
--- a/dao/src/main/resources/mapper/PoleXixunPlayerEntityMapper.xml
+++ b/dao/src/main/resources/mapper/PoleXixunPlayerEntityMapper.xml
@@ -14,6 +14,7 @@
             <result property="requestBody" column="request_body" jdbcType="VARCHAR"/>
             <result property="creatTime" column="creat_time" jdbcType="TIMESTAMP"/>
             <result property="createUserId" column="create_user_id" jdbcType="BIGINT"/>
+            <result property="clientId" column="client_id" jdbcType="BIGINT"/>
     </resultMap>
 
     <sql id="Base_Column_List">
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
index f3852ec..dc22ad0 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
@@ -4,27 +4,29 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.api.R;
 import com.github.pagehelper.PageHelper;
 import com.sandu.common.domain.ResponseVO;
 import com.sandu.common.execption.BusinessException;
 import com.sandu.common.object.BaseConditionVO;
 import com.sandu.common.util.ResponseUtil;
 import com.sandu.ximon.admin.entity.ProgramPro;
+import com.sandu.ximon.admin.param.LEDScheduleParam_xixun;
+import com.sandu.ximon.admin.param.SetVolumeParam;
 import com.sandu.ximon.admin.security.SecurityUtils;
 import com.sandu.ximon.admin.service.ClientService;
+import com.sandu.ximon.admin.service.LedScheduleService;
 import com.sandu.ximon.admin.service.PoleLightemitService;
 import com.sandu.ximon.admin.service.XiXunPlayerService;
 import com.sandu.ximon.admin.utils.LightemitUtils;
-import com.sandu.ximon.dao.domain.LedPlayerEntity;
-import com.sandu.ximon.dao.domain.PlayPlanNv;
 import com.sandu.ximon.dao.domain.PoleLightemitEntity;
 import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
 import com.sandu.ximon.dao.enums.AdministratorEnums;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Date;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -41,21 +43,63 @@
     private final ClientService clientService;
     private final PoleLightemitService poleLightemitService;
     private final LightemitUtils lightemitUtils;
+    private final LedScheduleService scheduleService;
 
+    /**
+     * 鏂板鑺傜洰
+     * @param programPro
+     * @return
+     */
     @PostMapping("/addProgram")
     public ResponseVO<Object> addProgram(@RequestBody ProgramPro programPro){
        return ResponseUtil.success(xiXunPlayerService.insert(programPro));
     }
 
+    /**
+     * 淇敼
+     */
+    @PostMapping("/updateProgram")
+   // @RequiresPermissions("pole:polexixunplayer:update")
+    public ResponseVO<Object> update(@RequestBody ProgramPro programPro){
+        PoleXixunPlayerEntity byId = xiXunPlayerService.getById(programPro.getProgramId());
+        if(byId==null){
+            throw  new BusinessException("鍙傛暟閿欒");
+        }
+//        QueryWrapper<PoleXixunPlayerEntity> queryWrapper = new QueryWrapper<>();
+//        queryWrapper.eq("program_code", programPro.get_id());
+        boolean insert=false;
+        if(xiXunPlayerService.removeById(programPro.getProgramId())){
+             insert = xiXunPlayerService.insert(programPro);
+        };
+        return  ResponseUtil.success(insert);
+    }
+
+    /**
+     * 鍒犻櫎鑺傜洰
+     * @param pid
+     * @return
+     */
     @PostMapping("/deleteProgram/{pid}")
     public ResponseVO<Object> deleteProgram(@PathVariable Long pid){
         return ResponseUtil.success(xiXunPlayerService.deleteProgram(pid));
     }
 
+    /**
+     * 鑾峰彇鑺傜洰璇︽儏
+     * @param pid
+     * @return
+     */
     @GetMapping("/getByPid/{pid}")
     public ResponseVO<Object> getByPid(@PathVariable Long pid){
         return ResponseUtil.success(xiXunPlayerService.getByPid(pid));
     }
+
+    /**
+     * 鑺傜洰鍒楄〃
+     * @param baseConditionVO
+     * @param keyword
+     * @return
+     */
     @GetMapping("/list")
     public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
         PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
@@ -86,12 +130,23 @@
     }
 
 
+    /**
+     * 鑺傜洰鎺ㄩ��
+     * @param pid
+     * @param lightemitIds
+     * @return
+     */
     @GetMapping("/pushToXixun/{pid}")
     public ResponseVO<Object> getByPid(@PathVariable Long pid, @RequestBody List<Long> lightemitIds ){
         xiXunPlayerService.videoXixunPlayer(pid,lightemitIds);
         return ResponseUtil.success("鎺ㄩ�佹垚鍔�");
     }
 
+    /**
+     * LED灞忓箷鏂板
+     * @param poleLightemit
+     * @return
+     */
     @PostMapping("/saveLed")
     public ResponseVO<Object> save(@RequestBody PoleLightemitEntity poleLightemit){
         int count = poleLightemitService.count(new QueryWrapper<PoleLightemitEntity>().eq("lightemit_control_code", poleLightemit.getLightemitControlCode()));
@@ -107,12 +162,23 @@
         return ResponseUtil.success("鏂板鎴愬姛");
     }
 
+    /**
+     * LED灞忓箷淇敼
+     * @param ledId
+     * @param poleLightemit
+     * @return
+     */
     @PostMapping("/updateLed/{ledId}")
     public ResponseVO<Object> updatePoleLightemit(@PathVariable Long ledId,@RequestBody PoleLightemitEntity poleLightemit){
         poleLightemitService.updatePoleLightemit(ledId,poleLightemit);
         return ResponseUtil.success("淇敼鎴愬姛");
     }
 
+    /**
+     * LED灞忓箷鍒犻櫎
+     * @param ledIds
+     * @return
+     */
     @PostMapping("/deleteLed")
     public ResponseVO<Object> deleteLed(@RequestBody List<Long> ledIds){
         boolean b = poleLightemitService.deletePoleLightemit(ledIds);
@@ -123,7 +189,12 @@
         }
     }
 
-
+    /**
+     * LED灞忓箷鍒楄〃
+     * @param baseConditionVO
+     * @param keyword
+     * @return
+     */
     @GetMapping("/listLed")
     public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
         PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
@@ -162,4 +233,68 @@
             throw new BusinessException("鏈�夋嫨LED灞�");
         }
     }
+
+    /*
+  鑾峰彇闊抽噺
+   */
+    @GetMapping("/getVolume/{id}")
+    public ResponseVO<Object> getVolume(@PathVariable Long id){
+        if(id == null){
+            throw new BusinessException("鏈�夋嫨LED灞�");
+        }
+        PoleLightemitEntity poleLightemitEntity = poleLightemitService.getById(id);
+        if(poleLightemitEntity != null){
+            String result = lightemitUtils.getVoiume(poleLightemitEntity.getLightemitControlCode());
+            return ResponseUtil.success(result);
+        }else {
+            throw new BusinessException("鏈�夋嫨LED灞�");
+        }
+    }
+
+
+    /*
+  璁剧疆闊抽噺
+   */
+    @GetMapping("/setVolume")
+    public ResponseVO<Object> setVolume(@RequestBody SetVolumeParam setVolumeEntity){
+
+        if(setVolumeEntity == null || setVolumeEntity.getIds() == null || setVolumeEntity.getVolume() > 15){
+            throw new BusinessException("鍙傛暟閿欒");
+        }
+
+        Collection poleLightemitControllers = poleLightemitService.listByIds(Arrays.asList(setVolumeEntity.getIds()));
+        if (!poleLightemitControllers.isEmpty()) {
+            Iterator iterator = poleLightemitControllers.iterator();
+            while (iterator.hasNext()) {
+                PoleLightemitEntity poleLightemitEntity = (PoleLightemitEntity) iterator.next();
+                poleLightemitService.setVolume(poleLightemitEntity.getLightemitControlCode(), setVolumeEntity.getVolume());
+            }
+            return ResponseUtil.success("璁剧疆闊抽噺鎴愬姛");
+        }else {
+            throw new BusinessException("鏈�夋嫨LED灞�");
+        }
+    }
+
+    @PostMapping("/addSchedule")
+    public ResponseVO<Object> addSchedule(@RequestBody LEDScheduleParam_xixun ledEntity){
+        return ResponseUtil.success(scheduleService.insert(ledEntity));
+    }
+
+    @PostMapping("/updateSchedule")
+    public ResponseVO<Object> updateSchedule(@RequestBody LEDScheduleParam_xixun ledEntity){
+        return ResponseUtil.success(scheduleService.updateSchedule(ledEntity));
+    }
+
+    @GetMapping("/getSchedule/{id}")
+    public ResponseVO<Object> getSchedule(@PathVariable Integer id){
+        return ResponseUtil.success(scheduleService.getSchedule(id));
+    }
+
+    @GetMapping("/pushSchedule/{id}")
+    public ResponseVO<Object> pushSchedule(@PathVariable Integer id,@RequestBody Long[] lightemitIds){
+        scheduleService.ledschedulepush(id,lightemitIds);
+        return ResponseUtil.success("璁剧疆鎴愬姛");
+    }
+
+
 }
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/param/LEDScheduleParam_xixun.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/param/LEDScheduleParam_xixun.java
new file mode 100644
index 0000000..5335e1e
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/param/LEDScheduleParam_xixun.java
@@ -0,0 +1,45 @@
+package com.sandu.ximon.admin.param;
+
+import lombok.Data;
+
+@Data
+public class LEDScheduleParam_xixun {
+
+    private Integer id;
+    /**
+     *
+     */
+    private Long userId;
+    /**
+     *
+     */
+    private String startTime;
+    /**
+     *
+     */
+    private String endTime;
+    /**
+     *
+     */
+    private String startDate;
+    /**
+     *
+     */
+    private String endDate;
+    /**
+     *
+     */
+    private String name;
+    /**
+     *
+     */
+    private String createDate;
+    /**
+     *
+     */
+    private String schedule;
+    /**
+     *
+     */
+    private Integer week[];
+}
\ No newline at end of file
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/param/SetVolumeParam.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/param/SetVolumeParam.java
new file mode 100644
index 0000000..c08b2f5
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/param/SetVolumeParam.java
@@ -0,0 +1,17 @@
+package com.sandu.ximon.admin.param;
+
+import lombok.Data;
+
+/**
+ * @program: machine-fast
+ * @description: 璁剧疆闊抽噺鎺ユ敹绫�
+ * @author: YSS
+ * @create: 2019-09-18 10:46
+ **/
+@Data
+public class SetVolumeParam {
+
+    private Long[] ids;
+
+    private Integer volume;
+}
\ No newline at end of file
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedScheduleService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedScheduleService.java
new file mode 100644
index 0000000..6acaf6d
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedScheduleService.java
@@ -0,0 +1,133 @@
+package com.sandu.ximon.admin.service;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.sandu.common.execption.BusinessException;
+import com.sandu.common.service.impl.BaseServiceImpl;
+import com.sandu.ximon.admin.config.RealtimeServerBean;
+import com.sandu.ximon.admin.param.LEDScheduleParam_xixun;
+import com.sandu.ximon.admin.security.SecurityUtils;
+import com.sandu.ximon.admin.utils.LightemitUtils;
+import com.sandu.ximon.admin.utils.request.Schedules;
+import com.sandu.ximon.admin.utils.request.Task;
+import com.sandu.ximon.admin.utils.request.TaskSchedules;
+import com.sandu.ximon.dao.domain.LedScheduleEntity;
+import com.sandu.ximon.dao.domain.PoleLightemitEntity;
+import com.sandu.ximon.dao.mapper.LedScheduleEntityMapper;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+/**
+ * @Author liuhaonan
+ * @Date 2022/2/28 13:45
+ * @Version 1.0
+ */
+@Service
+@AllArgsConstructor
+public class LedScheduleService extends BaseServiceImpl<LedScheduleEntityMapper, LedScheduleEntity> {
+
+    private final LedScheduleEntityMapper ledScheduleEntityMapper;
+    private final ClientService clientService;
+    private final PoleLightemitService poleLightemitService;
+    private final LightemitUtils lightemitUtils;
+    private final RealtimeServerBean realtimeServerBean;
+
+
+    public boolean insert(LEDScheduleParam_xixun ledEntity) {
+        LedScheduleEntity ledScheduleEntity = new LedScheduleEntity();
+        BeanUtil.copyProperties(ledEntity,ledScheduleEntity);
+        ledScheduleEntity.setUserId(SecurityUtils.getClientId());
+        Schedules schedules = new Schedules();
+        Task task = new Task();
+        TaskSchedules taskSchedules = new TaskSchedules();
+        if(ledEntity.getStartTime() =="" || ledEntity.getEndTime() == "" || ledEntity.getStartTime() == null || ledEntity.getEndTime() ==null ){
+            schedules.setTimeType("All");
+        }else {
+            schedules.setTimeType("Range");
+            schedules.setStartTime(ledEntity.getStartTime());
+            schedules.setEndTime(ledEntity.getEndTime());
+        }
+        if(ledEntity.getStartDate() =="" || ledEntity.getEndDate() == "" || ledEntity.getStartDate() == null || ledEntity.getEndDate() ==null ){
+            schedules.setDateType("All");
+        }else {
+            schedules.setDateType("Range");
+            schedules.setStartDate(ledEntity.getStartDate());
+            schedules.setEndDate(ledEntity.getEndDate());
+        }
+        if(ledEntity.getWeek().length != 0){
+            schedules.setFilterType("Week");
+            schedules.setWeekFilter(ledEntity.getWeek());
+        }else {
+            schedules.setFilterType("None");
+        }
+        List list =new ArrayList();
+        list.add(schedules);
+        task.setSchedules(list);
+        task.setCreateDate(ledEntity.getCreateDate());
+        task.setDateCreated(ledEntity.getCreateDate());
+        String id = UUID.randomUUID().toString();
+        task.set_id(id);
+        task.setId(id);
+        task.set_departmentd(UUID.randomUUID().toString());
+        task.set_role(UUID.randomUUID().toString());
+        task.setName(ledEntity.getName());
+        taskSchedules.setTask(task);
+
+        String json = JSON.toJSONString(taskSchedules, SerializerFeature.WriteMapNullValue);
+//         String json = new Gson().toJson(taskSchedules);
+        ledScheduleEntity.setSchedule(json);
+       return this.save(ledScheduleEntity);
+    }
+
+
+    /**
+     * 瀹氭椂鎺ㄩ��
+     * @param scheduleId
+     * @param lightemitIds
+     */
+    public void ledschedulepush(Integer scheduleId, Long[] lightemitIds) {
+
+        LedScheduleEntity ledScheduleEntity = baseMapper.selectById(scheduleId);
+//        SendCommand sendCommand = new SendCommand();
+//        sendCommand.setTask(ledScheduleEntity.getSchedule());
+//        String json = new Gson().toJson(sendCommand);
+        Collection<PoleLightemitEntity> poleLightemitEntities = poleLightemitService.listByIds(Arrays.asList(lightemitIds));
+
+        if(poleLightemitEntities != null){
+            for (PoleLightemitEntity entity: poleLightemitEntities) {
+                lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), ledScheduleEntity.getSchedule());
+            }
+        }
+    }
+
+    public boolean updateSchedule(LEDScheduleParam_xixun paramXixun){
+        if(paramXixun.getId()==null){
+            throw new BusinessException("鍙傛暟閿欒");
+        }
+        LedScheduleEntity byId = getById(paramXixun.getId());
+        if(byId==null){
+            throw new BusinessException("鏈壘鍒拌瀹氭椂鏁版嵁");
+        }
+        boolean result=false;
+       if( removeById(paramXixun.getId())){
+           result =  insert(paramXixun);
+       }
+       return result;
+    }
+
+    public LedScheduleEntity getSchedule(Integer id){
+        if(id==null){
+            throw new BusinessException("鍙傛暟閿欒");
+        }
+        LedScheduleEntity byId = getById(id);
+        if(byId==null){
+            throw new BusinessException("鏈壘鍒拌瀹氭椂鏁版嵁");
+        }
+       //List<Map> schedule = JSON.parseArray(byId.getSchedule(), List.class);
+        return byId;
+    }
+
+}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
index e125127..3fe82b5 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
@@ -48,6 +48,8 @@
         poleXixunPlayer.setHeight(programPro.getHeight());
         poleXixunPlayer.setWidth(programPro.getWidth());
         poleXixunPlayer.setTotalSize((float) programPro.getTotalSize() / 1000000 + "MB");
+//        programPro.setProgramId(poleXixunPlayer.getProgramId());
+//        System.out.println(poleXixunPlayer.getProgramId());
         poleXixunPlayer.setRequestBody(json);
         //  poleXixunPlayer.setCreatTime(sdf.format(date));
         poleXixunPlayer.setCreateUserId(SecurityUtils.getClientId());
@@ -72,6 +74,7 @@
         ProgramPro programPro = new ProgramPro();
         try {
             programPro = JsonUtil.convertJsonStringToObject(json, ProgramPro.class);
+            programPro.setProgramId(pid);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -92,7 +95,7 @@
         poleXixunPlayerEntity = this.getOne(queryWrapper);
         String json = poleXixunPlayerEntity.getRequestBody();
 
-        System.out.println( JSON.parseArray(json, ProgramPro.class));
+//        System.out.println( JSON.parseArray(json, ProgramPro.class));
 
         try {
             pro = JsonUtil.convertJsonStringToObject(json, ProgramPro.class);
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java
index 89038bc..c4e4bf3 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/LightemitUtils.java
@@ -334,12 +334,11 @@
 
         //璇锋眰
         String result = post(realtimeServerBean.getCommand() + ledCode, postBody);
+        LogUtils.error("璁剧疆缁撴灉:-------------------"+result);
     }
 
-    /*
-    鑾峰彇led闊抽噺
-     */
-    /*public String getVoiume(String ledCode){
+//    鑾峰彇led闊抽噺
+    public String getVoiume(String ledCode){
         GetVolume getVolume = new GetVolume();
         String postBody = new Gson().toJson(getVolume);
 
@@ -356,7 +355,6 @@
             return "0";
         }
     }
-*/
 
     /**
      * 鏌ヨ瀹氭椂
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/GetVolume.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/GetVolume.java
new file mode 100644
index 0000000..6d82a5e
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/GetVolume.java
@@ -0,0 +1,7 @@
+package com.sandu.ximon.admin.utils.request;
+
+public class GetVolume {
+    public final String type = "callCardService";
+
+    public final String fn = "getVolume";
+}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/Schedules.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/Schedules.java
new file mode 100644
index 0000000..80b59c7
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/Schedules.java
@@ -0,0 +1,33 @@
+package com.sandu.ximon.admin.utils.request;
+
+import lombok.Data;
+
+/**
+ * @program: server1
+ * @description: 瀹氭椂寮�鍏砽ed灞忓箷
+ * @author: YSS
+ * @create: 2020-07-29 15:19
+ **/
+@Data
+public class Schedules {
+
+    private String lng = "zh-CN";
+
+    private Integer monthFilter[] = {};
+
+    private Integer weekFilter[] = {};
+
+    private String filterType;
+
+    private String endTime;
+
+    private String startTime;
+
+    private String timeType = "Range";
+
+    private String endDate ;
+
+    private String startDate;
+
+    private String dateType;
+}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/Task.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/Task.java
new file mode 100644
index 0000000..f411027
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/Task.java
@@ -0,0 +1,44 @@
+package com.sandu.ximon.admin.utils.request;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @program: server1
+ * @description: 瀹氭椂浠诲姟
+ * @author: YSS
+ * @create: 2020-07-29 14:31
+ **/
+@Data
+public class Task {
+
+    private String createBy = "check";
+
+    private String createDate;
+
+    private String dateCreated;
+
+    private String id;
+
+    private String lng = "zh-CN";
+
+    private String name;
+
+    private List<Schedules> schedules;
+//    private  Schedules schedules;
+
+    private String _id;
+
+    private String _company = "alahover";
+
+    private String _departmentd;
+
+    private String _role;
+
+    private String _user = "check";
+
+    private Integer _v = 0;
+
+
+}
\ No newline at end of file
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/TaskSchedules.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/TaskSchedules.java
new file mode 100644
index 0000000..64fc226
--- /dev/null
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/utils/request/TaskSchedules.java
@@ -0,0 +1,16 @@
+package com.sandu.ximon.admin.utils.request;
+
+import lombok.Data;
+
+/**
+ * @program: server1
+ * @description: 瀹氭椂鎺ㄩ�佺被
+ * @author: YSS
+ * @create: 2020-07-29 14:20
+ **/
+@Data
+public class TaskSchedules {
+    private String  type = "timedScreening";
+
+    private Task task;
+}

--
Gitblit v1.9.3