Browse Source

扫描答题卡时直接上传base64

答题卡模块转pdf
wn
王宁 2 months ago
parent
commit
73463a09cf

+ 6
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/scantron/ScantronMapper.java View File

2
 
2
 
3
 import com.xhkjedu.base.TkMapper;
3
 import com.xhkjedu.base.TkMapper;
4
 import com.xhkjedu.sapi.model.scantron.TScantron;
4
 import com.xhkjedu.sapi.model.scantron.TScantron;
5
+import com.xhkjedu.sapi.model.system.TSchool;
5
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
6
 
7
 
7
 import java.util.List;
8
 import java.util.List;
20
     //修改答题卡公开状态
21
     //修改答题卡公开状态
21
     int updateScantronPubliched(@Param("sid")int sid, @Param("publiched")int publiched);
22
     int updateScantronPubliched(@Param("sid")int sid, @Param("publiched")int publiched);
22
 
23
 
24
+    //获取答题卡所在学校区域信息
25
+    TSchool getSchoolCloudByScanid(@Param("sid")int sid);
26
+
27
+    //更改pdf地址
28
+    Integer updatePdfpath(@Param("sid")int sid, @Param("pdfpath")String pdfpath);
23
 }
29
 }

+ 35
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/scantron/ScantronService.java View File

1
 package com.xhkjedu.sapi.service.scantron;
1
 package com.xhkjedu.sapi.service.scantron;
2
 
2
 
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONArray;
5
+import com.xhkjedu.sapi.config.ConfigKey;
3
 import com.xhkjedu.sapi.mapper.scantron.ScantronMapper;
6
 import com.xhkjedu.sapi.mapper.scantron.ScantronMapper;
4
 import com.xhkjedu.sapi.model.scantron.TScantron;
7
 import com.xhkjedu.sapi.model.scantron.TScantron;
8
+import com.xhkjedu.sapi.model.system.TSchool;
5
 import com.xhkjedu.utils.N_Utils;
9
 import com.xhkjedu.utils.N_Utils;
10
+import com.xhkjedu.vo.ResultVo;
6
 import org.springframework.stereotype.Service;
11
 import org.springframework.stereotype.Service;
7
 
12
 
8
 import javax.annotation.Resource;
13
 import javax.annotation.Resource;
38
         }else{
43
         }else{
39
             tScantron.setPapertype(2);
44
             tScantron.setPapertype(2);
40
         }
45
         }
46
+        String base64Path = tScantron.getPdfpath();
47
+        tScantron.setPdfpath(null);
41
         scantronMapper.insertSelective(tScantron);
48
         scantronMapper.insertSelective(tScantron);
49
+
50
+        Integer sid = tScantron.getId();
51
+        String pdfpath = saveScantronPdf(base64Path,sid,tScantron.getSlayout());
52
+        scantronMapper.updatePdfpath(sid,pdfpath);//更改转为路径的pdf地址
53
+    }
54
+
55
+    //答题卡-保存pdf
56
+    private String saveScantronPdf(String pdfpath,Integer sid,Integer column){
57
+        TSchool school = scantronMapper.getSchoolCloudByScanid(sid);
58
+        List<String> imgList = JSONArray.parseArray(pdfpath, String.class);
59
+        String savefloder = school.getCloudcode() + "/" + school.getSchoolid() + "/scantron/";
60
+        String params = "filepaths=" + imgList + "&savefloder=" + savefloder + "&column=" + column + "&filename=" + sid;
61
+        String fileInfoStr = N_Utils.sendPost(ConfigKey.fileapi + "ba/topdf", params);
62
+        ResultVo fileResult = JSON.parseObject(fileInfoStr, ResultVo.class);
63
+        if (fileResult.getCode() == 0 && N_Utils.isNotEmpty(fileResult.getObj())) {
64
+            return fileResult.getObj().toString();
65
+        }else{
66
+            return "";
67
+        }
42
     }
68
     }
69
+
43
     //答题卡-修改
70
     //答题卡-修改
44
     public void update(TScantron tScantron){
71
     public void update(TScantron tScantron){
45
         if(N_Utils.isTrueInteger(tScantron.getSlayout()) && tScantron.getSlayout() > 1){
72
         if(N_Utils.isTrueInteger(tScantron.getSlayout()) && tScantron.getSlayout() > 1){
47
         }else{
74
         }else{
48
             tScantron.setPapertype(2);
75
             tScantron.setPapertype(2);
49
         }
76
         }
77
+
78
+        TScantron oldScantron = scantronMapper.selectByPrimaryKey(tScantron.getSid());
79
+        if(!oldScantron.getPdfpath().equals(tScantron.getPdfpath())){
80
+            String base64Path = tScantron.getPdfpath();
81
+            String pdfpath = saveScantronPdf(base64Path,tScantron.getSid(),tScantron.getSlayout());
82
+            tScantron.setPdfpath(pdfpath);
83
+        }
84
+
50
         scantronMapper.updateByPrimaryKeySelective(tScantron);
85
         scantronMapper.updateByPrimaryKeySelective(tScantron);
51
     }
86
     }
52
 
87
 

+ 12
- 0
sapi/src/main/resources/mapper/scantron/ScantronMapper.xml View File

27
     <update id="updateScantronPubliched">
27
     <update id="updateScantronPubliched">
28
         update t_scantron set publiched=#{publiched} where sid=#{sid}
28
         update t_scantron set publiched=#{publiched} where sid=#{sid}
29
     </update>
29
     </update>
30
+
31
+    <!--获取答题卡所在学校区域信息-->
32
+    <select id="getSchoolCloudByScanid" resultType="com.xhkjedu.sapi.model.system.TSchool">
33
+        select schoolid,(select cloudcode from t_cloud order by cloudid limit 1) cloudcode
34
+        from t_scantron where sid=#{sid}
35
+    </select>
36
+
37
+    <!--更改pdf地址-->
38
+    <update id="updatePdfpath">
39
+        update t_scantron set pdfpath=#{pdfpath} where sid=#{sid}
40
+    </update>
41
+
30
 </mapper>
42
 </mapper>

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/config/ConfigKey.java View File

53
         //Spring Boot注解读取application.properties或者application-{profile}.properties文件时默认的是ISO_8859_1编码,中文会乱码
53
         //Spring Boot注解读取application.properties或者application-{profile}.properties文件时默认的是ISO_8859_1编码,中文会乱码
54
         ConfigKey.signName = new String(signName.getBytes("ISO_8859_1"),"UTF-8");
54
         ConfigKey.signName = new String(signName.getBytes("ISO_8859_1"),"UTF-8");
55
     }
55
     }
56
+
57
+    public static String fileapi;//文件服务地址
58
+    @Value("${fileapi}")
59
+    public void setFileapi(String fileapi) {
60
+        ConfigKey.fileapi = fileapi;
61
+    }
56
 }
62
 }

+ 37
- 26
smarking/src/main/java/com/xhkjedu/smarking/listener/MessageConsumer.java View File

1
 package com.xhkjedu.smarking.listener;
1
 package com.xhkjedu.smarking.listener;
2
 
2
 
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMapper;
5
+import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestion;
3
 import com.xhkjedu.smarking.utils.ConvertUtil;
6
 import com.xhkjedu.smarking.utils.ConvertUtil;
4
 import lombok.extern.slf4j.Slf4j;
7
 import lombok.extern.slf4j.Slf4j;
8
+import org.springframework.amqp.core.Message;
9
+import org.springframework.amqp.rabbit.annotation.RabbitHandler;
10
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
5
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.stereotype.Component;
12
 import org.springframework.stereotype.Component;
7
 
13
 
14
+import javax.annotation.Resource;
15
+import java.time.LocalDateTime;
16
+
8
 /**
17
 /**
9
  * 消息到达消费者监听类
18
  * 消息到达消费者监听类
10
  */
19
  */
11
 @Component
20
 @Component
12
 @Slf4j
21
 @Slf4j
13
 public class MessageConsumer {
22
 public class MessageConsumer {
23
+    @Resource
24
+    private MsPaperStudentQuestionMapper msPaperStudentQuestionMapper;
14
 
25
 
15
 
26
 
16
     @Autowired
27
     @Autowired
18
 
29
 
19
 
30
 
20
     /*
31
     /*
21
-     * @Description 学生题块、试题答案图片合并完处理转换状态
32
+     * @Description 学生试题答案图片合并完处理转换状态
22
      * @Date 2024/10/29 14:43:39
33
      * @Date 2024/10/29 14:43:39
23
      * @Author WN
34
      * @Author WN
24
      * @Param [message]
35
      * @Param [message]
25
      * @Return void
36
      * @Return void
26
      **/
37
      **/
27
-    // @RabbitHandler
28
-    // @RabbitListener(queues = "${rabbitmq.markingImgMergeHandleQueue}")
29
-    // public void imgMergeHandleQueue(Message message) {
30
-    //     try {
31
-    //         String msg = new String(message.getBody(), "UTF-8");
32
-    //         System.out.println(LocalDateTime.now() + "学生题块、试题答案合并接收消息内容:" + msg);
33
-    //         EPaperStudentQuestion psq = JSON.parseObject(msg, EPaperStudentQuestion.class);
34
-    //         if (psq.getConverted() != 1) {//合并失败不修改学生答案
35
-    //             psq.setStuanswer(null);
36
-    //         } else {
37
-    //             psq.setStuanswer(JSON.toJSONString(new String[]{psq.getStuanswer()}));
38
-    //         }
39
-    //         ePaperStudentQuestionMapper.updateByPrimaryKeySelective(psq);
40
-    //     } catch (Exception e) {
41
-    //         log.error("学生试题答案合并失败:" + e.getMessage());
42
-    //     }
43
-    // }
38
+    @RabbitHandler
39
+    @RabbitListener(queues = "${rabbitmq.markingImgMergeHandleQueue}")
40
+    public void imgMergeHandleQueue(Message message) {
41
+        try {
42
+            String msg = new String(message.getBody(), "UTF-8");
43
+            System.out.println(LocalDateTime.now() + "学生试题答案合并接收消息内容:" + msg);
44
+            MsPaperStudentQuestion psq = JSON.parseObject(msg, MsPaperStudentQuestion.class);
45
+            if (psq.getConverted() != 1) {//合并失败不修改学生答案
46
+                psq.setStuanswer(null);
47
+            } else {
48
+                psq.setStuanswer(JSON.toJSONString(new String[]{psq.getStuanswer()}));
49
+            }
50
+            msPaperStudentQuestionMapper.updateByPrimaryKeySelective(psq);
51
+        } catch (Exception e) {
52
+            log.error("学生试题答案合并失败:" + e.getMessage());
53
+        }
54
+    }
44
 
55
 
45
     /**
56
     /**
46
      * @Description 修改试卷答题卡pdf
57
      * @Description 修改试卷答题卡pdf
85
     // }
96
     // }
86
 
97
 
87
     /**
98
     /**
88
-     * @Description 考试附件试卷图片转pdf
99
+     * @Description 阅卷附件试卷图片转pdf
89
      * @Param [message]
100
      * @Param [message]
90
      * @Return void
101
      * @Return void
91
      * @Author wn
102
      * @Author wn
96
     // public void examImageToPdfHandleQueue(Message message) {
107
     // public void examImageToPdfHandleQueue(Message message) {
97
     //     try {
108
     //     try {
98
     //         String msg = new String(message.getBody(), "UTF-8");
109
     //         String msg = new String(message.getBody(), "UTF-8");
99
-    //         System.out.println(LocalDateTime.now() + "考试附件试卷图片转pdf接收消息内容:" + msg);
110
+    //         System.out.println(LocalDateTime.now() + "阅卷附件试卷图片转pdf接收消息内容:" + msg);
100
     //         EPaperFile paperFile = JSON.parseObject(msg, EPaperFile.class);
111
     //         EPaperFile paperFile = JSON.parseObject(msg, EPaperFile.class);
101
     //         if (paperFile.getConverted() != null && paperFile.getConverted() == 1) {
112
     //         if (paperFile.getConverted() != null && paperFile.getConverted() == 1) {
102
     //             ePaperFileMapper.updateSourcepathByEpid(paperFile.getEpid(),paperFile.getSourcepath());
113
     //             ePaperFileMapper.updateSourcepathByEpid(paperFile.getEpid(),paperFile.getSourcepath());
103
     //         }
114
     //         }
104
     //     } catch (Exception e) {
115
     //     } catch (Exception e) {
105
-    //         log.error("考试附件试卷图片转pdf失败:" + e.getMessage());
116
+    //         log.error("阅卷附件试卷图片转pdf失败:" + e.getMessage());
106
     //     }
117
     //     }
107
     // }
118
     // }
108
 
119
 
111
     // public void examHtmlToPdfHandleQueue(Message message) {
122
     // public void examHtmlToPdfHandleQueue(Message message) {
112
     //     try {
123
     //     try {
113
     //         String msg = new String(message.getBody(), "UTF-8");
124
     //         String msg = new String(message.getBody(), "UTF-8");
114
-    //         System.out.println(LocalDateTime.now() + "考试报告html转pdf接收消息内容:" + msg);
125
+    //         System.out.println(LocalDateTime.now() + "阅卷报告html转pdf接收消息内容:" + msg);
115
     //         EReportVo report = JSON.parseObject(msg, EReportVo.class);
126
     //         EReportVo report = JSON.parseObject(msg, EReportVo.class);
116
     //         if (report.getConverted() != null && report.getConverted() != 1) return;
127
     //         if (report.getConverted() != null && report.getConverted() != 1) return;
117
-    //         eReportGenerateMapper.updatePdf(report);//修改考试pdf地址
128
+    //         eReportGenerateMapper.updatePdf(report);//修改阅卷pdf地址
118
     //         Integer examid = report.getExamid();
129
     //         Integer examid = report.getExamid();
119
     //         Integer type = report.getType();
130
     //         Integer type = report.getType();
120
     //         if (3 == type) {
131
     //         if (3 == type) {
121
     //             Integer classid = report.getClassid();
132
     //             Integer classid = report.getClassid();
122
-    //             Integer num = eReportGenerateMapper.getNoPdfNumByExamAndClassId(examid, classid);//考试班级未生成pdf的数量
133
+    //             Integer num = eReportGenerateMapper.getNoPdfNumByExamAndClassId(examid, classid);//阅卷班级未生成pdf的数量
123
     //             if (0 == num) {
134
     //             if (0 == num) {
124
     //                 Map map = new HashMap();
135
     //                 Map map = new HashMap();
125
     //                 String savefolder = eReportGenerateMapper.getSaveFolder(examid);
136
     //                 String savefolder = eReportGenerateMapper.getSaveFolder(examid);
130
     //                 convertUtil.htmlToPdf(map);
141
     //                 convertUtil.htmlToPdf(map);
131
     //             }
142
     //             }
132
     //         } else if (4 == type) {
143
     //         } else if (4 == type) {
133
-    //             Integer num = eReportGenerateMapper.getNoPdfNumByExamId(examid);//考试未生成pdf的数量
144
+    //             Integer num = eReportGenerateMapper.getNoPdfNumByExamId(examid);//阅卷未生成pdf的数量
134
     //             if (0 == num) {
145
     //             if (0 == num) {
135
     //                 eBaseMapper.updateExamReportState(examid, 2);
146
     //                 eBaseMapper.updateExamReportState(examid, 2);
136
     //             }
147
     //             }
137
     //         }
148
     //         }
138
     //     } catch (Exception e) {
149
     //     } catch (Exception e) {
139
-    //         log.error("考试报告html转pdf失败:" + e.getMessage());
150
+    //         log.error("阅卷报告html转pdf失败:" + e.getMessage());
140
     //     }
151
     //     }
141
     // }
152
     // }
142
 }
153
 }

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/system/SchoolMapper.java View File

1
 package com.xhkjedu.smarking.mapper.system;
1
 package com.xhkjedu.smarking.mapper.system;
2
 
2
 
3
+import com.xhkjedu.smarking.vo.system.SchoolCloudVo;
4
+import org.apache.ibatis.annotations.Param;
5
+
3
 public interface SchoolMapper {
6
 public interface SchoolMapper {
4
 
7
 
5
     //获取学校当前年份
8
     //获取学校当前年份
7
 
10
 
8
     //获取用户当前年份
11
     //获取用户当前年份
9
     Integer getYearByUserId(Integer userid);
12
     Integer getYearByUserId(Integer userid);
13
+
14
+    //获取考试对应区域码和学校id
15
+    SchoolCloudVo getSchoolCloudcode(@Param("mpid")Integer mpid);
10
 }
16
 }

+ 56
- 17
smarking/src/main/java/com/xhkjedu/smarking/service/scan/MsScanbatchPaperService.java View File

1
 package com.xhkjedu.smarking.service.scan;
1
 package com.xhkjedu.smarking.service.scan;
2
 
2
 
3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONArray;
5
+import com.xhkjedu.smarking.config.ConfigKey;
4
 import com.xhkjedu.smarking.mapper.scan.MsScanbatchMapper;
6
 import com.xhkjedu.smarking.mapper.scan.MsScanbatchMapper;
5
 import com.xhkjedu.smarking.mapper.scan.MsScanbatchPaperBlockMapper;
7
 import com.xhkjedu.smarking.mapper.scan.MsScanbatchPaperBlockMapper;
6
 import com.xhkjedu.smarking.mapper.scan.MsScanbatchPaperBlockQuestionMapper;
8
 import com.xhkjedu.smarking.mapper.scan.MsScanbatchPaperBlockQuestionMapper;
8
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentBlockMapper;
10
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentBlockMapper;
9
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
11
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentMapper;
10
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMergeMapper;
12
 import com.xhkjedu.smarking.mapper.stupaper.MsPaperStudentQuestionMergeMapper;
13
+import com.xhkjedu.smarking.mapper.system.SchoolMapper;
11
 import com.xhkjedu.smarking.mapper.system.UserMapper;
14
 import com.xhkjedu.smarking.mapper.system.UserMapper;
12
 import com.xhkjedu.smarking.model.scan.MsScanbatchPaper;
15
 import com.xhkjedu.smarking.model.scan.MsScanbatchPaper;
13
 import com.xhkjedu.smarking.model.scan.MsScanbatchPaperBlock;
16
 import com.xhkjedu.smarking.model.scan.MsScanbatchPaperBlock;
17
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestionMerge;
20
 import com.xhkjedu.smarking.model.stupaper.MsPaperStudentQuestionMerge;
18
 import com.xhkjedu.smarking.utils.ConvertUtil;
21
 import com.xhkjedu.smarking.utils.ConvertUtil;
19
 import com.xhkjedu.smarking.utils.MarkingUtil;
22
 import com.xhkjedu.smarking.utils.MarkingUtil;
23
+import com.xhkjedu.smarking.vo.system.SchoolCloudVo;
20
 import com.xhkjedu.utils.N_Utils;
24
 import com.xhkjedu.utils.N_Utils;
25
+import com.xhkjedu.vo.ResultVo;
21
 import org.springframework.stereotype.Service;
26
 import org.springframework.stereotype.Service;
22
 import org.springframework.transaction.annotation.Transactional;
27
 import org.springframework.transaction.annotation.Transactional;
23
 
28
 
51
     private MsPaperStudentBlockMapper msPaperStudentBlockMapper;
56
     private MsPaperStudentBlockMapper msPaperStudentBlockMapper;
52
     @Resource
57
     @Resource
53
     private ConvertUtil convertUtil;
58
     private ConvertUtil convertUtil;
59
+    @Resource
60
+    private SchoolMapper schoolMapper;
54
 
61
 
55
     /**
62
     /**
56
      * @Description 新增
63
      * @Description 新增
113
             return;
120
             return;
114
         }
121
         }
115
 
122
 
116
-
117
         //保存扫描信息
123
         //保存扫描信息
118
         savePaperBlockQuestions(msScanbatchPaper);
124
         savePaperBlockQuestions(msScanbatchPaper);
119
         //学生试卷信息
125
         //学生试卷信息
129
 
135
 
130
     //保存扫描试卷-保存扫描题块试题信息
136
     //保存扫描试卷-保存扫描题块试题信息
131
     private void savePaperBlockQuestions(MsScanbatchPaper msScanbatchPaper){
137
     private void savePaperBlockQuestions(MsScanbatchPaper msScanbatchPaper){
138
+        //获取学校对应区域码,
139
+        SchoolCloudVo schoolCloudVo = schoolMapper.getSchoolCloudcode(msScanbatchPaper.getMpid());
140
+        String saveFloder = schoolCloudVo.getCloudcode() + "/" + schoolCloudVo.getSchoolid() + "/";
141
+
142
+        String paperfront = uploadBase64Img(msScanbatchPaper.getPaperfront(),1,saveFloder);
143
+        if(N_Utils.isNotEmpty(paperfront)){
144
+            msScanbatchPaper.setPaperfront(paperfront);
145
+        }
146
+        String paperback = uploadBase64Img(msScanbatchPaper.getPaperback(),1,saveFloder);
147
+        if(N_Utils.isNotEmpty(paperback)){
148
+            msScanbatchPaper.setPaperback(paperback);
149
+        }
150
+        String examnopic = uploadBase64Img(msScanbatchPaper.getExamnopic(),1,saveFloder);
151
+        if(N_Utils.isNotEmpty(examnopic)){
152
+            msScanbatchPaper.setExamnopic(examnopic);
153
+        }
154
+
132
         msScanbatchPaperMapper.insertUseGeneratedKeys(msScanbatchPaper);
155
         msScanbatchPaperMapper.insertUseGeneratedKeys(msScanbatchPaper);
133
         Integer mspid = msScanbatchPaper.getId();
156
         Integer mspid = msScanbatchPaper.getId();
134
         msScanbatchPaper.setMspid(mspid);
157
         msScanbatchPaper.setMspid(mspid);
138
         for (MsScanbatchPaperBlock spblock : spblocks) {
161
         for (MsScanbatchPaperBlock spblock : spblocks) {
139
             spblock.setMspid(mspid);
162
             spblock.setMspid(mspid);
140
             spblock.setBatchid(msScanbatchPaper.getBatchid());
163
             spblock.setBatchid(msScanbatchPaper.getBatchid());
164
+
165
+            //题块多图片合并比一张图片
166
+            String rtnBlock = uploadBase64Img(spblock.getPicpath(),2,saveFloder);
167
+            spblock.setPicpath(rtnBlock);
168
+
169
+            //题块多图片合并比一张图片
170
+            String extendBlock = uploadBase64Img(spblock.getExtendpath(),2,saveFloder);
171
+            spblock.setExtendpath(extendBlock);
141
         }
172
         }
142
 
173
 
143
         msScanbatchPaperBlockMapper.insertList(spblocks);
174
         msScanbatchPaperBlockMapper.insertList(spblocks);
155
         }
186
         }
156
         //更改识别数量
187
         //更改识别数量
157
         msScanbatchMapper.updateIdentifynum(msScanbatchPaper.getBatchid());
188
         msScanbatchMapper.updateIdentifynum(msScanbatchPaper.getBatchid());
189
+    }
158
 
190
 
191
+    //图片base上传
192
+    private String uploadBase64Img(String stupic,Integer merged,String saveFloder){
193
+        String apiMethod = "";
194
+        String params = "";
195
+        if(merged == 1){
196
+            //说明上传的图片为单张保存
197
+            params = "base64path=" + stupic;
198
+            apiMethod = "bs/base";
199
+        }else{
200
+            //上传的多张图片需要合并为一张
201
+            List<String> imgList =JSONArray.parseArray(stupic, String.class);
202
+            params = "filepaths=" + imgList;
203
+            apiMethod = "bs/mbase_merge";
204
+        }
205
+        //处理字段那种图片路径,base64转图片
206
+        params = params + "&savefolder=" + saveFloder + "marking/scan/";
207
+        String fileInfoStr = N_Utils.sendPost(ConfigKey.fileapi + apiMethod, params);
208
+        ResultVo fileResult = JSON.parseObject(fileInfoStr, ResultVo.class);
209
+        if (fileResult.getCode() == 0 && N_Utils.isNotEmpty(fileResult.getObj())) {
210
+            return fileResult.getObj().toString();
211
+        }else{
212
+            return "";
213
+        }
159
     }
214
     }
160
 
215
 
161
     //保存扫描试卷-清空学生试卷题块试题信息
216
     //保存扫描试卷-清空学生试卷题块试题信息
199
         Double stuPaperScore = 0.0;//学生试卷得分
254
         Double stuPaperScore = 0.0;//学生试卷得分
200
         List<MsPaperStudentBlock>  saveBlockList = new ArrayList<>();// 保存学生题块信息
255
         List<MsPaperStudentBlock>  saveBlockList = new ArrayList<>();// 保存学生题块信息
201
         List<MsPaperStudentQuestionMerge> saveQuesList = new ArrayList<>();//保存学生提交试题
256
         List<MsPaperStudentQuestionMerge> saveQuesList = new ArrayList<>();//保存学生提交试题
202
-        List<MsPaperStudentBlock> needConvertList = new ArrayList<>();//需要合并图片的题块
203
         Integer timestamp = N_Utils.getSecondTimestamp();
257
         Integer timestamp = N_Utils.getSecondTimestamp();
204
 
258
 
205
         for(MsScanbatchPaperBlock spblock : spblocks){
259
         for(MsScanbatchPaperBlock spblock : spblocks){
213
             }
267
             }
214
             studentBlock.setConverted(0);
268
             studentBlock.setConverted(0);
215
             saveBlockList.add(studentBlock);
269
             saveBlockList.add(studentBlock);
216
-            needConvertList.add(studentBlock);
217
 
270
 
218
             List<MsPaperStudentQuestionMerge> stuQuestions = studentBlock.getQuestions();//学生试题
271
             List<MsPaperStudentQuestionMerge> stuQuestions = studentBlock.getQuestions();//学生试题
219
             List<MsScanbatchPaperBlockQuestion> spbquestions = spblock.getSpbquestions();//扫描题块下试题
272
             List<MsScanbatchPaperBlockQuestion> spbquestions = spblock.getSpbquestions();//扫描题块下试题
288
         msPaperStudentBlockMapper.updateBatchStuBlock(saveBlockList);
341
         msPaperStudentBlockMapper.updateBatchStuBlock(saveBlockList);
289
         msPaperStudentQuestionMergeMapper.updateBatchStuQues(saveQuesList);
342
         msPaperStudentQuestionMergeMapper.updateBatchStuQues(saveQuesList);
290
         msPaperStudentMapper.updateByPrimaryKeySelective(msPaperStudent);
343
         msPaperStudentMapper.updateByPrimaryKeySelective(msPaperStudent);
291
-        handleStudentNeedConvert(needConvertList);
292
 
344
 
293
         rtnanswernum = saveQuesList.size();
345
         rtnanswernum = saveQuesList.size();
294
 
346
 
295
         return rtnanswernum;
347
         return rtnanswernum;
296
     }
348
     }
297
 
349
 
298
-    private void handleStudentNeedConvert(List<MsPaperStudentBlock> needConvertList){
299
-        if(needConvertList.size() > 0){
300
-            for(MsPaperStudentBlock studentBlock : needConvertList){
301
-                String stuAnswer = studentBlock.getStuanswer();
302
-                List<String> stuPicList = JSON.parseArray(stuAnswer, String.class);
303
-                if(stuPicList != null && stuPicList.size() > 1){
304
-                    convertUtil.imgMerge(studentBlock.getMpsbid(),stuPicList,2);
305
-                }
306
-            }
307
-        }
308
-    }
309
-
310
-
311
     /*
350
     /*
312
      * @Description 扫描记录-查看原卷
351
      * @Description 扫描记录-查看原卷
313
      * @Date 2024/10/25 17:22:45
352
      * @Date 2024/10/25 17:22:45

+ 15
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/system/SchoolCloudVo.java View File

1
+package com.xhkjedu.smarking.vo.system;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @Description:学校区域信息
7
+ * @Author: WN
8
+ * @Date: 2024/10/29 16:00:08
9
+ **/
10
+@Data
11
+public class SchoolCloudVo {
12
+    private Integer schoolid;
13
+
14
+    private String cloudcode;
15
+}

+ 4
- 0
smarking/src/main/resources/application.properties View File

92
 #\u89E3\u6790ip\u5F52\u5C5E\u5730\u6570\u636E
92
 #\u89E3\u6790ip\u5F52\u5C5E\u5730\u6570\u636E
93
 ipregiondb=D:\\school\\ip2region.xdb
93
 ipregiondb=D:\\school\\ip2region.xdb
94
 
94
 
95
+#\u6587\u4EF6\u670D\u52A1\u5730\u5740
96
+fileapi=https://schoolfiletest.xhkjedu.com/
97
+
98
+
95
 #\u7248\u672C\u53F7
99
 #\u7248\u672C\u53F7
96
 buildnum=301
100
 buildnum=301
97
 versionname=Test_v3.14.1
101
 versionname=Test_v3.14.1

+ 6
- 0
smarking/src/main/resources/mapper/system/SchoolMapper.xml View File

10
         select s.year from t_user u left join t_school s on u.schoolid=s.schoolid
10
         select s.year from t_user u left join t_school s on u.schoolid=s.schoolid
11
         where u.userid=#{userid}
11
         where u.userid=#{userid}
12
     </select>
12
     </select>
13
+
14
+    <!--获取考试对应区域码和学校id-->
15
+    <select id="getSchoolCloudcode" resultType="com.xhkjedu.smarking.vo.system.SchoolCloudVo">
16
+        select e.schoolid,(select cloudcode from t_cloud order by cloudid limit 1) cloudcode from ms_paper p left join ms_exam e on p.examid=p.examid
17
+        where p.mpid=#{mpid}
18
+    </select>
13
 </mapper>
19
 </mapper>

Loading…
Cancel
Save