@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse ;
import javax.servlet.http.HttpServletResponse ;
import java.io.InputStream ;
import java.io.InputStream ;
import java.util.* ;
import java.util.* ;
@Slf4j
@Slf4j
@Service
@Service
public class AchievementManagementServiceImpl extends ServiceImpl < AchievementManagementDao , ExperimentalReportEntity > implements AchievementManagementService {
public class AchievementManagementServiceImpl extends ServiceImpl < AchievementManagementDao , ExperimentalReportEntity > implements AchievementManagementService {
@ -58,39 +59,39 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
experimentalReportEntity . setReportId ( reportId ) ;
experimentalReportEntity . setReportId ( reportId ) ;
ExperimentalReportEntity experimentalReportEntity1 = baseMapper . getReport ( experimentalReportEntity ) ;
ExperimentalReportEntity experimentalReportEntity1 = baseMapper . getReport ( experimentalReportEntity ) ;
List < UserScoreVO > score = baseMapper . getScore ( userScoreVO ) ;
List < UserScoreVO > score = baseMapper . getScore ( userScoreVO ) ;
obj . put ( "score" , score ) ;
obj . put ( "score" , score ) ;
obj . put ( "experimentalReportEntity" , experimentalReportEntity1 ) ;
obj . put ( "experimentalReportEntity" , experimentalReportEntity1 ) ;
List < Integer > tradingJudgmentPointsIds = baseMapper . queryTradingJudgmentPointsId ( reportId ) ;
List < Integer > tradingJudgmentPointsIds = baseMapper . queryTradingJudgmentPointsId ( reportId ) ;
Integer size = tradingJudgmentPointsIds . size ( ) ;
Integer size = tradingJudgmentPointsIds . size ( ) ;
for ( int i = 0 ; i < size ; i + + ) {
for ( int i = 0 ; i < size ; i + + ) {
Integer tradingJudgmentPointsId = tradingJudgmentPointsIds . get ( i ) ;
Integer tradingJudgmentPointsId = tradingJudgmentPointsIds . get ( i ) ;
List < JudgmentPointsRuleVO > judgmentPointsRuleList = baseMapper . getUserAnswers ( tradingJudgmentPointsId ) ;
List < JudgmentPointsRuleVO > judgmentPointsRuleList = baseMapper . getUserAnswers ( tradingJudgmentPointsId ) ;
map . put ( "judgmentPointsRuleList" + i , judgmentPointsRuleList ) ;
map . put ( "judgmentPointsRuleList" + i , judgmentPointsRuleList ) ;
}
}
obj . put ( "userAnswersList" , map ) ;
obj . put ( "userAnswersList" , map ) ;
return R . ok ( ) . put ( "data" , obj ) ;
return R . ok ( ) . put ( "data" , obj ) ;
}
}
@Override
@Override
public R getTeacher ( Integer projectId ) {
public R getTeacher ( Integer projectId ) {
String name = baseMapper . getTeacher ( projectId ) ;
String name = baseMapper . getTeacher ( projectId ) ;
return R . ok ( ) . put ( "name" , name ) ;
return R . ok ( ) . put ( "name" , name ) ;
}
}
@Override
@Override
public List < ResultsEntity > list ( ResultsVo vo , Integer page , Integer size ) {
public List < ResultsEntity > list ( ResultsVo vo , Integer page , Integer size ) {
List < ResultsEntity > list = achievementManagementDao . list ( vo ) ;
List < ResultsEntity > list = achievementManagementDao . list ( vo ) ;
return list ;
return list ;
}
}
@Override
@Override
public List < ReportEntity > reportList ( ResultsVo vo , Integer page , Integer size ) {
public List < ReportEntity > reportList ( ResultsVo vo , Integer page , Integer size ) {
List < ReportEntity > reportList = achievementManagementDao . reportList ( vo ) ;
List < ReportEntity > reportList = achievementManagementDao . reportList ( vo ) ;
return reportList ;
return reportList ;
}
}
@Override
@Override
public List < ResultsEntity > newList ( ResultsVo vo , Integer page , Integer size ) {
public List < ResultsEntity > newList ( ResultsVo vo , Integer page , Integer size ) {
List < ResultsEntity > newList = achievementManagementDao . newList ( vo ) ;
List < ResultsEntity > newList = achievementManagementDao . newList ( vo ) ;
return newList ;
return newList ;
}
}
@ -152,36 +153,38 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
Integer eventId = report . getEventId ( ) ;
Integer eventId = report . getEventId ( ) ;
ProjectRecordEntity record = projectRecordDao . queryReport ( eventId ) ;
ProjectRecordEntity record = projectRecordDao . queryReport ( eventId ) ;
String userName = userInfoDao . queryUserReport ( record . getUserid ( ) ) ;
String userName = userInfoDao . queryUserReport ( record . getUserid ( ) ) ;
if ( report . getProjectId ( ) ! = null ) {
if ( report . getProjectId ( ) ! = null ) {
String evaluationName = achievementManagementDao . queryEvaluationName ( report . getProjectId ( ) ) ;
String evaluationName = achievementManagementDao . queryEvaluationName ( report . getProjectId ( ) ) ;
report . setEvaluationName ( evaluationName ) ;
report . setEvaluationName ( evaluationName ) ;
}
}
//python实验数据
//python实验数据
Integer systemId = report . getSystemId ( ) ;
Integer systemId = report . getSystemId ( ) ;
if ( systemId = = 1 | systemId = = 4 | systemId = = 5 ) {
if ( systemId = = 1 | systemId = = 4 | systemId = = 5 ) {
List < AchievementManagementVO > data = achievementManagementDao . queryPythonTest ( eventId ) ;
List < AchievementManagementVO > data = achievementManagementDao . queryPythonTest ( eventId ) ;
map . put ( "data" , data ) ;
map . put ( "data" , data ) ;
}
}
report . setUserName ( userName ) ;
report . setUserName ( userName ) ;
map . put ( "report" , report ) ;
map . put ( "report" , report ) ;
map . put ( "record" , record ) ;
map . put ( "record" , record ) ;
return R . ok ( ) . put ( "data" , map ) ;
return R . ok ( ) . put ( "data" , map ) ;
}
}
@Override
@Override
@Transactional
@Transactional
public R deleteReport ( Integer reportId ) {
public R deleteReport ( Integer reportId , Integer recordId ) {
achievementManagementDao . deleteReport ( reportId ) ;
achievementManagementDao . deleteReport ( reportId , recordId ) ;
return R . ok ( ) ;
return R . ok ( ) ;
}
}
@Override
@Override
public R queryEvaluationReport ( String searchContant , Integer projectId , Integer page , Integer size ) {
public R queryEvaluationReport ( String searchContant , Integer projectId , Integer page , Integer size ) {
Page < T > tPage = new Page < > ( page , size ) ;
Page < T > tPage = new Page < > ( page , size ) ;
IPage < AchievementManagementVO > data = achievementManagementDao . queryEvaluationReport ( tPage , searchContant , projectId ) ;
IPage < AchievementManagementVO > data = achievementManagementDao . queryEvaluationReport ( tPage , searchContant , projectId ) ;
PageUtils result = new PageUtils ( data ) ;
PageUtils result = new PageUtils ( data ) ;
return R . ok ( ) . put ( "data" , result ) ;
return R . ok ( ) . put ( "data" , result ) ;
}
}
@Override
@Override
@ -190,10 +193,10 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
List < Integer > list = new ArrayList < > ( ) ;
List < Integer > list = new ArrayList < > ( ) ;
String [ ] split = ids . split ( "," ) ;
String [ ] split = ids . split ( "," ) ;
for ( int i = 0 ; i < split . length ; i + + ) {
for ( int i = 0 ; i < split . length ; i + + ) {
list . add ( Integer . parseInt ( split [ i ] ) ) ;
list . add ( Integer . parseInt ( split [ i ] ) ) ;
}
}
List < AchievementImportRequest > achievement = achievementManagementDao . queryAchievement ( list ) ;
List < AchievementImportRequest > achievement = achievementManagementDao . queryAchievement ( list ) ;
//2.加载模板流数据
//2.加载模板流数据
ClassPathResource resource = new ClassPathResource ( "excel-template/川大成绩管理实验记录导出模板.xlsx" ) ;
ClassPathResource resource = new ClassPathResource ( "excel-template/川大成绩管理实验记录导出模板.xlsx" ) ;
@ -205,7 +208,7 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
}
}
@Override
@Override
public R queryAchievement ( Integer systemId , Integer projectPermissions , String searchContant , String startingtime ,
public R queryAchievement ( Integer systemId , Integer projectPermissions , String searchContant , String startingtime ,
String endtime , Integer month ) {
String endtime , Integer month ) {
try {
try {
List < AchievementManagementVO > fictitious ;
List < AchievementManagementVO > fictitious ;
@ -213,14 +216,16 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
List < AchievementManagementVO > vo = new ArrayList < > ( ) ;
List < AchievementManagementVO > vo = new ArrayList < > ( ) ;
List < Integer > educationResult = achievementManagementDao . countEducationProjectId ( ) ; //获取教学实验的主键id
List < Integer > educationResult = achievementManagementDao . countEducationProjectId ( ) ; //获取教学实验的主键id
List < Integer > fictitiousResult = achievementManagementDao . countFictitiousProjectId ( ) ; //获取教学实验的主键id
List < Integer > fictitiousResult = achievementManagementDao . countFictitiousProjectId ( ) ; //获取教学实验的主键id
if ( projectPermissions = = null ) { projectPermissions = - 9999 ; }
if ( projectPermissions = = null ) {
if ( projectPermissions = = 0 ) { //只查询练习项目
projectPermissions = - 9999 ;
}
if ( projectPermissions = = 0 ) { //只查询练习项目
fictitious = achievementManagementDao . queryFictitiousRecord ( systemId , searchContant , startingtime , endtime , month , fictitiousResult ) ;
fictitious = achievementManagementDao . queryFictitiousRecord ( systemId , searchContant , startingtime , endtime , month , fictitiousResult ) ;
vo = fictitious ;
vo = fictitious ;
} else if ( projectPermissions = = 1 ) { //只查询考核项目
} else if ( projectPermissions = = 1 ) { //只查询考核项目
education = achievementManagementDao . queryEducationRecord ( systemId , searchContant , startingtime , endtime , month , educationResult ) ;
education = achievementManagementDao . queryEducationRecord ( systemId , searchContant , startingtime , endtime , month , educationResult ) ;
vo = education ;
vo = education ;
} else { //查询练习+考核项目
} else { //查询练习+考核项目
if ( educationResult . size ( ) = = 0 ) {
if ( educationResult . size ( ) = = 0 ) {
if ( fictitiousResult . size ( ) > 0 ) {
if ( fictitiousResult . size ( ) > 0 ) {
fictitious = achievementManagementDao . queryFictitiousRecord ( systemId , searchContant , startingtime , endtime , month , fictitiousResult ) ;
fictitious = achievementManagementDao . queryFictitiousRecord ( systemId , searchContant , startingtime , endtime , month , fictitiousResult ) ;
@ -245,10 +250,10 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
}
}
}
}
}
}
return R . ok ( ) . put ( "data" , vo ) ;
return R . ok ( ) . put ( "data" , vo ) ;
} catch ( RuntimeException e ) {
} catch ( RuntimeException e ) {
log . info ( e . getMessage ( ) ) ;
log . info ( e . getMessage ( ) ) ;
return R . error ( 500 , "系统异常!!!" ) ;
return R . error ( 500 , "系统异常!!!" ) ;
}
}
}
}
@ -267,14 +272,36 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
Integer signatureId = entity . getSignatureId ( ) ;
Integer signatureId = entity . getSignatureId ( ) ;
Integer reportId = entity . getReportId ( ) ;
Integer reportId = entity . getReportId ( ) ;
String comment = entity . getComment ( ) ;
String comment = entity . getComment ( ) ;
if ( comment = = "" ) {
if ( comment = = "" ) {
comment = null ;
comment = null ;
}
}
if ( isSignature = = 1 ) {
if ( isSignature = = 1 ) {
achievementManagementDao . updateSignatrue ( 1 , signatureId , reportId , comment ) ;
achievementManagementDao . updateSignatrue ( 1 , signatureId , reportId , comment ) ;
} else {
} else {
achievementManagementDao . updateSignatrue ( 0 , null , reportId , comment ) ;
achievementManagementDao . updateSignatrue ( 0 , null , reportId , comment ) ;
}
}
}
}
@Override
public R deleteReportByProjectId ( Integer projectId ) {
achievementManagementDao . deleteReportById ( projectId ) ;
return R . ok ( ) ;
}
@Override
public List < AchievementManagementVO > getImitationAchievement ( Integer projectId ) {
List < AchievementManagementVO > list = achievementManagementDao . getImitationAchievement ( projectId ) ;
return list ;
}
@Override
public List < AchievementManagementVO > getTeachAchievement ( Integer id ) {
return achievementManagementDao . getTeachAchievement ( id ) ;
}
}
}