kangwei: 领导带班统计,解决:MyBatis-Plus 进行查询并返回空 List 集合
正在显示
13 个修改的文件
包含
197 行增加
和
35 行删除
... | @@ -110,7 +110,9 @@ public class LeaderInspectionRecordController { | ... | @@ -110,7 +110,9 @@ public class LeaderInspectionRecordController { |
110 | @GetMapping(value = "/statistics") | 110 | @GetMapping(value = "/statistics") |
111 | public Result<LeaderInspectionRecordVO> statistics(LeaderInspectionRecordSearchVO leaderInspectionRecord, HttpServletRequest req) { | 111 | public Result<LeaderInspectionRecordVO> statistics(LeaderInspectionRecordSearchVO leaderInspectionRecord, HttpServletRequest req) { |
112 | Result<LeaderInspectionRecordVO> result = new Result<>(); | 112 | Result<LeaderInspectionRecordVO> result = new Result<>(); |
113 | |||
113 | String departIds = null; | 114 | String departIds = null; |
115 | |||
114 | if (StringUtils.isEmpty(leaderInspectionRecord.getDepartId())) { | 116 | if (StringUtils.isEmpty(leaderInspectionRecord.getDepartId())) { |
115 | departIds = BaseContextHandler.getDeparts(); | 117 | departIds = BaseContextHandler.getDeparts(); |
116 | }else{ | 118 | }else{ |
... | @@ -118,33 +120,41 @@ public class LeaderInspectionRecordController { | ... | @@ -118,33 +120,41 @@ public class LeaderInspectionRecordController { |
118 | } | 120 | } |
119 | leaderInspectionRecord.setDepartIds(JSUtils.quoteEach(departIds,",")) ; | 121 | leaderInspectionRecord.setDepartIds(JSUtils.quoteEach(departIds,",")) ; |
120 | LeaderInspectionRecordVO leaderInspectionRecordVO = leaderInspectionRecordService.statisticsNum(leaderInspectionRecord); | 122 | LeaderInspectionRecordVO leaderInspectionRecordVO = leaderInspectionRecordService.statisticsNum(leaderInspectionRecord); |
123 | if(leaderInspectionRecordVO == null){ | ||
124 | leaderInspectionRecordVO = new LeaderInspectionRecordVO("0","0",new ArrayList<>(),new ArrayList<>()); | ||
125 | } | ||
121 | List<LeaderInspectionRecordStatisticsVO> timeDataList = leaderInspectionRecordService.statisticsByTime(leaderInspectionRecord); | 126 | List<LeaderInspectionRecordStatisticsVO> timeDataList = leaderInspectionRecordService.statisticsByTime(leaderInspectionRecord); |
122 | List<LeaderInspectionRecordStatisticsVO> leaderDataList = leaderInspectionRecordService.statisticsByLeader(leaderInspectionRecord); | 127 | List<LeaderInspectionRecordStatisticsVO> leaderDataList = leaderInspectionRecordService.statisticsByLeader(leaderInspectionRecord); |
123 | 128 | ||
124 | List<LeaderInspectionRecordStatisticsVO> monthDataList = null; | 129 | List<LeaderInspectionRecordStatisticsVO> monthDataList = null; |
125 | LeaderInspectionRecordStatisticsVO statisticsVO = null; | 130 | LeaderInspectionRecordStatisticsVO statisticsVO = null; |
126 | List<String> monthsDateList = DateUtil.getMonthsBetween(leaderInspectionRecord.getStartDate(), leaderInspectionRecord.getEndDate(),null); | 131 | if( StringUtils.isEmpty(leaderInspectionRecord.getStartDate()) || StringUtils.isEmpty(leaderInspectionRecord.getEndDate())){ |
127 | if(monthsDateList != null ){ | 132 | List<String> monthsDateList = DateUtil.getMonthsBetween(leaderInspectionRecord.getStartDate(), leaderInspectionRecord.getEndDate(),null); |
128 | monthDataList = new ArrayList<>(monthsDateList.size()); | 133 | if(monthsDateList != null ){ |
129 | for(String time : monthsDateList){ | 134 | monthDataList = new ArrayList<>(monthsDateList.size()); |
130 | statisticsVO = null; | 135 | for(String time : monthsDateList){ |
131 | if(timeDataList != null){ | 136 | statisticsVO = null; |
132 | for(LeaderInspectionRecordStatisticsVO timeDate : timeDataList){ | 137 | if(timeDataList != null){ |
133 | if( time.equals( timeDate.getTime() ) ){ | 138 | for(LeaderInspectionRecordStatisticsVO timeDate : timeDataList){ |
134 | statisticsVO = timeDate; | 139 | if( time.equals( timeDate.getTime() ) ){ |
135 | break; | 140 | statisticsVO = timeDate; |
141 | break; | ||
142 | } | ||
136 | } | 143 | } |
137 | } | 144 | } |
138 | } | 145 | if(statisticsVO != null){ |
139 | if(statisticsVO != null){ | 146 | monthDataList.add( statisticsVO ) ; |
140 | monthDataList.add( statisticsVO ) ; | 147 | }else{ |
141 | }else{ | 148 | monthDataList.add( new LeaderInspectionRecordStatisticsVO(time,"0","0") ); |
142 | monthDataList.add( new LeaderInspectionRecordStatisticsVO(time,"0","0") ); | 149 | } |
143 | } | ||
144 | 150 | ||
151 | } | ||
145 | } | 152 | } |
153 | }else{ | ||
154 | monthDataList = new ArrayList<>(); | ||
146 | } | 155 | } |
147 | 156 | ||
157 | |||
148 | leaderInspectionRecordVO.setLeaderDataList( leaderDataList); | 158 | leaderInspectionRecordVO.setLeaderDataList( leaderDataList); |
149 | leaderInspectionRecordVO.setTimeDataList(monthDataList ); | 159 | leaderInspectionRecordVO.setTimeDataList(monthDataList ); |
150 | result.setSuccess(true); | 160 | result.setSuccess(true); | ... | ... |
... | @@ -4,16 +4,13 @@ import java.util.Date; | ... | @@ -4,16 +4,13 @@ import java.util.Date; |
4 | import com.baomidou.mybatisplus.annotation.IdType; | 4 | import com.baomidou.mybatisplus.annotation.IdType; |
5 | import com.baomidou.mybatisplus.annotation.TableId; | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
6 | import com.baomidou.mybatisplus.annotation.TableName; | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
7 | import com.baomidou.mybatisplus.annotation.TableField; | ||
8 | import com.skua.core.aspect.annotation.Dict; | 7 | import com.skua.core.aspect.annotation.Dict; |
9 | import com.skua.modules.guest.util.DateUtil; | ||
10 | import io.swagger.annotations.ApiModel; | 8 | import io.swagger.annotations.ApiModel; |
11 | import io.swagger.annotations.ApiModelProperty; | 9 | import io.swagger.annotations.ApiModelProperty; |
12 | import lombok.Data; | 10 | import lombok.Data; |
13 | import lombok.EqualsAndHashCode; | 11 | import lombok.EqualsAndHashCode; |
14 | import lombok.experimental.Accessors; | 12 | import lombok.experimental.Accessors; |
15 | import com.fasterxml.jackson.annotation.JsonFormat; | 13 | import com.fasterxml.jackson.annotation.JsonFormat; |
16 | import org.apache.commons.lang3.StringUtils; | ||
17 | import org.springframework.format.annotation.DateTimeFormat; | 14 | import org.springframework.format.annotation.DateTimeFormat; |
18 | import org.jeecgframework.poi.excel.annotation.Excel; | 15 | import org.jeecgframework.poi.excel.annotation.Excel; |
19 | 16 | ... | ... |
... | @@ -33,7 +33,7 @@ public class AjhWasteMonthReportServiceImpl extends ServiceImpl<AjhWasteMonthRep | ... | @@ -33,7 +33,7 @@ public class AjhWasteMonthReportServiceImpl extends ServiceImpl<AjhWasteMonthRep |
33 | List<AjhWasteMonthReport> list = new ArrayList<>(); | 33 | List<AjhWasteMonthReport> list = new ArrayList<>(); |
34 | String departId = null; | 34 | String departId = null; |
35 | if (StringUtils.isBlank(ajhWasteMonthReport.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { | 35 | if (StringUtils.isBlank(ajhWasteMonthReport.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { |
36 | departId = departService.getChildDepartId(BaseContextHandler.getDeparts()); | 36 | departId = BaseContextHandler.getDeparts(); |
37 | }else{ | 37 | }else{ |
38 | departId = departService.getChildDepartId(ajhWasteMonthReport.getDepartId()); | 38 | departId = departService.getChildDepartId(ajhWasteMonthReport.getDepartId()); |
39 | } | 39 | } | ... | ... |
... | @@ -32,7 +32,7 @@ public class AjhWasteYearReportServiceImpl extends ServiceImpl<AjhWasteYearRepor | ... | @@ -32,7 +32,7 @@ public class AjhWasteYearReportServiceImpl extends ServiceImpl<AjhWasteYearRepor |
32 | List<AjhWasteYearReport> list = new ArrayList<>(); | 32 | List<AjhWasteYearReport> list = new ArrayList<>(); |
33 | String departId = null; | 33 | String departId = null; |
34 | if (StringUtils.isBlank(ajhWasteYearReport.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { | 34 | if (StringUtils.isBlank(ajhWasteYearReport.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { |
35 | departId = departService.getChildDepartId(BaseContextHandler.getDeparts()); | 35 | departId = BaseContextHandler.getDeparts(); |
36 | }else{ | 36 | }else{ |
37 | departId = departService.getChildDepartId(ajhWasteYearReport.getDepartId()); | 37 | departId = departService.getChildDepartId(ajhWasteYearReport.getDepartId()); |
38 | } | 38 | } | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/ajh/service/impl/LeaderInspectionRecordServiceImpl.java
... | @@ -24,10 +24,10 @@ public class LeaderInspectionRecordServiceImpl extends ServiceImpl<LeaderInspect | ... | @@ -24,10 +24,10 @@ public class LeaderInspectionRecordServiceImpl extends ServiceImpl<LeaderInspect |
24 | */ | 24 | */ |
25 | public LeaderInspectionRecordVO statisticsNum(LeaderInspectionRecordSearchVO leaderInspectionRecord){ | 25 | public LeaderInspectionRecordVO statisticsNum(LeaderInspectionRecordSearchVO leaderInspectionRecord){ |
26 | List<LeaderInspectionRecordVO> dataList = this.baseMapper.statisticsNum( leaderInspectionRecord) ; | 26 | List<LeaderInspectionRecordVO> dataList = this.baseMapper.statisticsNum( leaderInspectionRecord) ; |
27 | if(dataList != null ){ | 27 | if(dataList != null && !dataList.isEmpty()){ |
28 | return dataList.get(0); | 28 | return dataList.get(0); |
29 | } | 29 | } |
30 | return new LeaderInspectionRecordVO("0","0",new ArrayList<>(),new ArrayList<>()); | 30 | return null; |
31 | } | 31 | } |
32 | /** | 32 | /** |
33 | * 根据时间统计 | 33 | * 根据时间统计 | ... | ... |
... | @@ -83,7 +83,7 @@ public class MaterialInfoController { | ... | @@ -83,7 +83,7 @@ public class MaterialInfoController { |
83 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { | 83 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
84 | *//* String departIds = null; | 84 | *//* String departIds = null; |
85 | if (StringUtils.isBlank(materialInfo.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { | 85 | if (StringUtils.isBlank(materialInfo.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { |
86 | departIds = departService.getChildDepartId(BaseContextHandler.getDeparts()); | 86 | departIds =BaseContextHandler.getDeparts() |
87 | }else{ | 87 | }else{ |
88 | departIds = departService.getChildDepartId(materialInfo.getDepartId()); | 88 | departIds = departService.getChildDepartId(materialInfo.getDepartId()); |
89 | } | 89 | } |
... | @@ -160,7 +160,7 @@ public class MaterialInfoController { | ... | @@ -160,7 +160,7 @@ public class MaterialInfoController { |
160 | QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper(); | 160 | QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper(); |
161 | String departIds = null; | 161 | String departIds = null; |
162 | if (StringUtils.isNotEmpty(materialInfo.getDepartId())) { | 162 | if (StringUtils.isNotEmpty(materialInfo.getDepartId())) { |
163 | departIds = departService.getChildDepartId(BaseContextHandler.getDeparts()); | 163 | departIds = departService.getChildDepartId(materialInfo.getDepartId()); |
164 | //departIds = BaseContextHandler.getDeparts(); | 164 | //departIds = BaseContextHandler.getDeparts(); |
165 | queryWrapper.in("depart_id", JSUtils.quoteEach(departIds,",")); | 165 | queryWrapper.in("depart_id", JSUtils.quoteEach(departIds,",")); |
166 | } | 166 | } |
... | @@ -501,8 +501,8 @@ public class MaterialInfoController { | ... | @@ -501,8 +501,8 @@ public class MaterialInfoController { |
501 | @GetMapping(value = "/flowStatistics") | 501 | @GetMapping(value = "/flowStatistics") |
502 | public Result<List<Map<String, Object>>> flowStatistics(String departId,String startTime,String endTime,String facInformationtype,String status) { | 502 | public Result<List<Map<String, Object>>> flowStatistics(String departId,String startTime,String endTime,String facInformationtype,String status) { |
503 | Result<List<Map<String, Object>>> result = new Result<>(); | 503 | Result<List<Map<String, Object>>> result = new Result<>(); |
504 | if (StringUtils.isBlank(departId)&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { | 504 | if (StringUtils.isBlank(departId)) { |
505 | departId = departService.getChildDepartId(BaseContextHandler.getDeparts()); | 505 | departId = BaseContextHandler.getDeparts(); |
506 | }else{ | 506 | }else{ |
507 | departId = departService.getChildDepartId(departId); | 507 | departId = departService.getChildDepartId(departId); |
508 | } | 508 | } | ... | ... |
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; |
... | @@ -12,16 +10,18 @@ import com.skua.core.api.vo.Result; | ... | @@ -12,16 +10,18 @@ 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; | 11 | import com.skua.core.context.BaseContextHandler; |
14 | import com.skua.core.query.QueryGenerator; | 12 | import com.skua.core.query.QueryGenerator; |
15 | import com.skua.core.service.ISequenceService; | ||
16 | import com.skua.core.util.ConvertUtils; | 13 | import com.skua.core.util.ConvertUtils; |
17 | import com.skua.modules.safe.entity.SafetyStandardOptimize; | 14 | import com.skua.modules.safe.entity.SafetyStandardOptimize; |
18 | import com.skua.modules.safe.service.ISafetyStandardOptimizeService; | 15 | import com.skua.modules.safe.service.ISafetyStandardOptimizeService; |
19 | import java.util.Date; | ||
20 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 16 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
21 | import com.baomidou.mybatisplus.core.metadata.IPage; | 17 | import com.baomidou.mybatisplus.core.metadata.IPage; |
22 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 18 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
19 | import com.skua.modules.safe.vo.StatisticsSearchVO; | ||
20 | import com.skua.modules.system.service.ISysDepartService; | ||
21 | import com.skua.tool.util.JSUtils; | ||
23 | import lombok.extern.slf4j.Slf4j; | 22 | import lombok.extern.slf4j.Slf4j; |
24 | 23 | ||
24 | import org.apache.commons.lang3.StringUtils; | ||
25 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 25 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
26 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 26 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
27 | import org.jeecgframework.poi.excel.entity.ExportParams; | 27 | import org.jeecgframework.poi.excel.entity.ExportParams; |
... | @@ -52,6 +52,9 @@ public class SafetyStandardOptimizeController { | ... | @@ -52,6 +52,9 @@ public class SafetyStandardOptimizeController { |
52 | @Autowired | 52 | @Autowired |
53 | private ISafetyStandardOptimizeService safetyStandardOptimizeService; | 53 | private ISafetyStandardOptimizeService safetyStandardOptimizeService; |
54 | 54 | ||
55 | @Autowired | ||
56 | private ISysDepartService departService; | ||
57 | |||
55 | /** | 58 | /** |
56 | * <pre> | 59 | * <pre> |
57 | * 分页列表查询 | 60 | * 分页列表查询 |
... | @@ -64,9 +67,8 @@ public class SafetyStandardOptimizeController { | ... | @@ -64,9 +67,8 @@ public class SafetyStandardOptimizeController { |
64 | * @author 开发者姓名, 开发时间 | 67 | * @author 开发者姓名, 开发时间 |
65 | * @Description: TODO(这里描述这个方法的需求变更情况) | 68 | * @Description: TODO(这里描述这个方法的需求变更情况) |
66 | */ | 69 | */ |
67 | |||
68 | @AutoLog(value = "安全标准化优化-分页列表查询") | 70 | @AutoLog(value = "安全标准化优化-分页列表查询") |
69 | @ApiOperation(value="安全标准化优化-分页列表查询", notes="安全标准化优化-分页列表查询") | 71 | @ApiOperation(value="安全标准化优化-分页列表查询", notes="安全标准化优化-分页列表查询(时间参数:startDate,endDate)") |
70 | @GetMapping(value = "/list") | 72 | @GetMapping(value = "/list") |
71 | public Result<IPage<SafetyStandardOptimize>> queryPageList(SafetyStandardOptimize safetyStandardOptimize, | 73 | public Result<IPage<SafetyStandardOptimize>> queryPageList(SafetyStandardOptimize safetyStandardOptimize, |
72 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | 74 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
... | @@ -75,12 +77,75 @@ public class SafetyStandardOptimizeController { | ... | @@ -75,12 +77,75 @@ public class SafetyStandardOptimizeController { |
75 | Result<IPage<SafetyStandardOptimize>> result = new Result<IPage<SafetyStandardOptimize>>(); | 77 | Result<IPage<SafetyStandardOptimize>> result = new Result<IPage<SafetyStandardOptimize>>(); |
76 | QueryWrapper<SafetyStandardOptimize> queryWrapper = QueryGenerator.initQueryWrapper(safetyStandardOptimize, req.getParameterMap()); | 78 | QueryWrapper<SafetyStandardOptimize> queryWrapper = QueryGenerator.initQueryWrapper(safetyStandardOptimize, req.getParameterMap()); |
77 | Page<SafetyStandardOptimize> page = new Page<SafetyStandardOptimize>(pageNo, pageSize); | 79 | Page<SafetyStandardOptimize> page = new Page<SafetyStandardOptimize>(pageNo, pageSize); |
80 | |||
81 | String startDate = req.getParameter("startDate"); | ||
82 | if(StringUtils.isNotEmpty(startDate)){ | ||
83 | queryWrapper.ge("create_time",startDate+" 00:00:00"); | ||
84 | } | ||
85 | String endDate = req.getParameter("endDate"); | ||
86 | if(StringUtils.isNotEmpty(startDate)){ | ||
87 | queryWrapper.le("create_time",endDate+" 23:59:59"); | ||
88 | } | ||
89 | queryWrapper.orderByDesc("create_time"); | ||
78 | IPage<SafetyStandardOptimize> pageList = safetyStandardOptimizeService.page(page, queryWrapper); | 90 | IPage<SafetyStandardOptimize> pageList = safetyStandardOptimizeService.page(page, queryWrapper); |
79 | result.setSuccess(true); | 91 | result.setSuccess(true); |
80 | result.setResult(pageList); | 92 | result.setResult(pageList); |
81 | return result; | 93 | return result; |
82 | } | 94 | } |
83 | 95 | ||
96 | |||
97 | // 统计、统计详情 statistics | ||
98 | |||
99 | @AutoLog(value = "安全标准化优化-统计数量") | ||
100 | @ApiOperation(value="安全标准化优化-统计数量", notes="安全标准化优化-统计数量") | ||
101 | @GetMapping(value = "/statisticsCount") | ||
102 | public Result<Map<String,String>> statisticsCount( StatisticsSearchVO statisticsSearchVO) { | ||
103 | Result<Map<String,String>> result = new Result<>(); | ||
104 | |||
105 | Map<String,String> dataMap = new HashMap<>(); | ||
106 | String departIds = null; | ||
107 | if(StringUtils.isNotEmpty(statisticsSearchVO.getDepartId())){ | ||
108 | departIds = departService.getChildDepartId(statisticsSearchVO.getDepartId()); | ||
109 | }else{ | ||
110 | departIds = BaseContextHandler.getDeparts(); | ||
111 | } | ||
112 | statisticsSearchVO.setDepartIds( JSUtils.quoteEach(departIds,",")); | ||
113 | List<StatisticsSearchVO> dataList = safetyStandardOptimizeService.statistics(statisticsSearchVO); | ||
114 | Integer wantNum = 0 ; | ||
115 | String finishNum = "0"; | ||
116 | String finishNumExpression = "0"; | ||
117 | if(dataList != null && !dataList.isEmpty()) { | ||
118 | wantNum = dataList.size() * 4; | ||
119 | for(StatisticsSearchVO searchVO : dataList) { | ||
120 | finishNumExpression += "+" + searchVO.getFinishNum(); | ||
121 | } | ||
122 | finishNum = JSUtils.executeExpression(finishNumExpression,"0"); | ||
123 | } | ||
124 | dataMap.put("wantNum",wantNum+""); | ||
125 | dataMap.put("finishNum",finishNum); | ||
126 | |||
127 | result.setSuccess(true); | ||
128 | result.setResult(dataMap); | ||
129 | return result; | ||
130 | } | ||
131 | |||
132 | @AutoLog(value = "安全标准化优化-统计列表") | ||
133 | @ApiOperation(value="安全标准化优化-统计列表", notes="安全标准化优化-统计列表") | ||
134 | @GetMapping(value = "/statisticsList") | ||
135 | public Result<List<StatisticsSearchVO>> statisticsList( StatisticsSearchVO statisticsSearchVO) { | ||
136 | Result<List<StatisticsSearchVO>> result = new Result<>(); | ||
137 | String departIds = null; | ||
138 | if(StringUtils.isNotEmpty(statisticsSearchVO.getDepartId())){ | ||
139 | departIds = departService.getChildDepartId(statisticsSearchVO.getDepartId()); | ||
140 | }else{ | ||
141 | departIds = BaseContextHandler.getDeparts(); | ||
142 | } | ||
143 | statisticsSearchVO.setDepartIds( JSUtils.quoteEach(departIds,",")); | ||
144 | List<StatisticsSearchVO> dataList = safetyStandardOptimizeService.statistics(statisticsSearchVO); | ||
145 | result.setSuccess(true); | ||
146 | result.setResult(dataList); | ||
147 | return result; | ||
148 | } | ||
84 | /** | 149 | /** |
85 | * <pre> | 150 | * <pre> |
86 | * 添加 | 151 | * 添加 | ... | ... |
... | @@ -59,6 +59,12 @@ public class SafetyStandardOptimize { | ... | @@ -59,6 +59,12 @@ public class SafetyStandardOptimize { |
59 | @Excel(name = "文件路径", width = 15) | 59 | @Excel(name = "文件路径", width = 15) |
60 | @ApiModelProperty(value = "文件路径") | 60 | @ApiModelProperty(value = "文件路径") |
61 | private String filePath; | 61 | private String filePath; |
62 | |||
63 | |||
64 | @Excel(name = "自评分数", width = 15) | ||
65 | @ApiModelProperty(value = "自评分数") | ||
66 | private String selfScore; | ||
67 | |||
62 | /**备注*/ | 68 | /**备注*/ |
63 | @Excel(name = "备注", width = 15) | 69 | @Excel(name = "备注", width = 15) |
64 | @ApiModelProperty(value = "备注") | 70 | @ApiModelProperty(value = "备注") | ... | ... |
1 | package com.skua.modules.safe.mapper; | 1 | package com.skua.modules.safe.mapper; |
2 | 2 | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | import java.util.Map; | ||
4 | 5 | ||
6 | import com.skua.modules.safe.vo.StatisticsSearchVO; | ||
5 | import org.apache.ibatis.annotations.Param; | 7 | import org.apache.ibatis.annotations.Param; |
6 | import com.skua.modules.safe.entity.SafetyStandardOptimize; | 8 | import com.skua.modules.safe.entity.SafetyStandardOptimize; |
7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 9 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
... | @@ -11,4 +13,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ... | @@ -11,4 +13,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
11 | */ | 13 | */ |
12 | public interface SafetyStandardOptimizeMapper extends BaseMapper<SafetyStandardOptimize> { | 14 | public interface SafetyStandardOptimizeMapper extends BaseMapper<SafetyStandardOptimize> { |
13 | 15 | ||
16 | /*** | ||
17 | * 统计 | ||
18 | * @return | ||
19 | */ | ||
20 | List<StatisticsSearchVO> statistics(StatisticsSearchVO statisticsSearchVO); | ||
14 | } | 21 | } | ... | ... |
... | @@ -2,4 +2,16 @@ | ... | @@ -2,4 +2,16 @@ |
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.SafetyStandardOptimizeMapper"> | 3 | <mapper namespace="com.skua.modules.safe.mapper.SafetyStandardOptimizeMapper"> |
4 | 4 | ||
5 | </mapper> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
5 | <select id="statistics" resultType="com.skua.modules.safe.vo.StatisticsSearchVO" > | ||
6 | select d.id depart_id, d.depart_name,#{wantNum} 'wantNum', ifnull(aaa.report_num , 0 )finishNum | ||
7 | from sys_depart d | ||
8 | left join (select so.depart_id , count(so.id) report_num from safety_standard_optimize so | ||
9 | where DATE_FORMAT( so.create_time, '%Y-%m-%d' ) >= #{startDate} AND DATE_FORMAT( so.create_time, '%Y-%m-%d' ) <= #{endDate} | ||
10 | GROUP BY so.depart_id ) aaa on aaa.depart_id = d.id | ||
11 | where d.id in(${departIds}) | ||
12 | <if test="departName != null "> | ||
13 | and d.depart_name like CONCAT('%',#{departName},'%') | ||
14 | </if> | ||
15 | and d.depart_type = 1 | ||
16 | </select> | ||
17 | </mapper> | ... | ... |
... | @@ -2,10 +2,19 @@ package com.skua.modules.safe.service; | ... | @@ -2,10 +2,19 @@ package com.skua.modules.safe.service; |
2 | 2 | ||
3 | import com.skua.modules.safe.entity.SafetyStandardOptimize; | 3 | import com.skua.modules.safe.entity.SafetyStandardOptimize; |
4 | import com.baomidou.mybatisplus.extension.service.IService; | 4 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | import com.skua.modules.safe.vo.StatisticsSearchVO; | ||
6 | |||
7 | import java.util.List; | ||
8 | import java.util.Map; | ||
5 | 9 | ||
6 | /** | 10 | /** |
7 | * 安全标准化优化 | 11 | * 安全标准化优化 |
8 | */ | 12 | */ |
9 | public interface ISafetyStandardOptimizeService extends IService<SafetyStandardOptimize> { | 13 | public interface ISafetyStandardOptimizeService extends IService<SafetyStandardOptimize> { |
10 | 14 | ||
15 | /*** | ||
16 | * 统计 | ||
17 | * @return | ||
18 | */ | ||
19 | List<StatisticsSearchVO > statistics(StatisticsSearchVO statisticsSearchVO); | ||
11 | } | 20 | } | ... | ... |
... | @@ -3,14 +3,36 @@ package com.skua.modules.safe.service.impl; | ... | @@ -3,14 +3,36 @@ package com.skua.modules.safe.service.impl; |
3 | import com.skua.modules.safe.entity.SafetyStandardOptimize; | 3 | import com.skua.modules.safe.entity.SafetyStandardOptimize; |
4 | import com.skua.modules.safe.mapper.SafetyStandardOptimizeMapper; | 4 | import com.skua.modules.safe.mapper.SafetyStandardOptimizeMapper; |
5 | import com.skua.modules.safe.service.ISafetyStandardOptimizeService; | 5 | import com.skua.modules.safe.service.ISafetyStandardOptimizeService; |
6 | import com.skua.modules.safe.vo.StatisticsSearchVO; | ||
7 | import com.skua.tool.util.DateUtils; | ||
6 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
7 | 9 | ||
8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
9 | 11 | ||
12 | import java.util.List; | ||
13 | import java.util.Map; | ||
14 | |||
10 | /** | 15 | /** |
11 | * 安全标准优化 | 16 | * 安全标准优化 |
12 | */ | 17 | */ |
13 | @Service | 18 | @Service |
14 | public class SafetyStandardOptimizeServiceImpl extends ServiceImpl<SafetyStandardOptimizeMapper, SafetyStandardOptimize> implements ISafetyStandardOptimizeService { | 19 | public class SafetyStandardOptimizeServiceImpl extends ServiceImpl<SafetyStandardOptimizeMapper, SafetyStandardOptimize> implements ISafetyStandardOptimizeService { |
15 | 20 | ||
21 | /*** | ||
22 | * 统计 | ||
23 | * @return | ||
24 | */ | ||
25 | public List<StatisticsSearchVO> statistics(StatisticsSearchVO statisticsSearchVO){ | ||
26 | //计算两个时间相间的季度 = 应填写数量 | ||
27 | List<String> monthList = DateUtils.getMonthsBetween(statisticsSearchVO.getStartDate(), statisticsSearchVO.getEndDate()); | ||
28 | double d = monthList.size() / 3d; | ||
29 | Integer wantNum = null; | ||
30 | if(d == (int)d){ | ||
31 | wantNum = (int)d; | ||
32 | }else{ | ||
33 | wantNum = (int)d +1; | ||
34 | } | ||
35 | statisticsSearchVO.setWantNum(wantNum ); | ||
36 | return this.baseMapper.statistics(statisticsSearchVO); | ||
37 | } | ||
16 | } | 38 | } | ... | ... |
1 | package com.skua.modules.safe.vo; | ||
2 | |||
3 | /** | ||
4 | * @auther kangwei | ||
5 | * @create 2024-12-26-12:05 | ||
6 | */ | ||
7 | |||
8 | import io.swagger.annotations.ApiModel; | ||
9 | import io.swagger.annotations.ApiModelProperty; | ||
10 | import lombok.Data; | ||
11 | |||
12 | /** | ||
13 | * 统计查询对象对象 | ||
14 | */ | ||
15 | @Data | ||
16 | @ApiModel(value="StatisticsSearchVO 统计查询对象对象", description="统计查询对象对象") | ||
17 | public class StatisticsSearchVO { | ||
18 | @ApiModelProperty(value = "部门编号") | ||
19 | private String departId; | ||
20 | @ApiModelProperty(value = "部门编号集合") | ||
21 | private String departIds; | ||
22 | @ApiModelProperty(value = "部门名称") | ||
23 | private String departName; | ||
24 | |||
25 | @ApiModelProperty(value = "开始时间") | ||
26 | private String startDate; | ||
27 | @ApiModelProperty(value = "结束时间") | ||
28 | private String endDate; | ||
29 | |||
30 | @ApiModelProperty(value = "应填写数量") | ||
31 | private Integer wantNum; | ||
32 | @ApiModelProperty(value = "实际填写数量") | ||
33 | private Integer finishNum; | ||
34 | } |
-
请 注册 或 登录 后发表评论