|
@@ -7,6 +7,8 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.crypto.factory.PasswordEncoderFactories;
|
|
|
+import org.springframework.security.crypto.password.PasswordEncoder;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -20,11 +22,17 @@ import com.diagbot.dto.ResultModelDTO;
|
|
|
import com.diagbot.dto.UserInfoDTO;
|
|
|
import com.diagbot.entity.Organization;
|
|
|
import com.diagbot.entity.User;
|
|
|
+import com.diagbot.entity.UserAuthentication;
|
|
|
+import com.diagbot.entity.UserOrganization;
|
|
|
import com.diagbot.facade.OrganizationFacade;
|
|
|
+import com.diagbot.facade.UserAuthenticationFacade;
|
|
|
import com.diagbot.facade.UserFacade;
|
|
|
+import com.diagbot.facade.UserOrganizationFacade;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.GsonUtil;
|
|
|
import com.diagbot.vo.OrganizationVO;
|
|
|
import com.diagbot.vo.UserAndOrganizationVO;
|
|
|
+import com.diagbot.vo.UserInfoAuditVO;
|
|
|
import com.diagbot.vo.UserInfoOrganizationsVO;
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -44,6 +52,10 @@ public class UserInfoController {
|
|
|
private UserFacade userFacade;
|
|
|
@Autowired
|
|
|
OrganizationFacade organizationFacade;
|
|
|
+ @Autowired
|
|
|
+ UserOrganizationFacade userOrganizationFacade;
|
|
|
+ @Autowired
|
|
|
+ UserAuthenticationFacade userAuthenticationFacade;
|
|
|
|
|
|
private final String MSG_SUCCESS = "操作成功!";
|
|
|
private final String MSG_ERROR = "操作失败!";
|
|
@@ -69,15 +81,36 @@ public class UserInfoController {
|
|
|
return RespDTO.onSuc("修改成功"+res);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "审核用户信息和机构信息", notes = "审核用户信息和机构信息")
|
|
|
+ @PostMapping("/auditUserInfoAll")
|
|
|
+ @SysLogger("auditUserInfoAll")
|
|
|
+ public RespDTO<UserInfoAuditVO> auditUserInfoAll( UserInfoAuditVO userInfoAuditVO){
|
|
|
+ Map<String,Object> auditMap = new HashMap<String, Object>();
|
|
|
+ auditMap.put("userId", userInfoAuditVO.getUserId());
|
|
|
+ //TODO auditMap.put("modifier",UserUtils.getCurrentPrincipleID());
|
|
|
+ auditMap.put("modifier","5");
|
|
|
+ auditMap.put("gmtModified",DateUtil.now());
|
|
|
+ auditMap.put("isReject",userInfoAuditVO.getIsReject());
|
|
|
+ auditMap.put("rejectComment",userInfoAuditVO.getRejectComment());
|
|
|
+ auditMap.put("rejectType",userInfoAuditVO.getRejectType());
|
|
|
+ //TODO 审核前先验证该用户的的认证状态
|
|
|
+ boolean res = userFacade.auditUserInfoAll(auditMap);
|
|
|
+
|
|
|
+ if(res ==true){
|
|
|
+ return RespDTO.onSuc("审核通过!");
|
|
|
+ }
|
|
|
+ return RespDTO.onSuc("审核失败!");
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "删除用户信息和机构信息", notes = "用户信息和机构信息")
|
|
|
@PostMapping("/updateDeleted")
|
|
|
@SysLogger("updateDeleted")
|
|
|
public RespDTO updateDeleted(@RequestParam String userId){
|
|
|
- Map<String,String> map = new HashMap<String, String>();
|
|
|
+ Map<String,Object> map = new HashMap<String, Object>();
|
|
|
map.put("userId", userId);
|
|
|
//TODO map.put("modifier",UserUtils.getCurrentPrincipleID());
|
|
|
map.put("modifier","5");
|
|
|
- map.put("gmtModified",DateUtil.DATE_TIME_FORMAT);
|
|
|
+ map.put("gmtModified",DateUtil.now());
|
|
|
int res= userFacade.updateDeleted(map);
|
|
|
return RespDTO.onSuc("刪除成功"+res);
|
|
|
}
|
|
@@ -97,12 +130,10 @@ public class UserInfoController {
|
|
|
@SysLogger("addOrganization")
|
|
|
public RespDTO<OrganizationVO> addOrganization(OrganizationVO organizationVO){
|
|
|
//TODO
|
|
|
- ResultModelDTO resultMode = new ResultModelDTO();
|
|
|
String organizationName = organizationVO.getOrganizationName();
|
|
|
List<Organization> organizationList = organizationFacade.findOrganization(organizationName);
|
|
|
if(organizationList.size()>0){
|
|
|
- resultMode.setMessage("该机构存在");
|
|
|
- return RespDTO.onSuc(resultMode);
|
|
|
+ return RespDTO.onSuc("该机构存在");
|
|
|
}
|
|
|
Organization organization = new Organization();
|
|
|
organization.setName(organizationVO.getOrganizationName());
|
|
@@ -114,10 +145,13 @@ public class UserInfoController {
|
|
|
//TODO organization.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
organization.setCreator("5");
|
|
|
|
|
|
- boolean op = organizationFacade.save(organization);
|
|
|
+ boolean res = organizationFacade.save(organization);
|
|
|
|
|
|
- resultMode.setMessage(op+"");
|
|
|
- return RespDTO.onSuc(resultMode);
|
|
|
+ //System.out.println(GsonUtil.toJson(organization));
|
|
|
+ if(res ==true){
|
|
|
+ return RespDTO.onSuc("增加机构信息成功!");
|
|
|
+ }
|
|
|
+ return RespDTO.onSuc("增加机构信息失败!");
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "添加用户信息和机构信息管理员", notes = "用户信息和机构信息的绑定")
|
|
@@ -126,20 +160,73 @@ public class UserInfoController {
|
|
|
public RespDTO<UserAndOrganizationVO> addUserInfo(UserAndOrganizationVO userAndOrganizationVO){
|
|
|
//TODO 先查找机构,获取机构id,再注册用户,返回用户id, 取到用户id和 机构id ,查询用户机构关联表,在进行绑定
|
|
|
//User user = new User();
|
|
|
- ResultModelDTO resultMode = new ResultModelDTO();
|
|
|
- String username = userAndOrganizationVO.getUserName();
|
|
|
- User user= userFacade.getUserInfo(username);
|
|
|
- System.out.println(user);
|
|
|
- if(user!=null){
|
|
|
- resultMode.setMessage("该用户存在");
|
|
|
- return RespDTO.onSuc(resultMode);
|
|
|
+ //验证用户是否存在
|
|
|
+ String username = userAndOrganizationVO.getUserName();
|
|
|
+ User userData= userFacade.getUserInfo(username);
|
|
|
+ //System.out.println(user);
|
|
|
+ if(userData!=null){
|
|
|
+ return RespDTO.onSuc("该用户存在");
|
|
|
}
|
|
|
+ //验证机构是否被绑定
|
|
|
+ UserOrganization userORG =new UserOrganization();
|
|
|
+ userORG.setOrganizationId(userAndOrganizationVO.getOrganizationid());
|
|
|
|
|
|
+ List<UserOrganization> userOrganizationData = userOrganizationFacade.getAgencyPersonnel(userORG);
|
|
|
+ if(userOrganizationData.size()>0){
|
|
|
+ return RespDTO.onSuc("该机构绑定了用户!");
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- resultMode.setMessage("用户不存在");
|
|
|
- return RespDTO.onSuc(resultMode);
|
|
|
+ User user =new User();
|
|
|
+ user.setCreator("5");
|
|
|
+ user.setUsername(userAndOrganizationVO.getUserName());
|
|
|
+ PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
|
|
|
+ String entryPassword= passwordEncoder.encode(userAndOrganizationVO.getPassWord());
|
|
|
+ user.setPassword(entryPassword);
|
|
|
+ user.setLinkman(userAndOrganizationVO.getLinkman());
|
|
|
+ user.setGmtCreate(DateUtil.now());
|
|
|
+ user.setEmail(userAndOrganizationVO.getEmail());
|
|
|
+ boolean res = userFacade.save(user);
|
|
|
+ if(res==true){
|
|
|
+ Long userId =user.getId();
|
|
|
+ //用户信息的认证
|
|
|
+ UserAuthentication userAuthentication = new UserAuthentication();
|
|
|
+ userAuthentication.setCreator("5");//创建人Id
|
|
|
+ userAuthentication.setGmtCreate(DateUtil.now());//记录创建时间
|
|
|
+ userAuthentication.setPosition(userAndOrganizationVO.getPosition());//岗位信息
|
|
|
+ userAuthentication.setUserId(userId);//用户id
|
|
|
+ userAuthentication.setIsReject("Y");//是否通过认证 N:未通过,Y:已通过
|
|
|
+ userAuthentication.setStatus(1);//认证状态(0:未认证,1:已认证,2:认证中)
|
|
|
+ userAuthenticationFacade.save(userAuthentication);
|
|
|
+
|
|
|
+ //用户信息和机构信息的绑定
|
|
|
+ UserOrganization userOrganization = new UserOrganization();
|
|
|
+ userOrganization.setCreator("5");//创建人Id
|
|
|
+ userOrganization.setGmtCreate(DateUtil.now());
|
|
|
+ userOrganization.setOrganizationId(userAndOrganizationVO.getOrganizationid());//机构id
|
|
|
+ userOrganization.setUserId(userId);//用户id
|
|
|
+
|
|
|
+ userOrganizationFacade.save(userOrganization);
|
|
|
+ }
|
|
|
+
|
|
|
+ return RespDTO.onSuc("绑定成功");
|
|
|
}
|
|
|
+ //TODO
|
|
|
+/* @ApiOperation(value = "根据用户id查询已开通的功能", notes = "已开通信息")
|
|
|
+ @PostMapping("/addOrganization")
|
|
|
+ @SysLogger("addOrganization")*/
|
|
|
+
|
|
|
+ //TODO
|
|
|
+ /*
|
|
|
+ @ApiOperation(value = "根据用户id和产品id,启用和停用功能", notes = "开通信息")
|
|
|
+ @PostMapping("/addOrganization")
|
|
|
+ @SysLogger("addOrganization")*/
|
|
|
+
|
|
|
+ //TODO
|
|
|
+ /* @ApiOperation(value = "根据用户id和产品id,启用和停用功能", notes = "开通信息")
|
|
|
+ @PostMapping("/addOrganization")
|
|
|
+ @SysLogger("addOrganization")*/
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|
|
|
+
|