张延森 3 lat temu
rodzic
commit
31d2745b9b

+ 1
- 1
deploy/bootstrap Wyświetl plik

@@ -2,6 +2,6 @@
2 2
 #
3 3
 #
4 4
 
5
-appVer="0.0.3"
5
+appVer="0.0.6"
6 6
 
7 7
 java -jar ./medical-plat-${appVer}.jar

+ 1
- 1
deploy/template.yml Wyświetl plik

@@ -11,7 +11,7 @@ Resources:
11 11
       Properties:
12 12
         Handler: com.yunzhi.demo.SpringApplication::main
13 13
         Runtime: custom
14
-        CodeUri: 'oss://yz-serverless/medical-plat/medical-plat-0.0.4.zip'
14
+        CodeUri: 'oss://yz-serverless/medical-plat/medical-plat-0.0.6.zip'
15 15
         MemorySize: 1024
16 16
         Timeout: 30
17 17
         InitializationTimeout: 30

+ 16
- 2
pom.xml Wyświetl plik

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.yunzhi</groupId>
12 12
 	<artifactId>medical-plat</artifactId>
13
-	<version>0.0.5</version>
13
+	<version>0.0.6</version>
14 14
 	<name>medical-plat</name>
15 15
 	<description>Demo project for Spring Boot</description>
16 16
 
@@ -116,7 +116,15 @@
116 116
 			<artifactId>weixin-java-miniapp</artifactId>
117 117
 			<version>3.8.0</version>
118 118
 		</dependency>
119
-		<!--weixin-miniapp start-->
119
+		<!--weixin-miniapp end-->
120
+
121
+		<!--commons-compress start-->
122
+<!--		<dependency>-->
123
+<!--			<groupId>org.apache.commons</groupId>-->
124
+<!--			<artifactId>commons-compress</artifactId>-->
125
+<!--			<version>1.21</version>-->
126
+<!--		</dependency>-->
127
+		<!--commons-compress end-->
120 128
 
121 129
 		<!--lombok start-->
122 130
 		<dependency>
@@ -150,6 +158,9 @@
150 158
 					<plugin>
151 159
 						<groupId>org.springframework.boot</groupId>
152 160
 						<artifactId>spring-boot-maven-plugin</artifactId>
161
+						<configuration>
162
+							<includeSystemScope>true</includeSystemScope>
163
+						</configuration>
153 164
 					</plugin>
154 165
 				</plugins>
155 166
 				<resources>
@@ -175,6 +186,9 @@
175 186
 					<plugin>
176 187
 						<groupId>org.springframework.boot</groupId>
177 188
 						<artifactId>spring-boot-maven-plugin</artifactId>
189
+						<configuration>
190
+							<includeSystemScope>true</includeSystemScope>
191
+						</configuration>
178 192
 					</plugin>
179 193
 
180 194
 					<!-- 跳过测试 -->

+ 30
- 0
src/main/java/com/yunzhi/demo/common/StringUtils.java Wyświetl plik

@@ -2,6 +2,7 @@ package com.yunzhi.demo.common;
2 2
 
3 3
 import java.io.UnsupportedEncodingException;
4 4
 import java.net.URLEncoder;
5
+import java.nio.charset.Charset;
5 6
 import java.util.Random;
6 7
 import java.util.regex.Matcher;
7 8
 import java.util.regex.Pattern;
@@ -9,6 +10,18 @@ import java.util.regex.Pattern;
9 10
 public class StringUtils {
10 11
     private static Pattern humpPattern = Pattern.compile("[A-Z]");
11 12
 
13
+    private static String[] charsets = new String[] {
14
+        "GBK",
15
+        "BIG5",
16
+        "GB18030",
17
+        "EUC-TW",
18
+        "ISO-8859-1",
19
+        "UTF-8",
20
+        "UTF-16",
21
+        "WINDOWS-1251",
22
+        "WINDOWS-1252"
23
+    };
24
+
12 25
     public static boolean isEmpty(String str) {
13 26
         return null == str || "".equals(str.trim()) || "null".equals(str) || "undefined".equals(str);
14 27
     }
@@ -117,4 +130,21 @@ public class StringUtils {
117 130
         prefix = prefix.substring(0, padLen);
118 131
         return prefix + src;
119 132
     }
133
+
134
+    public static String convert(String value, String fromEncoding, String toEncoding) throws UnsupportedEncodingException {
135
+        return new String(value.getBytes(fromEncoding), toEncoding);
136
+    }
137
+
138
+    public static String detectCharset(String value) throws UnsupportedEncodingException {
139
+        String probe = "UTF-8";
140
+        for(String c : charsets) {
141
+            Charset charset = Charset.forName(c);
142
+            if(charset != null) {
143
+                if(value.equals(convert(convert(value, charset.name(), probe), probe, charset.name()))) {
144
+                    return c;
145
+                }
146
+            }
147
+        }
148
+        return probe;
149
+    }
120 150
 }

+ 42
- 19
src/main/java/com/yunzhi/demo/controller/TaTestLogController.java Wyświetl plik

@@ -2,14 +2,13 @@ package com.yunzhi.demo.controller;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.api.R;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
-import com.yunzhi.demo.common.BaseController;
7
-import com.yunzhi.demo.common.Constants;
8
-import com.yunzhi.demo.common.DateUtils;
9
-import com.yunzhi.demo.common.ResponseBean;
10
-import com.yunzhi.demo.entity.TaPerson;
11
-import com.yunzhi.demo.entity.TaStudent;
7
+import com.yunzhi.demo.common.*;
8
+import com.yunzhi.demo.entity.*;
12 9
 import com.yunzhi.demo.service.ITaStudentService;
10
+import com.yunzhi.demo.service.ITmTestPdfService;
11
+import com.yunzhi.demo.service.ITmTestStudentService;
13 12
 import com.yunzhi.demo.vo.StudentTestLog;
14 13
 import io.swagger.annotations.Api;
15 14
 import io.swagger.annotations.ApiOperation;
@@ -19,12 +18,9 @@ import org.slf4j.LoggerFactory;
19 18
 import org.springframework.beans.factory.annotation.Autowired;
20 19
 import org.springframework.web.bind.annotation.*;
21 20
 import com.yunzhi.demo.service.ITaTestLogService;
22
-import com.yunzhi.demo.entity.TaTestLog;
23
-import org.springframework.web.multipart.MultipartFile;
24 21
 
25
-import java.io.File;
26
-import java.time.LocalDateTime;
27
-import java.util.zip.ZipFile;
22
+import java.util.List;
23
+
28 24
 
29 25
 /**
30 26
  * <p>
@@ -48,6 +44,11 @@ public class TaTestLogController extends BaseController {
48 44
     @Autowired
49 45
     public ITaStudentService iTaStudentService;
50 46
 
47
+    @Autowired
48
+    public ITmTestPdfService iTmTestPdfService;
49
+
50
+    @Autowired
51
+    public ITmTestStudentService iTmTestStudentService;
51 52
 
52 53
     /**
53 54
      * 分页查询列表
@@ -109,16 +110,38 @@ public class TaTestLogController extends BaseController {
109 110
         }
110 111
     }
111 112
 
113
+    /**
114
+     *
115
+     * @param testPdfList
116
+     * @return
117
+     * @throws Exception
118
+     */
119
+    @RequestMapping(value="/admin/taTestLog/upload/pdf",method= RequestMethod.POST)
120
+    @ApiOperation(value="上传体检文件", notes = "上传体检文件", httpMethod = "POST", response = ResponseBean.class)
121
+    public ResponseBean uploadPDF(@RequestBody List<TmTestPdf> testPdfList) throws Exception {
122
+        if (null == testPdfList || testPdfList.size() < 1) {
123
+            return ResponseBean.error("请设置上传内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
124
+        }
125
+
126
+        iTmTestPdfService.saveBatch(testPdfList);
127
+
128
+        return ResponseBean.success(null);
129
+    }
112 130
 
113
-    public ResponseBean uploadZip(@RequestPart("schoolId") String schoolId,
114
-                                  @RequestPart("file") MultipartFile multipartFile) throws Exception {
115
-        LocalDateTime now = LocalDateTime.now();
116
-        String prefix = String.format("test-%s-%s", schoolId, DateUtils.toString(now, "yyyy-MM-dd"));
117
-        File file = File.createTempFile(prefix, "zip");
118
-        file.deleteOnExit();
131
+    /**
132
+     *
133
+     * @param testStudentList
134
+     * @return
135
+     * @throws Exception
136
+     */
137
+    @RequestMapping(value="/admin/taTestLog/upload/excel",method= RequestMethod.POST)
138
+    @ApiOperation(value="上传体检映射文件", notes = "上传体检映射文件", httpMethod = "POST", response = ResponseBean.class)
139
+    public ResponseBean uploadExcel(@RequestBody List<TmTestStudent> testStudentList) throws Exception {
140
+        if (null == testStudentList || testStudentList.size() < 1) {
141
+            return ResponseBean.error("请设置上传内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
142
+        }
119 143
 
120
-        multipartFile.transferTo(file);
121
-        ZipFile zf = new ZipFile(file);
144
+        iTmTestStudentService.saveBatch(testStudentList);
122 145
 
123 146
         return ResponseBean.success(null);
124 147
     }

+ 40
- 0
src/main/java/com/yunzhi/demo/entity/TmTestPdf.java Wyświetl plik

@@ -0,0 +1,40 @@
1
+package com.yunzhi.demo.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+@Data
15
+@EqualsAndHashCode(callSuper = false)
16
+@Accessors(chain = true)
17
+@ApiModel(value="TmTestPdf对象", description="体检PDF导入日志")
18
+public class TmTestPdf implements Serializable {
19
+
20
+    private static final long serialVersionUID = 1L;
21
+
22
+    @ApiModelProperty(value = "序号")
23
+    @TableId(value = "serial_no", type = IdType.AUTO)
24
+    private Integer serialNo;
25
+
26
+    @ApiModelProperty(value = "学校ID")
27
+    private String schoolId;
28
+
29
+    @ApiModelProperty(value = "姓名")
30
+    private String studentName;
31
+
32
+    @ApiModelProperty(value = "体检编号")
33
+    private String testNo;
34
+
35
+    @ApiModelProperty(value = "文件地址")
36
+    private String url;
37
+
38
+    @ApiModelProperty(value = "创建时间")
39
+    private LocalDateTime createDate;
40
+}

+ 37
- 0
src/main/java/com/yunzhi/demo/entity/TmTestStudent.java Wyświetl plik

@@ -0,0 +1,37 @@
1
+package com.yunzhi.demo.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+@Data
15
+@EqualsAndHashCode(callSuper = false)
16
+@Accessors(chain = true)
17
+@ApiModel(value="TmTestStudent对象", description="体检学生日志")
18
+public class TmTestStudent implements Serializable {
19
+
20
+    private static final long serialVersionUID = 1L;
21
+
22
+    @ApiModelProperty(value = "序号")
23
+    @TableId(value = "serial_no", type = IdType.AUTO)
24
+    private Integer serialNo;
25
+
26
+    @ApiModelProperty(value = "学校ID")
27
+    private String schoolId;
28
+
29
+    @ApiModelProperty(value = "序号")
30
+    private String studentNo;
31
+
32
+    @ApiModelProperty(value = "体检编号")
33
+    private String testNo;
34
+
35
+    @ApiModelProperty(value = "创建时间")
36
+    private LocalDateTime createDate;
37
+}

+ 18
- 0
src/main/java/com/yunzhi/demo/mapper/TmTestPdfMapper.java Wyświetl plik

@@ -0,0 +1,18 @@
1
+package com.yunzhi.demo.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.yunzhi.demo.entity.TmTestPdf;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 体检PDF导入日志 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2021-04-15
14
+ */
15
+@Mapper
16
+public interface TmTestPdfMapper extends BaseMapper<TmTestPdf> {
17
+
18
+}

+ 18
- 0
src/main/java/com/yunzhi/demo/mapper/TmTestStudentMapper.java Wyświetl plik

@@ -0,0 +1,18 @@
1
+package com.yunzhi.demo.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.yunzhi.demo.entity.TmTestStudent;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 体检学生日志 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2021-04-15
14
+ */
15
+@Mapper
16
+public interface TmTestStudentMapper extends BaseMapper<TmTestStudent> {
17
+
18
+}

+ 16
- 0
src/main/java/com/yunzhi/demo/service/ITmTestPdfService.java Wyświetl plik

@@ -0,0 +1,16 @@
1
+package com.yunzhi.demo.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.yunzhi.demo.entity.TmTestPdf;
5
+
6
+/**
7
+ * <p>
8
+ * 体检PDF导入日志 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2021-04-15
13
+ */
14
+public interface ITmTestPdfService extends IService<TmTestPdf> {
15
+
16
+}

+ 16
- 0
src/main/java/com/yunzhi/demo/service/ITmTestStudentService.java Wyświetl plik

@@ -0,0 +1,16 @@
1
+package com.yunzhi.demo.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.yunzhi.demo.entity.TmTestStudent;
5
+
6
+/**
7
+ * <p>
8
+ * 体检学生日志 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2021-04-15
13
+ */
14
+public interface ITmTestStudentService extends IService<TmTestStudent> {
15
+
16
+}

+ 20
- 0
src/main/java/com/yunzhi/demo/service/impl/TmTestPdfServiceImpl.java Wyświetl plik

@@ -0,0 +1,20 @@
1
+package com.yunzhi.demo.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.yunzhi.demo.entity.TmTestPdf;
5
+import com.yunzhi.demo.mapper.TmTestPdfMapper;
6
+import com.yunzhi.demo.service.ITmTestPdfService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 体检PDF导入日志 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2021-04-15
16
+ */
17
+@Service
18
+public class TmTestPdfServiceImpl extends ServiceImpl<TmTestPdfMapper, TmTestPdf> implements ITmTestPdfService {
19
+
20
+}

+ 20
- 0
src/main/java/com/yunzhi/demo/service/impl/TmTestStudentServiceImpl.java Wyświetl plik

@@ -0,0 +1,20 @@
1
+package com.yunzhi.demo.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.yunzhi.demo.entity.TmTestStudent;
5
+import com.yunzhi.demo.mapper.TmTestStudentMapper;
6
+import com.yunzhi.demo.service.ITmTestStudentService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 体检学生日志 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2021-04-15
16
+ */
17
+@Service
18
+public class TmTestStudentServiceImpl extends ServiceImpl<TmTestStudentMapper, TmTestStudent> implements ITmTestStudentService {
19
+
20
+}

+ 5
- 0
src/main/resources/mapper/TmTestPdfMapper.xml Wyświetl plik

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.demo.mapper.TmTestPdfMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TmTestStudentMapper.xml Wyświetl plik

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.demo.mapper.TmTestStudentMapper">
4
+
5
+</mapper>