Commit 2dc23b1f authored by zhangqingle's avatar zhangqingle

修改排序传值报错问题

parent 959b8b00
......@@ -153,75 +153,75 @@ public class BChapterController extends PaginationController<BChapter> {
MessageConstant.MESSAGE_ALERT_ERROR,
newFileUrl);
}
@RequestMapping(value = "/downloadFile", method = RequestMethod.GET)
public ResponseEntity<InputStreamResource> downloadFile(BFile bfile)
throws IOException {
log.debug("----------df1----------");
String filePath = bChapterService.getDownLoadUrl(bfile);
log.debug("----------df2----------");
FileSystemResource file = new FileSystemResource(filePath);
log.debug("----------df3----------");
HttpHeaders headers = new HttpHeaders();
log.debug("----------df4----------");
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
headers.add("Content-Disposition", String.format("attachment; filename=\"%s\"", file.getFilename()));
headers.add("Pragma", "no-cache");
headers.add("Expires", "0");
log.debug("----------df5----------");
return ResponseEntity
.ok()
.headers(headers)
.contentLength(file.contentLength())
.contentType(MediaType.parseMediaType("application/octet-stream"))
.body(new InputStreamResource(file.getInputStream()));
}
//文件下载相关代码
@RequestMapping("/download")
public void downloadFile(BFile bfile, HttpServletResponse response) {
String filePath = bChapterService.getDownLoadUrl(bfile);
File file = new File(filePath);
if (StringUtils.isNotEmpty(file.getName())) {
//设置文件路径
if (file.exists()) {
log.debug("------------------test1------------------");
// response.setContentType("application/force-download");
// response.setContentType("multipart/form-data");
response.setContentType("application/octet-stream;charset=utf-8");
// response.setHeader("content-type", "application/octet-stream");
String asd = file.getName();
//response.setHeader("Content-Disposition", "attachment;fileName=" + file.getName());// 设置文件名
response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"; filename*=utf-8''" + file.getName());
log.debug("------------------test2------------------");
byte[] buffer = new byte[2048];
FileInputStream fis = null;
log.debug("------------------test3------------------");
try {
fis = new FileInputStream(file);
OutputStream out = new BufferedOutputStream(response.getOutputStream());
int b = 0;
while ((b = fis.read(buffer)) != -1) {
out.write(buffer, 0, b); //4.写到输出流(out)中
}
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
}
// @RequestMapping(value = "/downloadFile", method = RequestMethod.GET)
// public ResponseEntity<InputStreamResource> downloadFile(BFile bfile)
// throws IOException {
// log.debug("----------df1----------");
// String filePath = bChapterService.getDownLoadUrl(bfile);
// log.debug("----------df2----------");
// FileSystemResource file = new FileSystemResource(filePath);
// log.debug("----------df3----------");
// HttpHeaders headers = new HttpHeaders();
// log.debug("----------df4----------");
// headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
// headers.add("Content-Disposition", String.format("attachment; filename=\"%s\"", file.getFilename()));
// headers.add("Pragma", "no-cache");
// headers.add("Expires", "0");
// log.debug("----------df5----------");
// return ResponseEntity
// .ok()
// .headers(headers)
// .contentLength(file.contentLength())
// .contentType(MediaType.parseMediaType("application/octet-stream"))
// .body(new InputStreamResource(file.getInputStream()));
// }
//
// //文件下载相关代码
// @RequestMapping("/download")
// public void downloadFile(BFile bfile, HttpServletResponse response) {
// String filePath = bChapterService.getDownLoadUrl(bfile);
// File file = new File(filePath);
// if (StringUtils.isNotEmpty(file.getName())) {
// //设置文件路径
// if (file.exists()) {
// log.debug("------------------test1------------------");
// // response.setContentType("application/force-download");
//// response.setContentType("multipart/form-data");
//
// response.setContentType("application/octet-stream;charset=utf-8");
//// response.setHeader("content-type", "application/octet-stream");
// String asd = file.getName();
// //response.setHeader("Content-Disposition", "attachment;fileName=" + file.getName());// 设置文件名
// response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"; filename*=utf-8''" + file.getName());
//
// log.debug("------------------test2------------------");
// byte[] buffer = new byte[2048];
// FileInputStream fis = null;
// log.debug("------------------test3------------------");
// try {
// fis = new FileInputStream(file);
// OutputStream out = new BufferedOutputStream(response.getOutputStream());
// int b = 0;
// while ((b = fis.read(buffer)) != -1) {
// out.write(buffer, 0, b); //4.写到输出流(out)中
// }
// out.flush();
// out.close();
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// if (fis != null) {
// try {
// fis.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// }
// }
// }
// }
......
......@@ -1019,7 +1019,8 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"<if test=\"bLesson.lessonName!=null and bLesson.lessonName!=''\">AND les.lesson_name like '%${bLesson.lessonName}%' </if>" +
"<if test=\"bLesson.lessonType!=null and bLesson.lessonType!=''\">AND les.lesson_type = #{bLesson.lessonType} </if>" +
"<if test=\"bLesson.lecturerId!=null and bLesson.lecturerId!=''\">AND u1.name like '%${bLesson.lecturerId}%' </if>" +
"<if test=\"bLesson.releaseState!=null and bLesson.releaseState!=''\">AND les.release_state = #{bLesson.releaseState} </if>" +
"<if test=\"bLesson.releaseState!=null and bLesson.releaseState!=''\">AND les.release_state = #{bLesson.releaseState} </if> " +
" order by les.`CREATE_DATE` DESC " +
"</script>")
@ResultMap(value = "AllManageResultMap")
List<BLesson> selectAllManageLesson(@Param("CurUserSet") Set<String> CurUserSet, @Param("bLesson") BLesson bLesson, @Param("isAdmin") boolean isAdmin, @Param("corpId") String corpId) ;
......
......@@ -218,7 +218,7 @@ public class BLesson extends IdEntity<BLesson> {
@Transient
private String isApply;
@ApiModelProperty(value = "否必修 0 选修 1必修")
@ApiModelProperty(value = "否必修 0 选修 1必修")
@Transient
private String isAppoint;
......
......@@ -7,6 +7,8 @@ import org.rcisoft.core.aop.IdGenAspect;
import org.rcisoft.core.aop.PageUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
/**
* Created by lcy on 18/1/21.
......@@ -50,4 +52,15 @@ public class AopConfig {
public EntityParamAspect entityParamAspect(){
return new EntityParamAspect();
}
@Bean
public RestTemplate restTemplate()
{
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(500000);
requestFactory.setReadTimeout(300000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
return restTemplate;
}
}
......@@ -69,9 +69,9 @@ public class CurUserAspect {
UserUtil.setCurUser(curUser);
//多线程判断是否有管理员
log.info("-------------------OUT-countAdminOut-up------------------");
log.debug("-------------------OUT-countAdminOut-up------------------");
int countAdminOut = sysRoleService.queryAdminInCorp(curUser.getCorpId());
log.info("-------------------OUT-countAdminOut-down------------------");
log.debug("-------------------OUT-countAdminOut-down------------------");
if (countAdminOut < 1){
synchronized (this) {
//查询本部门是否有管理员
......
......@@ -3,6 +3,7 @@ package org.rcisoft.core.aop;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
......@@ -69,8 +70,14 @@ public class PageUtil<T> extends PageInfo<T> implements Serializable {
@Around("execution(* org.rcisoft..*.service.impl.*ServiceImpl.*ByPagination(..))")
public List<T> preparedPageHeplerAndloadingPageInfoSetResults(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{
PageUtil paginationUtility = (PageUtil)proceedingJoinPoint.getArgs()[0];
PageHelper.startPage(paginationUtility.getPageNum(), paginationUtility.getPageSize(), paginationUtility.getOrderBy());
try {
log.info("------------------num:" + paginationUtility.getPageNum() + " pageSize : "
+ paginationUtility.getPageSize() + " orderBy: " + paginationUtility.getOrderBy() + "---------");
/* if(StringUtils.isAnyEmpty(paginationUtility.getOrderBy()))
PageHelper.startPage(paginationUtility.getPageNum(), paginationUtility.getPageSize());
else
PageHelper.startPage(paginationUtility.getPageNum(), paginationUtility.getPageSize(), paginationUtility.getOrderBy());*/
PageHelper.startPage(paginationUtility.getPageNum(), paginationUtility.getPageSize());
try {
List e = (List)proceedingJoinPoint.proceed();
PageInfo pageInfo = new PageInfo(e);
this.setPageInfo(paginationUtility, pageInfo);
......
package org.rcisoft.core.util;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class LogUtil {
//文件转换日志打印
public static void fileChangeLog(String message){
log.info(message);
}
}
......@@ -86,55 +86,58 @@ public class OfficeToPdf {
* @return 1 成功 0 失败 -1 错误
*/
public synchronized int transformToPdf(String sourceFile, String destFile){
log.debug("****************transform + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
LogUtil.fileChangeLog("****************transform + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
OpenOfficeConnection connection = null;
try {
File inputFile = new File(sourceFile);
if (!inputFile.exists()) {
return -1;// 找不到源文件, 则返回-1
}
log.debug("----------ZH------------");
LogUtil.fileChangeLog("----------ZH------------");
// 如果目标路径不存在, 则新建该路径
File outputFile = new File(destFile);
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
}
log.debug("----------ZH------------");
LogUtil.fileChangeLog("----------ZH------------");
// connect to an OpenOffice.org instance running on port 8100
connection = new SocketOpenOfficeConnection(
global.getLibreofficeIp(), global.getLibreofficePort());
log.debug("****************connect + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
LogUtil.fileChangeLog("****************connect + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
connection.connect();
log.debug("****************connect + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
LogUtil.fileChangeLog("****************connect + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
// convert
log.debug("----------ZH------------");
LogUtil.fileChangeLog("----------ZH------------");
DocumentConverter converter = new OpenOfficeDocumentConverter(
connection);
DocumentFormatRegistry factory = new BasicDocumentFormatRegistry();
log.debug("----------ZH------------");
LogUtil.fileChangeLog("----------ZH------------");
DocumentFormat inputDocumentFormat = factory
.getFormatByFileExtension(FileUtil.getFilePostfix(sourceFile));
DocumentFormat outputDocumentFormat = factory
.getFormatByFileExtension(FileUtil.getFilePostfix(destFile));
log.info("开始转换--> "+ sourceFile);
LogUtil.fileChangeLog("开始转换--> "+ sourceFile);
converter.convert(inputFile,inputDocumentFormat,outputFile,outputDocumentFormat);
log.info("转换完毕--> "+ destFile);
log.debug("****************transform + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
LogUtil.fileChangeLog("转换完毕--> "+ destFile);
LogUtil.fileChangeLog("****************transform + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
// close the connection
} catch (ConnectException e) {
LogUtil.fileChangeLog("----------------------catch1------------------"+e);
e.printStackTrace();
} catch (IOException e) {
LogUtil.fileChangeLog("----------------------catch2------------------"+e);
e.printStackTrace();
return 0;
}finally {
if(connection!=null) {
LogUtil.fileChangeLog("----------------------finally1------------------");
connection.disconnect();
}else{
LogUtil.fileChangeLog("----------------------finally2------------------");
// throw new ServiceException(ResultServiceEnums.CHANGE_FILE_ERROR);
throw new ServiceException(ResultServiceEnums.CHANGE_HAVE_MEDIA);
}
......
......@@ -180,7 +180,7 @@ public class SysRoleServiceImpl implements SysRoleService {
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
public int addAdminRoleMenuUser(CurUser curUser) {
String privilege = "M-LESSON-MANAGE,F-ADD-LESSON,F-UPDATE-LESSON,F-CLOSE-LESSON,F-DELETE-LESSON,M-TRAIN-MANAGE,F-ADD-TRAIN,F-UPDATE-TRAIN,F-CLOSE-TRAIN,F-DELETE-TRAIN,M-PRESERVE,F-DOWNLOAD-PRESERVE,F-REPRINT-PRESERVE,F-DELETE-PRESERVE,M-UPLOAD,F-DOWNLOAD-UPLOAD,F-REPRINT-UPLOAD,F-DELETE-UPLOAD,M-CTS-B,F-ONLINE,P-ONLINE-ADD,P-ONLINE-UPDATE,P-ONLINE-APPOINT,P-ONLINE-TRACK,P-ONLINE-RECOMMEND,P-ONLINE-CLOSE,P-ONLINE-DEL,F-UNDERLINE,P-UNDER-ADD,P-UNDER-UPDATE,P-UNDER-APPOINT,P-UNDER-TRACK,P-UNDER-RECOMMEND,P-UNDER-CLOSE,P-UNDER-DEL,F-CATEGORY,P-CATEGORY-ADD,P-CATEGORY-UPDATE,P-CATEGORY-DEL,F-LABEL,P-LABEL-ADD,P-LABEL-UPDATE,P-LABEL-DEL,F-INTEGRAL-M,P-NULL-2,M-QDB,F-QDB,P-QDB-ADD,P-QDB-UPDATE,P-QDB-DELETE,P-QDB-ANALYSIS,F-QES,P-QES-ADD,P-QES-UPDATE,P-QES-DELETE,P-QES-IMPORT,M-PAPER,F-PAPER-CATE,P-PAPER-CATE-ADD,P-PAPER-CATE-UPDATE,P-PAPER-CATE-DELETE,F-PAPER,P-PAPER-ADD,P-PAPER-UPDATE,P-PAPER-DELETE,P-PAPER-CONFIG,P-PAPER-HISTORY-VIEW,P-PAPER-HISTORY-CHECK,M-ANALYSIS,P-ANA-PAPER,P-ANA-EXAM,P-ANA-SCORE,M-SYSTEM,F-MAIN-MANAGE,P-COLUMN,P-BANNER,P-OUTER-LINK,F-USER-MANAGE,P-STOP-START,P-ROLE-EDIT,P-SYNCHRO,F-ROLE-MANAGE,P-ROLE-MANAGE,P-OPERATION,P-DATALIMIT";
String privilege = "M-LESSON-MANAGE,F-ADD-LESSON,F-UPDATE-LESSON,F-CLOSE-LESSON,F-DELETE-LESSON,M-TRAIN-MANAGE,F-ADD-TRAIN,F-UPDATE-TRAIN,F-CLOSE-TRAIN,F-DELETE-TRAIN,M-PRESERVE,F-DOWNLOAD-PRESERVE,F-REPRINT-PRESERVE,F-DELETE-PRESERVE,M-UPLOAD,F-DOWNLOAD-UPLOAD,F-REPRINT-UPLOAD,F-DELETE-UPLOAD,M-CTS-B,F-ONLINE,P-ONLINE-ADD,P-ONLINE-UPDATE,P-ONLINE-APPOINT,P-ONLINE-TRACK,P-ONLINE-RECOMMEND,P-ONLINE-CLOSE,P-ONLINE-DEL,F-UNDERLINE,P-UNDER-ADD,P-UNDER-UPDATE,P-UNDER-APPOINT,P-UNDER-TRACK,P-UNDER-RECOMMEND,P-UNDER-CLOSE,P-UNDER-DEL,F-CATEGORY,P-CATEGORY-ADD,P-CATEGORY-UPDATE,P-CATEGORY-DEL,F-LABEL,P-LABEL-ADD,P-LABEL-UPDATE,P-LABEL-DEL,F-INTEGRAL-M,P-NULL-2,M-QDB,F-QDB,P-QDB-ADD,P-QDB-UPDATE,P-QDB-DELETE,P-QDB-ANALYSIS,F-QES,P-QES-ADD,P-QES-UPDATE,P-QES-DELETE,P-QES-IMPORT,M-PAPER,F-PAPER-CATE,P-PAPER-CATE-ADD,P-PAPER-CATE-UPDATE,P-PAPER-CATE-DELETE,F-PAPER,P-PAPER-ADD,P-PAPER-UPDATE,P-PAPER-DELETE,P-PAPER-CONFIG,P-PAPER-HISTORY-VIEW,P-PAPER-HISTORY-CHECK,M-ANALYSIS,P-ANA-PAPER,P-ANA-EXAM,P-ANA-SCORE,M-SYSTEM,F-MAIN-MANAGE,P-COLUMN,P-BANNER,P-OUTER-LINK,F-USER-MANAGE,P-STOP-START,P-ROLE-EDIT,P-SYNCHRO,F-ROLE-MANAGE,P-ROLE-MANAGE,P-OPERATION,P-DATALIMIT,P-PAPER-CLONE";
//主管理员角色id
String mRId = IdGen.uuid();
//初始化角色(新加公司超级管理员)
......
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