From c4d773e9f56bdab25cd1e704aac8bfc0be8bfe6d Mon Sep 17 00:00:00 2001 From: chenyuan <907037276@qq.com> Date: Mon, 8 Apr 2024 16:53:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=90=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ibeetl/admin/core/dao/CoreDictDao.java | 1 - .../admin/core/service/CoreDictService.java | 1 + .../admin/core/util/user/ZYUserInfo.java | 177 ++ .../src/main/resources/sql/core/coreUser.md | 6 +- .../cn/jlw/Interceptor/InterceptorConfig.java | 3 +- .../jlw/dao/ResourcesApplicationDao.java | 6 + ...egesJurisdictionExperimentalSystemDao.java | 2 + .../jlw/entity/dto/StuLogicModuleInfoDTO.java | 30 + .../jlw/entity/dto/StuLogicPictureDTO.java | 27 + .../com/ibeetl/jlw/enums/SubsystemName.java | 47 + .../service/ResourcesApplicationService.java | 17 +- .../jlw/service/SchoolClassService.java | 16 +- .../StudentAccountAssetAllocationService.java | 43 +- ...JurisdictionExperimentalSystemService.java | 34 +- .../jlw/service/UniversityFacultyService.java | 5 + .../jlw/service/UniversitySystemService.java | 5 + .../java/com/ibeetl/jlw/util/BXApiUtil.java | 18 + .../java/com/ibeetl/jlw/util/BxJDBCUtil.java | 3 + .../java/com/ibeetl/jlw/util/HttpUtil.java | 95 ++ .../ibeetl/jlw/util/SubsystemUserUtil.java | 32 + .../com/ibeetl/jlw/web/AccountController.java | 69 +- .../web/ResourcesApplicationController.java | 28 + .../ibeetl/jlw/web/SchoolClassController.java | 18 +- .../com/ibeetl/jlw/web/StudentController.java | 1428 +++++++++-------- .../com/ibeetl/jlw/web/TestController.java | 25 +- web/src/main/resources/application.properties | 5 +- .../resources/sql/jlw/resourcesApplication.md | 10 +- ...sCollegesJurisdictionExperimentalSystem.md | 9 +- 28 files changed, 1410 insertions(+), 750 deletions(-) create mode 100644 admin-core/src/main/java/com/ibeetl/admin/core/util/user/ZYUserInfo.java create mode 100644 web/src/main/java/com/ibeetl/jlw/entity/dto/StuLogicModuleInfoDTO.java create mode 100644 web/src/main/java/com/ibeetl/jlw/entity/dto/StuLogicPictureDTO.java create mode 100644 web/src/main/java/com/ibeetl/jlw/enums/SubsystemName.java create mode 100644 web/src/main/java/com/ibeetl/jlw/util/BXApiUtil.java create mode 100644 web/src/main/java/com/ibeetl/jlw/util/HttpUtil.java create mode 100644 web/src/main/java/com/ibeetl/jlw/util/SubsystemUserUtil.java diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreDictDao.java b/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreDictDao.java index afe16c8f..ef025d7b 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreDictDao.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/dao/CoreDictDao.java @@ -21,7 +21,6 @@ import static com.ibeetl.admin.core.service.CorePlatformService.DICT_CACHE_FIND_ public interface CoreDictDao extends BaseMapper { - /** * 查询某个类型下的字典集合 * @param type 字典类型 diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java index cb785572..574c6991 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreDictService.java @@ -104,6 +104,7 @@ public class CoreDictService extends CoreBaseService { param[i] = param[i].contains("=") && !param[i].contains("find_in_set")?(param[i].replace("=","='").replace(",","',")+ (StringUtils.isBlank(param[i])?"":"'")):param[i]; } } + System.out.println("导致堆栈空间不足-----------------------------------------------------------------------------------"); return dictDao.findALlListByTable(idName,filedName,tableCode,tableName,param); }else { return new ArrayList<>(); diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/util/user/ZYUserInfo.java b/admin-core/src/main/java/com/ibeetl/admin/core/util/user/ZYUserInfo.java new file mode 100644 index 00000000..5f2d25ea --- /dev/null +++ b/admin-core/src/main/java/com/ibeetl/admin/core/util/user/ZYUserInfo.java @@ -0,0 +1,177 @@ +package com.ibeetl.admin.core.util.user; + + +import java.util.Map; + +public class ZYUserInfo { + + private String username; + private String password; + private String name; + private Integer userId; + private Integer roleId; + private Integer schoolId; + private String schoolName; + private Integer classId; + private String className; + private String phone ; + private Long collegeId; + private String collegeName; + private Long majorId; + private String majorName; + + private Long studentId; + private Long teacherId; + + + public Long getStudentId() { + return studentId; + } + + public void setStudentId(Long studentId) { + this.studentId = studentId; + } + + public Long getTeacherId() { + return teacherId; + } + + public void setTeacherId(Long teacherId) { + this.teacherId = teacherId; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public Integer getRoleId() { + return roleId; + } + + public void setRoleId(Integer roleId) { + this.roleId = roleId; + } + + public Integer getSchoolId() { + return schoolId; + } + + public void setSchoolId(Integer schoolId) { + this.schoolId = schoolId; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + public Integer getClassId() { + return classId; + } + + public void setClassId(Integer classId) { + this.classId = classId; + } + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Long getCollegeId() { + return collegeId; + } + + public void setCollegeId(Long collegeId) { + this.collegeId = collegeId; + } + + public String getCollegeName() { + return collegeName; + } + + public void setCollegeName(String collegeName) { + this.collegeName = collegeName; + } + + public Long getMajorId() { + return majorId; + } + + public void setMajorId(Long majorId) { + this.majorId = majorId; + } + + public String getMajorName() { + return majorName; + } + + public void setMajorName(String majorName) { + this.majorName = majorName; + } + + + public ZYUserInfo() { + } + + public ZYUserInfo(Map map) { + this.username = (String) map.get("username"); + this.password = (String) map.get("password"); + this.name = (String) map.get("name"); + this.userId = (Integer) map.get("userid"); + this.roleId = Integer.valueOf(map.get("roleid").toString()) ; + this.schoolId = Integer.valueOf(map.get("schoolid").toString()); + this.schoolName = (String) map.get("schoolname"); + this.classId = Integer.valueOf( map.get("classid").toString()); + this.className = (String) map.get("classname"); + this.phone = (String) map.get("phone"); + this.collegeId = (Long) map.get("collegeid"); + this.collegeName = (String) map.get("collegename"); + this.majorId = (Long) map.get("majorid"); + this.majorName = (String) map.get("majorname"); + this.studentId = map.get("studentid")==null?0L:(Long) map.get("studentid"); + this.teacherId = map.get("teacherid")==null?0L:(Long) map.get("teacherid"); + } +} diff --git a/admin-core/src/main/resources/sql/core/coreUser.md b/admin-core/src/main/resources/sql/core/coreUser.md index e95ccb82..f5231254 100644 --- a/admin-core/src/main/resources/sql/core/coreUser.md +++ b/admin-core/src/main/resources/sql/core/coreUser.md @@ -255,7 +255,7 @@ getUserInfoByUsername === select cu.CODE as username, cu.PASSWORD as password, -cu.NAME as name, +IF(s.student_name IS NULL, t.teacher_name, s.student_name) as name, cu.old_id as userId, if(cur.ROLE_ID = 192, 4, 3) as roleId, uc.old_school_id as schoolId, @@ -266,7 +266,9 @@ IF(s.student_mobile IS NULL, t.teacher_mobile, s.student_mobile) IF(uf.old_id is null, uf1.old_id, uf.old_id) as collegeId, IF(uf.university_faculty_name is null, uf1.university_faculty_name, uf.university_faculty_name) as collegeName, IF(us.old_id is null, us1.old_id, us.old_id) as majorId, -IF(us.university_system_name is null, us1.university_system_name, us.university_system_name) as majorName +IF(us.university_system_name is null, us1.university_system_name, us.university_system_name) as majorName, +s.old_id as studentId, +t.old_id as teacherId from core_user cu join universities_colleges uc on cu.ORG_ID = uc.org_id left join student s on cu.ID = s.user_id diff --git a/web/src/main/java/cn/jlw/Interceptor/InterceptorConfig.java b/web/src/main/java/cn/jlw/Interceptor/InterceptorConfig.java index f06898b1..23281982 100644 --- a/web/src/main/java/cn/jlw/Interceptor/InterceptorConfig.java +++ b/web/src/main/java/cn/jlw/Interceptor/InterceptorConfig.java @@ -112,7 +112,8 @@ public class InterceptorConfig implements WebMvcConfigurer, InitializingBean { "/**/externalApi/**", "/wx", "/test/**", - "/account/**" + "/account/**", + "/api/resourcesApplication/logicPicture.json" // "/upload/**" ) .excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**").order(1); diff --git a/web/src/main/java/com/ibeetl/jlw/dao/ResourcesApplicationDao.java b/web/src/main/java/com/ibeetl/jlw/dao/ResourcesApplicationDao.java index 12032bae..94dd8005 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/ResourcesApplicationDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/ResourcesApplicationDao.java @@ -1,6 +1,8 @@ package com.ibeetl.jlw.dao; import com.ibeetl.jlw.entity.ResourcesApplication; +import com.ibeetl.jlw.entity.dto.StuLogicModuleInfoDTO; +import com.ibeetl.jlw.entity.dto.StuLogicPictureDTO; import com.ibeetl.jlw.web.query.ResourcesApplicationQuery; import org.beetl.sql.core.engine.PageQuery; import org.beetl.sql.mapper.BaseMapper; @@ -9,6 +11,7 @@ import org.beetl.sql.mapper.annotation.Update; import org.springframework.stereotype.Repository; import java.util.List; +import java.util.Map; /** @@ -33,4 +36,7 @@ public interface ResourcesApplicationDao extends BaseMapper queryMyApplicationByConditionQuery(PageQuery query); List getValuesByQuery(ResourcesApplicationQuery query); + + List logicPicture(); + List logicPictureByName(String name); } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesJurisdictionExperimentalSystemDao.java b/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesJurisdictionExperimentalSystemDao.java index 2ec19738..69c77cf3 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesJurisdictionExperimentalSystemDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/UniversitiesCollegesJurisdictionExperimentalSystemDao.java @@ -53,4 +53,6 @@ public interface UniversitiesCollegesJurisdictionExperimentalSystemDao extends B List getNotExpireApply( @Param("orgId") Long orgId , @Param("typeId") String typeIds); ListforexSimulationTradingAuthorizationSchoolDataInterface(); + + List getAllApplicationIdBySchoolId(Long schoolId); } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/entity/dto/StuLogicModuleInfoDTO.java b/web/src/main/java/com/ibeetl/jlw/entity/dto/StuLogicModuleInfoDTO.java new file mode 100644 index 00000000..45c3a50d --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/entity/dto/StuLogicModuleInfoDTO.java @@ -0,0 +1,30 @@ +package com.ibeetl.jlw.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author 17803 + * @date 2024-02-20 9:17 + */ + +@Data +@ApiModel(description = "业务逻辑图模块内容") +public class StuLogicModuleInfoDTO { + + + @ApiModelProperty(value = "业务名") + private String nameInfo; + + @ApiModelProperty(value = "跳转路径") + private String redirectUrl; + + @ApiModelProperty(value = "是否可用") + private Integer authorityInfo; + + @ApiModelProperty(value = "序号") + private Integer order; + + +} diff --git a/web/src/main/java/com/ibeetl/jlw/entity/dto/StuLogicPictureDTO.java b/web/src/main/java/com/ibeetl/jlw/entity/dto/StuLogicPictureDTO.java new file mode 100644 index 00000000..4e704f16 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/entity/dto/StuLogicPictureDTO.java @@ -0,0 +1,27 @@ +package com.ibeetl.jlw.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author 17803 + * @date 2024-02-20 9:08 + */ + +@Data +@ApiModel(description = "业务逻辑图数据") +public class StuLogicPictureDTO { + + @ApiModelProperty(value = "模块名") + private String moduleName; + + @ApiModelProperty(value = "序号(`用来排序`)") + private Integer order; + + @ApiModelProperty(value = "模块内容") + private List moduleInfoDTOList; + +} diff --git a/web/src/main/java/com/ibeetl/jlw/enums/SubsystemName.java b/web/src/main/java/com/ibeetl/jlw/enums/SubsystemName.java new file mode 100644 index 00000000..e3b477a6 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/enums/SubsystemName.java @@ -0,0 +1,47 @@ +package com.ibeetl.jlw.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.beetl.sql.annotation.entity.EnumMapping; +import org.beetl.sql.annotation.entity.EnumValue; + +@Getter +@AllArgsConstructor +@EnumMapping("text") +public enum SubsystemName { + + P2P_NETWORK_LENDING("P2P网络借贷公司"), + ARTIFICIAL_INTELLIGENCE_TRAINING("人工智能实训"), + CROWDFUNDING_COMPANY("众筹公司"), + SUPPLY_CHAIN_FINANCE_COMPANY("供应链金融服务公司"), + INSURANCE_COMPANY("保险公司"), + BLOCKCHAIN_TECHNOLOGY("区块链技术"), + COMMERCIAL_BANK("商业银行"), + POLICY_BANK("政策性银行"), + CREDIT_COOPERATIVE("信用合作社机构"), + FOREIGN_EXCHANGE("外汇"), + BIG_DATA_ANALYSIS_MINING("大数据分析挖掘"), + BIG_DATA_COLLECTION("大数据采集"), + INVESTMENT_BANK("投资银行"), + PAYMENT_CLEARING("支付清算"), + DIGITAL_CURRENCY("数字人民币"), + DIGITAL_ASSETS("数字资产"), + DATA_INFORMATION("数据资讯"), + SMART_TRADING("智能交易"), + SMART_DATA("智能数据"), + SMART_FINANCE("智能理财"), + SECURITIES("证券/期货/基金/信托/资管公司"), + SECURITIES_TRADING("证券交易"), + CSRC("证监会、银保监会、行业协会"), + RISK_MANAGEMENT("风险管理"); + + + + @EnumValue + private String text; + + @Override + public String toString() { + return this.getText(); + } +} diff --git a/web/src/main/java/com/ibeetl/jlw/service/ResourcesApplicationService.java b/web/src/main/java/com/ibeetl/jlw/service/ResourcesApplicationService.java index 6d51958f..3bda8dc8 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/ResourcesApplicationService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/ResourcesApplicationService.java @@ -20,6 +20,8 @@ import com.ibeetl.admin.core.service.CoreBaseService; import com.ibeetl.admin.core.util.PlatformException; import com.ibeetl.jlw.dao.*; import com.ibeetl.jlw.entity.*; +import com.ibeetl.jlw.entity.dto.StuLogicModuleInfoDTO; +import com.ibeetl.jlw.entity.dto.StuLogicPictureDTO; import com.ibeetl.jlw.web.query.ResourcesApplicationQuery; import org.beetl.sql.core.SqlId; import org.beetl.sql.core.engine.PageQuery; @@ -30,10 +32,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.validation.constraints.NotNull; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import static cn.hutool.core.util.ObjectUtil.defaultIfBlank; @@ -454,5 +453,15 @@ public class ResourcesApplicationService extends CoreBaseService logicPicture(){ + List pics = resourcesApplicationDao.logicPicture(); + if(pics!=null&&pics.size()>0){ + for(StuLogicPictureDTO dto:pics){ + dto.setModuleInfoDTOList(resourcesApplicationDao.logicPictureByName(dto.getModuleName())); ; + } + } + return pics; + } + } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/service/SchoolClassService.java b/web/src/main/java/com/ibeetl/jlw/service/SchoolClassService.java index 89d57b66..dcf45015 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/SchoolClassService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/SchoolClassService.java @@ -7,11 +7,15 @@ import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.pinyin.PinyinUtil; import cn.hutool.extra.spring.SpringUtil; +import com.alibaba.fastjson.JSONObject; import com.ibeetl.admin.core.service.CoreBaseService; import com.ibeetl.admin.core.util.PlatformException; import com.ibeetl.jlw.dao.SchoolClassDao; import com.ibeetl.jlw.entity.SchoolClass; import com.ibeetl.jlw.entity.UniversitiesColleges; +import com.ibeetl.jlw.util.BXApiUtil; +import com.ibeetl.jlw.util.BxJDBCUtil; +import com.ibeetl.jlw.util.HttpJsonRequest; import com.ibeetl.jlw.web.query.SchoolClassQuery; import org.beetl.sql.core.SqlId; import org.beetl.sql.core.engine.PageQuery; @@ -206,11 +210,21 @@ public class SchoolClassService extends CoreBaseService { insertSchoolClass.setAddTime(new Date()); insertSchoolClass.setOrgId(orgId); insertSchoolClass.setUserId(userId); - + Integer icibtClassId = BXApiUtil.createBxClass(schoolClass.getClassName(), universitiesColleges.getIcibtSchoolId()); + insertSchoolClass.setIcibtClassId(icibtClassId); insert(insertSchoolClass); + SchoolClass s = new SchoolClass(); + s.setClassId(insertSchoolClass.getClassId()); + s.setOldClassId(insertSchoolClass.getClassId()+1500); + schoolClassDao.updateTemplateById(s); + insertSchoolClass.setOldClassId(s.getOldClassId()); return insertSchoolClass; } + + + + /** * 构建一个确保全局唯一的班级编号 * diff --git a/web/src/main/java/com/ibeetl/jlw/service/StudentAccountAssetAllocationService.java b/web/src/main/java/com/ibeetl/jlw/service/StudentAccountAssetAllocationService.java index 405f7c94..e394518b 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/StudentAccountAssetAllocationService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/StudentAccountAssetAllocationService.java @@ -21,6 +21,7 @@ import com.ibeetl.admin.core.web.JsonReturnCode; import com.ibeetl.jlw.dao.*; import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.enums.AccountTypeEnum; +import com.ibeetl.jlw.util.HttpUtil; import com.ibeetl.jlw.web.query.ResourcesApplicationCourseQuery; import com.ibeetl.jlw.web.query.ResourcesApplicationQuery; import com.ibeetl.jlw.web.query.StudentAccountAssetAllocationQuery; @@ -698,7 +699,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseService>() { }.getType(); @@ -782,7 +783,7 @@ public class StudentAccountAssetAllocationService extends CoreBaseServicequeryByCondition(PageQuery query){ PageQuery ret = universitiesCollegesJurisdictionExperimentalSystemDao.queryByCondition(query); @@ -115,6 +121,22 @@ public class UniversitiesCollegesJurisdictionExperimentalSystemService extends C } if(universitiesCollegesJurisdictionExperimentalSystemList.size()>0){ this.insertBatch(universitiesCollegesJurisdictionExperimentalSystemList); + //子系统添加用户数据 + List> students = studentService.findAllBySchoolId(universitiesCollegesId); + if(null != students && students.size()>0){ + List userInfos = new ArrayList<>(); + for(Map student : students){ + Map map = coreUserService.getUserInfoByUsername(String.valueOf(student.get("studentNo"))); + ZYUserInfo info = new ZYUserInfo(map); + userInfos.add(info); + } + List applications = getAllApplicationIdBySchoolId(universitiesCollegesId); + try { + SubsystemUserUtil.subsystemUserCreate(userInfos,applications); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } //应用授权后开通资金账户权限 studentAccountAssetAllocationService.updateApplicationAuthority(uc.getOrgId()); } @@ -192,4 +214,8 @@ public class UniversitiesCollegesJurisdictionExperimentalSystemService extends C public List forexSimulationTradingAuthorizationSchoolDataInterface(){ return universitiesCollegesJurisdictionExperimentalSystemDao.forexSimulationTradingAuthorizationSchoolDataInterface(); } + + public List getAllApplicationIdBySchoolId(Long schoolId){ + return universitiesCollegesJurisdictionExperimentalSystemDao.getAllApplicationIdBySchoolId(schoolId); + } } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/service/UniversityFacultyService.java b/web/src/main/java/com/ibeetl/jlw/service/UniversityFacultyService.java index ee2b0ec0..fe2eae7e 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/UniversityFacultyService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/UniversityFacultyService.java @@ -231,6 +231,11 @@ public class UniversityFacultyService extends CoreBaseService faculty.setOrgId(orgId); insert(faculty); + UniversityFaculty f = new UniversityFaculty(); + f.setUniversityFacultyId(faculty.getUniversityFacultyId()); + f.setOldId(f.getUniversityFacultyId()+500); + universityFacultyDao.updateTemplateById(f); + faculty.setOldId(f.getOldId()); return faculty; } diff --git a/web/src/main/java/com/ibeetl/jlw/service/UniversitySystemService.java b/web/src/main/java/com/ibeetl/jlw/service/UniversitySystemService.java index c154d56b..3fd74c35 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/UniversitySystemService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/UniversitySystemService.java @@ -203,6 +203,11 @@ public class UniversitySystemService extends CoreBaseService{ system.setOrgId(orgId); insert(system); + UniversitySystem s = new UniversitySystem(); + s.setUniversitySystemId(system.getUniversitySystemId()); + s.setOldId(system.getUniversitySystemId()+500); + universitySystemDao.updateTemplateById(s); + system.setOldId(s.getOldId()); return system; } diff --git a/web/src/main/java/com/ibeetl/jlw/util/BXApiUtil.java b/web/src/main/java/com/ibeetl/jlw/util/BXApiUtil.java new file mode 100644 index 00000000..d44d116d --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/util/BXApiUtil.java @@ -0,0 +1,18 @@ +package com.ibeetl.jlw.util; + +import com.alibaba.fastjson.JSONObject; + +public class BXApiUtil { + + + public static int createBxClass(String className, Integer icibtSchoolId) { + String request = HttpJsonRequest.sendPostRequest("http://120.79.161.177:8183/SignIn/AddClass", null, "{'ClassName':'" + className + "','SchoolId': " + icibtSchoolId + "}", "application/json"); + JSONObject jsonObject = JSONObject.parseObject(request); + String schoolId = jsonObject.getString("schoolClassId"); + if (schoolId != null) { + return Integer.parseInt(schoolId); + } else { + return 0; + } + } +} diff --git a/web/src/main/java/com/ibeetl/jlw/util/BxJDBCUtil.java b/web/src/main/java/com/ibeetl/jlw/util/BxJDBCUtil.java index 206302d1..50712a68 100644 --- a/web/src/main/java/com/ibeetl/jlw/util/BxJDBCUtil.java +++ b/web/src/main/java/com/ibeetl/jlw/util/BxJDBCUtil.java @@ -37,4 +37,7 @@ public class BxJDBCUtil { } } } + + + } diff --git a/web/src/main/java/com/ibeetl/jlw/util/HttpUtil.java b/web/src/main/java/com/ibeetl/jlw/util/HttpUtil.java new file mode 100644 index 00000000..de5b6f72 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/util/HttpUtil.java @@ -0,0 +1,95 @@ +package com.ibeetl.jlw.util; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; + +public class HttpUtil { + + public static String sendPostRequest(String url, String postData) { + try { + URL apiUrl = new URL(url); + + HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection(); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + connection.setRequestProperty("Content-Length", String.valueOf(postData.length())); + connection.setDoOutput(true); + + try (OutputStream os = connection.getOutputStream()) { + byte[] input = postData.getBytes("UTF-8"); + os.write(input, 0, input.length); + } + + int responseCode = connection.getResponseCode(); + StringBuilder response = new StringBuilder(); + if (responseCode == HttpURLConnection.HTTP_OK) { + try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { + String inputLine; + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + } + } else { + try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getErrorStream()))) { + String inputLine; + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + } + System.out.println("接口请求错误:" + responseCode); + } + + return response.toString(); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } + + + public static String sendPostRequest(String url, String postData,String contentType) { + try { + URL apiUrl = new URL(url); + + HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection(); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Type", contentType); + connection.setRequestProperty("Content-Length", String.valueOf(postData.length())); + connection.setDoOutput(true); + + try (OutputStream os = connection.getOutputStream()) { + byte[] input = postData.getBytes("UTF-8"); + os.write(input, 0, input.length); + } + + int responseCode = connection.getResponseCode(); + StringBuilder response = new StringBuilder(); + if (responseCode == HttpURLConnection.HTTP_OK) { + try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { + String inputLine; + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + } + } else { + try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getErrorStream()))) { + String inputLine; + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + } + System.out.println("接口请求错误:" + responseCode); + } + + return response.toString(); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } +} diff --git a/web/src/main/java/com/ibeetl/jlw/util/SubsystemUserUtil.java b/web/src/main/java/com/ibeetl/jlw/util/SubsystemUserUtil.java new file mode 100644 index 00000000..75fbc447 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/util/SubsystemUserUtil.java @@ -0,0 +1,32 @@ +package com.ibeetl.jlw.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ibeetl.admin.core.util.user.ZYUserInfo; +import com.ibeetl.jlw.enums.SubsystemName; +import org.springframework.beans.factory.annotation.Value; + +import java.util.List; + +public class SubsystemUserUtil { + @Value("${PEVC_USER_INSERT_API_URL}") + private static String pevcUserInsertApiUrl; + @Value("${MNJY_USER_INSERT_API_URL}") + private static String mnjyUserInsertApiUrl; + + public static void subsystemUserCreate(List zyUserInfos, List applications) throws JsonProcessingException { + if (zyUserInfos != null && zyUserInfos.size() > 0) { + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(zyUserInfos); + if (applications.contains(SubsystemName.INVESTMENT_BANK.getText())) { + //PEVC系统新增用户信息 + HttpUtil.sendPostRequest(pevcUserInsertApiUrl, json, "application/json"); + } + if (applications.contains(SubsystemName.SECURITIES_TRADING.getText())) { + //MNJY系统新增用户信息 + HttpUtil.sendPostRequest(mnjyUserInsertApiUrl, json, "application/json"); + } + } + + } +} diff --git a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java index 38518782..ae7f0272 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/AccountController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/AccountController.java @@ -5,11 +5,14 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.service.CoreUserService; +import com.ibeetl.admin.core.util.user.ZYUserInfo; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.admin.core.web.query.CustomFilterByLcUser; import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.enums.AccountTypeEnum; import com.ibeetl.jlw.service.*; +import com.ibeetl.jlw.util.HttpJsonRequest; +import com.ibeetl.jlw.util.HttpUtil; import com.ibeetl.jlw.web.query.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -18,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; +import java.security.MessageDigest; import java.sql.*; import java.util.ArrayList; import java.util.HashMap; @@ -210,7 +214,7 @@ public class AccountController { if (applicationId == -1) { allocationQuery.setApplicationId(Long.valueOf(-1)); allocationQuery.setName(AccountTypeEnum.BANK_ACCOUNT); - } else if (applicationId == 4) { + } else if (applicationId == 4) { allocationQuery.setApplicationId(Long.valueOf(4)); allocationQuery.setName(AccountTypeEnum.P2P_ACCOUNT); StudentAccountCrowdfundingSystem info = studentAccountCrowdfundingSystemService.getInfo(student.getStudentId()); @@ -1345,8 +1349,69 @@ public class AccountController { @ApiOperation("根据学校id查询用户数据") @GetMapping("getUsersBySchoolId.json") - public JsonResult>> getUsersBySchoolId(Long schoolId){ + public JsonResult>> getUsersBySchoolId(Long schoolId) { return JsonResult.success(userService.getUsersBySchoolId(schoolId)); } + + @ApiOperation("创建保险用户") + @PostMapping("createInsuranceUser") + public void createInsuranceUser(Long classId, Integer icibtClassId) { + StudentQuery query = new StudentQuery(); + query.setClassId(classId); + List students = studentService.getValuesByQuery(query); + for (Student s : students) { + createBxStudent(69, icibtClassId, s.getStudentSn(), s.getStudentName(), 1); + } + } + + public void createBxStudent(Integer icibtSchoolId, Integer icibtClassId, String studentNo, String name, Integer sex) { + String PostData = "{'LoginName':'" + studentNo + "','Password':'" + + encryptToMD5("123qwe") + "','Name':'" + name + "','Sex':'" + + sex + "','SchoolNumber':'" + studentNo + "','RoleId':'" + 4 + "','SchoolId':'" + + icibtSchoolId + "','SchoolClassId':[" + icibtClassId + "]}"; + String request = HttpJsonRequest.sendPostRequest("http://120.79.161.177:8183/SignIn/AddUser", null, PostData, "application/json"); + } + + 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; + } + } + + @ApiOperation("测试子系统用户传输") + + @PostMapping("test1") + public void test() throws JsonProcessingException { + + + Map map = coreUserService.getUserInfoByUsername("tzs001"); + Map map1 = coreUserService.getUserInfoByUsername("tzs006"); + ZYUserInfo info = new ZYUserInfo(map); + ZYUserInfo info1 = new ZYUserInfo(map1); + List userInfoList = new ArrayList<>(); + userInfoList.add(info); + userInfoList.add(info1); + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(userInfoList); +// HttpUtil.sendPostRequest("http://localhost:61814/account/saveNewUsersFromZhiyunPlatform", json,"application/json"); + HttpUtil.sendPostRequest("http://localhost:61759/account/saveNewUsersFromZhiyunPlatform", json,"application/json"); +// String request = HttpUtil.sendPostRequest("http://118.31.7.2:8800/account/checkOrCreateForexSimulationUser", json, "application/json"); + int a = 0; + } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/ResourcesApplicationController.java b/web/src/main/java/com/ibeetl/jlw/web/ResourcesApplicationController.java index 354ad9b6..f59355fc 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/ResourcesApplicationController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/ResourcesApplicationController.java @@ -11,16 +11,20 @@ import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.jlw.entity.ResourcesApplication; import com.ibeetl.jlw.entity.Student; import com.ibeetl.jlw.entity.Teacher; +import com.ibeetl.jlw.entity.dto.StuLogicModuleInfoDTO; +import com.ibeetl.jlw.entity.dto.StuLogicPictureDTO; import com.ibeetl.jlw.service.LoginTodoService; import com.ibeetl.jlw.service.ResourcesApplicationService; import com.ibeetl.jlw.service.SysLogService; import com.ibeetl.jlw.web.query.ResourcesApplicationQuery; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.beetl.sql.core.engine.PageQuery; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -221,4 +225,28 @@ public class ResourcesApplicationController{ public JsonResult getLoginTodo() { return JsonResult.success(loginTodoService.buildByCurrentLoginUser()); } + + + @ApiOperation("业务逻辑图详情") + @ResponseBody + @GetMapping(API + "/logicPicture.json") + public JsonResult> logicPicture(@SCoreUser CoreUser coreUser){ + + List logicPictureDTOList = resourcesApplicationService.logicPicture(); + String token = resourcesApplicationService.getKeyByCurrentUser(118L, "zy_szjj_c1fqkcgekg1icu7ddp8qiho0u"); + if (logicPictureDTOList!=null&&logicPictureDTOList.size()>0) + { + for(StuLogicPictureDTO d:logicPictureDTOList){ + for(StuLogicModuleInfoDTO dto:d.getModuleInfoDTOList()){ + StringBuffer sb = new StringBuffer(); + sb.append(dto.getRedirectUrl()); + sb.append("?token="); + sb.append(token); + dto.setRedirectUrl(sb.toString()); + } + } + return JsonResult.success(logicPictureDTOList); + } + return JsonResult.failMessage("获取失败"); + } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/SchoolClassController.java b/web/src/main/java/com/ibeetl/jlw/web/SchoolClassController.java index 420a0091..cab1be13 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/SchoolClassController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/SchoolClassController.java @@ -23,6 +23,7 @@ import com.ibeetl.jlw.entity.dto.SchoolClassBatchImportDTO; import com.ibeetl.jlw.service.SchoolClassService; import com.ibeetl.jlw.service.UniversitiesCollegesService; import com.ibeetl.jlw.service.UniversitySystemService; +import com.ibeetl.jlw.util.BXApiUtil; import com.ibeetl.jlw.util.HttpJsonRequest; import com.ibeetl.jlw.web.query.SchoolClassQuery; import io.swagger.annotations.Api; @@ -215,7 +216,7 @@ public class SchoolClassController extends BaseController { if (StrUtil.isNotBlank(schoolClass.getClassSn())) { schoolClassService.validateClassSnListIsExistsThrow(Collections.singletonList(schoolClass), universitiesColleges.getOrgId().toString()); } - icibtClassId = createBxClass(schoolClass.getClassName(), universitiesColleges.getIcibtSchoolId()); + icibtClassId = BXApiUtil.createBxClass(schoolClass.getClassName(), universitiesColleges.getIcibtSchoolId()); } else { UniversitiesColleges universitiesColleges = new UniversitiesColleges(); universitiesColleges.setOrgId(coreUser.getOrgId()); @@ -226,13 +227,11 @@ public class SchoolClassController extends BaseController { schoolClass.setClassSn(uniqueClassSn); schoolClass.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId()); schoolClass.setOrgId(universitiesColleges.getOrgId()); - icibtClassId = createBxClass(schoolClass.getClassName(), universitiesColleges.getIcibtSchoolId()); + icibtClassId = BXApiUtil.createBxClass(schoolClass.getClassName(), universitiesColleges.getIcibtSchoolId()); } } schoolClassService.save(schoolClass); - - SchoolClass newClass = new SchoolClass(); newClass.setIcibtClassId(icibtClassId); newClass.setClassId(schoolClass.getClassId()); @@ -244,16 +243,7 @@ public class SchoolClassController extends BaseController { } - private int createBxClass(String className, Integer icibtSchoolId) { - String request = HttpJsonRequest.sendPostRequest("http://120.79.161.177:8183/SignIn/AddClass", null, "{'ClassName':'" + className + "','SchoolId': " + icibtSchoolId + "}", "application/json"); - JSONObject jsonObject = JSONObject.parseObject(request); - String schoolId = jsonObject.getString("schoolClassId"); - if (schoolId != null) { - return Integer.parseInt(schoolId); - } else { - return 0; - } - } + @PostMapping(MODEL + "/edit.json") @Function("schoolClass.edit") @ResponseBody diff --git a/web/src/main/java/com/ibeetl/jlw/web/StudentController.java b/web/src/main/java/com/ibeetl/jlw/web/StudentController.java index e5283c40..dc892090 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/StudentController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/StudentController.java @@ -13,6 +13,8 @@ import cn.jlw.util.excel.listener.MyValidateExcelCellDataListener; import cn.jlw.validate.ValidateConfig; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.ibeetl.admin.core.annotation.Function; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.file.FileService; @@ -23,6 +25,7 @@ import com.ibeetl.admin.core.util.HttpRequestLocal; import com.ibeetl.admin.core.util.DateUtil; import com.ibeetl.admin.core.util.PlatformException; import com.ibeetl.admin.core.util.TimeTool; +import com.ibeetl.admin.core.util.user.ZYUserInfo; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.jlw.conf.KeyExpiredListener; import com.ibeetl.jlw.dao.SchoolClassDao; @@ -32,7 +35,11 @@ import com.ibeetl.jlw.entity.dto.StudentBatchImportUniAdminDTO; import com.ibeetl.jlw.entity.vo.StudentLogAnalysisVO; import com.ibeetl.jlw.entity.vo.StudentLoginLogVO; import com.ibeetl.jlw.entity.vo.StudentUseLogVO; +import com.ibeetl.jlw.enums.AccountTypeEnum; +import com.ibeetl.jlw.enums.SubsystemName; import com.ibeetl.jlw.service.*; +import com.ibeetl.jlw.util.HttpUtil; +import com.ibeetl.jlw.util.SubsystemUserUtil; import com.ibeetl.jlw.web.query.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -46,6 +53,7 @@ import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.xssf.usermodel.*; import org.beetl.sql.core.engine.PageQuery; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; @@ -87,59 +95,92 @@ import static java.util.function.UnaryOperator.identity; @Controller @Api(tags = {"学生管理"}) -public class StudentController extends BaseController{ +public class StudentController extends BaseController { private final Log log = LogFactory.getLog(this.getClass()); private static final String MODEL = "/jlw/student"; private static final String API = "/api/student"; - @Autowired private ResourcesApplicationService resourcesApplicationService; - - @Autowired private StudentService studentService; + @Autowired + private ResourcesApplicationService resourcesApplicationService; - @Autowired private TeacherService teacherService; + @Autowired + private StudentService studentService; - @Autowired private UniversitiesCollegesService universitiesCollegesService; + @Autowired + private TeacherService teacherService; - @Autowired private UniversitySystemService universitySystemService; + @Autowired + private UniversitiesCollegesService universitiesCollegesService; - @Autowired private SchoolClassService schoolClassService; + @Autowired + private UniversitySystemService universitySystemService; - @Autowired private StudentDirectMessagesService studentDirectMessagesService; + @Autowired + private SchoolClassService schoolClassService; - @Autowired private TokenService tokenService; + @Autowired + private StudentDirectMessagesService studentDirectMessagesService; - @Autowired private CourseInfoService courseInfoService; + @Autowired + private TokenService tokenService; + @Autowired + private UniversitiesCollegesJurisdictionExperimentalSystemService universitiesCollegesJurisdictionExperimentalSystemService; + @Autowired + private CourseInfoService courseInfoService; - @Autowired private WrongQuestionService wrongQuestionService; + @Autowired + private WrongQuestionService wrongQuestionService; - @Autowired private CompetitionService competitionService; - @Autowired private CompetitionStudentsService competitionStudentsService; - @Autowired private CompetitionTaskOneQuestionService competitionTaskOneQuestionService; - @Autowired private CompetitionTaskSecondQuestionService competitionTaskSecondQuestionService; - @Autowired private CompetitionTaskSecondQuestionStepService competitionTaskSecondQuestionStepService; + @Autowired + private CompetitionService competitionService; + @Autowired + private CompetitionStudentsService competitionStudentsService; + @Autowired + private CompetitionTaskOneQuestionService competitionTaskOneQuestionService; + @Autowired + private CompetitionTaskSecondQuestionService competitionTaskSecondQuestionService; + @Autowired + private CompetitionTaskSecondQuestionStepService competitionTaskSecondQuestionStepService; - @Autowired private ExamService examService; - @Autowired private ExamStudentsService examStudentsService; - @Autowired private ExamTaskOneQuestionService examTaskOneQuestionService; - @Autowired private ExamTaskSecondQuestionService examTaskSecondQuestionService; - @Autowired private ExamTaskSecondQuestionStepService examTaskSecondQuestionStepService; - @Autowired private ExamTaskThreeQuestionService examTaskThreeQuestionService; - @Autowired private ExamTaskThreeQuestionStepService examTaskThreeQuestionStepService; + @Autowired + private ExamService examService; + @Autowired + private ExamStudentsService examStudentsService; + @Autowired + private ExamTaskOneQuestionService examTaskOneQuestionService; + @Autowired + private ExamTaskSecondQuestionService examTaskSecondQuestionService; + @Autowired + private ExamTaskSecondQuestionStepService examTaskSecondQuestionStepService; + @Autowired + private ExamTaskThreeQuestionService examTaskThreeQuestionService; + @Autowired + private ExamTaskThreeQuestionStepService examTaskThreeQuestionStepService; - @Autowired private ResourcesQuestionService resourcesQuestionService; - @Autowired private ResourcesCompetitionService resourcesCompetitionService; - @Autowired private ResourcesCompetitionStepService resourcesCompetitionStepService; - @Autowired private ResourcesTrainingService resourcesTrainingService; - @Autowired private ResourcesTrainingStepService resourcesTrainingStepService; + @Autowired + private ResourcesQuestionService resourcesQuestionService; + @Autowired + private ResourcesCompetitionService resourcesCompetitionService; + @Autowired + private ResourcesCompetitionStepService resourcesCompetitionStepService; + @Autowired + private ResourcesTrainingService resourcesTrainingService; + @Autowired + private ResourcesTrainingStepService resourcesTrainingStepService; - @Autowired private ResourcesInfoService resourcesInfoService; + @Autowired + private ResourcesInfoService resourcesInfoService; - @Autowired private CorePlatformService platformService; + @Autowired + private CorePlatformService platformService; - @Autowired private CoreUserService coreUserService; - @Autowired private SysLogService sysLogService; - @Autowired private SchoolClassDao schoolClassDao; + @Autowired + private CoreUserService coreUserService; + @Autowired + private SysLogService sysLogService; + @Autowired + private SchoolClassDao schoolClassDao; @Autowired FileService fileService; @@ -154,40 +195,40 @@ public class StudentController extends BaseController{ /** * 学生登录 * 账号密码 - * + *

* 登陆 */ @PostMapping(API + "/login.do") @ResponseBody @ApiOperation("学生登录") public JsonResult login(@Validated(ValidateConfig.MEMBER_MOBILE.class) Student student, BindingResult result) { - if(result.hasErrors()){ + if (result.hasErrors()) { return JsonResult.failMessage(result); - }else { - Map map = new HashMap<>(); + } else { + Map map = new HashMap<>(); String account = student.getStudentSn(); String password = student.getStudentPassword(); - if(StringUtils.isBlank(password)){ + if (StringUtils.isBlank(password)) { return JsonResult.failMessage("请输入密码"); } Student s = studentService.getByAccount(account); - if(null != s){ - if(s.getStudentStatus() != 1) { + if (null != s) { + if (s.getStudentStatus() != 1) { return JsonResult.failMessage("账号被删除"); - }else { - if(StringUtils.isBlank(s.getStudentPassword())){ + } else { + if (StringUtils.isBlank(s.getStudentPassword())) { return JsonResult.failMessage("未设置密码,请用短信验证码登陆"); - }else { + } else { //if(!s.getStudentPassword().equals(ToolUtils.getMd5Hex(password))){ - if(!s.getStudentPassword().equals(password)){ + if (!s.getStudentPassword().equals(password)) { return JsonResult.failMessage("密码错误,请重新输入或使用短信验证码登陆"); - }else { + } else { //登陆 map = getMap(s, tokenService); } } } - }else { + } else { return JsonResult.failMessage("该用户不存在,请用短信验证码登陆"); } return JsonResult.success(map); @@ -199,22 +240,22 @@ public class StudentController extends BaseController{ @ResponseBody @ApiOperation("学生端首页所需数据") public JsonResult indexInfo(@TStudent Student student) { - if(null != student){ + if (null != student) { - Map map = new HashMap<>(); + Map map = new HashMap<>(); UniversitiesColleges universitiesColleges = universitiesCollegesService.getByOrgId(student.getOrgId()); //院校名称 - map.put("universitiesCollegesName",universitiesColleges.getUniversitiesCollegesName()); + map.put("universitiesCollegesName", universitiesColleges.getUniversitiesCollegesName()); //banner - map.put("banner",null); + map.put("banner", null); //子系统logo - map.put("subsystemLogo",null); + map.put("subsystemLogo", null); //网站底部 - map.put("subsystemBottomBar",null); - UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther(); - if(null != uSystem){ - map.put("subsystemLogo",StringUtils.isNotBlank(uSystem.getSubsystemLogo())?uSystem.getSubsystemLogo():null); //如果是空则用这个子系统默认的 - map.put("subsystemBottomBar",uSystem.getSubsystemBottomBar()); + map.put("subsystemBottomBar", null); + UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem) platformService.getOther(); + if (null != uSystem) { + map.put("subsystemLogo", StringUtils.isNotBlank(uSystem.getSubsystemLogo()) ? uSystem.getSubsystemLogo() : null); //如果是空则用这个子系统默认的 + map.put("subsystemBottomBar", uSystem.getSubsystemBottomBar()); } //我的竞赛成绩 @@ -232,7 +273,7 @@ public class StudentController extends BaseController{ List competitionTeamInfoList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery); competitionStudentsList.addAll(competitionTeamInfoList); - map.put("competitionStudentsList",competitionStudentsList); + map.put("competitionStudentsList", competitionStudentsList); //我的考试成绩 ExamStudentsQuery examStudentsQuery = new ExamStudentsQuery(); @@ -242,7 +283,7 @@ public class StudentController extends BaseController{ examStudentsQuery.setOrgId(student.getOrgId()); List examStudentsList = examStudentsService.getExamInfo(examStudentsQuery); - map.put("examStudentsList",examStudentsList); + map.put("examStudentsList", examStudentsList); //我的竞赛任务 CompetitionQuery competitionQuery = new CompetitionQuery(); @@ -251,7 +292,7 @@ public class StudentController extends BaseController{ competitionQuery.setCompetitionStatus(1); List competitionList = competitionService.getValuesByQuery(competitionQuery); - map.put("competitionList",competitionList); + map.put("competitionList", competitionList); //我的考试任务 ExamQuery examQuery = new ExamQuery(); @@ -260,10 +301,10 @@ public class StudentController extends BaseController{ examQuery.setExamStatus(1); List examList = examService.getValuesByQuery(examQuery); - map.put("examList",examList); + map.put("examList", examList); return JsonResult.success(map); - }else { + } else { return JsonResult.failMessage("请登录后再操作"); } } @@ -272,19 +313,19 @@ public class StudentController extends BaseController{ @PostMapping(API + "/allCompetitionList.do") @ResponseBody @ApiOperation("全部大赛列表") - public JsonResult allCompetitionList(CompetitionQuery condition,@TStudent Student student) { - if(null == student){ + public JsonResult allCompetitionList(CompetitionQuery condition, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } condition.setOrgId(student.getOrgId()); - UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther(); - if(null != uSystem && ((Integer)1).equals(uSystem.getType())){ + UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem) platformService.getOther(); + if (null != uSystem && ((Integer) 1).equals(uSystem.getType())) { condition.setResourcesApplicationId(uSystem.getTypeId()); } - if(null == condition.getCompetitionStatus() && StringUtils.isBlank(condition.getCompetitionDetailedStatuses())){ + if (null == condition.getCompetitionStatus() && StringUtils.isBlank(condition.getCompetitionDetailedStatuses())) { condition.setCompetitionStatus(1); } @@ -297,20 +338,20 @@ public class StudentController extends BaseController{ @PostMapping(API + "/myCompetitionList.do") @ResponseBody @ApiOperation("我的大赛列表") - public JsonResult myCompetitionList(CompetitionQuery condition,@TStudent Student student) { - if(null == student){ + public JsonResult myCompetitionList(CompetitionQuery condition, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } condition.setStudentId(student.getStudentId()); condition.setOrgId(student.getOrgId()); - UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther(); - if(null != uSystem && ((Integer)1).equals(uSystem.getType())){ + UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem) platformService.getOther(); + if (null != uSystem && ((Integer) 1).equals(uSystem.getType())) { condition.setResourcesApplicationId(uSystem.getTypeId()); } - if(null == condition.getCompetitionStatus() && StringUtils.isBlank(condition.getCompetitionDetailedStatuses())){ + if (null == condition.getCompetitionStatus() && StringUtils.isBlank(condition.getCompetitionDetailedStatuses())) { condition.setCompetitionStatus(1); } @@ -323,9 +364,9 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getCompetitionInfo.do") @ResponseBody @ApiOperation("大赛详情 (除了排行榜、参赛学员(或团队))") - public JsonResult getCompetitionInfo(Long competitionId,Integer part,@TStudent Student student) { + public JsonResult getCompetitionInfo(Long competitionId, Integer part, @TStudent Student student) { //part 代表部分值 1大赛概况 2大赛任务 3排行榜 4大赛答辩 5参赛学员(参赛团队) 6获奖名单 7大赛动态 8常见问题 - Competition competition = competitionService.queryInfo(competitionId,student.getStudentId(),part); + Competition competition = competitionService.queryInfo(competitionId, student.getStudentId(), part); return JsonResult.success(competition); } @@ -336,22 +377,22 @@ public class StudentController extends BaseController{ @ApiOperation("排行榜") public JsonResult competitionRankingList(CompetitionStudentsQuery condition) { Competition competition = competitionService.getById(condition.getCompetitionId()); - if(null != competition){ - if(((Integer)1).equals(competition.getCompetitionType())){ + if (null != competition) { + if (((Integer) 1).equals(competition.getCompetitionType())) { PageQuery page = condition.getPageQuery(); competitionStudentsService.queryPersonalByCondition(page); return JsonResult.success(page); - }else if(((Integer)2).equals(competition.getCompetitionType())){ + } else if (((Integer) 2).equals(competition.getCompetitionType())) { //团队赛排行榜类型(1团队赛排行 2团队赛个人排行 3团队赛答辩排行) - if(((Integer)1).equals(condition.getCompetitionRankingType())){ + if (((Integer) 1).equals(condition.getCompetitionRankingType())) { PageQuery page = condition.getPageQuery(); competitionStudentsService.queryTeamByCondition(page); return JsonResult.success(page); - }else if(((Integer)2).equals(condition.getCompetitionRankingType())){ + } else if (((Integer) 2).equals(condition.getCompetitionRankingType())) { PageQuery page = condition.getPageQuery(); competitionStudentsService.queryTeamPersonalByCondition(page); return JsonResult.success(page); - }else if(((Integer)3).equals(condition.getCompetitionRankingType())){ + } else if (((Integer) 3).equals(condition.getCompetitionRankingType())) { PageQuery page = condition.getPageQuery(); competitionStudentsService.queryTeamDefenceByCondition(page); return JsonResult.success(page); @@ -367,12 +408,12 @@ public class StudentController extends BaseController{ @ApiOperation("参赛学员(或团队)") public JsonResult competitionStudentsList(CompetitionStudentsQuery condition) { Competition competition = competitionService.getById(condition.getCompetitionId()); - if(null != competition){ - if(((Integer)1).equals(competition.getCompetitionType())){ + if (null != competition) { + if (((Integer) 1).equals(competition.getCompetitionType())) { PageQuery page = condition.getPageQuery(); competitionStudentsService.queryPersonalByCondition(page); return JsonResult.success(page); - }else if(((Integer)2).equals(competition.getCompetitionType())){ + } else if (((Integer) 2).equals(competition.getCompetitionType())) { PageQuery page = condition.getPageQuery(); competitionStudentsService.queryTeamByCondition(page); return JsonResult.success(page); @@ -385,11 +426,11 @@ public class StudentController extends BaseController{ @PostMapping(API + "/classStudentsList.do") @ResponseBody @ApiOperation("同班同学") - public JsonResult classStudentsList(StudentQuery condition,@TStudent Student student) { - if(null == condition.getCompetitionId()){ + public JsonResult classStudentsList(StudentQuery condition, @TStudent Student student) { + if (null == condition.getCompetitionId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } condition.setClassId(student.getClassId()); @@ -411,22 +452,22 @@ public class StudentController extends BaseController{ @PostMapping(API + "/enroll.do") @ResponseBody @ApiOperation("自己报名") - public JsonResult enroll(Long competitionId,String teamName,@TStudent Student student) { + public JsonResult enroll(Long competitionId, String teamName, @TStudent Student student) { - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } Competition competition = competitionService.getById(competitionId); - if(StringUtils.isBlank(competition.getClassIds())){ + if (StringUtils.isBlank(competition.getClassIds())) { return JsonResult.failMessage("不允许自主报名"); } - if(!ToolUtils.findInSet(competition.getClassIds(),student.getClassId())){ + if (!ToolUtils.findInSet(competition.getClassIds(), student.getClassId())) { return JsonResult.failMessage("不在可参赛的班级内"); } - if(ToolUtils.findInSet(competition.getExcludedStudentIds(),student.getStudentId())){ + if (ToolUtils.findInSet(competition.getExcludedStudentIds(), student.getStudentId())) { return JsonResult.failMessage("不在可参赛的学员内"); } @@ -441,23 +482,23 @@ public class StudentController extends BaseController{ @PostMapping(API + "/inviteToCompetition.do") @ResponseBody @ApiOperation("邀请报名") - public JsonResult inviteToCompetition(Long competitionId,Long studentId,@TStudent Student student) { + public JsonResult inviteToCompetition(Long competitionId, Long studentId, @TStudent Student student) { - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } Competition competition = competitionService.getById(competitionId); - if(StringUtils.isBlank(competition.getClassIds())){ + if (StringUtils.isBlank(competition.getClassIds())) { return JsonResult.failMessage("不允许自主报名"); } Student s = studentService.queryById(studentId); - if(!ToolUtils.findInSet(competition.getClassIds(),s.getClassId())){ + if (!ToolUtils.findInSet(competition.getClassIds(), s.getClassId())) { return JsonResult.failMessage("不在可参赛的班级内"); } - if(ToolUtils.findInSet(competition.getExcludedStudentIds(),studentId)){ + if (ToolUtils.findInSet(competition.getExcludedStudentIds(), studentId)) { return JsonResult.failMessage("不在可参赛的学员内"); } @@ -476,23 +517,23 @@ public class StudentController extends BaseController{ @PostMapping(API + "/applyTeam.do") @ResponseBody @ApiOperation("申请入队") - public JsonResult applyTeam(Long competitionStudentsId,@TStudent Student student) { + public JsonResult applyTeam(Long competitionStudentsId, @TStudent Student student) { - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } CompetitionStudents competitionStudents = competitionStudentsService.queryById(competitionStudentsId); Competition competition = competitionService.getById(competitionStudents.getCompetitionId()); - if(StringUtils.isBlank(competition.getClassIds())){ + if (StringUtils.isBlank(competition.getClassIds())) { return JsonResult.failMessage("不允许自主报名"); } - if(!ToolUtils.findInSet(competition.getClassIds(),student.getClassId())){ + if (!ToolUtils.findInSet(competition.getClassIds(), student.getClassId())) { return JsonResult.failMessage("不在可参赛的班级内"); } - if(ToolUtils.findInSet(competition.getExcludedStudentIds(),student.getStudentId())){ + if (ToolUtils.findInSet(competition.getExcludedStudentIds(), student.getStudentId())) { return JsonResult.failMessage("不在可参赛的学员内"); } @@ -501,7 +542,7 @@ public class StudentController extends BaseController{ cs.setCompetitionId(competition.getCompetitionId()); cs.setStudentsId(student.getStudentId()); List csList = competitionStudentsService.getValues(cs); - if(null != csList && csList.size()>0){ + if (null != csList && csList.size() > 0) { return JsonResult.failMessage("申请失败,已参赛"); } @@ -522,8 +563,8 @@ public class StudentController extends BaseController{ @PostMapping(API + "/send.do") @ResponseBody @ApiOperation("聊一聊") - public JsonResult send(StudentDirectMessagesQuery studentDirectMessagesQuery,@TStudent Student student) { - if(null == student){ + public JsonResult send(StudentDirectMessagesQuery studentDirectMessagesQuery, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } @@ -542,11 +583,11 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getCT1QuestionMap.do") @ResponseBody @ApiOperation("大赛任务一") - public JsonResult getCT1QuestionMap(CompetitionTaskOneQuestionQuery competitionTaskOneQuestionQuery,@TStudent Student student){ - if(null == competitionTaskOneQuestionQuery.getCompetitionId()){ + public JsonResult getCT1QuestionMap(CompetitionTaskOneQuestionQuery competitionTaskOneQuestionQuery, @TStudent Student student) { + if (null == competitionTaskOneQuestionQuery.getCompetitionId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } @@ -555,28 +596,28 @@ public class StudentController extends BaseController{ Competition competition = competitionService.getById(competitionTaskOneQuestionQuery.getCompetitionId()); //如果是团队赛判断是否符合团队赛进入条件 - if(((Integer)1).equals(competition.getCompetitionType())){//大赛类型:1:个人 2:团队 - competitionService.createPaper(competitionTaskOneQuestionQuery.getCompetitionId(),student.getStudentId());//生成试卷 - }else if(((Integer)2).equals(competition.getCompetitionType())){ + if (((Integer) 1).equals(competition.getCompetitionType())) {//大赛类型:1:个人 2:团队 + competitionService.createPaper(competitionTaskOneQuestionQuery.getCompetitionId(), student.getStudentId());//生成试卷 + } else if (((Integer) 2).equals(competition.getCompetitionType())) { CompetitionStudentsQuery competitionStudentsQuery = new CompetitionStudentsQuery(); competitionStudentsQuery.setCompetitionId(competitionTaskOneQuestionQuery.getCompetitionId()); competitionStudentsQuery.setStudentsId(student.getStudentId()); List competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery); - teamName = null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).getTeamName():null; + teamName = null != competitionStudentsList && competitionStudentsList.size() > 0 ? competitionStudentsList.get(0).getTeamName() : null; - String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).teamStudentsIds():""; - teamStudentsIds = student.getStudentId() +","+ teamStudentsIds; + String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size() > 0 ? competitionStudentsList.get(0).teamStudentsIds() : ""; + teamStudentsIds = student.getStudentId() + "," + teamStudentsIds; Integer teamStudentsCount = teamStudentsIds.trim().split(",").length; - if(null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount){ + if (null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount) { return JsonResult.failMessage("未达到组队参加竞赛最低人数标准"); } - competitionService.createPaper(competitionTaskOneQuestionQuery.getCompetitionId(),student.getStudentId());//生成试卷 + competitionService.createPaper(competitionTaskOneQuestionQuery.getCompetitionId(), student.getStudentId());//生成试卷 } - if(null != competition && competition.getCompetitionTaskOneStartTime().getTime() > System.currentTimeMillis() ){ + if (null != competition && competition.getCompetitionTaskOneStartTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,大赛任务一还未开始"); } @@ -584,45 +625,46 @@ public class StudentController extends BaseController{ cs.setCompetitionId(competitionTaskOneQuestionQuery.getCompetitionId()); cs.setStudentsId(student.getStudentId()); List csList = competitionStudentsService.getValues(cs); - if(null != csList && csList.size()>0){ - if(null != csList.get(0).getCompetitionTaskOneFinishTime()){ + if (null != csList && csList.size() > 0) { + if (null != csList.get(0).getCompetitionTaskOneFinishTime()) { return JsonResult.failMessage("已交卷"); } } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("competitionName",competition.getCompetitionName());//大赛名称 - map.put("cT1StartTime",competition.getCompetitionTaskOneStartTime());//开始时间 - map.put("cT1EndTime",competition.getCompetitionTaskOneEndTime());//结束时间 - map.put("competitionType",competition.getCompetitionType());//大赛类型:1:个人 2:团队 - map.put("headImg",student.getHeadImg());//头像 - map.put("studentName",student.getStudentName());//学生姓名 - map.put("studentSn",student.getStudentSn());//学生账号 + map.put("competitionName", competition.getCompetitionName());//大赛名称 + map.put("cT1StartTime", competition.getCompetitionTaskOneStartTime());//开始时间 + map.put("cT1EndTime", competition.getCompetitionTaskOneEndTime());//结束时间 + map.put("competitionType", competition.getCompetitionType());//大赛类型:1:个人 2:团队 + map.put("headImg", student.getHeadImg());//头像 + map.put("studentName", student.getStudentName());//学生姓名 + map.put("studentSn", student.getStudentSn());//学生账号 - map.put("teamName",teamName);//队伍名称 + map.put("teamName", teamName);//队伍名称 competitionTaskOneQuestionQuery.setStudentsId(student.getStudentId()); List cT1QuestionList = competitionTaskOneQuestionService.getValuesWithOutAnswer(competitionTaskOneQuestionQuery); Map> groupByQuestionType = null; - try{ + try { groupByQuestionType = cT1QuestionList.stream().collect(Collectors.groupingBy(e -> e.getQuestionType())); - }catch (Exception e){} - if(null != groupByQuestionType){ - if(null == groupByQuestionType.get(Integer.valueOf("1"))){ - groupByQuestionType.put(1,new ArrayList()); + } catch (Exception e) { + } + if (null != groupByQuestionType) { + if (null == groupByQuestionType.get(Integer.valueOf("1"))) { + groupByQuestionType.put(1, new ArrayList()); } - if(null == groupByQuestionType.get(Integer.valueOf("2"))){ - groupByQuestionType.put(2,new ArrayList()); + if (null == groupByQuestionType.get(Integer.valueOf("2"))) { + groupByQuestionType.put(2, new ArrayList()); } - if(null == groupByQuestionType.get(Integer.valueOf("3"))){ - groupByQuestionType.put(3,new ArrayList()); + if (null == groupByQuestionType.get(Integer.valueOf("3"))) { + groupByQuestionType.put(3, new ArrayList()); } } - map.put("data",groupByQuestionType);//所有数据 - map.put("nowTime",System.currentTimeMillis()); + map.put("data", groupByQuestionType);//所有数据 + map.put("nowTime", System.currentTimeMillis()); return JsonResult.successMap(map); } @@ -631,19 +673,19 @@ public class StudentController extends BaseController{ @PostMapping(API + "/updateCT1QuestionAnswer.do") @ResponseBody @ApiOperation("大赛任务一 答卷") - public JsonResult updateCT1QuestionAnswer(CompetitionTaskOneQuestionQuery condition,@TStudent Student student){ - return studentService.updateCT1QuestionAnswer(condition,student); + public JsonResult updateCT1QuestionAnswer(CompetitionTaskOneQuestionQuery condition, @TStudent Student student) { + return studentService.updateCT1QuestionAnswer(condition, student); } //大赛任务一 查看自己的详情 @GetMapping(API + "/getMyCT1QuestionMap.do") @ResponseBody @ApiOperation("大赛任务一 查看自己的详情") - public JsonResult getMyCT1QuestionMap(CompetitionTaskOneQuestionQuery competitionTaskOneQuestionQuery,@TStudent Student student){ - if(null == competitionTaskOneQuestionQuery.getCompetitionId()){ + public JsonResult getMyCT1QuestionMap(CompetitionTaskOneQuestionQuery competitionTaskOneQuestionQuery, @TStudent Student student) { + if (null == competitionTaskOneQuestionQuery.getCompetitionId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } @@ -652,49 +694,50 @@ public class StudentController extends BaseController{ Competition competition = competitionService.getById(competitionTaskOneQuestionQuery.getCompetitionId()); //如果是团队赛判断是否符合团队赛进入条件 - if(((Integer)2).equals(competition.getCompetitionType())){ + if (((Integer) 2).equals(competition.getCompetitionType())) { CompetitionStudentsQuery competitionStudentsQuery = new CompetitionStudentsQuery(); competitionStudentsQuery.setCompetitionId(competitionTaskOneQuestionQuery.getCompetitionId()); competitionStudentsQuery.setStudentsId(student.getStudentId()); List competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery); - teamName = null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).getTeamName():null; + teamName = null != competitionStudentsList && competitionStudentsList.size() > 0 ? competitionStudentsList.get(0).getTeamName() : null; - String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).teamStudentsIds():""; - teamStudentsIds = student.getStudentId() +","+ teamStudentsIds; + String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size() > 0 ? competitionStudentsList.get(0).teamStudentsIds() : ""; + teamStudentsIds = student.getStudentId() + "," + teamStudentsIds; Integer teamStudentsCount = teamStudentsIds.trim().split(",").length; - if(null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount){ + if (null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount) { return JsonResult.failMessage("未达到组队参加竞赛最低人数标准"); } } - if(null != competition && competition.getCompetitionTaskOneEndTime().getTime() > System.currentTimeMillis() ){ + if (null != competition && competition.getCompetitionTaskOneEndTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,大赛任务一还未结束"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("competitionName",competition.getCompetitionName()); - map.put("cT1StartTime",competition.getCompetitionTaskOneStartTime()); - map.put("cT1EndTime",competition.getCompetitionTaskOneEndTime()); - map.put("competitionType",competition.getCompetitionType()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("competitionName", competition.getCompetitionName()); + map.put("cT1StartTime", competition.getCompetitionTaskOneStartTime()); + map.put("cT1EndTime", competition.getCompetitionTaskOneEndTime()); + map.put("competitionType", competition.getCompetitionType()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); - map.put("teamName",teamName); + map.put("teamName", teamName); competitionTaskOneQuestionQuery.setStudentsId(student.getStudentId()); List cT1QuestionList = competitionTaskOneQuestionService.getValuesByQuery(competitionTaskOneQuestionQuery); Map> groupByQuestionType = null; - try{ + try { groupByQuestionType = cT1QuestionList.stream().collect(Collectors.groupingBy(e -> e.getQuestionType())); - }catch (Exception e){} + } catch (Exception e) { + } - map.put("data",groupByQuestionType); - map.put("nowTime",System.currentTimeMillis()); + map.put("data", groupByQuestionType); + map.put("nowTime", System.currentTimeMillis()); return JsonResult.successMap(map); } @@ -703,11 +746,11 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getCT2QuestionList.do") @ResponseBody @ApiOperation("大赛任务二") - public JsonResult getCT2QuestionList(CompetitionTaskSecondQuestionQuery competitionTaskSecondQuestionQuery,@TStudent Student student){ - if(null == competitionTaskSecondQuestionQuery.getCompetitionId()){ + public JsonResult getCT2QuestionList(CompetitionTaskSecondQuestionQuery competitionTaskSecondQuestionQuery, @TStudent Student student) { + if (null == competitionTaskSecondQuestionQuery.getCompetitionId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } String teamName = null; @@ -715,28 +758,28 @@ public class StudentController extends BaseController{ Competition competition = competitionService.getById(competitionTaskSecondQuestionQuery.getCompetitionId()); //如果是团队赛判断是否符合团队赛进入条件 - if(((Integer)1).equals(competition.getCompetitionType())){//大赛类型:1:个人 2:团队 - competitionService.createPaper(competitionTaskSecondQuestionQuery.getCompetitionId(),student.getStudentId());//生成试卷 - }else if(((Integer)2).equals(competition.getCompetitionType())){ + if (((Integer) 1).equals(competition.getCompetitionType())) {//大赛类型:1:个人 2:团队 + competitionService.createPaper(competitionTaskSecondQuestionQuery.getCompetitionId(), student.getStudentId());//生成试卷 + } else if (((Integer) 2).equals(competition.getCompetitionType())) { CompetitionStudentsQuery competitionStudentsQuery = new CompetitionStudentsQuery(); competitionStudentsQuery.setCompetitionId(competitionTaskSecondQuestionQuery.getCompetitionId()); competitionStudentsQuery.setStudentsId(student.getStudentId()); List competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery); - teamName = null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).getTeamName():null; + teamName = null != competitionStudentsList && competitionStudentsList.size() > 0 ? competitionStudentsList.get(0).getTeamName() : null; - String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).teamStudentsIds():""; - teamStudentsIds = student.getStudentId() +","+ teamStudentsIds; + String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size() > 0 ? competitionStudentsList.get(0).teamStudentsIds() : ""; + teamStudentsIds = student.getStudentId() + "," + teamStudentsIds; Integer teamStudentsCount = teamStudentsIds.trim().split(",").length; - if(null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount){ + if (null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount) { return JsonResult.failMessage("未达到组队参加竞赛最低人数标准"); } - competitionService.createPaper(competitionTaskSecondQuestionQuery.getCompetitionId(),student.getStudentId());//生成试卷 + competitionService.createPaper(competitionTaskSecondQuestionQuery.getCompetitionId(), student.getStudentId());//生成试卷 } - if(null != competition && competition.getCompetitionTaskSecondStartTime().getTime() > System.currentTimeMillis() ){ + if (null != competition && competition.getCompetitionTaskSecondStartTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,大赛任务二还未开始"); } @@ -744,36 +787,36 @@ public class StudentController extends BaseController{ cs.setCompetitionId(competitionTaskSecondQuestionQuery.getCompetitionId()); cs.setStudentsId(student.getStudentId()); List csList = competitionStudentsService.getValues(cs); - if(null != csList && csList.size()>0){ - if(null != csList.get(0).getCompetitionTaskSecondFinishTime()){ + if (null != csList && csList.size() > 0) { + if (null != csList.get(0).getCompetitionTaskSecondFinishTime()) { return JsonResult.failMessage("已交卷"); } } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("competitionName",competition.getCompetitionName()); - map.put("cT2StartTime",competition.getCompetitionTaskSecondStartTime()); - map.put("cT2EndTime",competition.getCompetitionTaskSecondEndTime()); - map.put("competitionType",competition.getCompetitionType()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("competitionName", competition.getCompetitionName()); + map.put("cT2StartTime", competition.getCompetitionTaskSecondStartTime()); + map.put("cT2EndTime", competition.getCompetitionTaskSecondEndTime()); + map.put("competitionType", competition.getCompetitionType()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); - map.put("teamName",teamName); + map.put("teamName", teamName); competitionTaskSecondQuestionQuery.setStudentsId(student.getStudentId()); PageQuery page = competitionTaskSecondQuestionQuery.getPageQuery(); competitionTaskSecondQuestionService.queryByConditionWithOutAnswer(page); List cT2QuestionList = page.getList(); - for(int i=0;i competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery); - teamName = null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).getTeamName():null; + teamName = null != competitionStudentsList && competitionStudentsList.size() > 0 ? competitionStudentsList.get(0).getTeamName() : null; - String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).teamStudentsIds():""; - teamStudentsIds = student.getStudentId() +","+ teamStudentsIds; + String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size() > 0 ? competitionStudentsList.get(0).teamStudentsIds() : ""; + teamStudentsIds = student.getStudentId() + "," + teamStudentsIds; Integer teamStudentsCount = teamStudentsIds.trim().split(",").length; - if(null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount){ + if (null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount) { return JsonResult.failMessage("未达到组队参加竞赛最低人数标准"); } } - if(null != competition && competition.getCompetitionTaskSecondEndTime().getTime() > System.currentTimeMillis() ){ + if (null != competition && competition.getCompetitionTaskSecondEndTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,大赛任务二还未结束"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("competitionName",competition.getCompetitionName()); - map.put("cT2StartTime",competition.getCompetitionTaskSecondStartTime()); - map.put("cT2EndTime",competition.getCompetitionTaskSecondEndTime()); - map.put("competitionType",competition.getCompetitionType()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("competitionName", competition.getCompetitionName()); + map.put("cT2StartTime", competition.getCompetitionTaskSecondStartTime()); + map.put("cT2EndTime", competition.getCompetitionTaskSecondEndTime()); + map.put("competitionType", competition.getCompetitionType()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); - map.put("teamName",teamName); + map.put("teamName", teamName); competitionTaskSecondQuestionQuery.setStudentsId(student.getStudentId()); PageQuery page = competitionTaskSecondQuestionQuery.getPageQuery(); competitionTaskSecondQuestionService.queryByConditionWithOutAnswer(page); List cT2QuestionList = page.getList(); - for(int i=0;i System.currentTimeMillis() ){ + if (null != competition && competition.getCompetitionTaskThreeStartTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,大赛任务三还未开始"); } - if(null != competition && competition.getCompetitionTaskThreeEndTime().getTime() < System.currentTimeMillis() ){ + if (null != competition && competition.getCompetitionTaskThreeEndTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("上传失败,大赛任务三已结束"); } //如果是团队赛判断是否符合团队赛进入条件 - if(((Integer)2).equals(competition.getCompetitionType())){ + if (((Integer) 2).equals(competition.getCompetitionType())) { CompetitionStudentsQuery csq = new CompetitionStudentsQuery(); csq.setCompetitionId(competitionStudentsQuery.getCompetitionId()); csq.setStudentsId(student.getStudentId()); List competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(csq); - String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).teamStudentsIds():""; - teamStudentsIds = student.getStudentId() +","+ teamStudentsIds; + String teamStudentsIds = null != competitionStudentsList && competitionStudentsList.size() > 0 ? competitionStudentsList.get(0).teamStudentsIds() : ""; + teamStudentsIds = student.getStudentId() + "," + teamStudentsIds; Integer teamStudentsCount = teamStudentsIds.trim().split(",").length; - if(null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount){ + if (null != competition.getCompetitionTeamLimit() && Integer.parseInt(competition.getCompetitionTeamLimit().split("\\-")[0]) > teamStudentsCount) { return JsonResult.failMessage("未达到组队参加竞赛最低人数标准"); } } @@ -912,19 +955,19 @@ public class StudentController extends BaseController{ CompetitionStudentsQuery csQuery = new CompetitionStudentsQuery(); csQuery.setCompetitionId(competitionStudentsQuery.getCompetitionId()); csQuery.setStudentsId(student.getStudentId()); - if(((Integer)1).equals(competition.getCompetitionType())){ + if (((Integer) 1).equals(competition.getCompetitionType())) { List competitionStudentsList = competitionStudentsService.getCompetitionPersonalInfo(csQuery); competitionStudents = competitionStudentsList.get(0); competitionStudentsRanking = competitionStudents.competitionStudentsRanking(); - }else if(((Integer)2).equals(competition.getCompetitionType())){ + } else if (((Integer) 2).equals(competition.getCompetitionType())) { List competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery); competitionStudents = competitionStudentsList.get(0); competitionStudentsRanking = competitionStudents.competitionStudentsRanking(); } - if( null == competition.getCompetitionFinalsLimit() || (null != competitionStudentsRanking && null != competition.getCompetitionFinalsLimit() && competitionStudentsRanking <= competition.getCompetitionFinalsLimit())){ + if (null == competition.getCompetitionFinalsLimit() || (null != competitionStudentsRanking && null != competition.getCompetitionFinalsLimit() && competitionStudentsRanking <= competition.getCompetitionFinalsLimit())) { - if(((Integer)2).equals(competition.getCompetitionType())) { + if (((Integer) 2).equals(competition.getCompetitionType())) { //判断是否是队长 if (((Integer) 1).equals(competitionStudents.getIsCaptain())) { } else { @@ -933,20 +976,20 @@ public class StudentController extends BaseController{ } String competitionTaskThreeInfos = competitionStudents.getCompetitionTaskThreeInfos(); - if(StringUtils.isBlank(competitionTaskThreeInfos)){ + if (StringUtils.isBlank(competitionTaskThreeInfos)) { competitionTaskThreeInfos = " , "; } String[] competitionTaskThreeInfo = competitionTaskThreeInfos.split(","); String[] ct3Info = new String[2]; - ct3Info[0] = competitionTaskThreeInfo.length > 0? competitionTaskThreeInfo[0]:""; - ct3Info[1] = competitionTaskThreeInfo.length > 1? competitionTaskThreeInfo[1]:""; - if(StringUtils.isNotBlank(competitionStudentsQuery.getCompetitionTaskThreePPT())){ + ct3Info[0] = competitionTaskThreeInfo.length > 0 ? competitionTaskThreeInfo[0] : ""; + ct3Info[1] = competitionTaskThreeInfo.length > 1 ? competitionTaskThreeInfo[1] : ""; + if (StringUtils.isNotBlank(competitionStudentsQuery.getCompetitionTaskThreePPT())) { ct3Info[0] = competitionStudentsQuery.getCompetitionTaskThreePPT(); } - if(StringUtils.isNotBlank(competitionStudentsQuery.getCompetitionTaskThreeVideo())){ + if (StringUtils.isNotBlank(competitionStudentsQuery.getCompetitionTaskThreeVideo())) { ct3Info[1] = competitionStudentsQuery.getCompetitionTaskThreeVideo(); } - competitionTaskThreeInfos = ct3Info[0]+","+ct3Info[1]; + competitionTaskThreeInfos = ct3Info[0] + "," + ct3Info[1]; CompetitionStudents c = new CompetitionStudents(); c.setCompetitionStudentsId(competitionStudents.getCompetitionStudentsId()); @@ -954,7 +997,7 @@ public class StudentController extends BaseController{ competitionStudentsService.updateTemplate(c); return JsonResult.successMessage("上传成功"); - }else { + } else { return JsonResult.failMessage("很遗憾,未达到大赛任务三标准,请下次再接再厉"); } } @@ -963,11 +1006,11 @@ public class StudentController extends BaseController{ @PostMapping(API + "/myExamList.do") @ResponseBody @ApiOperation("我的考试列表") - public JsonResult myExamList(ExamQuery condition,@TStudent Student student) { + public JsonResult myExamList(ExamQuery condition, @TStudent Student student) { condition.setStudentId(student.getStudentId()); condition.setOrgId(student.getOrgId()); - if(null == condition.getExamStatus()){ + if (null == condition.getExamStatus()) { condition.setExamStatus(1); } @@ -983,7 +1026,7 @@ public class StudentController extends BaseController{ @ApiOperation("成绩排名") public JsonResult examRankingList(ExamStudentsQuery condition) { Exam exam = examService.queryById(condition.getExamId()); - if(null != exam){ + if (null != exam) { PageQuery page = condition.getPageQuery(); examStudentsService.queryExamByCondition(page); return JsonResult.success(page); @@ -995,9 +1038,9 @@ public class StudentController extends BaseController{ @PostMapping(API + "/examGradeList.do") @ResponseBody @ApiOperation("成绩详情列表") - public JsonResult examGradeList(ExamStudentsQuery condition,@TStudent Student student) { + public JsonResult examGradeList(ExamStudentsQuery condition, @TStudent Student student) { Exam exam = examService.queryById(condition.getExamId()); - if(null != exam){ + if (null != exam) { condition.setStudentsId(student.getStudentId()); PageQuery page = condition.getPageQuery(); @@ -1014,7 +1057,7 @@ public class StudentController extends BaseController{ @ApiOperation("参赛学员") public JsonResult examStudentsList(ExamStudentsQuery condition) { Exam exam = examService.queryById(condition.getExamId()); - if(null != exam){ + if (null != exam) { PageQuery page = condition.getPageQuery(); examStudentsService.queryExamByCondition(page); return JsonResult.success(page); @@ -1026,36 +1069,36 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getET1QuestionMap.do") @ResponseBody @ApiOperation("考试任务一") - public JsonResult getET1QuestionList(ExamTaskOneQuestionQuery examTaskOneQuestionQuery,@TStudent Student student){ - if(null == examTaskOneQuestionQuery.getExamId()){ + public JsonResult getET1QuestionList(ExamTaskOneQuestionQuery examTaskOneQuestionQuery, @TStudent Student student) { + if (null == examTaskOneQuestionQuery.getExamId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - examService.createPaper(examTaskOneQuestionQuery.getExamId(),student.getStudentId());//生成试卷 + examService.createPaper(examTaskOneQuestionQuery.getExamId(), student.getStudentId());//生成试卷 Exam exam = examService.queryById(examTaskOneQuestionQuery.getExamId()); - if(null != exam && exam.getExamTaskOneStartTime().getTime() > System.currentTimeMillis() ){ + if (null != exam && exam.getExamTaskOneStartTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,考试任务一还未开始"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("examName",exam.getExamName()); - map.put("eT1StartTime",exam.getExamTaskOneStartTime()); - map.put("eT1EndTime",exam.getExamTaskOneEndTime()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); - map.put("studentSn",student.getStudentSn());//学生账号 + map.put("examName", exam.getExamName()); + map.put("eT1StartTime", exam.getExamTaskOneStartTime()); + map.put("eT1EndTime", exam.getExamTaskOneEndTime()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); + map.put("studentSn", student.getStudentSn());//学生账号 ExamStudents es = new ExamStudents(); es.setExamId(examTaskOneQuestionQuery.getExamId()); es.setStudentsId(student.getStudentId()); List esList = examStudentsService.getValues(es); - if(null != esList && esList.size()>0){ - if(null != esList.get(0).getExamTaskOneFinishTime()){ + if (null != esList && esList.size() > 0) { + if (null != esList.get(0).getExamTaskOneFinishTime()) { return JsonResult.failMessage("已交卷"); } } @@ -1064,23 +1107,24 @@ public class StudentController extends BaseController{ List eT1QuestionList = examTaskOneQuestionService.getValuesWithOutAnswer(examTaskOneQuestionQuery); Map> groupByQuestionType = null; - try{ + try { groupByQuestionType = eT1QuestionList.stream().collect(Collectors.groupingBy(e -> e.getQuestionType())); - }catch (Exception e){} - if(null != groupByQuestionType){ - if(null == groupByQuestionType.get(Integer.valueOf("1"))){ - groupByQuestionType.put(1,new ArrayList()); + } catch (Exception e) { + } + if (null != groupByQuestionType) { + if (null == groupByQuestionType.get(Integer.valueOf("1"))) { + groupByQuestionType.put(1, new ArrayList()); } - if(null == groupByQuestionType.get(Integer.valueOf("2"))){ - groupByQuestionType.put(2,new ArrayList()); + if (null == groupByQuestionType.get(Integer.valueOf("2"))) { + groupByQuestionType.put(2, new ArrayList()); } - if(null == groupByQuestionType.get(Integer.valueOf("3"))){ - groupByQuestionType.put(3,new ArrayList()); + if (null == groupByQuestionType.get(Integer.valueOf("3"))) { + groupByQuestionType.put(3, new ArrayList()); } } - map.put("data",groupByQuestionType); - map.put("nowTime",System.currentTimeMillis()); + map.put("data", groupByQuestionType); + map.put("nowTime", System.currentTimeMillis()); return JsonResult.successMap(map); } @@ -1089,36 +1133,36 @@ public class StudentController extends BaseController{ @PostMapping(API + "/updateET1QuestionAnswer.do") @ResponseBody @ApiOperation("考试任务一 答卷") - public JsonResult updateET1QuestionAnswer(ExamTaskOneQuestionQuery condition,@TStudent Student student){ - return studentService.updateET1QuestionAnswer(condition,student); + public JsonResult updateET1QuestionAnswer(ExamTaskOneQuestionQuery condition, @TStudent Student student) { + return studentService.updateET1QuestionAnswer(condition, student); } //考试任务一 查看我的成绩详情 @GetMapping(API + "/getMyET1QuestionMap.do") @ResponseBody @ApiOperation("考试任务一 查看我的成绩详情") - public JsonResult getMyET1QuestionMap(ExamTaskOneQuestionQuery examTaskOneQuestionQuery,@TStudent Student student){ - if(null == examTaskOneQuestionQuery.getExamId()){ + public JsonResult getMyET1QuestionMap(ExamTaskOneQuestionQuery examTaskOneQuestionQuery, @TStudent Student student) { + if (null == examTaskOneQuestionQuery.getExamId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - examService.createPaper(examTaskOneQuestionQuery.getExamId(),student.getStudentId());//生成试卷 + examService.createPaper(examTaskOneQuestionQuery.getExamId(), student.getStudentId());//生成试卷 Exam exam = examService.queryById(examTaskOneQuestionQuery.getExamId()); - if(null != exam && exam.getExamTaskOneEndTime().getTime() > System.currentTimeMillis() ){ + if (null != exam && exam.getExamTaskOneEndTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,考试任务一还未结束"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("examName",exam.getExamName()); - map.put("eT1StartTime",exam.getExamTaskOneStartTime()); - map.put("eT1EndTime",exam.getExamTaskOneEndTime()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("examName", exam.getExamName()); + map.put("eT1StartTime", exam.getExamTaskOneStartTime()); + map.put("eT1EndTime", exam.getExamTaskOneEndTime()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); ExamStudentsQuery examStudentsQuery = new ExamStudentsQuery(); examStudentsQuery.setExamId(examTaskOneQuestionQuery.getExamId()); @@ -1128,12 +1172,13 @@ public class StudentController extends BaseController{ List eT1QuestionList = examTaskOneQuestionService.getValuesByQuery(examTaskOneQuestionQuery); Map> groupByQuestionType = null; - try{ + try { groupByQuestionType = eT1QuestionList.stream().collect(Collectors.groupingBy(e -> e.getQuestionType())); - }catch (Exception e){} + } catch (Exception e) { + } - map.put("data",groupByQuestionType); - map.put("nowTime",System.currentTimeMillis()); + map.put("data", groupByQuestionType); + map.put("nowTime", System.currentTimeMillis()); return JsonResult.successMap(map); } @@ -1142,34 +1187,34 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getET2QuestionList.do") @ResponseBody @ApiOperation("考试任务二") - public JsonResult getET2QuestionList(ExamTaskSecondQuestionQuery examTaskSecondQuestionQuery,@TStudent Student student){ - if(null == examTaskSecondQuestionQuery.getExamId()){ + public JsonResult getET2QuestionList(ExamTaskSecondQuestionQuery examTaskSecondQuestionQuery, @TStudent Student student) { + if (null == examTaskSecondQuestionQuery.getExamId()) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - examService.createPaper(examTaskSecondQuestionQuery.getExamId(),student.getStudentId());//生成试卷 + examService.createPaper(examTaskSecondQuestionQuery.getExamId(), student.getStudentId());//生成试卷 Exam exam = examService.queryById(examTaskSecondQuestionQuery.getExamId()); - if(null != exam && exam.getExamTaskSecondStartTime().getTime() > System.currentTimeMillis() ){ + if (null != exam && exam.getExamTaskSecondStartTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,考试任务二还未开始"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("examName",exam.getExamName()); - map.put("eT2StartTime",exam.getExamTaskSecondStartTime()); - map.put("eT2EndTime",exam.getExamTaskSecondEndTime()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("examName", exam.getExamName()); + map.put("eT2StartTime", exam.getExamTaskSecondStartTime()); + map.put("eT2EndTime", exam.getExamTaskSecondEndTime()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); ExamStudents es = new ExamStudents(); es.setExamId(examTaskSecondQuestionQuery.getExamId()); es.setStudentsId(student.getStudentId()); List esList = examStudentsService.getValues(es); - if(null != esList && esList.size()>0){ - if(null != esList.get(0).getExamTaskSecondFinishTime()){ + if (null != esList && esList.size() > 0) { + if (null != esList.get(0).getExamTaskSecondFinishTime()) { return JsonResult.failMessage("已交卷"); } } @@ -1178,15 +1223,15 @@ public class StudentController extends BaseController{ PageQuery page = examTaskSecondQuestionQuery.getPageQuery(); examTaskSecondQuestionService.queryByConditionWithOutAnswer(page); List eT2QuestionList = page.getList(); - for(int i=0;i System.currentTimeMillis() ){ + if (null != exam && exam.getExamTaskSecondEndTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,考试任务二还未结束"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("examName",exam.getExamName()); - map.put("eT2StartTime",exam.getExamTaskSecondStartTime()); - map.put("eT2EndTime",exam.getExamTaskSecondEndTime()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("examName", exam.getExamName()); + map.put("eT2StartTime", exam.getExamTaskSecondStartTime()); + map.put("eT2EndTime", exam.getExamTaskSecondEndTime()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); ExamStudentsQuery examStudentsQuery = new ExamStudentsQuery(); examStudentsQuery.setExamId(examTaskSecondQuestionQuery.getExamId()); @@ -1233,15 +1278,15 @@ public class StudentController extends BaseController{ PageQuery page = examTaskSecondQuestionQuery.getPageQuery(); examTaskSecondQuestionService.queryByConditionWithOutAnswer(page); List eT2QuestionList = page.getList(); - for(int i=0;i System.currentTimeMillis() ){ + if (null != exam && exam.getExamTaskThreeStartTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,考试任务三还未开始"); } @@ -1268,33 +1313,33 @@ public class StudentController extends BaseController{ es.setExamId(examTaskThreeQuestionQuery.getExamId()); es.setStudentsId(student.getStudentId()); List esList = examStudentsService.getValues(es); - if(null != esList && esList.size()>0){ - if(null != esList.get(0).getExamTaskThreeFinishTime()){ + if (null != esList && esList.size() > 0) { + if (null != esList.get(0).getExamTaskThreeFinishTime()) { return JsonResult.failMessage("已交卷"); } } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("examName",exam.getExamName()); - map.put("eT3StartTime",exam.getExamTaskThreeStartTime()); - map.put("eT3EndTime",exam.getExamTaskThreeEndTime()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("examName", exam.getExamName()); + map.put("eT3StartTime", exam.getExamTaskThreeStartTime()); + map.put("eT3EndTime", exam.getExamTaskThreeEndTime()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); examTaskThreeQuestionQuery.setStudentsId(student.getStudentId()); PageQuery page = examTaskThreeQuestionQuery.getPageQuery(); examTaskThreeQuestionService.queryByConditionWithOutAnswer(page); List eT3QuestionList = page.getList(); - for(int i=0;i System.currentTimeMillis() ){ + if (null != exam && exam.getExamTaskThreeEndTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,考试任务三还未结束"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("examName",exam.getExamName()); - map.put("eT3StartTime",exam.getExamTaskThreeStartTime()); - map.put("eT3EndTime",exam.getExamTaskThreeEndTime()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); - map.put("teacherName",teacherService.queryById(exam.getTeacherId()).getTeacherName()); + map.put("examName", exam.getExamName()); + map.put("eT3StartTime", exam.getExamTaskThreeStartTime()); + map.put("eT3EndTime", exam.getExamTaskThreeEndTime()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); + map.put("teacherName", teacherService.queryById(exam.getTeacherId()).getTeacherName()); ExamStudentsQuery examStudentsQuery = new ExamStudentsQuery(); examStudentsQuery.setExamId(examTaskThreeQuestionQuery.getExamId()); examStudentsQuery.setStudentsId(student.getStudentId()); - ListexamStudentsList = examStudentsService.getValues(examStudentsQuery); + List examStudentsList = examStudentsService.getValues(examStudentsQuery); - map.put("examStudents",examStudentsList.get(0)); + map.put("examStudents", examStudentsList.get(0)); examTaskThreeQuestionQuery.setStudentsId(student.getStudentId()); PageQuery page = examTaskThreeQuestionQuery.getPageQuery(); examTaskThreeQuestionService.queryByConditionWithOutAnswer(page); List eT3QuestionList = page.getList(); - for(int i=0;i System.currentTimeMillis() ){ + if (null != exam && exam.getExamTaskThreeStartTime().getTime() > System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,考试任务三还未开始"); } - if( null != exam && exam.getExamTaskThreeEndTime().getTime() < System.currentTimeMillis() ){ + if (null != exam && exam.getExamTaskThreeEndTime().getTime() < System.currentTimeMillis()) { return JsonResult.failMessage("请稍等,考试任务三已结束"); } @@ -1404,81 +1449,82 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getCourseResourcesList.do") @ResponseBody @ApiOperation("练习实训 系统模块 查课程名称") - public JsonResult getCourseList(@TStudent Student student){ - if( null == student ){ + public JsonResult getCourseList(@TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - Listlist = courseInfoService.getListByCourseLabelTypes("应用课程类"); - return JsonResult.success(list); + List list = courseInfoService.getListByCourseLabelTypes("应用课程类"); + return JsonResult.success(list); } //根据课程查章节 @GetMapping(API + "/getCourseInfoValues.do") @ResponseBody @ApiOperation("根据课程查章节") - public JsonResult>getValues(CourseInfoQuery param) { - Listlist = courseInfoService.getValues(param); - return JsonResult.success(list); + public JsonResult> getValues(CourseInfoQuery param) { + List list = courseInfoService.getValues(param); + return JsonResult.success(list); } //练习实训 系统模块 查课程详情 @GetMapping(API + "/getCourseResourcesInfoList.do") @ResponseBody @ApiOperation("练习实训 系统模块 查课程详情") - public JsonResult getCourseResourcesInfoList(Long courseInfoId,@TStudent Student student){ - if( null == student ){ + public JsonResult getCourseResourcesInfoList(Long courseInfoId, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - Listlist = courseInfoService.getCourseResources(courseInfoId); - return JsonResult.success(list); + List list = courseInfoService.getCourseResources(courseInfoId); + return JsonResult.success(list); } //练习实训 系统模块 题库中客观题 @GetMapping(API + "/getResourcesQuestionMap.do") @ResponseBody @ApiOperation("练习实训 系统模块 题库中客观题") - public JsonResult getResourcesQuestionMap(Long courseInfoId,@TStudent Student student){ - if(null == courseInfoId){ + public JsonResult getResourcesQuestionMap(Long courseInfoId, @TStudent Student student) { + if (null == courseInfoId) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); CourseInfo[] courseInfos = courseInfoService.getSurroundChapterInfo(courseInfoId); CourseInfo courseInfo = courseInfos[1]; - map.put("courseInfo",courseInfo);//当前章节信息 + map.put("courseInfo", courseInfo);//当前章节信息 //上一个章节ID - map.put("backCourseInfoId",courseInfos[0].getCourseInfoId()); + map.put("backCourseInfoId", courseInfos[0].getCourseInfoId()); //下一个章节ID - map.put("nextCourseInfoId",courseInfos[2].getCourseInfoId()); + map.put("nextCourseInfoId", courseInfos[2].getCourseInfoId()); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); - map.put("studentSn",student.getStudentSn());//学生账号 + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); + map.put("studentSn", student.getStudentSn());//学生账号 SchoolClass schoolClass = schoolClassService.queryById(student.getClassId()); - map.put("className",schoolClass.getClassName());//班级名称 + map.put("className", schoolClass.getClassName());//班级名称 List resourcesQuestionList = null; - if(ToolUtils.isNotSplitBlank(courseInfo.getResourcesQuestionIds(),",",0)){ + if (ToolUtils.isNotSplitBlank(courseInfo.getResourcesQuestionIds(), ",", 0)) { ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery(); resourcesQuestionQuery.setResourcesQuestionIds(courseInfo.getResourcesQuestionIds()); resourcesQuestionList = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery); } Map> groupByQuestionType = null; - try{ + try { groupByQuestionType = resourcesQuestionList.stream().collect(Collectors.groupingBy(e -> e.getQuestionType())); - }catch (Exception e){} + } catch (Exception e) { + } - map.put("data",groupByQuestionType); - map.put("nowTime",System.currentTimeMillis()); + map.put("data", groupByQuestionType); + map.put("nowTime", System.currentTimeMillis()); return JsonResult.successMap(map); } @@ -1487,46 +1533,46 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getResourcesCompetitionList.do") @ResponseBody @ApiOperation("练习实训 系统模块 题库中竞赛案例") - public JsonResult getResourcesCompetitionList(Long courseInfoId,ResourcesCompetitionQuery resourcesCompetitionQuery,@TStudent Student student){ - if(null == courseInfoId){ + public JsonResult getResourcesCompetitionList(Long courseInfoId, ResourcesCompetitionQuery resourcesCompetitionQuery, @TStudent Student student) { + if (null == courseInfoId) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); CourseInfo[] courseInfos = courseInfoService.getSurroundChapterInfo(courseInfoId); CourseInfo courseInfo = courseInfos[1]; - map.put("courseInfo",courseInfo);//当前章节信息 + map.put("courseInfo", courseInfo);//当前章节信息 //上一个章节ID - map.put("backCourseInfoId",courseInfos[0].getCourseInfoId()); + map.put("backCourseInfoId", courseInfos[0].getCourseInfoId()); //下一个章节ID - map.put("nextCourseInfoId",courseInfos[2].getCourseInfoId()); + map.put("nextCourseInfoId", courseInfos[2].getCourseInfoId()); //目录 - map.put("chapterList",courseInfoService.getChapterList(courseInfoId)); + map.put("chapterList", courseInfoService.getChapterList(courseInfoId)); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); resourcesCompetitionQuery.setResourcesCompetitionIds(courseInfo.getResourcesCompetitionIds()); PageQuery page = resourcesCompetitionQuery.getPageQuery(); resourcesCompetitionService.queryByCondition2Student(page); List resourcesCompetitionList = page.getList(); - for(int i=0;imap = new HashMap<>(); + Map map = new HashMap<>(); CourseInfo[] courseInfos = courseInfoService.getSurroundChapterInfo(courseInfoId); CourseInfo courseInfo = courseInfos[1]; - map.put("courseInfo",courseInfo);//当前章节信息 + map.put("courseInfo", courseInfo);//当前章节信息 //上一个章节ID - map.put("backCourseInfoId",courseInfos[0].getCourseInfoId()); + map.put("backCourseInfoId", courseInfos[0].getCourseInfoId()); //下一个章节ID - map.put("nextCourseInfoId",courseInfos[2].getCourseInfoId()); + map.put("nextCourseInfoId", courseInfos[2].getCourseInfoId()); //目录 - map.put("chapterList",courseInfoService.getChapterList(courseInfoId)); + map.put("chapterList", courseInfoService.getChapterList(courseInfoId)); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); resourcesTrainingQuery.setResourcesTrainingIds(courseInfo.getResourcesTrainingIds()); resourcesTrainingQuery.setStudentId(student.getStudentId()); PageQuery page = resourcesTrainingQuery.getPageQuery(); resourcesTrainingService.queryByCondition2Student(page); List resourcesTrainingList = page.getList(); - for(int i=0;ilist = resourcesInfoService.getValues(resourcesInfoQuery); - return JsonResult.success(list); + List list = resourcesInfoService.getValues(resourcesInfoQuery); + return JsonResult.success(list); } @@ -1639,28 +1685,28 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getCatalogue.do") @ResponseBody @ApiOperation("目录和当前节") - public JsonResult getCatalogue(Long courseInfoId,@TStudent Student student){ - if(null == courseInfoId){ + public JsonResult getCatalogue(Long courseInfoId, @TStudent Student student) { + if (null == courseInfoId) { return JsonResult.failMessage("参数丢失"); } - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); CourseInfo c = courseInfoService.getById(courseInfoId); - map.put("courseInfo",c);//当前节信息 + map.put("courseInfo", c);//当前节信息 - if(null != c){ - if(!((Integer)1).equals(c.getCourseInfoType())){ + if (null != c) { + if (!((Integer) 1).equals(c.getCourseInfoType())) { courseInfoId = c.getCourseInfoParentId(); - for(int i=0;i<10;i++){ + for (int i = 0; i < 10; i++) { CourseInfo courseInfoParent = courseInfoService.queryById(courseInfoId); - if(((Integer)1).equals(courseInfoParent.getCourseInfoType())){ + if (((Integer) 1).equals(courseInfoParent.getCourseInfoType())) { courseInfoId = courseInfoParent.getCourseInfoId(); break; - }else { + } else { courseInfoId = courseInfoParent.getCourseInfoParentId(); } } @@ -1668,7 +1714,7 @@ public class StudentController extends BaseController{ } //目录 - map.put("chapterList",courseInfoService.getChapterList(courseInfoId)); + map.put("chapterList", courseInfoService.getChapterList(courseInfoId)); return JsonResult.successMap(map); } @@ -1677,20 +1723,20 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getStudentInfo.do") @ResponseBody @ApiOperation("个人中心") - public JsonResult getStudentInfo(@TStudent Student student,@RequestIp String ip){ - if(null == student){ + public JsonResult getStudentInfo(@TStudent Student student, @RequestIp String ip) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } student.setStudentPassword(null); - student.set("ip",ip);//IP + student.set("ip", ip);//IP IpAddress ipAddress = ipAddressMap.get(ip); - student.set("ipAddress",null != ipAddress?(ipAddress.getProvince()+ipAddress.getCity()+ipAddress.getDistrict()):null);//IP地址 + student.set("ipAddress", null != ipAddress ? (ipAddress.getProvince() + ipAddress.getCity() + ipAddress.getDistrict()) : null);//IP地址 SchoolClass schoolClass = schoolClassService.queryById(student.getClassId()); - student.set("className",schoolClass.getClassName()); + student.set("className", schoolClass.getClassName()); UniversitiesColleges universitiesColleges = universitiesCollegesService.queryById(schoolClass.getUniversitiesCollegesId()); - student.set("universitiesCollegesName",universitiesColleges.getUniversitiesCollegesName()); + student.set("universitiesCollegesName", universitiesColleges.getUniversitiesCollegesName()); return JsonResult.success(student); } @@ -1699,8 +1745,8 @@ public class StudentController extends BaseController{ @PostMapping(API + "/editStudentInfo.do") @ResponseBody @ApiOperation("修改学员个人信息") - public JsonResult editStudentInfo(StudentQuery studentQuery,@RFile FileEntity fileEntity,@TStudent Student student) { - if(null == student){ + public JsonResult editStudentInfo(StudentQuery studentQuery, @RFile FileEntity fileEntity, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } @@ -1709,13 +1755,13 @@ public class StudentController extends BaseController{ if (success) { //更新缓存 updateByIds(student.getId().toString()); - if (StringUtils.isNotBlank(studentQuery.getHeadImg())){ + if (StringUtils.isNotBlank(studentQuery.getHeadImg())) { student.setHeadImg(studentQuery.getHeadImg()); Object sessionValue = httpRequestLocal.getSessionValue(T_STUDENT); - if(null != sessionValue){ + if (null != sessionValue) { Student bean = (Student) sessionValue; bean.setHeadImg(studentQuery.getHeadImg()); - httpRequestLocal.setSessionValue(T_STUDENT,bean); + httpRequestLocal.setSessionValue(T_STUDENT, bean); } } return JsonResult.success(); @@ -1729,9 +1775,9 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getStudentDirectMessagesCount.do") @ResponseBody @ApiOperation("个人私信 数量") - public JsonResult getStudentDirectMessagesCount(StudentDirectMessagesQuery condition,@TStudent Student student){ + public JsonResult getStudentDirectMessagesCount(StudentDirectMessagesQuery condition, @TStudent Student student) { - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } @@ -1749,9 +1795,9 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getStudentDirectMessagesList.do") @ResponseBody @ApiOperation("个人私信") - public JsonResult list(StudentDirectMessagesQuery condition,@TStudent Student student){ + public JsonResult list(StudentDirectMessagesQuery condition, @TStudent Student student) { - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } @@ -1763,11 +1809,11 @@ public class StudentController extends BaseController{ PageQuery page = condition.getPageQuery(); studentDirectMessagesService.queryByCondition2Student(page); - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("count",page.getTotalRow()); - map.put("data",page.getList()); - map.put("student",student); + map.put("count", page.getTotalRow()); + map.put("data", page.getList()); + map.put("student", student); return JsonResult.successMap(map); } @@ -1776,8 +1822,8 @@ public class StudentController extends BaseController{ @PostMapping(API + "/reply.do") @ResponseBody @ApiOperation("回复") - public JsonResult reply(StudentDirectMessagesQuery studentDirectMessagesQuery,@TStudent Student student) { - if(null == student){ + public JsonResult reply(StudentDirectMessagesQuery studentDirectMessagesQuery, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } StudentDirectMessages studentDirectMessages = studentDirectMessagesService.getById(studentDirectMessagesQuery.getStudentDirectMessagesId()); @@ -1799,17 +1845,17 @@ public class StudentController extends BaseController{ @PostMapping(API + "/messagesToEnroll.do") @ResponseBody @ApiOperation("报名参赛") - public JsonResult messagesToEnroll(StudentDirectMessagesQuery studentDirectMessagesQuery,@TStudent Student student) { - if(null == student){ + public JsonResult messagesToEnroll(StudentDirectMessagesQuery studentDirectMessagesQuery, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - if(null == studentDirectMessagesQuery){ + if (null == studentDirectMessagesQuery) { return JsonResult.failMessage("请选择相应的邀请"); } - if(null == studentDirectMessagesQuery.getStudentDirectMessagesId()){ + if (null == studentDirectMessagesQuery.getStudentDirectMessagesId()) { return JsonResult.failMessage("请选择相应的邀请"); } - if(null == studentDirectMessagesQuery.getStudentDirectMessagesStatus()){ + if (null == studentDirectMessagesQuery.getStudentDirectMessagesStatus()) { return JsonResult.failMessage("请选择同意或拒绝"); } StudentDirectMessages studentDirectMessages = studentDirectMessagesService.getById(studentDirectMessagesQuery.getStudentDirectMessagesId()); @@ -1817,24 +1863,24 @@ public class StudentController extends BaseController{ CompetitionStudents competitionStudents = new CompetitionStudents(); competitionStudents.setCompetitionId(studentDirectMessages.getCompetitionId()); competitionStudents.setStudentsId(student.getStudentId()); - return competitionStudentsService.add(competitionStudents,studentDirectMessagesQuery); + return competitionStudentsService.add(competitionStudents, studentDirectMessagesQuery); } //同意参与队伍 @PostMapping(API + "/agreeInvolvedTeam.do") @ResponseBody @ApiOperation("同意参与队伍") - public JsonResult agreeInvolvedTeam(StudentDirectMessagesQuery studentDirectMessagesQuery,@TStudent Student student) { - if(null == student){ + public JsonResult agreeInvolvedTeam(StudentDirectMessagesQuery studentDirectMessagesQuery, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - if(null == studentDirectMessagesQuery){ + if (null == studentDirectMessagesQuery) { return JsonResult.failMessage("请选择相应的申请"); } - if(null == studentDirectMessagesQuery.getStudentDirectMessagesId()){ + if (null == studentDirectMessagesQuery.getStudentDirectMessagesId()) { return JsonResult.failMessage("请选择相应的申请"); } - if(null == studentDirectMessagesQuery.getStudentDirectMessagesStatus()){ + if (null == studentDirectMessagesQuery.getStudentDirectMessagesStatus()) { return JsonResult.failMessage("请选择同意或拒绝"); } return competitionStudentsService.agreeInvolvedTeam(studentDirectMessagesQuery); @@ -1844,21 +1890,21 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getChapterList.do") @ResponseBody @ApiOperation("查询课程和章") - public JsonResult getChapterList(@TStudent Student student){ - if( null == student ){ + public JsonResult getChapterList(@TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - Listlist = courseInfoService.getListByCourseLabelTypes("应用课程类"); - return JsonResult.success(list); + List list = courseInfoService.getListByCourseLabelTypes("应用课程类"); + return JsonResult.success(list); } //错题集 @GetMapping(API + "/getWrongQuestionList.do") @ResponseBody @ApiOperation("错题集") - public JsonResult getWrongQuestionList(WrongQuestionQuery condition,@TStudent Student student){ + public JsonResult getWrongQuestionList(WrongQuestionQuery condition, @TStudent Student student) { - if(null == student){ + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } condition.setStudentId(student.getStudentId()); @@ -1871,8 +1917,8 @@ public class StudentController extends BaseController{ @PostMapping(API + "/removeWrongQuestion.do") @ResponseBody @ApiOperation("移除错题") - public JsonResult removeWrongQuestion(String ids,@TStudent Student student){ - if(null == student){ + public JsonResult removeWrongQuestion(String ids, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } wrongQuestionService.deleteWrongQuestion(ids); @@ -1883,32 +1929,33 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getWrongResourcesQuestionMap.do") @ResponseBody @ApiOperation("错题练习 错题中客观题") - public JsonResult getWrongResourcesQuestionMap(@TStudent Student student){ - if(null == student){ + public JsonResult getWrongResourcesQuestionMap(@TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); - map.put("studentSn",student.getStudentSn());//学生账号 + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); + map.put("studentSn", student.getStudentSn());//学生账号 SchoolClass schoolClass = schoolClassService.queryById(student.getClassId()); - map.put("className",schoolClass.getClassName());//班级名称 + map.put("className", schoolClass.getClassName());//班级名称 ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery(); resourcesQuestionQuery.setWrongQuestionFromStudentId(student.getStudentId()); List resourcesQuestionList = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery); Map> groupByQuestionType = null; - try{ + try { groupByQuestionType = resourcesQuestionList.stream().collect(Collectors.groupingBy(e -> e.getQuestionType())); - }catch (Exception e){} + } catch (Exception e) { + } - map.put("data",groupByQuestionType); - map.put("nowTime",System.currentTimeMillis()); + map.put("data", groupByQuestionType); + map.put("nowTime", System.currentTimeMillis()); return JsonResult.successMap(map); } @@ -1917,36 +1964,36 @@ public class StudentController extends BaseController{ @GetMapping(API + "/getWrongResourcesCompetitionList.do") @ResponseBody @ApiOperation("错题练习 错题中竞赛案例") - public JsonResult getWrongResourcesCompetitionList(Long resourcesCompetitionId,@TStudent Student student){ - if(null == student){ + public JsonResult getWrongResourcesCompetitionList(Long resourcesCompetitionId, @TStudent Student student) { + if (null == student) { return JsonResult.failMessage("请登录后再操作"); } - Mapmap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); - WrongQuestion[] wrongQuestions = wrongQuestionService.getSurroundWrongInfo(student.getStudentId(),resourcesCompetitionId,null); + WrongQuestion[] wrongQuestions = wrongQuestionService.getSurroundWrongInfo(student.getStudentId(), resourcesCompetitionId, null); //上一个章节ID - map.put("backWrongInfoId",wrongQuestions[0].resourcesCompetitionId()); + map.put("backWrongInfoId", wrongQuestions[0].resourcesCompetitionId()); //下一个章节ID - map.put("nextWrongInfoId",wrongQuestions[2].resourcesCompetitionId()); + map.put("nextWrongInfoId", wrongQuestions[2].resourcesCompetitionId()); ResourcesCompetitionQuery resourcesCompetitionQuery = new ResourcesCompetitionQuery(); resourcesCompetitionQuery.setResourcesCompetitionId(resourcesCompetitionId); List resourcesCompetitionList = resourcesCompetitionService.getValuesByQuery(resourcesCompetitionQuery); - for(int i=0;imap = new HashMap<>(); + Map map = new HashMap<>(); - map.put("headImg",student.getHeadImg()); - map.put("studentName",student.getStudentName()); + map.put("headImg", student.getHeadImg()); + map.put("studentName", student.getStudentName()); - WrongQuestion[] wrongQuestions = wrongQuestionService.getSurroundWrongInfo(student.getStudentId(),null,resourcesTrainingId); + WrongQuestion[] wrongQuestions = wrongQuestionService.getSurroundWrongInfo(student.getStudentId(), null, resourcesTrainingId); //上一个章节ID - map.put("backWrongInfoId",wrongQuestions[0].resourcesTrainingId()); + map.put("backWrongInfoId", wrongQuestions[0].resourcesTrainingId()); //下一个章节ID - map.put("nextWrongInfoId",wrongQuestions[2].resourcesTrainingId()); + map.put("nextWrongInfoId", wrongQuestions[2].resourcesTrainingId()); ResourcesTrainingQuery resourcesTrainingQuery = new ResourcesTrainingQuery(); resourcesTrainingQuery.setResourcesTrainingId(resourcesTrainingId); List resourcesTrainingList = resourcesTrainingService.getValuesByQuery(resourcesTrainingQuery); - for(int i=0;i universitiesCollegesList = universitiesCollegesService.getValues(universitiesColleges); - if(universitiesCollegesList.size() > 0){ + if (universitiesCollegesList.size() > 0) { universitiesColleges = universitiesCollegesList.get(0); view.addObject("universitiesCollegesId", universitiesColleges.getUniversitiesCollegesId()); - }else { + } else { view.addObject("universitiesCollegesId", null); } - view.addObject("beTeacher",null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?1:2);//是否是教师 1是 2否 + view.addObject("beTeacher", null != coreUser && "JT_S_02".equals(coreUser.getJobType1()) ? 1 : 2);//是否是教师 1是 2否 return view; } @@ -2085,8 +2133,7 @@ public class StudentController extends BaseController{ ModelAndView view = new ModelAndView("/jlw/student/importPage.html"); if (coreUser.isUniAdmin()) { view.addObject("uploadFileUrl", "/jlw/student/uniAdminImportBatchTemplate.json"); - } - else if(coreUser.isAdmin()) { + } else if (coreUser.isAdmin()) { view.addObject("uploadFileUrl", "/jlw/student/adminImportBatchTemplate.json"); } @@ -2100,29 +2147,30 @@ public class StudentController extends BaseController{ @Function("student.query") @ResponseBody @ApiOperation("分页列表") - public JsonResult list(StudentQuery condition,@SCoreUser CoreUser coreUser,@RequestReferer String referer){ - if(null == coreUser){ + public JsonResult list(StudentQuery condition, @SCoreUser CoreUser coreUser, @RequestReferer String referer) { + if (null == coreUser) { return JsonResult.failMessage("请登录后再操作"); } - condition.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?coreUser.getOrgId():null); + condition.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1()) ? coreUser.getOrgId() : null); - if(null == condition.getStudentStatus() && StringUtils.isBlank(condition.getStudentStatuses())){ + if (null == condition.getStudentStatus() && StringUtils.isBlank(condition.getStudentStatuses())) { condition.setStudentStatus(1); } List ctList = new ArrayList<>(); - if(StringUtils.isNotBlank(condition.getStudentTempJson())){ + if (StringUtils.isNotBlank(condition.getStudentTempJson())) { String tempStudentIds = ""; try { ctList = JSON.parseArray(condition.getStudentTempJson(), StudentQuery.StudentTemp.class); } catch (Exception e) { try { ctList.add(JSONObject.parseObject(condition.getStudentTempJson(), StudentQuery.StudentTemp.class)); - } catch (Exception e1) {} + } catch (Exception e1) { + } } ToolUtils.deleteNullList(ctList); - for(int i=0;null != ctList && i jsonResultMap = new HashMap<>(); + Map jsonResultMap = new HashMap<>(); - if(null != condition.getCompetitionId() && ((Integer)1).equals(condition.getBeCompetitionStudent())){ + if (null != condition.getCompetitionId() && ((Integer) 1).equals(condition.getBeCompetitionStudent())) { Competition competition = competitionService.getById(condition.getCompetitionId()); - jsonResultMap.put("classIds",competition.getClassIds()); - jsonResultMap.put("excludedStudentIds",competition.getExcludedStudentIds()); + jsonResultMap.put("classIds", competition.getClassIds()); + jsonResultMap.put("excludedStudentIds", competition.getExcludedStudentIds()); CompetitionStudentsQuery competitionStudentsQuery = new CompetitionStudentsQuery(); competitionStudentsQuery.setCompetitionId(condition.getCompetitionId()); - if(((Integer)1).equals(competition.getCompetitionType())){ - Mapmap = new HashMap<>(); - if(null != ctList && ctList.size()>0){ }else { + if (((Integer) 1).equals(competition.getCompetitionType())) { + Map map = new HashMap<>(); + if (null != ctList && ctList.size() > 0) { + } else { List competitionStudentsList = competitionStudentsService.getCompetitionPersonalInfo(competitionStudentsQuery); - for(int i=0;null != competitionStudentsList && imap = new HashMap<>(); - if(null != ctList && ctList.size()>0){ }else { + jsonResultMap.put("studentTempMap", map); + } else if (((Integer) 2).equals(competition.getCompetitionType())) { + Map map = new HashMap<>(); + if (null != ctList && ctList.size() > 0) { + } else { List competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery); - for(int i=0;null != competitionStudentsList && imap = new HashMap<>(); - if(null != ctList && ctList.size()>0){ }else { + if (null != condition.getExamId() && ((Integer) 1).equals(condition.getBeExamStudent())) { + Map map = new HashMap<>(); + if (null != ctList && ctList.size() > 0) { + } else { ExamStudentsQuery examStudentsQuery = new ExamStudentsQuery(); examStudentsQuery.setExamId(condition.getExamId()); List examStudentsList = examStudentsService.getExamInfo(examStudentsQuery); - for(int i=0;null != examStudentsList && i pageQuery = studentService.queryByCondition(page); List list = pageQuery.getList(); @@ -2254,11 +2306,17 @@ public class StudentController extends BaseController{ @Function("student.add") @ResponseBody @ApiOperation("添加") - public JsonResult add(@Validated(ValidateConfig.ADD.class)Student student, BindingResult result){ - if(result.hasErrors()){ + public JsonResult add(@Validated(ValidateConfig.ADD.class) Student student, BindingResult result) throws JsonProcessingException { + if (result.hasErrors()) { return JsonResult.failMessage(result); - }else{ + } else { student.setCodeFrom("后台新增"); + Long schoolId = student.getSchoolClass().getUniversitiesCollegesId(); + ZYUserInfo info = new + ZYUserInfo( + coreUserService.getUserInfoByUsername(student.getStudentSn())); + List applications = universitiesCollegesJurisdictionExperimentalSystemService.getAllApplicationIdBySchoolId(schoolId); + SubsystemUserUtil.subsystemUserCreate(Arrays.asList(info),applications); return studentService.add(student); } } @@ -2267,10 +2325,10 @@ public class StudentController extends BaseController{ @Function("student.edit") @ResponseBody @ApiOperation("编辑") - public JsonResult edit(@Validated(ValidateConfig.UPDATE.class) Student student, BindingResult result) { - if(result.hasErrors()){ + public JsonResult edit(@Validated(ValidateConfig.UPDATE.class) Student student, BindingResult result) { + if (result.hasErrors()) { return JsonResult.failMessage(result); - }else { + } else { student.setAddTime(null); student.setUserId(null); student.setOrgId(null); @@ -2294,10 +2352,10 @@ public class StudentController extends BaseController{ @Function("teacher.edit") @ResponseBody @ApiOperation("初始化密码") - public JsonResult initPassword(@Validated(ValidateConfig.UPDATE.class) Student student, BindingResult result) { - if(result.hasErrors()){ + public JsonResult initPassword(@Validated(ValidateConfig.UPDATE.class) Student student, BindingResult result) { + if (result.hasErrors()) { return JsonResult.failMessage(result); - }else { + } else { boolean success = studentService.initPassword(student); if (success) { return JsonResult.success(); @@ -2311,27 +2369,27 @@ public class StudentController extends BaseController{ @Function("student.query") @ResponseBody @ApiOperation("根据ID获取数据") - public JsonResultqueryInfo(Long studentId) { - Student student = studentService.queryById( studentId); - return JsonResult.success(student); + public JsonResult queryInfo(Long studentId) { + Student student = studentService.queryById(studentId); + return JsonResult.success(student); } @GetMapping(MODEL + "/getValues.json") @ResponseBody @ApiOperation("列表") - public JsonResult>getValues(StudentQuery param) { - Listlist = studentService.getValuesByQuery(param); - return JsonResult.success(list); + public JsonResult> getValues(StudentQuery param) { + List list = studentService.getValuesByQuery(param); + return JsonResult.success(list); } @PostMapping(API + "/getPageList.do") @ResponseBody @ApiOperation("分页列表") - public JsonResult getPageList(StudentQuery condition, @SCoreUser CoreUser coreUser){ - if(null == coreUser){ + public JsonResult getPageList(StudentQuery condition, @SCoreUser CoreUser coreUser) { + if (null == coreUser) { return JsonResult.failMessage("请登录后再操作"); - }else{ + } else { condition.setStudentStatus(1); PageQuery page = condition.getPageQuery(); studentService.queryByConditionQuery(page); @@ -2382,20 +2440,20 @@ public class StudentController extends BaseController{ @Function("student.query") @ResponseBody @ApiOperation("学生登录日志") - public JsonResult logList(StudentQuery condition,@SCoreUser CoreUser coreUser){ + public JsonResult logList(StudentQuery condition, @SCoreUser CoreUser coreUser) { condition.setLog(1); - condition.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?coreUser.getOrgId():null); + condition.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1()) ? coreUser.getOrgId() : null); - if(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())){ - UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther(); - if(null != uSystem && ((Integer)1).equals(uSystem.getType())){ + if (null != coreUser && "JT_S_02".equals(coreUser.getJobType1())) { + UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem) platformService.getOther(); + if (null != uSystem && ((Integer) 1).equals(uSystem.getType())) { condition.setResourcesApplicationId(uSystem.getTypeId()); } } - if(null == condition.getStudentStatus()){ + if (null == condition.getStudentStatus()) { condition.setStudentStatus(1); } @@ -2419,14 +2477,14 @@ public class StudentController extends BaseController{ @Function("student.query") @ResponseBody @ApiOperation("登录日志") - public JsonResult studentLoginLogList(StudentLoginLogQuery condition, @SCoreUser CoreUser coreUser){ + public JsonResult studentLoginLogList(StudentLoginLogQuery condition, @SCoreUser CoreUser coreUser) { Assert.isFalse(coreUser.isStudent(), "暂无权限访问!"); condition.setLoginPath(ResponseControllerAdvice.LOGIN_URL); condition.setLogoutPath(KeyExpiredListener.TOKEN_EXPIRED_MESSAGE); - if (!Objects.isNull(condition.getLoginStartTime())){ + if (!Objects.isNull(condition.getLoginStartTime())) { condition.setLoginStartTime(DateUtil.beginOfDay(condition.getLoginStartTime())); } - if (!Objects.isNull(condition.getLoginEndTime())){ + if (!Objects.isNull(condition.getLoginEndTime())) { condition.setLoginEndTime(DateUtil.endOfDay(condition.getLoginEndTime())); } // return JsonResult.success(studentService.queryStudentLoginLogByCondition(condition.getPageQuery())); @@ -2449,13 +2507,14 @@ public class StudentController extends BaseController{ Assert.isFalse(coreUser.isStudent(), "暂无权限访问!"); condition.setLoginPath(ResponseControllerAdvice.LOGIN_URL); condition.setLogoutPath(KeyExpiredListener.TOKEN_EXPIRED_MESSAGE); - if (!Objects.isNull(condition.getLoginStartTime())){ + if (!Objects.isNull(condition.getLoginStartTime())) { condition.setLoginStartTime(DateUtil.beginOfDay(condition.getLoginStartTime())); } - if (!Objects.isNull(condition.getLoginEndTime())){ + if (!Objects.isNull(condition.getLoginEndTime())) { condition.setLoginEndTime(DateUtil.endOfDay(condition.getLoginEndTime())); } - condition.setPage(1); condition.setLimit(Integer.MAX_VALUE + 0L); + condition.setPage(1); + condition.setLimit(Integer.MAX_VALUE + 0L); // PageQuery page = studentService.queryStudentLoginLogByCondition(condition.getPageQuery()); PageQuery page = studentService.queryUserLoginLogByCondition(condition.getPageQuery()); @@ -2478,7 +2537,7 @@ public class StudentController extends BaseController{ @Function("student.query") @ResponseBody @ApiOperation("学生使用日志") - public JsonResult studentUseLogList(StudentUseLogQuery condition, @SCoreUser CoreUser coreUser){ + public JsonResult studentUseLogList(StudentUseLogQuery condition, @SCoreUser CoreUser coreUser) { Assert.isFalse(coreUser.isStudent(), "暂无权限访问!"); return JsonResult.success(studentService.queryStudentUseLogByCondition(condition.getPageQuery())); } @@ -2498,7 +2557,8 @@ public class StudentController extends BaseController{ public String studentUseLogListExport(StudentUseLogQuery condition, @SCoreUser CoreUser coreUser) throws IOException { Assert.isFalse(coreUser.isStudent(), "暂无权限访问!"); - condition.setPage(1); condition.setLimit(Integer.MAX_VALUE + 0L); + condition.setPage(1); + condition.setLimit(Integer.MAX_VALUE + 0L); PageQuery page = studentService.queryStudentUseLogByCondition(condition.getPageQuery()); String filename = StrUtil.format("学生使用日志导出{}.xlsx", System.currentTimeMillis()); @@ -2520,14 +2580,14 @@ public class StudentController extends BaseController{ @Function("student.query") @ResponseBody @ApiOperation("学生日志,统计报表") - public JsonResult studentLogAnalysisList(StudentLogAnalysisQuery condition, @SCoreUser CoreUser coreUser){ + public JsonResult studentLogAnalysisList(StudentLogAnalysisQuery condition, @SCoreUser CoreUser coreUser) { Assert.isFalse(coreUser.isStudent(), "暂无权限访问!"); condition.setLoginPath(ResponseControllerAdvice.LOGIN_URL); condition.setLogoutPath(KeyExpiredListener.TOKEN_EXPIRED_MESSAGE); - if (!Objects.isNull(condition.getLoginStartTime())){ + if (!Objects.isNull(condition.getLoginStartTime())) { condition.setLoginStartTime(DateUtil.beginOfDay(condition.getLoginStartTime())); } - if (!Objects.isNull(condition.getLoginEndTime())){ + if (!Objects.isNull(condition.getLoginEndTime())) { condition.setLoginEndTime(DateUtil.endOfDay(condition.getLoginEndTime())); } // return JsonResult.success(studentService.queryStudentLogAnalysisByCondition(condition.getPageQuery())); @@ -2552,13 +2612,14 @@ public class StudentController extends BaseController{ Assert.isFalse(coreUser.isStudent(), "暂无权限访问!"); condition.setLoginPath(ResponseControllerAdvice.LOGIN_URL); condition.setLogoutPath(KeyExpiredListener.TOKEN_EXPIRED_MESSAGE); - if (!Objects.isNull(condition.getLoginStartTime())){ + if (!Objects.isNull(condition.getLoginStartTime())) { condition.setLoginStartTime(DateUtil.beginOfDay(condition.getLoginStartTime())); } - if (!Objects.isNull(condition.getLoginEndTime())){ + if (!Objects.isNull(condition.getLoginEndTime())) { condition.setLoginEndTime(DateUtil.endOfDay(condition.getLoginEndTime())); } - condition.setPage(1); condition.setLimit(Integer.MAX_VALUE + 0L); + condition.setPage(1); + condition.setLimit(Integer.MAX_VALUE + 0L); // PageQuery page = studentService.queryStudentLogAnalysisByCondition(condition.getPageQuery()); PageQuery page = studentService.queryStatisticalStatementNumberPeopleByCondition(condition.getPageQuery()); @@ -2575,13 +2636,13 @@ public class StudentController extends BaseController{ XSSFWorkbook workbook = null; InputStream is = null; try { - is = new FileInputStream(GetFile.p + File.separator +"filesystem"+ File.separator +"template"+ File.separator+ "学生导入模板.xlsx"); + is = new FileInputStream(GetFile.p + File.separator + "filesystem" + File.separator + "template" + File.separator + "学生导入模板.xlsx"); workbook = new XSSFWorkbook(is); UniversitiesColleges universitiesColleges = new UniversitiesColleges(); universitiesColleges.setUniversitiesCollegesStatus(1); - if("JT_S_02".equals(coreUser.getJobType1())){//老师 + if ("JT_S_02".equals(coreUser.getJobType1())) {//老师 universitiesColleges.setOrgId(coreUser.getOrgId()); } List universitiesCollegesList = universitiesCollegesService.getValues(universitiesColleges); @@ -2592,8 +2653,8 @@ public class StudentController extends BaseController{ // 查询所有的大学的名称 List universitiesCollegesArr = new ArrayList(); Map> map = new HashMap>(); - if(null != universitiesCollegesList && universitiesCollegesList.size()>0){ - for(int i=0;i 0) { + for (int i = 0; i < universitiesCollegesList.size(); i++) { String universitiesCollegesName = universitiesCollegesList.get(i).getUniversitiesCollegesName(); universitiesCollegesName = standardName(universitiesCollegesName); // key不可重复 @@ -2602,14 +2663,14 @@ public class StudentController extends BaseController{ // 整理数据,放入一个Map中,mapkey存放父地点,value 存放院校下的班级 Object classNameId = universitiesCollegesList.get(i).get("classNameId"); - if(null != classNameId && StringUtils.isNotBlank(classNameId.toString())){ - map.put(universitiesCollegesName,Arrays.asList(classNameId.toString().split(",")) ); - }else { - map.put(universitiesCollegesName,new ArrayList<>()); + if (null != classNameId && StringUtils.isNotBlank(classNameId.toString())) { + map.put(universitiesCollegesName, Arrays.asList(classNameId.toString().split(","))); + } else { + map.put(universitiesCollegesName, new ArrayList<>()); } } - }else { + } else { throw new PlatformException("请先添加院校"); } @@ -2635,7 +2696,7 @@ public class StudentController extends BaseController{ Row row = hideSheet.createRow(rowId++); row.createCell(0).setCellValue(key); for (int i = 0; i < son.size(); i++) { - Cell cell = row.createCell(i+1); + Cell cell = row.createCell(i + 1); cell.setCellValue(son.get(i)); } // 添加名称管理器 @@ -2653,8 +2714,8 @@ public class StudentController extends BaseController{ // provinceDataValidation.createErrorBox("error", "请选择正确的院校"); // sheetPro.addValidationData(provinceDataValidation); - XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper((XSSFSheet)sheetPro); - XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint) dvHelper.createExplicitListConstraint(universitiesCollegesArr.toArray(new String[] {})); + XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper((XSSFSheet) sheetPro); + XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint) dvHelper.createExplicitListConstraint(universitiesCollegesArr.toArray(new String[]{})); CellRangeAddressList addressList = new CellRangeAddressList(1, 20, 0, 0); XSSFDataValidation validation = (XSSFDataValidation) dvHelper.createValidation(dvConstraint, addressList); validation.createErrorBox("error", "请选择正确的院校"); @@ -2666,10 +2727,10 @@ public class StudentController extends BaseController{ } try { - if(null != is){ + if (null != is) { is.close(); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } @@ -2685,7 +2746,7 @@ public class StudentController extends BaseController{ //workbook将Excel写入到response的输出流中,供页面下载 workbook.write(response.getOutputStream()); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } finally { try { @@ -2695,12 +2756,14 @@ public class StudentController extends BaseController{ if (null != response && null != response.getOutputStream()) { response.getOutputStream().close(); } - } catch (Exception e) { } + } catch (Exception e) { + } } } /** * 设置有效性 + * * @param offset 主影响单元格所在列,即此单元格由哪个单元格影响联动 * @param sheet * @param rowNum 行数 @@ -2718,7 +2781,7 @@ public class StudentController extends BaseController{ // cacse.createErrorBox("error", "请选择正确的班级"); // sheet.addValidationData(cacse); - XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper((XSSFSheet)sheet); + XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper((XSSFSheet) sheet); XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint) dvHelper.createFormulaListConstraint("INDIRECT($" + offset + "$" + rowNum + ")"); int firstRow = rowNum - 1; int lastRow = rowNum - 1; @@ -2733,21 +2796,22 @@ public class StudentController extends BaseController{ /** * 添加数据有效性检查. - * @param sheet 要添加此检查的Sheet - * @param firstRow 开始行 - * @param lastRow 结束行 - * @param firstCol 开始列 - * @param lastCol 结束列 + * + * @param sheet 要添加此检查的Sheet + * @param firstRow 开始行 + * @param lastRow 结束行 + * @param firstCol 开始列 + * @param lastCol 结束列 * @param explicitListValues 有效性检查的下拉列表 * @throws IllegalArgumentException 如果传入的行或者列小于0(< 0)或者结束行/列比开始行/列小 */ - public static void setValidationData(Sheet sheet, int firstRow, int lastRow, - int firstCol, int lastCol,String[] explicitListValues) throws IllegalArgumentException{ + public static void setValidationData(Sheet sheet, int firstRow, int lastRow, + int firstCol, int lastCol, String[] explicitListValues) throws IllegalArgumentException { if (firstRow < 0 || lastRow < 0 || firstCol < 0 || lastCol < 0 || lastRow < firstRow || lastCol < firstCol) { - throw new IllegalArgumentException("Wrong Row or Column index : " + firstRow+":"+lastRow+":"+firstCol+":" +lastCol); + throw new IllegalArgumentException("Wrong Row or Column index : " + firstRow + ":" + lastRow + ":" + firstCol + ":" + lastCol); } if (sheet instanceof XSSFSheet) { - XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper((XSSFSheet)sheet); + XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper((XSSFSheet) sheet); XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint) dvHelper .createExplicitListConstraint(explicitListValues); CellRangeAddressList addressList = new CellRangeAddressList(firstRow, lastRow, firstCol, lastCol); @@ -2755,7 +2819,7 @@ public class StudentController extends BaseController{ validation.setSuppressDropDownArrow(true); validation.setShowErrorBox(true); sheet.addValidationData(validation); - } else if(sheet instanceof HSSFSheet){ + } else if (sheet instanceof HSSFSheet) { CellRangeAddressList addressList = new CellRangeAddressList(firstRow, lastRow, firstCol, lastCol); DVConstraint dvConstraint = DVConstraint.createExplicitListConstraint(explicitListValues); DataValidation validation = new HSSFDataValidation(addressList, dvConstraint); @@ -2766,12 +2830,12 @@ public class StudentController extends BaseController{ } /** - * 计算formula - * @param offset 偏移量,如果给0,表示从A列开始,1,就是从B列 - * @param rowId 第几行 + * 计算formula + * + * @param offset 偏移量,如果给0,表示从A列开始,1,就是从B列 + * @param rowId 第几行 * @param colCount 一共多少列 * @return 如果给入参 1,1,10. 表示从B1-K1。最终返回 $B$1:$K$1 - * */ public static String getRange(int offset, int rowId, int colCount) { char start = (char) ('A' + offset); @@ -2805,13 +2869,13 @@ public class StudentController extends BaseController{ @ResponseBody @ApiOperation("导入模板信息") public JsonResult importTemplate(@RFile FileEntity fileEntity) { - ListdelList=new ArrayList<>(); - Listlist=new ArrayList<>(); - JsonResult jsonResult = studentService.importTemplate(fileEntity,delList,list); - if(delList.size()>0){ + List delList = new ArrayList<>(); + List list = new ArrayList<>(); + JsonResult jsonResult = studentService.importTemplate(fileEntity, delList, list); + if (delList.size() > 0) { studentService.deleteByList(delList); } - if(list.size()== 1 && StringUtils.isNotBlank(list.get(0))){ + if (list.size() == 1 && StringUtils.isNotBlank(list.get(0))) { updateByIds(list.get(0));//更新缓存 } return jsonResult; @@ -2821,12 +2885,12 @@ public class StudentController extends BaseController{ @GetMapping(MODEL + "/export1.json") @ResponseBody @ApiOperation("导出信息") - public void export(HttpServletResponse response,StudentQuery studentQuery) { + public void export(HttpServletResponse response, StudentQuery studentQuery) { HSSFWorkbook workbook = null; try { //表头数据 String[] header = {"班级名称", "学生姓名", "学号", "电话", "邮箱"}; - String[] headerCode = {"className","studentName", "studentSn", "studentMobile", "studentEmail"}; + String[] headerCode = {"className", "studentName", "studentSn", "studentMobile", "studentEmail"}; //数据内容 List> mapList = studentService.getExcelValues(studentQuery); @@ -2872,7 +2936,7 @@ public class StudentController extends BaseController{ //设置表格特定的列宽度 if (null != widthMap.get(headerCode[i])) { String width = widthMap.get(headerCode[i]).toString().split("\\.")[0]; - Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3; + Integer w = Integer.parseInt(width) > header[i].length() * 3 ? Integer.parseInt(width) : header[i].length() * 3; sheet.setColumnWidth(i, w * 190); } @@ -2893,7 +2957,7 @@ public class StudentController extends BaseController{ for (int i = 0; i < mapList.size(); i++) { HSSFRow row = sheet.createRow(i + 1); - row.setHeight((short) (50*10)); + row.setHeight((short) (50 * 10)); Map map = mapList.get(i); for (int j = 0; j < headerCode.length; j++) { @@ -2917,7 +2981,7 @@ public class StudentController extends BaseController{ //workbook将Excel写入到response的输出流中,供页面下载 workbook.write(response.getOutputStream()); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } finally { try { @@ -2927,16 +2991,18 @@ public class StudentController extends BaseController{ if (null != response && null != response.getOutputStream()) { response.getOutputStream().close(); } - } catch (Exception e) { } + } catch (Exception e) { + } } } /** * 导出批量模板 + * * @return */ @SneakyThrows - @GetMapping({ API + "/exportBatchTemplate.do", MODEL + "/downloadTemplate.json" }) + @GetMapping({API + "/exportBatchTemplate.do", MODEL + "/downloadTemplate.json"}) @ResponseBody @ApiOperation("导出批量模板") public void exportBatchTemplate(@SCoreUser CoreUser coreUser) { @@ -2948,8 +3014,7 @@ public class StudentController extends BaseController{ if (coreUser.isAdmin()) { // 输出 Excel createExcel(Arrays.asList(new StudentBatchImportAdminDTO()), response.getOutputStream()); - } - else if(coreUser.isUniAdmin()) { + } else if (coreUser.isUniAdmin()) { // 输出 Excel createExcel(Arrays.asList(new StudentBatchImportUniAdminDTO()), response.getOutputStream()); } @@ -2960,8 +3025,9 @@ public class StudentController extends BaseController{ /** * 功能描述:
* 〈导入批量模板数据〉 + * * @param file - * @param coreUser 一般这个接口都是学校管理员操作的,所以直接取这个里面的机构ID就代表这个学校的机构ID + * @param coreUser 一般这个接口都是学校管理员操作的,所以直接取这个里面的机构ID就代表这个学校的机构ID * @return {@link JsonResult} * @Author: 87966 * @Date: 2022/11/28 10:04 @@ -3044,7 +3110,7 @@ public class StudentController extends BaseController{ } return null; }, true); - }catch (Exception e) { + } catch (Exception e) { log.error(e.getMessage()); } @@ -3052,22 +3118,32 @@ public class StudentController extends BaseController{ // 再次判断错误的结果集 Assert.isTrue(CollectionUtil.isEmpty(listener.getFailMessage()), JSONUtil.toJsonStr(listener.getFailMessage())); - // 导入并添加身份信息 - list.forEach(studentService::add); + List zyUserInfos = new ArrayList<>(); + Long schoolId = list.get(0).getSchoolClass().getUniversitiesCollegesId(); + for (Student student : list) { + studentService.add(student); + zyUserInfos.add(new + ZYUserInfo( + coreUserService.getUserInfoByUsername(student.getStudentSn()) + )); + } + List applications = universitiesCollegesJurisdictionExperimentalSystemService.getAllApplicationIdBySchoolId(schoolId); + SubsystemUserUtil.subsystemUserCreate(zyUserInfos,applications); platformService.clearDictCache(); - } - catch (IllegalArgumentException exception) { + } catch (IllegalArgumentException exception) { return JsonResult.failMessage(exception.getMessage()).setCode(DIY_ERROR.getCode()); } return JsonResult.successMessage("导入成功!"); } + /** * 功能描述:
* 〈导入批量模板数据〉 - * 批量导入题目 excel版本,只支持单选多选,对错吧 + * 批量导入题目 excel版本,只支持单选多选,对错吧 + * * @param file - * @param coreUser 超管的身份,不能直接用 + * @param coreUser 超管的身份,不能直接用 * @return {@link JsonResult} * @Author: 87966 * @Date: 2022/11/28 10:04 @@ -3123,7 +3199,7 @@ public class StudentController extends BaseController{ } return null; }, true); - }catch (Exception e) { + } catch (Exception e) { log.error(e.getMessage()); } @@ -3134,8 +3210,7 @@ public class StudentController extends BaseController{ // 导入并添加身份信息 list.forEach(studentService::add); platformService.clearDictCache(); - } - catch (IllegalArgumentException exception) { + } catch (IllegalArgumentException exception) { return JsonResult.failMessage(exception.getMessage()).setCode(DIY_ERROR.getCode()); } @@ -3144,6 +3219,7 @@ public class StudentController extends BaseController{ /** * 消费并记录错误信息 + * * @param t * @param tConsumer * @param listener @@ -3151,7 +3227,7 @@ public class StudentController extends BaseController{ private void consumerPutErrorMessage(Object t, Consumer tConsumer, MyValidateExcelCellDataListener listener) { try { tConsumer.accept(t); - }catch (Exception e) { + } catch (Exception e) { listener.putFailMessage(e.getMessage()); } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/TestController.java b/web/src/main/java/com/ibeetl/jlw/web/TestController.java index 6f8397e6..dea06ca4 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TestController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TestController.java @@ -16,6 +16,7 @@ import com.ibeetl.jlw.entity.dto.CreateUserDTO; import com.ibeetl.jlw.enums.AccountTypeEnum; import com.ibeetl.jlw.enums.GenderEnum; import com.ibeetl.jlw.service.*; +import com.ibeetl.jlw.util.HttpUtil; import com.ibeetl.jlw.util.ZhiYunJDBCUtil; import com.ibeetl.jlw.web.query.*; import io.swagger.annotations.Api; @@ -38,7 +39,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import static com.ibeetl.jlw.service.StudentAccountAssetAllocationService.sendPostRequest; @Api(tags = "数据迁移") @RestController @@ -517,7 +517,7 @@ public class TestController { " JOIN EduMajors maj ON stu.MajorId = maj.Id " + " JOIN EduSchools sch ON stu.SchoolId = sch.Id " + " JOIN EduClasses cla ON stu.ClassId = cla.Id" + - " join EduUsers us on stu.StudentNo = us.UserName where stu.isdeleted=0"; + " join EduUsers us on stu.StudentNo = us.UserName where stu.isdeleted=0 "; ps = conn.prepareStatement(sql); ResultSet resultSet = ps.executeQuery(); int i = 0; @@ -1629,7 +1629,7 @@ public class TestController { "&majorName=" + majorName + "&studentNumber=" + studentNumber + "&initialCapital=" + initialCapital; - String result = sendPostRequest("http://localhost:8801/account/checkOrCreateForexSimulationUser", postData); + String result = HttpUtil.sendPostRequest("http://localhost:8801/account/checkOrCreateForexSimulationUser", postData); // 使用 Gson 将 JSON 字符串解析为一个 Map 对象 Type type = new TypeToken>() { }.getType(); @@ -1655,4 +1655,23 @@ public class TestController { } } } + + @ApiOperation("去除用户名空格") + @PostMapping("removeNameSpace") + public void removeNameSpace(Long classId) { + StudentQuery q = new StudentQuery(); + q.setClassId(classId); + List students = studentService.getValuesByQuery(q) ; + if (students != null && students.size() > 0) { + for (Student student : students) { + CoreUser coreUser = coreUserService.getUserById(student.getUserId()); + if (coreUser != null) { + coreUser.setCode(coreUser.getCode().replaceAll("\\D+", "")); + coreUserService.updateTemplateById(coreUser); + } + student.setStudentSn(student.getStudentSn().replaceAll("\\D+", "")); + studentService.updateTemplate(student); + } + } + } } \ No newline at end of file diff --git a/web/src/main/resources/application.properties b/web/src/main/resources/application.properties index e87cf655..0136e046 100644 --- a/web/src/main/resources/application.properties +++ b/web/src/main/resources/application.properties @@ -137,4 +137,7 @@ logistics.customer = 90F883EF5EB30F659B5B44173E01C8A6 # vue \u9884\u89C8url vue_next_home=http://localhost:10000/jlw/next-home -vue_next_goods_filter_prefix=http://localhost:10000/jlw/next-goodsList?exhibitionType=1&exhibitionId= \ No newline at end of file +vue_next_goods_filter_prefix=http://localhost:10000/jlw/next-goodsList?exhibitionType=1&exhibitionId= + +PEVC_USER_INSERT_API_URL="http://localhost:61814/account/saveNewUsersFromZhiyunPlatform" +MNJY_USER_INSERT_API_URL="http://localhost:61759/account/saveNewUsersFromZhiyunPlatform" \ No newline at end of file diff --git a/web/src/main/resources/sql/jlw/resourcesApplication.md b/web/src/main/resources/sql/jlw/resourcesApplication.md index 2838d362..772661df 100644 --- a/web/src/main/resources/sql/jlw/resourcesApplication.md +++ b/web/src/main/resources/sql/jlw/resourcesApplication.md @@ -301,4 +301,12 @@ getValuesByQuery @} @if(!isEmpty(linkSecretKey)){ and t.link_secret_key =#linkSecretKey# - @} \ No newline at end of file + @} + +logicPicture +=== +select module_name,module_order as 'order' from stu_logic_picture_info group by module_name,module_order + +logicPictureByName +=== +select name_info, redirect_url, authority_info, sequencys as 'order', module_name, module_order from stu_logic_picture_info where module_name=#name# ORDER BY module_order ASC ,sequencys ASC \ No newline at end of file diff --git a/web/src/main/resources/sql/jlw/universitiesCollegesJurisdictionExperimentalSystem.md b/web/src/main/resources/sql/jlw/universitiesCollegesJurisdictionExperimentalSystem.md index 8d41eab9..56691eb9 100644 --- a/web/src/main/resources/sql/jlw/universitiesCollegesJurisdictionExperimentalSystem.md +++ b/web/src/main/resources/sql/jlw/universitiesCollegesJurisdictionExperimentalSystem.md @@ -267,4 +267,11 @@ AND a.use_end_time >= NOW() forexSimulationTradingAuthorizationSchoolDataInterface === -select * from universities_colleges_jurisdiction_experimental_system where type_id=113 \ No newline at end of file +select * from universities_colleges_jurisdiction_experimental_system where type_id=113 + + +getAllApplicationIdBySchoolId +=== +select ra.application_second_level_relation +from universities_colleges_jurisdiction_experimental_system ues join resources_application ra on ues.type_id = ra.resources_application_id +where universities_colleges_id =#schoolId#; \ No newline at end of file