diff --git a/src/main/java/com/glxp/api/controller/purchase/userPersonController.java b/src/main/java/com/glxp/api/controller/purchase/userPersonController.java index 23d3760..93030cf 100644 --- a/src/main/java/com/glxp/api/controller/purchase/userPersonController.java +++ b/src/main/java/com/glxp/api/controller/purchase/userPersonController.java @@ -24,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.Date; import java.util.List; /** @@ -90,6 +91,23 @@ public class userPersonController { return ResultVOUtils.success(); } + @ApiOperation(value = "新增本企业负责人信息", response = BaseResponse.class) + @PostMapping("/sup/company/person/addPerSon") + public BaseResponse addPerSon(@RequestBody UserPersonFilterRequest userPersonFilterRequest ,BindingResult bindingResult ){ + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + UserPersonEntity userPerson = new UserPersonEntity(); + + BeanUtils.copyProperties(userPersonFilterRequest,userPerson); + userPerson.setPassword(userPersonFilterRequest.getCheckPassword()); + userPerson.setCompanyId(Long.valueOf(userPersonFilterRequest.getCompanyId())); +// userPerson.setId(Long.valueOf(Long.parseLong(userPersonFilterRequest.getCompanyId()))); + userPerson.setCreateTime(new Date()); + userPersonService.add(userPerson); + return ResultVOUtils.success(); + } + public String getCompanyId() { ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); if (attributes == null) { @@ -101,4 +119,5 @@ public class userPersonController { } + } diff --git a/src/main/java/com/glxp/api/service/sup/UserPersonService.java b/src/main/java/com/glxp/api/service/sup/UserPersonService.java index 01c2ff3..13d0b91 100644 --- a/src/main/java/com/glxp/api/service/sup/UserPersonService.java +++ b/src/main/java/com/glxp/api/service/sup/UserPersonService.java @@ -24,4 +24,9 @@ public class UserPersonService extends ServiceImpl 0; } + + public boolean add(UserPersonEntity userPerson) { + return userPersonMapper.insert(userPerson)> 0; + } + }