Commit a3f05b67 authored by YangZhaoJun1's avatar YangZhaoJun1

合并

parent 43a99b0e
/*
数据库变动记录 2018-04-17 V2.0.3
*/
/*1.班级表b_class新建字段“type”,区分行政班和企业班,0行政班,1企业班*/
ALTER TABLE `b_class`
MODIFY COLUMN `type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL
DEFAULT 0 COMMENT '0行政班,1企业班' AFTER `create_date`;
/*
2.新建作息时间表b_course_code(商务应该只有上下午课,没有晚上课)
sql文件位置:sql>new_table>2.0.3>b_course_code.sql
3.新建组班表b_edu_class
sql文件位置:sql>new_table>2.0.3>b_edu_class.sql
4.新建年级表b_grade
sql文件位置:sql>new_table>2.0.3>b_grade.sql
*/
/*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1_3306
Source Server Version : 50717
Source Host : localhost:3306
Source Database : edu_db
Target Server Type : MYSQL
Target Server Version : 50717
File Encoding : 65001
Date: 2018-04-17 15:26:45
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for b_course_code
-- ----------------------------
DROP TABLE IF EXISTS `b_course_code`;
CREATE TABLE `b_course_code` (
`business_id` varchar(64) NOT NULL,
`create_by` varchar(45) DEFAULT NULL,
`update_by` varchar(45) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`flag` varchar(1) DEFAULT NULL,
`remarks` varchar(64) DEFAULT NULL,
`seq` int(10) DEFAULT NULL,
`start_date` varchar(64) DEFAULT NULL,
`end_date` varchar(64) DEFAULT NULL,
`del_flag` varchar(1) DEFAULT NULL,
`date_desc` varchar(1) DEFAULT NULL,
PRIMARY KEY (`business_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of b_course_code
-- ----------------------------
INSERT INTO `b_course_code` VALUES ('1', null, '333e421d32d9425ea99afce95b603902', null, '2018-04-17 11:25:19', '1', null, '1', '8:20', '9:05', '0', '0');
INSERT INTO `b_course_code` VALUES ('10', null, null, null, null, '1', null, '10', '19:25', '20:05', '0', '2');
INSERT INTO `b_course_code` VALUES ('11', null, null, null, null, '1', null, '11', '20:25', '21:05', '0', '2');
INSERT INTO `b_course_code` VALUES ('12', null, null, null, null, '1', null, '12', '21:15', '22:00', '0', '2');
INSERT INTO `b_course_code` VALUES ('2', null, null, null, null, '1', null, '2', '9:15', '10:00', '0', '0');
INSERT INTO `b_course_code` VALUES ('3', null, null, null, null, '1', null, '3', '10:20', '11:05', '0', '0');
INSERT INTO `b_course_code` VALUES ('4', null, null, null, null, '1', null, '4', '11:15', '12:00', '0', '0');
INSERT INTO `b_course_code` VALUES ('5', null, null, null, null, '1', null, '5', '14:00', '14:45', '0', '1');
INSERT INTO `b_course_code` VALUES ('6', null, null, null, null, '1', null, '6', '14:55', '15:40', '0', '1');
INSERT INTO `b_course_code` VALUES ('7', null, null, null, null, '1', null, '7', '16:00', '16:45', '0', '1');
INSERT INTO `b_course_code` VALUES ('8', null, null, null, null, '1', null, '8', '16:55', '17:40', '0', '1');
INSERT INTO `b_course_code` VALUES ('9', null, null, null, null, '1', null, '9', '18:30', '19:15', '0', '2');
/*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1_3306
Source Server Version : 50717
Source Host : localhost:3306
Source Database : edu_db
Target Server Type : MYSQL
Target Server Version : 50717
File Encoding : 65001
Date: 2018-04-17 15:27:17
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for b_edu_class
-- ----------------------------
DROP TABLE IF EXISTS `b_edu_class`;
CREATE TABLE `b_edu_class` (
`business_id` varchar(64) NOT NULL,
`create_date` datetime DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`create_by` varchar(45) DEFAULT NULL,
`update_by` varchar(45) DEFAULT NULL,
`del_flag` varchar(1) DEFAULT NULL,
`flag` varchar(1) DEFAULT NULL,
`remarks` varchar(64) DEFAULT NULL,
`code` varchar(45) DEFAULT NULL,
`class_name` varchar(200) DEFAULT NULL,
`agency_id` varchar(64) DEFAULT NULL,
`type` varchar(1) DEFAULT NULL COMMENT '0.行政班 1.业务班 2.其他',
`classes_id` varchar(1000) DEFAULT NULL COMMENT 'b_class_id',
`grade_id` varchar(64) DEFAULT NULL,
PRIMARY KEY (`business_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教学班';
-- ----------------------------
-- Records of b_edu_class
-- ----------------------------
INSERT INTO `b_edu_class` VALUES ('', null, null, '', '', '', '', '', '', '', '', '', '', null);
INSERT INTO `b_edu_class` VALUES ('1', null, null, null, null, '0', '1', null, '001', '大软Java 1班', '1', '0', '1,2', null);
INSERT INTO `b_edu_class` VALUES ('100', null, null, '', '', '0', '1', '', '101', '教学班100', '100', '0', '4,5,6', null);
INSERT INTO `b_edu_class` VALUES ('101', null, null, '', '', '0', '1', '', '102', '教学班101', '101', '0', '4,5,6', null);
INSERT INTO `b_edu_class` VALUES ('102', null, null, '', '', '0', '1', '', '103', '教学班102', '102', '0', '4,5,6', null);
INSERT INTO `b_edu_class` VALUES ('103', null, null, '', '', '0', '1', '', '104', '教学班103', '103', '0', '4,5,6', null);
INSERT INTO `b_edu_class` VALUES ('104', null, null, '', '', '0', '1', '', '105', '教学班104', '104', '0', '4,5,6', null);
INSERT INTO `b_edu_class` VALUES ('105', null, null, '', '', '0', '1', '', '106', '教学班105', '105', '0', '4,5,6', null);
INSERT INTO `b_edu_class` VALUES ('106', null, null, '', '', '0', '1', '', '107', '教学班106', '106', '0', '4,5,6', null);
INSERT INTO `b_edu_class` VALUES ('107', null, null, '', '', '0', '1', '', '108', '教学班107', '107', '0', '7,8,9', null);
INSERT INTO `b_edu_class` VALUES ('108', null, null, '', '', '0', '1', '', '109', '教学班108', '108', '0', '7,8,9', null);
INSERT INTO `b_edu_class` VALUES ('109', null, null, '', '', '0', '1', '', '110', '教学班109', '109', '0', '7,8,9', null);
INSERT INTO `b_edu_class` VALUES ('110', null, null, '', '', '0', '1', '', '111', '教学班110', '110', '0', '7,8,9', null);
INSERT INTO `b_edu_class` VALUES ('111', null, null, '', '', '0', '1', '', '112', '教学班111', '111', '0', '7,8,9', null);
INSERT INTO `b_edu_class` VALUES ('112', null, null, '', '', '0', '1', '', '113', '教学班112', '112', '0', '7,8,9', null);
INSERT INTO `b_edu_class` VALUES ('113', null, null, '', '', '0', '1', '', '114', '教学班113', '113', '0', '7,8,9', null);
INSERT INTO `b_edu_class` VALUES ('114', null, null, '', '', '0', '1', '', '115', '教学班114', '114', '0', '7,8,9', null);
INSERT INTO `b_edu_class` VALUES ('115', null, null, '', '', '0', '1', '', '116', '教学班115', '115', '0', '7,8,9', null);
INSERT INTO `b_edu_class` VALUES ('2', null, null, null, null, '0', '1', null, '002', '大软Java 2班', '1', '0', '3,4', null);
INSERT INTO `b_edu_class` VALUES ('3', null, null, null, null, '0', '1', null, '003', '大软Java 3班', '1', '0', '5,6', null);
INSERT INTO `b_edu_class` VALUES ('4', null, null, null, null, '0', '1', null, '012', '腾讯Oracle 2班', '2', '0', '7,8', null);
INSERT INTO `b_edu_class` VALUES ('5', null, null, null, null, '0', '1', null, '100', '英语 1班', '3', '0', '11,12', null);
INSERT INTO `b_edu_class` VALUES ('9ff09747f16040898722ef604d779070', '2018-04-17 14:51:58', '2018-04-17 14:51:58', '333e421d32d9425ea99afce95b603902', '333e421d32d9425ea99afce95b603902', '0', '1', null, 'kbztest', 'kbzTEST', null, '0', null, null);
INSERT INTO `b_edu_class` VALUES ('a100', null, null, '', '', '0', '1', '', 'w101', '教学一班', '100', '0', 'b100,b101', null);
INSERT INTO `b_edu_class` VALUES ('a101', null, null, '', '', '0', '1', '', 'w102', '教学二班', '100', '0', 'b102', null);
INSERT INTO `b_edu_class` VALUES ('a102', null, null, '', '', '0', '1', '', 'w103', '教学三班', '100', '0', 'b103,b104', null);
INSERT INTO `b_edu_class` VALUES ('a103', null, null, '', '', '0', '1', '', 'w104', '教学四班', '100', '0', 'b105,b106', null);
INSERT INTO `b_edu_class` VALUES ('a104', null, null, '', '', '0', '1', '', 'w105', '教学五班', '100', '0', 'b107', null);
INSERT INTO `b_edu_class` VALUES ('a105', null, null, '', '', '0', '1', '', 'w106', '教学六班', '100', '0', 'b108,b109', null);
INSERT INTO `b_edu_class` VALUES ('a200', null, null, '', '', '0', '1', '', 'w201', '教学一班', '200', '0', 'b200,b201', null);
INSERT INTO `b_edu_class` VALUES ('a201', null, null, '', '', '0', '1', '', 'w202', '教学二班', '200', '0', 'b202', null);
INSERT INTO `b_edu_class` VALUES ('a202', null, null, '', '', '0', '1', '', 'w203', '教学三班', '200', '0', 'b203,b204', null);
INSERT INTO `b_edu_class` VALUES ('a203', null, null, '', '', '0', '1', '', 'w204', '教学四班', '200', '0', 'b205,b206', null);
INSERT INTO `b_edu_class` VALUES ('a204', null, null, '', '', '0', '1', '', 'w205', '教学五班', '200', '0', 'b207', null);
INSERT INTO `b_edu_class` VALUES ('a205', null, null, '', '', '0', '1', '', 'w206', '教学六班', '200', '0', 'b208,b209', null);
INSERT INTO `b_edu_class` VALUES ('a300', null, null, '', '', '0', '1', '', 'w301', '教学一班', '300', '0', 'b300,b301', null);
INSERT INTO `b_edu_class` VALUES ('a301', null, null, '', '', '0', '1', '', 'w302', '教学二班', '300', '0', 'b302', null);
INSERT INTO `b_edu_class` VALUES ('a302', null, null, '', '', '0', '1', '', 'w303', '教学三班', '300', '0', 'b303,b304', null);
INSERT INTO `b_edu_class` VALUES ('a303', null, null, '', '', '0', '1', '', 'w304', '教学四班', '300', '0', 'b305,b306', null);
INSERT INTO `b_edu_class` VALUES ('a304', null, null, '', '', '0', '1', '', 'w305', '教学五班', '300', '0', 'b307', null);
INSERT INTO `b_edu_class` VALUES ('a305', null, null, '', '', '0', '1', '', 'w306', '教学六班', '300', '0', 'b308,b309', null);
/*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1_3306
Source Server Version : 50717
Source Host : localhost:3306
Source Database : edu_db
Target Server Type : MYSQL
Target Server Version : 50717
File Encoding : 65001
Date: 2018-04-17 15:26:51
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for b_grade
-- ----------------------------
DROP TABLE IF EXISTS `b_grade`;
CREATE TABLE `b_grade` (
`business_id` varchar(64) NOT NULL,
`create_by` varchar(45) DEFAULT NULL,
`update_by` varchar(45) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`del_flag` varchar(1) DEFAULT NULL,
`flag` varchar(1) DEFAULT NULL,
`remarks` varchar(64) DEFAULT NULL,
`code` varchar(64) DEFAULT NULL,
`name` varchar(150) DEFAULT NULL,
PRIMARY KEY (`business_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of b_grade
-- ----------------------------
INSERT INTO `b_grade` VALUES ('99d1ff3a7d144842ae23f05d5a4788cc', '333e421d32d9425ea99afce95b603902', '333e421d32d9425ea99afce95b603902', '2018-04-17 15:16:10', '2018-04-17 15:17:37', '1', '1', null, 'A0002', '假的');
INSERT INTO `b_grade` VALUES ('e32105729cfb4b8db0cad297ab994403', '333e421d32d9425ea99afce95b603902', '333e421d32d9425ea99afce95b603902', '2018-04-17 15:15:56', '2018-04-17 15:15:56', '0', '1', null, 'A001', '第一学年');
...@@ -395,4 +395,16 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -395,4 +395,16 @@ public class BChapterController extends PaginationController<BChapter> {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
studentCode); studentCode);
} }
@ApiOperation(value="修改项目任务书", notes="修改项目任务书")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "mdFile", value = "项目任务书内容", required = true, dataType = "varchar")})
@PostMapping(value = "/updateMdFile")
public Result updateMdFile(String businessId, String mdFile){
int data = bChapterService.updateMdFile(businessId,mdFile);
return Result.builder(new PersistModel(data),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
} }
...@@ -165,7 +165,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -165,7 +165,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @param studentId * @param studentId
* @return * @return
*/ */
@Update("<script>update b_r_student_chapter set score = '-1', is_complete = '0' where chapter_id = #{chapterId} and student_id = #{studentId}</script>") @Update("<script>update b_r_student_chapter set score = '999', is_complete = '0' where chapter_id = #{chapterId} and student_id = #{studentId}</script>")
int updateScoerInfo(@Param("chapterId") String chapterId, @Param("studentId") String studentId); int updateScoerInfo(@Param("chapterId") String chapterId, @Param("studentId") String studentId);
@Select("<script>select * from b_chapter " + @Select("<script>select * from b_chapter " +
...@@ -332,6 +332,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -332,6 +332,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"<if test=\"paperFinish !=null and paperFinish != ''\"> set paper_finish = '1' </if>" + "<if test=\"paperFinish !=null and paperFinish != ''\"> set paper_finish = '1' </if>" +
"<if test=\"score !=null and score != ''\"> set score = #{score}, </if>" + "<if test=\"score !=null and score != ''\"> set score = #{score}, </if>" +
"<if test=\"isComplete !=null and isComplete != ''\"> is_complete = #{isComplete} </if>" + "<if test=\"isComplete !=null and isComplete != ''\"> is_complete = #{isComplete} </if>" +
"<if test=\"automatic !=null and automatic != ''\"> automatic = #{automatic} </if>" +
"where student_id = #{studentId} and chapter_id = #{chapterId} </script>") "where student_id = #{studentId} and chapter_id = #{chapterId} </script>")
int updateToFinish(ScoreInfoDTO scoreInfoDTO); int updateToFinish(ScoreInfoDTO scoreInfoDTO);
......
...@@ -50,7 +50,7 @@ public class BChapter extends IdEntity<BChapter> { ...@@ -50,7 +50,7 @@ public class BChapter extends IdEntity<BChapter> {
private String mdFile; private String mdFile;
/*1:实验 2:视频 3:PPT*/ /*1:实验 2:视频 3:PPT*/
@Length(min = 1,max = 20,message = "长度最小为1,最大为15") //@Length(min = 1,max = 20,message = "长度最小为1,最大为15")
private String isTest; private String isTest;
/*课程或开课 0:开课 1:课程*/ /*课程或开课 0:开课 1:课程*/
......
...@@ -124,4 +124,6 @@ public interface BChapterService{ ...@@ -124,4 +124,6 @@ public interface BChapterService{
int updateToFinish(String type, String studentCode, String chapterId ,String slId); int updateToFinish(String type, String studentCode, String chapterId ,String slId);
String queryIsCompleteByUserIdAndChapId(String userInfoProp, String chapId); String queryIsCompleteByUserIdAndChapId(String userInfoProp, String chapId);
int updateMdFile(String businessId, String mdFile);
} }
...@@ -201,9 +201,11 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -201,9 +201,11 @@ public class BChapterServiceImpl implements BChapterService {
//获取智评分数 //获取智评分数
int score = IntellEvaluation.IntellEvaluation(filePath,scoreInfoDTO.getStudentCode(),bChapter.getExperimentType()); int score = IntellEvaluation.IntellEvaluation(filePath,scoreInfoDTO.getStudentCode(),bChapter.getExperimentType());
scoreInfoDTO.setScore(score); scoreInfoDTO.setScore(score);
scoreInfoDTO.setAutomatic("1");
}else{ }else{
scoreInfoDTO.setScore(-1); scoreInfoDTO.setScore(-1);
scoreInfoDTO.setAutomatic("0");
} }
scoreInfoDTO.setStudentId(stuid); scoreInfoDTO.setStudentId(stuid);
int result; int result;
...@@ -539,5 +541,13 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -539,5 +541,13 @@ public class BChapterServiceImpl implements BChapterService {
return bChapterRepository.queryIsCompleteByUserIdAndChapId(userId, chapId); return bChapterRepository.queryIsCompleteByUserIdAndChapId(userId, chapId);
} }
@Override
public int updateMdFile(String businessId, String mdFile) {
BChapter bChapter = new BChapter();
bChapter.setBusinessId(businessId);
bChapter.setMdFile(mdFile);
return bChapterRepository.updateByPrimaryKeySelective(bChapter);
}
} }
...@@ -34,12 +34,10 @@ public class BClass extends IdEntity<BClass> { ...@@ -34,12 +34,10 @@ public class BClass extends IdEntity<BClass> {
/*学生数量,默认为0*/ /*学生数量,默认为0*/
@Length(min = 1,max = 3,message = "长度最小为1,最大为3") @Length(min = 1,max = 3,message = "长度最小为1,最大为3")
@NotBlank
private String studentNum; private String studentNum;
/*班级类型*/ /*班级类型*/
@Length(min = 1,max = 1,message = "长度为1") @Length(min = 1,max = 1,message = "长度为1")
@NotBlank
private String type; private String type;
/*学年ID*/ /*学年ID*/
......
...@@ -205,13 +205,14 @@ public class BCodeController extends PaginationController { ...@@ -205,13 +205,14 @@ public class BCodeController extends PaginationController {
if(finished!=null&&finished.equals("1")&&!fileType.equals("6")){ if(finished!=null&&finished.equals("1")&&!fileType.equals("6")){
throw new ServiceException(ResultServiceEnums.EXPERIMENT_FINISHED); throw new ServiceException(ResultServiceEnums.EXPERIMENT_FINISHED);
} }
File fatherFile = new File(serverPath+(filePath.substring(0,filePath.lastIndexOf("/"))));
if(fileType.equals("1")&&!file.exists()){//新增文件夹 if(fileType.equals("1")&&!file.exists()){//新增文件夹
if(file.isFile()){ if(fatherFile.isFile()){
throw new ServiceException(ResultServiceEnums.THIS_IS_FILE); throw new ServiceException(ResultServiceEnums.THIS_IS_FILE);
} }
file.mkdirs(); file.mkdirs();
}else if(fileType.equals("2")&&!file.exists()){//新增文件 }else if(fileType.equals("2")&&!file.exists()){//新增文件
if(file.isFile()){ if(fatherFile.isFile()){
throw new ServiceException(ResultServiceEnums.THIS_IS_FILE); throw new ServiceException(ResultServiceEnums.THIS_IS_FILE);
} }
file.createNewFile(); file.createNewFile();
......
...@@ -32,7 +32,7 @@ import java.util.List; ...@@ -32,7 +32,7 @@ import java.util.List;
* Created by on 2018-4-17 11:12:17. * Created by on 2018-4-17 11:12:17.
*/ */
@RestController @RestController
@RequestMapping("/bcoursecode") @RequestMapping("/bCourseCode")
public class BCourseCodeController extends PaginationController<BCourseCode> { public class BCourseCodeController extends PaginationController<BCourseCode> {
@Autowired @Autowired
...@@ -47,15 +47,15 @@ public class BCourseCodeController extends PaginationController<BCourseCode> { ...@@ -47,15 +47,15 @@ public class BCourseCodeController extends PaginationController<BCourseCode> {
@ApiImplicitParam(name = "end_date", value = "结束时间 length(1~50)", required = false, dataType = "varchar"), @ApiImplicitParam(name = "end_date", value = "结束时间 length(1~50)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "date_desc", value = "节点描述 length(1)", required = false, dataType = "varchar") @ApiImplicitParam(name = "date_desc", value = "节点描述 length(1)", required = false, dataType = "varchar")
}) })
@PutMapping("/update/{businessId}") @PostMapping("/update")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result update(@ApiIgnore BCourseCode bCourseCode, BindingResult bindingResult) { public Result update(@ApiIgnore BCourseCode bCourseCode) {
bCourseCode.setToken(getToken()); bCourseCode.setToken(getToken());
PersistModel data = bCourseCodeServiceImpl.merge(bCourseCode); PersistModel data = bCourseCodeServiceImpl.merge(bCourseCode);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bCourseCode); bCourseCode);
} }
@ApiOperation(value="查看集合", notes="查看集合") @ApiOperation(value="查看集合", notes="查看集合")
......
...@@ -23,6 +23,8 @@ import java.util.List; ...@@ -23,6 +23,8 @@ import java.util.List;
public class BCourseCode extends IdEntity<BCourseCode> { public class BCourseCode extends IdEntity<BCourseCode> {
private static final long serialVersionUID = 6659179609972376021L;
/*节点顺序*/ /*节点顺序*/
@Length(min = 1,max = 10,message = "长度最小为1,最大为10") @Length(min = 1,max = 10,message = "长度最小为1,最大为10")
@NotBlank @NotBlank
......
...@@ -30,7 +30,7 @@ import java.util.List; ...@@ -30,7 +30,7 @@ import java.util.List;
* Created by on 2018-4-17 14:33:36. * Created by on 2018-4-17 14:33:36.
*/ */
@RestController @RestController
@RequestMapping("/beduclass") @RequestMapping("/bEduClass")
public class BEduClassController extends PaginationController<BEduClass> { public class BEduClassController extends PaginationController<BEduClass> {
@Autowired @Autowired
...@@ -45,20 +45,20 @@ public class BEduClassController extends PaginationController<BEduClass> { ...@@ -45,20 +45,20 @@ public class BEduClassController extends PaginationController<BEduClass> {
@ApiImplicitParam(name = "classedId", value = "教学班ID串", required = false, dataType = "varchar")}) @ApiImplicitParam(name = "classedId", value = "教学班ID串", required = false, dataType = "varchar")})
@PostMapping(value = "/add") @PostMapping(value = "/add")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result add(@Valid BEduClass bEduClass, BindingResult bindingResult) { public Result add(BEduClass bEduClass) {
bEduClass.setToken(getToken()); bEduClass.setToken(getToken());
PersistModel data = bEduClassServiceImpl.save(bEduClass); PersistModel data = bEduClassServiceImpl.save(bEduClass);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bEduClass); bEduClass);
} }
@ApiOperation(value="逻辑删除", notes="逻辑删除") @ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}") @PostMapping("/delete")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result delete(@PathVariable String id) { public Result delete(String id) {
BEduClass bEduClass = new BEduClass(); BEduClass bEduClass = new BEduClass();
bEduClass.setBusinessId(id); bEduClass.setBusinessId(id);
bEduClass.setToken(getToken()); bEduClass.setToken(getToken());
...@@ -76,26 +76,26 @@ public class BEduClassController extends PaginationController<BEduClass> { ...@@ -76,26 +76,26 @@ public class BEduClassController extends PaginationController<BEduClass> {
@ApiImplicitParam(name = "agencyId", value = "企业ID", required = false, dataType = "varchar"), @ApiImplicitParam(name = "agencyId", value = "企业ID", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "type", value = "班级类型 length(1)", required = false, dataType = "varchar"), @ApiImplicitParam(name = "type", value = "班级类型 length(1)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "classedId", value = "教学班ID串 length(1~150)", required = false, dataType = "varchar")}) @ApiImplicitParam(name = "classedId", value = "教学班ID串 length(1~150)", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}") @PostMapping("/update")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result update(BEduClass bEduClass, BindingResult bindingResult) { public Result update(BEduClass bEduClass) {
bEduClass.setToken(getToken()); bEduClass.setToken(getToken());
PersistModel data = bEduClassServiceImpl.merge(bEduClass); PersistModel data = bEduClassServiceImpl.merge(bEduClass);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bEduClass); bEduClass);
} }
@ApiOperation(value="查看单 ", notes="查看单 ") @ApiOperation(value="查看单 ", notes="查看单 ")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@GetMapping("/detail/{id:\\w+}") @GetMapping("/selectOne")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result detail(@PathVariable String id) { public Result detail(String id) {
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bEduClassServiceImpl.findById(id)); bEduClassServiceImpl.findById(id));
} }
@ApiOperation(value="查看 集合", notes="查看单 集合") @ApiOperation(value="查看 集合", notes="查看单 集合")
......
...@@ -23,6 +23,7 @@ import java.util.List; ...@@ -23,6 +23,7 @@ import java.util.List;
public class BEduClass extends IdEntity<BEduClass> { public class BEduClass extends IdEntity<BEduClass> {
private static final long serialVersionUID = 1330074578479142863L;
/*教学班编号*/ /*教学班编号*/
@Length(min = 1,max = 50,message = "长度最小为1,最大为50") @Length(min = 1,max = 50,message = "长度最小为1,最大为50")
@NotBlank @NotBlank
......
...@@ -92,8 +92,7 @@ public class BEduClassServiceImpl implements BEduClassService { ...@@ -92,8 +92,7 @@ public class BEduClassServiceImpl implements BEduClassService {
* @param bEduClass * @param bEduClass
* @return * @return
*/ */
public List<BEduClass> findAllByPagination(PageUtil<BEduClass> paginationUtility, public List<BEduClass> findAllByPagination(PageUtil<BEduClass> paginationUtility, BEduClass bEduClass){
BEduClass bEduClass){
bEduClass.setStart(); bEduClass.setStart();
bEduClass.setNotDeleted(); bEduClass.setNotDeleted();
return bEduClassRepository.queryBEduClasss(bEduClass); return bEduClassRepository.queryBEduClasss(bEduClass);
......
...@@ -31,7 +31,7 @@ import java.util.List; ...@@ -31,7 +31,7 @@ import java.util.List;
* Created by on 2018-4-17 15:09:18. * Created by on 2018-4-17 15:09:18.
*/ */
@RestController @RestController
@RequestMapping("/bgrade") @RequestMapping("/bGrade")
public class BGradeController extends PaginationController<BGrade> { public class BGradeController extends PaginationController<BGrade> {
@Autowired @Autowired
...@@ -43,18 +43,18 @@ public class BGradeController extends PaginationController<BGrade> { ...@@ -43,18 +43,18 @@ public class BGradeController extends PaginationController<BGrade> {
@ApiImplicitParam(name = "name", value = "年级名称 length(1~150)", required = true, dataType = "varchar")}) @ApiImplicitParam(name = "name", value = "年级名称 length(1~150)", required = true, dataType = "varchar")})
@PostMapping(value = "/add") @PostMapping(value = "/add")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result add(@ApiIgnore @Valid BGrade bGrade, BindingResult bindingResult) { public Result add(@ApiIgnore BGrade bGrade) {
bGrade.setToken(getToken()); bGrade.setToken(getToken());
PersistModel data = bGradeServiceImpl.save(bGrade); PersistModel data = bGradeServiceImpl.save(bGrade);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bGrade); bGrade);
} }
@ApiOperation(value="逻辑删除", notes="逻辑删除") @ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}") @PostMapping("/delete")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result delete(@PathVariable String id) { public Result delete(@PathVariable String id) {
BGrade bGrade = new BGrade(); BGrade bGrade = new BGrade();
...@@ -64,33 +64,33 @@ public class BGradeController extends PaginationController<BGrade> { ...@@ -64,33 +64,33 @@ public class BGradeController extends PaginationController<BGrade> {
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
id); id);
} }
@ApiOperation(value="修改", notes="修改") @ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId 拼在地址栏", required = false, dataType = "varchar"), @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId 拼在地址栏", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "code", value = "年级编号 length(1~50)", required = false, dataType = "varchar"), @ApiImplicitParam(name = "code", value = "年级编号 length(1~50)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "name", value = "年级名称 length(1~150)", required = false, dataType = "varchar")}) @ApiImplicitParam(name = "name", value = "年级名称 length(1~150)", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}") @PostMapping("/update")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result update(@ApiIgnore BGrade bGrade, BindingResult bindingResult) { public Result update(@ApiIgnore BGrade bGrade) {
bGrade.setToken(getToken()); bGrade.setToken(getToken());
PersistModel data = bGradeServiceImpl.merge(bGrade); PersistModel data = bGradeServiceImpl.merge(bGrade);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bGrade); bGrade);
} }
@ApiOperation(value="查看单 ", notes="查看单 ") @ApiOperation(value="查看单 ", notes="查看单 ")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId 拼在地址栏", required = true, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId 拼在地址栏", required = true, dataType = "varchar")})
@GetMapping("/detail/{businessId:\\w+}") @GetMapping("/selectOne")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
public Result detail(@PathVariable String businessId) { public Result detail(String businessId) {
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bGradeServiceImpl.findById(businessId)); bGradeServiceImpl.findById(businessId));
} }
@ApiOperation(value="查看 集合", notes="查看单 集合") @ApiOperation(value="查看 集合", notes="查看单 集合")
...@@ -104,4 +104,15 @@ public class BGradeController extends PaginationController<BGrade> { ...@@ -104,4 +104,15 @@ public class BGradeController extends PaginationController<BGrade> {
bGradeServiceImpl.findAllByPagination(getPaginationUtility(), bGrade); bGradeServiceImpl.findAllByPagination(getPaginationUtility(), bGrade);
return getGridModelResponse(); return getGridModelResponse();
} }
@ApiOperation(value="查询近5年的年级", notes="查询近5年的年级")
@GetMapping(value = "/queryFirstFiveBGrades")
@PreAuthorize("hasRole('ROLE_1001')")
public Result queryFirstFiveBGrades(@ApiIgnore BGrade bGrade) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bGradeServiceImpl.queryFirstFiveBGrades(bGrade));
}
} }
...@@ -25,5 +25,23 @@ public interface BGradeRepository extends BaseMapper<BGrade> { ...@@ -25,5 +25,23 @@ public interface BGradeRepository extends BaseMapper<BGrade> {
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BGrade> queryBGrades(BGrade bGrade); List<BGrade> queryBGrades(BGrade bGrade);
/**
查询是否有本年的年级
*/
@Select("<script>select * from b_grade where code = #{nowYear} </script>")
@ResultMap(value = "BaseResultMap" )
List<BGrade> queryBGradeByNowYear(String nowYear);
/*
查询近5年的年级
*/
@Select("<script>select * from b_grade where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "order by code desc "
+ "limit 5</script>")
@ResultMap(value = "BaseResultMap" )
List<BGrade> queryFirstFiveBGrades(BGrade bGrade);
} }
...@@ -23,6 +23,7 @@ import java.util.List; ...@@ -23,6 +23,7 @@ import java.util.List;
public class BGrade extends IdEntity<BGrade> { public class BGrade extends IdEntity<BGrade> {
private static final long serialVersionUID = -7596273136358665894L;
/*年级编号*/ /*年级编号*/
@NotBlank @NotBlank
@Length(min = 1,max = 50,message = "长度最小为1,最大为50") @Length(min = 1,max = 50,message = "长度最小为1,最大为50")
......
...@@ -48,6 +48,10 @@ public interface BGradeService { ...@@ -48,6 +48,10 @@ public interface BGradeService {
BGrade bGrade); BGrade bGrade);
/**
* 查询近5年的年级
* @param bGrade
* @return
*/
List<BGrade> queryFirstFiveBGrades(BGrade bGrade);
} }
...@@ -15,6 +15,8 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -15,6 +15,8 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -92,11 +94,34 @@ public class BGradeServiceImpl implements BGradeService { ...@@ -92,11 +94,34 @@ public class BGradeServiceImpl implements BGradeService {
* @param bGrade * @param bGrade
* @return * @return
*/ */
public List<BGrade> findAllByPagination(PageUtil<BGrade> paginationUtility, public List<BGrade> findAllByPagination(PageUtil<BGrade> paginationUtility, BGrade bGrade){
BGrade bGrade){
bGrade.setStart(); bGrade.setStart();
bGrade.setNotDeleted(); bGrade.setNotDeleted();
return bGradeRepository.queryBGrades(bGrade); return bGradeRepository.queryBGrades(bGrade);
} }
/**
* 查询近5年的年级
* @param bGrade
* @return
*/
@Override
public List<BGrade> queryFirstFiveBGrades(BGrade bGrade) {
bGrade.setStart();
bGrade.setNotDeleted();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
Date date = new Date();
String nowYear = sdf.format(date);
//查询是否有本年的年级
List<BGrade> bGrades = bGradeRepository.queryBGradeByNowYear(nowYear);
if(bGrades.size()<1){//没有就新增
BGrade grade = new BGrade();
grade.setCode(nowYear);
grade.setName(nowYear+"级");
UserUtil.setCurrentPersistOperation(grade);
bGradeRepository.insertSelective(grade);
}
return bGradeRepository.queryFirstFiveBGrades(bGrade);
}
} }
...@@ -17,6 +17,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -17,6 +17,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil; import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.IdGen; import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.TestChinese;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -112,6 +113,8 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -112,6 +113,8 @@ public class BLessonServiceImpl implements BLessonService {
ArrayList<String> repeatCode = new ArrayList<String>(); ArrayList<String> repeatCode = new ArrayList<String>();
List<String> errorCode = new ArrayList<>(); List<String> errorCode = new ArrayList<>();
ArrayList<String> direction = new ArrayList<String>(); ArrayList<String> direction = new ArrayList<String>();
List<String> isChinese = new ArrayList<>();
List<String> isNegative = new ArrayList<>();
String[] headers = {"课程编号","课程名称","课程方向编号","学时","学分"}; String[] headers = {"课程编号","课程名称","课程方向编号","学时","学分"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers); //获取excel数据
...@@ -125,12 +128,24 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -125,12 +128,24 @@ public class BLessonServiceImpl implements BLessonService {
BLesson bLesson = null; BLesson bLesson = null;
String classCode = value[0]; String classCode = value[0];
//判断编号是否含有中文
if(TestChinese.isChinese(classCode)){
isChinese.add(value[0]);
continue;
};
//判断1:班级编号是否满足<15位; //判断1:班级编号是否满足<15位;
if(classCode.length()>15){ if(classCode.length()>15){
//该用户不满足要求,记入valuesShort中 //该用户不满足要求,记入valuesShort中
errorCode.add(value[0]); errorCode.add(value[0]);
continue; continue;
} }
if(Integer.parseInt(value[4])<0||Integer.parseInt(value[3])<0){
//该用户不满足要求,记入valuesShort中
isNegative.add(value[0]);
continue;
}
if((bLesson=bLessonRepository.queryBLessonByCode(value[0]))!=null) { if((bLesson=bLessonRepository.queryBLessonByCode(value[0]))!=null) {
repeatCode.add(value[0]); repeatCode.add(value[0]);
continue; continue;
...@@ -169,6 +184,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -169,6 +184,12 @@ public class BLessonServiceImpl implements BLessonService {
} }
if(isNegative.size()>0){
result+="以下课程的学时或学分不能为负数:"+ JSON.toJSONString(isNegative)+"。";
}
if(isChinese.size()>0){
result+="以下编号格式不正确:"+ JSON.toJSONString(isChinese)+"。";
}
if(repeatCode.size()>0){ if(repeatCode.size()>0){
result+="以下课程编号存在重复:"+ JSON.toJSONString(repeatCode)+"。"; result+="以下课程编号存在重复:"+ JSON.toJSONString(repeatCode)+"。";
} }
......
...@@ -306,6 +306,17 @@ public class BSlController extends PaginationController<BSl> { ...@@ -306,6 +306,17 @@ public class BSlController extends PaginationController<BSl> {
slId); slId);
} }
@ApiOperation(value="修改任课教师", notes="修改任课教师")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "teacherCode", value = "教师工号", required = true, dataType = "varchar")})
@PostMapping("/updateTeacher")
public Result updateTeacher(String businessId, String teacherCode){
int data = bSlService.updateTeacher(businessId,teacherCode);
return Result.builder(new PersistModel(data),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
teacherCode);
}
/*public GridModel querySlStudentSlId(String slId) { /*public GridModel querySlStudentSlId(String slId) {
bSlService.querySlStudentByPagination(getPaginationUtility(),slId); bSlService.querySlStudentByPagination(getPaginationUtility(),slId);
......
...@@ -261,6 +261,9 @@ public interface BSlRepository extends BaseMapper<BSl> { ...@@ -261,6 +261,9 @@ public interface BSlRepository extends BaseMapper<BSl> {
"where sl.business_id = #{slId}") "where sl.business_id = #{slId}")
int queryStudentNumById(String slId); int queryStudentNumById(String slId);
@Update("<script>update b_sl set teacher_code=#{teacherCode} where business_id=#{businessId}</script>")
int updateTeacher(@Param("businessId") String businessId, @Param("teacherCode") String teacherCode);
//List<BStudent> querySlStudentByPagination(String slId); //List<BStudent> querySlStudentByPagination(String slId);
} }
...@@ -123,5 +123,7 @@ public interface BSlService{ ...@@ -123,5 +123,7 @@ public interface BSlService{
int auditBsl(String slId, String status, String opinion); int auditBsl(String slId, String status, String opinion);
int updateTeacher(String businessId, String teacherCode);
//List<BStudent> querySlStudentByPagination(PageUtil pageUtil, String slId); //List<BStudent> querySlStudentByPagination(PageUtil pageUtil, String slId);
} }
...@@ -389,6 +389,11 @@ public class BSlServiceImpl implements BSlService { ...@@ -389,6 +389,11 @@ public class BSlServiceImpl implements BSlService {
return result; return result;
} }
@Override
public int updateTeacher(String businessId, String teacherCode) {
return bSlRepository.updateTeacher(businessId,teacherCode);
}
/*@Override /*@Override
public List<BStudent> querySlStudentByPagination(PageUtil pageUtil, String slId) { public List<BStudent> querySlStudentByPagination(PageUtil pageUtil, String slId) {
return bSlRepository.querySlStudentByPagination(slId); return bSlRepository.querySlStudentByPagination(slId);
......
...@@ -20,6 +20,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -20,6 +20,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil; import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.RegexValidateUtil; import org.rcisoft.core.util.RegexValidateUtil;
import org.rcisoft.core.util.TestChinese;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.dao.SysUserMapper; import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.entity.SysUser; import org.rcisoft.sys.user.entity.SysUser;
...@@ -137,11 +138,19 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -137,11 +138,19 @@ public class BStudentServiceImpl implements BStudentService {
List<String> valuesRepeat = new ArrayList<>(); List<String> valuesRepeat = new ArrayList<>();
List<String> valuesShort = new ArrayList<>(); List<String> valuesShort = new ArrayList<>();
List<String> valuesEmailExist = new ArrayList<>(); List<String> valuesEmailExist = new ArrayList<>();
List<String> isChinese = new ArrayList<>();
List<String> nameTooLong = new ArrayList<>();
for (String[] value : values) { for (String[] value : values) {
String stuCode = value[0]; String stuCode = value[0];
//判断学号是否含有中文
if(TestChinese.isChinese(stuCode)){
isChinese.add(value[0]);
continue;
};
//判断1:学号是否满足8~15位; //判断1:学号是否满足8~15位;
if(stuCode.length()<8||stuCode.length()>15){ if(stuCode.length()<8||stuCode.length()>15){
//该用户不满足要求,记入valuesShort中 //该用户不满足要求,记入valuesShort中
...@@ -149,6 +158,12 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -149,6 +158,12 @@ public class BStudentServiceImpl implements BStudentService {
continue; continue;
} }
if(value[1].length()<1||value[1].length()>15){
//该用户不满足要求,记入valuesShort中
nameTooLong.add(value[0]);
continue;
}
//判断2:MySQL数据库中是否存在该用户; //判断2:MySQL数据库中是否存在该用户;
SysUser user1 =new SysUser(); SysUser user1 =new SysUser();
user1.setLoginName(value[0]); user1.setLoginName(value[0]);
...@@ -224,9 +239,15 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -224,9 +239,15 @@ public class BStudentServiceImpl implements BStudentService {
} }
} }
if(isChinese.size()>0){
result+="以下学生的学号格式不正确:"+ JSON.toJSONString(isChinese)+"。";
}
if(valuesRepeat.size()>0){ if(valuesRepeat.size()>0){
result+="以下学生的学号存在重复:"+ JSON.toJSONString(valuesRepeat)+"。"; result+="以下学生的学号存在重复:"+ JSON.toJSONString(valuesRepeat)+"。";
} }
if(nameTooLong.size()>0){
result+="以下学生的姓名格式不正确:"+ JSON.toJSONString(nameTooLong)+"。";
}
if(valuesShort.size()>0){ if(valuesShort.size()>0){
result+="以下学生的学号位数不在8~15位之间:"+ JSON.toJSONString(valuesShort)+"。"; result+="以下学生的学号位数不在8~15位之间:"+ JSON.toJSONString(valuesShort)+"。";
} }
......
...@@ -43,7 +43,7 @@ public interface BTeacherRepository extends BaseMapper<BTeacher> { ...@@ -43,7 +43,7 @@ public interface BTeacherRepository extends BaseMapper<BTeacher> {
"FROM\n" + "FROM\n" +
"\tb_teacher b\n" + "\tb_teacher b\n" +
"LEFT JOIN s_user u ON b.`code` = u.login_name\n" + "LEFT JOIN s_user u ON b.`code` = u.login_name\n" +
" where b.del_flag != 1" + " where b.del_flag != 1 AND u.del_flag != 1 " +
"<if test=\"name!=null\">and u.`name` like #{name}</if>"+ "<if test=\"name!=null\">and u.`name` like #{name}</if>"+
"<if test=\"code!=null\">and b.`code` like #{code}</if>" + "<if test=\"code!=null\">and b.`code` like #{code}</if>" +
"<if test=\"teacherCode!=null\">and b.`code` != #{teacherCode}</if></script>") "<if test=\"teacherCode!=null\">and b.`code` != #{teacherCode}</if></script>")
......
...@@ -18,6 +18,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -18,6 +18,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil; import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.RegexValidateUtil; import org.rcisoft.core.util.RegexValidateUtil;
import org.rcisoft.core.util.TestChinese;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.dao.SysUserMapper; import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.entity.SysUser; import org.rcisoft.sys.user.entity.SysUser;
...@@ -92,10 +93,17 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -92,10 +93,17 @@ public class BTeacherServiceImpl implements BTeacherService {
List<String> valuesRepeat = new ArrayList<>(); List<String> valuesRepeat = new ArrayList<>();
List<String> valuesShort = new ArrayList<>(); List<String> valuesShort = new ArrayList<>();
List<String> valuesEmailExist = new ArrayList<>(); List<String> valuesEmailExist = new ArrayList<>();
List<String> isChinese = new ArrayList<>();
List<String> nameTooLong = new ArrayList<>();
for (String[] value : values) { for (String[] value : values) {
String teaCode = value[0]; String teaCode = value[0];
//判断工号是否含有中文
if(TestChinese.isChinese(teaCode)){
isChinese.add(value[0]);
continue;
};
//判断1:学号是否满足8~15位; //判断1:学号是否满足8~15位;
if(teaCode.length()<8||teaCode.length()>15){ if(teaCode.length()<8||teaCode.length()>15){
...@@ -104,6 +112,12 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -104,6 +112,12 @@ public class BTeacherServiceImpl implements BTeacherService {
continue; continue;
} }
if(value[1].length()<1||value[1].length()>15){
//该用户不满足要求,记入valuesShort中
nameTooLong.add(value[0]);
continue;
}
//判断2:MySQL数据库中是否存在该用户; //判断2:MySQL数据库中是否存在该用户;
SysUser user1 =new SysUser(); SysUser user1 =new SysUser();
user1.setLoginName(value[0]); user1.setLoginName(value[0]);
...@@ -179,9 +193,15 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -179,9 +193,15 @@ public class BTeacherServiceImpl implements BTeacherService {
} }
} }
if(isChinese.size()>0){
result+="以下教师的工号格式不正确:"+ JSON.toJSONString(isChinese)+"。";
}
if(valuesRepeat.size()>0){ if(valuesRepeat.size()>0){
result+="以下教师的工号存在重复:"+ JSON.toJSONString(valuesRepeat)+"。"; result+="以下教师的工号存在重复:"+ JSON.toJSONString(valuesRepeat)+"。";
} }
if(nameTooLong.size()>0){
result+="以下教师的姓名格式不正确:"+ JSON.toJSONString(nameTooLong)+"。";
}
if(valuesShort.size()>0){ if(valuesShort.size()>0){
result+="以下教师的工号位数不在8~15位之间:"+ JSON.toJSONString(valuesShort)+"。"; result+="以下教师的工号位数不在8~15位之间:"+ JSON.toJSONString(valuesShort)+"。";
} }
......
...@@ -72,7 +72,8 @@ public class TExamInfoServiceImpl implements TExamInfoService { ...@@ -72,7 +72,8 @@ public class TExamInfoServiceImpl implements TExamInfoService {
tExamInfo.setIp(IpUtil.getIpAddr(request)); tExamInfo.setIp(IpUtil.getIpAddr(request));
int line = tExamInfoRepository.insertSelective(tExamInfo); int line = tExamInfoRepository.insertSelective(tExamInfo);
tExamInfoRepository.updateStatus(pId); tExamInfoRepository.updateStatus(pId);
return new PersistModel(line,pId); Object pid = pId;
return new PersistModel(line,pid);
}else{ }else{
throw new ServiceException(ResultServiceEnums.NO_PAPER_EXISTS); throw new ServiceException(ResultServiceEnums.NO_PAPER_EXISTS);
} }
......
...@@ -227,7 +227,9 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -227,7 +227,9 @@ public class TQuestionServiceImpl implements TQuestionService {
byte[] results = rcRedisServiceImpl.getBytes(userId + "_" + chapterId); byte[] results = rcRedisServiceImpl.getBytes(userId + "_" + chapterId);
QuestionListAndNumDto questionListAndNum = new QuestionListAndNumDto(); QuestionListAndNumDto questionListAndNum = new QuestionListAndNumDto();
//判断缓存中是否有数据,有数据直接返回;没有数据先查询数据,再放入缓存 //判断缓存中是否有数据,有数据直接返回;没有数据先查询数据,再放入缓存
log.info("-----正在查询------");
if(results!=null){ if(results!=null){
log.info("-----redis有数据------");
questionListAndNum = SerializationUtils.deserializer(results, QuestionListAndNumDto.class); questionListAndNum = SerializationUtils.deserializer(results, QuestionListAndNumDto.class);
if(questionListAndNum!=null) if(questionListAndNum!=null)
return questionListAndNum; return questionListAndNum;
...@@ -251,6 +253,7 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -251,6 +253,7 @@ public class TQuestionServiceImpl implements TQuestionService {
List<TQuestion> multiSelectList = new ArrayList<>(); List<TQuestion> multiSelectList = new ArrayList<>();
List<TQuestion> judgmentList = new ArrayList<>(); List<TQuestion> judgmentList = new ArrayList<>();
List<TQuestion> questionList = tQuestionRepository.queryQuestionsByChap_IdAndQtype(pId); List<TQuestion> questionList = tQuestionRepository.queryQuestionsByChap_IdAndQtype(pId);
log.info("全部习题:+++++++++"+questionList.toString());
for(TQuestion question : questionList){ for(TQuestion question : questionList){
if(question==null){ if(question==null){
throw new ServiceException(ResultServiceEnums.QUESTION_ERROR); throw new ServiceException(ResultServiceEnums.QUESTION_ERROR);
...@@ -298,9 +301,12 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -298,9 +301,12 @@ public class TQuestionServiceImpl implements TQuestionService {
questionListAndNum.setNumOfMultiSelect(tQuestionRepository.queryNumByType("2",chapterId).get(0)); questionListAndNum.setNumOfMultiSelect(tQuestionRepository.queryNumByType("2",chapterId).get(0));
questionListAndNum.setNumOfJudgment(tQuestionRepository.queryNumByType("3",chapterId).get(0)); questionListAndNum.setNumOfJudgment(tQuestionRepository.queryNumByType("3",chapterId).get(0));
//将数据放入缓存中 //将数据放入缓存中
log.info("-----redis开始放数据------");
rcRedisServiceImpl.setBytes(userId + "_" + chapterId, rcRedisServiceImpl.setBytes(userId + "_" + chapterId,
SerializationUtils.serializer(questionListAndNum), SerializationUtils.serializer(questionListAndNum),
global.getREDIS_TIMEOUT()); global.getREDIS_TIMEOUT());
log.info("-----redis结束放数据------");
log.info(questionListAndNum.toString());
return questionListAndNum; return questionListAndNum;
} }
......
package org.rcisoft.config; package org.rcisoft.config;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.core.bean.RcRedisConfigBean; import org.rcisoft.core.bean.RcRedisConfigBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -54,7 +55,9 @@ public class RedisConfig { ...@@ -54,7 +55,9 @@ public class RedisConfig {
config.setTimeBetweenEvictionRunsMillis(-1); config.setTimeBetweenEvictionRunsMillis(-1);
JedisPool pool = new JedisPool(config,redisConfigBean.getHost(),redisConfigBean.getPort(), JedisPool pool = new JedisPool(config,redisConfigBean.getHost(),redisConfigBean.getPort(),
redisConfigBean.getTimeout(),redisConfigBean.getPassword(),redisConfigBean.getDatabase()); redisConfigBean.getTimeout(),
(StringUtils.isAnyBlank(redisConfigBean.getPassword()) ? null : redisConfigBean.getPassword()),
redisConfigBean.getDatabase());
log.info("init JedisPool ..."); log.info("init JedisPool ...");
return pool; return pool;
} }
......
...@@ -17,7 +17,6 @@ public class RcRedisConfigBean { ...@@ -17,7 +17,6 @@ public class RcRedisConfigBean {
private int port; private int port;
@Value("${spring.redis.password}")
private String password; private String password;
private int timeout; private int timeout;
......
...@@ -52,14 +52,14 @@ public class JwtAuthenTokenFilter extends OncePerRequestFilter { ...@@ -52,14 +52,14 @@ public class JwtAuthenTokenFilter extends OncePerRequestFilter {
/**/ /**/
String lk = rcRedisServiceImpl.get("lk"); String lk = rcRedisServiceImpl.get("lk");
// if(StringUtils.isBlank(lk) || !"1".equals(lk)){ /*if(StringUtils.isBlank(lk) || !"1".equals(lk)){
// if(permitRes==-1) { if(permitRes==-1) {
// Result result = new Result(); Result result = new Result();
// result.setCode(202); result.setCode(202);
// ResponseUtil.responseResult(response, result); ResponseUtil.responseResult(response, result);
// return; return;
// } }
// } }*/
// 取得header // 取得header
String authHeader = request.getHeader(this.tokenHeader); String authHeader = request.getHeader(this.tokenHeader);
//判断header头 //判断header头
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment