diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java b/src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java index 516e505..95fca6d 100644 --- a/src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java +++ b/src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java @@ -2,6 +2,8 @@ package com.zteits.oa.api.dto.asraop.param; import com.zteits.oa.api.base.bean.BaseRequest; +import java.util.List; + public class AsraOpQueryReq extends BaseRequest{ /** @@ -12,7 +14,7 @@ public class AsraOpQueryReq extends BaseRequest{ /**主键*/ private Long id; - /**登录工号*/ + /**当前登录人的登录工号*/ private String loginCode; /**登录密码*/ @@ -25,6 +27,18 @@ public class AsraOpQueryReq extends BaseRequest{ private String email; + /**员工idlist*/ + private List opIdLists; + + + public List getOpIdLists() { + return opIdLists; + } + + public void setOpIdLists(List opIdLists) { + this.opIdLists = opIdLists; + } + public String getLoginCode() { return loginCode; } diff --git a/src/main/java/com/zteits/oa/api/dto/asraoprelations/AsraOpRelationsDTO.java b/src/main/java/com/zteits/oa/api/dto/asraoprelations/AsraOpRelationsDTO.java new file mode 100644 index 0000000..57ed3cc --- /dev/null +++ b/src/main/java/com/zteits/oa/api/dto/asraoprelations/AsraOpRelationsDTO.java @@ -0,0 +1,45 @@ +package com.zteits.oa.api.dto.asraoprelations; + +import com.zteits.oa.api.base.bean.BaiscDTO; + +public class AsraOpRelationsDTO extends BaiscDTO { + + /**父级ID*/ + private Long parentId; + + /**员工ID*/ + private Long opId; + + /**数据状态:1有效,0无效,2:锁定*/ + private Integer dataState; + + /**获取父级ID*/ + public Long getParentId() { + return parentId; + } + + /**设置父级ID*/ + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + /**获取员工ID*/ + public Long getOpId() { + return opId; + } + + /**设置员工ID*/ + public void setOpId(Long opId) { + this.opId = opId; + } + + /**获取数据状态:1有效,0无效,2:锁定*/ + public Integer getDataState() { + return dataState; + } + + /**设置数据状态:1有效,0无效,2:锁定*/ + public void setDataState(Integer dataState) { + this.dataState = dataState; + } +} \ No newline at end of file diff --git a/src/main/java/com/zteits/oa/api/dto/asraoprelations/param/AsraOpRelationsQueryReq.java b/src/main/java/com/zteits/oa/api/dto/asraoprelations/param/AsraOpRelationsQueryReq.java new file mode 100644 index 0000000..5b95328 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/dto/asraoprelations/param/AsraOpRelationsQueryReq.java @@ -0,0 +1,20 @@ +package com.zteits.oa.api.dto.asraoprelations.param; + +import com.zteits.oa.api.base.bean.BaseRequest; + +public class AsraOpRelationsQueryReq extends BaseRequest { + + /**父级ID*/ + private Long parentId; + + /**获取父级ID*/ + public Long getParentId() { + return parentId; + } + + /**设置父级ID*/ + public void setParentId(Long parentId) { + this.parentId = parentId; + } + +} \ No newline at end of file diff --git a/src/main/java/com/zteits/oa/api/service/report/query/AsraOpRueryService.java b/src/main/java/com/zteits/oa/api/service/report/query/AsraOpQueryService.java index 82a9c86..f568f74 100644 --- a/src/main/java/com/zteits/oa/api/service/report/query/AsraOpRueryService.java +++ b/src/main/java/com/zteits/oa/api/service/report/query/AsraOpQueryService.java @@ -23,7 +23,7 @@ import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; -public interface AsraOpRueryService { +public interface AsraOpQueryService { /** * 分页查询工时系统员工信息.
@@ -40,4 +40,14 @@ public interface AsraOpRueryService { */ BizResult queryAsraOp(AsraOpQueryReq asraOpQueryRe); + + /** + * 根据登录工号查询员工信息 + * @param + * @return + * @Author: xiejianpeng + * @Date: 2018/7/31 10:33 + * + */ + BizResult queryAsraOpByLoginCode(AsraOpQueryReq asraOpQueryReq); } diff --git a/src/main/java/com/zteits/oa/api/service/report/query/AsraOpRelationsQueryService.java b/src/main/java/com/zteits/oa/api/service/report/query/AsraOpRelationsQueryService.java new file mode 100644 index 0000000..93233b5 --- /dev/null +++ b/src/main/java/com/zteits/oa/api/service/report/query/AsraOpRelationsQueryService.java @@ -0,0 +1,38 @@ +package com.zteits.oa.api.service.report.query; + +import com.zteits.oa.api.base.bean.BizResult; +import com.zteits.oa.api.base.bean.PageBean; +import com.zteits.oa.api.dto.asraop.AsraOpDTO; +import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; +import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; +import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; + +import java.util.List; + +/** + * 员工关系表查询service.
+ * + * Copyright: Copyright (c) 2017 ZTE-ITS + * + * @ClassName: AmountUtils.java + * @Description: + * @version: v1.0.0 + * @author: wangfs + * @date: 2018年7月30日 + * Modification History: + * Date Author Version Description + *---------------------------------------------------------* + * 2018年7月30日 xiejp v1.0.0 创建 + */ +public interface AsraOpRelationsQueryService { + + /** + * 根据登录工号查询管理的员工信息 + * @param + * @return + * @Author: xiejianpeng + * @Date: 2018/7/31 10:33 + * + */ + BizResult> queryAsraOpRelations(AsraOpRelationsQueryReq asraOpRelationsQueryReq); +} diff --git a/src/main/java/com/zteits/oa/report/biz/AsraOpRueryServiceImpl.java b/src/main/java/com/zteits/oa/report/biz/AsraOpQueryServiceImpl.java index a90c758..4016882 100644 --- a/src/main/java/com/zteits/oa/report/biz/AsraOpRueryServiceImpl.java +++ b/src/main/java/com/zteits/oa/report/biz/AsraOpQueryServiceImpl.java @@ -12,7 +12,7 @@ import com.zteits.oa.api.base.bean.BizResult; import com.zteits.oa.api.base.bean.PageBean; import com.zteits.oa.api.dto.asraop.AsraOpDTO; import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; -import com.zteits.oa.api.service.report.query.AsraOpRueryService; +import com.zteits.oa.api.service.report.query.AsraOpQueryService; import com.zteits.oa.report.dao.AsraOpDao; import com.zteits.oa.report.domain.AsraOp; import com.zteits.oa.util.pagepaper.PageBeanUtil; @@ -32,9 +32,9 @@ import com.zteits.oa.util.pagepaper.PageBeanUtil; * 2018年7月30日 wangfs v1.0.0 创建 */ @Service("") -public class AsraOpRueryServiceImpl implements AsraOpRueryService { +public class AsraOpQueryServiceImpl implements AsraOpQueryService { - private static final Logger logger = LoggerFactory.getLogger(AsraOpRueryServiceImpl.class); + private static final Logger logger = LoggerFactory.getLogger(AsraOpQueryServiceImpl.class); @Autowired private AsraOpDao asraOpDao; /** @@ -68,4 +68,13 @@ public class AsraOpRueryServiceImpl implements AsraOpRueryService { return new BizResult(asraOpDTO); } + + @Override + public BizResult queryAsraOpByLoginCode(AsraOpQueryReq asraOpQueryReq) { + AsraOpDTO asraOpDTO = new AsraOpDTO(); + AsraOp asraOp = asraOpDao.queryAsraOpByLoginCode(asraOpQueryReq.getLoginCode()); + BeanUtils.copyProperties(asraOp,asraOpDTO); + return new BizResult<>(asraOpDTO); + } + } diff --git a/src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java b/src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java new file mode 100644 index 0000000..5436672 --- /dev/null +++ b/src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java @@ -0,0 +1,42 @@ +package com.zteits.oa.report.biz; + +import com.zteits.oa.api.base.bean.BizResult; +import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; +import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; +import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService; +import com.zteits.oa.report.dao.AsraOpRelationsDao; +import com.zteits.oa.report.domain.AsraOpRelations; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Copyright: Copyright (c) 2018 zteits + * + * @Description: + * @version: v1.0.0 + * @author: xiejianpeng + * @date: 2018/7/31 11 + * Modification History: + * Date Author Version Description + * ---------------------------------------------------------* + * 2018/7/31 xiejianpeng v1.0.0 创建 + */ +@Service +public class AsraOpRelationsQueryServiceImpl implements AsraOpRelationsQueryService { + + @Autowired + private AsraOpRelationsDao asraOpRelationsDao; + + @Override + public BizResult> queryAsraOpRelations(AsraOpRelationsQueryReq asraOpRelationsQueryReq) { + + List asraOpRelationsDTOs = new ArrayList<>(); + List asraOpRelationsList = asraOpRelationsDao.queryAsraOpRelations(asraOpRelationsQueryReq.getParentId()); + BeanUtils.copyProperties(asraOpRelationsList,asraOpRelationsDTOs,AsraOpRelationsDTO.class); + return new BizResult<>(asraOpRelationsDTOs); + } +} diff --git a/src/main/java/com/zteits/oa/report/dao/AsraOpDao.java b/src/main/java/com/zteits/oa/report/dao/AsraOpDao.java index 649ad83..d35da7c 100644 --- a/src/main/java/com/zteits/oa/report/dao/AsraOpDao.java +++ b/src/main/java/com/zteits/oa/report/dao/AsraOpDao.java @@ -15,7 +15,7 @@ public interface AsraOpDao { * 2018年7月30日 wangfs.
*/ PageInfo queryAsraOpForPage(AsraOpQueryReq asraOpQueryReq); - + /** * 获取员工信息.
* @param asraOpQueryRe @@ -23,4 +23,14 @@ public interface AsraOpDao { * 2018年7月31日 wangfs.
*/ AsraOp queryAsraOp(AsraOpQueryReq asraOpQueryRe); + + /** + * 根据登录工号查询员工信息 + * @param + * @return + * @Author: xiejianpeng + * @Date: 2018/7/31 10:36 + * + */ + AsraOp queryAsraOpByLoginCode(String loginCode); } diff --git a/src/main/java/com/zteits/oa/report/dao/AsraOpRelationsDao.java b/src/main/java/com/zteits/oa/report/dao/AsraOpRelationsDao.java new file mode 100644 index 0000000..4b556b5 --- /dev/null +++ b/src/main/java/com/zteits/oa/report/dao/AsraOpRelationsDao.java @@ -0,0 +1,30 @@ +package com.zteits.oa.report.dao; + +import com.zteits.oa.report.domain.AsraOpRelations; + +import java.util.List; + +/** + * Copyright: Copyright (c) 2018 zteits + * + * @Description: + * @version: v1.0.0 + * @author: xiejianpeng + * @date: 2018/7/31 11 + * Modification History: + * Date Author Version Description + * ---------------------------------------------------------* + * 2018/7/31 xiejianpeng v1.0.0 创建 + */ +public interface AsraOpRelationsDao { + + /** + * 根据登录工号查询管理的员工信息 + * @param + * @return + * @Author: xiejianpeng + * @Date: 2018/7/31 11:42 + * + */ + List queryAsraOpRelations(Long parentId); +} diff --git a/src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java b/src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java index 28ade5a..19b5b35 100644 --- a/src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java +++ b/src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java @@ -2,6 +2,8 @@ package com.zteits.oa.report.dao.impl; import java.util.List; +import com.zteits.oa.report.domain.AsraOpExample; +import com.zteits.oa.report.mapper.AsraOpMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -21,7 +23,7 @@ public class AsraOpDaoImpl implements AsraOpDao { @Autowired private AsraOpSmapper asraOpSmapper; - + @Autowired private AsraOpMapper asraOpMapper; /** @@ -62,4 +64,12 @@ public class AsraOpDaoImpl implements AsraOpDao { return CollectionUtils.isEmpty(list) ? new AsraOp() : list.get(0); } + @Override + public AsraOp queryAsraOpByLoginCode(String loginCode) { + AsraOpExample example = new AsraOpExample(); + example.createCriteria().andLoginCodeEqualTo(loginCode); + List berths = asraOpMapper.selectByExample(example); + return berths.get(0); + } + } diff --git a/src/main/java/com/zteits/oa/report/dao/impl/AsraOpRelationsDaoImpl.java b/src/main/java/com/zteits/oa/report/dao/impl/AsraOpRelationsDaoImpl.java new file mode 100644 index 0000000..68d80a4 --- /dev/null +++ b/src/main/java/com/zteits/oa/report/dao/impl/AsraOpRelationsDaoImpl.java @@ -0,0 +1,37 @@ +package com.zteits.oa.report.dao.impl; + +import com.zteits.oa.report.dao.AsraOpRelationsDao; +import com.zteits.oa.report.domain.AsraOpRelations; +import com.zteits.oa.report.domain.AsraOpRelationsExample; +import com.zteits.oa.report.mapper.AsraOpRelationsMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * Copyright: Copyright (c) 2018 zteits + * + * @Description: + * @version: v1.0.0 + * @author: xiejianpeng + * @date: 2018/7/31 11 + * Modification History: + * Date Author Version Description + * ---------------------------------------------------------* + * 2018/7/31 xiejianpeng v1.0.0 创建 + */ +@Component +public class AsraOpRelationsDaoImpl implements AsraOpRelationsDao { + + @Autowired + private AsraOpRelationsMapper asraOpRelationsMapper; + + @Override + public List queryAsraOpRelations(Long parentId) { + AsraOpRelationsExample example = new AsraOpRelationsExample(); + example.createCriteria().andParentIdEqualTo(parentId); + List asraOpRelationsList = asraOpRelationsMapper.selectByExample(example); + return asraOpRelationsList; + } +} diff --git a/src/main/java/com/zteits/oa/report/web/AsraOpController.java b/src/main/java/com/zteits/oa/report/web/AsraOpController.java index 7321ad4..7318efd 100644 --- a/src/main/java/com/zteits/oa/report/web/AsraOpController.java +++ b/src/main/java/com/zteits/oa/report/web/AsraOpController.java @@ -1,30 +1,69 @@ package com.zteits.oa.report.web; +import com.alibaba.fastjson.JSONObject; +import com.xiaoleilu.hutool.util.CollectionUtil; import com.zteits.oa.api.base.bean.BizResult; import com.zteits.oa.api.base.bean.PageBean; import com.zteits.oa.api.dto.asraop.AsraOpDTO; import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; -import com.zteits.oa.api.service.report.query.AsraOpRueryService; +import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; +import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; +import com.zteits.oa.api.service.report.query.AsraOpQueryService; +import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService; import io.swagger.annotations.Api; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cglib.core.CollectionUtils; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; @Api(value = "日报系统-员工管理", description = "日报系统-员工管理") @RestController @RequestMapping("/asraOp") public class AsraOpController { + private static final Logger logger = LoggerFactory.getLogger(AsraOpController.class); + + @Autowired + private AsraOpQueryService asraOpQueryService; + @Autowired - private AsraOpRueryService asraOpRueryService; + private AsraOpRelationsQueryService asraOpRelationsQueryService; + + + + @RequestMapping(value="/queryAsraOpPage",method = RequestMethod.POST) public BizResult> queryAsraOpPage(@RequestBody AsraOpQueryReq asraOpQueryReq, HttpServletRequest request){ - BizResult> result = asraOpRueryService.queryAsraOpForPage(asraOpQueryReq); + logger.info("日报系统-员工管理-根据登录人分页查询员工信息入参:{}", JSONObject.toJSON(asraOpQueryReq)); + /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/ + + AsraOpDTO asraOpDTO = null; + + /**2.判断登录人是领导还是员工 ,2:员工,1:领导*/ + List opIdLists = new ArrayList<>(); + opIdLists.add(asraOpDTO.getId()); + if(asraOpDTO.getRoleId() == 1){ + /**如果是领导,获取领导下面的员工信息*/ + AsraOpRelationsQueryReq asraOpRelationsQueryReq = new AsraOpRelationsQueryReq(); + asraOpRelationsQueryReq.setParentId(asraOpDTO.getId()); + BizResult> listBizResult = asraOpRelationsQueryService.queryAsraOpRelations(asraOpRelationsQueryReq); + if(listBizResult.isSuccess() && CollectionUtil.isNotEmpty(listBizResult.getData())){ + for(AsraOpRelationsDTO asraOpRelationsDTO : listBizResult.getData()){ + opIdLists.add(asraOpRelationsDTO.getOpId()); + } + } + } + BizResult> result = asraOpQueryService.queryAsraOpForPage(asraOpQueryReq); + logger.info("日报系统-员工管理-根据登录人分页查询员工信息结果:{}", JSONObject.toJSON(result)); return result; } diff --git a/src/main/java/com/zteits/oa/report/web/OAuthController.java b/src/main/java/com/zteits/oa/report/web/OAuthController.java index e5e258d..c6d8248 100644 --- a/src/main/java/com/zteits/oa/report/web/OAuthController.java +++ b/src/main/java/com/zteits/oa/report/web/OAuthController.java @@ -3,6 +3,7 @@ package com.zteits.oa.report.web; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import com.zteits.oa.api.service.report.query.AsraOpQueryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -19,7 +20,6 @@ import com.zteits.oa.api.dto.asraop.AsraOpDTO; import com.zteits.oa.api.dto.asraop.LoginOathRes; import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; import com.zteits.oa.api.dto.asraop.param.LoginOauthReq; -import com.zteits.oa.api.service.report.query.AsraOpRueryService; import com.zteits.oa.report.vo.OAuthResult; import com.zteits.oa.util.MD5Utils; @@ -33,7 +33,7 @@ public class OAuthController { private static final Logger logger = LoggerFactory.getLogger(OAuthController.class); @Autowired - private AsraOpRueryService asraOpRueryService; + private AsraOpQueryService asraOpQueryService; @Autowired private HttpServletRequest request; @@ -64,7 +64,7 @@ public class OAuthController { boolean isCheckSuccess = false; //1.判断登录账号/密码 asraOpQueryRe.setLoginCode(loginCode); - BizResult asraOpReult = asraOpRueryService.queryAsraOp(asraOpQueryRe); + BizResult asraOpReult = asraOpQueryService.queryAsraOp(asraOpQueryRe); if(asraOpReult != null && asraOpReult.getData() != null){ asraOpDTO = asraOpReult.getData(); if(StringUtils.isEmpty(asraOpDTO.getLoginCode())){ diff --git a/src/main/resources/mybatis/smapper/AsraOpSmapper.xml b/src/main/resources/mybatis/smapper/AsraOpSmapper.xml index 70fff19..1d82bec 100644 --- a/src/main/resources/mybatis/smapper/AsraOpSmapper.xml +++ b/src/main/resources/mybatis/smapper/AsraOpSmapper.xml @@ -31,15 +31,21 @@ from asra_op where 1=1 - + and login_code = #{loginCode,jdbcType=VARCHAR} - and op_name = #{opName,jdbcType=VARCHAR} + and op_name ike concat('${opName}','%') and email = #{email,jdbcType=VARCHAR} + + and id in + + #{opId} + + \ No newline at end of file