|
|
|
@ -13,14 +13,13 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class ConsumerBehaviorStepFourServiceImpl implements ConsumerBehaviorStepFourService {
|
|
|
|
public class ConsumerBehaviorStepFourServiceImpl implements ConsumerBehaviorStepFourService {
|
|
|
|
private static final int REQUIRED_REPORT_ROWS = 5;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ConsumerBehaviorStepFourValidationResult validate(ConsumerBehaviorStepFourValidationRequest request, JwtUser user) {
|
|
|
|
public ConsumerBehaviorStepFourValidationResult validate(ConsumerBehaviorStepFourValidationRequest request, JwtUser user) {
|
|
|
|
requireStudent(user);
|
|
|
|
requireStudent(user);
|
|
|
|
List<ConsumerBehaviorStepFourValidationRequest.ReportRow> rows = request == null ? null : request.getRows();
|
|
|
|
List<ConsumerBehaviorStepFourValidationRequest.ReportRow> rows = request == null ? null : request.getRows();
|
|
|
|
if (rows == null || rows.size() != REQUIRED_REPORT_ROWS) {
|
|
|
|
if (rows == null || rows.isEmpty()) {
|
|
|
|
throw badRequest("问卷调研报告需填写 5 个报告模块");
|
|
|
|
throw badRequest("请至少填写一个报告模块");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (ConsumerBehaviorStepFourValidationRequest.ReportRow row : rows) {
|
|
|
|
for (ConsumerBehaviorStepFourValidationRequest.ReportRow row : rows) {
|
|
|
|
if (row == null || StringUtils.isBlank(row.getTitle()) || StringUtils.isBlank(row.getContent())) {
|
|
|
|
if (row == null || StringUtils.isBlank(row.getTitle()) || StringUtils.isBlank(row.getContent())) {
|
|
|
|
|