Commit 2455866c authored by liqin's avatar liqin 💬

bug fixed

parent 900cda8c
package cn.wisenergy.chnmuseum.party.common.exception;
/**
* 封装fastdfs的异常,使用运行时异常
*
* @author yuqih
* @author tobato
*
*/
public abstract class FdfsException extends RuntimeException {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
protected FdfsException(String message) {
super(message);
}
/**
* @param message
* @param cause
*/
protected FdfsException(String message, Throwable cause) {
super(message, cause);
}
}
\ No newline at end of file
package cn.wisenergy.chnmuseum.party.common.exception;
/**
* 从Url解析StorePath文件路径对象错误
*
* @author wuyf
*
*/
public class FdfsUnsupportStorePathException extends FdfsException {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 8116336411011152869L;
public FdfsUnsupportStorePathException(String message) {
super(message);
}
}
\ No newline at end of file
package cn.wisenergy.chnmuseum.party.common.mvc; package cn.wisenergy.chnmuseum.party.common.mvc;
import cn.wisenergy.chnmuseum.party.common.enums.RESPONSE_CODE_ENUM; import cn.wisenergy.chnmuseum.party.common.enums.RESPONSE_CODE_ENUM;
import cn.wisenergy.chnmuseum.party.common.enums.RESULT_INFO_ENUM;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
...@@ -23,11 +24,14 @@ import org.springframework.web.bind.MethodArgumentNotValidException; ...@@ -23,11 +24,14 @@ import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.support.MissingServletRequestPartException;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import java.sql.SQLIntegrityConstraintViolationException; import java.sql.SQLIntegrityConstraintViolationException;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -202,6 +206,14 @@ public class GlobalExceptionAdvisor { ...@@ -202,6 +206,14 @@ public class GlobalExceptionAdvisor {
return httpResult; return httpResult;
} }
@ExceptionHandler(MissingServletRequestPartException.class)
public Object handleServletRequestPartException(MissingServletRequestPartException exception) {
Map<String, Object> map = new LinkedHashMap<>();
map.put(RESULT_INFO_ENUM.RESULT_CODE.getKey(), "400");
map.put(RESULT_INFO_ENUM.RESULT_MSG.getKey(), "请选择文件后点击上传");
return map;
}
/** /**
* 添加异常信息到map中 * 添加异常信息到map中
* *
......
...@@ -2,20 +2,22 @@ package cn.wisenergy.chnmuseum.party.common.video; ...@@ -2,20 +2,22 @@ package cn.wisenergy.chnmuseum.party.common.video;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.io.*; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@Slf4j @Slf4j
public class VideoEncryptUtil { public class VideoEncryptUtil {
private static final String plainFilePath = "D:\\200.tmp\\";
//此为AES128位,如果要求AES256位,需要更新jdk内的包,jdk8发布版本默认不支持 //此为AES128位,如果要求AES256位,需要更新jdk内的包,jdk8发布版本默认不支持
private static final String cipher = "3348c95c60520be7"; private static final String cipher = "3348c95c60520be7";
private static final int dataLength = 4096; private static final int dataLength = 4096;
public static void main(InputStream fis, String cipher) throws IOException { public static InputStream main(InputStream fis, String cipher) throws IOException {
final OutputStream[] outputStream = new OutputStream[1]; final ByteArrayOutputStream[] outputStream = new ByteArrayOutputStream[1];
AesCipherDataSink encryptingDataSink = new AesCipherDataSink("3348c95c60520be7".getBytes(StandardCharsets.UTF_8), AesCipherDataSink encryptingDataSink = new AesCipherDataSink(cipher.getBytes(StandardCharsets.UTF_8),
new DataSink() { new DataSink() {
@Override @Override
public void open() { public void open() {
...@@ -23,7 +25,7 @@ public class VideoEncryptUtil { ...@@ -23,7 +25,7 @@ public class VideoEncryptUtil {
} }
@Override @Override
public void write(byte[] buffer, int offset, int length) throws IOException { public void write(byte[] buffer, int offset, int length) {
outputStream[0].write(buffer, offset, length); outputStream[0].write(buffer, offset, length);
} }
...@@ -41,6 +43,7 @@ public class VideoEncryptUtil { ...@@ -41,6 +43,7 @@ public class VideoEncryptUtil {
encryptingDataSink.close(); encryptingDataSink.close();
fis.close(); fis.close();
log.info("加解密完成"); log.info("加解密完成");
return new ByteArrayInputStream(outputStream[0].toByteArray());
} }
} }
...@@ -10,6 +10,7 @@ import java.nio.charset.StandardCharsets; ...@@ -10,6 +10,7 @@ import java.nio.charset.StandardCharsets;
@Slf4j @Slf4j
public class VideoTestUtil { public class VideoTestUtil {
private static final String plainFilePath = "D:\\200.tmp\\"; private static final String plainFilePath = "D:\\200.tmp\\";
//此为AES128位,如果要求AES256位,需要更新jdk内的包,jdk8发布版本默认不支持 //此为AES128位,如果要求AES256位,需要更新jdk内的包,jdk8发布版本默认不支持
private static final String cipher = "3348c95c60520be7"; private static final String cipher = "3348c95c60520be7";
......
...@@ -35,7 +35,6 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo ...@@ -35,7 +35,6 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
@Select("SELECT t.* FROM " + @Select("SELECT t.* FROM " +
"(" + "(" +
"SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a " "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a "
+ "WHERE lcb.learning_content_id = lc.id " + "WHERE lcb.learning_content_id = lc.id "
+ "and lcb.exhibition_board_id = eb.id " + "and lcb.exhibition_board_id = eb.id "
...@@ -44,7 +43,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo ...@@ -44,7 +43,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
+ "and a.file_type = 'VIDEO' " + "and a.file_type = 'VIDEO' "
+ "and lc.applicable_scope = 'THIS_ORGAN' " + "and lc.applicable_scope = 'THIS_ORGAN' "
+ "and lc.organ_code = #{organCode} " + "and lc.organ_code = #{organCode} "
+ "UNION ALL " + "UNION "
+ "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, asset a " + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, asset a "
+ "WHERE lcb.learning_content_id = lc.id " + "WHERE lcb.learning_content_id = lc.id "
+ "and lcb.exhibition_board_id = eb.id " + "and lcb.exhibition_board_id = eb.id "
...@@ -53,9 +52,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo ...@@ -53,9 +52,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
+ "and a.file_type = 'VIDEO' " + "and a.file_type = 'VIDEO' "
+ "and lc.applicable_scope = 'THIS_ORGAN' " + "and lc.applicable_scope = 'THIS_ORGAN' "
+ "and lc.organ_code = #{organCode} " + "and lc.organ_code = #{organCode} "
+ "UNION " + "UNION "
+ "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover " + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover "
+ "FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a " + "FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a "
+ "WHERE lcb.learning_content_id = lc.id " + "WHERE lcb.learning_content_id = lc.id "
...@@ -65,7 +62,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo ...@@ -65,7 +62,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
+ "and a.file_type = 'VIDEO' " + "and a.file_type = 'VIDEO' "
+ "and lc.applicable_scope = 'THIS_ORGAN_SUB'" + "and lc.applicable_scope = 'THIS_ORGAN_SUB'"
+ "and lc.organ_code like CONCAT(#{organCode},'%') " + "and lc.organ_code like CONCAT(#{organCode},'%') "
+ "UNION ALL " + "UNION "
+ "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, asset a " + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, asset a "
+ "WHERE lcb.learning_content_id = lc.id " + "WHERE lcb.learning_content_id = lc.id "
+ "and lcb.exhibition_board_id = eb.id " + "and lcb.exhibition_board_id = eb.id "
...@@ -74,9 +71,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo ...@@ -74,9 +71,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
+ "and a.file_type = 'VIDEO' " + "and a.file_type = 'VIDEO' "
+ "and lc.applicable_scope = 'THIS_ORGAN_SUB' " + "and lc.applicable_scope = 'THIS_ORGAN_SUB' "
+ "and lc.organ_code = #{organCode} " + "and lc.organ_code = #{organCode} "
+ "UNION " + "UNION "
+ "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a " + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a "
+ "WHERE lcb.learning_content_id = lc.id " + "WHERE lcb.learning_content_id = lc.id "
+ "and lcb.exhibition_board_id = eb.id " + "and lcb.exhibition_board_id = eb.id "
...@@ -84,7 +79,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo ...@@ -84,7 +79,7 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
+ "and vc.id = a.ref_item_id " + "and vc.id = a.ref_item_id "
+ "and a.file_type = 'VIDEO' " + "and a.file_type = 'VIDEO' "
+ "and lc.applicable_scope = 'ALL_PLAT'" + "and lc.applicable_scope = 'ALL_PLAT'"
+ "UNION ALL " + "UNION "
+ "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover " + "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover "
+ "FROM learning_content_board lcb, learning_content lc, exhibition_board eb, asset a " + "FROM learning_content_board lcb, learning_content lc, exhibition_board eb, asset a "
+ "WHERE lcb.learning_content_id = lc.id " + "WHERE lcb.learning_content_id = lc.id "
......
...@@ -29,7 +29,6 @@ import org.apache.commons.lang3.StringUtils; ...@@ -29,7 +29,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.DisabledAccountException; import org.apache.shiro.authc.DisabledAccountException;
import org.apache.shiro.authc.IncorrectCredentialsException; import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
...@@ -43,7 +42,9 @@ import org.springframework.web.bind.annotation.*; ...@@ -43,7 +42,9 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -144,7 +145,7 @@ public class ChinaMobileRestApiController extends BaseController { ...@@ -144,7 +145,7 @@ public class ChinaMobileRestApiController extends BaseController {
@GetMapping("/equitment/activity") @GetMapping("/equitment/activity")
//@RequiresAuthentication //@RequiresPermissions("/equitment/activity/") //@RequiresAuthentication //@RequiresPermissions("/equitment/activity/")
public Map<String, Object> getActivity(@RequestParam(required = true) String mac) { public Map<String, Object> getActivity(@RequestParam(required = true) String mac) {
List<TBoxOperation> list = new ArrayList<>(); List<TBoxOperation> list;
try { try {
UpdateWrapper<TBoxOperation> wrapper = new UpdateWrapper<>(); UpdateWrapper<TBoxOperation> wrapper = new UpdateWrapper<>();
wrapper.eq("mac", mac); wrapper.eq("mac", mac);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment