2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-04-18 66080a0b82181aaa567e8080ee2b82315b840930
节目列表
已修改6个文件
163 ■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/domain/LEDProgram.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/LEDProgramMapper.xml 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LEDProgramController.java 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/domain/LEDProgram.java
@@ -4,30 +4,38 @@
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 lombok.Data;
/**
 * LED节目表
 *
 * @TableName led_program
 */
@TableName(value ="led_program")
@TableName(value = "led_program")
@Data
public class LEDProgram implements Serializable {
    /**
     *
     *
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     *
     *
     */
    private Long userId;
    /**
     *
     *
     */
    private Long clientId;
    /**
     *
     */
    private String userName;
@@ -62,12 +70,12 @@
    private Integer kind;
    /**
     *
     *
     */
    private LocalDateTime createTime;
    /**
     *
     *
     */
    private LocalDateTime updateTime;
dao/src/main/resources/mapper/LEDProgramMapper.xml
@@ -5,17 +5,18 @@
<mapper namespace="com.sandu.ximon.dao.mapper.LEDProgramMapper">
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LEDProgram">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="userId" column="user_id" jdbcType="BIGINT"/>
            <result property="userName" column="user_name" jdbcType="VARCHAR"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="preview" column="preview" jdbcType="VARCHAR"/>
            <result property="width" column="width" jdbcType="INTEGER"/>
            <result property="height" column="height" jdbcType="INTEGER"/>
            <result property="pages" column="pages" jdbcType="VARCHAR"/>
            <result property="kind" column="kind" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
        <id property="id" column="id" jdbcType="BIGINT"/>
        <result property="userId" column="user_id" jdbcType="BIGINT"/>
        <result property="clientId" column="client_id" jdbcType="BIGINT"/>
        <result property="userName" column="user_name" jdbcType="VARCHAR"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="preview" column="preview" jdbcType="VARCHAR"/>
        <result property="width" column="width" jdbcType="INTEGER"/>
        <result property="height" column="height" jdbcType="INTEGER"/>
        <result property="pages" column="pages" jdbcType="VARCHAR"/>
        <result property="kind" column="kind" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <sql id="Base_Column_List">
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LEDProgramController.java
@@ -54,35 +54,35 @@
        }
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        LambdaQueryWrapper<LEDProgram> wrapper = ledProgramService.listProgram();
        if (null != keyword) {
        if (!keyword.isEmpty()) {
            wrapper.like(LEDProgram::getName, keyword);
        }
        return ResponseUtil.successPage(ledProgramService.list(wrapper));
    }
    /**
     * 模糊查询
     *
     * @return
     */
    @GetMapping("/listLike")
    public ResponseVO<Object> listLikeProgram(@RequestBody ReceiveParam receiveParam) {
        LambdaQueryWrapper<LEDProgram> wrapper = ledProgramService.listProgram();
        if (receiveParam.getKind() != null || receiveParam.getName() != null) {
            wrapper.like(LEDProgram::getName, receiveParam.getName())
                    .or(
                            ledProgramLambdaQueryWrapper -> {
                                ledProgramLambdaQueryWrapper.like(LEDProgram::getKind, receiveParam.getKind());
                            }
                    );
        }
        // List<LEDProgram> list = ledProgramService.list(wrapper);
        return ResponseUtil.success(ledProgramService.list(wrapper));
    }
//    /**
//     * 模糊查询
//     *
//     * @return
//     */
//    @GetMapping("/listLike")
//    public ResponseVO<Object> listLikeProgram(@RequestBody ReceiveParam receiveParam) {
//        LambdaQueryWrapper<LEDProgram> wrapper = ledProgramService.listProgram();
//        if (receiveParam.getKind() != null || receiveParam.getName() != null) {
//
//            wrapper.like(LEDProgram::getName, receiveParam.getName())
//                    .or(
//                            ledProgramLambdaQueryWrapper -> {
//                                ledProgramLambdaQueryWrapper.like(LEDProgram::getKind, receiveParam.getKind());
//                            }
//                    );
//
//        }
//
//        // List<LEDProgram> list = ledProgramService.list(wrapper);
//        return ResponseUtil.success(ledProgramService.list(wrapper));
//
//    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
@@ -115,31 +115,10 @@
        if (!permissionConfig.check(MenuEnum.LED_PROGRAM_LIST.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        LambdaQueryWrapper<PoleXixunPlayerEntity> wrapper = xiXunPlayerService.XixunPlayerList(keyword);
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        LambdaQueryWrapper<PoleXixunPlayerEntity> wrapper = Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).like(PoleXixunPlayerEntity::getProgramName, keyword);
//        if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())){
//            boolean clientId = clientService.findClientId();
//            if(clientId){
//                wrapper= wrapper.eq(PoleXixunPlayerEntity::getUserId,SecurityUtils.getUserId());
//            }
//            wrapper= wrapper.eq(PoleXixunPlayerEntity::getClientId,clientService.getClientId());
//        }
//        wrapper=Wrappers.lambdaQuery(PoleXixunPlayerEntity.class);
//        if(StrUtil.isNotBlank(keyword)){
//            wrapper.like(PoleXixunPlayerEntity::getLightemitName,keyword).or(
//                    lambdaQueryWrapper -> {
//                        lambdaQueryWrapper.like(PoleXixunPlayerEntity::getLightemitControlCode, keyword);
//                    }
//            );
//        }
//        return ResponseUtil.success(poleLightemitService.list(wrapper));
        if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) {
            return ResponseUtil.success(xiXunPlayerService.list(wrapper)); //  todo
        } else {
            return ResponseUtil.success(xiXunPlayerService.list(wrapper));
        }
        return ResponseUtil.success(xiXunPlayerService.list(wrapper));
    }
@@ -303,13 +282,11 @@
    }
    /**
     *
     *
     * @param
     * @return
     */
    @GetMapping("/getbycode")
  public ResponseVO<Object> getLedByLightControlCode(String lightemitControlCode) {
    public ResponseVO<Object> getLedByLightControlCode(String lightemitControlCode) {
        return ResponseUtil.success(poleLightemitService.getLedByLightControlCode(lightemitControlCode));
    }
@@ -471,8 +448,6 @@
        scheduleService.ledschedulepush(id, lightemitIds);
        return ResponseUtil.success("设置成功");
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java
@@ -19,7 +19,6 @@
public class LEDProgramService extends BaseServiceImpl<LEDProgramMapper, LEDProgram> {
    public boolean addProgram(LEDProgramParam receiveParam) {
        LEDProgram led = new LEDProgram();
@@ -36,7 +35,7 @@
    }
    public boolean updateProgram(Long pid,LEDProgramParam receiveParam) {
    public boolean updateProgram(Long pid, LEDProgramParam receiveParam) {
        LEDProgram byId = getById(pid);
        if (byId == null) {
@@ -70,7 +69,7 @@
        if (byId == null) {
            throw new BusinessException("未找到该节目");
        }
        LEDProgramParam param=new LEDProgramParam();
        LEDProgramParam param = new LEDProgramParam();
        param.setId(byId.getId());
        param.setHeight(byId.getHeight());
        param.setWidth(byId.getWidth());
@@ -82,11 +81,13 @@
    public LambdaQueryWrapper<LEDProgram> listProgram() {
        if (SecurityUtils.getClientId() != null) {
            return Wrappers.lambdaQuery(LEDProgram.class).eq(LEDProgram::getUserId, SecurityUtils.getClientId());
        } else {
        if (SecurityUtils.getClientId() == null) {
            return Wrappers.lambdaQuery(LEDProgram.class);
        } else {
            return Wrappers.lambdaQuery(LEDProgram.class).eq(LEDProgram::getUserId, SecurityUtils.getUserId())
                    .or(w -> {
                        w.eq(LEDProgram::getClientId, SecurityUtils.getClientId());
                    });
        }
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/XiXunPlayerService.java
@@ -1,6 +1,8 @@
package com.sandu.ximon.admin.service;
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.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.sandu.common.execption.BusinessException;
@@ -12,6 +14,7 @@
import com.sandu.ximon.admin.utils.JsonUtil;
import com.sandu.ximon.admin.utils.LightemitUtils;
import com.sandu.ximon.admin.utils.LogUtils;
import com.sandu.ximon.dao.domain.LEDProgram;
import com.sandu.ximon.dao.domain.LedSFile;
import com.sandu.ximon.dao.domain.PoleLightemitEntity;
import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
@@ -39,6 +42,29 @@
    private final ClientService clientService;
    private final LedSFileService xiXunFileService;
    //熙讯节目列表
    public LambdaQueryWrapper<PoleXixunPlayerEntity> XixunPlayerList(String keyword) {
        if (SecurityUtils.getClientId() == null) {
            if (keyword.isEmpty()) {
                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class);
            } else {
                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).like(PoleXixunPlayerEntity::getProgramName, keyword);
            }
        } else {
            if (keyword.isEmpty()) {
                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).eq(PoleXixunPlayerEntity::getCreateUserId, SecurityUtils.getUserId())
                        .or(w -> {
                            w.eq(PoleXixunPlayerEntity::getClientId, SecurityUtils.getClientId());
                        });
            } else {
                return Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).eq(PoleXixunPlayerEntity::getCreateUserId, SecurityUtils.getUserId())
                        .or(w -> {
                            w.eq(PoleXixunPlayerEntity::getClientId, SecurityUtils.getClientId());
                        }).like(PoleXixunPlayerEntity::getProgramName, keyword);
            }
        }
    }
    public boolean insert(ProgramPro programPro) {
        String json = JsonUtil.jsonObj2Sting(programPro);