Ver código fonte

代码优化;

hlf 1 ano atrás
pai
commit
8240ff4f6d

+ 18 - 24
ims-service/ims-eval/src/main/java/com/ims/eval/controller/DeptAssessmentDeclarationController.java

@@ -234,7 +234,7 @@ public class DeptAssessmentDeclarationController {
 			if (b) {
 				return R.ok().data(b);
 			} else {
-				return R.error("新增/修改失败,人员重复!");
+				return R.error("保存失败,人员重复或人员信息不完善!");
 			}
 		} catch (CustomException e) {
 			return R.customError(e.getMessage()).data("失败!");
@@ -334,13 +334,11 @@ public class DeptAssessmentDeclarationController {
 					DeptAssessmentDeclarationContent deptAssessmentDeclarationContent = new DeptAssessmentDeclarationContent();
 					deptAssessmentDeclarationContent.setAssessmentDeclarationId(id);
 					deptAssessmentDeclarationContent.setEmployeeNo(str[0]);
-					JSONObject jsonArr = userService.pageList(1, 500, "", "", "", str[0], "", "", request);
-					JSONObject jsonArr1 = (JSONObject) jsonArr.get("data");
-					JSONArray array = JSONUtil.parseArray(jsonArr1.get("records"));
-					List<UserDTO> userList = JSONUtil.toList(array, UserDTO.class);
-					if (userList.size() > 0) {
-						deptAssessmentDeclarationContent.setEmployeeId(userList.get(0).getId());
-						deptAssessmentDeclarationContent.setEmployeeName(userList.get(0).getName());
+					JSONObject jsonArr = userService.getLoginNameByUserInfo(str[0], request);
+					JSONObject data = (JSONObject) jsonArr.get("data");
+					if ("操作成功".equals(String.valueOf(data.get("msg")))){
+						deptAssessmentDeclarationContent.setEmployeeId(String.valueOf(data.get("id")));
+						deptAssessmentDeclarationContent.setEmployeeName(String.valueOf(data.get("name")));
 					}
 					deptAssessmentDeclarationContent.setSuggestedValue(str[2]);
 					deptAssessmentDeclarationContent.setSerialNumber(Convert.toInt(str[3]));
@@ -646,16 +644,14 @@ public class DeptAssessmentDeclarationController {
 	public R addApprovalLeader(@RequestParam(value = "id") String id,
 							   @RequestParam(value = "employeeNo") String employeeNo) {
 		boolean b = false;
-		JSONObject jsonArr = userService.pageList(1, 500, "", "", "", employeeNo, "", "", request);
-		JSONObject jsonArr1 = (JSONObject) jsonArr.get("data");
-		JSONArray array = JSONUtil.parseArray(jsonArr1.get("records"));
-		List<UserDTO> userList = JSONUtil.toList(array, UserDTO.class);
-		if (userList.size() > 0) {
+		JSONObject jsonArr = userService.getLoginNameByUserInfo(employeeNo, request);
+		JSONObject data = (JSONObject) jsonArr.get("data");
+		if ("操作成功".equals(String.valueOf(data.get("msg")))){
 			DeptAssessmentDeclaration deptAssessmentDeclaration = deptAssessmentDeclarationService.getById(id);
 			if (null != deptAssessmentDeclaration) {
-				deptAssessmentDeclaration.setDeptLeaderId(userList.get(0).getId());
-				deptAssessmentDeclaration.setDeptLeaderNo(userList.get(0).getNo());
-				deptAssessmentDeclaration.setDeptLeaderName(userList.get(0).getName());
+				deptAssessmentDeclaration.setDeptLeaderId(String.valueOf(data.get("id")));
+				deptAssessmentDeclaration.setDeptLeaderNo(String.valueOf(data.get("no")));
+				deptAssessmentDeclaration.setDeptLeaderName(String.valueOf(data.get("name")));
 				b = deptAssessmentDeclarationService.updateById(deptAssessmentDeclaration);
 			}
 		}
@@ -677,16 +673,14 @@ public class DeptAssessmentDeclarationController {
 	public R addRepeatBatchLeader(@RequestParam(value = "id") String id,
 								  @RequestParam(value = "employeeNo") String employeeNo) {
 		boolean b = false;
-		JSONObject jsonArr = userService.pageList(1, 500, "", "", "", employeeNo, "", "", request);
-		JSONObject jsonArr1 = (JSONObject) jsonArr.get("data");
-		JSONArray array = JSONUtil.parseArray(jsonArr1.get("records"));
-		List<UserDTO> userList = JSONUtil.toList(array, UserDTO.class);
-		if (userList.size() > 0) {
+		JSONObject jsonArr = userService.getLoginNameByUserInfo(employeeNo, request);
+		JSONObject data = (JSONObject) jsonArr.get("data");
+		if ("操作成功".equals(String.valueOf(data.get("msg")))){
 			DeptAssessmentDeclaration deptAssessmentDeclaration = deptAssessmentDeclarationService.getById(id);
 			if (null != deptAssessmentDeclaration) {
-				deptAssessmentDeclaration.setSeconderId(userList.get(0).getId());
-				deptAssessmentDeclaration.setSeconderNo(userList.get(0).getNo());
-				deptAssessmentDeclaration.setSeconderName(userList.get(0).getName());
+				deptAssessmentDeclaration.setSeconderId(String.valueOf(data.get("id")));
+				deptAssessmentDeclaration.setSeconderNo(String.valueOf(data.get("no")));
+				deptAssessmentDeclaration.setSeconderName(String.valueOf(data.get("name")));
 				b = deptAssessmentDeclarationService.updateById(deptAssessmentDeclaration);
 			}
 		}

+ 4 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/DeptAssessmentDeclarationContentServiceImpl.java

@@ -35,6 +35,10 @@ public class DeptAssessmentDeclarationContentServiceImpl extends ServiceImpl<Dep
 		List<DeptAssessmentDeclarationContent> list1 = new ArrayList<>();
 		List<DeptAssessmentDeclarationContent> list2 = new ArrayList<>();
 		for (DeptAssessmentDeclarationContent deptAssessmentDeclarationContent : deptAssessmentDeclarationContentList) {
+			if ("".equals(deptAssessmentDeclarationContent.getEmployeeId()) || "".equals(deptAssessmentDeclarationContent.getEmployeeNo()) || "".equals(deptAssessmentDeclarationContent.getEmployeeName())) {
+				b = false;
+				break;
+			}
 			if (deptAssessmentDeclarationContent.getId() == null || "".equals(deptAssessmentDeclarationContent.getId())) {//新增
 				QueryWrapper<DeptAssessmentDeclarationContent> qw = new QueryWrapper<>();
 				if (StringUtils.isNotEmpty(deptAssessmentDeclarationContent.getAssessmentDeclarationId())) {