Browse Source

正式环境发作业,预习,教研科目教研,token验证

tags/正式3.13.0
王宁 1 year ago
parent
commit
8fe458c9dc

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

74
     public void setSecretKey(String secretKey) {
74
     public void setSecretKey(String secretKey) {
75
         ConfigKey.secretKey = secretKey;
75
         ConfigKey.secretKey = secretKey;
76
     }
76
     }
77
+
78
+    public static String blacklist;//黑名单
79
+    @Value("${blacklist}")
80
+    public void setBlacklist(String blacklist) {
81
+        ConfigKey.blacklist = blacklist;
82
+    }
77
 }
83
 }

+ 7
- 7
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperController.java View File

154
         N_Utils.validation(new Object[]{questionStr, "试题json字符串", 1, paper.getPapertype(), "作业分类", 1
154
         N_Utils.validation(new Object[]{questionStr, "试题json字符串", 1, paper.getPapertype(), "作业分类", 1
155
                 , paper.getPaperclass(), "作业类型", 1, paper.getPapername(), "作业名称", 2});
155
                 , paper.getPaperclass(), "作业类型", 1, paper.getPapername(), "作业名称", 2});
156
         List<TPaperQtype> qtypes = JSONObject.parseArray(questionStr, TPaperQtype.class);
156
         List<TPaperQtype> qtypes = JSONObject.parseArray(questionStr, TPaperQtype.class);
157
-        boolean rtn = false;
158
         try {
157
         try {
159
-            rtn = paperService.updateQuestionPaper(paper, qtypes);
158
+            boolean rtn = paperService.updateQuestionPaper(paper, qtypes);
159
+            if (rtn) {
160
+                return new ResultVo(0, "修改成功");
161
+            } else {
162
+                return new ResultVo(1, "修改失败");
163
+            }
160
         } catch (Exception e) {
164
         } catch (Exception e) {
161
             return new ResultVo(1, "修改失败");
165
             return new ResultVo(1, "修改失败");
162
         }
166
         }
163
-        if (rtn) {
164
-            return new ResultVo(0, "修改成功");
165
-        } else {
166
-            return new ResultVo(1, "修改失败");
167
-        }
167
+
168
     }
168
     }
169
 
169
 
170
     /**
170
     /**

+ 13
- 9
sstudy/src/main/java/com/xhkjedu/sstudy/controller/recite/ReciteController.java View File

65
      */
65
      */
66
     @PostMapping("/up")
66
     @PostMapping("/up")
67
     public ResultVo update(@RequestBody TRecite recite){
67
     public ResultVo update(@RequestBody TRecite recite){
68
-        N_Utils.validation(new Object[]{
69
-                recite.getReciteid(),"背诵id",1,
70
-                recite.getRecitetitle(),"背诵标题",2,
71
-                recite.getRecitecont(),"背诵内容",2
72
-        });
73
-        Integer result = reciteService.updateRecite(recite);
74
-        if(result>0){
75
-            return new ResultVo(0,"修改成功");
76
-        }else{
68
+        try {
69
+            N_Utils.validation(new Object[]{
70
+                    recite.getReciteid(),"背诵id",1,
71
+                    recite.getRecitetitle(),"背诵标题",2,
72
+                    recite.getRecitecont(),"背诵内容",2
73
+            });
74
+            Integer result = reciteService.updateRecite(recite);
75
+            if(result>0){
76
+                return new ResultVo(0,"修改成功");
77
+            }else{
78
+                return new ResultVo(1,"修改失败");
79
+            }
80
+        }catch (Exception e){
77
             return new ResultVo(1,"修改失败");
81
             return new ResultVo(1,"修改失败");
78
         }
82
         }
79
     }
83
     }

+ 27
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/RequestInterceptor.java View File

2
 
2
 
3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
 import com.xhkjedu.exception.MissingParametersException;
4
 import com.xhkjedu.exception.MissingParametersException;
5
+import com.xhkjedu.sstudy.config.ConfigKey;
5
 import com.xhkjedu.sstudy.utils.StudyUtil;
6
 import com.xhkjedu.sstudy.utils.StudyUtil;
6
 import com.xhkjedu.utils.JedisUtil;
7
 import com.xhkjedu.utils.JedisUtil;
7
 import com.xhkjedu.utils.N_Utils;
8
 import com.xhkjedu.utils.N_Utils;
53
         String requestURI = request.getRequestURI();
54
         String requestURI = request.getRequestURI();
54
         String key = request.getHeader("Token-Key");
55
         String key = request.getHeader("Token-Key");
55
         String token = request.getHeader("Token-Value");
56
         String token = request.getHeader("Token-Value");
56
-        if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
57
-                && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
57
+
58
+        if(isBlacklist(requestURI) && (N_Utils.isEmpty(key) || N_Utils.isEmpty(token))){
59
+            ResultVo result = new ResultVo();
60
+            result.setCode(2);
61
+            result.setMsg("登录失效");
62
+
63
+            response.getWriter().print(JSON.toJSONString(result));
64
+            return false;
65
+        }
66
+
67
+        if(N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)){
58
             String redis_token = get(key);//系统缓存中保存的token
68
             String redis_token = get(key);//系统缓存中保存的token
59
             if (redis_token != null && redis_token.equals("0")) {//获取token失败不对比
69
             if (redis_token != null && redis_token.equals("0")) {//获取token失败不对比
70
+
60
             } else if (!token.equals(redis_token)) {
71
             } else if (!token.equals(redis_token)) {
61
                 ResultVo result = new ResultVo();
72
                 ResultVo result = new ResultVo();
62
                 result.setCode(2);
73
                 result.setCode(2);
98
         return true;
109
         return true;
99
     }
110
     }
100
 
111
 
112
+    private Boolean isBlacklist(String uri){
113
+        boolean rtn = false;
114
+        String blacklist = ConfigKey.blacklist;
115
+        if(!N_Utils.isEmpty(blacklist)){
116
+            String[] blackArr = blacklist.split(",");//黑名单
117
+            for(String str : blackArr){
118
+                if(uri.contains(str)){
119
+                    rtn = true;
120
+                }
121
+            }
122
+        }
123
+        return rtn;
124
+    }
125
+
101
     /**
126
     /**
102
      * 需要拦截的请求
127
      * 需要拦截的请求
103
      * @Param [uri]
128
      * @Param [uri]

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/TeacherSubjectbookMapper.java View File

42
 
42
 
43
     //根据教材id获取科目id
43
     //根据教材id获取科目id
44
     String getSubjectidByLsbid(@Param("lsbid") String lsbid);
44
     String getSubjectidByLsbid(@Param("lsbid") String lsbid);
45
+
46
+    //根据教师id获取教师权限科目
47
+    String listSubjectidByTeacherid(@Param("teacherid") Integer teacherid);
45
 }
48
 }

+ 19
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperService.java View File

7
 import com.xhkjedu.sstudy.mapper.paper.*;
7
 import com.xhkjedu.sstudy.mapper.paper.*;
8
 import com.xhkjedu.sstudy.mapper.paperstudent.PaperClassMapper;
8
 import com.xhkjedu.sstudy.mapper.paperstudent.PaperClassMapper;
9
 import com.xhkjedu.sstudy.mapper.paperstudent.PaperStudentMapper;
9
 import com.xhkjedu.sstudy.mapper.paperstudent.PaperStudentMapper;
10
+import com.xhkjedu.sstudy.mapper.subjectbook.TeacherSubjectbookMapper;
10
 import com.xhkjedu.sstudy.model.paper.*;
11
 import com.xhkjedu.sstudy.model.paper.*;
11
 import com.xhkjedu.sstudy.model.paperstudent.TPaperClass;
12
 import com.xhkjedu.sstudy.model.paperstudent.TPaperClass;
12
 import com.xhkjedu.sstudy.model.paperstudent.TPaperStudent;
13
 import com.xhkjedu.sstudy.model.paperstudent.TPaperStudent;
59
     @Resource
60
     @Resource
60
     private PaperClassMapper paperClassMapper;
61
     private PaperClassMapper paperClassMapper;
61
 
62
 
63
+    @Resource
64
+    private TeacherSubjectbookMapper teacherSubjectbookMapper;
65
+
62
     /**
66
     /**
63
      * 功能描述  答题卡作业--保存
67
      * 功能描述  答题卡作业--保存
64
      *
68
      *
72
     public Integer saveScantronPaper(TPaper paper, List<TPaperScantronQtype> qtypes) throws Exception {
76
     public Integer saveScantronPaper(TPaper paper, List<TPaperScantronQtype> qtypes) throws Exception {
73
         Integer paperid = 0;
77
         Integer paperid = 0;
74
         try {
78
         try {
79
+
80
+            //根据用户id获取用户权限科目,如果上传科目和权限科目不一致,不允许保存
81
+            String subjectid = teacherSubjectbookMapper.listSubjectidByTeacherid(paper.getCreateid());
82
+            if(!subjectid.equals(paper.getSubjectid())){
83
+                throw new Exception("保存失败");
84
+            }
85
+
75
             paper.setPapertype(2); //作业类型1结构性试题2自定义答题卡
86
             paper.setPapertype(2); //作业类型1结构性试题2自定义答题卡
76
 
87
 
77
             //答题卡中试题
88
             //答题卡中试题
127
     public boolean updateScantronPaper(TPaper paper, List<TPaperScantronQtype> qtypes) throws Exception {
138
     public boolean updateScantronPaper(TPaper paper, List<TPaperScantronQtype> qtypes) throws Exception {
128
         boolean rtn = false;
139
         boolean rtn = false;
129
         try {
140
         try {
130
-
131
             //答题卡中试题
141
             //答题卡中试题
132
             List<TPaperScantron> scanlist = new ArrayList<>();
142
             List<TPaperScantron> scanlist = new ArrayList<>();
133
             qtypes.forEach(t->{
143
             qtypes.forEach(t->{
378
     public Integer saveQuestionPaper(TPaper paper, List<TPaperQtype> qtypes) throws Exception {
388
     public Integer saveQuestionPaper(TPaper paper, List<TPaperQtype> qtypes) throws Exception {
379
         Integer paperid = 0;
389
         Integer paperid = 0;
380
         try {
390
         try {
391
+
392
+            //根据用户id获取用户权限科目,如果上传科目和权限科目不一致,不允许保存
393
+            String subjectid = teacherSubjectbookMapper.listSubjectidByTeacherid(paper.getCreateid());
394
+            if(!subjectid.equals(paper.getSubjectid())){
395
+                throw new Exception("保存失败");
396
+            }
397
+
381
             setPaperScoreAndNum(paper, qtypes);//设置作业分值和试题数量
398
             setPaperScoreAndNum(paper, qtypes);//设置作业分值和试题数量
382
             paperid = savePaper(paper);//保存作业
399
             paperid = savePaper(paper);//保存作业
383
             paper.setPaperid(paperid);
400
             paper.setPaperid(paperid);
413
     public boolean updateQuestionPaper(TPaper paper, List<TPaperQtype> qtypes) throws Exception {
430
     public boolean updateQuestionPaper(TPaper paper, List<TPaperQtype> qtypes) throws Exception {
414
         boolean rtn = false;
431
         boolean rtn = false;
415
         try {
432
         try {
433
+
416
             setPaperScoreAndNum(paper, qtypes);//设置作业分值和试题数量
434
             setPaperScoreAndNum(paper, qtypes);//设置作业分值和试题数量
417
             //修改作业基本信息
435
             //修改作业基本信息
418
             paperMapper.updatePaper(paper);
436
             paperMapper.updatePaper(paper);

+ 23
- 15
sstudy/src/main/java/com/xhkjedu/sstudy/service/recite/ReciteService.java View File

4
 import com.xhkjedu.sstudy.mapper.recite.ReciteGroupMapper;
4
 import com.xhkjedu.sstudy.mapper.recite.ReciteGroupMapper;
5
 import com.xhkjedu.sstudy.mapper.recite.ReciteMapper;
5
 import com.xhkjedu.sstudy.mapper.recite.ReciteMapper;
6
 import com.xhkjedu.sstudy.mapper.recite.ReciteStudentMapper;
6
 import com.xhkjedu.sstudy.mapper.recite.ReciteStudentMapper;
7
+import com.xhkjedu.sstudy.mapper.subjectbook.TeacherSubjectbookMapper;
7
 import com.xhkjedu.sstudy.mapper.system.SchoolMapper;
8
 import com.xhkjedu.sstudy.mapper.system.SchoolMapper;
8
 import com.xhkjedu.sstudy.model.recite.TRecite;
9
 import com.xhkjedu.sstudy.model.recite.TRecite;
9
 import com.xhkjedu.sstudy.model.recite.TReciteGroup;
10
 import com.xhkjedu.sstudy.model.recite.TReciteGroup;
45
     @Resource
46
     @Resource
46
     private SchoolMapper schoolMapper;
47
     private SchoolMapper schoolMapper;
47
 
48
 
49
+    @Resource
50
+    private TeacherSubjectbookMapper teacherSubjectbookMapper;
51
+
48
     @Transactional(rollbackFor = Exception.class)
52
     @Transactional(rollbackFor = Exception.class)
49
     public ResultVo save(TRecite recite){
53
     public ResultVo save(TRecite recite){
50
         try {
54
         try {
51
-
52
-            recite.setCreatetime(N_Utils.getSecondTimestamp());
53
-            recite.setRecitestate(22);//背诵作业状态:21未布置 22 已布置
54
-            if(N_Utils.isListNotEmpty(recite.getJtrclist())){
55
-                recite.setHashb(1);
55
+            //根据用户id获取用户权限科目,如果上传科目和权限科目不一致,不允许保存
56
+            String subjectid = teacherSubjectbookMapper.listSubjectidByTeacherid(recite.getCreateid());
57
+            if(!subjectid.equals(recite.getSubjectid())){
58
+                return new ResultVo(1,"保存失败");
56
             }else{
59
             }else{
57
-                recite.setHashb(0);
58
-            }
59
-
60
-            int year = schoolMapper.getYearById(recite.getSchoolid());
61
-            recite.setYear(year);
62
-            reciteMapper.insertUseGeneratedKeys(recite);
63
-            //保存背诵班级-分组-学生
64
-            saveReciteGroup(recite);
60
+                recite.setCreatetime(N_Utils.getSecondTimestamp());
61
+                recite.setRecitestate(22);//背诵作业状态:21未布置 22 已布置
62
+                if(N_Utils.isListNotEmpty(recite.getJtrclist())){
63
+                    recite.setHashb(1);
64
+                }else{
65
+                    recite.setHashb(0);
66
+                }
65
 
67
 
68
+                int year = schoolMapper.getYearById(recite.getSchoolid());
69
+                recite.setYear(year);
70
+                reciteMapper.insertUseGeneratedKeys(recite);
71
+                //保存背诵班级-分组-学生
72
+                saveReciteGroup(recite);
73
+                return new ResultVo(0,"保存成功");
74
+            }
66
         }catch (Exception e){
75
         }catch (Exception e){
67
             log.error("发布背诵失败:" + e.getMessage());
76
             log.error("发布背诵失败:" + e.getMessage());
68
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
77
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
69
             return new ResultVo(1,"保存失败");
78
             return new ResultVo(1,"保存失败");
70
         }
79
         }
71
-        return new ResultVo(0,"保存成功");
72
     }
80
     }
73
 
81
 
74
     //保存背诵班级-分组-学生
82
     //保存背诵班级-分组-学生
165
      * @param  * @param recite
173
      * @param  * @param recite
166
      * @return java.lang.Integer
174
      * @return java.lang.Integer
167
      */
175
      */
168
-    public Integer updateRecite(TRecite recite){
176
+    public Integer updateRecite(TRecite recite) throws Exception{
169
         return reciteMapper.updateRecite(recite);
177
         return reciteMapper.updateRecite(recite);
170
     }
178
     }
171
 
179
 

+ 84
- 70
sstudy/src/main/java/com/xhkjedu/sstudy/service/resource/GuideService.java View File

4
 import com.xhkjedu.sstudy.mapper.gradeclass.ClassMapper;
4
 import com.xhkjedu.sstudy.mapper.gradeclass.ClassMapper;
5
 import com.xhkjedu.sstudy.mapper.resource.*;
5
 import com.xhkjedu.sstudy.mapper.resource.*;
6
 import com.xhkjedu.sstudy.mapper.subjectbook.SubjectMapper;
6
 import com.xhkjedu.sstudy.mapper.subjectbook.SubjectMapper;
7
+import com.xhkjedu.sstudy.mapper.subjectbook.TeacherSubjectbookMapper;
7
 import com.xhkjedu.sstudy.mapper.system.SchoolMapper;
8
 import com.xhkjedu.sstudy.mapper.system.SchoolMapper;
8
 import com.xhkjedu.sstudy.model.resource.*;
9
 import com.xhkjedu.sstudy.model.resource.*;
9
 import com.xhkjedu.sstudy.utils.ConvertUtil;
10
 import com.xhkjedu.sstudy.utils.ConvertUtil;
55
     private MessageSender messageSender;
56
     private MessageSender messageSender;
56
     @Autowired
57
     @Autowired
57
     private ConvertUtil convertUtil;
58
     private ConvertUtil convertUtil;
59
+    @Resource
60
+    private TeacherSubjectbookMapper teacherSubjectbookMapper;
58
 
61
 
59
     //学生预习列表--教师网页端
62
     //学生预习列表--教师网页端
60
     public List<GuideVo> listGuidesForTeacherWeb(TGuide guide){
63
     public List<GuideVo> listGuidesForTeacherWeb(TGuide guide){
95
     //保存学生预习
98
     //保存学生预习
96
     @Transactional(rollbackFor = Exception.class)
99
     @Transactional(rollbackFor = Exception.class)
97
     public ResultVo save(TGuide guide){
100
     public ResultVo save(TGuide guide){
98
-
99
         try {
101
         try {
100
-            Integer timestamp = N_Utils.getSecondTimestamp();
101
-            guide.setCreatetime(timestamp);
102
-            Integer hashb = 0;
103
-            if (N_Utils.isListNotEmpty(guide.getJtrclist())) {
104
-                hashb = 1;
105
-            }
106
-            guide.setHashb(hashb);
107
-            int year = schoolMapper.getYearById(guide.getSchoolid());
108
-            guide.setYear(year);
109
-            guideMapper.insertUseGeneratedKeys(guide);
110
-            Integer guideid = guide.getId();//预习id
111
-            guide.setGuideid(guideid);
112
-
113
-            //保存资源
114
-            List<TResource> resources = guide.getResources();
115
-            for(TResource r : resources) {
116
-                r.setCreateid(guide.getCreateid());
117
-                r.setCreatetime(guide.getCreatetime());
118
-                r.setLevel(3);
119
-                r.setResourcestate(1);
120
-                r.setResourcetype(10);
121
-                r.setBelong(4);
122
-                r.setSchoolid(guide.getSchoolid());
123
-                r.setSubjectid(guide.getSubjectid());
124
-
125
-                String resourceid = StudyUtil.getId();//资源id
126
-                r.setResourceid(resourceid);
127
-                Integer resourceclass = r.getResourceclass();
128
-                if (resourceclass == 3 || resourceclass == 4 || resourceclass == 6) {
129
-                    r.setConverted(1);
130
-                } else if (resourceclass == 5 && ("flv".equals(r.getSuffix()) || "h264".equals(r.getMp4code()))) {
131
-                    r.setConverted(1);
102
+            //根据用户id获取用户权限科目,如果上传科目和权限科目不一致,不允许保存
103
+            String subjectid = teacherSubjectbookMapper.listSubjectidByTeacherid(guide.getCreateid());
104
+            if(!subjectid.equals(guide.getSubjectid())){
105
+                return new ResultVo(1,"保存失败");
106
+            }else{
107
+                Integer timestamp = N_Utils.getSecondTimestamp();
108
+                guide.setCreatetime(timestamp);
109
+                Integer hashb = 0;
110
+                if (N_Utils.isListNotEmpty(guide.getJtrclist())) {
111
+                    hashb = 1;
112
+                }
113
+                guide.setHashb(hashb);
114
+                int year = schoolMapper.getYearById(guide.getSchoolid());
115
+                guide.setYear(year);
116
+                guideMapper.insertUseGeneratedKeys(guide);
117
+                Integer guideid = guide.getId();//预习id
118
+                guide.setGuideid(guideid);
119
+
120
+                //保存资源
121
+                List<TResource> resources = guide.getResources();
122
+                for(TResource r : resources) {
123
+                    r.setCreateid(guide.getCreateid());
124
+                    r.setCreatetime(guide.getCreatetime());
125
+                    r.setLevel(3);
126
+                    r.setResourcestate(1);
127
+                    r.setResourcetype(10);
128
+                    r.setBelong(4);
129
+                    r.setSchoolid(guide.getSchoolid());
130
+                    r.setSubjectid(guide.getSubjectid());
131
+
132
+                    String resourceid = StudyUtil.getId();//资源id
133
+                    r.setResourceid(resourceid);
134
+                    Integer resourceclass = r.getResourceclass();
135
+                    if (resourceclass == 3 || resourceclass == 4 || resourceclass == 6) {
136
+                        r.setConverted(1);
137
+                    } else if (resourceclass == 5 && ("flv".equals(r.getSuffix()) || "h264".equals(r.getMp4code()))) {
138
+                        r.setConverted(1);
139
+                    }
140
+                    //保存资源信息
141
+                    resourceMapper.insertSelective(r);
142
+                    //保存预习资源关联关系
143
+                    TGuideResource gr = new TGuideResource();
144
+                    gr.setGuideid(guideid);
145
+                    gr.setResourceid(resourceid);
146
+                    gr.setCreateid(guide.getCreateid());
147
+                    gr.setCreatetime(guide.getCreatetime());
148
+                    guideResourceMapper.insertUseGeneratedKeys(gr);
149
+
150
+                    convertUtil.convertResource(r);//资源转换(word或ppt转为pdf,视频非h264编码转码,压缩包解压)
132
                 }
151
                 }
133
-                //保存资源信息
134
-                resourceMapper.insertSelective(r);
135
-                //保存预习资源关联关系
136
-                TGuideResource gr = new TGuideResource();
137
-                gr.setGuideid(guideid);
138
-                gr.setResourceid(resourceid);
139
-                gr.setCreateid(guide.getCreateid());
140
-                gr.setCreatetime(guide.getCreatetime());
141
-                guideResourceMapper.insertUseGeneratedKeys(gr);
142
-
143
-                convertUtil.convertResource(r);//资源转换(word或ppt转为pdf,视频非h264编码转码,压缩包解压)
144
-            }
145
 
152
 
146
-            //保存预习学生关联信息
147
-            batchSaveGuideStudent(guide);
148
-            return new ResultVo(0,"保存成功");
153
+                //保存预习学生关联信息
154
+                batchSaveGuideStudent(guide);
155
+                return new ResultVo(0,"保存成功");
156
+            }
149
         }catch (Exception e){
157
         }catch (Exception e){
150
             log.error("保存预习失败:" + e.getMessage());
158
             log.error("保存预习失败:" + e.getMessage());
151
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
159
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
159
     public ResultVo shareGuide(TGuide guide){
167
     public ResultVo shareGuide(TGuide guide){
160
 
168
 
161
         try {
169
         try {
162
-            String resourceid = guide.getResourceid();
163
-            Integer timestamp = N_Utils.getSecondTimestamp();
164
-            guide.setCreatetime(timestamp);
165
-            Integer hashb = 0;
166
-            if (N_Utils.isListNotEmpty(guide.getJtrclist())) {
167
-                hashb = 1;
170
+            //根据用户id获取用户权限科目,如果上传科目和权限科目不一致,不允许保存
171
+            String subjectid = teacherSubjectbookMapper.listSubjectidByTeacherid(guide.getCreateid());
172
+            if(!subjectid.equals(guide.getSubjectid())){
173
+                return new ResultVo(1,"分享失败");
174
+            }else{
175
+                String resourceid = guide.getResourceid();
176
+                Integer timestamp = N_Utils.getSecondTimestamp();
177
+                guide.setCreatetime(timestamp);
178
+                Integer hashb = 0;
179
+                if (N_Utils.isListNotEmpty(guide.getJtrclist())) {
180
+                    hashb = 1;
181
+                }
182
+                guide.setHashb(hashb);
183
+                guideMapper.insertUseGeneratedKeys(guide);
184
+                Integer guideid = guide.getId();//预习id
185
+
186
+                //保存预习资源
187
+                TGuideResource guideResource = new TGuideResource();
188
+                guideResource.setGuideid(guideid);
189
+                guideResource.setResourceid(resourceid);
190
+                guideResource.setCreateid(guide.getCreateid());
191
+                guideResource.setCreatetime(timestamp);
192
+                guideResourceMapper.insert(guideResource);
193
+                guide.setGuideid(guideid);
194
+
195
+                //保存预习学生关联信息
196
+                batchSaveGuideStudent(guide);
197
+                return new ResultVo(0,"分享成功");
168
             }
198
             }
169
-            guide.setHashb(hashb);
170
-            guideMapper.insertUseGeneratedKeys(guide);
171
-            Integer guideid = guide.getId();//预习id
172
-
173
-            //保存预习资源
174
-            TGuideResource guideResource = new TGuideResource();
175
-            guideResource.setGuideid(guideid);
176
-            guideResource.setResourceid(resourceid);
177
-            guideResource.setCreateid(guide.getCreateid());
178
-            guideResource.setCreatetime(timestamp);
179
-            guideResourceMapper.insert(guideResource);
180
-            guide.setGuideid(guideid);
181
-
182
-            //保存预习学生关联信息
183
-            batchSaveGuideStudent(guide);
184
-            return new ResultVo(0,"分享成功");
185
         }catch (Exception e){
199
         }catch (Exception e){
186
             log.error("分享预习失败:" + e.getMessage());
200
             log.error("分享预习失败:" + e.getMessage());
187
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
201
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();

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

3
 
3
 
4
 spring.application.name=sstudy
4
 spring.application.name=sstudy
5
 #注册到我们本地的eureka注册中心,端口8081
5
 #注册到我们本地的eureka注册中心,端口8081
6
-eureka.client.service-url.defaultZone=http://xhschool:Xhkjedud07@127.0.0.1:8081/eureka/
7
-#eureka.client.register-with-eureka=false
8
-#eureka.client.fetch-registry=false
6
+#eureka.client.service-url.defaultZone=http://xhschool:Xhkjedud07@127.0.0.1:8081/eureka/
7
+eureka.client.register-with-eureka=false
8
+eureka.client.fetch-registry=false
9
 #设置eureka输出日志级别
9
 #设置eureka输出日志级别
10
 logging.level.com.netflix=error
10
 logging.level.com.netflix=error
11
 
11
 
12
 spring.datasource.url=jdbc:mysql://dbtest.xhkjedu.com:3306/xhkjedu_school_test?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&allowMultiQueries=true
12
 spring.datasource.url=jdbc:mysql://dbtest.xhkjedu.com:3306/xhkjedu_school_test?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&allowMultiQueries=true
13
 spring.datasource.username=root
13
 spring.datasource.username=root
14
 spring.datasource.password=HNxhkjedu!@#07
14
 spring.datasource.password=HNxhkjedu!@#07
15
+
15
 spring.mvc.hiddenmethod.filter.enabled=true
16
 spring.mvc.hiddenmethod.filter.enabled=true
16
 
17
 
17
 #数据库连接池配置
18
 #数据库连接池配置
114
 #数据库名
115
 #数据库名
115
 dbname=xhkjedu_school_test
116
 dbname=xhkjedu_school_test
116
 
117
 
118
+#拦截黑名单
119
+blacklist=guide/add,guide/share,recite/save,recite/up,paper/saves,paper/ups,paper/saveq,paper/updateq
120
+
117
 #版本号
121
 #版本号
118
-versionname=Test_v3.9.0
122
+versionname=Test_v3.11.1

+ 5
- 0
sstudy/src/main/resources/mapper/subjectbook/TeacherSubjectBookMapper.xml View File

104
     <select id="getSubjectidByLsbid" resultType="java.lang.String">
104
     <select id="getSubjectidByLsbid" resultType="java.lang.String">
105
         select subjectid from t_subject_book where lsbid=#{lsbid}
105
         select subjectid from t_subject_book where lsbid=#{lsbid}
106
     </select>
106
     </select>
107
+
108
+    <!--根据教师id获取教师权限科目-->
109
+    <select id="listSubjectidByTeacherid" resultType="java.lang.String">
110
+        select DISTINCT subjectid from t_teacher_powersb where teacherid=#{teacherid} limit 1
111
+    </select>
107
 </mapper>
112
 </mapper>

Loading…
Cancel
Save