Commit b1704d7cf717475c8f3b86b7b7e51cb9f34a73bd
1 parent
d0a6a58f
提交
Showing
13 changed files
with
180 additions
and
584 deletions
src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailyForTotalNumAndDetailReq.java
1 | 1 | package com.zteits.oa.api.dto.asradaily.param; |
2 | 2 | |
3 | +import java.util.List; | |
4 | + | |
3 | 5 | import com.zteits.oa.api.base.bean.BaseRequest; |
4 | 6 | |
5 | 7 | /** |
... | ... | @@ -33,7 +35,19 @@ public class AsraDailyForTotalNumAndDetailReq extends BaseRequest{ |
33 | 35 | |
34 | 36 | /**员工名称.*/ |
35 | 37 | private String opName; |
38 | + /**父级ID 顶级为-1.*/ | |
39 | + private List<Long> opIds; | |
40 | + | |
36 | 41 | |
42 | + | |
43 | + | |
44 | + public List<Long> getOpIds() { | |
45 | + return opIds; | |
46 | + } | |
47 | + | |
48 | + public void setOpIds(List<Long> opIds) { | |
49 | + this.opIds = opIds; | |
50 | + } | |
37 | 51 | |
38 | 52 | public String getBeginTime() { |
39 | 53 | return beginTime; | ... | ... |
src/main/java/com/zteits/oa/api/dto/asradaily/param/AsraDailySaveOrUpdateReq.java
... | ... | @@ -3,6 +3,7 @@ package com.zteits.oa.api.dto.asradaily.param; |
3 | 3 | import com.zteits.oa.api.base.bean.BaiscDTO; |
4 | 4 | |
5 | 5 | import java.util.Date; |
6 | +import java.util.List; | |
6 | 7 | |
7 | 8 | public class AsraDailySaveOrUpdateReq extends BaiscDTO{ |
8 | 9 | /**主键*/ |
... | ... | @@ -52,8 +53,21 @@ public class AsraDailySaveOrUpdateReq extends BaiscDTO{ |
52 | 53 | |
53 | 54 | /**工时内容*/ |
54 | 55 | private String dailyContent; |
56 | + | |
57 | + /**员工ids.*/ | |
58 | + private List<Long> opIds; | |
59 | + | |
60 | + | |
55 | 61 | |
56 | - /**获取主键*/ | |
62 | + public List<Long> getOpIds() { | |
63 | + return opIds; | |
64 | + } | |
65 | + | |
66 | + public void setOpIds(List<Long> opIds) { | |
67 | + this.opIds = opIds; | |
68 | + } | |
69 | + | |
70 | + /**获取主键*/ | |
57 | 71 | public Long getId() { |
58 | 72 | return id; |
59 | 73 | } | ... | ... |
src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java
... | ... | @@ -25,18 +25,18 @@ public class AsraOpQueryReq extends BaseRequest{ |
25 | 25 | |
26 | 26 | /**员工邮箱*/ |
27 | 27 | private String email; |
28 | + | |
29 | + /**父级ID 顶级为-1*/ | |
30 | + private Long parentId; | |
31 | + | |
28 | 32 | |
29 | 33 | |
30 | - /**员工idlist*/ | |
31 | - private List<Long> opIdLists; | |
32 | - | |
33 | - | |
34 | - public List<Long> getOpIdLists() { | |
35 | - return opIdLists; | |
34 | + public Long getParentId() { | |
35 | + return parentId; | |
36 | 36 | } |
37 | 37 | |
38 | - public void setOpIdLists(List<Long> opIdLists) { | |
39 | - this.opIdLists = opIdLists; | |
38 | + public void setParentId(Long parentId) { | |
39 | + this.parentId = parentId; | |
40 | 40 | } |
41 | 41 | |
42 | 42 | public String getLoginCode() { | ... | ... |
src/main/java/com/zteits/oa/api/service/report/query/AsraOpQueryService.java
1 | 1 | package com.zteits.oa.api.service.report.query; |
2 | 2 | |
3 | +import java.util.List; | |
4 | + | |
3 | 5 | import com.zteits.oa.api.base.bean.BizResult; |
4 | 6 | import com.zteits.oa.api.base.bean.PageBean; |
5 | 7 | import com.zteits.oa.api.dto.asraop.AsraOpDTO; |
... | ... | @@ -50,4 +52,12 @@ public interface AsraOpQueryService { |
50 | 52 | * |
51 | 53 | */ |
52 | 54 | BizResult<AsraOpDTO> queryAsraOpByLoginCode(AsraOpQueryReq asraOpQueryReq); |
55 | + | |
56 | + /** | |
57 | + * 通过员工父级Id获取员工信息.<br/> | |
58 | + * @param asraOpQueryRe | |
59 | + * @return | |
60 | + * 2018年7月31日 wangfs.<br/> | |
61 | + */ | |
62 | + BizResult<List<AsraOpDTO>> queryAsraOpByParentId(AsraOpQueryReq asraOpQueryRe); | |
53 | 63 | } | ... | ... |
src/main/java/com/zteits/oa/report/biz/AsraOpQueryServiceImpl.java
1 | 1 | package com.zteits.oa.report.biz; |
2 | 2 | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.List; | |
5 | + | |
3 | 6 | import org.slf4j.Logger; |
4 | 7 | import org.slf4j.LoggerFactory; |
5 | 8 | import org.springframework.beans.BeanUtils; |
... | ... | @@ -15,6 +18,7 @@ import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; |
15 | 18 | import com.zteits.oa.api.service.report.query.AsraOpQueryService; |
16 | 19 | import com.zteits.oa.report.dao.AsraOpDao; |
17 | 20 | import com.zteits.oa.report.domain.AsraOp; |
21 | +import com.zteits.oa.util.ListCopyUtil; | |
18 | 22 | import com.zteits.oa.util.pagepaper.PageBeanUtil; |
19 | 23 | /** |
20 | 24 | * 工时系统操作员实现类.<br/> |
... | ... | @@ -31,7 +35,7 @@ import com.zteits.oa.util.pagepaper.PageBeanUtil; |
31 | 35 | *---------------------------------------------------------* |
32 | 36 | * 2018年7月30日 wangfs v1.0.0 创建 |
33 | 37 | */ |
34 | -@Service("") | |
38 | +@Service("com.zteits.oa.report.biz.AsraOpQueryServiceImpl") | |
35 | 39 | public class AsraOpQueryServiceImpl implements AsraOpQueryService { |
36 | 40 | |
37 | 41 | private static final Logger logger = LoggerFactory.getLogger(AsraOpQueryServiceImpl.class); |
... | ... | @@ -77,4 +81,18 @@ public class AsraOpQueryServiceImpl implements AsraOpQueryService { |
77 | 81 | return new BizResult<>(asraOpDTO); |
78 | 82 | } |
79 | 83 | |
84 | + /** | |
85 | + * 通过员工父级Id获取员工信息.<br/> | |
86 | + * @param asraOpQueryRe | |
87 | + * @return | |
88 | + * 2018年7月31日 wangfs.<br/> | |
89 | + */ | |
90 | + @Override | |
91 | + public BizResult<List<AsraOpDTO>> queryAsraOpByParentId(AsraOpQueryReq asraOpQueryRe) { | |
92 | + List<AsraOpDTO> listDTO = new ArrayList<>(); | |
93 | + List<AsraOp> list = asraOpDao.queryAsraOpByParentId(asraOpQueryRe); | |
94 | + ListCopyUtil.listCopyProperties(list, listDTO, AsraOpDTO.class); | |
95 | + return new BizResult<List<AsraOpDTO>>(listDTO); | |
96 | + } | |
97 | + | |
80 | 98 | } | ... | ... |
src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java deleted
1 | -package com.zteits.oa.report.biz; | |
2 | - | |
3 | -import com.xiaoleilu.hutool.util.CollectionUtil; | |
4 | -import com.zteits.oa.api.base.bean.BizResult; | |
5 | -import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; | |
6 | -import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; | |
7 | -import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService; | |
8 | -import com.zteits.oa.report.domain.AsraOpRelations; | |
9 | -import org.springframework.beans.BeanUtils; | |
10 | -import org.springframework.beans.factory.annotation.Autowired; | |
11 | -import org.springframework.stereotype.Service; | |
12 | - | |
13 | -import java.util.ArrayList; | |
14 | -import java.util.List; | |
15 | - | |
16 | -/** | |
17 | - * Copyright: Copyright (c) 2018 zteits | |
18 | - * | |
19 | - * @Description: | |
20 | - * @version: v1.0.0 | |
21 | - * @author: xiejianpeng | |
22 | - * @date: 2018/7/31 11 | |
23 | - * Modification History: | |
24 | - * Date Author Version Description | |
25 | - * ---------------------------------------------------------* | |
26 | - * 2018/7/31 xiejianpeng v1.0.0 创建 | |
27 | - */ | |
28 | -@Service | |
29 | -public class AsraOpRelationsQueryServiceImpl implements AsraOpRelationsQueryService { | |
30 | - | |
31 | - //@Autowired | |
32 | - //private AsraOpRelationsDao asraOpRelationsDao; | |
33 | - | |
34 | - @Override | |
35 | - public BizResult<List<AsraOpRelationsDTO>> queryAsraOpRelations(AsraOpRelationsQueryReq asraOpRelationsQueryReq) { | |
36 | - | |
37 | - List<AsraOpRelationsDTO> asraOpRelationsDTOs = new ArrayList<>(); | |
38 | - List<AsraOpRelations> asraOpRelationsList = null;//asraOpRelationsDao.queryAsraOpRelations(asraOpRelationsQueryReq.getParentId()); | |
39 | - if(CollectionUtil.isNotEmpty(asraOpRelationsList)) { | |
40 | - BeanUtils.copyProperties(asraOpRelationsList, asraOpRelationsDTOs, AsraOpRelationsDTO.class); | |
41 | - } | |
42 | - return new BizResult<>(asraOpRelationsDTOs); | |
43 | - } | |
44 | -} |
src/main/java/com/zteits/oa/report/dao/AsraOpDao.java
1 | 1 | package com.zteits.oa.report.dao; |
2 | 2 | |
3 | +import java.util.List; | |
4 | + | |
3 | 5 | import com.github.pagehelper.PageInfo; |
4 | 6 | import com.zteits.oa.api.base.bean.BizResult; |
5 | 7 | import com.zteits.oa.api.dto.asraop.AsraOpDTO; |
... | ... | @@ -33,4 +35,12 @@ public interface AsraOpDao { |
33 | 35 | * |
34 | 36 | */ |
35 | 37 | AsraOp queryAsraOpByLoginCode(String loginCode); |
38 | + | |
39 | + /** | |
40 | + * 通过员工父级Id获取员工信息.<br/> | |
41 | + * @param asraOpQueryRe | |
42 | + * @return | |
43 | + * 2018年7月31日 wangfs.<br/> | |
44 | + */ | |
45 | + List<AsraOp> queryAsraOpByParentId(AsraOpQueryReq asraOpQueryRe); | |
36 | 46 | } | ... | ... |
src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java
... | ... | @@ -14,8 +14,6 @@ import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; |
14 | 14 | import com.zteits.oa.report.dao.AsraDailyDao; |
15 | 15 | import com.zteits.oa.report.domain.AsraDaily; |
16 | 16 | import com.zteits.oa.report.domain.AsraDailyExample; |
17 | -import com.zteits.oa.report.domain.AsraOpRelations; | |
18 | -import com.zteits.oa.report.domain.AsraOpRelationsExample; | |
19 | 17 | import com.zteits.oa.report.domain.sdo.AsraDailyDO; |
20 | 18 | import com.zteits.oa.report.domain.sdo.AsraDailyOpNumForCurrentDayDO; |
21 | 19 | import com.zteits.oa.report.mapper.AsraDailyMapper; |
... | ... | @@ -71,23 +69,13 @@ public class AsraDailyDaoImpl implements AsraDailyDao{ |
71 | 69 | public AsraDailyOpNumForCurrentDayDO queryAsraDailyOpNumForCurrentDay(AsraDailyForTotalNumAndDetailReq request) { |
72 | 70 | AsraDailyOpNumForCurrentDayDO asraDailyOpNumForCurrentDayDO = new AsraDailyOpNumForCurrentDayDO(); |
73 | 71 | List<Long> opList = new ArrayList<>(); |
72 | + | |
73 | + //1.总人数获取 | |
74 | 74 | int employeeTotal = 0; |
75 | -// //1.总人数获取 | |
76 | -// AsraOpRelationsExample example = new AsraOpRelationsExample(); | |
77 | -// example.createCriteria().andParentIdEqualTo(request.getOpId()); | |
78 | -// //List<AsraOpRelations> selectByExample = asraOpRelationsMapper.selectByExample(example); | |
79 | -// int employeeTotal = (CollectionUtil.isNotEmpty(selectByExample) ? selectByExample.size() +1 : 1); | |
80 | -// asraDailyOpNumForCurrentDayDO.setEmployeeTotal(employeeTotal); | |
81 | -// //获取员工人数 | |
82 | -// if(CollectionUtil.isNotEmpty(selectByExample)){ | |
83 | -// for(AsraOpRelations op:selectByExample){ | |
84 | -// if(op == null){ | |
85 | -// continue; | |
86 | -// } | |
87 | -// opList.add(op.getOpId()); | |
88 | -// } | |
89 | -// } | |
90 | - opList.add(request.getOpId());//查询自己id | |
75 | + if(CollectionUtil.isNotEmpty(request.getOpIds())){ | |
76 | + employeeTotal = request.getOpIds().size(); | |
77 | + } | |
78 | + | |
91 | 79 | //2.查询今日日报填写人数 |
92 | 80 | AsraDailyExample exampleTwo = new AsraDailyExample(); |
93 | 81 | exampleTwo.createCriteria().andAsarOpIdIn(opList) | ... | ... |
src/main/java/com/zteits/oa/report/dao/impl/AsraOpDaoImpl.java
... | ... | @@ -60,6 +60,7 @@ public class AsraOpDaoImpl implements AsraOpDao { |
60 | 60 | if(asraOpQueryRe.getId() != null){ |
61 | 61 | criteria.andIdEqualTo(asraOpQueryRe.getId()); |
62 | 62 | } |
63 | + | |
63 | 64 | criteria.andDataStateEqualTo(1); |
64 | 65 | List<AsraOp> list = asraOpMapper.selectByExample(example); |
65 | 66 | return CollectionUtils.isEmpty(list) ? new AsraOp() : list.get(0); |
... | ... | @@ -73,4 +74,18 @@ public class AsraOpDaoImpl implements AsraOpDao { |
73 | 74 | return berths.get(0); |
74 | 75 | } |
75 | 76 | |
77 | + /** | |
78 | + * 通过员工父级Id获取员工信息.<br/> | |
79 | + * @param asraOpQueryRe | |
80 | + * @return | |
81 | + * 2018年7月31日 wangfs.<br/> | |
82 | + */ | |
83 | + @Override | |
84 | + public List<AsraOp> queryAsraOpByParentId(AsraOpQueryReq asraOpQueryRe) { | |
85 | + AsraOpExample example = new AsraOpExample(); | |
86 | + example.createCriteria().andParentIdEqualTo(asraOpQueryRe.getParentId()); | |
87 | + List<AsraOp> list = asraOpMapper.selectByExample(example); | |
88 | + return list; | |
89 | + } | |
90 | + | |
76 | 91 | } | ... | ... |
src/main/java/com/zteits/oa/report/domain/AsraOpRelations.java deleted
1 | -package com.zteits.oa.report.domain; | |
2 | - | |
3 | -public class AsraOpRelations { | |
4 | - /**主键*/ | |
5 | - private Long id; | |
6 | - | |
7 | - /**父级ID*/ | |
8 | - private Long parentId; | |
9 | - | |
10 | - /**员工ID*/ | |
11 | - private Long opId; | |
12 | - | |
13 | - /**数据状态:1有效,0无效,2:锁定*/ | |
14 | - private Integer dataState; | |
15 | - | |
16 | - /**获取主键*/ | |
17 | - public Long getId() { | |
18 | - return id; | |
19 | - } | |
20 | - | |
21 | - /**设置主键*/ | |
22 | - public void setId(Long id) { | |
23 | - this.id = id; | |
24 | - } | |
25 | - | |
26 | - /**获取父级ID*/ | |
27 | - public Long getParentId() { | |
28 | - return parentId; | |
29 | - } | |
30 | - | |
31 | - /**设置父级ID*/ | |
32 | - public void setParentId(Long parentId) { | |
33 | - this.parentId = parentId; | |
34 | - } | |
35 | - | |
36 | - /**获取员工ID*/ | |
37 | - public Long getOpId() { | |
38 | - return opId; | |
39 | - } | |
40 | - | |
41 | - /**设置员工ID*/ | |
42 | - public void setOpId(Long opId) { | |
43 | - this.opId = opId; | |
44 | - } | |
45 | - | |
46 | - /**获取数据状态:1有效,0无效,2:锁定*/ | |
47 | - public Integer getDataState() { | |
48 | - return dataState; | |
49 | - } | |
50 | - | |
51 | - /**设置数据状态:1有效,0无效,2:锁定*/ | |
52 | - public void setDataState(Integer dataState) { | |
53 | - this.dataState = dataState; | |
54 | - } | |
55 | -} | |
56 | 0 | \ No newline at end of file |
src/main/java/com/zteits/oa/report/domain/AsraOpRelationsExample.java deleted
1 | -package com.zteits.oa.report.domain; | |
2 | - | |
3 | -import java.util.ArrayList; | |
4 | -import java.util.List; | |
5 | - | |
6 | -public class AsraOpRelationsExample { | |
7 | - protected String orderByClause; | |
8 | - | |
9 | - protected boolean distinct; | |
10 | - | |
11 | - protected List<Criteria> oredCriteria; | |
12 | - | |
13 | - public AsraOpRelationsExample() { | |
14 | - oredCriteria = new ArrayList<Criteria>(); | |
15 | - } | |
16 | - | |
17 | - public void setOrderByClause(String orderByClause) { | |
18 | - this.orderByClause = orderByClause; | |
19 | - } | |
20 | - | |
21 | - public String getOrderByClause() { | |
22 | - return orderByClause; | |
23 | - } | |
24 | - | |
25 | - public void setDistinct(boolean distinct) { | |
26 | - this.distinct = distinct; | |
27 | - } | |
28 | - | |
29 | - public boolean isDistinct() { | |
30 | - return distinct; | |
31 | - } | |
32 | - | |
33 | - public List<Criteria> getOredCriteria() { | |
34 | - return oredCriteria; | |
35 | - } | |
36 | - | |
37 | - public void or(Criteria criteria) { | |
38 | - oredCriteria.add(criteria); | |
39 | - } | |
40 | - | |
41 | - public Criteria or() { | |
42 | - Criteria criteria = createCriteriaInternal(); | |
43 | - oredCriteria.add(criteria); | |
44 | - return criteria; | |
45 | - } | |
46 | - | |
47 | - public Criteria createCriteria() { | |
48 | - Criteria criteria = createCriteriaInternal(); | |
49 | - if (oredCriteria.size() == 0) { | |
50 | - oredCriteria.add(criteria); | |
51 | - } | |
52 | - return criteria; | |
53 | - } | |
54 | - | |
55 | - protected Criteria createCriteriaInternal() { | |
56 | - Criteria criteria = new Criteria(); | |
57 | - return criteria; | |
58 | - } | |
59 | - | |
60 | - public void clear() { | |
61 | - oredCriteria.clear(); | |
62 | - orderByClause = null; | |
63 | - distinct = false; | |
64 | - } | |
65 | - | |
66 | - protected abstract static class GeneratedCriteria { | |
67 | - protected List<Criterion> criteria; | |
68 | - | |
69 | - protected GeneratedCriteria() { | |
70 | - super(); | |
71 | - criteria = new ArrayList<Criterion>(); | |
72 | - } | |
73 | - | |
74 | - public boolean isValid() { | |
75 | - return criteria.size() > 0; | |
76 | - } | |
77 | - | |
78 | - public List<Criterion> getAllCriteria() { | |
79 | - return criteria; | |
80 | - } | |
81 | - | |
82 | - public List<Criterion> getCriteria() { | |
83 | - return criteria; | |
84 | - } | |
85 | - | |
86 | - protected void addCriterion(String condition) { | |
87 | - if (condition == null) { | |
88 | - throw new RuntimeException("Value for condition cannot be null"); | |
89 | - } | |
90 | - criteria.add(new Criterion(condition)); | |
91 | - } | |
92 | - | |
93 | - protected void addCriterion(String condition, Object value, String property) { | |
94 | - if (value == null) { | |
95 | - throw new RuntimeException("Value for " + property + " cannot be null"); | |
96 | - } | |
97 | - criteria.add(new Criterion(condition, value)); | |
98 | - } | |
99 | - | |
100 | - protected void addCriterion(String condition, Object value1, Object value2, String property) { | |
101 | - if (value1 == null || value2 == null) { | |
102 | - throw new RuntimeException("Between values for " + property + " cannot be null"); | |
103 | - } | |
104 | - criteria.add(new Criterion(condition, value1, value2)); | |
105 | - } | |
106 | - | |
107 | - public Criteria andIdIsNull() { | |
108 | - addCriterion("id is null"); | |
109 | - return (Criteria) this; | |
110 | - } | |
111 | - | |
112 | - public Criteria andIdIsNotNull() { | |
113 | - addCriterion("id is not null"); | |
114 | - return (Criteria) this; | |
115 | - } | |
116 | - | |
117 | - public Criteria andIdEqualTo(Long value) { | |
118 | - addCriterion("id =", value, "id"); | |
119 | - return (Criteria) this; | |
120 | - } | |
121 | - | |
122 | - public Criteria andIdNotEqualTo(Long value) { | |
123 | - addCriterion("id <>", value, "id"); | |
124 | - return (Criteria) this; | |
125 | - } | |
126 | - | |
127 | - public Criteria andIdGreaterThan(Long value) { | |
128 | - addCriterion("id >", value, "id"); | |
129 | - return (Criteria) this; | |
130 | - } | |
131 | - | |
132 | - public Criteria andIdGreaterThanOrEqualTo(Long value) { | |
133 | - addCriterion("id >=", value, "id"); | |
134 | - return (Criteria) this; | |
135 | - } | |
136 | - | |
137 | - public Criteria andIdLessThan(Long value) { | |
138 | - addCriterion("id <", value, "id"); | |
139 | - return (Criteria) this; | |
140 | - } | |
141 | - | |
142 | - public Criteria andIdLessThanOrEqualTo(Long value) { | |
143 | - addCriterion("id <=", value, "id"); | |
144 | - return (Criteria) this; | |
145 | - } | |
146 | - | |
147 | - public Criteria andIdIn(List<Long> values) { | |
148 | - addCriterion("id in", values, "id"); | |
149 | - return (Criteria) this; | |
150 | - } | |
151 | - | |
152 | - public Criteria andIdNotIn(List<Long> values) { | |
153 | - addCriterion("id not in", values, "id"); | |
154 | - return (Criteria) this; | |
155 | - } | |
156 | - | |
157 | - public Criteria andIdBetween(Long value1, Long value2) { | |
158 | - addCriterion("id between", value1, value2, "id"); | |
159 | - return (Criteria) this; | |
160 | - } | |
161 | - | |
162 | - public Criteria andIdNotBetween(Long value1, Long value2) { | |
163 | - addCriterion("id not between", value1, value2, "id"); | |
164 | - return (Criteria) this; | |
165 | - } | |
166 | - | |
167 | - public Criteria andParentIdIsNull() { | |
168 | - addCriterion("parent_id is null"); | |
169 | - return (Criteria) this; | |
170 | - } | |
171 | - | |
172 | - public Criteria andParentIdIsNotNull() { | |
173 | - addCriterion("parent_id is not null"); | |
174 | - return (Criteria) this; | |
175 | - } | |
176 | - | |
177 | - public Criteria andParentIdEqualTo(Long value) { | |
178 | - addCriterion("parent_id =", value, "parentId"); | |
179 | - return (Criteria) this; | |
180 | - } | |
181 | - | |
182 | - public Criteria andParentIdNotEqualTo(Long value) { | |
183 | - addCriterion("parent_id <>", value, "parentId"); | |
184 | - return (Criteria) this; | |
185 | - } | |
186 | - | |
187 | - public Criteria andParentIdGreaterThan(Long value) { | |
188 | - addCriterion("parent_id >", value, "parentId"); | |
189 | - return (Criteria) this; | |
190 | - } | |
191 | - | |
192 | - public Criteria andParentIdGreaterThanOrEqualTo(Long value) { | |
193 | - addCriterion("parent_id >=", value, "parentId"); | |
194 | - return (Criteria) this; | |
195 | - } | |
196 | - | |
197 | - public Criteria andParentIdLessThan(Long value) { | |
198 | - addCriterion("parent_id <", value, "parentId"); | |
199 | - return (Criteria) this; | |
200 | - } | |
201 | - | |
202 | - public Criteria andParentIdLessThanOrEqualTo(Long value) { | |
203 | - addCriterion("parent_id <=", value, "parentId"); | |
204 | - return (Criteria) this; | |
205 | - } | |
206 | - | |
207 | - public Criteria andParentIdIn(List<Long> values) { | |
208 | - addCriterion("parent_id in", values, "parentId"); | |
209 | - return (Criteria) this; | |
210 | - } | |
211 | - | |
212 | - public Criteria andParentIdNotIn(List<Long> values) { | |
213 | - addCriterion("parent_id not in", values, "parentId"); | |
214 | - return (Criteria) this; | |
215 | - } | |
216 | - | |
217 | - public Criteria andParentIdBetween(Long value1, Long value2) { | |
218 | - addCriterion("parent_id between", value1, value2, "parentId"); | |
219 | - return (Criteria) this; | |
220 | - } | |
221 | - | |
222 | - public Criteria andParentIdNotBetween(Long value1, Long value2) { | |
223 | - addCriterion("parent_id not between", value1, value2, "parentId"); | |
224 | - return (Criteria) this; | |
225 | - } | |
226 | - | |
227 | - public Criteria andOpIdIsNull() { | |
228 | - addCriterion("op_id is null"); | |
229 | - return (Criteria) this; | |
230 | - } | |
231 | - | |
232 | - public Criteria andOpIdIsNotNull() { | |
233 | - addCriterion("op_id is not null"); | |
234 | - return (Criteria) this; | |
235 | - } | |
236 | - | |
237 | - public Criteria andOpIdEqualTo(Long value) { | |
238 | - addCriterion("op_id =", value, "opId"); | |
239 | - return (Criteria) this; | |
240 | - } | |
241 | - | |
242 | - public Criteria andOpIdNotEqualTo(Long value) { | |
243 | - addCriterion("op_id <>", value, "opId"); | |
244 | - return (Criteria) this; | |
245 | - } | |
246 | - | |
247 | - public Criteria andOpIdGreaterThan(Long value) { | |
248 | - addCriterion("op_id >", value, "opId"); | |
249 | - return (Criteria) this; | |
250 | - } | |
251 | - | |
252 | - public Criteria andOpIdGreaterThanOrEqualTo(Long value) { | |
253 | - addCriterion("op_id >=", value, "opId"); | |
254 | - return (Criteria) this; | |
255 | - } | |
256 | - | |
257 | - public Criteria andOpIdLessThan(Long value) { | |
258 | - addCriterion("op_id <", value, "opId"); | |
259 | - return (Criteria) this; | |
260 | - } | |
261 | - | |
262 | - public Criteria andOpIdLessThanOrEqualTo(Long value) { | |
263 | - addCriterion("op_id <=", value, "opId"); | |
264 | - return (Criteria) this; | |
265 | - } | |
266 | - | |
267 | - public Criteria andOpIdIn(List<Long> values) { | |
268 | - addCriterion("op_id in", values, "opId"); | |
269 | - return (Criteria) this; | |
270 | - } | |
271 | - | |
272 | - public Criteria andOpIdNotIn(List<Long> values) { | |
273 | - addCriterion("op_id not in", values, "opId"); | |
274 | - return (Criteria) this; | |
275 | - } | |
276 | - | |
277 | - public Criteria andOpIdBetween(Long value1, Long value2) { | |
278 | - addCriterion("op_id between", value1, value2, "opId"); | |
279 | - return (Criteria) this; | |
280 | - } | |
281 | - | |
282 | - public Criteria andOpIdNotBetween(Long value1, Long value2) { | |
283 | - addCriterion("op_id not between", value1, value2, "opId"); | |
284 | - return (Criteria) this; | |
285 | - } | |
286 | - | |
287 | - public Criteria andDataStateIsNull() { | |
288 | - addCriterion("data_state is null"); | |
289 | - return (Criteria) this; | |
290 | - } | |
291 | - | |
292 | - public Criteria andDataStateIsNotNull() { | |
293 | - addCriterion("data_state is not null"); | |
294 | - return (Criteria) this; | |
295 | - } | |
296 | - | |
297 | - public Criteria andDataStateEqualTo(Integer value) { | |
298 | - addCriterion("data_state =", value, "dataState"); | |
299 | - return (Criteria) this; | |
300 | - } | |
301 | - | |
302 | - public Criteria andDataStateNotEqualTo(Integer value) { | |
303 | - addCriterion("data_state <>", value, "dataState"); | |
304 | - return (Criteria) this; | |
305 | - } | |
306 | - | |
307 | - public Criteria andDataStateGreaterThan(Integer value) { | |
308 | - addCriterion("data_state >", value, "dataState"); | |
309 | - return (Criteria) this; | |
310 | - } | |
311 | - | |
312 | - public Criteria andDataStateGreaterThanOrEqualTo(Integer value) { | |
313 | - addCriterion("data_state >=", value, "dataState"); | |
314 | - return (Criteria) this; | |
315 | - } | |
316 | - | |
317 | - public Criteria andDataStateLessThan(Integer value) { | |
318 | - addCriterion("data_state <", value, "dataState"); | |
319 | - return (Criteria) this; | |
320 | - } | |
321 | - | |
322 | - public Criteria andDataStateLessThanOrEqualTo(Integer value) { | |
323 | - addCriterion("data_state <=", value, "dataState"); | |
324 | - return (Criteria) this; | |
325 | - } | |
326 | - | |
327 | - public Criteria andDataStateIn(List<Integer> values) { | |
328 | - addCriterion("data_state in", values, "dataState"); | |
329 | - return (Criteria) this; | |
330 | - } | |
331 | - | |
332 | - public Criteria andDataStateNotIn(List<Integer> values) { | |
333 | - addCriterion("data_state not in", values, "dataState"); | |
334 | - return (Criteria) this; | |
335 | - } | |
336 | - | |
337 | - public Criteria andDataStateBetween(Integer value1, Integer value2) { | |
338 | - addCriterion("data_state between", value1, value2, "dataState"); | |
339 | - return (Criteria) this; | |
340 | - } | |
341 | - | |
342 | - public Criteria andDataStateNotBetween(Integer value1, Integer value2) { | |
343 | - addCriterion("data_state not between", value1, value2, "dataState"); | |
344 | - return (Criteria) this; | |
345 | - } | |
346 | - } | |
347 | - | |
348 | - public static class Criteria extends GeneratedCriteria { | |
349 | - | |
350 | - protected Criteria() { | |
351 | - super(); | |
352 | - } | |
353 | - } | |
354 | - | |
355 | - public static class Criterion { | |
356 | - private String condition; | |
357 | - | |
358 | - private Object value; | |
359 | - | |
360 | - private Object secondValue; | |
361 | - | |
362 | - private boolean noValue; | |
363 | - | |
364 | - private boolean singleValue; | |
365 | - | |
366 | - private boolean betweenValue; | |
367 | - | |
368 | - private boolean listValue; | |
369 | - | |
370 | - private String typeHandler; | |
371 | - | |
372 | - public String getCondition() { | |
373 | - return condition; | |
374 | - } | |
375 | - | |
376 | - public Object getValue() { | |
377 | - return value; | |
378 | - } | |
379 | - | |
380 | - public Object getSecondValue() { | |
381 | - return secondValue; | |
382 | - } | |
383 | - | |
384 | - public boolean isNoValue() { | |
385 | - return noValue; | |
386 | - } | |
387 | - | |
388 | - public boolean isSingleValue() { | |
389 | - return singleValue; | |
390 | - } | |
391 | - | |
392 | - public boolean isBetweenValue() { | |
393 | - return betweenValue; | |
394 | - } | |
395 | - | |
396 | - public boolean isListValue() { | |
397 | - return listValue; | |
398 | - } | |
399 | - | |
400 | - public String getTypeHandler() { | |
401 | - return typeHandler; | |
402 | - } | |
403 | - | |
404 | - protected Criterion(String condition) { | |
405 | - super(); | |
406 | - this.condition = condition; | |
407 | - this.typeHandler = null; | |
408 | - this.noValue = true; | |
409 | - } | |
410 | - | |
411 | - protected Criterion(String condition, Object value, String typeHandler) { | |
412 | - super(); | |
413 | - this.condition = condition; | |
414 | - this.value = value; | |
415 | - this.typeHandler = typeHandler; | |
416 | - if (value instanceof List<?>) { | |
417 | - this.listValue = true; | |
418 | - } else { | |
419 | - this.singleValue = true; | |
420 | - } | |
421 | - } | |
422 | - | |
423 | - protected Criterion(String condition, Object value) { | |
424 | - this(condition, value, null); | |
425 | - } | |
426 | - | |
427 | - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { | |
428 | - super(); | |
429 | - this.condition = condition; | |
430 | - this.value = value; | |
431 | - this.secondValue = secondValue; | |
432 | - this.typeHandler = typeHandler; | |
433 | - this.betweenValue = true; | |
434 | - } | |
435 | - | |
436 | - protected Criterion(String condition, Object value, Object secondValue) { | |
437 | - this(condition, value, secondValue, null); | |
438 | - } | |
439 | - } | |
440 | -} | |
441 | 0 | \ No newline at end of file |
src/main/java/com/zteits/oa/report/web/AsraDailyController.java
... | ... | @@ -17,6 +17,7 @@ import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; |
17 | 17 | import com.zteits.oa.api.dto.asradaily.param.AsraDailySaveOrUpdateReq; |
18 | 18 | import com.zteits.oa.api.dto.asraop.AsraOpDTO; |
19 | 19 | import com.zteits.oa.api.service.report.query.AsraDailyQueryService; |
20 | +import com.zteits.oa.report.domain.AsraDaily; | |
20 | 21 | import com.zteits.oa.util.pagepaper.DateForObjectUtil; |
21 | 22 | import io.swagger.annotations.Api; |
22 | 23 | import io.swagger.annotations.ApiOperation; |
... | ... | @@ -72,7 +73,7 @@ public class AsraDailyController { |
72 | 73 | if(asraOpDTO == null ){ |
73 | 74 | throw new BizException(ErrorType.PARAMM_NULL,"获取session为空"); |
74 | 75 | } |
75 | - request.setOpId(asraOpDTO.getId()); | |
76 | + request.setOpIds(asraOpDTO.getOpIds()); | |
76 | 77 | BizResult<AsraDailyOpNumForCurrentDayDTO> result = asraDailyQueryService.queryAsraDailyOpNumForCurrentDay(request); |
77 | 78 | logger.info("--end工时查询-当天填报人数统计(汇总),结果={}",JSONObject.toJSON(result)); |
78 | 79 | return result; |
... | ... | @@ -93,7 +94,7 @@ public class AsraDailyController { |
93 | 94 | if(asraOpDTO == null ){ |
94 | 95 | throw new BizException(ErrorType.PARAMM_NULL,"获取session为空"); |
95 | 96 | } |
96 | - request.setOpId(asraOpDTO.getId()); | |
97 | + request.setOpIds(asraOpDTO.getOpIds()); | |
97 | 98 | BizResult<QueryAsraDailyAllForListReqDTO> result = asraDailyQueryService.queryAsraDailyAllForList(request); |
98 | 99 | logger.info("--end工时查询-所有员工及自己或者自己日报,结果={}",JSONObject.toJSON(result)); |
99 | 100 | return result; | ... | ... |
src/main/java/com/zteits/oa/report/web/OAuthController.java
1 | 1 | package com.zteits.oa.report.web; |
2 | 2 | |
3 | +import static org.mockito.Matchers.contains; | |
4 | + | |
3 | 5 | import java.util.ArrayList; |
4 | 6 | import java.util.List; |
5 | 7 | |
... | ... | @@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
16 | 18 | import org.springframework.web.bind.annotation.RestController; |
17 | 19 | |
18 | 20 | import com.alibaba.fastjson.JSONObject; |
21 | +import com.xiaoleilu.hutool.util.CollectionUtil; | |
19 | 22 | import com.zteits.oa.api.base.bean.BizResult; |
20 | 23 | import com.zteits.oa.api.base.constants.ErrorType; |
21 | 24 | import com.zteits.oa.api.base.constants.SessionEnum; |
... | ... | @@ -93,7 +96,7 @@ public class OAuthController { |
93 | 96 | List<Long> opIds = new ArrayList<>(); |
94 | 97 | opIds.add(asraOpDTO.getId()); |
95 | 98 | /**递归查询员工ids.*/ |
96 | - opIds = queryOpTreeByOpId(asraOpDTO.getParentId(),opIds); | |
99 | + opIds = queryOpTreeByOpId(asraOpDTO.getId()); | |
97 | 100 | logger.info("---获取到的opIds={}",JSONObject.toJSON(opIds)); |
98 | 101 | asraOpDTO.setOpIds(opIds); |
99 | 102 | HttpSession session = request.getSession(); |
... | ... | @@ -140,22 +143,84 @@ public class OAuthController { |
140 | 143 | * @return |
141 | 144 | * 2018年8月2日 wangfs.<br/> |
142 | 145 | */ |
143 | - private List<Long> queryOpTreeByOpId(Long parentOpId,List<Long> opList){ | |
144 | - if(parentOpId != null && !parentOpId.equals(-1L)){ | |
145 | - AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); | |
146 | - asraOpQueryRe.setId(parentOpId); | |
147 | - BizResult<AsraOpDTO> asraOpReult = asraOpQueryService.queryAsraOp(asraOpQueryRe); | |
148 | - if(asraOpReult != null && asraOpReult.getData() != null){ | |
149 | - AsraOpDTO data = asraOpReult.getData(); | |
150 | - if(data != null){ | |
151 | - opList.add(data.getId()); | |
152 | - } | |
153 | - queryOpTreeByOpId(data.getParentId(),opList); | |
154 | - } | |
155 | - } | |
146 | + private List<Long> queryOpTreeByOpId(Long opId){ | |
147 | + List<Long> rootAllList = new ArrayList<>(); | |
148 | + rootAllList.add(opId); | |
149 | + //1.查找第一级下的所有用户 | |
150 | + List<Long> rootOpIds = this.getRootOpIds(opId); | |
156 | 151 | |
157 | - return opList; | |
152 | + //2.查找第二级以下所有用户 | |
153 | + if(CollectionUtil.isNotEmpty(rootOpIds)){ | |
154 | + rootAllList.addAll(rootOpIds); | |
155 | + for(Long getOpId:rootOpIds ){ | |
156 | + List<Long> childOpIds = new ArrayList<>(); | |
157 | + this.getChildOpIds(getOpId,childOpIds); | |
158 | + rootAllList.addAll(childOpIds); | |
159 | + } | |
160 | + | |
161 | + } | |
162 | + return rootAllList; | |
163 | + } | |
164 | + | |
165 | + /** | |
166 | + * 递归查找一级以下的用户 | |
167 | + * @param parentId | |
168 | + * @return | |
169 | + * 2018年8月2日 wangfs.<br/> | |
170 | + */ | |
171 | + private List<Long> getChildOpIds(Long parentId,List<Long> childOpIds){ | |
172 | + AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); | |
173 | + asraOpQueryRe.setParentId(parentId); | |
174 | + BizResult<List<AsraOpDTO>> asraOpReult = asraOpQueryService.queryAsraOpByParentId(asraOpQueryRe); | |
175 | + if(asraOpReult != null && CollectionUtil.isNotEmpty(asraOpReult.getData())){ | |
176 | + List<AsraOpDTO> list = asraOpReult.getData(); | |
177 | + for(AsraOpDTO asraOpDTO :list){ | |
178 | + if(asraOpDTO == null){ | |
179 | + continue; | |
180 | + } | |
181 | + childOpIds.add(asraOpDTO.getId()); | |
182 | + } | |
183 | + | |
184 | + //遍历下一级 | |
185 | + if(CollectionUtil.isNotEmpty(childOpIds)){ | |
186 | + for(Long opId:childOpIds){ | |
187 | + if(opId != null && !opId.equals(parentId)){ | |
188 | + getChildOpIds(opId,childOpIds); | |
189 | + } | |
190 | + break; | |
191 | + | |
192 | + } | |
193 | + | |
194 | + } | |
195 | + } | |
196 | + | |
197 | + return childOpIds; | |
158 | 198 | } |
199 | + | |
200 | + /** | |
201 | + * 查找登陆用户下一级用户 | |
202 | + * @param opId | |
203 | + * @param opList | |
204 | + * @return | |
205 | + * 2018年8月2日 wangfs.<br/> | |
206 | + */ | |
207 | + private List<Long> getRootOpIds(Long parentId){ | |
208 | + List<Long> opList = new ArrayList<>(); | |
209 | + AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); | |
210 | + asraOpQueryRe.setParentId(parentId); | |
211 | + BizResult<List<AsraOpDTO>> asraOpReult = asraOpQueryService.queryAsraOpByParentId(asraOpQueryRe); | |
212 | + if(asraOpReult != null && CollectionUtil.isNotEmpty(asraOpReult.getData())){ | |
213 | + List<AsraOpDTO> list = asraOpReult.getData(); | |
214 | + for(AsraOpDTO asraOpDTO :list){ | |
215 | + if(asraOpDTO == null){ | |
216 | + continue; | |
217 | + } | |
218 | + opList.add(asraOpDTO.getId()); | |
219 | + } | |
220 | + } | |
221 | + return opList; | |
222 | + } | |
223 | + | |
159 | 224 | |
160 | 225 | |
161 | 226 | } | ... | ... |