Browse Source

Merge remote-tracking branch 'origin/master' into ywx

tags/正式3.3.0
雍文秀 2 years ago
parent
commit
7e5b1e30b4

+ 19
- 2
sapi/src/main/java/com/xhkjedu/sapi/controller/system/ModuleController.java View File

@@ -37,17 +37,18 @@ public class ModuleController {
37 37
     @PostMapping("/list")
38 38
     public ResultVo listModules(@RequestBody TModule module){
39 39
         N_Utils.validation(new Object[]{module.getSchoolid(),"学校id",1,module.getModuletype(),"模块归属",1});
40
-        List<TModule> lst = moduleService.listModules(module.getSchoolid(), module.getModuletype(), 1);
40
+        List<TModule> lst = moduleService.listModules(module.getSchoolid(), module.getModuletype(), module.getDisplay());
41 41
         return new ResultVo(0,"获取应用集合成功",lst);
42 42
     }
43 43
 
44 44
     @PostMapping("/list2")
45 45
     public ResultVo listModules2(@RequestBody TModule module){
46 46
         N_Utils.validation(new Object[]{module.getSchoolid(),"学校id",1,module.getModuletype(),"模块归属",1});
47
-        List<TModule> lst = moduleService.listModules(module.getSchoolid(), module.getModuletype(), 1);
47
+        List<TModule> lst = moduleService.listModules(module.getSchoolid(), module.getModuletype(), module.getDisplay());
48 48
         return new ResultVo(0,"获取应用集合成功",lst);
49 49
     }
50 50
 
51
+    //学生网页端模块获取
51 52
     @PostMapping("/list_stu")
52 53
     public ResultVo listStuModules(@RequestBody TModule module){
53 54
         N_Utils.validation(new Object[]{module.getSchoolid(),"学校id",1,module.getModuletype(),"模块归属",1});
@@ -160,4 +161,20 @@ public class ModuleController {
160 161
         List<Map> list = moduleService.listForSel2(schoolid, moduletype);
161 162
         return new ResultVo(0,"获取模块选择列表成功", list);
162 163
     }
164
+
165
+    //设置显示
166
+    @PostMapping("/dis")
167
+    public ResultVo updateModuleDisplay(@RequestBody TModule module){
168
+        N_Utils.validation(new Object[]{module.getModuleid(),"模块id",2});
169
+        moduleService.updateModuleDisplay(module.getModuleid(),1);
170
+        return new ResultVo(0,"设置模块显示成功");
171
+    }
172
+
173
+    //设置模块不显示
174
+    @PostMapping("/nodis")
175
+    public ResultVo updateModuleNoDisplay(@RequestBody TModule module){
176
+        N_Utils.validation(new Object[]{module.getModuleid(),"模块id",2});
177
+        moduleService.updateModuleDisplay(module.getModuleid(),10);
178
+        return new ResultVo(0,"设置模块不显示成功");
179
+    }
163 180
 }

+ 3
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/ModuleMapper.java View File

@@ -58,4 +58,7 @@ public interface ModuleMapper extends TkMapper<TModule> {
58 58
 
59 59
     //批量保存
60 60
     void batchSave(@Param("modules") List<TModule> modules);
61
+
62
+    //修改模块状态
63
+    void updateModuleDisplay(@Param("moduleid") String moduleid, @Param("display") Integer display);
61 64
 }

+ 5
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/ModuleService.java View File

@@ -194,4 +194,9 @@ public class ModuleService {
194 194
     public void batchSave(List<TModule> modules) {
195 195
         moduleMapper.batchSave(modules);
196 196
     }
197
+
198
+    //修改模块状态
199
+    public void updateModuleDisplay(String moduleid,Integer dispaly){
200
+        moduleMapper.updateModuleDisplay(moduleid,dispaly);
201
+    }
197 202
 }

+ 3
- 1
sapi/src/main/resources/application.properties View File

@@ -2,6 +2,8 @@ server.port=8087
2 2
 spring.application.name=sapi
3 3
 #注册到我们本地的eureka注册中心,端口8081
4 4
 eureka.client.service-url.defaultZone=http://127.0.0.1:8081/eureka/
5
+#eureka.client.register-with-eureka=false
6
+#eureka.client.fetch-registry=false
5 7
 #设置eureka输出日志级别
6 8
 logging.level.com.netflix=error
7 9
 spring.datasource.url=jdbc:mysql://dbtest.xhkjedu.com:3306/xhkjedu_school_test?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&allowMultiQueries=true
@@ -98,4 +100,4 @@ cron.syncnum=100
98 100
 #每隔3s清除一下请求地址map
99 101
 cron.deleteUriMap=0/3 * * * * ?
100 102
 #版本号
101
-versionname=Test_v3.2.6
103
+versionname=Test_v3.2.7

+ 5
- 0
sapi/src/main/resources/mapper/system/ModuleMapper.xml View File

@@ -73,4 +73,9 @@
73 73
             ,#{m.minout},#{m.mclass},#{m.level},#{m.mdefault},#{m.display},#{m.defaultid},#{m.createid},#{m.createtime},#{m.schoolid})
74 74
         </foreach>
75 75
     </insert>
76
+
77
+    <!--修改模块状态-->
78
+    <update id="updateModuleDisplay">
79
+        update t_module set display=#{display} where moduleid=#{moduleid}
80
+    </update>
76 81
 </mapper>

+ 4
- 4
sstudy/src/main/java/com/xhkjedu/sstudy/controller/resource/GuideController.java View File

@@ -11,6 +11,7 @@ import com.xhkjedu.vo.ResultVo;
11 11
 import com.xhkjedu.sstudy.vo.paper.AnalyzeSearchVo;
12 12
 import com.xhkjedu.sstudy.vo.resource.GuideAnalyzeVo;
13 13
 import com.xhkjedu.sstudy.vo.resource.GuideVo;
14
+import lombok.extern.slf4j.Slf4j;
14 15
 import org.springframework.beans.factory.annotation.Autowired;
15 16
 import org.springframework.util.CollectionUtils;
16 17
 import org.springframework.web.bind.annotation.PostMapping;
@@ -29,6 +30,7 @@ import java.util.Map;
29 30
  **/
30 31
 @RequestMapping("/guide")
31 32
 @RestController
33
+@Slf4j
32 34
 public class GuideController {
33 35
     @Autowired
34 36
     private GuideService guideService;
@@ -106,8 +108,7 @@ public class GuideController {
106 108
         String lsbid = guide.getLsbid();
107 109
         N_Utils.validation(new Object[]{createid,"教师id",1,subjectid,"科目",2,lsbid,"教材",2});
108 110
 
109
-        guideService.save(guide);
110
-        return new ResultVo(0, "保存成功");
111
+        return guideService.save(guide);
111 112
     }
112 113
 
113 114
     //分享预习
@@ -122,8 +123,7 @@ public class GuideController {
122 123
         String lsbid = guide.getLsbid();
123 124
         N_Utils.validation(new Object[]{resourceid,"资源",2,createid,"教师id",1,subjectid,"科目",2,lsbid,"教材",2});
124 125
 
125
-        guideService.shareGuide(guide);
126
-        return new ResultVo(0, "分享成功");
126
+        return guideService.shareGuide(guide);
127 127
     }
128 128
 
129 129
     //删除预习

+ 101
- 74
sstudy/src/main/java/com/xhkjedu/sstudy/service/resource/GuideService.java View File

@@ -14,10 +14,13 @@ import com.xhkjedu.sstudy.vo.paper.AnalyzeSearchVo;
14 14
 import com.xhkjedu.sstudy.vo.resource.GuideAnalyzeVo;
15 15
 import com.xhkjedu.sstudy.vo.resource.GuideVo;
16 16
 import com.xhkjedu.utils.N_Utils;
17
+import com.xhkjedu.vo.ResultVo;
18
+import lombok.extern.slf4j.Slf4j;
17 19
 import org.apache.commons.lang3.StringUtils;
18 20
 import org.springframework.beans.factory.annotation.Autowired;
19 21
 import org.springframework.stereotype.Service;
20 22
 import org.springframework.transaction.annotation.Transactional;
23
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
21 24
 
22 25
 import javax.annotation.Resource;
23 26
 import java.util.*;
@@ -30,6 +33,7 @@ import java.util.stream.Collectors;
30 33
  * Date 2021/10/20 10:37
31 34
  **/
32 35
 @Service
36
+@Slf4j
33 37
 public class GuideService {
34 38
     @Resource
35 39
     private GuideMapper guideMapper;
@@ -90,76 +94,93 @@ public class GuideService {
90 94
     }
91 95
 
92 96
     //保存学生预习
93
-    @Transactional
94
-    public Integer save(TGuide guide){
95
-        Integer timestamp = N_Utils.getSecondTimestamp();
96
-        guide.setCreatetime(timestamp);
97
-        guideMapper.insertUseGeneratedKeys(guide);
98
-        Integer guideid = guide.getId();//预习id
99
-        guide.setGuideid(guideid);
100
-
101
-        //保存资源
102
-        List<TResource> resources = guide.getResources();
103
-        for(TResource r : resources) {
104
-            r.setCreateid(guide.getCreateid());
105
-            r.setCreatetime(guide.getCreatetime());
106
-            r.setLevel(3);
107
-            r.setResourcestate(1);
108
-            r.setResourcetype(10);
109
-            r.setBelong(4);
110
-            r.setSchoolid(guide.getSchoolid());
111
-            r.setSubjectid(guide.getSubjectid());
112
-
113
-            String resourceid = StudyUtil.getId();//资源id
114
-            r.setResourceid(resourceid);
115
-            Integer resourceclass = r.getResourceclass();
116
-            if (resourceclass == 3 || resourceclass == 4 || resourceclass == 6) {
117
-                r.setConverted(1);
118
-            } else if (resourceclass == 5 && (r.getSuffix().equals("flv") || r.getMp4code().equals("h264"))) {
119
-                r.setConverted(1);
97
+    @Transactional(rollbackFor = Exception.class)
98
+    public ResultVo save(TGuide guide){
99
+
100
+        try {
101
+            Integer timestamp = N_Utils.getSecondTimestamp();
102
+            guide.setCreatetime(timestamp);
103
+            guideMapper.insertUseGeneratedKeys(guide);
104
+            Integer guideid = guide.getId();//预习id
105
+            guide.setGuideid(guideid);
106
+
107
+            //保存资源
108
+            List<TResource> resources = guide.getResources();
109
+            for(TResource r : resources) {
110
+                r.setCreateid(guide.getCreateid());
111
+                r.setCreatetime(guide.getCreatetime());
112
+                r.setLevel(3);
113
+                r.setResourcestate(1);
114
+                r.setResourcetype(10);
115
+                r.setBelong(4);
116
+                r.setSchoolid(guide.getSchoolid());
117
+                r.setSubjectid(guide.getSubjectid());
118
+
119
+                String resourceid = StudyUtil.getId();//资源id
120
+                r.setResourceid(resourceid);
121
+                Integer resourceclass = r.getResourceclass();
122
+                if (resourceclass == 3 || resourceclass == 4 || resourceclass == 6) {
123
+                    r.setConverted(1);
124
+                } else if (resourceclass == 5 && (r.getSuffix().equals("flv") || r.getMp4code().equals("h264"))) {
125
+                    r.setConverted(1);
126
+                }
127
+                //保存资源信息
128
+                resourceMapper.insertSelective(r);
129
+                //保存预习资源关联关系
130
+                TGuideResource gr = new TGuideResource();
131
+                gr.setGuideid(guideid);
132
+                gr.setResourceid(resourceid);
133
+                gr.setCreateid(guide.getCreateid());
134
+                gr.setCreatetime(guide.getCreatetime());
135
+                guideResourceMapper.insertUseGeneratedKeys(gr);
136
+
137
+                convertUtil.convertResource(r);//资源转换(word或ppt转为pdf,视频非h264编码转码,压缩包解压)
120 138
             }
121
-            //保存资源信息
122
-            resourceMapper.insertSelective(r);
123
-            //保存预习资源关联关系
124
-            TGuideResource gr = new TGuideResource();
125
-            gr.setGuideid(guideid);
126
-            gr.setResourceid(resourceid);
127
-            gr.setCreateid(guide.getCreateid());
128
-            gr.setCreatetime(guide.getCreatetime());
129
-            guideResourceMapper.insertUseGeneratedKeys(gr);
130
-
131
-            convertUtil.convertResource(r);//资源转换(word或ppt转为pdf,视频非h264编码转码,压缩包解压)
139
+
140
+            //保存预习学生关联信息
141
+            batchSaveGuideStudent(guide);
142
+            return new ResultVo(0,"保存成功");
143
+        }catch (Exception e){
144
+            log.error("保存预习失败:" + e.getMessage());
145
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
146
+            return new ResultVo(1,"保存失败");
132 147
         }
133 148
 
134
-        //保存预习学生关联信息
135
-        batchSaveGuideStudent(guide);
136
-        return guideid;
137 149
     }
138 150
 
139 151
     //个人空间分享到学生预习
140
-    @Transactional
141
-    public void shareGuide(TGuide guide) {
142
-        String resourceid = guide.getResourceid();
143
-        Integer timestamp = N_Utils.getSecondTimestamp();
144
-        guide.setCreatetime(timestamp);
145
-        guideMapper.insertUseGeneratedKeys(guide);
146
-        Integer guideid = guide.getId();//预习id
147
-
148
-        //保存预习资源
149
-        TGuideResource guideResource = new TGuideResource();
150
-        guideResource.setGuideid(guideid);
151
-        guideResource.setResourceid(resourceid);
152
-        guideResource.setCreateid(guide.getCreateid());
153
-        guideResource.setCreatetime(timestamp);
154
-        guideResourceMapper.insert(guideResource);
155
-        guide.setGuideid(guideid);
156
-
157
-        //保存预习学生关联信息
158
-        batchSaveGuideStudent(guide);
152
+    @Transactional(rollbackFor = Exception.class)
153
+    public ResultVo shareGuide(TGuide guide){
154
+
155
+        try {
156
+            String resourceid = guide.getResourceid();
157
+            Integer timestamp = N_Utils.getSecondTimestamp();
158
+            guide.setCreatetime(timestamp);
159
+            guideMapper.insertUseGeneratedKeys(guide);
160
+            Integer guideid = guide.getId();//预习id
161
+
162
+            //保存预习资源
163
+            TGuideResource guideResource = new TGuideResource();
164
+            guideResource.setGuideid(guideid);
165
+            guideResource.setResourceid(resourceid);
166
+            guideResource.setCreateid(guide.getCreateid());
167
+            guideResource.setCreatetime(timestamp);
168
+            guideResourceMapper.insert(guideResource);
169
+            guide.setGuideid(guideid);
170
+
171
+            //保存预习学生关联信息
172
+            batchSaveGuideStudent(guide);
173
+            return new ResultVo(0,"分享成功");
174
+        }catch (Exception e){
175
+            log.error("分享预习失败:" + e.getMessage());
176
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
177
+            return new ResultVo(1,"分享失败");
178
+        }
179
+
159 180
     }
160 181
 
161 182
     //批量维护预习班级和学生信息
162
-    private void batchSaveGuideStudent(TGuide guide) {
183
+    private void batchSaveGuideStudent(TGuide guide) throws Exception {
163 184
         List<TGuideGroup> guideGroups = guide.getGuideGroups().stream().distinct().collect(Collectors.toList());
164 185
         List<TGuideGroup> savegroup = new ArrayList<>();
165 186
         List<TGuideGroupStudent> savestus = new ArrayList<>();
@@ -172,23 +193,29 @@ public class GuideService {
172 193
             g.setCreatetime(guide.getCreatetime());
173 194
             savegroup.add(g);
174 195
 
175
-            //页面选择的学生预习学生集合
176
-            String groupids = StringUtils.join(gg.getGroups(),",");
177
-
178
-            //获取选中班级分组下所有学生
179
-            List<Integer> stus = classMapper.listStudentidsByGroupids(groupids);
180
-            for (Integer studentid : stus) {
181
-                TGuideGroupStudent ggs = new TGuideGroupStudent();
182
-                ggs.setGuideid(guide.getGuideid());
183
-                ggs.setClassid(classid);
184
-                ggs.setStudentid(studentid);
185
-                ggs.setCosttime(0);
186
-                ggs.setCreatetime(N_Utils.getSecondTimestamp());
187
-                savestus.add(ggs);
196
+            if(gg.getGroups() != null && gg.getGroups().size() > 0){
197
+                //页面选择的学生预习学生集合
198
+                String groupids = StringUtils.join(gg.getGroups(),",");
199
+
200
+                //获取选中班级分组下所有学生
201
+                List<Integer> stus = classMapper.listStudentidsByGroupids(groupids);
202
+                for (Integer studentid : stus) {
203
+                    TGuideGroupStudent ggs = new TGuideGroupStudent();
204
+                    ggs.setGuideid(guide.getGuideid());
205
+                    ggs.setClassid(classid);
206
+                    ggs.setStudentid(studentid);
207
+                    ggs.setCosttime(0);
208
+                    ggs.setCreatetime(N_Utils.getSecondTimestamp());
209
+                    savestus.add(ggs);
188 210
 
211
+                }
189 212
             }
190 213
         }
191 214
 
215
+        if(savestus == null || savestus.size() == 0){
216
+            throw new Exception("未选择学生");
217
+        }
218
+
192 219
         //保存预习班级、预习学生信息
193 220
         guideGroupMapper.insertList(savegroup);
194 221
         guideGroupStudentMapper.insertList(savestus);

+ 1
- 1
sstudy/src/main/resources/application.properties View File

@@ -107,4 +107,4 @@ file.showurl=http://schoolstatictest.xhkjedu.com/static/
107 107
 dbname=xhkjedu_school_test
108 108
 
109 109
 #版本号
110
-versionname=Test_v3.2.6
110
+versionname=Test_v3.2.7

+ 43
- 8
suser/src/main/java/com/xhkjedu/suser/service/system/UserService.java View File

@@ -115,10 +115,24 @@ public class UserService extends JedisUtil {
115 115
                 }
116 116
             }
117 117
 
118
+            //判断用户状态
118 119
             if(userVo.getUserlock() == 1){
119 120
                 return new ResultVo(1, "此账号已锁定,禁止登录");
120 121
             }
121 122
 
123
+            //判断用户有效期
124
+            String usertime = userVo.getUsertime();
125
+            if (N_Utils.isNotEmpty(usertime)) {
126
+                String dayBegin = DatesUtil.getDayBegin();
127
+                if (usertime.compareTo(dayBegin) < 0) {
128
+                    if (usertype == 2) {//学生
129
+                        return new ResultVo(1, "账号已过有效期,请联系老师");
130
+                    } else {
131
+                        return new ResultVo(1, "账号已过有效期,请联系管理员");
132
+                    }
133
+                }
134
+            }
135
+
122 136
             //进行角色判断
123 137
             if (usertype == 2) {
124 138
                 Integer stuweb = userVo.getStuweb();
@@ -146,10 +160,14 @@ public class UserService extends JedisUtil {
146 160
                     return new ResultVo(1, "此账号未分配班级");
147 161
                 }
148 162
 
149
-                //更新学生硬件绑定信息
150
-                userVo.setMac(mac);
151
-                userVo.setBindmac(sbindmac);
152
-                userMapper.updateBindMac(userVo);
163
+                String device = user.getDevice();//只有学生
164
+                if (device != null && "pad".equals(device)) {
165
+                    //更新学生硬件绑定信息
166
+                    userVo.setMac(mac);
167
+                    userVo.setBindmac(sbindmac);
168
+                    userMapper.updateBindMac(userVo);
169
+                }
170
+
153 171
                 return new ResultVo(0, "登录成功", userVo);
154 172
             } else{
155 173
                 return new ResultVo(0, "登录成功", userVo);
@@ -169,7 +187,12 @@ public class UserService extends JedisUtil {
169 187
             user.setUserid(userVo.getUserid());
170 188
             user.setUsername(userVo.getUsername());
171 189
             user.setSchoolid(userVo.getSchoolid());
172
-            if (!userVo.getLoginpwd().equals(user.getLoginpwd())) {
190
+            user.setUsertype(userVo.getUsertype());
191
+
192
+            //验证用户信息
193
+            resultVo = this.checkLoginUser(user,userVo,1);
194
+
195
+            /*if (!userVo.getLoginpwd().equals(user.getLoginpwd())) {
173 196
                 resultVo = new ResultVo(1, "密码错误");
174 197
             } else {
175 198
                 if (userVo.getUsertype() != 1) {
@@ -183,7 +206,7 @@ public class UserService extends JedisUtil {
183 206
                         resultVo = new ResultVo(0, "登录成功", userVo);
184 207
                     }
185 208
                 }
186
-            }
209
+            }*/
187 210
         } else {
188 211
             resultVo = new ResultVo(1, "此账号不存在");
189 212
         }
@@ -210,6 +233,7 @@ public class UserService extends JedisUtil {
210 233
             user.setUserid(userVo.getUserid());
211 234
             user.setUsername(userVo.getUsername());
212 235
             user.setSchoolid(userVo.getSchoolid());
236
+            user.setUsertype(userVo.getUsertype());
213 237
             //验证学生登录系列问题
214 238
             resultVo = checkLoginStudent(user,userVo);
215 239
         } else {
@@ -226,6 +250,7 @@ public class UserService extends JedisUtil {
226 250
         } else {
227 251
             Integer sbindmac = userVo.getSbindmac();//学校是否绑定设备0未绑定1绑定
228 252
             String mac = user.getMac();
253
+            String usertime = userVo.getUsertime();
229 254
 
230 255
             if (userVo.getUsertype() != 2) {
231 256
                 return new ResultVo(1, "登录失败,仅允许学生登录");
@@ -240,7 +265,15 @@ public class UserService extends JedisUtil {
240 265
                         return new ResultVo(1, "登录失败,该设备已与其他账号关联");
241 266
                     }
242 267
                 }
268
+            } else if (N_Utils.isNotEmpty(usertime)){
269
+                String dayBegin = DatesUtil.getDayBegin();
270
+                if (usertime.compareTo(dayBegin) < 0) {
271
+                    return new ResultVo(1, "账号已过有效期,请联系老师");
272
+                }
273
+            } else if (userVo.getUserlock() == 1) {
274
+                return new ResultVo(1, "此账号已锁定,禁止登录");
243 275
             }
276
+
244 277
             //更新学生硬件绑定信息
245 278
             userVo.setMac(mac);
246 279
             userVo.setBindmac(sbindmac);
@@ -267,6 +300,7 @@ public class UserService extends JedisUtil {
267 300
             user.setUsername(userVo.getUsername());
268 301
             user.setSchoolid(userVo.getSchoolid());
269 302
             user.setLoginname(userVo.getLoginname());
303
+            user.setUsertype(userVo.getUsertype());
270 304
 
271 305
             resultVo = checkLoginUser(user,userVo,2);
272 306
         } else {
@@ -291,7 +325,8 @@ public class UserService extends JedisUtil {
291 325
         Integer usertype = user.getUsertype();
292 326
         if (result.getCode() == 0) {
293 327
             UserVo userVo = (UserVo) result.getObj();
294
-            if (userVo.getUserlock() == 1) {
328
+            //以下代码登录的时候进行判断
329
+            /*if (userVo.getUserlock() == 1) {
295 330
                 result.setCode(1);
296 331
                 result.setMsg("此账号已锁定,禁止登录");
297 332
                 return result;
@@ -308,7 +343,7 @@ public class UserService extends JedisUtil {
308 343
                     }
309 344
                     return result;
310 345
                 }
311
-            }
346
+            }*/
312 347
 
313 348
             //redis
314 349
             String ticketKey = UUID.randomUUID().toString().replace("-", "");

+ 1
- 1
suser/src/main/resources/application.properties View File

@@ -57,4 +57,4 @@ signName=【河南星火燎原】
57 57
 #郑州管城大数据SSO认证鉴权接口
58 58
 ssourl=http://gcdsj.zzgcjy.cn/portal/sso/api/agent
59 59
 #版本号
60
-versionname=Test_v3.2.10
60
+versionname=Test_v3.2.11

Loading…
Cancel
Save