Commit 2e6a8b6f55fa22c3843dfe6f06a74e099b649166
Merge branch 'branch0730' of
http://192.168.1.195:9998/ZTEITS-Developers/zteits-oa.git into branch0730 Conflicts: src/main/java/com/zteits/oa/report/web/OAuthController.java
Showing
6 changed files
with
137 additions
and
140 deletions
src/main/java/com/zteits/oa/api/dto/asraop/param/AsraOpQueryReq.java
... | ... | @@ -25,11 +25,34 @@ public class AsraOpQueryReq extends BaseRequest{ |
25 | 25 | |
26 | 26 | /**员工邮箱*/ |
27 | 27 | private String email; |
28 | - | |
28 | + | |
29 | 29 | /**父级ID 顶级为-1*/ |
30 | 30 | private Long parentId; |
31 | - | |
32 | - | |
31 | + | |
32 | + | |
33 | + | |
34 | + | |
35 | + /**员工idlist*/ | |
36 | + private List<Long> opIdLists; | |
37 | + | |
38 | + /**员工idlist*/ | |
39 | + private List<Long> opParentIdLists; | |
40 | + | |
41 | + public List<Long> getOpIdLists() { | |
42 | + return opIdLists; | |
43 | + } | |
44 | + | |
45 | + public void setOpIdLists(List<Long> opIdLists) { | |
46 | + this.opIdLists = opIdLists; | |
47 | + } | |
48 | + | |
49 | + public List<Long> getOpParentIdLists() { | |
50 | + return opParentIdLists; | |
51 | + } | |
52 | + | |
53 | + public void setOpParentIdLists(List<Long> opParentIdLists) { | |
54 | + this.opParentIdLists = opParentIdLists; | |
55 | + } | |
33 | 56 | |
34 | 57 | public Long getParentId() { |
35 | 58 | return parentId; | ... | ... |
src/main/java/com/zteits/oa/api/service/report/query/AsraOpRelationsQueryService.java deleted
1 | -package com.zteits.oa.api.service.report.query; | |
2 | - | |
3 | -import com.zteits.oa.api.base.bean.BizResult; | |
4 | -import com.zteits.oa.api.base.bean.PageBean; | |
5 | -import com.zteits.oa.api.dto.asraop.AsraOpDTO; | |
6 | -import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; | |
7 | -import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; | |
8 | -import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; | |
9 | - | |
10 | -import java.util.List; | |
11 | - | |
12 | -/** | |
13 | - * 员工关系表查询service.<br/> | |
14 | - * | |
15 | - * Copyright: Copyright (c) 2017 ZTE-ITS | |
16 | - * | |
17 | - * @ClassName: AmountUtils.java | |
18 | - * @Description: | |
19 | - * @version: v1.0.0 | |
20 | - * @author: wangfs | |
21 | - * @date: 2018年7月30日 | |
22 | - * Modification History: | |
23 | - * Date Author Version Description | |
24 | - *---------------------------------------------------------* | |
25 | - * 2018年7月30日 xiejp v1.0.0 创建 | |
26 | - */ | |
27 | -public interface AsraOpRelationsQueryService { | |
28 | - | |
29 | - /** | |
30 | - * 根据登录工号查询管理的员工信息 | |
31 | - * @param | |
32 | - * @return | |
33 | - * @Author: xiejianpeng | |
34 | - * @Date: 2018/7/31 10:33 | |
35 | - * | |
36 | - */ | |
37 | - BizResult<List<AsraOpRelationsDTO>> queryAsraOpRelations(AsraOpRelationsQueryReq asraOpRelationsQueryReq); | |
38 | -} |
src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java
... | ... | @@ -4,11 +4,11 @@ import java.util.ArrayList; |
4 | 4 | import java.util.Date; |
5 | 5 | import java.util.List; |
6 | 6 | |
7 | +import com.xiaoleilu.hutool.util.CollectionUtil; | |
7 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
8 | 9 | import org.springframework.stereotype.Component; |
9 | 10 | |
10 | 11 | import com.xiaoleilu.hutool.date.DateUtil; |
11 | -import com.xiaoleilu.hutool.util.CollectionUtil; | |
12 | 12 | import com.zteits.oa.api.dto.asradaily.param.AsraDailyForTotalNumAndDetailReq; |
13 | 13 | import com.zteits.oa.api.dto.asradaily.param.AsraDailyQueryReq; |
14 | 14 | import com.zteits.oa.report.dao.AsraDailyDao; |
... | ... | @@ -69,13 +69,13 @@ public class AsraDailyDaoImpl implements AsraDailyDao{ |
69 | 69 | public AsraDailyOpNumForCurrentDayDO queryAsraDailyOpNumForCurrentDay(AsraDailyForTotalNumAndDetailReq request) { |
70 | 70 | AsraDailyOpNumForCurrentDayDO asraDailyOpNumForCurrentDayDO = new AsraDailyOpNumForCurrentDayDO(); |
71 | 71 | List<Long> opList = new ArrayList<>(); |
72 | - | |
72 | + | |
73 | 73 | //1.总人数获取 |
74 | 74 | int employeeTotal = 0; |
75 | 75 | if(CollectionUtil.isNotEmpty(request.getOpIds())){ |
76 | 76 | employeeTotal = request.getOpIds().size(); |
77 | 77 | } |
78 | - | |
78 | + | |
79 | 79 | //2.查询今日日报填写人数 |
80 | 80 | AsraDailyExample exampleTwo = new AsraDailyExample(); |
81 | 81 | exampleTwo.createCriteria().andAsarOpIdIn(opList) | ... | ... |
src/main/java/com/zteits/oa/report/web/AsraOpController.java
1 | 1 | package com.zteits.oa.report.web; |
2 | 2 | |
3 | 3 | import com.alibaba.fastjson.JSONObject; |
4 | -import com.xiaoleilu.hutool.util.CollectionUtil; | |
5 | 4 | import com.zteits.oa.api.base.bean.BizResult; |
6 | 5 | import com.zteits.oa.api.base.bean.PageBean; |
7 | 6 | import com.zteits.oa.api.base.constants.SessionEnum; |
8 | 7 | import com.zteits.oa.api.dto.asraop.AsraOpDTO; |
9 | 8 | import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; |
10 | -import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; | |
11 | -import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; | |
12 | 9 | import com.zteits.oa.api.service.report.query.AsraOpQueryService; |
13 | -import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService; | |
14 | 10 | import com.zteits.oa.report.web.vo.EasyUIDataGridVO; |
15 | 11 | import io.swagger.annotations.Api; |
16 | 12 | import org.slf4j.Logger; |
17 | 13 | import org.slf4j.LoggerFactory; |
18 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
19 | -import org.springframework.cglib.core.CollectionUtils; | |
20 | 15 | import org.springframework.web.bind.annotation.RequestBody; |
21 | 16 | import org.springframework.web.bind.annotation.RequestMapping; |
22 | 17 | import org.springframework.web.bind.annotation.RequestMethod; |
23 | 18 | import org.springframework.web.bind.annotation.RestController; |
24 | 19 | |
25 | 20 | import javax.servlet.http.HttpServletRequest; |
26 | -import javax.servlet.http.HttpSession; | |
27 | -import java.util.ArrayList; | |
28 | -import java.util.List; | |
29 | 21 | |
30 | 22 | @Api(value = "日报系统-员工管理", description = "日报系统-员工管理") |
31 | 23 | @RestController |
... | ... | @@ -38,15 +30,12 @@ public class AsraOpController extends BizController { |
38 | 30 | private AsraOpQueryService asraOpQueryService; |
39 | 31 | |
40 | 32 | |
41 | - | |
42 | - | |
43 | - | |
44 | 33 | @RequestMapping(value="/queryAsraOpPage",method = RequestMethod.POST) |
45 | 34 | public BizResult<EasyUIDataGridVO<AsraOpDTO>> queryAsraOpPage(@RequestBody AsraOpQueryReq asraOpQueryReq, HttpServletRequest request) throws IllegalAccessException, InstantiationException { |
46 | 35 | logger.info("日报系统-员工管理-根据登录人分页查询员工信息入参:{}", JSONObject.toJSON(asraOpQueryReq)); |
47 | 36 | /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/ |
48 | 37 | AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key()); |
49 | - asraOpQueryReq.setId(asraOpDTO.getId()); | |
38 | + asraOpQueryReq.setOpIdLists(asraOpDTO.getOpIds()); | |
50 | 39 | BizResult<PageBean<AsraOpDTO>> result = asraOpQueryService.queryAsraOpForPage(asraOpQueryReq); |
51 | 40 | logger.info("日报系统-员工管理-根据登录人分页查询员工信息结果:{}", JSONObject.toJSON(result)); |
52 | 41 | return returnJqGridData(result, AsraOpDTO.class); | ... | ... |
src/main/java/com/zteits/oa/report/web/OAuthController.java
1 | 1 | package com.zteits.oa.report.web; |
2 | 2 | |
3 | - | |
4 | 3 | import java.util.ArrayList; |
5 | 4 | import java.util.List; |
6 | 5 | |
... | ... | @@ -15,10 +14,10 @@ import org.springframework.web.bind.annotation.PostMapping; |
15 | 14 | import org.springframework.web.bind.annotation.RequestBody; |
16 | 15 | import org.springframework.web.bind.annotation.RequestMapping; |
17 | 16 | import org.springframework.web.bind.annotation.RestController; |
18 | - | |
19 | 17 | import com.alibaba.fastjson.JSONObject; |
20 | 18 | import com.xiaoleilu.hutool.util.CollectionUtil; |
21 | 19 | import com.zteits.oa.api.base.bean.BizResult; |
20 | +import com.zteits.oa.api.base.bean.PageBean; | |
22 | 21 | import com.zteits.oa.api.base.constants.ErrorType; |
23 | 22 | import com.zteits.oa.api.base.constants.SessionEnum; |
24 | 23 | import com.zteits.oa.api.dto.asraop.AsraOpDTO; |
... | ... | @@ -28,7 +27,6 @@ import com.zteits.oa.api.dto.asraop.param.LoginOauthReq; |
28 | 27 | import com.zteits.oa.api.service.report.query.AsraOpQueryService; |
29 | 28 | import com.zteits.oa.report.vo.OAuthResult; |
30 | 29 | import com.zteits.oa.util.MD5Utils; |
31 | - | |
32 | 30 | import io.swagger.annotations.Api; |
33 | 31 | import io.swagger.annotations.ApiOperation; |
34 | 32 | |
... | ... | @@ -94,8 +92,10 @@ public class OAuthController { |
94 | 92 | |
95 | 93 | List<Long> opIds = new ArrayList<>(); |
96 | 94 | opIds.add(asraOpDTO.getId()); |
95 | + List<Long> opParentIds = new ArrayList<>(); | |
96 | + opParentIds.add(asraOpDTO.getId()); | |
97 | 97 | /**递归查询员工ids.*/ |
98 | - opIds = queryOpTreeByOpId(asraOpDTO.getId()); | |
98 | + opIds = queryOpTreeByOpIds(opParentIds,opIds); | |
99 | 99 | logger.info("---获取到的opIds={}",JSONObject.toJSON(opIds)); |
100 | 100 | asraOpDTO.setOpIds(opIds); |
101 | 101 | HttpSession session = request.getSession(); |
... | ... | @@ -117,7 +117,7 @@ public class OAuthController { |
117 | 117 | } |
118 | 118 | /** |
119 | 119 | * 退出登录 |
120 | - * @param req | |
120 | + * @param | |
121 | 121 | * @return |
122 | 122 | * 2018年7月31日 wangfs.<br/> |
123 | 123 | */ |
... | ... | @@ -135,9 +135,33 @@ public class OAuthController { |
135 | 135 | return new OAuthResult<>(true); |
136 | 136 | } |
137 | 137 | |
138 | + | |
139 | + private List<Long> queryOpTreeByOpIds(List<Long> queryOpList,List<Long> opList){ | |
140 | + if(queryOpList != null && CollectionUtil.isNotEmpty(queryOpList)){ | |
141 | + AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); | |
142 | + asraOpQueryRe.setOpParentIdLists(queryOpList); | |
143 | + asraOpQueryRe.getBaseRequest().setPageNum(1); | |
144 | + asraOpQueryRe.getBaseRequest().setPageSize(0); | |
145 | + BizResult<PageBean<AsraOpDTO>> asraOpReult = asraOpQueryService.queryAsraOpForPage(asraOpQueryRe); | |
146 | + if(asraOpReult != null && asraOpReult.getData() != null){ | |
147 | + queryOpList.clear(); | |
148 | + List<AsraOpDTO> data = asraOpReult.getData().getDataList(); | |
149 | + if(CollectionUtil.isNotEmpty(data)){ | |
150 | + for(AsraOpDTO dto:data){ | |
151 | + queryOpList.add(dto.getId()); | |
152 | + opList.add(dto.getId()); | |
153 | + } | |
154 | + } | |
155 | + queryOpTreeByOpIds(queryOpList,opList); | |
156 | + } | |
157 | + } | |
158 | + return opList; | |
159 | + } | |
160 | + | |
161 | + | |
138 | 162 | /** |
139 | 163 | * 递归查询员工id.<br/> |
140 | - * @param parentOpId | |
164 | + * @param | |
141 | 165 | * @param opList |
142 | 166 | * @return |
143 | 167 | * 2018年8月2日 wangfs.<br/> |
... | ... | @@ -160,66 +184,65 @@ public class OAuthController { |
160 | 184 | } |
161 | 185 | return rootAllList; |
162 | 186 | } |
163 | - | |
164 | - /** | |
165 | - * 递归查找一级以下的用户 | |
166 | - * @param parentId | |
167 | - * @return | |
168 | - * 2018年8月2日 wangfs.<br/> | |
169 | - */ | |
170 | - private List<Long> getChildOpIds(Long parentId,List<Long> childOpIds){ | |
171 | - AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); | |
172 | - asraOpQueryRe.setParentId(parentId); | |
173 | - BizResult<List<AsraOpDTO>> asraOpReult = asraOpQueryService.queryAsraOpByParentId(asraOpQueryRe); | |
174 | - if(asraOpReult != null && CollectionUtil.isNotEmpty(asraOpReult.getData())){ | |
175 | - List<AsraOpDTO> list = asraOpReult.getData(); | |
176 | - for(AsraOpDTO asraOpDTO :list){ | |
177 | - if(asraOpDTO == null){ | |
178 | - continue; | |
179 | - } | |
180 | - childOpIds.add(asraOpDTO.getId()); | |
181 | - } | |
187 | + /** | |
188 | + * 递归查找一级以下的用户 | |
189 | + * @param parentId | |
190 | + * @return | |
191 | + * 2018年8月2日 wangfs.<br/> | |
192 | + */ | |
193 | + private List<Long> getChildOpIds(Long parentId,List<Long> childOpIds){ | |
194 | + AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); | |
195 | + asraOpQueryRe.setParentId(parentId); | |
196 | + BizResult<List<AsraOpDTO>> asraOpReult = asraOpQueryService.queryAsraOpByParentId(asraOpQueryRe); | |
197 | + if(asraOpReult != null && CollectionUtil.isNotEmpty(asraOpReult.getData())){ | |
198 | + List<AsraOpDTO> list = asraOpReult.getData(); | |
199 | + for(AsraOpDTO asraOpDTO :list){ | |
200 | + if(asraOpDTO == null){ | |
201 | + continue; | |
202 | + } | |
203 | + childOpIds.add(asraOpDTO.getId()); | |
204 | + } | |
205 | + | |
206 | + //遍历下一级 | |
207 | + if(CollectionUtil.isNotEmpty(childOpIds)){ | |
208 | + for(Long opId:childOpIds){ | |
209 | + if(opId != null && !opId.equals(parentId)){ | |
210 | + getChildOpIds(opId,childOpIds); | |
211 | + } | |
212 | + break; | |
213 | + | |
214 | + } | |
215 | + | |
216 | + } | |
217 | + } | |
218 | + | |
219 | + return childOpIds; | |
220 | + } | |
221 | + | |
222 | + /** | |
223 | + * 查找登陆用户下一级用户 | |
224 | + * @param opId | |
225 | + * @param opList | |
226 | + * @return | |
227 | + * 2018年8月2日 wangfs.<br/> | |
228 | + */ | |
229 | + private List<Long> getRootOpIds(Long parentId){ | |
230 | + List<Long> opList = new ArrayList<>(); | |
231 | + AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); | |
232 | + asraOpQueryRe.setParentId(parentId); | |
233 | + BizResult<List<AsraOpDTO>> asraOpReult = asraOpQueryService.queryAsraOpByParentId(asraOpQueryRe); | |
234 | + if(asraOpReult != null && CollectionUtil.isNotEmpty(asraOpReult.getData())){ | |
235 | + List<AsraOpDTO> list = asraOpReult.getData(); | |
236 | + for(AsraOpDTO asraOpDTO :list){ | |
237 | + if(asraOpDTO == null){ | |
238 | + continue; | |
239 | + } | |
240 | + opList.add(asraOpDTO.getId()); | |
241 | + } | |
242 | + } | |
243 | + return opList; | |
244 | + } | |
245 | + | |
182 | 246 | |
183 | - //遍历下一级 | |
184 | - if(CollectionUtil.isNotEmpty(childOpIds)){ | |
185 | - for(Long opId:childOpIds){ | |
186 | - if(opId != null && !opId.equals(parentId)){ | |
187 | - getChildOpIds(opId,childOpIds); | |
188 | - } | |
189 | - break; | |
190 | - | |
191 | - } | |
192 | - | |
193 | - } | |
194 | - } | |
195 | - | |
196 | - return childOpIds; | |
197 | - } | |
198 | - | |
199 | - /** | |
200 | - * 查找登陆用户下一级用户 | |
201 | - * @param opId | |
202 | - * @param opList | |
203 | - * @return | |
204 | - * 2018年8月2日 wangfs.<br/> | |
205 | - */ | |
206 | - private List<Long> getRootOpIds(Long parentId){ | |
207 | - List<Long> opList = new ArrayList<>(); | |
208 | - AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq(); | |
209 | - asraOpQueryRe.setParentId(parentId); | |
210 | - BizResult<List<AsraOpDTO>> asraOpReult = asraOpQueryService.queryAsraOpByParentId(asraOpQueryRe); | |
211 | - if(asraOpReult != null && CollectionUtil.isNotEmpty(asraOpReult.getData())){ | |
212 | - List<AsraOpDTO> list = asraOpReult.getData(); | |
213 | - for(AsraOpDTO asraOpDTO :list){ | |
214 | - if(asraOpDTO == null){ | |
215 | - continue; | |
216 | - } | |
217 | - opList.add(asraOpDTO.getId()); | |
218 | - } | |
219 | - } | |
220 | - return opList; | |
221 | - } | |
222 | - | |
223 | - | |
224 | 247 | |
225 | 248 | } | ... | ... |
src/main/resources/mybatis/smapper/AsraOpSmapper.xml
... | ... | @@ -19,43 +19,43 @@ |
19 | 19 | <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" /> |
20 | 20 | <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" /> |
21 | 21 | <result column="remark" jdbcType="VARCHAR" property="remark" /> |
22 | + <result column="parent_id" jdbcType="BIGINT" property="parentId" /> | |
22 | 23 | </resultMap> |
23 | 24 | <sql id="Base_Column_List"> |
24 | - id, login_code, login_password, op_name, email, role_id, city_id, city_name, | |
25 | - is_remind_email, data_state, create_empid, create_emp_name, create_date, modfiy_empid, | |
26 | - modfiy_emp_name, modfiy_date, remark | |
25 | + id, login_code, login_password, op_name, email, role_id, city_id, city_name, is_remind_email, | |
26 | + data_state, create_empid, create_emp_name, create_date, modfiy_empid, modfiy_emp_name, | |
27 | + modfiy_date, remark, parent_id | |
27 | 28 | </sql> |
28 | 29 | |
29 | - <select id="queryAsraOpForList" parameterType="com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq" resultType="com.zteits.oa.api.dto.asraop.AsraOpDTO"> | |
30 | + <select id="queryAsraOpForList" parameterType="com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq" resultMap="BaseResultMap"> | |
30 | 31 | select |
31 | - ap.id id, | |
32 | - ap.login_code loginCode, | |
33 | - ap.op_name opName, | |
34 | - ap.email email, | |
35 | - ap.role_id roleId, | |
36 | - ap.city_id cityId, | |
37 | - ap.city_name cityName, | |
38 | - ap.is_remind_email isRemindEmail | |
39 | - from asra_op ap left join asra_op_relations apr on ap.id = apr.op_id | |
32 | + <include refid="Base_Column_List" /> | |
33 | + from asra_op | |
40 | 34 | where 1=1 |
41 | 35 | <if test="id != null "> |
42 | - and (apr.parent_id = #{id} or ap.id = #{id}) | |
36 | + id = #{id} | |
43 | 37 | </if> |
44 | 38 | <if test="loginCode != null and loginCode !=''"> |
45 | - and ap.login_code = #{loginCode,jdbcType=VARCHAR} | |
39 | + and login_code = #{loginCode,jdbcType=VARCHAR} | |
46 | 40 | </if> |
47 | 41 | <if test="opName != null and opName != ''"> |
48 | - and ap.op_name like concat('%','${opName}','%') | |
42 | + and op_name like concat('%','${opName}','%') | |
49 | 43 | </if> |
50 | 44 | <if test="email != null and email != ''"> |
51 | - and ap.email = #{email,jdbcType=VARCHAR} | |
45 | + and email = #{email,jdbcType=VARCHAR} | |
52 | 46 | </if> |
53 | 47 | <if test="opIdLists != null"> |
54 | - and ap.id in | |
48 | + and id in | |
55 | 49 | <foreach collection="opIdLists" item="opId" open="(" close=")" separator="," > |
56 | 50 | #{opId} |
57 | 51 | </foreach> |
58 | 52 | </if> |
53 | + <if test="opParentIdLists != null"> | |
54 | + and parent_id in | |
55 | + <foreach collection="opParentIdLists" item="opId" open="(" close=")" separator="," > | |
56 | + #{opId} | |
57 | + </foreach> | |
58 | + </if> | |
59 | 59 | </select> |
60 | 60 | |
61 | 61 | </mapper> |
62 | 62 | \ No newline at end of file | ... | ... |