use of com.bc.pmpheep.back.po.OrgUser in project pmph by BCSquad.
the class SsoHelperTest method createSSOAccount.
@Test
public void createSSOAccount() {
// SSO已存在该账号,理应报错
OrgUser orgUser = new OrgUser("gugia", "123");
String msg = ssoHelper.createSSOAccount(orgUser);
logger.info(msg);
Assert.assertFalse(msg.equals("success"));
}
use of com.bc.pmpheep.back.po.OrgUser in project pmph by BCSquad.
the class OrgUserServiceImpl method resetPassword.
@Override
public String resetPassword(Long id) throws CheckedServiceException {
if (ObjectUtil.isNull(id)) {
throw new CheckedServiceException(CheckedExceptionBusiness.ORG, CheckedExceptionResult.NULL_PARAM, "参数为空");
}
String password = "123456";
OrgUser orgUser = orgUserDao.getOrgUserById(id);
DesRun desRun = new DesRun(orgUser.getUsername(), password);
orgUser.setPassword(desRun.enpsw);
orgUserDao.updateOrgUser(orgUser);
return password;
}
use of com.bc.pmpheep.back.po.OrgUser in project pmph by BCSquad.
the class OrgUserServiceImpl method updateOrgUserOfBack.
@Override
public String updateOrgUserOfBack(OrgAndOrgUserVO orgAndOrgUserVO) throws CheckedServiceException {
OrgUser username = orgUserDao.getOrgUserById(orgAndOrgUserVO.getId());
if (!username.getUsername().equals(orgAndOrgUserVO.getUsername())) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.ILLEGAL_PARAM, "机构代码不相同");
}
if (ObjectUtil.isNull(orgAndOrgUserVO.getId())) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.NULL_PARAM, "主键为空");
}
if (StringUtil.strLength(orgAndOrgUserVO.getUsername()) > 20) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.ILLEGAL_PARAM, "用户名不能超过20个字符");
}
if (StringUtil.isEmpty(orgAndOrgUserVO.getUsername())) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.NULL_PARAM, "机构代码不能为空");
}
if (StringUtil.strLength(orgAndOrgUserVO.getRealname()) > 20) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.ILLEGAL_PARAM, "管理员姓名不能超过20个字符");
}
if (StringUtil.strLength(orgAndOrgUserVO.getNote()) > 100) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.ILLEGAL_PARAM, "备注不能超过100个字符");
}
if (!StringUtil.isEmpty(orgAndOrgUserVO.getEmail())) {
if (!ValidatUtil.checkEmail(orgAndOrgUserVO.getEmail())) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.ILLEGAL_PARAM, "邮箱不符合规范");
}
}
if (!StringUtil.isEmpty(orgAndOrgUserVO.getHandphone())) {
if (!ValidatUtil.checkMobileNumber(orgAndOrgUserVO.getHandphone())) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.ILLEGAL_PARAM, "手机号码不符合规范");
}
}
if (StringUtil.isEmpty(orgAndOrgUserVO.getOrgName())) {
throw new CheckedServiceException(CheckedExceptionBusiness.ORG, CheckedExceptionResult.ILLEGAL_PARAM, "机构名称为空");
}
if (StringUtil.strLength(orgAndOrgUserVO.getOrgName()) > 20) {
throw new CheckedServiceException(CheckedExceptionBusiness.ORG, CheckedExceptionResult.ILLEGAL_PARAM, "机构名称过长");
}
// 通过id查询机构用户来判断该机构名称是否被使用或者用户名等于数据库的机构
Org orgname = orgDao.getOrgById(orgAndOrgUserVO.getOrgId());
if (!orgname.getOrgName().equals(orgAndOrgUserVO.getOrgName())) {
if (orgDao.getOrgByOrgName(orgAndOrgUserVO.getOrgName()).size() > 0) {
throw new CheckedServiceException(CheckedExceptionBusiness.ORG, CheckedExceptionResult.ILLEGAL_PARAM, "该机构名称已被使用,请重新输入");
}
}
Org org = new Org();
org.setId(orgAndOrgUserVO.getOrgId());
org.setOrgName(orgAndOrgUserVO.getOrgName());
org.setOrgTypeId(orgAndOrgUserVO.getOrgTypeId());
org.setAreaId(orgAndOrgUserVO.getAreaId());
if (ObjectUtil.notNull(org)) {
orgDao.updateOrg(org);
}
OrgUser orgUser = new OrgUser();
orgUser.setId(orgAndOrgUserVO.getId());
if (StringUtil.isEmpty(orgAndOrgUserVO.getRealname())) {
orgUser.setRealname(orgAndOrgUserVO.getUsername());
} else {
orgUser.setRealname(orgAndOrgUserVO.getRealname());
}
orgUser.setIsDisabled(orgAndOrgUserVO.getIsDisabled());
orgUser.setHandphone(orgAndOrgUserVO.getHandphone());
orgUser.setEmail(orgAndOrgUserVO.getEmail());
orgUser.setAddress(orgAndOrgUserVO.getNote());
String result = "FAIL";
if (ObjectUtil.notNull(orgUser)) {
// 返回的影响行数,如果不是影响0行就是添加成功
int count = orgUserDao.updateOrgUser(orgUser);
if (count > 0) {
result = "SUCCESS";
}
}
return result;
}
use of com.bc.pmpheep.back.po.OrgUser in project pmph by BCSquad.
the class OrgUserServiceImpl method updateOrgUserProgressById.
@Override
public Integer updateOrgUserProgressById(Integer progress, List<Long> orgUserIds) throws CheckedServiceException, IOException {
if (CollectionUtil.isEmpty(orgUserIds) || ObjectUtil.isNull(progress)) {
throw new CheckedServiceException(CheckedExceptionBusiness.SCHOOL_ADMIN_CHECK, CheckedExceptionResult.NULL_PARAM, "参数为空");
}
List<OrgUser> orgUserList = orgUserDao.getOrgUserByIds(orgUserIds);
Integer count = 0;
if (CollectionUtil.isNotEmpty(orgUserList)) {
List<OrgUser> orgUsers = new ArrayList<OrgUser>(orgUserList.size());
for (OrgUser orgUser : orgUserList) {
if (Const.ORG_USER_PROGRESS_1 == orgUser.getProgress() || Const.ORG_USER_PROGRESS_2 == orgUser.getProgress()) {
throw new CheckedServiceException(CheckedExceptionBusiness.USER_MANAGEMENT, CheckedExceptionResult.NULL_PARAM, "已审核的用户不能再次审核");
}
orgUsers.add(new OrgUser(orgUser.getId(), progress));
}
if (CollectionUtil.isNotEmpty(orgUsers)) {
count = orgUserDao.updateOrgUserProgressById(orgUsers);
}
}
Boolean isPass = null;
if (1 == progress) {
isPass = true;
}
if (2 == progress) {
isPass = false;
}
if (null != isPass) {
// 推送机构认证审核信息
systemMessageService.sendWhenManagerCertificationAudit(orgUserIds, isPass);
}
return count;
}
use of com.bc.pmpheep.back.po.OrgUser in project pmph by BCSquad.
the class UserMessageServiceImpl method getUserMessageById.
@Override
public Map<String, Object> getUserMessageById(Long userMsgId) {
Map<String, Object> resultMap = new HashMap<String, Object>();
if (ObjectUtil.isNull(userMsgId)) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "消息ID为空!");
}
UserMessage userMessage = userMessageDao.getUserMessageById(userMsgId);
if (ObjectUtil.isNull(userMessage)) {
throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE, CheckedExceptionResult.NULL_PARAM, "用户消息对象为空!");
}
String realName = null;
if (Const.SENDER_TYPE_0 == userMessage.getSenderType() || Const.SENDER_TYPE_1 == userMessage.getSenderType()) {
PmphUser pmphUser = pmphUserService.get(userMessage.getSenderId());
realName = pmphUser.getRealname();
}
if (Const.SENDER_TYPE_2 == userMessage.getSenderType()) {
WriterUser writerUser = writerUserService.get(userMessage.getSenderId());
realName = writerUser.getRealname();
}
if (Const.SENDER_TYPE_3 == userMessage.getSenderType()) {
OrgUser orgUser = orgUserService.getOrgUserById(userMessage.getSenderId());
realName = orgUser.getRealname();
}
// 主键ID
resultMap.put("msgId", userMessage.getId());
// 标题
resultMap.put("title", userMessage.getTitle());
// 发送者
resultMap.put("senderName", realName);
// 发送时间
resultMap.put("senderDate", userMessage.getGmtCreate());
// 获取消息内容
Message message = messageService.get(userMessage.getMsgId());
if (ObjectUtil.notNull(message)) {
// throw new CheckedServiceException(CheckedExceptionBusiness.MESSAGE,
// CheckedExceptionResult.NULL_PARAM, "消息对象为空!");
// 内容
resultMap.put("content", message.getContent());
List<MessageAttachment> messageAttachments = messageAttachmentService.getMessageAttachmentByMsgId(message.getId());
if (CollectionUtil.isNotEmpty(messageAttachments)) {
for (MessageAttachment mAttachment : messageAttachments) {
String attachmentId = mAttachment.getAttachment();
mAttachment.setAttachment(Const.FILE_DOWNLOAD + attachmentId);
}
}
// 内容附件
resultMap.put("MessageAttachment", messageAttachments);
}
return resultMap;
}
Aggregations