|
@@ -9,6 +9,8 @@ import com.diagbot.entity.Organization;
|
|
|
import com.diagbot.entity.User;
|
|
|
import com.diagbot.entity.UserAuthentication;
|
|
|
import com.diagbot.entity.UserOrganization;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.facade.OrganizationFacade;
|
|
|
import com.diagbot.facade.UserAuthenticationFacade;
|
|
|
import com.diagbot.facade.UserFacade;
|
|
@@ -42,7 +44,7 @@ import java.util.Map;
|
|
|
* @time: 2018年9月17日 下午1:53:53
|
|
|
*/
|
|
|
@RestController
|
|
|
-@Api(value = "用户信息和机构信息API", tags = { "用户信息和机构信息API" })
|
|
|
+@Api(value = "用户信息和机构信息API[by:wangfeng]", tags = { "用户信息和机构信息API" })
|
|
|
@RequestMapping("/userInfo")
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public class UserInfoController {
|
|
@@ -56,7 +58,7 @@ public class UserInfoController {
|
|
|
@Autowired
|
|
|
UserAuthenticationFacade userAuthenticationFacade;
|
|
|
|
|
|
- @ApiOperation(value = "分页查询获取用户信息", notes = "根据每页显示条数,默认 10,和当前页")
|
|
|
+ @ApiOperation(value = "分页查询获取用户信息[by:wangfeng]", notes = "根据每页显示条数,默认 10,和当前页")
|
|
|
@PostMapping("/getUserInfoPag")
|
|
|
@SysLogger("getUserInfoPag")
|
|
|
// @ApiIgnore
|
|
@@ -68,7 +70,7 @@ public class UserInfoController {
|
|
|
return RespDTO.onSuc(user);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "修改用户信息和机构信息", notes = "用户信息和机构信息")
|
|
|
+ @ApiOperation(value = "修改用户信息和机构信息[by:wangfeng]", notes = "用户信息和机构信息")
|
|
|
@PostMapping("/updateUserInfoAll")
|
|
|
@SysLogger("updateUserInfoAll")
|
|
|
@Transactional
|
|
@@ -83,19 +85,18 @@ public class UserInfoController {
|
|
|
userMap.put("type", userInfoOrganizationsVO.getType());
|
|
|
userMap.put("position", userInfoOrganizationsVO.getPosition());
|
|
|
userMap.put("userId", userInfoOrganizationsVO.getUserId());
|
|
|
- int res = userFacade.updateUserInfoAll(userMap);
|
|
|
-
|
|
|
- if (res != 0) {
|
|
|
- return RespDTO.onSuc("修改用户信息成功!");
|
|
|
+ boolean res = userFacade.updateUserInfoAll(userMap);
|
|
|
+ if (!res){
|
|
|
+ throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
|
|
|
}
|
|
|
- return RespDTO.onSuc("修改用户信息失败!");
|
|
|
+ return RespDTO.onSuc(res);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "审核用户信息和机构信息", notes = "审核用户信息和机构信息")
|
|
|
+ @ApiOperation(value = "审核用户信息和机构信息[by:wangfeng]", notes = "审核用户信息和机构信息")
|
|
|
@PostMapping("/auditUserInfoAll")
|
|
|
@SysLogger("auditUserInfoAll")
|
|
|
@Transactional
|
|
|
- public RespDTO<UserInfoAuditVO> auditUserInfoAll(@Valid @RequestBody UserInfoAuditVO userInfoAuditVO) {
|
|
|
+ public RespDTO<Boolean> auditUserInfoAll(@Valid @RequestBody UserInfoAuditVO userInfoAuditVO) {
|
|
|
Map<String, Object> auditMap = new HashMap<String, Object>();
|
|
|
auditMap.put("userId", userInfoAuditVO.getUserId());
|
|
|
auditMap.put("modifier",UserUtils.getCurrentPrincipleID());
|
|
@@ -106,13 +107,13 @@ public class UserInfoController {
|
|
|
// TODO 审核前先验证该用户的的认证状态
|
|
|
boolean res = userFacade.auditUserInfoAll(auditMap);
|
|
|
|
|
|
- if (res == true) {
|
|
|
- return RespDTO.onSuc("审核通过!");
|
|
|
+ if (!res){
|
|
|
+ throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
|
|
|
}
|
|
|
- return RespDTO.onSuc("审核失败!");
|
|
|
+ return RespDTO.onSuc(res);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "删除用户信息和机构信息", notes = "用户信息和机构信息")
|
|
|
+ @ApiOperation(value = "删除用户信息和机构信息[by:wangfeng]", notes = "用户信息和机构信息")
|
|
|
@PostMapping("/updateDeleted")
|
|
|
@SysLogger("updateDeleted")
|
|
|
@Transactional
|
|
@@ -121,11 +122,14 @@ public class UserInfoController {
|
|
|
map.put("userId", userId);
|
|
|
map.put("modifier",UserUtils.getCurrentPrincipleID());
|
|
|
map.put("gmtModified", DateUtil.now());
|
|
|
- int res = userFacade.updateDeleted(map);
|
|
|
- return RespDTO.onSuc("刪除成功" + res);
|
|
|
+ boolean res = userFacade.updateDeleted(map);
|
|
|
+ if (!res){
|
|
|
+ throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
|
|
|
+ }
|
|
|
+ return RespDTO.onSuc(res);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "模糊查询机构信息", notes = "机构信息")
|
|
|
+ @ApiOperation(value = "模糊查询机构信息[by:wangfeng]", notes = "机构信息")
|
|
|
@PostMapping("/findOrganization")
|
|
|
@SysLogger("findOrganization")
|
|
|
public RespDTO findOrganization(@RequestParam String organizationName) {
|
|
@@ -135,11 +139,11 @@ public class UserInfoController {
|
|
|
return RespDTO.onSuc(organization);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "添加构信息", notes = "机构信息")
|
|
|
+ @ApiOperation(value = "添加构信息[by:wangfeng]", notes = "机构信息")
|
|
|
@PostMapping("/addOrganization")
|
|
|
@SysLogger("addOrganization")
|
|
|
@Transactional
|
|
|
- public RespDTO<OrganizationVO> addOrganization(@Valid @RequestBody OrganizationVO organizationVO) {
|
|
|
+ public RespDTO<Boolean> addOrganization(@Valid @RequestBody OrganizationVO organizationVO) {
|
|
|
|
|
|
String organizationName = organizationVO.getOrganizationName();
|
|
|
List<Organization> organizationList = organizationFacade.findOrganization(organizationName);
|
|
@@ -159,13 +163,13 @@ public class UserInfoController {
|
|
|
boolean res = organizationFacade.save(organization);
|
|
|
|
|
|
// System.out.println(GsonUtil.toJson(organization));
|
|
|
- if (res == true) {
|
|
|
- return RespDTO.onSuc("增加机构信息成功!");
|
|
|
+ if (!res){
|
|
|
+ throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
|
|
|
}
|
|
|
- return RespDTO.onSuc("增加机构信息失败!");
|
|
|
+ return RespDTO.onSuc(res);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "添加用户信息和机构信息管理员", notes = "用户信息和机构信息的绑定")
|
|
|
+ @ApiOperation(value = "添加用户信息和机构信息管理员[by:wangfeng]", notes = "用户信息和机构信息的绑定")
|
|
|
@PostMapping("/addUserInfo")
|
|
|
@SysLogger("addUserInfo")
|
|
|
@Transactional
|