|
|
@ -23,6 +23,7 @@ import io.swagger.annotations.ApiParam;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@ -192,7 +193,7 @@ public class TrainingController {
|
|
|
|
memberService.insert(member);
|
|
|
|
memberService.insert(member);
|
|
|
|
buildPracticeMember(member);
|
|
|
|
buildPracticeMember(member);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
trainingService.updatePeopleNum(true,trainingId);
|
|
|
|
trainingService.updatePeopleNum(true, trainingId);
|
|
|
|
return new ResultEntity(HttpStatus.OK);
|
|
|
|
return new ResultEntity(HttpStatus.OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -204,7 +205,7 @@ public class TrainingController {
|
|
|
|
Assert.notNull(trainingId, "实训记录不存在");
|
|
|
|
Assert.notNull(trainingId, "实训记录不存在");
|
|
|
|
Assert.notNull(memberId, "参赛用户不存在");
|
|
|
|
Assert.notNull(memberId, "参赛用户不存在");
|
|
|
|
memberService.deleteById(memberId);
|
|
|
|
memberService.deleteById(memberId);
|
|
|
|
trainingService.updatePeopleNum(false,trainingId);
|
|
|
|
trainingService.updatePeopleNum(false, trainingId);
|
|
|
|
return new ResultEntity(HttpStatus.OK);
|
|
|
|
return new ResultEntity(HttpStatus.OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -289,4 +290,39 @@ public class TrainingController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, memberService.selectTrainingListByClassId(classId));
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, memberService.selectTrainingListByClassId(classId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Permission(codes = PermissionType.TRAINING_MANAGEMENT_EDIT)
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
|
|
|
@ApiOperation("更新参赛人员")
|
|
|
|
|
|
|
|
@GetMapping("/updateMember")
|
|
|
|
|
|
|
|
public ResultEntity updateMember(@ApiParam("实训记录id") @RequestParam String trainingId) {
|
|
|
|
|
|
|
|
JwtUser user = TokenProvider.getJWTUser(request);
|
|
|
|
|
|
|
|
List<Map<String, Object>> classList = memberService.selectClassListByTrainingId(trainingId);
|
|
|
|
|
|
|
|
List<String> insertNames = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (classList == null || classList.size() == 0) {
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.OK);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Map<String, Object>> resultInfos = new ArrayList<>();
|
|
|
|
|
|
|
|
List<String> studentNos = new ArrayList<>();
|
|
|
|
|
|
|
|
String classIdResult = classList.stream()
|
|
|
|
|
|
|
|
.map(classMap -> classMap.get("class_id").toString())
|
|
|
|
|
|
|
|
.collect(Collectors.joining(","));
|
|
|
|
|
|
|
|
List<Map<String, Object>> studentInfos = TzApi.GetStudentInfoByClassIdForForeignExchangeTrading(classIdResult, user);
|
|
|
|
|
|
|
|
Training training = trainingService.findById(trainingId);
|
|
|
|
|
|
|
|
for (Map<String, Object> studentInfo : studentInfos) {
|
|
|
|
|
|
|
|
String studentNo = studentInfo.get("studentNo").toString();
|
|
|
|
|
|
|
|
studentNos.add(studentNo);
|
|
|
|
|
|
|
|
Member existsInMember = memberService.findByTrainingIdAndStudentNumber(trainingId,studentNo);
|
|
|
|
|
|
|
|
if (existsInMember!=null) continue;
|
|
|
|
|
|
|
|
insertNames.add(studentInfo.get("name").toString());
|
|
|
|
|
|
|
|
resultInfos.add(studentInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(resultInfos==null||resultInfos.size()==0){
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.OK,new ArrayList<>());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
memberService.insertAll(buildMembers(resultInfos, training));
|
|
|
|
|
|
|
|
memberService.deleteMembersByTrainingIdNotInStudentInfos(trainingId,studentNos);
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.OK, insertNames);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|