kangwei : 修改、添加健康档案相关接口
正在显示
22 个修改的文件
包含
414 行增加
和
42 行删除
... | @@ -15,6 +15,12 @@ | ... | @@ -15,6 +15,12 @@ |
15 | <if test="param.departId != null and param.departId !=''"> | 15 | <if test="param.departId != null and param.departId !=''"> |
16 | and p.depart_id = #{param.departId} | 16 | and p.depart_id = #{param.departId} |
17 | </if> | 17 | </if> |
18 | <if test="param.paperTitle != null and param.paperTitle !=''"> | ||
19 | and p.paper_title like CONCAT('%',#{param.paperTitle},'%') | ||
20 | </if> | ||
21 | <if test="param.departId != null and param.departId !=''"> | ||
22 | and p.depart_id = #{param.departId} | ||
23 | </if> | ||
18 | and p.id NOT in ( select DISTINCT p1.id | 24 | and p.id NOT in ( select DISTINCT p1.id |
19 | from edu_user_paper up , edu_paper p1 | 25 | from edu_user_paper up , edu_paper p1 |
20 | where up.paper_id = p1.id and up.user_id = #{param.userId} | 26 | where up.paper_id = p1.id and up.user_id = #{param.userId} |
... | @@ -29,9 +35,14 @@ | ... | @@ -29,9 +35,14 @@ |
29 | 35 | ||
30 | <!-- 考试记录--> | 36 | <!-- 考试记录--> |
31 | <select id="queryMyPaperRecoredByList" resultType="com.skua.modules.edu.entity.Paper"> | 37 | <select id="queryMyPaperRecoredByList" resultType="com.skua.modules.edu.entity.Paper"> |
32 | select up.score, up.rank,up.id as 'user_paper_id', p.* from edu_user_paper up | 38 | select up.score, up.rank,up.id as 'user_paper_id', p.* from edu_user_paper up ,edu_paper p |
33 | left join edu_paper p on p.id = up.paper_id | 39 | where up.user_id = #{param.userId} and p.id = up.paper_id |
34 | where up.user_id = #{param.userId} | 40 | <if test="param.paperTitle != null and param.paperTitle !=''"> |
41 | and p.paper_title like CONCAT('%',#{param.paperTitle},'%') | ||
42 | </if> | ||
43 | <if test="param.departId != null and param.departId !=''"> | ||
44 | and p.depart_id = #{param.departId} | ||
45 | </if> | ||
35 | order by up.start_time desc | 46 | order by up.start_time desc |
36 | </select> | 47 | </select> |
37 | </mapper> | 48 | </mapper> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -7,6 +7,7 @@ import com.skua.core.api.vo.Result; | ... | @@ -7,6 +7,7 @@ import com.skua.core.api.vo.Result; |
7 | import com.skua.core.aspect.annotation.AutoLog; | 7 | import com.skua.core.aspect.annotation.AutoLog; |
8 | import com.skua.core.context.BaseContextHandler; | 8 | import com.skua.core.context.BaseContextHandler; |
9 | import com.skua.core.query.QueryGenerator; | 9 | import com.skua.core.query.QueryGenerator; |
10 | import com.skua.core.util.ConvertUtils; | ||
10 | import com.skua.modules.equipment.service.IEquipmentSparepartService; | 11 | import com.skua.modules.equipment.service.IEquipmentSparepartService; |
11 | import com.skua.modules.erp.entity.ApproveRecord; | 12 | import com.skua.modules.erp.entity.ApproveRecord; |
12 | import com.skua.modules.erp.entity.PurchaseMaterial; | 13 | import com.skua.modules.erp.entity.PurchaseMaterial; |
... | @@ -15,16 +16,20 @@ import com.skua.modules.erp.service.IPurchaseMaterialService; | ... | @@ -15,16 +16,20 @@ import com.skua.modules.erp.service.IPurchaseMaterialService; |
15 | import com.skua.modules.erp.vo.MaterialSearchVO; | 16 | import com.skua.modules.erp.vo.MaterialSearchVO; |
16 | import com.skua.modules.erp.vo.PurchaseMaterialVO; | 17 | import com.skua.modules.erp.vo.PurchaseMaterialVO; |
17 | import com.skua.modules.supplies.entity.EquipmentSparepartSupplies; | 18 | import com.skua.modules.supplies.entity.EquipmentSparepartSupplies; |
19 | import com.skua.modules.supplies.entity.EquipmentSparepartType; | ||
18 | import com.skua.modules.supplies.service.IEquipmentSparepartSuppliesService; | 20 | import com.skua.modules.supplies.service.IEquipmentSparepartSuppliesService; |
21 | import com.skua.modules.supplies.service.IEquipmentSparepartTypeService; | ||
19 | import com.skua.modules.system.entity.SysUser; | 22 | import com.skua.modules.system.entity.SysUser; |
23 | import com.skua.tool.dfs.MapDFS; | ||
20 | import io.swagger.annotations.Api; | 24 | import io.swagger.annotations.Api; |
21 | import io.swagger.annotations.ApiOperation; | 25 | import io.swagger.annotations.ApiOperation; |
22 | import lombok.extern.slf4j.Slf4j; | 26 | import lombok.extern.slf4j.Slf4j; |
27 | import org.apache.commons.lang3.StringUtils; | ||
23 | import org.springframework.beans.factory.annotation.Autowired; | 28 | import org.springframework.beans.factory.annotation.Autowired; |
24 | import org.springframework.web.bind.annotation.*; | 29 | import org.springframework.web.bind.annotation.*; |
25 | 30 | ||
26 | import javax.servlet.http.HttpServletRequest; | 31 | import javax.servlet.http.HttpServletRequest; |
27 | import java.util.List; | 32 | import java.util.*; |
28 | 33 | ||
29 | @Slf4j | 34 | @Slf4j |
30 | @Api(tags="ert通用方法") | 35 | @Api(tags="ert通用方法") |
... | @@ -37,7 +42,7 @@ public class ErpCommonController { | ... | @@ -37,7 +42,7 @@ public class ErpCommonController { |
37 | private IPurchaseMaterialService purchaseMaterialService; | 42 | private IPurchaseMaterialService purchaseMaterialService; |
38 | 43 | ||
39 | @Autowired | 44 | @Autowired |
40 | private IDistributMaterialService distributMaterialService; | 45 | private IEquipmentSparepartTypeService equipmentSparepartTypeService; |
41 | 46 | ||
42 | @AutoLog(value = "ERP-采购计划--物料列表") | 47 | @AutoLog(value = "ERP-采购计划--物料列表") |
43 | @ApiOperation(value = "ERP-采购计划--物料列表", notes = "ERP-采购计划--物料列表") | 48 | @ApiOperation(value = "ERP-采购计划--物料列表", notes = "ERP-采购计划--物料列表") |
... | @@ -47,9 +52,20 @@ public class ErpCommonController { | ... | @@ -47,9 +52,20 @@ public class ErpCommonController { |
47 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { | 52 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { |
48 | Result<IPage<EquipmentSparepartSupplies>> result = new Result<IPage<EquipmentSparepartSupplies>>(); | 53 | Result<IPage<EquipmentSparepartSupplies>> result = new Result<IPage<EquipmentSparepartSupplies>>(); |
49 | Page<EquipmentSparepartSupplies> page = new Page<EquipmentSparepartSupplies>(pageNo, pageSize); | 54 | Page<EquipmentSparepartSupplies> page = new Page<EquipmentSparepartSupplies>(pageNo, pageSize); |
50 | String depId = BaseContextHandler.getRealDepartId();//临时参数 | 55 | |
56 | Set<String> sparepartTypeSet = new HashSet<>(); | ||
57 | String sparepartTypeStr = ""; | ||
58 | if (StringUtils.isNotEmpty(materialSearchVO.getSparepartType())) { | ||
59 | // 查询子集 | ||
60 | sparepartTypeSet = equipmentSparepartTypeService.getAllChildrenSparepartTypeIds( materialSearchVO.getSparepartType() ); | ||
61 | if(sparepartTypeSet.size() > 0 ){ | ||
62 | // 使用String.join()方法转换Set为字符串,以逗号分隔 | ||
63 | sparepartTypeStr = String.join(",", sparepartTypeSet); | ||
64 | } | ||
65 | } | ||
66 | // String depId = BaseContextHandler.getRealDepartId();//临时参数 | ||
51 | // String username = req.getParameter("username"); | 67 | // String username = req.getParameter("username"); |
52 | IPage<EquipmentSparepartSupplies> pageList = sparepartSuppliesService.queryPageByOut(page, depId , materialSearchVO.getSparepartName() ,materialSearchVO.getSparepartType(),materialSearchVO.getSparepartCode()); | 68 | IPage<EquipmentSparepartSupplies> pageList = sparepartSuppliesService.queryPageByOut(page , materialSearchVO.getSparepartName() ,sparepartTypeStr ,materialSearchVO.getSparepartCode()); |
53 | result.setSuccess(true); | 69 | result.setSuccess(true); |
54 | result.setResult(pageList); | 70 | result.setResult(pageList); |
55 | return result; | 71 | return result; | ... | ... |
... | @@ -4,6 +4,7 @@ import java.text.ParseException; | ... | @@ -4,6 +4,7 @@ import java.text.ParseException; |
4 | import java.text.SimpleDateFormat; | 4 | import java.text.SimpleDateFormat; |
5 | import java.time.LocalDate; | 5 | import java.time.LocalDate; |
6 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
7 | import java.time.Period; | ||
7 | import java.time.ZoneId; | 8 | import java.time.ZoneId; |
8 | import java.time.format.DateTimeFormatter; | 9 | import java.time.format.DateTimeFormatter; |
9 | import java.util.*; | 10 | import java.util.*; |
... | @@ -28,6 +29,21 @@ public class DateUtil { | ... | @@ -28,6 +29,21 @@ public class DateUtil { |
28 | return dateUtil; | 29 | return dateUtil; |
29 | } | 30 | } |
30 | 31 | ||
32 | |||
33 | /*** | ||
34 | * 计算年龄 | ||
35 | * @param birthdate | ||
36 | * @return | ||
37 | */ | ||
38 | public static int calculateAge(Date birthdate) { | ||
39 | LocalDate now = LocalDate.now(); | ||
40 | LocalDate dob = birthdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); | ||
41 | |||
42 | Period period = Period.between(dob, now); | ||
43 | int age = period.getYears(); | ||
44 | |||
45 | return age; | ||
46 | } | ||
31 | /** | 47 | /** |
32 | * 转化日期格式 | 48 | * 转化日期格式 |
33 | * @param dateString 要转换的日期字符串 | 49 | * @param dateString 要转换的日期字符串 | ... | ... |
1 | package com.skua.modules.safe.controller; | 1 | package com.skua.modules.safe.controller; |
2 | 2 | ||
3 | import java.util.Arrays; | 3 | import java.util.*; |
4 | import java.util.List; | ||
5 | import java.util.Map; | ||
6 | import java.io.IOException; | 4 | import java.io.IOException; |
7 | import java.io.UnsupportedEncodingException; | 5 | import java.io.UnsupportedEncodingException; |
8 | import java.net.URLDecoder; | 6 | import java.net.URLDecoder; |
... | @@ -10,16 +8,23 @@ import javax.servlet.http.HttpServletRequest; | ... | @@ -10,16 +8,23 @@ import javax.servlet.http.HttpServletRequest; |
10 | import javax.servlet.http.HttpServletResponse; | 8 | import javax.servlet.http.HttpServletResponse; |
11 | import com.skua.core.api.vo.Result; | 9 | import com.skua.core.api.vo.Result; |
12 | import com.skua.core.aspect.annotation.AutoLog; | 10 | import com.skua.core.aspect.annotation.AutoLog; |
13 | import com.skua.core.context.BaseContextHandler; | ||
14 | import com.skua.core.query.QueryGenerator; | 11 | import com.skua.core.query.QueryGenerator; |
15 | import com.skua.core.util.ConvertUtils; | 12 | import com.skua.core.util.ConvertUtils; |
13 | import com.skua.modules.flow.utils.StringUtil; | ||
16 | import com.skua.modules.safe.entity.HealthRecords; | 14 | import com.skua.modules.safe.entity.HealthRecords; |
17 | import com.skua.modules.safe.service.IHealthRecordsService; | 15 | import com.skua.modules.safe.service.IHealthRecordsService; |
18 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 16 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
19 | import com.baomidou.mybatisplus.core.metadata.IPage; | 17 | import com.baomidou.mybatisplus.core.metadata.IPage; |
20 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 18 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
19 | import com.skua.modules.safe.vo.HealthRecordsStatisticsVO; | ||
20 | import com.skua.modules.safe.vo.HealthRecordsVO; | ||
21 | import com.skua.modules.system.entity.SysUser; | ||
22 | import com.skua.modules.system.service.ISysDepartService; | ||
23 | import com.skua.modules.system.service.ISysUserDepartService; | ||
24 | import com.skua.modules.system.service.ISysUserService; | ||
21 | import lombok.extern.slf4j.Slf4j; | 25 | import lombok.extern.slf4j.Slf4j; |
22 | 26 | ||
27 | import org.apache.commons.lang.StringUtils; | ||
23 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 28 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
24 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 29 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
25 | import org.jeecgframework.poi.excel.entity.ExportParams; | 30 | import org.jeecgframework.poi.excel.entity.ExportParams; |
... | @@ -49,12 +54,18 @@ import io.swagger.annotations.ApiOperation; | ... | @@ -49,12 +54,18 @@ import io.swagger.annotations.ApiOperation; |
49 | public class HealthRecordsController { | 54 | public class HealthRecordsController { |
50 | @Autowired | 55 | @Autowired |
51 | private IHealthRecordsService healthRecordsService; | 56 | private IHealthRecordsService healthRecordsService; |
57 | @Autowired | ||
58 | private ISysUserDepartService userDepartService; | ||
59 | @Autowired | ||
60 | private ISysDepartService departService; | ||
52 | 61 | ||
62 | @Autowired | ||
63 | private ISysUserService userService; | ||
53 | /** | 64 | /** |
54 | * <pre> | 65 | * <pre> |
55 | * 分页列表查询 | 66 | * 分页列表查询 |
56 | * </pre> | 67 | * </pre> |
57 | * @param healthRecords | 68 | * @param healthRecordsVO |
58 | * @param pageNo | 69 | * @param pageNo |
59 | * @param pageSize | 70 | * @param pageSize |
60 | * @param req | 71 | * @param req |
... | @@ -62,20 +73,38 @@ public class HealthRecordsController { | ... | @@ -62,20 +73,38 @@ public class HealthRecordsController { |
62 | * @author 开发者姓名, 开发时间 | 73 | * @author 开发者姓名, 开发时间 |
63 | * @Description: TODO(这里描述这个方法的需求变更情况) | 74 | * @Description: TODO(这里描述这个方法的需求变更情况) |
64 | */ | 75 | */ |
65 | |||
66 | @AutoLog(value = "健康档案-分页列表查询") | 76 | @AutoLog(value = "健康档案-分页列表查询") |
67 | @ApiOperation(value="健康档案-分页列表查询", notes="健康档案-分页列表查询") | 77 | @ApiOperation(value="健康档案-分页列表查询", notes="健康档案-分页列表查询") |
68 | @GetMapping(value = "/list") | 78 | @GetMapping(value = "/list") |
69 | public Result<IPage<HealthRecords>> queryPageList(HealthRecords healthRecords, | 79 | public Result<IPage<HealthRecordsVO>> queryPageList(HealthRecordsVO healthRecordsVO, |
70 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | 80 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
71 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 81 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
72 | HttpServletRequest req) { | 82 | HttpServletRequest req) { |
73 | Result<IPage<HealthRecords>> result = new Result<IPage<HealthRecords>>(); | 83 | Result<IPage<HealthRecordsVO>> result = new Result<IPage<HealthRecordsVO>>(); |
74 | QueryWrapper<HealthRecords> queryWrapper = QueryGenerator.initQueryWrapper(healthRecords, req.getParameterMap()); | 84 | /* QueryWrapper<HealthRecords> queryWrapper = QueryGenerator.initQueryWrapper(healthRecords, req.getParameterMap()); |
75 | Page<HealthRecords> page = new Page<HealthRecords>(pageNo, pageSize); | 85 | Page<HealthRecords> page = new Page<HealthRecords>(pageNo, pageSize); |
76 | //queryWrapper.eq("depart_id", BaseContextHandler.getRealDepartId()); | 86 | //queryWrapper.eq("depart_id", BaseContextHandler.getRealDepartId()); |
77 | queryWrapper.in("depart_id", BaseContextHandler.getDeparts().split(",")); | 87 | queryWrapper.in("depart_id", BaseContextHandler.getDeparts().split(",")); |
78 | IPage<HealthRecords> pageList = healthRecordsService.page(page, queryWrapper); | 88 | IPage<HealthRecords> pageList = healthRecordsService.page(page, queryWrapper);*/ |
89 | |||
90 | String departAncestors = ""; | ||
91 | |||
92 | Set<String> departSet = new HashSet<>(); | ||
93 | if (StringUtils.isNotEmpty(healthRecordsVO.getDepartId() )) { | ||
94 | String departId = healthRecordsVO.getDepartId(); | ||
95 | // 查询子集 | ||
96 | departSet = departService.getAllChildrenDepartIds(departId); | ||
97 | if(departSet.size() > 0 ){ | ||
98 | // 使用String.join()方法转换Set为字符串,以逗号分隔 | ||
99 | departAncestors = String.join(",", departSet); | ||
100 | } | ||
101 | } | ||
102 | if(departAncestors.length() > 0 ){ | ||
103 | healthRecordsVO.setDepartAncestors( departAncestors ); | ||
104 | } | ||
105 | |||
106 | Page<HealthRecordsVO> page = new Page<HealthRecordsVO>(pageNo, pageSize); | ||
107 | IPage<HealthRecordsVO> pageList = healthRecordsService.queryByPage(page, healthRecordsVO); | ||
79 | result.setSuccess(true); | 108 | result.setSuccess(true); |
80 | result.setResult(pageList); | 109 | result.setResult(pageList); |
81 | return result; | 110 | return result; |
... | @@ -96,6 +125,14 @@ public class HealthRecordsController { | ... | @@ -96,6 +125,14 @@ public class HealthRecordsController { |
96 | public Result<HealthRecords> add(@RequestBody HealthRecords healthRecords) { | 125 | public Result<HealthRecords> add(@RequestBody HealthRecords healthRecords) { |
97 | Result<HealthRecords> result = new Result<HealthRecords>(); | 126 | Result<HealthRecords> result = new Result<HealthRecords>(); |
98 | try { | 127 | try { |
128 | if( StringUtil.isNotBlank(healthRecords.getUserId())){ | ||
129 | List<String> deparentList = userDepartService.getDepartByUserId(healthRecords.getUserId()); | ||
130 | if(deparentList != null && !deparentList.isEmpty()){ | ||
131 | healthRecords.setDepartId(deparentList.get(0) );//获取用户所属的部门的第一条记录 | ||
132 | } | ||
133 | SysUser sysUser = userService.getById(healthRecords.getUserId()); | ||
134 | if(sysUser != null ) healthRecords.setUserName( sysUser.getRealname()); | ||
135 | } | ||
99 | healthRecordsService.save(healthRecords); | 136 | healthRecordsService.save(healthRecords); |
100 | result.success("添加成功!"); | 137 | result.success("添加成功!"); |
101 | } catch (Exception e) { | 138 | } catch (Exception e) { |
... | @@ -118,10 +155,21 @@ public class HealthRecordsController { | ... | @@ -118,10 +155,21 @@ public class HealthRecordsController { |
118 | @PutMapping(value = "/edit") | 155 | @PutMapping(value = "/edit") |
119 | public Result<HealthRecords> edit(@RequestBody HealthRecords healthRecords) { | 156 | public Result<HealthRecords> edit(@RequestBody HealthRecords healthRecords) { |
120 | Result<HealthRecords> result = new Result<HealthRecords>(); | 157 | Result<HealthRecords> result = new Result<HealthRecords>(); |
158 | |||
159 | |||
121 | HealthRecords healthRecordsEntity = healthRecordsService.getById(healthRecords.getId()); | 160 | HealthRecords healthRecordsEntity = healthRecordsService.getById(healthRecords.getId()); |
122 | if(healthRecordsEntity==null) { | 161 | if(healthRecordsEntity==null) { |
123 | result.error500("未找到对应实体"); | 162 | result.error500("未找到对应实体"); |
124 | }else { | 163 | }else { |
164 | |||
165 | if( StringUtil.isNotBlank(healthRecords.getUserId())){ | ||
166 | List<String> deparentList = userDepartService.getDepartByUserId(healthRecords.getUserId()); | ||
167 | if(deparentList != null && !deparentList.isEmpty()){ | ||
168 | healthRecords.setDepartId(deparentList.get(0) );//获取用户所属的部门的第一条记录 | ||
169 | } | ||
170 | SysUser sysUser = userService.getById(healthRecords.getUserId()); | ||
171 | if(sysUser != null ) healthRecords.setUserName( sysUser.getRealname()); | ||
172 | } | ||
125 | boolean ok = healthRecordsService.updateById(healthRecords); | 173 | boolean ok = healthRecordsService.updateById(healthRecords); |
126 | //TODO 返回false说明什么? | 174 | //TODO 返回false说明什么? |
127 | if(ok) { | 175 | if(ok) { |
... | @@ -199,6 +247,30 @@ public class HealthRecordsController { | ... | @@ -199,6 +247,30 @@ public class HealthRecordsController { |
199 | return result; | 247 | return result; |
200 | } | 248 | } |
201 | 249 | ||
250 | |||
251 | @AutoLog(value = "健康档案-统计接口") | ||
252 | @ApiOperation(value="健康档案-统计接口", notes="健康档案-统计接口") | ||
253 | @GetMapping(value = "/statistics") | ||
254 | public Result<HealthRecordsStatisticsVO> statistics(@RequestParam(name="departId",required=true) String departId) { | ||
255 | Result<HealthRecordsStatisticsVO> result = new Result<HealthRecordsStatisticsVO>(); | ||
256 | |||
257 | // 查询子集 | ||
258 | String departAncestors = ""; | ||
259 | |||
260 | Set<String> departSet = new HashSet<>(); | ||
261 | // 查询子集 | ||
262 | departSet = departService.getAllChildrenDepartIds(departId); | ||
263 | if(departSet.size() > 0 ){ | ||
264 | // 使用String.join()方法转换Set为字符串,以逗号分隔 | ||
265 | departAncestors = String.join(",", departSet); | ||
266 | } | ||
267 | |||
268 | HealthRecordsStatisticsVO statisticsVO = healthRecordsService.statistics(departAncestors); | ||
269 | result.setResult(statisticsVO); | ||
270 | result.setSuccess(true); | ||
271 | return result; | ||
272 | } | ||
273 | |||
202 | /** | 274 | /** |
203 | * <pre> | 275 | * <pre> |
204 | * 导出excel | 276 | * 导出excel | ... | ... |
... | @@ -41,16 +41,11 @@ public class EpibolyOuterStaff { | ... | @@ -41,16 +41,11 @@ public class EpibolyOuterStaff { |
41 | @Dict(dictTable = "epiboly_company", dicCode="id", dicText = "company_name") | 41 | @Dict(dictTable = "epiboly_company", dicCode="id", dicText = "company_name") |
42 | private String companyId; | 42 | private String companyId; |
43 | 43 | ||
44 | |||
45 | |||
46 | |||
47 | /**关联外协单位ID*/ | 44 | /**关联外协单位ID*/ |
48 | @Excel(name = "外协类型", width = 15) | 45 | @Excel(name = "外协类型", width = 15) |
49 | @ApiModelProperty(value = "外协类型:1 单位合作;2 个人合作") | 46 | @ApiModelProperty(value = "外协类型:1 单位合作;2 个人合作") |
50 | @Dict(dicCode = "cooperate_type") | 47 | @Dict(dicCode = "cooperate_type") |
51 | private String cooperateType; | 48 | private String cooperateType; |
52 | |||
53 | |||
54 | /**员工名称*/ | 49 | /**员工名称*/ |
55 | @Excel(name = "员工名称", width = 15) | 50 | @Excel(name = "员工名称", width = 15) |
56 | @ApiModelProperty(value = "员工名称") | 51 | @ApiModelProperty(value = "员工名称") | ... | ... |
... | @@ -43,6 +43,14 @@ public class HealthRecords { | ... | @@ -43,6 +43,14 @@ public class HealthRecords { |
43 | @Excel(name = "用户编号", width = 15) | 43 | @Excel(name = "用户编号", width = 15) |
44 | @ApiModelProperty(value = "用户编号") | 44 | @ApiModelProperty(value = "用户编号") |
45 | private String userId; | 45 | private String userId; |
46 | |||
47 | @ApiModelProperty(value = "用户名称") | ||
48 | private String userName; | ||
49 | |||
50 | @Excel(name = "用户学历", width = 15) | ||
51 | @ApiModelProperty(value = "用户学历") | ||
52 | private String education; | ||
53 | |||
46 | /**检查地点*/ | 54 | /**检查地点*/ |
47 | @Excel(name = "检查地点", width = 15) | 55 | @Excel(name = "检查地点", width = 15) |
48 | @ApiModelProperty(value = "检查地点") | 56 | @ApiModelProperty(value = "检查地点") |
... | @@ -50,7 +58,12 @@ public class HealthRecords { | ... | @@ -50,7 +58,12 @@ public class HealthRecords { |
50 | /**检查结果*/ | 58 | /**检查结果*/ |
51 | @Excel(name = "检查结果", width = 15) | 59 | @Excel(name = "检查结果", width = 15) |
52 | @ApiModelProperty(value = "检查结果") | 60 | @ApiModelProperty(value = "检查结果") |
61 | @Dict(dicCode="health_records_inspection_results") | ||
53 | private String inspectResult; | 62 | private String inspectResult; |
63 | |||
64 | @Excel(name = "检查日期", width = 15) | ||
65 | @ApiModelProperty(value = "检查日期") | ||
66 | private String inspectTime; | ||
54 | /**检查报告*/ | 67 | /**检查报告*/ |
55 | @Excel(name = "检查报告", width = 15) | 68 | @Excel(name = "检查报告", width = 15) |
56 | @ApiModelProperty(value = "检查报告") | 69 | @ApiModelProperty(value = "检查报告") | ... | ... |
... | @@ -2,6 +2,10 @@ package com.skua.modules.safe.mapper; | ... | @@ -2,6 +2,10 @@ package com.skua.modules.safe.mapper; |
2 | 2 | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | 4 | ||
5 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
7 | import com.skua.modules.safe.vo.HealthRecordsStatisticsVO; | ||
8 | import com.skua.modules.safe.vo.HealthRecordsVO; | ||
5 | import org.apache.ibatis.annotations.Param; | 9 | import org.apache.ibatis.annotations.Param; |
6 | import com.skua.modules.safe.entity.HealthRecords; | 10 | import com.skua.modules.safe.entity.HealthRecords; |
7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 11 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
... | @@ -11,4 +15,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ... | @@ -11,4 +15,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
11 | */ | 15 | */ |
12 | public interface HealthRecordsMapper extends BaseMapper<HealthRecords> { | 16 | public interface HealthRecordsMapper extends BaseMapper<HealthRecords> { |
13 | 17 | ||
18 | public IPage<HealthRecordsVO> queryByPage(Page<HealthRecordsVO> page,@Param("healthRecordsVO") HealthRecordsVO healthRecordsVO); | ||
19 | |||
20 | /*** | ||
21 | * 统计接口 | ||
22 | * @param departAncestors | ||
23 | * @return | ||
24 | */ | ||
25 | public HealthRecordsStatisticsVO statistics(@Param("departAncestors") String departAncestors ); | ||
14 | } | 26 | } | ... | ... |
... | @@ -2,4 +2,40 @@ | ... | @@ -2,4 +2,40 @@ |
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | <mapper namespace="com.skua.modules.safe.mapper.HealthRecordsMapper"> | 3 | <mapper namespace="com.skua.modules.safe.mapper.HealthRecordsMapper"> |
4 | 4 | ||
5 | |||
6 | <select id="queryByPage" resultType="com.skua.modules.safe.vo.HealthRecordsVO" parameterType="com.skua.modules.safe.vo.HealthRecordsVO"> | ||
7 | select u.phone, u.birthday,u.sex, | ||
8 | (select group_concat(DISTINCT (select r.role_name from sys_role r where r.id = sur.role_id)) role_name | ||
9 | from sys_user_role sur where sur.user_id = hr.user_id) 'role_name', | ||
10 | hr.* | ||
11 | from safety_health_records hr | ||
12 | left join sys_user u on hr.user_id = u.id | ||
13 | <where> | ||
14 | <if test="healthRecordsVO.userName != null and healthRecordsVO.userName !=''"> | ||
15 | and hr.user_name like CONCAT('%',#{healthRecordsVO.userName},'%') | ||
16 | </if> | ||
17 | <if test="healthRecordsVO.departAncestors != null and healthRecordsVO.departAncestors !=''"> | ||
18 | and hr.depart_id in (${healthRecordsVO.departAncestors}) | ||
19 | </if> | ||
20 | <if test="healthRecordsVO.inspectTime != null and healthRecordsVO.inspectTime !=''"> | ||
21 | and hr.inspect_time = #{healthRecordsVO.inspectTime} | ||
22 | </if> | ||
23 | <if test="healthRecordsVO.startTime != null and healthRecordsVO.startTime !=''"> | ||
24 | and hr.inspect_time >= #{healthRecordsVO.startTime} | ||
25 | </if> | ||
26 | <if test="healthRecordsVO.endTime != null and healthRecordsVO.endTime !=''"> | ||
27 | and hr.inspect_time <= #{healthRecordsVO.endTime} | ||
28 | </if> | ||
29 | </where> | ||
30 | order by hr.create_time desc | ||
31 | </select> | ||
32 | |||
33 | <!-- 统计接口--> | ||
34 | <select id="statistics" resultType="com.skua.modules.safe.vo.HealthRecordsStatisticsVO"> | ||
35 | select | ||
36 | (select count(1) from sys_user_depart where dep_id in (${departAncestors}) ) 'totalNum', | ||
37 | (select count(1 ) from (select DISTINCT user_id from safety_health_records hr where hr.depart_id in ( ${departAncestors} ) ) aa) 'useNum' | ||
38 | from dual | ||
39 | </select> | ||
40 | |||
5 | </mapper> | 41 | </mapper> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | package com.skua.modules.safe.service; | 1 | package com.skua.modules.safe.service; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
3 | import com.skua.modules.safe.entity.HealthRecords; | 5 | import com.skua.modules.safe.entity.HealthRecords; |
4 | import com.baomidou.mybatisplus.extension.service.IService; | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
7 | import com.skua.modules.safe.vo.HealthRecordsStatisticsVO; | ||
8 | import com.skua.modules.safe.vo.HealthRecordsVO; | ||
5 | 9 | ||
6 | /** | 10 | /** |
7 | * 健康档案 | 11 | * 健康档案 |
8 | */ | 12 | */ |
9 | public interface IHealthRecordsService extends IService<HealthRecords> { | 13 | public interface IHealthRecordsService extends IService<HealthRecords> { |
14 | /*** | ||
15 | * 分页检索健康记录 | ||
16 | * @param page | ||
17 | * @param healthRecordsVO | ||
18 | * @return | ||
19 | */ | ||
20 | IPage<HealthRecordsVO> queryByPage(Page<HealthRecordsVO> page, HealthRecordsVO healthRecordsVO); | ||
10 | 21 | ||
22 | /*** | ||
23 | * 统计 | ||
24 | * @param departAncestors | ||
25 | * @return | ||
26 | */ | ||
27 | public HealthRecordsStatisticsVO statistics(String departAncestors); | ||
11 | } | 28 | } | ... | ... |
1 | package com.skua.modules.safe.service.impl; | 1 | package com.skua.modules.safe.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
3 | import com.skua.modules.safe.entity.HealthRecords; | 5 | import com.skua.modules.safe.entity.HealthRecords; |
4 | import com.skua.modules.safe.mapper.HealthRecordsMapper; | 6 | import com.skua.modules.safe.mapper.HealthRecordsMapper; |
5 | import com.skua.modules.safe.service.IHealthRecordsService; | 7 | import com.skua.modules.safe.service.IHealthRecordsService; |
8 | import com.skua.modules.safe.vo.HealthRecordsStatisticsVO; | ||
9 | import com.skua.modules.safe.vo.HealthRecordsVO; | ||
6 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
7 | 11 | ||
8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 12 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
... | @@ -13,4 +17,22 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ... | @@ -13,4 +17,22 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
13 | @Service | 17 | @Service |
14 | public class HealthRecordsServiceImpl extends ServiceImpl<HealthRecordsMapper, HealthRecords> implements IHealthRecordsService { | 18 | public class HealthRecordsServiceImpl extends ServiceImpl<HealthRecordsMapper, HealthRecords> implements IHealthRecordsService { |
15 | 19 | ||
20 | /*** | ||
21 | * 分页检索健康记录 | ||
22 | * @param page | ||
23 | * @param healthRecordsVO | ||
24 | * @return | ||
25 | */ | ||
26 | public IPage<HealthRecordsVO> queryByPage(Page<HealthRecordsVO> page, HealthRecordsVO healthRecordsVO){ | ||
27 | return this.baseMapper.queryByPage( page,healthRecordsVO ); | ||
28 | } | ||
29 | |||
30 | /*** | ||
31 | * 统计 | ||
32 | * @param departAncestors | ||
33 | * @return | ||
34 | */ | ||
35 | public HealthRecordsStatisticsVO statistics(String departAncestors){ | ||
36 | return this.baseMapper.statistics( departAncestors ); | ||
37 | } | ||
16 | } | 38 | } | ... | ... |
1 | package com.skua.modules.safe.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | |||
7 | @Data | ||
8 | @ApiModel(value="HealthRecords健康档案统计对象", description="健康档案统计对象") | ||
9 | public class HealthRecordsStatisticsVO { | ||
10 | @ApiModelProperty(value = "部门下总人数") | ||
11 | private String totalNum; | ||
12 | |||
13 | @ApiModelProperty(value = "已检查人数") | ||
14 | private String useNum; | ||
15 | } |
1 | package com.skua.modules.safe.vo; | ||
2 | |||
3 | import com.fasterxml.jackson.annotation.JsonFormat; | ||
4 | import com.skua.core.aspect.annotation.Dict; | ||
5 | import com.skua.modules.safe.entity.HealthRecords; | ||
6 | import com.skua.modules.guest.util.DateUtil; | ||
7 | import io.swagger.annotations.ApiModel; | ||
8 | import io.swagger.annotations.ApiModelProperty; | ||
9 | import lombok.Data; | ||
10 | import org.jeecgframework.poi.excel.annotation.Excel; | ||
11 | import org.springframework.format.annotation.DateTimeFormat; | ||
12 | |||
13 | import java.util.Date; | ||
14 | |||
15 | @Data | ||
16 | @ApiModel(value="HealthRecords健康档案", description="健康档案") | ||
17 | public class HealthRecordsVO extends HealthRecords { | ||
18 | |||
19 | |||
20 | /** | ||
21 | * 性别(1:男 2:女) | ||
22 | */ | ||
23 | @Excel(name = "用户性别", width = 15,dicCode="sex") | ||
24 | @Dict(dicCode = "sex") | ||
25 | private Integer sex; | ||
26 | |||
27 | @ApiModelProperty(value = "年龄") | ||
28 | private String age; | ||
29 | |||
30 | |||
31 | @Excel(name = "生日", width = 15, format = "yyyy-MM-dd") | ||
32 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") | ||
33 | @DateTimeFormat(pattern = "yyyy-MM-dd") | ||
34 | private Date birthday; | ||
35 | /** | ||
36 | * 电话 | ||
37 | */ | ||
38 | @Excel(name = "电话", width = 15) | ||
39 | @ApiModelProperty(value = "电话") | ||
40 | private String phone; | ||
41 | /** | ||
42 | * 角色 | ||
43 | */ | ||
44 | @Excel(name = "角色", width = 15) | ||
45 | @ApiModelProperty(value = "角色名称") | ||
46 | private String roleName; | ||
47 | |||
48 | @ApiModelProperty(value = "开始时间") | ||
49 | private String startTime; | ||
50 | @ApiModelProperty(value = "结束时间") | ||
51 | private String endTime; | ||
52 | |||
53 | public String getAge(){ | ||
54 | if(this.getBirthday() != null ){ | ||
55 | return DateUtil.calculateAge(this.getBirthday() )+""; | ||
56 | } | ||
57 | return ""; | ||
58 | } | ||
59 | |||
60 | } |
... | @@ -15,10 +15,9 @@ public interface EquipmentSparepartSuppliesMapper extends BaseMapper<EquipmentSp | ... | @@ -15,10 +15,9 @@ public interface EquipmentSparepartSuppliesMapper extends BaseMapper<EquipmentSp |
15 | /*** | 15 | /*** |
16 | * 物料列表+去年出库 | 16 | * 物料列表+去年出库 |
17 | * @param page | 17 | * @param page |
18 | * @param depId | 18 | * @param |
19 | * @return | 19 | * @return |
20 | */ | 20 | */ |
21 | public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, | 21 | public IPage<EquipmentSparepartSupplies> selectPageByOut(Page<EquipmentSparepartSupplies> page,@Param("sparepartName")String sparepartName, |
22 | @Param("depId") String depId ,@Param("sparepartName")String sparepartName, | ||
23 | @Param("sparepartType")String sparepartType ,@Param("sparepartCode")String sparepartCode); | 22 | @Param("sparepartType")String sparepartType ,@Param("sparepartCode")String sparepartCode); |
24 | } | 23 | } | ... | ... |
... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
3 | <mapper namespace="com.skua.modules.supplies.mapper.EquipmentSparepartSuppliesMapper"> | 3 | <mapper namespace="com.skua.modules.supplies.mapper.EquipmentSparepartSuppliesMapper"> |
4 | 4 | ||
5 | <!-- 物料列表+去年出库 --> | 5 | <!-- 物料列表+去年出库 --> |
6 | <select id="queryPageByOut" resultType="com.skua.modules.supplies.entity.EquipmentSparepartSupplies"> | 6 | <select id="selectPageByOut" resultType="com.skua.modules.supplies.entity.EquipmentSparepartSupplies"> |
7 | select st.item_text 'sparepart_type_name' , aaa.out_num, ss.* from equipment_sparepart_supplies ss | 7 | select st.item_text 'sparepart_type_name' , aaa.out_num, ss.* from equipment_sparepart_supplies ss |
8 | left join equipment_sparepart_type st on ss.sparepart_type = st.id | 8 | left join equipment_sparepart_type st on ss.sparepart_type = st.id |
9 | left join ( | 9 | left join ( |
... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
20 | and ss.sparepart_code like CONCAT('%', #{sparepartCode},'%') | 20 | and ss.sparepart_code like CONCAT('%', #{sparepartCode},'%') |
21 | </if> | 21 | </if> |
22 | <if test="sparepartType != null and sparepartType !=''"> | 22 | <if test="sparepartType != null and sparepartType !=''"> |
23 | and ss.sparepart_type = #{sparepartType} | 23 | and ss.sparepart_type in ( ${sparepartType}) |
24 | </if> | 24 | </if> |
25 | </where> | 25 | </where> |
26 | </select> | 26 | </select> | ... | ... |
... | @@ -15,5 +15,5 @@ public interface IEquipmentSparepartSuppliesService extends IService<EquipmentSp | ... | @@ -15,5 +15,5 @@ public interface IEquipmentSparepartSuppliesService extends IService<EquipmentSp |
15 | * @param depId | 15 | * @param depId |
16 | * @return | 16 | * @return |
17 | */ | 17 | */ |
18 | public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId ,String sparepartName,String sparepartType ,String sparepartCode); | 18 | public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String sparepartName,String sparepartType ,String sparepartCode); |
19 | } | 19 | } | ... | ... |
... | @@ -3,10 +3,20 @@ package com.skua.modules.supplies.service; | ... | @@ -3,10 +3,20 @@ package com.skua.modules.supplies.service; |
3 | import com.baomidou.mybatisplus.extension.service.IService; | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | import com.skua.modules.supplies.entity.EquipmentSparepartType; | 4 | import com.skua.modules.supplies.entity.EquipmentSparepartType; |
5 | 5 | ||
6 | import java.util.Set; | ||
7 | |||
6 | /** | 8 | /** |
7 | * 设备物资类型 | 9 | * 设备物资类型 |
8 | */ | 10 | */ |
9 | public interface IEquipmentSparepartTypeService extends IService<EquipmentSparepartType> { | 11 | public interface IEquipmentSparepartTypeService extends IService<EquipmentSparepartType> { |
12 | |||
13 | |||
14 | /*** | ||
15 | * 获取类别下所有的子分类 | ||
16 | * @param sparepartTypeId | ||
17 | * @return | ||
18 | */ | ||
19 | public Set<String> getAllChildrenSparepartTypeIds( String sparepartTypeId ); | ||
10 | /** | 20 | /** |
11 | * <pre> | 21 | * <pre> |
12 | * 保存并修改父级叶子节点状态 | 22 | * 保存并修改父级叶子节点状态 | ... | ... |
... | @@ -17,10 +17,10 @@ public class EquipmentSparepartSuppliesServiceImpl extends ServiceImpl<Equipment | ... | @@ -17,10 +17,10 @@ public class EquipmentSparepartSuppliesServiceImpl extends ServiceImpl<Equipment |
17 | /*** | 17 | /*** |
18 | * 物料列表+去年出库 | 18 | * 物料列表+去年出库 |
19 | * @param page | 19 | * @param page |
20 | * @param depId | 20 | * @param |
21 | * @return | 21 | * @return |
22 | */ | 22 | */ |
23 | public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId ,String sparepartName,String sparepartType ,String sparepartCode){ | 23 | public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page ,String sparepartName,String sparepartType ,String sparepartCode){ |
24 | return baseMapper.queryPageByOut(page,depId ,sparepartName,sparepartType,sparepartCode); | 24 | return baseMapper.selectPageByOut(page ,sparepartName,sparepartType,sparepartCode); |
25 | } | 25 | } |
26 | } | 26 | } | ... | ... |
1 | package com.skua.modules.supplies.service.impl; | 1 | package com.skua.modules.supplies.service.impl; |
2 | 2 | ||
3 | import java.util.List; | 3 | import java.util.*; |
4 | 4 | ||
5 | import com.skua.core.util.ConvertUtils; | ||
6 | import com.skua.tool.dfs.MapDFS; | ||
5 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
6 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
7 | import org.springframework.transaction.annotation.Transactional; | 9 | import org.springframework.transaction.annotation.Transactional; |
... | @@ -20,7 +22,32 @@ import com.skua.modules.supplies.service.IEquipmentSparepartTypeService; | ... | @@ -20,7 +22,32 @@ import com.skua.modules.supplies.service.IEquipmentSparepartTypeService; |
20 | public class EquipmentSparepartTypeServiceImpl extends ServiceImpl<EquipmentSparepartTypeMapper, EquipmentSparepartType> implements IEquipmentSparepartTypeService { | 22 | public class EquipmentSparepartTypeServiceImpl extends ServiceImpl<EquipmentSparepartTypeMapper, EquipmentSparepartType> implements IEquipmentSparepartTypeService { |
21 | @Autowired | 23 | @Autowired |
22 | private ISequenceService sequenceService; | 24 | private ISequenceService sequenceService; |
23 | @Override | 25 | |
26 | /*** | ||
27 | * 获取类别下所有的子分类 | ||
28 | * @param sparepartTypeId | ||
29 | * @return | ||
30 | */ | ||
31 | public Set<String> getAllChildrenSparepartTypeIds(String sparepartTypeId ){ | ||
32 | Set<String> sparepartTypeSet = new HashSet<>(); | ||
33 | //查询子集 | ||
34 | MapDFS mapDFS = new MapDFS(); | ||
35 | List<Map<String, Object>> tree = mapDFS.buildTree(this.listMaps(new QueryWrapper<EquipmentSparepartType>().select("id, parent_id as parentId"))); | ||
36 | LinkedList<LinkedList<Map<String, Object>>> routeList = mapDFS.getRouteList(tree); | ||
37 | for (LinkedList<Map<String, Object>> route: routeList) { | ||
38 | for (int i = 0; i < route.size(); i++) { | ||
39 | if (sparepartTypeId.equals(route.get(i).get("id"))) { | ||
40 | for (int j = i; j < route.size(); j++) { | ||
41 | sparepartTypeSet.add( "'"+ ConvertUtils.getString(route.get(j).get("id"))+"'"); | ||
42 | //sparepartTypeStr = sparepartTypeStr + ConvertUtils.getString(route.get(j).get("id")) + ","; | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | |||
48 | return sparepartTypeSet; | ||
49 | } | ||
50 | |||
24 | @Transactional(rollbackFor = Exception.class) | 51 | @Transactional(rollbackFor = Exception.class) |
25 | public void saveAndUpdateParent(EquipmentSparepartType equipmentSparepartType) { | 52 | public void saveAndUpdateParent(EquipmentSparepartType equipmentSparepartType) { |
26 | //保存新数据 | 53 | //保存新数据 | ... | ... |
... | @@ -10,6 +10,7 @@ import com.skua.modules.system.vo.SysDeptUserVO; | ... | @@ -10,6 +10,7 @@ import com.skua.modules.system.vo.SysDeptUserVO; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | import java.util.Set; | ||
13 | 14 | ||
14 | /** | 15 | /** |
15 | * 部门表 服务实现类 | 16 | * 部门表 服务实现类 |
... | @@ -17,6 +18,13 @@ import java.util.Map; | ... | @@ -17,6 +18,13 @@ import java.util.Map; |
17 | public interface ISysDepartService extends IService<SysDepart>{ | 18 | public interface ISysDepartService extends IService<SysDepart>{ |
18 | 19 | ||
19 | 20 | ||
21 | /*** | ||
22 | * 查询子集所有的部门 | ||
23 | * @param departId | ||
24 | * @return | ||
25 | */ | ||
26 | public Set<String> getAllChildrenDepartIds(String departId); | ||
27 | |||
20 | /** | 28 | /** |
21 | * 查询所有部门信息,并分节点进行显示 | 29 | * 查询所有部门信息,并分节点进行显示 |
22 | * @return | 30 | * @return | ... | ... |
... | @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | ... | @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; |
5 | import com.skua.modules.system.entity.SysUser; | 5 | import com.skua.modules.system.entity.SysUser; |
6 | import com.skua.modules.system.entity.SysUserDepart; | 6 | import com.skua.modules.system.entity.SysUserDepart; |
7 | import com.skua.modules.system.model.DepartIdModel; | 7 | import com.skua.modules.system.model.DepartIdModel; |
8 | import io.lettuce.core.dynamic.annotation.Param; | ||
8 | 9 | ||
9 | import java.util.List; | 10 | import java.util.List; |
10 | 11 | ||
... | @@ -29,6 +30,13 @@ public interface ISysUserDepartService extends IService<SysUserDepart> { | ... | @@ -29,6 +30,13 @@ public interface ISysUserDepartService extends IService<SysUserDepart> { |
29 | */ | 30 | */ |
30 | String queryDepartIdsStringOfUserId(String userId); | 31 | String queryDepartIdsStringOfUserId(String userId); |
31 | 32 | ||
33 | |||
34 | /*** | ||
35 | * 根据用户编号查询所属部门 | ||
36 | * @param userId | ||
37 | * @return | ||
38 | */ | ||
39 | List<String> getDepartByUserId(String userId); | ||
32 | /** | 40 | /** |
33 | * 根据指定用户id查询部门id集合 | 41 | * 根据指定用户id查询部门id集合 |
34 | * @param userId | 42 | * @param userId | ... | ... |
... | @@ -17,6 +17,7 @@ import com.skua.modules.system.service.ISysDepartService; | ... | @@ -17,6 +17,7 @@ import com.skua.modules.system.service.ISysDepartService; |
17 | import com.skua.modules.system.util.FindsDepartsChildrenUtil; | 17 | import com.skua.modules.system.util.FindsDepartsChildrenUtil; |
18 | import com.skua.modules.system.vo.DepartTree; | 18 | import com.skua.modules.system.vo.DepartTree; |
19 | import com.skua.modules.system.vo.SysDeptUserVO; | 19 | import com.skua.modules.system.vo.SysDeptUserVO; |
20 | import com.skua.tool.dfs.MapDFS; | ||
20 | import io.netty.util.internal.StringUtil; | 21 | import io.netty.util.internal.StringUtil; |
21 | import org.apache.commons.lang3.StringUtils; | 22 | import org.apache.commons.lang3.StringUtils; |
22 | import org.springframework.beans.factory.annotation.Autowired; | 23 | import org.springframework.beans.factory.annotation.Autowired; |
... | @@ -35,6 +36,30 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart | ... | @@ -35,6 +36,30 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart |
35 | private SysDepartMapper sysDepartMapper; | 36 | private SysDepartMapper sysDepartMapper; |
36 | @Autowired | 37 | @Autowired |
37 | private ISequenceService sequenceService; | 38 | private ISequenceService sequenceService; |
39 | |||
40 | /*** | ||
41 | * 查询子集所有的部门 | ||
42 | * @param departId | ||
43 | * @return | ||
44 | */ | ||
45 | public Set<String> getAllChildrenDepartIds(String departId){ | ||
46 | MapDFS mapDFS = new MapDFS(); | ||
47 | Set<String> departSet = new HashSet<>(); | ||
48 | List<Map<String, Object>> tree = mapDFS.buildTree( this.listMaps(new QueryWrapper<SysDepart>().select("id, parent_id as parentId"))); | ||
49 | LinkedList<LinkedList<Map<String, Object>>> routeList = mapDFS.getRouteList(tree); | ||
50 | for (LinkedList<Map<String, Object>> route: routeList) { | ||
51 | for (int i = 0; i < route.size(); i++) { | ||
52 | if (departId.equals(route.get(i).get("id"))) { | ||
53 | for (int j = i; j < route.size(); j++) { | ||
54 | departSet.add( "'"+ ConvertUtils.getString(route.get(j).get("id")) +"'"); | ||
55 | /*if(departAncestors.length() > 0 ) departAncestors+=","; | ||
56 | departAncestors = departAncestors+ "'"+ConvertUtils.getString(route.get(j).get("id")) +"'";*/ | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | return departSet; | ||
62 | } | ||
38 | /** | 63 | /** |
39 | * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端 | 64 | * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端 |
40 | */ | 65 | */ | ... | ... |
... | @@ -30,6 +30,16 @@ public class SysUserDepartServiceImpl extends ServiceImpl<SysUserDepartMapper, S | ... | @@ -30,6 +30,16 @@ public class SysUserDepartServiceImpl extends ServiceImpl<SysUserDepartMapper, S |
30 | private ISysUserService sysUserService; | 30 | private ISysUserService sysUserService; |
31 | 31 | ||
32 | 32 | ||
33 | /*** | ||
34 | * 根据用户编号查询所属部门 | ||
35 | * @param userId | ||
36 | * @return | ||
37 | */ | ||
38 | public List<String> getDepartByUserId(String userId){ | ||
39 | return this.baseMapper.getDepartByUserId(userId); | ||
40 | } | ||
41 | |||
42 | |||
33 | /** | 43 | /** |
34 | * 根据用户id查询部门信息 | 44 | * 根据用户id查询部门信息 |
35 | */ | 45 | */ |
... | @@ -43,17 +53,17 @@ public class SysUserDepartServiceImpl extends ServiceImpl<SysUserDepartMapper, S | ... | @@ -43,17 +53,17 @@ public class SysUserDepartServiceImpl extends ServiceImpl<SysUserDepartMapper, S |
43 | List<DepartIdModel> depIdModelList = new ArrayList<>(); | 53 | List<DepartIdModel> depIdModelList = new ArrayList<>(); |
44 | List<SysUserDepart> userDepList = this.list(queryUDep); | 54 | List<SysUserDepart> userDepList = this.list(queryUDep); |
45 | if(userDepList != null && userDepList.size() > 0) { | 55 | if(userDepList != null && userDepList.size() > 0) { |
46 | for(SysUserDepart userDepart : userDepList) { | 56 | for(SysUserDepart userDepart : userDepList) { |
47 | depIdList.add(userDepart.getDepId()); | 57 | depIdList.add(userDepart.getDepId()); |
48 | } | ||
49 | queryDep.in(SysDepart::getId, depIdList); | ||
50 | List<SysDepart> depList = sysDepartService.list(queryDep); | ||
51 | if(depList != null || depList.size() > 0) { | ||
52 | for(SysDepart depart : depList) { | ||
53 | depIdModelList.add(new DepartIdModel().convertByUserDepart(depart)); | ||
54 | } | 58 | } |
55 | } | 59 | queryDep.in(SysDepart::getId, depIdList); |
56 | return depIdModelList; | 60 | List<SysDepart> depList = sysDepartService.list(queryDep); |
61 | if(depList != null || depList.size() > 0) { | ||
62 | for(SysDepart depart : depList) { | ||
63 | depIdModelList.add(new DepartIdModel().convertByUserDepart(depart)); | ||
64 | } | ||
65 | } | ||
66 | return depIdModelList; | ||
57 | } | 67 | } |
58 | }catch(Exception e) { | 68 | }catch(Exception e) { |
59 | e.fillInStackTrace(); | 69 | e.fillInStackTrace(); | ... | ... |
-
请 注册 或 登录 后发表评论