Antiloveg 8 years ago
parent
commit
2e6f8fbd29
1 changed files with 12 additions and 3 deletions
  1. 12 3
      src/main/java/com/goafanti/user/controller/UserApiController.java

+ 12 - 3
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import com.goafanti.cognizance.bo.InputOrgHumanResource;
 import com.goafanti.cognizance.service.OrgRatepayService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
@@ -27,6 +28,7 @@ import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.enums.DeleteStatus;
 import com.goafanti.common.enums.IdentityAuditStatus;
 import com.goafanti.common.enums.IdentityProcess;
+import com.goafanti.common.enums.OrgHumanResourceFields;
 import com.goafanti.common.enums.OrgProFields;
 import com.goafanti.common.enums.OrganizationIdentityFields;
 import com.goafanti.common.enums.OrganizationTechFields;
@@ -650,15 +652,22 @@ public class UserApiController extends BaseApiController {
 	}
 
 	/**
-	 * 团体人力资源情况修改保存(用户端)
+	 * 团体人力资源情况新增修改保存(用户端)
 	 * 
 	 * @param orgHumanResource
 	 * @return
 	 */
 	@RequestMapping(value = "/SaveHumanResource", method = RequestMethod.POST)
-	public Result SaveHumanResource(OrgHumanResource orgHumanResource) {
+	public Result SaveHumanResource(@Valid InputOrgHumanResource ohr, BindingResult bindingResult) {
 		Result res = new Result();
-		if (null == orgHumanResource.getId()) {
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					OrgHumanResourceFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+		OrgHumanResource orgHumanResource = new OrgHumanResource();
+		BeanUtils.copyProperties(ohr, orgHumanResource);
+		if (StringUtils.isBlank(orgHumanResource.getId())) {
 			if (null != orgHumanResourceService.selectOrgHumanResourceByUidAndYear(orgHumanResource.getYear(),
 					orgHumanResource.getUid())) {
 				res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度人力资源情况已录入!"));