Jelajahi Sumber

Merge remote-tracking branch 'origin/Eternity' into superb

superb 1 tahun lalu
induk
melakukan
5c9a010fa4
21 mengubah file dengan 575 tambahan dan 31 penghapusan
  1. 91 3
      common/src/main/java/com/koobietech/eas/common/utils/FileManager.java
  2. 19 0
      controller/pom.xml
  3. 105 0
      controller/src/main/java/com/koobietech/eas/controller/EasArcTlsScoresController.java
  4. 2 1
      controller/src/main/java/com/koobietech/eas/controller/EasStuProfileController.java
  5. TEMPAT SAMPAH
      controller/src/main/resources/Temp/kun1.jpeg
  6. TEMPAT SAMPAH
      controller/src/main/resources/Temp/~$uRegistTemp.docx
  7. 2 2
      controller/src/main/resources/application-local.yaml
  8. 30 0
      controller/src/main/resources/application-wheng.yaml
  9. 2 2
      controller/src/main/resources/application.yaml
  10. 1 1
      controller/src/main/resources/logback.xml
  11. TEMPAT SAMPAH
      controller/src/main/resources/temp/kun.jpeg
  12. 19 5
      controller/src/test/java/com/koobietech/eas/controller/ControllerApplicationTests.java
  13. 12 1
      pom.xml
  14. 16 6
      security/src/main/java/com/koobietech/eas/security/filter/EasSecurityFilter.java
  15. 19 0
      security/src/main/java/com/koobietech/eas/security/utils/SecurityUtils.java
  16. 4 0
      service/pom.xml
  17. 22 0
      service/src/main/java/com/koobietech/eas/service/EasArcTlsScoresService.java
  18. 2 2
      service/src/main/java/com/koobietech/eas/service/impl/AdminLoginServiceImpl.java
  19. 215 0
      service/src/main/java/com/koobietech/eas/service/impl/EasArcTlsScoresServiceImpl.java
  20. 7 8
      service/src/main/java/com/koobietech/eas/service/impl/EasStuProfileServiceImpl.java
  21. 7 0
      upload/src/main/java/com/koobietech/eas/upload/UploadService.java

+ 91 - 3
common/src/main/java/com/koobietech/eas/common/utils/FileManager.java

@@ -1,7 +1,95 @@
 package com.koobietech.eas.common.utils;
 
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+
+import java.io.*;
+
 public class FileManager {
-//    public boolean saveDocument(XWPFDocument document, String savePath){
-//
-//    }
+    public boolean saveDocument(XWPFDocument document, String savePath){
+        boolean ret = true;
+        FileOutputStream fileOutputStream = null;
+        try {
+            fileOutputStream = new FileOutputStream(savePath);
+            document.write(fileOutputStream);
+        } catch (IOException e) {
+            ret = false;
+        } finally {
+            try {
+                fileOutputStream.close();
+            } catch (IOException e) {}
+        }
+        return ret;
+    }
+
+    public boolean saveDocument(XWPFDocument document, String savePath, String fileName){
+        return saveDocument(document, savePath + fileName);
+    }
+
+    public boolean createPath(String path){
+        File file = new File(path);
+        if (!file.exists()){
+            file.mkdirs();
+        }
+        return true;
+    }
+
+    public boolean saveFile(InputStream stream, String savePath){
+        FileOutputStream fileOutputStream = null;
+        try {
+            fileOutputStream = new FileOutputStream(savePath);
+            int bytesRead;
+            byte[] buffer = new byte[1024];
+            while ((bytesRead = stream.read(buffer)) != -1){
+                fileOutputStream.write(bytesRead);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                fileOutputStream.close();
+            }catch (IOException e){}
+        }
+        return true;
+    }
+
+    public boolean saveFile(InputStream  stream, String savePath, String fileName) {
+        return saveFile(stream, savePath + fileName);
+    }
+
+    public boolean isFileExists(String filePath){
+        File file = new File(filePath);
+        return file.exists();
+    }
+
+    public boolean deleteFile(String filePath){
+        File file = new File(filePath);
+        return file.delete();
+    }
+
+    public boolean isFolderExists(String folderPath){
+        File file = new File(folderPath);
+        return file.exists();
+    }
+
+    public boolean createFolder(String folderPath){
+        File file = new File(folderPath);
+        return file.mkdirs();
+    }
+
+    public boolean deleteFolder(String folderPath){
+        File file = new File(folderPath);
+        return file.delete();
+    }
+
+    public boolean copyFile(String srcFilePath, String destFilePath){
+        File srcFile = new File(srcFilePath);
+        File destFile = new File(destFilePath);
+        return srcFile.renameTo(destFile);
+    }
+
+    public boolean moveFile(String srcFilePath, String destFilePath){
+        File srcFile = new File(srcFilePath);
+        File destFile = new File(destFilePath);
+        return srcFile.renameTo(destFile);
+    }
 }

+ 19 - 0
controller/pom.xml

@@ -14,6 +14,10 @@
     </parent>
 
     <dependencies>
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.anji-plus</groupId>
             <artifactId>spring-boot-starter-captcha</artifactId>
@@ -77,6 +81,21 @@
     </dependencyManagement>
 
     <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.png</include>
+                    <include>**/*.jpeg</include>
+                    <include>**/*.xml</include>
+                    <include>**/*.docx</include>
+                    <include>**/*.xlsx</include>
+                    <include>**/*.yaml</include>
+                    <include>**/*.properties</include>
+                </includes>
+            </resource>
+        </resources>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

+ 105 - 0
controller/src/main/java/com/koobietech/eas/controller/EasArcTlsScoresController.java

@@ -0,0 +1,105 @@
+package com.koobietech.eas.controller;
+
+import cn.hutool.db.Page;
+import com.github.pagehelper.PageHelper;
+import com.koobietech.eas.common.result.JsonPageResult;
+import com.koobietech.eas.common.result.JsonResult;
+import com.koobietech.eas.common.result.PageData;
+import com.koobietech.eas.mbg.model.EasArcTlsScores;
+import com.koobietech.eas.service.EasArcTlsScoresService;
+import io.swagger.v3.core.util.Json;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+@RestController
+@Tag(name = "成绩控制器")
+public class EasArcTlsScoresController {
+
+    @Resource
+    EasArcTlsScoresService easArcTlsScoresService;
+
+    /**
+     * 添加学生成绩信息
+     * @param easArcTlsScores
+     * @return
+     */
+    @PostMapping(value = "/addStudentScore")
+    @Operation(summary = "添加学生成绩信息",description = "用于添加学生成绩信息")
+    public JsonResult addStudentScore(@RequestBody EasArcTlsScores easArcTlsScores) {
+        int i = easArcTlsScoresService.addStudentScore(easArcTlsScores);
+        System.out.println(i);
+        return JsonResult.ok("添加成功!");
+    }
+
+    /**
+     * 修改学生成绩信息
+     * @param easArcTlsScores
+     * @return
+     */
+    @PutMapping(value = "/updateStudentScore")
+    @Operation(summary = "修改学生成绩信息",description = "用于修改学生成绩信息")
+    public JsonResult updateStudentScore(@RequestBody EasArcTlsScores easArcTlsScores) {
+        int i = easArcTlsScoresService.updateStudentScore(easArcTlsScores);
+        if (i > 0){
+            return JsonResult.ok();
+        }else {
+            return JsonResult.fail();
+        }
+    }
+
+    /**
+     * 查询所有学生成绩信息
+     * @return
+     */
+    @GetMapping(value = "/selectAllStudentScores")
+    @Operation(summary = "查询所有学生的成绩信息",description = "用于查询所有学生的成绩信息")
+    public JsonResult selectAllStudentScores() {
+        List<EasArcTlsScores> easArcTlsScores = easArcTlsScoresService.selectAllStudentScores();
+        return JsonResult.data(easArcTlsScores);
+    }
+
+    /**
+     * 条件查询学生成绩信息
+     * @param easArcTlsScores
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @PostMapping(value = "/selectScoreByExample")
+    @Operation(summary = "条件查询学生成绩信息",description = "用于条件查询学生成绩信息")
+    public JsonPageResult selectScoreByExample(@RequestBody EasArcTlsScores easArcTlsScores,
+                                               @RequestParam Integer pageNum,@RequestParam Integer pageSize){
+        PageHelper.startPage(pageNum,pageSize);
+        PageData pageData = easArcTlsScoresService.selectScoreByExample(easArcTlsScores);
+        return JsonPageResult.data(pageData);
+    }
+
+    @PostMapping(value = "/importExcelScores")
+    @Operation(summary = "Excel导入学生成绩信息",description = "用于Excel导入学生成绩信息")
+    public JsonResult importExcelScores(MultipartFile excelFile) {
+        InputStream inputStream = null;
+        Boolean aBoolean = null;
+        try {
+            inputStream = excelFile.getInputStream();
+            aBoolean = easArcTlsScoresService.importExcelScores(inputStream);
+        } catch (IOException e) {
+            aBoolean = false;
+        } finally {
+            try {
+                inputStream.close();
+            } catch (IOException e) {}
+        }
+        if (aBoolean == true){
+            return JsonResult.ok();
+        }else {
+            return JsonResult.fail();
+        }
+    }
+}

+ 2 - 1
controller/src/main/java/com/koobietech/eas/controller/EasStuProfileController.java

@@ -4,6 +4,7 @@ package com.koobietech.eas.controller;
 import com.koobietech.eas.common.result.JsonResult;
 import com.koobietech.eas.mbg.model.EasArcTlsStudents;
 import com.koobietech.eas.service.EasStuProfileService;
+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;
@@ -17,7 +18,7 @@ public class EasStuProfileController {
     @Resource
     private EasStuProfileService easStuProfileService;
 
-    @RequestMapping("/StuProfileDownload")
+    @PostMapping("/StuProfileDownload")
     public JsonResult StuProfileDownload(@RequestBody  EasArcTlsStudents easArcTlsStudents) throws FileNotFoundException {
 
         return easStuProfileService.StuProfileDownload(easArcTlsStudents);

TEMPAT SAMPAH
controller/src/main/resources/Temp/kun1.jpeg


TEMPAT SAMPAH
controller/src/main/resources/Temp/~$uRegistTemp.docx


+ 2 - 2
controller/src/main/resources/application-local.yaml

@@ -1,10 +1,10 @@
 server:
-  port: 8081
+  port: 8080
 spring:
   datasource:
     url: jdbc:mysql://127.0.0.1:3306/eas?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true&tinyInt1isBit=false
     username: root
-    password: 123456
+    password: 1234
     driver-class-name: com.mysql.cj.jdbc.Driver
   redis:
     host: localhost

+ 30 - 0
controller/src/main/resources/application-wheng.yaml

@@ -0,0 +1,30 @@
+server:
+  port: 8080
+spring:
+  datasource:
+    url: jdbc:mysql://127.0.0.1:13306/eas?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true&tinyInt1isBit=false
+    username: root
+    password: 0JZBdtlYoiOepddh
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  redis:
+    host: localhost
+    database: 8
+    password:
+    port: 26379
+  security:
+    user:
+      name: admin
+      password: 123456
+springdoc:
+  version: v0.0.1
+  api-docs:
+    enabled: true
+  swagger-ui:
+    enabled: true
+knife4j:
+  enable: true
+  setting:
+    language: zh_cn
+logging:
+  level:
+    com.koobietech.eas.*: TRACE

+ 2 - 2
controller/src/main/resources/application.yaml

@@ -2,7 +2,7 @@ server:
   port: 8081
 spring:
   profiles:
-    active: local
+    active: wheng
   main:
     allow-circular-references: true
   servlet:
@@ -32,7 +32,7 @@ security:
       - /**
 eas:
   jwt-secret-key: 123456
-  jwt-expires-date: 1
+  jwt-expires-date: 2
   password-sign-key: eas-key-password
 aj:
   captcha:

+ 1 - 1
controller/src/main/resources/logback.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
-    <property name="log.path" value="./" />
+    <property name="log.path" value="./logs" />
     <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>

TEMPAT SAMPAH
controller/src/main/resources/temp/kun.jpeg


+ 19 - 5
controller/src/test/java/com/koobietech/eas/controller/ControllerApplicationTests.java

@@ -1,14 +1,18 @@
 package com.koobietech.eas.controller;
 
 import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.ExcelImportUtil;
 import cn.afterturn.easypoi.excel.entity.ExportParams;
+import cn.afterturn.easypoi.excel.entity.ImportParams;
 import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
+import cn.afterturn.easypoi.handler.inter.IReadHandler;
 import cn.afterturn.easypoi.handler.inter.IWriter;
 import com.koobietech.eas.common.constant.UserType;
 import com.koobietech.eas.common.pojo.JwtUserDto;
 import com.koobietech.eas.common.service.RedisService;
 import com.koobietech.eas.common.utils.JwtManager;
 import com.koobietech.eas.common.utils.PasswordManager;
+import com.koobietech.eas.mbg.model.EasArcTlsScores;
 import com.koobietech.eas.mbg.model.EasSysLogs;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.junit.jupiter.api.Test;
@@ -23,11 +27,22 @@ import java.util.*;
 @SpringBootTest
 class ControllerApplicationTests {
 
-    @Test
-    void contextLoads() throws IOException {
+//    @Test
+//    void contextLoads() {
+//        try {
+//            ImportParams params = new ImportParams();
+//            List<Map<String, Object>> arc = ExcelImportUtil.importExcel(
+//                    new FileInputStream("C:\\Users\\lc\\Desktop\\1.xlsx"),
+//                    Map.class, params);
+//            for (Map<String, Object> map : arc) {
+//                System.out.println(map);
+//            }
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//    }
+
 
-        InputStream wordStream = this.getClass().getClassLoader().getResourceAsStream("\\temp\\StuRegistTemp.docx");
-        System.out.println( wordStream );
 
 //        List<Map> list = new ArrayList<>();
 //        Workbook workbook = null;
@@ -62,6 +77,5 @@ class ControllerApplicationTests {
 //        fos.close();
 
 
-    }
 
 }

+ 12 - 1
pom.xml

@@ -33,13 +33,24 @@
         <javax.servlet-api.version>4.0.1</javax.servlet-api.version>
         <spring-data-redis.version>2.7.3</spring-data-redis.version>
         <knife4j.version>4.1.0</knife4j.version>
-        <easypoi.version>4.3.0</easypoi.version>
+        <easypoi.version>4.4.0</easypoi.version>
         <pagehelper.starter.version>1.3.1</pagehelper.starter.version>
         <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
         <captcha.version>1.3.0</captcha.version>
+        <xerces.version>2.9.1</xerces.version>
     </properties>
     <dependencyManagement>
         <dependencies>
+            <dependency>
+                <groupId>xerces</groupId>
+                <artifactId>xercesImpl</artifactId>
+                <version>${xerces.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>cn.afterturn</groupId>
+                <artifactId>easypoi-wps</artifactId>
+                <version>${easypoi.version}</version>
+            </dependency>
             <dependency>
                 <groupId>com.anji-plus</groupId>
                 <artifactId>spring-boot-starter-captcha</artifactId>

+ 16 - 6
security/src/main/java/com/koobietech/eas/security/filter/EasSecurityFilter.java

@@ -6,6 +6,8 @@ import com.koobietech.eas.common.utils.JwtManager;
 import com.koobietech.eas.dao.adminLoginPojo.Permission;
 import com.koobietech.eas.dao.adminLoginPojo.UserDetail;
 import com.koobietech.eas.service.LoginRedisService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
 import org.springframework.security.core.context.SecurityContext;
@@ -27,6 +29,8 @@ import javax.servlet.http.HttpServletResponse;
 @Component
 public class EasSecurityFilter extends OncePerRequestFilter {
 
+    private static final Logger logger = LoggerFactory.getLogger(EasSecurityFilter.class);
+
     @Resource
     private LoginRedisService loginRedisService;
 
@@ -45,16 +49,22 @@ public class EasSecurityFilter extends OncePerRequestFilter {
             try {
                 //过滤器 允许 Token 不正确, 后面Security 会拦截处理
                 jwtUserDto = jwtManager.decodeJwt(token);
-            } catch ( EasException e) {}
+            } catch ( EasException e) {
+                logger.debug(e.getMessage());
+            }
             if ( Objects.nonNull(jwtUserDto) ) {
                 //判断token是否有效
-                UserDetail userDetail = loginRedisService.checkToken(jwtUserDto);
-
-                // 获取当前的 SecurityContext 对象,用于保存当前用户的安全上下文信息
-                SecurityContext context = SecurityContextHolder.getContext();
+                UserDetail userDetail = null;
+                try {
+                    userDetail = loginRedisService.checkToken(jwtUserDto);
+                } catch ( EasException e) {
+                    logger.debug(e.getMessage());
+                }
 
+                // 如果获取到了有效的用户对象
                 if (Objects.nonNull(userDetail)) {
-                    // 如果获取到了有效的用户对象
+                    // 获取当前的 SecurityContext 对象,用于保存当前用户的安全上下文信息
+                    SecurityContext context = SecurityContextHolder.getContext();
 
                     // 获取用户的权限列表
                     List<Permission> permission = userDetail.getPermissions();

+ 19 - 0
security/src/main/java/com/koobietech/eas/security/utils/SecurityUtils.java

@@ -0,0 +1,19 @@
+package com.koobietech.eas.security.utils;
+import org.springframework.security.core.context.SecurityContextHolder;
+public class SecurityUtils {
+
+    public static String getLoginUserName(){
+        Object principal = getPrincipal();
+        return principal.toString().equals("anonymousUser") ? "" : principal.toString();
+    }
+
+    public static boolean isLogged(){
+        Object principal = getPrincipal();
+        return principal.toString().equals("anonymousUser");
+    }
+
+    private static Object getPrincipal(){
+        return SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+    }
+
+}

+ 4 - 0
service/pom.xml

@@ -8,6 +8,10 @@
     <description>service</description>
 
     <dependencies>
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+        </dependency>
         <dependency>
             <groupId>cn.afterturn</groupId>
             <artifactId>easypoi-spring-boot-starter</artifactId>

+ 22 - 0
service/src/main/java/com/koobietech/eas/service/EasArcTlsScoresService.java

@@ -0,0 +1,22 @@
+package com.koobietech.eas.service;
+
+import com.koobietech.eas.common.result.PageData;
+import com.koobietech.eas.mbg.model.EasArcTlsScores;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.InputStream;
+import java.util.List;
+
+public interface EasArcTlsScoresService {
+
+    int addStudentScore(EasArcTlsScores easArcTlsScores);
+
+    int updateStudentScore(EasArcTlsScores easArcTlsScores);
+
+    List<EasArcTlsScores> selectAllStudentScores();
+
+    PageData selectScoreByExample(EasArcTlsScores easArcTlsScores);
+
+    Boolean importExcelScores(InputStream inputStream);
+
+}

+ 2 - 2
service/src/main/java/com/koobietech/eas/service/impl/AdminLoginServiceImpl.java

@@ -41,8 +41,8 @@ public class AdminLoginServiceImpl implements AdminLoginService {
     private JwtManager jwtManager;
 
     // token过期时间 单位:s
-    private final Integer token_expires = 60*3;
-    private final Integer refreshToken_expires = 60*7;
+    private final Integer token_expires = 24 * 60 * 60;
+    private final Integer refreshToken_expires = 48 * 60 * 60;
 
     @Override
     public LoginToken adminLogin(AdminPojo adminPojo) {

+ 215 - 0
service/src/main/java/com/koobietech/eas/service/impl/EasArcTlsScoresServiceImpl.java

@@ -0,0 +1,215 @@
+package com.koobietech.eas.service.impl;
+
+import cn.afterturn.easypoi.excel.ExcelImportUtil;
+import cn.afterturn.easypoi.excel.entity.ImportParams;
+import cn.afterturn.easypoi.excel.imports.ExcelImportService;
+import cn.afterturn.easypoi.handler.inter.IReadHandler;
+import com.koobietech.eas.common.result.PageData;
+import com.koobietech.eas.mbg.mapper.EasArcTlsScoresMapper;
+import com.koobietech.eas.mbg.model.EasArcTlsScores;
+import com.koobietech.eas.mbg.model.EasArcTlsScoresExample;
+import com.koobietech.eas.service.EasArcTlsScoresService;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.Resource;
+import java.io.*;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+@Service
+public class EasArcTlsScoresServiceImpl implements EasArcTlsScoresService {
+
+    @Resource
+    EasArcTlsScoresMapper easArcTlsScoresMapper;
+
+
+    @Override
+    public int addStudentScore(EasArcTlsScores easArcTlsScores) {
+        easArcTlsScores.setCreateTime(new Date());
+        easArcTlsScores.setModifyTime(new Date());
+        return easArcTlsScoresMapper.insert(easArcTlsScores);
+    }
+
+    @Override
+    public int updateStudentScore(EasArcTlsScores easArcTlsScores) {
+        return easArcTlsScoresMapper.updateByPrimaryKey(easArcTlsScores);
+    }
+
+    @Override
+    public List<EasArcTlsScores> selectAllStudentScores() {
+        return easArcTlsScoresMapper.selectByExample(null);
+    }
+
+    @Override
+    public PageData selectScoreByExample(EasArcTlsScores easArcTlsScores) {
+        EasArcTlsScoresExample easArcTlsScoresExample = new EasArcTlsScoresExample();
+        EasArcTlsScoresExample.Criteria criteria = easArcTlsScoresExample.createCriteria();
+        if (Objects.nonNull(easArcTlsScores)){
+            if (Objects.nonNull(easArcTlsScores.getId())) {
+                criteria.andIdEqualTo(easArcTlsScores.getId());
+            }
+            if (StringUtils.hasText(easArcTlsScores.getStudentNumber())) {
+                criteria.andStudentNumberLike("%"+easArcTlsScores.getStudentNumber()+"%");
+            }
+            if (Objects.nonNull(easArcTlsScores.getTestDate())) {
+                criteria.andTestDateGreaterThan(easArcTlsScores.getTestDate());
+            }
+            if (Objects.nonNull(easArcTlsScores.getScore())) {
+                criteria.andScoreEqualTo(easArcTlsScores.getScore());
+            }
+            if (Objects.nonNull(easArcTlsScores.getPassRate())) {
+                criteria.andPassRateEqualTo(easArcTlsScores.getPassRate());
+            }
+            if (Objects.nonNull(easArcTlsScores.getExcelRate())) {
+                criteria.andExcelRateEqualTo(easArcTlsScores.getExcelRate());
+            }
+            if (Objects.nonNull(easArcTlsScores.getCreateTime())) {
+                criteria.andCreateTimeGreaterThan(easArcTlsScores.getCreateTime());
+            }
+            if (Objects.nonNull(easArcTlsScores.getModifyTime())) {
+                criteria.andCreateTimeGreaterThan(easArcTlsScores.getModifyTime());
+            }
+            if (Objects.nonNull(easArcTlsScores.getCreateUid())) {
+                criteria.andCreateUidEqualTo(easArcTlsScores.getCreateUid());
+            }
+            if (StringUtils.hasText(easArcTlsScores.getComment())) {
+                criteria.andCommentLike("%"+easArcTlsScores.getComment()+"%");
+            }
+        }
+        List<EasArcTlsScores> easArcTlsScores1 = easArcTlsScoresMapper.selectByExample(easArcTlsScoresExample);
+        long l = easArcTlsScoresMapper.countByExample(easArcTlsScoresExample);
+        return PageData.init(easArcTlsScores1,l);
+    }
+
+        @Override
+    public Boolean importExcelScores(InputStream inputStream) {
+            ImportParams params = new ImportParams();
+            try {
+                ExcelImportUtil.importExcelBySax(
+                        new FileInputStream("C:\\Users\\常忠宇\\Desktop\\新建XLSX工作表.xlsx"),
+                        Map.class, params,
+                        new IReadHandler<Map>() {
+                            @Override
+                            public void handler(Map o) {
+                                System.out.println(o);
+                            }
+                            @Override
+                            public void doAfterAll() {
+                                System.out.println("全部执行完毕了--------------------------------");
+                            }
+                        });
+            } catch (FileNotFoundException e) {
+                e.printStackTrace();
+            }
+//            ImportParams params = new ImportParams();
+//            params.setTitleRows(0);
+//            try {
+//                List<EasArcTlsScores> list = new ExcelImportService().importExcelByIs(inputStream,
+//                        EasArcTlsScores.class, params, false).getList();
+//                for ( EasArcTlsScores eas : list) {
+//                    System.out.println( eas );
+//                }
+//            } catch (Exception e) {
+//                e.printStackTrace();
+//            }
+            return true;
+    }
+
+//    @Override
+//    public Boolean importExcelScores(InputStream inputStream) {
+//        try {
+////            创建一个Excel实体
+//            XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
+////            获取第一个表格页面
+//            XSSFSheet sheetAt = workbook.getSheetAt(0);
+////            获取第一个表格页面共有多少行
+//            int lastRowNum = sheetAt.getLastRowNum();
+////            遍历表格行数
+//            for (int rowNum = 0; rowNum < lastRowNum; rowNum++) {
+////                取表格中的每一行
+//                XSSFRow row = sheetAt.getRow(rowNum);
+////                取每一行共有多少列
+//                short lastCellNum = row.getLastCellNum();
+////                创建一个对象准备填入数据
+//                EasArcTlsScores easArcTlsScores = new EasArcTlsScores();
+////                循环表格列数
+//                for (int cellNum = 0; cellNum < lastCellNum; cellNum++) {
+//                    CellType cellType = CellType.forInt(row.getCell(cellNum).getCellType());
+//                    switch (cellType) {
+//                        case _NONE:break;
+//                        case STRING:
+//                            row.getCell(cellNum).getStringCellValue();
+//                            break;
+//                        case NUMERIC:
+////                            判断是否是日期类型
+//                            if (DateUtil.isCellDateFormatted(row.getCell(rowNum))){
+////                                如果是日期类型将其转变为JavaDate格式
+//                                Date javaDate = DateUtil.getJavaDate(row.getCell(cellNum).getNumericCellValue());
+//                                if (cellNum == 5){
+////                                    若是第五列将其设置为考试时间
+//                                    easArcTlsScores.setTestDate( javaDate );
+////                                    第九列设置为创建时间
+//                                }else if (cellNum == 9) {
+//                                    easArcTlsScores.setCreateTime( javaDate );
+////                                    第十列设置为modifyTime
+//                                }else if (cellNum == 10) {
+//                                    easArcTlsScores.setModifyTime( javaDate );
+//                                }
+//                            }else {
+//                                if (cellNum == 1) {
+//                                    easArcTlsScores.setId((int)row.getCell(cellNum).getNumericCellValue());
+//                                }
+//                                if (cellNum == 2) {
+//                                    easArcTlsScores.setStudentNumber(String.valueOf(row.getCell(cellNum).getNumericCellValue()));
+//                                }
+//                                if (cellNum == 3) {
+//                                    easArcTlsScores.setCategoryId((int) row.getCell(cellNum).getNumericCellValue());
+//                                }
+//                                if (cellNum == 4) {
+//                                    easArcTlsScores.setSubjectId((int) row.getCell(cellNum).getNumericCellValue());
+//                                }
+//                                if (cellNum == 6){
+//                                    easArcTlsScores.setScore(BigDecimal.valueOf(row.getCell(cellNum).getNumericCellValue()));
+//                                }
+//                                if (cellNum == 7){
+//                                    easArcTlsScores.setPassRate(BigDecimal.valueOf(row.getCell(cellNum).getNumericCellValue()));
+//                                }
+//                                if (cellNum == 8){
+//                                    easArcTlsScores.setExcelRate(BigDecimal.valueOf(row.getCell(cellNum).getNumericCellValue()));
+//                                }
+//                                if (cellNum == 11){
+//                                    easArcTlsScores.setCreateUid((int) row.getCell(cellNum).getNumericCellValue());
+//                                }
+//                            }
+//                                break;
+//                        case FORMULA:
+//                            break;
+//
+//                        case BLANK:
+//                            break;
+//
+//                        case BOOLEAN:
+//                            break;
+//
+//                        case ERROR:
+//                            break;
+//                    }
+//                }
+//                easArcTlsScoresMapper.insert(easArcTlsScores);
+//            }
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        }
+//        return true;
+//    }
+}

+ 7 - 8
service/src/main/java/com/koobietech/eas/service/impl/EasStuProfileServiceImpl.java

@@ -10,6 +10,7 @@ import org.apache.poi.xwpf.usermodel.XWPFTableCell;
 import org.apache.poi.xwpf.usermodel.XWPFTableRow;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.poi.util.Units;
 import org.springframework.stereotype.Service;
 
 import java.io.*;
@@ -20,8 +21,8 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(EasStuProfileServiceImpl.class);
     private static final String TEMPLATE_PATH = "temp/StuRegistTemp.docx";
-    private static final String PHOTO_PATH = "temp/kun1.jpeg";
-    private static final String OUTPUT_PATH = "D:\\myDesk\\test.docx";
+    private static final String PHOTO_PATH = "temp/kun.jpeg";
+    private static final String OUTPUT_PATH = "C:\\Users\\lc\\Desktop\\test.docx";
 
     @Override
     public JsonResult StuProfileDownload(EasArcTlsStudents easArcTlsStudents) {
@@ -41,6 +42,7 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
             map.put("university", easArcTlsStudents.getUniversity());
 
             InputStream photo = getClass().getClassLoader().getResourceAsStream(PHOTO_PATH);
+            System.out.println( photo );
             map.put("avatar", photo);
 
             replacePlaceholders(doc, map);
@@ -76,12 +78,9 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
                                 cell.removeParagraph(0);
                                 if (value instanceof InputStream) {
                                     //如果是放置图片的单元格,在这里添加一个计算图片合适大小的方法,按比例
-
-
-
-
-                                    // 计算合适的宽度和高度
-                                    cell.addParagraph().createRun().addPicture((InputStream) value, XWPFDocument.PICTURE_TYPE_JPEG, "avatar.jpg", 400000, 400000);
+                                    cell.addParagraph().createRun().addPicture((InputStream) value,
+                                            XWPFDocument.PICTURE_TYPE_JPEG, "avatar.jpg",
+                                            Units.pixelToEMU(110), Units.pixelToEMU(140));
                                 } else {
                                     cell.setText(cellText.replace(placeholder, value.toString()));
                                 }

+ 7 - 0
upload/src/main/java/com/koobietech/eas/upload/UploadService.java

@@ -1,4 +1,11 @@
 package com.koobietech.eas.upload;
 
 public class UploadService {
+    public boolean uploadFile(){
+        return false;
+    }
+
+    public boolean moveFile(){
+        return false;
+    }
 }