|
|
@ -12,12 +12,14 @@ import com.ibeetl.admin.core.entity.CoreDict;
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
import com.ibeetl.admin.core.service.CorePlatformService;
|
|
|
|
import com.ibeetl.admin.core.service.CorePlatformService;
|
|
|
|
import com.ibeetl.admin.core.service.CoreUserService;
|
|
|
|
import com.ibeetl.admin.core.service.CoreUserService;
|
|
|
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
import com.ibeetl.jlw.dao.StudentAccountAssetAllocationDao;
|
|
|
|
import com.ibeetl.jlw.dao.StudentAccountAssetAllocationDao;
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
import com.ibeetl.jlw.entity.dto.CreateUserDTO;
|
|
|
|
import com.ibeetl.jlw.entity.dto.CreateUserDTO;
|
|
|
|
import com.ibeetl.jlw.enums.AccountTypeEnum;
|
|
|
|
import com.ibeetl.jlw.enums.AccountTypeEnum;
|
|
|
|
import com.ibeetl.jlw.enums.GenderEnum;
|
|
|
|
import com.ibeetl.jlw.enums.GenderEnum;
|
|
|
|
import com.ibeetl.jlw.service.*;
|
|
|
|
import com.ibeetl.jlw.service.*;
|
|
|
|
|
|
|
|
import com.ibeetl.jlw.util.HttpJsonRequest;
|
|
|
|
import com.ibeetl.jlw.util.HttpUtil;
|
|
|
|
import com.ibeetl.jlw.util.HttpUtil;
|
|
|
|
import com.ibeetl.jlw.util.ZhiYunJDBCUtil;
|
|
|
|
import com.ibeetl.jlw.util.ZhiYunJDBCUtil;
|
|
|
|
import com.ibeetl.jlw.web.query.*;
|
|
|
|
import com.ibeetl.jlw.web.query.*;
|
|
|
@ -33,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Type;
|
|
|
|
import java.lang.reflect.Type;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.security.MessageDigest;
|
|
|
|
import java.sql.*;
|
|
|
|
import java.sql.*;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
@ -42,6 +45,9 @@ import java.util.concurrent.Executors;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.ibeetl.jlw.enums.AddTypeEnum.ADMIN_ADD;
|
|
|
|
|
|
|
|
import static com.ibeetl.jlw.enums.AddTypeEnum.FACULTY_ADD;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Api(tags = "数据迁移")
|
|
|
|
@Api(tags = "数据迁移")
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
@ -76,9 +82,12 @@ public class TestController {
|
|
|
|
private StudentAccountCrowdfundingSystemService studentAccountCrowdfundingSystemService;
|
|
|
|
private StudentAccountCrowdfundingSystemService studentAccountCrowdfundingSystemService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private StudentAccountMockTradingSystemService studentAccountMockTradingSystemService;
|
|
|
|
private StudentAccountMockTradingSystemService studentAccountMockTradingSystemService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private CourseInfoService courseInfoService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private StudentAccountEquityInvestmentSystemService studentAccountEquityInvestmentSystemService;
|
|
|
|
private StudentAccountEquityInvestmentSystemService studentAccountEquityInvestmentSystemService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ResourcesInfoService resourcesInfoService;
|
|
|
|
private final static String URL = "jdbc:sqlserver://120.79.161.177:1433;databaseName=Test.Zhiyun_v2.0;trustServerCertificate=true;encrypt=true";
|
|
|
|
private final static String URL = "jdbc:sqlserver://120.79.161.177:1433;databaseName=Test.Zhiyun_v2.0;trustServerCertificate=true;encrypt=true";
|
|
|
|
private final static String USER = "sa";
|
|
|
|
private final static String USER = "sa";
|
|
|
|
private final static String PASSWORD = "sztzjy@2017";
|
|
|
|
private final static String PASSWORD = "sztzjy@2017";
|
|
|
@ -128,7 +137,7 @@ public class TestController {
|
|
|
|
" join EduUsers on EduSchools.Id=EduUsers.SchoolId \n" +
|
|
|
|
" join EduUsers on EduSchools.Id=EduUsers.SchoolId \n" +
|
|
|
|
" join EduUserRoles on EduUsers.Id = EduUserRoles.UserId \n" +
|
|
|
|
" join EduUserRoles on EduUsers.Id = EduUserRoles.UserId \n" +
|
|
|
|
" join EduLevel on EduSchools.LevelId=EduLevel.Id where \n" +
|
|
|
|
" join EduLevel on EduSchools.LevelId=EduLevel.Id where \n" +
|
|
|
|
" EduUserRoles.RoleId=2 ";
|
|
|
|
" EduUserRoles.RoleId=2 and EduSchools.id = 67";
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
while (resultSet.next()) {
|
|
|
|
while (resultSet.next()) {
|
|
|
@ -188,7 +197,7 @@ public class TestController {
|
|
|
|
" EduColleges col" +
|
|
|
|
" EduColleges col" +
|
|
|
|
" JOIN EduSchools sch " +
|
|
|
|
" JOIN EduSchools sch " +
|
|
|
|
"ON" +
|
|
|
|
"ON" +
|
|
|
|
" col.SchoolId = sch.id ";
|
|
|
|
" col.SchoolId = sch.id where sch.id=67";
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
@ -267,7 +276,7 @@ public class TestController {
|
|
|
|
"FROM " +
|
|
|
|
"FROM " +
|
|
|
|
" EduMajors ma " +
|
|
|
|
" EduMajors ma " +
|
|
|
|
" JOIN EduColleges col ON ma.CollegeId = col.Id " +
|
|
|
|
" JOIN EduColleges col ON ma.CollegeId = col.Id " +
|
|
|
|
" JOIN EduSchools sch ON col.schoolId = sch.id ";
|
|
|
|
" JOIN EduSchools sch ON col.schoolId = sch.id where sch.id=67";
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
@ -346,7 +355,7 @@ public class TestController {
|
|
|
|
" cla.id," +
|
|
|
|
" cla.id," +
|
|
|
|
" cla.schoolId as schoolId \n" +
|
|
|
|
" cla.schoolId as schoolId \n" +
|
|
|
|
" FROM \n" +
|
|
|
|
" FROM \n" +
|
|
|
|
" EduClasses cla ";
|
|
|
|
" EduClasses cla where cla.schoolId = 67";
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
@ -433,7 +442,7 @@ public class TestController {
|
|
|
|
" EduTeachers tea " +
|
|
|
|
" EduTeachers tea " +
|
|
|
|
" JOIN EduColleges col ON tea.CollegeId = col.Id " +
|
|
|
|
" JOIN EduColleges col ON tea.CollegeId = col.Id " +
|
|
|
|
" JOIN EduMajors maj ON tea.MajorId = maj.Id " +
|
|
|
|
" JOIN EduMajors maj ON tea.MajorId = maj.Id " +
|
|
|
|
" JOIN EduSchools sch ON tea.SchoolId = sch.Id ";
|
|
|
|
" JOIN EduSchools sch ON tea.SchoolId = sch.Id where sch.id = 67";
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
@ -523,7 +532,7 @@ public class TestController {
|
|
|
|
" JOIN EduMajors maj ON stu.MajorId = maj.Id " +
|
|
|
|
" JOIN EduMajors maj ON stu.MajorId = maj.Id " +
|
|
|
|
" JOIN EduSchools sch ON stu.SchoolId = sch.Id " +
|
|
|
|
" JOIN EduSchools sch ON stu.SchoolId = sch.Id " +
|
|
|
|
" JOIN EduClasses cla ON stu.ClassId = cla.Id" +
|
|
|
|
" JOIN EduClasses cla ON stu.ClassId = cla.Id" +
|
|
|
|
" join EduUsers us on stu.StudentNo = us.UserName where stu.isdeleted=0 and cla.id = 1274";
|
|
|
|
" join EduUsers us on stu.StudentNo = us.UserName where stu.isdeleted=0 and sch.id=67";
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ps = conn.prepareStatement(sql);
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
ResultSet resultSet = ps.executeQuery();
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
@ -1616,7 +1625,7 @@ public class TestController {
|
|
|
|
for (Student student : students) {
|
|
|
|
for (Student student : students) {
|
|
|
|
|
|
|
|
|
|
|
|
StudentAccountForeignExchangeInvestmentSystem foreignExchangeInvestmentSystem = studentAccountForeignExchangeInvestmentSystemService.getByStudentId(student.getStudentId());
|
|
|
|
StudentAccountForeignExchangeInvestmentSystem foreignExchangeInvestmentSystem = studentAccountForeignExchangeInvestmentSystemService.getByStudentId(student.getStudentId());
|
|
|
|
if(foreignExchangeInvestmentSystem != null){
|
|
|
|
if (foreignExchangeInvestmentSystem != null) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1667,7 +1676,7 @@ public class TestController {
|
|
|
|
public void removeNameSpace(Long classId) {
|
|
|
|
public void removeNameSpace(Long classId) {
|
|
|
|
StudentQuery q = new StudentQuery();
|
|
|
|
StudentQuery q = new StudentQuery();
|
|
|
|
q.setClassId(classId);
|
|
|
|
q.setClassId(classId);
|
|
|
|
List<Student> students = studentService.getValuesByQuery(q) ;
|
|
|
|
List<Student> students = studentService.getValuesByQuery(q);
|
|
|
|
if (students != null && students.size() > 0) {
|
|
|
|
if (students != null && students.size() > 0) {
|
|
|
|
for (Student student : students) {
|
|
|
|
for (Student student : students) {
|
|
|
|
CoreUser coreUser = coreUserService.getUserById(student.getUserId());
|
|
|
|
CoreUser coreUser = coreUserService.getUserById(student.getUserId());
|
|
|
@ -1687,4 +1696,394 @@ public class TestController {
|
|
|
|
List<CoreDict> aLlListByTable = coreDictDao.findALlListByTable("student_id", "student_name", "", "student", new String[]{"student_status=1"});
|
|
|
|
List<CoreDict> aLlListByTable = coreDictDao.findALlListByTable("student_id", "student_name", "", "student", new String[]{"student_status=1"});
|
|
|
|
int a = 0;
|
|
|
|
int a = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private CourseLabelService courseLabelService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("课程标签迁移")
|
|
|
|
|
|
|
|
@PostMapping("courseTagCopy")
|
|
|
|
|
|
|
|
public void courseTagCopy() throws SQLException {
|
|
|
|
|
|
|
|
Connection connection = ZhiYunJDBCUtil.openConn();
|
|
|
|
|
|
|
|
String sql = "select EduKind.KindName\n" +
|
|
|
|
|
|
|
|
"from EduCourses\n" +
|
|
|
|
|
|
|
|
" join EduKind on EduCourses.KindId = EduKind.Id\n" +
|
|
|
|
|
|
|
|
" join EduLevel on EduCourses.LevelId = EduLevel.Id\n" +
|
|
|
|
|
|
|
|
" join EduCourseKind on EduCourses.CourseKindId = EduCourseKind.Id\n" +
|
|
|
|
|
|
|
|
"group by EduKind.KindName";
|
|
|
|
|
|
|
|
PreparedStatement ps = connection.prepareStatement(sql);
|
|
|
|
|
|
|
|
ResultSet rs = ps.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
String name = rs.getString("KindName");
|
|
|
|
|
|
|
|
if (name == null) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CourseLabel courseLabel = new CourseLabel();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
courseLabel.setCourseLabelName(name);
|
|
|
|
|
|
|
|
courseLabel.setCourseLabelType("理论课程类");
|
|
|
|
|
|
|
|
courseLabel.setCourseLabelStatus(1);
|
|
|
|
|
|
|
|
CoreUser coreUser = coreUserService.findByUsername("tzadmin");
|
|
|
|
|
|
|
|
courseLabel.setOrgId(coreUser.getOrgId());
|
|
|
|
|
|
|
|
courseLabel.setUserId(coreUser.getId());
|
|
|
|
|
|
|
|
courseLabel.setAddType(coreUser.isAdmin() ? ADMIN_ADD : FACULTY_ADD);
|
|
|
|
|
|
|
|
courseLabelService.insert(courseLabel);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("课程迁移")
|
|
|
|
|
|
|
|
@PostMapping("courseCopy")
|
|
|
|
|
|
|
|
public void courseCopy() throws SQLException {
|
|
|
|
|
|
|
|
Connection conn = ZhiYunJDBCUtil.openConn();
|
|
|
|
|
|
|
|
String sql = "select c.id as id, c.name as name, c.CourseImgUrl,c.Description, k.KindName as kindname, c.IsDeleted\n" +
|
|
|
|
|
|
|
|
"from EduCourses c\n" +
|
|
|
|
|
|
|
|
" join EduKind k on c.KindId = k.Id and c.IsDeleted = 0";
|
|
|
|
|
|
|
|
PreparedStatement ps = conn.prepareStatement(sql);
|
|
|
|
|
|
|
|
ResultSet rs = ps.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
String name = rs.getString("name");
|
|
|
|
|
|
|
|
if (name == null) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CourseLabel label = new CourseLabel();
|
|
|
|
|
|
|
|
label.setCourseLabelName(rs.getString("kindname"));
|
|
|
|
|
|
|
|
CourseLabel once = courseLabelService.getOnce(label);
|
|
|
|
|
|
|
|
CourseInfoQuery query = new CourseInfoQuery();
|
|
|
|
|
|
|
|
query.setAddTime(new Date());
|
|
|
|
|
|
|
|
query.setCourseInfoName(name);
|
|
|
|
|
|
|
|
query.setCourseInfoThumbnail(rs.getString("courseimgurl"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
query.setCourseLabelId(once.getCourseLabelId());
|
|
|
|
|
|
|
|
query.setCourseInfoBasicsCount(1000);
|
|
|
|
|
|
|
|
query.setCourseInfoContent(rs.getString("description"));
|
|
|
|
|
|
|
|
query.setCourseInfoType(1);
|
|
|
|
|
|
|
|
// query.setCourseInfoName();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CoreUser coreUser = coreUserService.findByUsername("tzadmin");
|
|
|
|
|
|
|
|
query.setOrgId(coreUser.getOrgId());
|
|
|
|
|
|
|
|
query.setUserId(coreUser.getId());
|
|
|
|
|
|
|
|
query.setCourseInfoStatus(1);
|
|
|
|
|
|
|
|
query.setOldId(rs.getInt("id"));
|
|
|
|
|
|
|
|
CourseInfo courseInfo = courseInfoService.add(query);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("课程章节迁移")
|
|
|
|
|
|
|
|
@PostMapping("courseChapterCopy")
|
|
|
|
|
|
|
|
public void courseChapterCopy() throws SQLException {
|
|
|
|
|
|
|
|
Connection conn = ZhiYunJDBCUtil.openConn();
|
|
|
|
|
|
|
|
String sql = "select * from EduCourseItems where IsDeleted = 0";
|
|
|
|
|
|
|
|
PreparedStatement ps = conn.prepareStatement(sql);
|
|
|
|
|
|
|
|
ResultSet rs = ps.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
Integer courseId = rs.getInt("CourseId");
|
|
|
|
|
|
|
|
String name = rs.getString("Name");
|
|
|
|
|
|
|
|
if (name == null || courseId == 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CourseInfo infoByOldId = courseInfoService.getCourseInfoByOldId(courseId);
|
|
|
|
|
|
|
|
if (infoByOldId == null) continue;
|
|
|
|
|
|
|
|
CourseInfoQuery query = new CourseInfoQuery();
|
|
|
|
|
|
|
|
query.setCourseInfoParentId(infoByOldId.getCourseInfoId());
|
|
|
|
|
|
|
|
query.setCourseInfoType(2);
|
|
|
|
|
|
|
|
query.setCourseInfoName(name);
|
|
|
|
|
|
|
|
query.setCourseInfoStatus(query.getCourseInfoStatus());
|
|
|
|
|
|
|
|
query.setOldItemId(rs.getInt("id"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CourseInfoController controller = new CourseInfoController();
|
|
|
|
|
|
|
|
CoreUser coreUser = coreUserService.findByUsername("tzadmin");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(null != courseInfoQuery.getCourseLabelId()){
|
|
|
|
|
|
|
|
// CourseLabel courseLabel = courseLabelService.queryById(courseInfoQuery.getCourseLabelId());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if(null != courseLabel && courseLabel.getCourseLabelType().contains("应用课程类") &&
|
|
|
|
|
|
|
|
// null == courseInfoQuery.getCourseInfoParentId() && StringUtils.isBlank(courseInfoQuery.getResourcesApplicationIds())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请选择课程归属的应用");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (StringUtils.isEmpty(courseInfoQuery.getCourseInfoThumbnail())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请选择课程缩略图");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//if (Objects.isNull(courseInfoQuery.getCourseInfoType())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请选择课程类别");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//if (Objects.isNull(courseInfoQuery.getCourseLabelId())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请选择课程标签");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (StringUtils.isEmpty(courseInfoQuery.getCourseInfoContent())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请输入课程简介");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (null != query.getCourseInfoParentId()) {
|
|
|
|
|
|
|
|
CourseInfo ci = courseInfoService.queryById(query.getCourseInfoParentId());
|
|
|
|
|
|
|
|
query.setCourseLabelId(ci.getCourseLabelId());
|
|
|
|
|
|
|
|
query.setCourseInfoStatus(1); //状态(1启用 2禁用 3删除)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
query.setCourseInfoStatus(2); //状态(1启用 2禁用 3删除)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
query.setAddTime(new Date());
|
|
|
|
|
|
|
|
query.setUserId(coreUser.getId());
|
|
|
|
|
|
|
|
query.setOrgId(coreUser.getOrgId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CourseInfo courseInfo = courseInfoService.add(query);
|
|
|
|
|
|
|
|
//移除缓存
|
|
|
|
|
|
|
|
courseInfoService.flushCache(courseInfo.getCourseInfoId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ZhiYunJDBCUtil.closeConn(conn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("课程节迁移")
|
|
|
|
|
|
|
|
@PostMapping("courseItemCopy")
|
|
|
|
|
|
|
|
public void courseItemCopy() throws SQLException {
|
|
|
|
|
|
|
|
Connection conn = ZhiYunJDBCUtil.openConn();
|
|
|
|
|
|
|
|
String sql = "select * from EduCourseItemSteps where IsDeleted =0";
|
|
|
|
|
|
|
|
PreparedStatement ps = conn.prepareStatement(sql);
|
|
|
|
|
|
|
|
ResultSet rs = ps.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
Integer courseId = rs.getInt("CourseId");
|
|
|
|
|
|
|
|
Integer itemId = rs.getInt("CourseItemId");
|
|
|
|
|
|
|
|
Integer stepId = rs.getInt("Id");
|
|
|
|
|
|
|
|
String name = rs.getString("Name");
|
|
|
|
|
|
|
|
if (name == null || courseId == 0 || itemId == 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CourseInfo infoByOldId = courseInfoService.getCourseInfoByOldItemId(itemId);
|
|
|
|
|
|
|
|
if (infoByOldId == null) continue;
|
|
|
|
|
|
|
|
CourseInfoQuery query = new CourseInfoQuery();
|
|
|
|
|
|
|
|
query.setCourseInfoParentId(infoByOldId.getCourseInfoId());
|
|
|
|
|
|
|
|
query.setCourseInfoType(3);
|
|
|
|
|
|
|
|
query.setCourseInfoName(name);
|
|
|
|
|
|
|
|
query.setOldStepId(stepId);
|
|
|
|
|
|
|
|
query.setCourseInfoStatus(query.getCourseInfoStatus());
|
|
|
|
|
|
|
|
// query.setOldItemId(rs.getInt("id"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CourseInfoController controller = new CourseInfoController();
|
|
|
|
|
|
|
|
CoreUser coreUser = coreUserService.findByUsername("tzadmin");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(null != courseInfoQuery.getCourseLabelId()){
|
|
|
|
|
|
|
|
// CourseLabel courseLabel = courseLabelService.queryById(courseInfoQuery.getCourseLabelId());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if(null != courseLabel && courseLabel.getCourseLabelType().contains("应用课程类") &&
|
|
|
|
|
|
|
|
// null == courseInfoQuery.getCourseInfoParentId() && StringUtils.isBlank(courseInfoQuery.getResourcesApplicationIds())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请选择课程归属的应用");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (StringUtils.isEmpty(courseInfoQuery.getCourseInfoThumbnail())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请选择课程缩略图");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//if (Objects.isNull(courseInfoQuery.getCourseInfoType())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请选择课程类别");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//if (Objects.isNull(courseInfoQuery.getCourseLabelId())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请选择课程标签");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (StringUtils.isEmpty(courseInfoQuery.getCourseInfoContent())){
|
|
|
|
|
|
|
|
// return JsonResult.failMessage("请输入课程简介");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (null != query.getCourseInfoParentId()) {
|
|
|
|
|
|
|
|
CourseInfo ci = courseInfoService.queryById(query.getCourseInfoParentId());
|
|
|
|
|
|
|
|
query.setCourseLabelId(ci.getCourseLabelId());
|
|
|
|
|
|
|
|
query.setCourseInfoStatus(1); //状态(1启用 2禁用 3删除)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
query.setCourseInfoStatus(2); //状态(1启用 2禁用 3删除)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
query.setAddTime(new Date());
|
|
|
|
|
|
|
|
query.setUserId(coreUser.getId());
|
|
|
|
|
|
|
|
query.setOrgId(coreUser.getOrgId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CourseInfo courseInfo = courseInfoService.add(query);
|
|
|
|
|
|
|
|
//移除缓存
|
|
|
|
|
|
|
|
courseInfoService.flushCache(courseInfo.getCourseInfoId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ZhiYunJDBCUtil.closeConn(conn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("迁移课程资源")
|
|
|
|
|
|
|
|
@PostMapping("courseResourceCopy")
|
|
|
|
|
|
|
|
public void courseResourceCopy() throws SQLException {
|
|
|
|
|
|
|
|
List<CourseInfo> infos = courseInfoService.getCourseInfosByCourseInfoType(2L);
|
|
|
|
|
|
|
|
for (CourseInfo info : infos) {
|
|
|
|
|
|
|
|
Connection conn = ZhiYunJDBCUtil.openConn();
|
|
|
|
|
|
|
|
String sql = "select itemRrsource.CourseItemId as itemId,res.* \n" +
|
|
|
|
|
|
|
|
" from EduCourseItemResources itemRrsource \n" +
|
|
|
|
|
|
|
|
" join EduResources res on itemRrsource.ResourceId = res.Id \n" +
|
|
|
|
|
|
|
|
" join EduCourseItems ite on itemRrsource.CourseItemId = ite.Id \n" +
|
|
|
|
|
|
|
|
" where itemRrsource.IsDeleted = 0 and res.IsDeleted = 0 and ite.IsDeleted=0 \n" +
|
|
|
|
|
|
|
|
"and itemRrsource.CourseItemId = " + info.getOldItemId()+" order by Id";
|
|
|
|
|
|
|
|
PreparedStatement ps = conn.prepareStatement(sql);
|
|
|
|
|
|
|
|
ResultSet rs = ps.executeQuery();
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
List<CourseInfo> courseInfos = courseInfoService.getCourseInfoByParentId(info.getCourseInfoId());
|
|
|
|
|
|
|
|
if (courseInfos == null || courseInfos.isEmpty()) continue;
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(rs.getString("Name").equals("1.2是存起来,还是变更多?.pdf")){
|
|
|
|
|
|
|
|
int a = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(i>=courseInfos.size()){
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.println(rs.getString("Name"));
|
|
|
|
|
|
|
|
CourseInfo courseInfo = courseInfos.get(i);
|
|
|
|
|
|
|
|
String name = rs.getString("Name");
|
|
|
|
|
|
|
|
if (name != null && name.contains(".")) {
|
|
|
|
|
|
|
|
name = name.substring(0, name.lastIndexOf('.'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
assert name != null;
|
|
|
|
|
|
|
|
if (name.equals("1.6风险中性定价法")) {
|
|
|
|
|
|
|
|
int a = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String filePath = rs.getString("FilePath");
|
|
|
|
|
|
|
|
String extend = rs.getString("Extend");
|
|
|
|
|
|
|
|
int recourceType = 0;
|
|
|
|
|
|
|
|
if (extend.contains(".avi")) {
|
|
|
|
|
|
|
|
recourceType = 1;
|
|
|
|
|
|
|
|
} else if (extend.contains(".mp4")) {
|
|
|
|
|
|
|
|
recourceType = 1;
|
|
|
|
|
|
|
|
} else if (extend.contains(".pptx")) {
|
|
|
|
|
|
|
|
recourceType = 2;
|
|
|
|
|
|
|
|
} else if (extend.contains(".pdf")) {
|
|
|
|
|
|
|
|
recourceType = 2;
|
|
|
|
|
|
|
|
} else if (extend.contains(".ppt")) {
|
|
|
|
|
|
|
|
recourceType = 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResourcesInfo resourcesInfo = new ResourcesInfo();
|
|
|
|
|
|
|
|
resourcesInfo.setResourcesInfoType(recourceType);
|
|
|
|
|
|
|
|
resourcesInfo.setResourcesInfoName(name);
|
|
|
|
|
|
|
|
resourcesInfo.setResourcesInfoContent(filePath);
|
|
|
|
|
|
|
|
resourcesInfo.setCourseInfoId(courseInfo.getCourseInfoId());
|
|
|
|
|
|
|
|
resourcesInfoService.add(resourcesInfo);
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ZhiYunJDBCUtil.closeConn(conn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("修改对应用户学校院系专业id")
|
|
|
|
|
|
|
|
@PostMapping("updateSchoolIdAndCollageIdAndMajorId")
|
|
|
|
|
|
|
|
public void updateSchoolIdAndCollageIdAndMajorId(Long orgId) throws SQLException {
|
|
|
|
|
|
|
|
List<CoreUser> users = coreUserService.findBySchoolId(orgId);
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
for (CoreUser user : users) {
|
|
|
|
|
|
|
|
if (user.isStudent()) continue;
|
|
|
|
|
|
|
|
Connection conn = ZhiYunJDBCUtil.openConn();
|
|
|
|
|
|
|
|
String sql = "select sch.id as schoolId,\n" +
|
|
|
|
|
|
|
|
" stu.Name as studentName,\n" +
|
|
|
|
|
|
|
|
" col.name as collageName,\n" +
|
|
|
|
|
|
|
|
" col.id as collageId,\n" +
|
|
|
|
|
|
|
|
" maj.Id as majorId,\n" +
|
|
|
|
|
|
|
|
" maj.name as majorName,\n" +
|
|
|
|
|
|
|
|
" sch.Name as schoolName\n" +
|
|
|
|
|
|
|
|
"from EduUsers users\n" +
|
|
|
|
|
|
|
|
" join EduSchools sch on users.SchoolId = sch.Id\n" +
|
|
|
|
|
|
|
|
" join EduTeachers stu on users.UserName = stu.teacherNo\n" +
|
|
|
|
|
|
|
|
" join EduColleges col on stu.CollegeId = col.Id\n" +
|
|
|
|
|
|
|
|
" join EduMajors maj on stu.MajorId = maj.Id\n" +
|
|
|
|
|
|
|
|
"" +
|
|
|
|
|
|
|
|
"where UserName = '" + user.getCode() + "'";
|
|
|
|
|
|
|
|
Statement statement = conn.createStatement();
|
|
|
|
|
|
|
|
ResultSet resultSet = statement.executeQuery(sql);
|
|
|
|
|
|
|
|
while (resultSet.next()) {
|
|
|
|
|
|
|
|
System.out.println("当前处理:" + i++ + "/" + users.size());
|
|
|
|
|
|
|
|
Long oldSchoolId = resultSet.getLong("schoolId");
|
|
|
|
|
|
|
|
Long oldCollageId = resultSet.getLong("collageId");
|
|
|
|
|
|
|
|
Long oldMajorId = resultSet.getLong("majorId");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UniversitiesColleges colleges = universitiesCollegesService.findByOldId(oldSchoolId);
|
|
|
|
|
|
|
|
user.setOrgId(colleges.getOrgId());
|
|
|
|
|
|
|
|
coreUserService.updateTemplateById(user);
|
|
|
|
|
|
|
|
UniversityFaculty faculty = universityFacultyService.getByOldId(oldCollageId);
|
|
|
|
|
|
|
|
UniversitySystem system = universitySystemService.getByOldId(oldMajorId);
|
|
|
|
|
|
|
|
// SchoolClass classes = schoolClassService.getByOldId(oldClassId);
|
|
|
|
|
|
|
|
Teacher teacher = teacherService.getByUserId(user.getId());
|
|
|
|
|
|
|
|
if (teacher != null) {
|
|
|
|
|
|
|
|
teacher.setOrgId(colleges.getOrgId());
|
|
|
|
|
|
|
|
teacher.setUniversitiesCollegesId(colleges.getUniversitiesCollegesId());
|
|
|
|
|
|
|
|
teacher.setUniversityFacultyId(faculty.getUniversityFacultyId());
|
|
|
|
|
|
|
|
teacher.setUniversitySystemId(system.getUniversitySystemId());
|
|
|
|
|
|
|
|
teacherService.updateTemplate(teacher);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ZhiYunJDBCUtil.closeConn(conn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("修改homework用户名称")
|
|
|
|
|
|
|
|
@PostMapping("updateHomeworkUserName")
|
|
|
|
|
|
|
|
public void updateHomeworkUserName(Integer classId) throws SQLException {
|
|
|
|
|
|
|
|
Connection conn = ZhiYunJDBCUtil.openConn();
|
|
|
|
|
|
|
|
String sql = "select * from EduHomeWorks where ClassId = " + classId;
|
|
|
|
|
|
|
|
Statement statement = conn.createStatement();
|
|
|
|
|
|
|
|
ResultSet rs = statement.executeQuery(sql);
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
String code = rs.getString("studentno");
|
|
|
|
|
|
|
|
CoreUser user = coreUserService.findByUsername(code);
|
|
|
|
|
|
|
|
if (user == null) continue;
|
|
|
|
|
|
|
|
Connection conn1 = ZhiYunJDBCUtil.openConn();
|
|
|
|
|
|
|
|
String sql2 = "update EduHomeWorks set upload = '" + user.getName() + "' where studentno = '" + code + "'";
|
|
|
|
|
|
|
|
Statement statement1 = conn1.createStatement();
|
|
|
|
|
|
|
|
statement1.executeUpdate(sql2);
|
|
|
|
|
|
|
|
conn1.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ZhiYunJDBCUtil.closeConn(conn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("单独新增保险教师信息")
|
|
|
|
|
|
|
|
@PostMapping("addInsuranceTeacher")
|
|
|
|
|
|
|
|
public void addInsuranceTeacher(String schoolName) throws SQLException {
|
|
|
|
|
|
|
|
UniversitiesColleges school = universitiesCollegesService.getByName(schoolName);
|
|
|
|
|
|
|
|
Integer icibtSchoolId = school.getIcibtSchoolId();
|
|
|
|
|
|
|
|
List<Map<String, Object>> teachers = teacherService.findAllTeacherBySchoolId(school.getOldSchoolId());
|
|
|
|
|
|
|
|
for (Map<String,Object> map:teachers){
|
|
|
|
|
|
|
|
String teacherNo = map.get("teacherNo").toString();
|
|
|
|
|
|
|
|
String name = map.get("name").toString();
|
|
|
|
|
|
|
|
createBxStudent(icibtSchoolId,teacherNo,name,0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void createBxStudent(Integer icibtSchoolId, String studentNo, String name, Integer sex) {
|
|
|
|
|
|
|
|
String PostData = "{'LoginName':'" + studentNo + "','Password':'" +
|
|
|
|
|
|
|
|
encryptToMD5("123qwe") + "','Name':'" + name + "','Sex':'" +
|
|
|
|
|
|
|
|
sex + "','SchoolNumber':'" + studentNo + "','RoleId':'" + 3 + "','SchoolId':'" +
|
|
|
|
|
|
|
|
icibtSchoolId + "'}";
|
|
|
|
|
|
|
|
String request = HttpJsonRequest.sendPostRequest("http://120.79.161.177:8183/SignIn/AddUser", null, PostData, "application/json");
|
|
|
|
|
|
|
|
int a = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String encryptToMD5(String input) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
|
|
|
|
|
|
|
byte[] messageDigest = md.digest(input.getBytes());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder hexString = new StringBuilder();
|
|
|
|
|
|
|
|
for (byte b : messageDigest) {
|
|
|
|
|
|
|
|
String hex = Integer.toHexString(0xff & b);
|
|
|
|
|
|
|
|
if (hex.length() == 1) {
|
|
|
|
|
|
|
|
hexString.append('0');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
hexString.append(hex).append('-');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
hexString.deleteCharAt(hexString.length() - 1); // 移除末尾多余的连字符
|
|
|
|
|
|
|
|
return hexString.toString().toUpperCase(); // 转换为大写形式
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|