From b1704d7cf717475c8f3b86b7b7e51cb9f34a73bd Mon Sep 17 00:00:00 2001 From: wangfs <15029758498@163.com> Date: Thu, 2 Aug 2018 15:05:32 +0800 Subject: [PATCH] 提交 --- src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailyForTotalNumAndDetailReq.java | 14 ++++++++++++++ src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailySaveOrUpdateReq.java | 16 +++++++++++++++- src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java | 16 ++++++++-------- src/main/java/com/zteits/oa/api/service/report/query/AsraOpQueryService.java | 10 ++++++++++ src/main/java/com/zteits/oa/report/biz/AsraOpQueryServiceImpl.java | 20 +++++++++++++++++++- src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java | 44 -------------------------------------------- src/main/java/com/zteits/oa/report/dao/AsraOpDao.java | 10 ++++++++++ src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java | 24 ++++++------------------ src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java | 15 +++++++++++++++ src/main/java/com/zteits/oa/report/domain/AsraOpRelations.java | 55 ------------------------------------------------------- src/main/java/com/zteits/oa/report/domain/AsraOpRelationsExample.java | 440 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/main/java/com/zteits/oa/report/web/AsraDailyController.java | 5 +++-- src/main/java/com/zteits/oa/report/web/OAuthController.java | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------- 13 files changed, 180 insertions(+), 584 deletions(-) delete mode 100644 src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java delete mode 100644 src/main/java/com/zteits/oa/report/domain/AsraOpRelations.java delete mode 100644 src/main/java/com/zteits/oa/report/domain/AsraOpRelationsExample.java diff --git a/src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailyForTotalNumAndDetailReq.java b/src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailyForTotalNumAndDetailReq.java index 61dfdc4..9858168 100644 --- a/src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailyForTotalNumAndDetailReq.java +++ b/src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailyForTotalNumAndDetailReq.java @@ -1,5 +1,7 @@ package com.zteits.oa.api.dto.asradaily.param; +import java.util.List; + import com.zteits.oa.api.base.bean.BaseRequest; /** @@ -33,7 +35,19 @@ public class AsraDailyForTotalNumAndDetailReq extends BaseRequest{ /**员工名称.*/ private String opName; + /**父级ID 顶级为-1.*/ + private List opIds; + + + + public List getOpIds() { + return opIds; + } + + public void setOpIds(List opIds) { + this.opIds = opIds; + } public String getBeginTime() { return beginTime; diff --git a/src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailySaveOrUpdateReq.java b/src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailySaveOrUpdateReq.java index 89fdf41..698be2e 100644 --- a/src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailySaveOrUpdateReq.java +++ b/src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailySaveOrUpdateReq.java @@ -3,6 +3,7 @@ package com.zteits.oa.api.dto.asradaily.param; import com.zteits.oa.api.base.bean.BaiscDTO; import java.util.Date; +import java.util.List; public class AsraDailySaveOrUpdateReq extends BaiscDTO{ /**主键*/ @@ -52,8 +53,21 @@ public class AsraDailySaveOrUpdateReq extends BaiscDTO{ /**工时内容*/ private String dailyContent; + + /**员工ids.*/ + private List opIds; + + - /**获取主键*/ + public List getOpIds() { + return opIds; + } + + public void setOpIds(List opIds) { + this.opIds = opIds; + } + + /**获取主键*/ public Long getId() { return id; } 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 95fca6d..04b06e0 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 @@ -25,18 +25,18 @@ public class AsraOpQueryReq extends BaseRequest{ /**员工邮箱*/ private String email; + + /**父级ID 顶级为-1*/ + private Long parentId; + - /**员工idlist*/ - private List opIdLists; - - - public List getOpIdLists() { - return opIdLists; + public Long getParentId() { + return parentId; } - public void setOpIdLists(List opIdLists) { - this.opIdLists = opIdLists; + public void setParentId(Long parentId) { + this.parentId = parentId; } public String getLoginCode() { diff --git a/src/main/java/com/zteits/oa/api/service/report/query/AsraOpQueryService.java b/src/main/java/com/zteits/oa/api/service/report/query/AsraOpQueryService.java index f568f74..5ef5247 100644 --- a/src/main/java/com/zteits/oa/api/service/report/query/AsraOpQueryService.java +++ b/src/main/java/com/zteits/oa/api/service/report/query/AsraOpQueryService.java @@ -1,5 +1,7 @@ package com.zteits.oa.api.service.report.query; +import java.util.List; + import com.zteits.oa.api.base.bean.BizResult; import com.zteits.oa.api.base.bean.PageBean; import com.zteits.oa.api.dto.asraop.AsraOpDTO; @@ -50,4 +52,12 @@ public interface AsraOpQueryService { * */ BizResult queryAsraOpByLoginCode(AsraOpQueryReq asraOpQueryReq); + + /** + * 通过员工父级Id获取员工信息.
+ * @param asraOpQueryRe + * @return + * 2018年7月31日 wangfs.
+ */ + BizResult> queryAsraOpByParentId(AsraOpQueryReq asraOpQueryRe); } diff --git a/src/main/java/com/zteits/oa/report/biz/AsraOpQueryServiceImpl.java b/src/main/java/com/zteits/oa/report/biz/AsraOpQueryServiceImpl.java index 4016882..f522de4 100644 --- a/src/main/java/com/zteits/oa/report/biz/AsraOpQueryServiceImpl.java +++ b/src/main/java/com/zteits/oa/report/biz/AsraOpQueryServiceImpl.java @@ -1,5 +1,8 @@ package com.zteits.oa.report.biz; +import java.util.ArrayList; +import java.util.List; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; @@ -15,6 +18,7 @@ import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; 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.ListCopyUtil; import com.zteits.oa.util.pagepaper.PageBeanUtil; /** * 工时系统操作员实现类.
@@ -31,7 +35,7 @@ import com.zteits.oa.util.pagepaper.PageBeanUtil; *---------------------------------------------------------* * 2018年7月30日 wangfs v1.0.0 创建 */ -@Service("") +@Service("com.zteits.oa.report.biz.AsraOpQueryServiceImpl") public class AsraOpQueryServiceImpl implements AsraOpQueryService { private static final Logger logger = LoggerFactory.getLogger(AsraOpQueryServiceImpl.class); @@ -77,4 +81,18 @@ public class AsraOpQueryServiceImpl implements AsraOpQueryService { return new BizResult<>(asraOpDTO); } + /** + * 通过员工父级Id获取员工信息.
+ * @param asraOpQueryRe + * @return + * 2018年7月31日 wangfs.
+ */ + @Override + public BizResult> queryAsraOpByParentId(AsraOpQueryReq asraOpQueryRe) { + List listDTO = new ArrayList<>(); + List list = asraOpDao.queryAsraOpByParentId(asraOpQueryRe); + ListCopyUtil.listCopyProperties(list, listDTO, AsraOpDTO.class); + return new BizResult>(listDTO); + } + } diff --git a/src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java b/src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java deleted file mode 100644 index 03b33be..0000000 --- a/src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.zteits.oa.report.biz; - -import com.xiaoleilu.hutool.util.CollectionUtil; -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.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 = null;//asraOpRelationsDao.queryAsraOpRelations(asraOpRelationsQueryReq.getParentId()); - if(CollectionUtil.isNotEmpty(asraOpRelationsList)) { - 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 d35da7c..b64699d 100644 --- a/src/main/java/com/zteits/oa/report/dao/AsraOpDao.java +++ b/src/main/java/com/zteits/oa/report/dao/AsraOpDao.java @@ -1,5 +1,7 @@ package com.zteits.oa.report.dao; +import java.util.List; + import com.github.pagehelper.PageInfo; import com.zteits.oa.api.base.bean.BizResult; import com.zteits.oa.api.dto.asraop.AsraOpDTO; @@ -33,4 +35,12 @@ public interface AsraOpDao { * */ AsraOp queryAsraOpByLoginCode(String loginCode); + + /** + * 通过员工父级Id获取员工信息.
+ * @param asraOpQueryRe + * @return + * 2018年7月31日 wangfs.
+ */ + List queryAsraOpByParentId(AsraOpQueryReq asraOpQueryRe); } diff --git a/src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java b/src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java index 50dd97c..2e4b676 100644 --- a/src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java +++ b/src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java @@ -14,8 +14,6 @@ import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; import com.zteits.oa.report.dao.AsraDailyDao; import com.zteits.oa.report.domain.AsraDaily; import com.zteits.oa.report.domain.AsraDailyExample; -import com.zteits.oa.report.domain.AsraOpRelations; -import com.zteits.oa.report.domain.AsraOpRelationsExample; import com.zteits.oa.report.domain.sdo.AsraDailyDO; import com.zteits.oa.report.domain.sdo.AsraDailyOpNumForCurrentDayDO; import com.zteits.oa.report.mapper.AsraDailyMapper; @@ -71,23 +69,13 @@ public class AsraDailyDaoImpl implements AsraDailyDao{ public AsraDailyOpNumForCurrentDayDO queryAsraDailyOpNumForCurrentDay(AsraDailyForTotalNumAndDetailReq request) { AsraDailyOpNumForCurrentDayDO asraDailyOpNumForCurrentDayDO = new AsraDailyOpNumForCurrentDayDO(); List opList = new ArrayList<>(); + + //1.总人数获取 int employeeTotal = 0; -// //1.总人数获取 -// AsraOpRelationsExample example = new AsraOpRelationsExample(); -// example.createCriteria().andParentIdEqualTo(request.getOpId()); -// //List selectByExample = asraOpRelationsMapper.selectByExample(example); -// int employeeTotal = (CollectionUtil.isNotEmpty(selectByExample) ? selectByExample.size() +1 : 1); -// asraDailyOpNumForCurrentDayDO.setEmployeeTotal(employeeTotal); -// //获取员工人数 -// if(CollectionUtil.isNotEmpty(selectByExample)){ -// for(AsraOpRelations op:selectByExample){ -// if(op == null){ -// continue; -// } -// opList.add(op.getOpId()); -// } -// } - opList.add(request.getOpId());//查询自己id + if(CollectionUtil.isNotEmpty(request.getOpIds())){ + employeeTotal = request.getOpIds().size(); + } + //2.查询今日日报填写人数 AsraDailyExample exampleTwo = new AsraDailyExample(); exampleTwo.createCriteria().andAsarOpIdIn(opList) 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 6eb6347..0b5a4af 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 @@ -60,6 +60,7 @@ public class AsraOpDaoImpl implements AsraOpDao { if(asraOpQueryRe.getId() != null){ criteria.andIdEqualTo(asraOpQueryRe.getId()); } + criteria.andDataStateEqualTo(1); List list = asraOpMapper.selectByExample(example); return CollectionUtils.isEmpty(list) ? new AsraOp() : list.get(0); @@ -73,4 +74,18 @@ public class AsraOpDaoImpl implements AsraOpDao { return berths.get(0); } + /** + * 通过员工父级Id获取员工信息.
+ * @param asraOpQueryRe + * @return + * 2018年7月31日 wangfs.
+ */ + @Override + public List queryAsraOpByParentId(AsraOpQueryReq asraOpQueryRe) { + AsraOpExample example = new AsraOpExample(); + example.createCriteria().andParentIdEqualTo(asraOpQueryRe.getParentId()); + List list = asraOpMapper.selectByExample(example); + return list; + } + } diff --git a/src/main/java/com/zteits/oa/report/domain/AsraOpRelations.java b/src/main/java/com/zteits/oa/report/domain/AsraOpRelations.java deleted file mode 100644 index 17eb23c..0000000 --- a/src/main/java/com/zteits/oa/report/domain/AsraOpRelations.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.zteits.oa.report.domain; - -public class AsraOpRelations { - /**主键*/ - private Long id; - - /**父级ID*/ - private Long parentId; - - /**员工ID*/ - private Long opId; - - /**数据状态:1有效,0无效,2:锁定*/ - private Integer dataState; - - /**获取主键*/ - public Long getId() { - return id; - } - - /**设置主键*/ - public void setId(Long id) { - this.id = id; - } - - /**获取父级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/report/domain/AsraOpRelationsExample.java b/src/main/java/com/zteits/oa/report/domain/AsraOpRelationsExample.java deleted file mode 100644 index b97cb96..0000000 --- a/src/main/java/com/zteits/oa/report/domain/AsraOpRelationsExample.java +++ /dev/null @@ -1,440 +0,0 @@ -package com.zteits.oa.report.domain; - -import java.util.ArrayList; -import java.util.List; - -public class AsraOpRelationsExample { - protected String orderByClause; - - protected boolean distinct; - - protected List oredCriteria; - - public AsraOpRelationsExample() { - oredCriteria = new ArrayList(); - } - - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - public String getOrderByClause() { - return orderByClause; - } - - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - public boolean isDistinct() { - return distinct; - } - - public List getOredCriteria() { - return oredCriteria; - } - - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andParentIdIsNull() { - addCriterion("parent_id is null"); - return (Criteria) this; - } - - public Criteria andParentIdIsNotNull() { - addCriterion("parent_id is not null"); - return (Criteria) this; - } - - public Criteria andParentIdEqualTo(Long value) { - addCriterion("parent_id =", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotEqualTo(Long value) { - addCriterion("parent_id <>", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdGreaterThan(Long value) { - addCriterion("parent_id >", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdGreaterThanOrEqualTo(Long value) { - addCriterion("parent_id >=", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLessThan(Long value) { - addCriterion("parent_id <", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLessThanOrEqualTo(Long value) { - addCriterion("parent_id <=", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdIn(List values) { - addCriterion("parent_id in", values, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotIn(List values) { - addCriterion("parent_id not in", values, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdBetween(Long value1, Long value2) { - addCriterion("parent_id between", value1, value2, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotBetween(Long value1, Long value2) { - addCriterion("parent_id not between", value1, value2, "parentId"); - return (Criteria) this; - } - - public Criteria andOpIdIsNull() { - addCriterion("op_id is null"); - return (Criteria) this; - } - - public Criteria andOpIdIsNotNull() { - addCriterion("op_id is not null"); - return (Criteria) this; - } - - public Criteria andOpIdEqualTo(Long value) { - addCriterion("op_id =", value, "opId"); - return (Criteria) this; - } - - public Criteria andOpIdNotEqualTo(Long value) { - addCriterion("op_id <>", value, "opId"); - return (Criteria) this; - } - - public Criteria andOpIdGreaterThan(Long value) { - addCriterion("op_id >", value, "opId"); - return (Criteria) this; - } - - public Criteria andOpIdGreaterThanOrEqualTo(Long value) { - addCriterion("op_id >=", value, "opId"); - return (Criteria) this; - } - - public Criteria andOpIdLessThan(Long value) { - addCriterion("op_id <", value, "opId"); - return (Criteria) this; - } - - public Criteria andOpIdLessThanOrEqualTo(Long value) { - addCriterion("op_id <=", value, "opId"); - return (Criteria) this; - } - - public Criteria andOpIdIn(List values) { - addCriterion("op_id in", values, "opId"); - return (Criteria) this; - } - - public Criteria andOpIdNotIn(List values) { - addCriterion("op_id not in", values, "opId"); - return (Criteria) this; - } - - public Criteria andOpIdBetween(Long value1, Long value2) { - addCriterion("op_id between", value1, value2, "opId"); - return (Criteria) this; - } - - public Criteria andOpIdNotBetween(Long value1, Long value2) { - addCriterion("op_id not between", value1, value2, "opId"); - return (Criteria) this; - } - - public Criteria andDataStateIsNull() { - addCriterion("data_state is null"); - return (Criteria) this; - } - - public Criteria andDataStateIsNotNull() { - addCriterion("data_state is not null"); - return (Criteria) this; - } - - public Criteria andDataStateEqualTo(Integer value) { - addCriterion("data_state =", value, "dataState"); - return (Criteria) this; - } - - public Criteria andDataStateNotEqualTo(Integer value) { - addCriterion("data_state <>", value, "dataState"); - return (Criteria) this; - } - - public Criteria andDataStateGreaterThan(Integer value) { - addCriterion("data_state >", value, "dataState"); - return (Criteria) this; - } - - public Criteria andDataStateGreaterThanOrEqualTo(Integer value) { - addCriterion("data_state >=", value, "dataState"); - return (Criteria) this; - } - - public Criteria andDataStateLessThan(Integer value) { - addCriterion("data_state <", value, "dataState"); - return (Criteria) this; - } - - public Criteria andDataStateLessThanOrEqualTo(Integer value) { - addCriterion("data_state <=", value, "dataState"); - return (Criteria) this; - } - - public Criteria andDataStateIn(List values) { - addCriterion("data_state in", values, "dataState"); - return (Criteria) this; - } - - public Criteria andDataStateNotIn(List values) { - addCriterion("data_state not in", values, "dataState"); - return (Criteria) this; - } - - public Criteria andDataStateBetween(Integer value1, Integer value2) { - addCriterion("data_state between", value1, value2, "dataState"); - return (Criteria) this; - } - - public Criteria andDataStateNotBetween(Integer value1, Integer value2) { - addCriterion("data_state not between", value1, value2, "dataState"); - return (Criteria) this; - } - } - - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/zteits/oa/report/web/AsraDailyController.java b/src/main/java/com/zteits/oa/report/web/AsraDailyController.java index 6e4088b..0e2fd5a 100644 --- a/src/main/java/com/zteits/oa/report/web/AsraDailyController.java +++ b/src/main/java/com/zteits/oa/report/web/AsraDailyController.java @@ -17,6 +17,7 @@ import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; import com.zteits.oa.api.dto.asradaily.param.AsraDailySaveOrUpdateReq; import com.zteits.oa.api.dto.asraop.AsraOpDTO; import com.zteits.oa.api.service.report.query.AsraDailyQueryService; +import com.zteits.oa.report.domain.AsraDaily; import com.zteits.oa.util.pagepaper.DateForObjectUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -72,7 +73,7 @@ public class AsraDailyController { if(asraOpDTO == null ){ throw new BizException(ErrorType.PARAMM_NULL,"获取session为空"); } - request.setOpId(asraOpDTO.getId()); + request.setOpIds(asraOpDTO.getOpIds()); BizResult result = asraDailyQueryService.queryAsraDailyOpNumForCurrentDay(request); logger.info("--end工时查询-当天填报人数统计(汇总),结果={}",JSONObject.toJSON(result)); return result; @@ -93,7 +94,7 @@ public class AsraDailyController { if(asraOpDTO == null ){ throw new BizException(ErrorType.PARAMM_NULL,"获取session为空"); } - request.setOpId(asraOpDTO.getId()); + request.setOpIds(asraOpDTO.getOpIds()); BizResult result = asraDailyQueryService.queryAsraDailyAllForList(request); logger.info("--end工时查询-所有员工及自己或者自己日报,结果={}",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 f3a985b..2526c7b 100644 --- a/src/main/java/com/zteits/oa/report/web/OAuthController.java +++ b/src/main/java/com/zteits/oa/report/web/OAuthController.java @@ -1,5 +1,7 @@ package com.zteits.oa.report.web; +import static org.mockito.Matchers.contains; + import java.util.ArrayList; import java.util.List; @@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; 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.constants.ErrorType; import com.zteits.oa.api.base.constants.SessionEnum; @@ -93,7 +96,7 @@ public class OAuthController { List opIds = new ArrayList<>(); opIds.add(asraOpDTO.getId()); /**递归查询员工ids.*/ - opIds = queryOpTreeByOpId(asraOpDTO.getParentId(),opIds); + opIds = queryOpTreeByOpId(asraOpDTO.getId()); logger.info("---获取到的opIds={}",JSONObject.toJSON(opIds)); asraOpDTO.setOpIds(opIds); HttpSession session = request.getSession(); @@ -140,22 +143,84 @@ public class OAuthController { * @return * 2018年8月2日 wangfs.
*/ - private List queryOpTreeByOpId(Long parentOpId,List opList){ - if(parentOpId != null && !parentOpId.equals(-1L)){ - AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); - asraOpQueryRe.setId(parentOpId); - BizResult asraOpReult = asraOpQueryService.queryAsraOp(asraOpQueryRe); - if(asraOpReult != null && asraOpReult.getData() != null){ - AsraOpDTO data = asraOpReult.getData(); - if(data != null){ - opList.add(data.getId()); - } - queryOpTreeByOpId(data.getParentId(),opList); - } - } + private List queryOpTreeByOpId(Long opId){ + List rootAllList = new ArrayList<>(); + rootAllList.add(opId); + //1.查找第一级下的所有用户 + List rootOpIds = this.getRootOpIds(opId); - return opList; + //2.查找第二级以下所有用户 + if(CollectionUtil.isNotEmpty(rootOpIds)){ + rootAllList.addAll(rootOpIds); + for(Long getOpId:rootOpIds ){ + List childOpIds = new ArrayList<>(); + this.getChildOpIds(getOpId,childOpIds); + rootAllList.addAll(childOpIds); + } + + } + return rootAllList; + } + + /** + * 递归查找一级以下的用户 + * @param parentId + * @return + * 2018年8月2日 wangfs.
+ */ + private List getChildOpIds(Long parentId,List childOpIds){ + AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); + asraOpQueryRe.setParentId(parentId); + BizResult> asraOpReult = asraOpQueryService.queryAsraOpByParentId(asraOpQueryRe); + if(asraOpReult != null && CollectionUtil.isNotEmpty(asraOpReult.getData())){ + List list = asraOpReult.getData(); + for(AsraOpDTO asraOpDTO :list){ + if(asraOpDTO == null){ + continue; + } + childOpIds.add(asraOpDTO.getId()); + } + + //遍历下一级 + if(CollectionUtil.isNotEmpty(childOpIds)){ + for(Long opId:childOpIds){ + if(opId != null && !opId.equals(parentId)){ + getChildOpIds(opId,childOpIds); + } + break; + + } + + } + } + + return childOpIds; } + + /** + * 查找登陆用户下一级用户 + * @param opId + * @param opList + * @return + * 2018年8月2日 wangfs.
+ */ + private List getRootOpIds(Long parentId){ + List opList = new ArrayList<>(); + AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); + asraOpQueryRe.setParentId(parentId); + BizResult> asraOpReult = asraOpQueryService.queryAsraOpByParentId(asraOpQueryRe); + if(asraOpReult != null && CollectionUtil.isNotEmpty(asraOpReult.getData())){ + List list = asraOpReult.getData(); + for(AsraOpDTO asraOpDTO :list){ + if(asraOpDTO == null){ + continue; + } + opList.add(asraOpDTO.getId()); + } + } + return opList; + } + } -- libgit2 0.21.4