Browse Source

Merge branch 'wheng' of wuheng/eas-system into master

wuheng 1 year ago
parent
commit
e8e1b41968

+ 15 - 3
common/pom.xml

@@ -15,8 +15,16 @@
 
 
     <dependencies>
     <dependencies>
         <dependency>
         <dependency>
-            <groupId>cn.afterturn</groupId>
-            <artifactId>easypoi-base</artifactId>
+            <groupId>javax.annotation</groupId>
+            <artifactId>javax.annotation-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <groupId>org.springframework.boot</groupId>
@@ -41,7 +49,11 @@
         <dependency>
         <dependency>
             <groupId>com.koobietech.eas</groupId>
             <groupId>com.koobietech.eas</groupId>
             <artifactId>dao</artifactId>
             <artifactId>dao</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>org.springframework.security</groupId>
             <groupId>org.springframework.security</groupId>

+ 8 - 0
common/src/main/java/com/koobietech/eas/common/result/JsonResult.java

@@ -12,6 +12,14 @@ public class JsonResult implements Serializable {
 
 
     private Integer code = 200;
     private Integer code = 200;
 
 
+    /**
+     * 成功
+     * @return
+     */
+    public static JsonResult bool( boolean status ){
+        return status ? JsonResult.ok() : JsonResult.fail();
+    }
+
     /**
     /**
      * 成功
      * 成功
      * @return
      * @return

+ 0 - 2
common/src/main/java/com/koobietech/eas/common/service/impl/RedisServiceImpl.java

@@ -1,8 +1,6 @@
 package com.koobietech.eas.common.service.impl;
 package com.koobietech.eas.common.service.impl;
 
 
 import com.koobietech.eas.common.service.RedisService;
 import com.koobietech.eas.common.service.RedisService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 

+ 6 - 0
common/src/main/java/com/koobietech/eas/common/utils/ArchiveManager.java

@@ -2,8 +2,10 @@ package com.koobietech.eas.common.utils;
 
 
 import com.koobietech.eas.common.constant.FileType;
 import com.koobietech.eas.common.constant.FileType;
 import com.koobietech.eas.common.constant.UniversityCode;
 import com.koobietech.eas.common.constant.UniversityCode;
+import com.koobietech.eas.common.exception.EasException;
 import com.koobietech.eas.common.pojo.ArchiveNumberInfoPojo;
 import com.koobietech.eas.common.pojo.ArchiveNumberInfoPojo;
 import com.koobietech.eas.common.pojo.StudentNumberInfoPojo;
 import com.koobietech.eas.common.pojo.StudentNumberInfoPojo;
+import org.springframework.util.StringUtils;
 
 
 import java.time.LocalDate;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
@@ -72,6 +74,10 @@ public class ArchiveManager {
      * @return  ST911X3B98736M20251021273
      * @return  ST911X3B98736M20251021273
      */
      */
     public static String generateStudentCode(String studentNumber, String studentCardId, String schoolName, String enrollmentDate) {
     public static String generateStudentCode(String studentNumber, String studentCardId, String schoolName, String enrollmentDate) {
+        if ( !StringUtils.hasText(studentCardId)
+                || !StringUtils.hasText(schoolName) || !StringUtils.hasText(enrollmentDate) ) {
+            throw new EasException("参数不能为空");
+        }
         LocalDate localDateEnrollmentDate = LocalDate.of(Integer.parseInt(enrollmentDate), 1, 1);
         LocalDate localDateEnrollmentDate = LocalDate.of(Integer.parseInt(enrollmentDate), 1, 1);
         String studentAge = String.valueOf(getStudentAge(studentCardId));
         String studentAge = String.valueOf(getStudentAge(studentCardId));
         String studentNum = getStudentNum(studentNumber);
         String studentNum = getStudentNum(studentNumber);

+ 16 - 25
controller/pom.xml

@@ -14,19 +14,10 @@
     </parent>
     </parent>
 
 
     <dependencies>
     <dependencies>
-        <dependency>
-            <groupId>xerces</groupId>
-            <artifactId>xercesImpl</artifactId>
-        </dependency>
         <dependency>
         <dependency>
             <groupId>com.anji-plus</groupId>
             <groupId>com.anji-plus</groupId>
             <artifactId>captcha</artifactId>
             <artifactId>captcha</artifactId>
         </dependency>
         </dependency>
-        <dependency>
-            <groupId>cn.afterturn</groupId>
-            <artifactId>easypoi-base</artifactId>
-            <version>4.3.0</version>
-        </dependency>
         <dependency>
         <dependency>
             <groupId>com.github.xiaoymin</groupId>
             <groupId>com.github.xiaoymin</groupId>
             <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
             <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
@@ -64,7 +55,7 @@
         <dependency>
         <dependency>
             <groupId>com.koobietech.eas</groupId>
             <groupId>com.koobietech.eas</groupId>
             <artifactId>dao</artifactId>
             <artifactId>dao</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
+            <version>${project.version}</version>
             <scope>compile</scope>
             <scope>compile</scope>
         </dependency>
         </dependency>
     </dependencies>
     </dependencies>
@@ -82,21 +73,21 @@
     </dependencyManagement>
     </dependencyManagement>
 
 
     <build>
     <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>-->
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>false</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>
         <plugins>
             <plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <groupId>org.apache.maven.plugins</groupId>

+ 3 - 0
controller/src/main/java/com/koobietech/eas/ControllerApplication.java

@@ -6,6 +6,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.FilterType;
 import org.springframework.context.annotation.FilterType;
 
 
+/**
+ * @author lc
+ */
 @SpringBootApplication
 @SpringBootApplication
 @MapperScan(basePackages = {"com.koobietech.eas.mbg.mapper","com.koobietech.eas.dao.mapper"})
 @MapperScan(basePackages = {"com.koobietech.eas.mbg.mapper","com.koobietech.eas.dao.mapper"})
 @ComponentScan(basePackages = {"com.koobietech.eas"}, excludeFilters = {
 @ComponentScan(basePackages = {"com.koobietech.eas"}, excludeFilters = {

+ 3 - 0
controller/src/main/java/com/koobietech/eas/controller/EasEduClassController.java

@@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.List;
 import java.util.List;
 
 
+/**
+ * @author lc
+ */
 @RestController
 @RestController
 @Tag(name = "班级控制器")
 @Tag(name = "班级控制器")
 @RequestMapping("/class")
 @RequestMapping("/class")

+ 46 - 9
controller/src/main/java/com/koobietech/eas/controller/EasSysStuProfileController.java

@@ -7,9 +7,12 @@ import com.koobietech.eas.service.EasStuProfileService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
 
 
 /**
 /**
  * @author lc
  * @author lc
@@ -21,14 +24,48 @@ public class EasSysStuProfileController {
     @Resource
     @Resource
     private EasStuProfileService easStuProfileService;
     private EasStuProfileService easStuProfileService;
 
 
-    @PostMapping("/StuProfileDownload")
-    @Operation(summary = "保存学生档案为word文档到本地或者服务器中", description = "根据学生档案信息和管理员ID保存学生档案为word文档到本地或者服务器中,注意manager_id要传在url中")
-    public JsonResult StuProfileDownload(@RequestBody EasArcTlsStudents easArcTlsStudents, @RequestParam Integer manager_id) throws FileNotFoundException {
-        //StuProfileDownload返回值是boolean,这里用JsonResult包装一下 加上if判断
-        if (easStuProfileService.StuProfileDownload(easArcTlsStudents, manager_id)) {
-            return JsonResult.ok("下载成功");
-        }
-        return JsonResult.fail("下载失败");
+    @PostMapping("/add")
+    @Operation(summary = "添加学员", description = "添加学员")
+    public JsonResult add(@RequestBody EasArcTlsStudents easArcTlsStudents) {
+        return JsonResult.bool(easStuProfileService.add(easArcTlsStudents));
+    }
+
+    @PostMapping("/del/{id}")
+    @Operation(summary = "更新学员信息", description = "更新学员信息")
+    public JsonResult delete(@PathVariable int id){
+        boolean result = easStuProfileService.delete(id);
+        return JsonResult.bool(result);
+    }
+
+    @PostMapping("/update")
+    @Operation(summary = "更新学员信息", description = "更新学员信息")
+    public JsonResult update(@RequestBody EasArcTlsStudents studentDto){
+        boolean result = easStuProfileService.update(studentDto);
+        return JsonResult.bool(result);
+    }
+    @PostMapping("/query")
+    @Operation(summary = "查询学员信息", description = "查询学员信息")
+    public JsonResult query(@RequestBody(required = false) EasArcTlsStudents studentDto,
+                            @RequestParam Integer pageNum, @RequestParam Integer pageSize){
+        List<EasArcTlsStudents> res = easStuProfileService.query(studentDto, pageNum, pageSize);
+        return JsonResult.data(res);
     }
     }
 
 
+    @PostMapping("/importExcel")
+    @Operation(summary = "导入学员信息", description = "导入学员信息")
+    public JsonResult importExcel( MultipartFile file ){
+        InputStream inputStream = null;
+        boolean result = false;
+        try {
+            inputStream = file.getInputStream();
+            result = easStuProfileService.importExcel(inputStream);
+        } catch (IOException e) {}finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                } catch (IOException e) {}
+            }
+        }
+        return JsonResult.bool(result);
+    }
 }
 }

+ 112 - 0
controller/src/test/java/com/koobietech/eas/controller/ChatClient.java

@@ -0,0 +1,112 @@
+package com.koobietech.eas.controller;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.util.Scanner;
+
+/**
+ * ClassName: ChatClient
+ * Package: com.lc.chat
+ * Description:
+ *
+ * @Author 爱扣钉-陈晨
+ * @Create 2023/8/18 9:00
+ * @Version 1.0
+ */
+public class ChatClient {
+    public static void main(String[] args) throws Exception {
+        Scanner scanner = new Scanner(System.in);
+        //请输入链接地址
+        //创建网络链接对象Socket
+        Socket socket = new Socket("192.168.18.32",9999);
+        System.out.println("链接系统成功,请输入个人昵称,bye退出");
+        String nickname = scanner.nextLine();
+        //发送线程
+        SendThread send = new SendThread(socket,nickname);
+        send.start();
+
+        //接收线程
+        ReceiveThread receive = new ReceiveThread(socket);
+        receive.start();
+        //插队
+        send.join();
+
+    }
+}
+class ReceiveThread extends Thread{
+    Socket socket;
+
+    public ReceiveThread(Socket socket) {
+        this.socket = socket;
+    }
+
+    @Override
+    public void run() {
+        try {
+            //获取输入字节流
+            InputStream is = socket.getInputStream();
+            Scanner scanner = new Scanner(is);
+            //循环
+            while (scanner.hasNextLine()){
+                String s1 = socket.getInetAddress().toString().substring(1);
+                String s2 = InetAddress.getLocalHost().getHostAddress();
+                if (!s1.equals(s2)){
+                    String s = scanner.nextLine();
+                    System.out.println(s);
+                }
+
+            }
+            socket.close();
+
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
+class SendThread extends Thread {
+    private Socket socket;
+
+    private String nickname;
+
+    public SendThread(Socket socket , String nickname ) throws IOException {
+        this.socket = socket;
+        this.nickname = nickname;
+
+        //获取输出字节流
+        OutputStream os = socket.getOutputStream();
+        PrintStream ps = new PrintStream(os);
+        //发送名称
+        ps.println( nickname);
+    }
+
+    @Override
+    public void run() {
+        try {
+            //获取输出字节流
+            OutputStream os = socket.getOutputStream();
+            PrintStream ps = new PrintStream(os);
+            //键盘输入
+            Scanner scanner = new Scanner(System.in);
+            //循环
+            while (true){
+
+                String str = scanner.nextLine();
+                if (str.equals("bye")){
+                    break;
+                }
+                ps.println( nickname+":"+ str);
+
+            }
+            socket.shutdownOutput();
+            socket.close();
+
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
+

+ 102 - 0
dao/src/main/java/com/koobietech/eas/dao/dto/EasArcTlsStudentsDto.java

@@ -0,0 +1,102 @@
+package com.koobietech.eas.dao.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author lc
+ */
+@Data
+public class EasArcTlsStudentsDto {
+
+    @Schema(description = "对应的文件档案号")
+    @Excel(name = "文件档案号")
+    private String archiveNumber;
+
+    @Excel(name = "学生档案号")
+    @Schema(description = "归属的学员档案号")
+    private String studentNumber;
+
+    @Excel(name =  "学生姓名")
+    @Schema(description = "学生姓名")
+    private String studentName;
+
+    @Excel(name = "学生性别", replace = { "男_M", "女_F" } )
+    @Schema(description = "学生性别")
+    private String gender;
+
+    @Excel(name = "出生日期")
+    @Schema(description = "学生出生日期")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date birthdate;
+
+    @Excel(name = "学生居住地")
+    @Schema(description = "学生居住地址")
+    private String address;
+
+    @Excel(name = "学生联系电话")
+    @Schema(description = "学生联系电话")
+    private String phone;
+
+    @Excel(name = "学生电子邮箱")
+    @Schema(description = "学生电子邮箱")
+    private String email;
+
+    @Excel(name = "学生入学进入培训班日期", importFormat = "yyyy-MM-dd" )
+    @Schema(description = "学生入学进入培训班日期")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date enrollmentDate;
+
+    @Schema(description = "学生在培训班毕业日期")
+    @Excel(name = "学生在培训班毕业日期", importFormat = "yyyy-MM-dd" )
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date graduationDate;
+
+    @Excel(name = "学生培训时年级")
+    @Schema(description = "学生年级")
+    private Integer grade;
+
+    @Excel(name = "学生专业")
+    @Schema(description = "学生专业")
+    private String major;
+
+    @Excel(name = "学生辅修专业")
+    @Schema(description = "学生辅修专业")
+    private String minor;
+
+    @Excel(name = "学生所在学校")
+    @Schema(description = "学生所在学校")
+    private String university;
+
+    @ExcelIgnore
+    @Schema(description = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date createTime;
+
+    @ExcelIgnore
+    @Schema(description = "修改时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date modifyTime;
+
+    @Excel(name = "招生老师ID")
+    @Schema(description = "招生老师")
+    private Integer admissionsId;
+
+    @Excel(name = "直属负责人ID")
+    @Schema(description = "直属负责人ID")
+    private Integer managerId;
+
+    @ExcelIgnore
+    @Schema(description = "创建用户ID")
+    private Integer createUid;
+
+    @Schema(description = "学生身份证号")
+    @Excel(name = "学生身份证号")
+    private String studentIdnumber;
+
+}

+ 25 - 3
pom.xml

@@ -31,18 +31,35 @@
         <spring-context.version>5.3.24</spring-context.version>
         <spring-context.version>5.3.24</spring-context.version>
         <spring-beans.version>5.3.24</spring-beans.version>
         <spring-beans.version>5.3.24</spring-beans.version>
         <javax.servlet-api.version>4.0.1</javax.servlet-api.version>
         <javax.servlet-api.version>4.0.1</javax.servlet-api.version>
-        <spring-data-redis.version>2.7.3</spring-data-redis.version>
+        <spring-redis.version>2.7.3</spring-redis.version>
         <knife4j.version>4.1.0</knife4j.version>
         <knife4j.version>4.1.0</knife4j.version>
         <easypoi.version>4.4.0</easypoi.version>
         <easypoi.version>4.4.0</easypoi.version>
+        <poi.version>5.0.0</poi.version>
         <pagehelper.starter.version>1.3.1</pagehelper.starter.version>
         <pagehelper.starter.version>1.3.1</pagehelper.starter.version>
         <pagehelper.version>5.2.1</pagehelper.version>
         <pagehelper.version>5.2.1</pagehelper.version>
         <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
         <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
         <captcha.version>1.3.0</captcha.version>
         <captcha.version>1.3.0</captcha.version>
         <xerces.version>2.9.1</xerces.version>
         <xerces.version>2.9.1</xerces.version>
         <security.version>5.7.5</security.version>
         <security.version>5.7.5</security.version>
+        <javax.annotation.version>1.3.2</javax.annotation.version>
     </properties>
     </properties>
     <dependencyManagement>
     <dependencyManagement>
         <dependencies>
         <dependencies>
+            <dependency>
+                <groupId>javax.annotation</groupId>
+                <artifactId>javax.annotation-api</artifactId>
+                <version>${javax.annotation.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.poi</groupId>
+                <artifactId>poi-ooxml</artifactId>
+                <version>${poi.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.poi</groupId>
+                <artifactId>poi</artifactId>
+                <version>${poi.version}</version>
+            </dependency>
             <dependency>
             <dependency>
                 <groupId>org.springframework.security</groupId>
                 <groupId>org.springframework.security</groupId>
                 <artifactId>spring-security-core</artifactId>
                 <artifactId>spring-security-core</artifactId>
@@ -60,7 +77,7 @@
             </dependency>
             </dependency>
             <dependency>
             <dependency>
                 <groupId>cn.afterturn</groupId>
                 <groupId>cn.afterturn</groupId>
-                <artifactId>easypoi-base</artifactId>
+                <artifactId>easypoi-wps</artifactId>
                 <version>${easypoi.version}</version>
                 <version>${easypoi.version}</version>
             </dependency>
             </dependency>
             <dependency>
             <dependency>
@@ -68,6 +85,11 @@
                 <artifactId>easypoi-annotation</artifactId>
                 <artifactId>easypoi-annotation</artifactId>
                 <version>${easypoi.version}</version>
                 <version>${easypoi.version}</version>
             </dependency>
             </dependency>
+            <dependency>
+                <groupId>cn.afterturn</groupId>
+                <artifactId>easypoi-base</artifactId>
+                <version>${easypoi.version}</version>
+            </dependency>
             <dependency>
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-starter-security</artifactId>
                 <artifactId>spring-boot-starter-security</artifactId>
@@ -86,7 +108,7 @@
             <dependency>
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-starter-data-redis</artifactId>
                 <artifactId>spring-boot-starter-data-redis</artifactId>
-                <version>${spring-data-redis.version}</version>
+                <version>${spring-redis.version}</version>
             </dependency>
             </dependency>
             <dependency>
             <dependency>
                 <groupId>com.auth0</groupId>
                 <groupId>com.auth0</groupId>

+ 1 - 1
security/pom.xml

@@ -29,7 +29,7 @@
         <dependency>
         <dependency>
             <groupId>com.koobietech.eas</groupId>
             <groupId>com.koobietech.eas</groupId>
             <artifactId>service</artifactId>
             <artifactId>service</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
+            <version>${project.version}</version>
             <scope>compile</scope>
             <scope>compile</scope>
         </dependency>
         </dependency>
     </dependencies>
     </dependencies>

+ 13 - 8
service/pom.xml

@@ -8,6 +8,14 @@
     <description>service</description>
     <description>service</description>
 
 
     <dependencies>
     <dependencies>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+        </dependency>
         <dependency>
         <dependency>
             <groupId>xerces</groupId>
             <groupId>xerces</groupId>
             <artifactId>xercesImpl</artifactId>
             <artifactId>xercesImpl</artifactId>
@@ -15,7 +23,6 @@
         <dependency>
         <dependency>
             <groupId>cn.afterturn</groupId>
             <groupId>cn.afterturn</groupId>
             <artifactId>easypoi-base</artifactId>
             <artifactId>easypoi-base</artifactId>
-            <version>4.3.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>com.github.pagehelper</groupId>
             <groupId>com.github.pagehelper</groupId>
@@ -32,30 +39,28 @@
         <dependency>
         <dependency>
             <groupId>com.koobietech.eas</groupId>
             <groupId>com.koobietech.eas</groupId>
             <artifactId>dao</artifactId>
             <artifactId>dao</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
+            <version>${project.version}</version>
             <scope>compile</scope>
             <scope>compile</scope>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>com.koobietech.eas</groupId>
             <groupId>com.koobietech.eas</groupId>
             <artifactId>mbg</artifactId>
             <artifactId>mbg</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
+            <version>${project.version}</version>
             <scope>compile</scope>
             <scope>compile</scope>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>com.koobietech.eas</groupId>
             <groupId>com.koobietech.eas</groupId>
             <artifactId>common</artifactId>
             <artifactId>common</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
+            <version>${project.version}</version>
             <scope>compile</scope>
             <scope>compile</scope>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-core</artifactId>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>com.anji-plus</groupId>
             <groupId>com.anji-plus</groupId>
             <artifactId>captcha</artifactId>
             <artifactId>captcha</artifactId>
-            <version>1.3.0</version>
-            <scope>compile</scope>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
             <groupId>javax.servlet</groupId>

+ 14 - 3
service/src/main/java/com/koobietech/eas/service/EasStuProfileService.java

@@ -1,10 +1,21 @@
 package com.koobietech.eas.service;
 package com.koobietech.eas.service;
 
 
-import com.koobietech.eas.common.result.JsonResult;
 import com.koobietech.eas.mbg.model.EasArcTlsStudents;
 import com.koobietech.eas.mbg.model.EasArcTlsStudents;
 
 
-import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.List;
 
 
+/**
+ * @author lc
+ */
 public interface EasStuProfileService {
 public interface EasStuProfileService {
-    boolean StuProfileDownload(EasArcTlsStudents easArcTlsStudents,Integer manager_id) throws FileNotFoundException;
+    boolean add(EasArcTlsStudents easArcTlsStudents);
+
+    List<EasArcTlsStudents> query(EasArcTlsStudents studentDto, Integer pageNum, Integer pageSize);
+
+    boolean update(EasArcTlsStudents studentDto);
+
+    boolean delete(int id);
+
+    boolean importExcel(InputStream inputStream);
 }
 }

+ 3 - 3
service/src/main/java/com/koobietech/eas/service/impl/EasArchivesFilesServiceImpl.java

@@ -58,7 +58,7 @@ public class EasArchivesFilesServiceImpl implements EasArchivesFilesService {
 
 
     @Override
     @Override
     public ArchivesDto saveArchiveFile(String studentNumber, InputStream stream, String type) {
     public ArchivesDto saveArchiveFile(String studentNumber, InputStream stream, String type) {
-        String archiveCode = getArchiveCode(studentNumber, FileType.valueOf(type).getSuffix());
+        String archiveCode = getArchiveCode(studentNumber, String.valueOf(FileType.valueOf(type).getValue()));
         String path = getArchivePath(studentNumber, archiveCode, FileType.valueOf(type).getSuffix());
         String path = getArchivePath(studentNumber, archiveCode, FileType.valueOf(type).getSuffix());
         boolean status = fileManager.saveFile(stream, path);
         boolean status = fileManager.saveFile(stream, path);
         return new ArchivesDto(path, status, archiveCode, type);
         return new ArchivesDto(path, status, archiveCode, type);
@@ -115,14 +115,14 @@ public class EasArchivesFilesServiceImpl implements EasArchivesFilesService {
     }
     }
 
 
     private ArchivesDto saveArchiveDocumentFile(String studentNumber, XWPFDocument document, String type) {
     private ArchivesDto saveArchiveDocumentFile(String studentNumber, XWPFDocument document, String type) {
-        String archiveCode = ArchiveManager.generateArchiveCode(studentNumber, FileType.valueOf(type).getSuffix());
+        String archiveCode = ArchiveManager.generateArchiveCode(studentNumber, String.valueOf(FileType.valueOf(type).getValue()));
         String path = getArchivePath(studentNumber, archiveCode, FileType.valueOf(type).getSuffix());
         String path = getArchivePath(studentNumber, archiveCode, FileType.valueOf(type).getSuffix());
         boolean status = fileManager.saveDocument(document, path);
         boolean status = fileManager.saveDocument(document, path);
         return new ArchivesDto(path, status, archiveCode, type);
         return new ArchivesDto(path, status, archiveCode, type);
     }
     }
 
 
     private ArchivesDto saveArchiveWorkbookFile(String studentNumber, Workbook workbook, String type) {
     private ArchivesDto saveArchiveWorkbookFile(String studentNumber, Workbook workbook, String type) {
-        String archiveCode = ArchiveManager.generateArchiveCode(studentNumber, FileType.valueOf(type).getSuffix());
+        String archiveCode = ArchiveManager.generateArchiveCode(studentNumber, String.valueOf(FileType.valueOf(type).getValue()));
         String path = getArchivePath(studentNumber, archiveCode, FileType.valueOf(type).getSuffix());
         String path = getArchivePath(studentNumber, archiveCode, FileType.valueOf(type).getSuffix());
         boolean status = fileManager.saveWorkbook(workbook, path);
         boolean status = fileManager.saveWorkbook(workbook, path);
         return new ArchivesDto(path, status, archiveCode, type);
         return new ArchivesDto(path, status, archiveCode, type);

+ 111 - 19
service/src/main/java/com/koobietech/eas/service/impl/EasStuProfileServiceImpl.java

@@ -1,16 +1,23 @@
 package com.koobietech.eas.service.impl;
 package com.koobietech.eas.service.impl;
 
 
+import cn.afterturn.easypoi.excel.ExcelImportUtil;
+import cn.afterturn.easypoi.excel.entity.ImportParams;
+import com.github.pagehelper.PageHelper;
 import com.koobietech.eas.common.constant.FileType;
 import com.koobietech.eas.common.constant.FileType;
 import com.koobietech.eas.common.constant.Gender;
 import com.koobietech.eas.common.constant.Gender;
+import com.koobietech.eas.common.constant.UniversityCode;
 import com.koobietech.eas.common.exception.EasException;
 import com.koobietech.eas.common.exception.EasException;
 import com.koobietech.eas.common.utils.ArchiveManager;
 import com.koobietech.eas.common.utils.ArchiveManager;
 import com.koobietech.eas.common.utils.DateManager;
 import com.koobietech.eas.common.utils.DateManager;
+import com.koobietech.eas.common.utils.SecurityManager;
 import com.koobietech.eas.dao.dto.ArchivesDto;
 import com.koobietech.eas.dao.dto.ArchivesDto;
+import com.koobietech.eas.dao.dto.EasArcTlsStudentsDto;
 import com.koobietech.eas.mbg.mapper.EasArcArchivesMapper;
 import com.koobietech.eas.mbg.mapper.EasArcArchivesMapper;
 import com.koobietech.eas.mbg.mapper.EasArcTlsStudentsMapper;
 import com.koobietech.eas.mbg.mapper.EasArcTlsStudentsMapper;
 import com.koobietech.eas.mbg.mapper.EasSysStudentMapper;
 import com.koobietech.eas.mbg.mapper.EasSysStudentMapper;
 import com.koobietech.eas.mbg.model.EasArcArchives;
 import com.koobietech.eas.mbg.model.EasArcArchives;
 import com.koobietech.eas.mbg.model.EasArcTlsStudents;
 import com.koobietech.eas.mbg.model.EasArcTlsStudents;
+import com.koobietech.eas.mbg.model.EasArcTlsStudentsExample;
 import com.koobietech.eas.mbg.model.EasSysStudent;
 import com.koobietech.eas.mbg.model.EasSysStudent;
 import com.koobietech.eas.service.EasArchivesFilesService;
 import com.koobietech.eas.service.EasArchivesFilesService;
 import com.koobietech.eas.service.EasStuProfileService;
 import com.koobietech.eas.service.EasStuProfileService;
@@ -20,9 +27,12 @@ import org.apache.poi.xwpf.usermodel.XWPFDocument;
 import org.apache.poi.xwpf.usermodel.XWPFTable;
 import org.apache.poi.xwpf.usermodel.XWPFTable;
 import org.apache.poi.xwpf.usermodel.XWPFTableCell;
 import org.apache.poi.xwpf.usermodel.XWPFTableCell;
 import org.apache.poi.xwpf.usermodel.XWPFTableRow;
 import org.apache.poi.xwpf.usermodel.XWPFTableRow;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.io.IOException;
@@ -32,6 +42,8 @@ import java.util.*;
 @Service
 @Service
 public class EasStuProfileServiceImpl implements EasStuProfileService {
 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 TEMPLATE_PATH = "temp/StuRegistTemp.docx";
     private static final String PHOTO_PATH = "temp/kun.jpeg";
     private static final String PHOTO_PATH = "temp/kun.jpeg";
     @Resource
     @Resource
@@ -46,7 +58,7 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
     private EasArchivesFilesService easArchivesFilesService;
     private EasArchivesFilesService easArchivesFilesService;
 
 
     @Override
     @Override
-    public boolean StuProfileDownload(EasArcTlsStudents easArcTlsStudents, Integer manager_id) {
+    public boolean add(EasArcTlsStudents easArcTlsStudents) {
 
 
         //使用try-with-resources 语句 保证流的关闭
         //使用try-with-resources 语句 保证流的关闭
         try (InputStream wordStream = getClass().getClassLoader().getResourceAsStream(TEMPLATE_PATH)) {
         try (InputStream wordStream = getClass().getClassLoader().getResourceAsStream(TEMPLATE_PATH)) {
@@ -55,9 +67,17 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
                 //调用内部类方法 生成学号
                 //调用内部类方法 生成学号
                 String studentNumber = generateStudentNumber(easArcTlsStudents);
                 String studentNumber = generateStudentNumber(easArcTlsStudents);
 
 
+                easArcTlsStudents.setStudentNumber(studentNumber);
                 Map<String, Object> map = generateDataMap(easArcTlsStudents, studentNumber);
                 Map<String, Object> map = generateDataMap(easArcTlsStudents, studentNumber);
                 replacePlaceholders(doc, map);
                 replacePlaceholders(doc, map);
+                //这里会生成一个学生档案保存本地 目前这里有bug保存不成功 而且文件后缀有错误
+                ArchivesDto archivesDto = insertEasArcArchives(easArcTlsStudents, doc);
+                if ( !archivesDto.isStatus() ) {
+                    throw new EasException("EasArcArchives保存失败", 8002);
+                }
+
                 //将easArcTlsStudents 保存到数据库
                 //将easArcTlsStudents 保存到数据库
+                easArcTlsStudents.setArchiveNumber(archivesDto.getArchiveCode());
                 boolean isTlsStudentsInsert = insertEasArcTlsStudents(easArcTlsStudents);
                 boolean isTlsStudentsInsert = insertEasArcTlsStudents(easArcTlsStudents);
                 if (!isTlsStudentsInsert) {
                 if (!isTlsStudentsInsert) {
                     throw new EasException("EasArcTlsStudents保存失败", 8000);
                     throw new EasException("EasArcTlsStudents保存失败", 8000);
@@ -66,18 +86,92 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
                 if (!isSysStudentsInsert) {
                 if (!isSysStudentsInsert) {
                     throw new EasException("EasSysStudents保存失败", 8001);
                     throw new EasException("EasSysStudents保存失败", 8001);
                 }
                 }
-                //这里会生成一个学生档案保存本地 目前这里有bug保存不成功 而且文件后缀有错误
-                boolean isEasArcArchives = insertEasArcArchives(easArcTlsStudents, studentNumber, manager_id, doc);
-                if (!isEasArcArchives) {
-                    throw new EasException("EasArcArchives保存失败", 8002);
-                }
+
             }
             }
         } catch (IOException e) {
         } catch (IOException e) {
-            return false;
+            logger.error(e.getMessage());
+            throw new EasException("生成档案失败", 8003);
         }
         }
         return true;
         return true;
     }
     }
 
 
+    @Override
+    public List<EasArcTlsStudents> query(EasArcTlsStudents studentDto, Integer pageNum, Integer pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        EasArcTlsStudentsExample easArcTlsStudentsExample = new EasArcTlsStudentsExample();
+        EasArcTlsStudentsExample.Criteria criteria = easArcTlsStudentsExample.createCriteria();
+        if ( Objects.nonNull(studentDto) ) {
+            if (StringUtils.hasText(studentDto.getStudentName())) {
+                criteria.andStudentNameLike("%" + studentDto.getStudentName() + "%");
+            }
+            if (StringUtils.hasText(studentDto.getStudentNumber())) {
+                criteria.andStudentNumberLike("%" + studentDto.getStudentNumber() + "%");
+            }
+            if (Objects.nonNull(studentDto.getGender())) {
+                criteria.andGenderEqualTo(studentDto.getGender());
+            }
+            if (StringUtils.hasText(studentDto.getStudentIdnumber())) {
+                criteria.andStudentIdnumberEqualTo(studentDto.getStudentIdnumber());
+            }
+            if (StringUtils.hasText(studentDto.getPhone())) {
+                criteria.andPhoneLike("%"+studentDto.getPhone() + "% %" + studentDto.getPhone() + "%");
+            }
+            if (StringUtils.hasText(studentDto.getUniversity())) {
+                criteria.andUniversityLike("%" + studentDto.getUniversity() + "%");
+            }
+            if (StringUtils.hasText(studentDto.getAddress())) {
+                criteria.andAddressLike("%" + studentDto.getAddress() + "%");
+            }
+            if (StringUtils.hasText(studentDto.getEmail())) {
+                criteria.andEmailEqualTo(studentDto.getEmail());
+            }
+            if (Objects.nonNull(studentDto.getEnrollmentDate())) {
+                criteria.andEnrollmentDateEqualTo(studentDto.getEnrollmentDate());
+            }
+        }
+        List<EasArcTlsStudents> easArcTlsStudents = easArcTlsStudentsMapper.selectByExample(easArcTlsStudentsExample);
+        return easArcTlsStudents;
+    }
+
+    @Override
+    public boolean update(EasArcTlsStudents studentDto) {
+        return easArcTlsStudentsMapper.updateByPrimaryKey(studentDto) == 1;
+    }
+
+    @Override
+    public boolean delete(int id) {
+        return easArcTlsStudentsMapper.deleteByPrimaryKey(id) == 1;
+    }
+
+    @Override
+    public boolean importExcel(InputStream inputStream) {
+        ImportParams params = new ImportParams();
+        params.setTitleRows(1);
+        params.setHeadRows(1);
+        try {
+            EasArcTlsStudents easArcTlsStudents = null;
+                    List<EasArcTlsStudentsDto> studentList = ExcelImportUtil.importExcel(
+                    inputStream, EasArcTlsStudentsDto.class, params);
+            for (EasArcTlsStudentsDto studentDto : studentList) {
+                easArcTlsStudents = new EasArcTlsStudents();
+                BeanUtils.copyProperties(studentDto, easArcTlsStudents);
+                add(easArcTlsStudents);
+            }
+            return true;
+        } catch (Exception ignored){
+            logger.error(ignored.getMessage());
+        } finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                } catch (IOException ignored) {
+                    logger.error(ignored.getMessage());
+                }
+            }
+        }
+        return false;
+    }
+
     private Map<String, Object> generateDataMap(EasArcTlsStudents easArcTlsStudents, String studentNumber) {
     private Map<String, Object> generateDataMap(EasArcTlsStudents easArcTlsStudents, String studentNumber) {
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         map.put("student_name", easArcTlsStudents.getStudentName());
         map.put("student_name", easArcTlsStudents.getStudentName());
@@ -93,14 +187,12 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
         return map;
         return map;
     }
     }
 
 
-    public boolean insertEasArcArchives(EasArcTlsStudents easArcTlsStudents, String studentNumber, Integer managerId, XWPFDocument doc) {
+    public ArchivesDto insertEasArcArchives(EasArcTlsStudents easArcTlsStudents,  XWPFDocument doc) {
         // 生成档案号
         // 生成档案号
-        String archiveCode = ArchiveManager.generateArchiveCode(studentNumber, String.valueOf(FileType.DOCX));
+        String archiveCode = ArchiveManager.generateArchiveCode(easArcTlsStudents.getStudentNumber(), String.valueOf(FileType.DOCX.getValue()));
 
 
         // 保存学员档案文件
         // 保存学员档案文件
         ArchivesDto archivesDto = easArchivesFilesService.saveArchiveStudentsFile(easArcTlsStudents.getStudentIdnumber(), doc);
         ArchivesDto archivesDto = easArchivesFilesService.saveArchiveStudentsFile(easArcTlsStudents.getStudentIdnumber(), doc);
-        String filePath = archivesDto.getPath();
-        String arcType = archivesDto.getFileType();
 
 
         // 设置时间和有效期
         // 设置时间和有效期
         Date createTime = DateManager.convertToYearMonthDayToDate(new Date());
         Date createTime = DateManager.convertToYearMonthDayToDate(new Date());
@@ -114,21 +206,21 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
         // 创建 EasArcArchives 对象并设置属性
         // 创建 EasArcArchives 对象并设置属性
         EasArcArchives easArcArchives = new EasArcArchives();
         EasArcArchives easArcArchives = new EasArcArchives();
         easArcArchives.setArchiveNumber(archiveCode);
         easArcArchives.setArchiveNumber(archiveCode);
-        easArcArchives.setStudentNumber(studentNumber);
-        easArcArchives.setFilePath(filePath);
-        easArcArchives.setArctype(arcType);
+        easArcArchives.setStudentNumber(easArcTlsStudents.getStudentNumber());
+        easArcArchives.setFilePath(archivesDto.getPath());
+        easArcArchives.setArctype(archivesDto.getFileType());
         easArcArchives.setCreateTime(createTime);
         easArcArchives.setCreateTime(createTime);
         easArcArchives.setModifyTime(modifyTime);
         easArcArchives.setModifyTime(modifyTime);
         easArcArchives.setValidityTime(validityTime);
         easArcArchives.setValidityTime(validityTime);
-        easArcArchives.setManagerId(managerId);
-        easArcArchives.setCreateUid(1);
+        easArcArchives.setManagerId(easArcTlsStudents.getManagerId());
+        easArcArchives.setCreateUid(SecurityManager.getLoginUid().intValue());
         easArcArchives.setCreateDate(new Date());
         easArcArchives.setCreateDate(new Date());
 
 
         // 插入到数据库
         // 插入到数据库
         int result = easArcArchivesMapper.insert(easArcArchives);
         int result = easArcArchivesMapper.insert(easArcArchives);
-
+        archivesDto.setStatus( result == 1 );
         // 返回是否成功插入数据库
         // 返回是否成功插入数据库
-        return result > 0;
+        return archivesDto;
     }
     }
 
 
 
 
@@ -153,7 +245,7 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
         String year = String.valueOf(calendar.get(Calendar.YEAR));
         String year = String.valueOf(calendar.get(Calendar.YEAR));
 
 
         return ArchiveManager.generateStudentCode("",
         return ArchiveManager.generateStudentCode("",
-                easArcTlsStudents.getStudentIdnumber(), easArcTlsStudents.getUniversity(), year);
+                easArcTlsStudents.getStudentIdnumber(), String.valueOf(UniversityCode.getCode(easArcTlsStudents.getUniversity().trim())), year);
     }
     }
 
 
     private String convertToGender(String gender) {
     private String convertToGender(String gender) {