|
@@ -33,8 +33,11 @@ import cn.com.qmth.examcloud.core.basic.api.request.GetOrgReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetUserReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetUserResp;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.ExamRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.OrgIpRepo;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.OrgIpEntity;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.service.ExamService;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.OrgIpService;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.bean.orgip.OrgIpInfo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.bean.orgip.OrgIpQuery;
|
|
@@ -50,12 +53,15 @@ public class OrgIpServiceImpl implements OrgIpService {
|
|
|
private static final String[] EXCEL_HEADER = new String[] { "IP/IP段", "学习中心代码", "学习中心名称", "备注" };
|
|
|
@Autowired
|
|
|
private OrgIpRepo orgIpRepo;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ExamRepo examRepo;
|
|
|
@Autowired
|
|
|
private UserCloudService userCloudService;
|
|
|
|
|
|
@Autowired
|
|
|
private OrgCloudService orgCloudService;
|
|
|
+ @Autowired
|
|
|
+ private ExamService examService;
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<OrgIpInfo> getPage(OrgIpQuery req) {
|
|
@@ -113,8 +119,8 @@ public class OrgIpServiceImpl implements OrgIpService {
|
|
|
}
|
|
|
checkIp(req.getIp());
|
|
|
req.setIp(req.getIp().trim());
|
|
|
- if (req.getRemark() != null && req.getRemark().length() > 200) {
|
|
|
- throw new StatusException("备注长度不能超过200");
|
|
|
+ if (req.getRemark() != null && req.getRemark().length() > 100) {
|
|
|
+ throw new StatusException("备注长度不能超过100");
|
|
|
}
|
|
|
checkIpExists(req);
|
|
|
OrgIpEntity e = new OrgIpEntity();
|
|
@@ -137,8 +143,8 @@ public class OrgIpServiceImpl implements OrgIpService {
|
|
|
}
|
|
|
checkIp(req.getIp());
|
|
|
req.setIp(req.getIp().trim());
|
|
|
- if (req.getRemark() != null && req.getRemark().length() > 200) {
|
|
|
- throw new StatusException("备注长度不能超过200");
|
|
|
+ if (req.getRemark() != null && req.getRemark().length() > 100) {
|
|
|
+ throw new StatusException("备注长度不能超过100");
|
|
|
}
|
|
|
checkIpExists(req);
|
|
|
OrgIpEntity e = GlobalHelper.getPresentEntity(orgIpRepo, req.getId(), OrgIpEntity.class);
|
|
@@ -297,8 +303,8 @@ public class OrgIpServiceImpl implements OrgIpService {
|
|
|
}
|
|
|
|
|
|
String remark = trimAndNullIfBlank(line[3]);
|
|
|
- if (remark != null && remark.length() > 200) {
|
|
|
- msg.append(" 备注长度不能超过200");
|
|
|
+ if (remark != null && remark.length() > 100) {
|
|
|
+ msg.append(" 备注长度不能超过100");
|
|
|
hasError = true;
|
|
|
}
|
|
|
info.setRemark(remark);
|
|
@@ -337,8 +343,8 @@ public class OrgIpServiceImpl implements OrgIpService {
|
|
|
throw new StatusException("学习中心不能为空");
|
|
|
}
|
|
|
req.setIp(req.getIp().trim());
|
|
|
- if (req.getRemark() != null && req.getRemark().length() > 200) {
|
|
|
- throw new StatusException("备注长度不能超过200");
|
|
|
+ if (req.getRemark() != null && req.getRemark().length() > 100) {
|
|
|
+ throw new StatusException("备注长度不能超过100");
|
|
|
}
|
|
|
try {
|
|
|
checkIpExists(req);
|
|
@@ -413,4 +419,27 @@ public class OrgIpServiceImpl implements OrgIpService {
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void examAdd(Long rootOrgId, Long examId) {
|
|
|
+ ExamEntity exam = GlobalHelper.getPresentEntity(examRepo, examId, ExamEntity.class);
|
|
|
+ if(!exam.getRootOrgId().equals(rootOrgId)) {
|
|
|
+ throw new StatusException("参数错误,考试id非法");
|
|
|
+ }
|
|
|
+ List<OrgIpEntity> list=orgIpRepo.findByRootOrgId(rootOrgId);
|
|
|
+ if(CollectionUtils.isEmpty(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<OrgIpInfo> ret = new ArrayList<>();
|
|
|
+ for (OrgIpEntity e : list) {
|
|
|
+ OrgIpInfo info = new OrgIpInfo();
|
|
|
+ ret.add(info);
|
|
|
+ info.setId(e.getId());
|
|
|
+ info.setIp(e.getIp());
|
|
|
+ info.setOrgId(e.getOrgId());
|
|
|
+ info.setRemark(e.getRemark());
|
|
|
+ }
|
|
|
+ examService.addIpLimitByOrgIp(examId, ret);
|
|
|
+ }
|
|
|
}
|