新增根据职位名称查询人员的接口

yun-zuoyi
nies 4 years ago
parent d5189ee5b6
commit f45ff23249

@ -111,4 +111,12 @@ public interface ISysPositionService extends ICrudService<SysPosition> {
*/ */
@ApiOperation(value = "查询符合条件的岗位信息", notes = "根据SysPosition查询所有符合条件的岗位") @ApiOperation(value = "查询符合条件的岗位信息", notes = "根据SysPosition查询所有符合条件的岗位")
List<SysPosition> findAllByBaseBean(SysPosition sysPosition); List<SysPosition> findAllByBaseBean(SysPosition sysPosition);
/**
*
* @param positionName
* @return
*/
@ApiOperation(value = "根据岗位名称查询岗位信息", notes = "根据岗位名称查询岗位信息")
List<SysPosition> findAllByPositionName(String positionName);
} }

@ -142,6 +142,15 @@ public interface ISysUserInfoService {
@ApiOperation(value = "关系查询-用户岗位",notes = "查询用户岗位关系") @ApiOperation(value = "关系查询-用户岗位",notes = "查询用户岗位关系")
List<SysRefUserPosition> findSysRefUserPositionByUserId(Long userId); List<SysRefUserPosition> findSysRefUserPositionByUserId(Long userId);
/**
*
* @param positionName
* @return SysRefUserPosition
*/
@ApiOperation(value = "关系查询-用户岗位",notes = "查询用户岗位关系")
List<SysRefUserPosition> findSysRefUserPositionByPositionName(String positionName);
/** /**
* (ID,ID,,) * (ID,ID,,)
* @param info * @param info

@ -9,6 +9,7 @@ import cn.estsh.i3plus.platform.common.tool.StringTool;
import cn.estsh.i3plus.platform.common.util.CommonConstWords; import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.platform.common.util.FileContentTypeTool; import cn.estsh.i3plus.platform.common.util.FileContentTypeTool;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords; import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.Pager;
@ -598,6 +599,19 @@ public class SysUserInfoController extends CoreBaseController {
} }
} }
@GetMapping("/find-position-ref-user")
@ApiOperation(value = "根据职位名称查询用户信息", notes = "根据职位名称查询用户信息")
public BaseResultBean<SysRefUserPosition> findUserByPositionName(String positionName) {
try {
List<SysRefUserPosition> resultList = sysUserInfoService.findSysRefUserPositionByPositionName(positionName);
return new ResultBean().setSuccess(true).setResultList(resultList).build();
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
/** /**
* @param userInfoList * @param userInfoList
* @param faildList * @param faildList

@ -14,14 +14,18 @@ import cn.estsh.i3plus.pojo.platform.repository.SysPositionRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysUserInfoRepository; import cn.estsh.i3plus.pojo.platform.repository.SysUserInfoRepository;
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack; import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
import cn.estsh.impp.framework.base.service.CrudService; import cn.estsh.impp.framework.base.service.CrudService;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ValidatorBean; import cn.estsh.impp.framework.boot.util.ValidatorBean;
import com.dingtalk.api.request.OapiAlitripBtripApprovalNewRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example; import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -128,4 +132,16 @@ public class SysPositionService extends CrudService<SysPosition> implements ISys
return this.positionRDao.findAll(example); return this.positionRDao.findAll(example);
} }
@Override
public List<SysPosition> findAllByPositionName(String positionName) {
List<SysPosition> positionList = new ArrayList();
if (StringUtils.isEmpty(positionName)) {
return positionList;
}
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(AuthUtil.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(positionName, "name", ddlPackBean);
positionList = this.positionRDao.findByHqlWhere(ddlPackBean);
return positionList;
}
} }

@ -8,11 +8,13 @@ import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.base.common.PagerHelper;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.base.tool.HqlPack; import cn.estsh.i3plus.pojo.base.tool.HqlPack;
import cn.estsh.i3plus.pojo.model.platform.UserDetailModel; import cn.estsh.i3plus.pojo.model.platform.UserDetailModel;
import cn.estsh.i3plus.pojo.platform.bean.*; import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.i3plus.pojo.platform.repository.*; import cn.estsh.i3plus.pojo.platform.repository.*;
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack; import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum; import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -21,6 +23,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -335,6 +338,27 @@ public class SysUserInfoService implements ISysUserInfoService {
} }
@Override @Override
public List<SysRefUserPosition> findSysRefUserPositionByPositionName(String positionName) {
List<SysRefUserPosition> users = new ArrayList();
if (StringUtils.isEmpty(positionName)) {
return users;
}
List<SysPosition> positionList = positionService.findAllByPositionName(positionName);
if (ObjectUtils.isEmpty(positionList)) {
return users;
}
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(AuthUtil.getOrganizeCode());
DdlPreparedPack.getInPackList(
positionList.stream().map(el -> el.getId()).collect(Collectors.toList()),
"positionId",
ddlPackBean
);
users = refUserPositionRDao.findByHqlWhere(ddlPackBean);
return users;
}
@Override
@ApiOperation(value = "用户唯一校验", notes = "校验用户信息唯一性") @ApiOperation(value = "用户唯一校验", notes = "校验用户信息唯一性")
public void checkSysUserInfoOnly(SysUserInfo userInfo) { public void checkSysUserInfoOnly(SysUserInfo userInfo) {
if (userInfo != null) { if (userInfo != null) {

@ -55,6 +55,10 @@ public class MailUtil {
private boolean isAuthenticationSMTP = false; private boolean isAuthenticationSMTP = false;
private final List<BodyPart> attachmentList = new ArrayList<>(); private final List<BodyPart> attachmentList = new ArrayList<>();
private static final int MAIL_SMTP_TIMEOUT =10000;
private static final int MAIL_SMTP_CONNECTIONTIMEOUT =10000;
private static final int MAIL_SMTP_WRITETIMEOUT =10000;
/** /**
* *
* *
@ -255,6 +259,11 @@ public class MailUtil {
Properties server = new Properties(); Properties server = new Properties();
server.put("mail.smtp.port", String.valueOf(this.smtpPort)); server.put("mail.smtp.port", String.valueOf(this.smtpPort));
server.put("mail.smtp.host", this.smtpHost); server.put("mail.smtp.host", this.smtpHost);
//设置邮件的默认的超时时间
server.put("mail.smtp.timeout", MAIL_SMTP_TIMEOUT);
server.put("mail.smtp.connectiontimeout", MAIL_SMTP_CONNECTIONTIMEOUT);
server.put("mail.smtp.writetimeout", MAIL_SMTP_WRITETIMEOUT);
if (this.isAuthenticationSMTP) { if (this.isAuthenticationSMTP) {
server.put("mail.smtp.auth", "true"); server.put("mail.smtp.auth", "true");
} }
@ -366,12 +375,12 @@ public class MailUtil {
mailConfig.setMailPassword("Aa135790"); mailConfig.setMailPassword("Aa135790");
MailUtil mailUtil = new MailUtil(); MailUtil mailUtil = new MailUtil();
mailUtil.init(mailConfig); mailUtil.init(mailConfig);
mailUtil.setNick("yunhao"); mailUtil.setNick("ns");
mailUtil.setTo("yunhaok@163.com"); mailUtil.setTo("13298408382@163.com");
mailUtil.setContentType(ImppEnumUtil.MESSAGE_TYPE_CONTENT.TEXT.getDescription()); mailUtil.setContentType(ImppEnumUtil.MESSAGE_TYPE_CONTENT.TEXT.getDescription());
mailUtil.setSubject("test"); mailUtil.setSubject("test");
mailUtil.setBody("666"); mailUtil.setBody("666");
File file = new File("C:\\Users\\yunha\\Desktop\\miss_file (2).txt"); File file = new File("C:\\Users\\ns\\Desktop\\test.txt");
mailUtil.addAttachment(file); mailUtil.addAttachment(file);
mailUtil.send(); mailUtil.send();

@ -1,5 +1,6 @@
package test.cn.estsh.i3plus.core.apiservice.serviceimpl.busi; package test.cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.core.apiservice.auth.realm.UserAuthRealm;
import cn.estsh.i3plus.pojo.base.shirotoken.UserToken; import cn.estsh.i3plus.pojo.base.shirotoken.UserToken;
import cn.estsh.i3plus.pojo.platform.bean.SessionUser; import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil; import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
@ -45,7 +46,7 @@ public class TestBase {
SessionContext sessionContext = new DefaultSessionContext(); SessionContext sessionContext = new DefaultSessionContext();
sessionContext.setHost("localhost"); sessionContext.setHost("localhost");
ImppUserAuthRealm userAuthRealm = (ImppUserAuthRealm) SpringContextsUtil.getBean(ImppUserAuthRealm.class); UserAuthRealm userAuthRealm = (UserAuthRealm) SpringContextsUtil.getBean(UserAuthRealm.class);
org.apache.shiro.mgt.SecurityManager securityManager = new DefaultSecurityManager(userAuthRealm); org.apache.shiro.mgt.SecurityManager securityManager = new DefaultSecurityManager(userAuthRealm);
SecurityUtils.setSecurityManager(securityManager); SecurityUtils.setSecurityManager(securityManager);
securityManager.start(sessionContext); securityManager.start(sessionContext);

@ -31,14 +31,14 @@ public class TestMailUtil extends TestBase {
mailConfig.setMailHost("smtphm.qiye.163.com"); mailConfig.setMailHost("smtphm.qiye.163.com");
mailConfig.setMailPort(25); mailConfig.setMailPort(25);
mailConfig.setMailNick(""); mailConfig.setMailNick("");
mailConfig.setMailUser("impp.dev@sss.com"); mailConfig.setMailUser("impp-test@estsh.com");
mailConfig.setMailPassword("Aa135790s"); mailConfig.setMailPassword("Aa135790");
MailUtil mailUtil = new MailUtil(); MailUtil mailUtil = new MailUtil();
try { try {
mailUtil.setTo("yunhao.wang@estsh.com"); mailUtil.setTo("13298408382@163.com");
mailUtil.setBody("zhenw"); mailUtil.setBody("测试");
mailUtil.setSubject("title"); mailUtil.setSubject("发送邮件测试");
mailUtil.setContentType(ImppEnumUtil.MESSAGE_TYPE_CONTENT.HTML.getDescription()); mailUtil.setContentType(ImppEnumUtil.MESSAGE_TYPE_CONTENT.HTML.getDescription());
mailUtil.init(mailConfig).send(); mailUtil.init(mailConfig).send();
} catch (Exception e){ } catch (Exception e){

Loading…
Cancel
Save