11da9057 康伟

kangwei:年度经营方案配置、

          年度经营方案数据录入
          设备分析bug修改、添加权限过滤
          工作进度添加权限过滤
1 个父辈 5b7b75e4
...@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
18 import com.baomidou.mybatisplus.core.metadata.IPage; 18 import com.baomidou.mybatisplus.core.metadata.IPage;
19 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 19 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
20 import com.skua.modules.common.vo.TreeNodeVO; 20 import com.skua.modules.common.vo.TreeNodeVO;
21 import com.skua.test.AjhPlanScheduleConfigXls;
21 import com.skua.tool.util.TreeBuilder; 22 import com.skua.tool.util.TreeBuilder;
22 import lombok.extern.slf4j.Slf4j; 23 import lombok.extern.slf4j.Slf4j;
23 24
...@@ -264,6 +265,25 @@ public class AjhPlanScheduleConfigController { ...@@ -264,6 +265,25 @@ public class AjhPlanScheduleConfigController {
264 } 265 }
265 266
266 /** 267 /**
268 * 导出配置模版
269 * @param request
270 * @param response
271 * @return
272 */
273 @RequestMapping(value = "/exportXlsTemplate")
274 public ModelAndView exportXlsTemplate(HttpServletRequest request, HttpServletResponse response) {
275 // Step.1 组装查询条件
276 //Step.2 AutoPoi 导出Excel
277 ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
278 List<AjhPlanScheduleConfigXls> pageList = new ArrayList<>();
279 //导出文件名称
280 mv.addObject(NormalExcelConstants.FILE_NAME, "经营方案计划表列表");
281 mv.addObject(NormalExcelConstants.CLASS, AjhPlanScheduleConfigXls.class);
282 mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("经营方案计划表列表数据", "", ""));
283 mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
284 return mv;
285 }
286 /**
267 * <pre> 287 * <pre>
268 * 通过excel导入数据 288 * 通过excel导入数据
269 * </pre> 289 * </pre>
...@@ -277,6 +297,8 @@ public class AjhPlanScheduleConfigController { ...@@ -277,6 +297,8 @@ public class AjhPlanScheduleConfigController {
277 public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { 297 public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
278 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; 298 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
279 Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); 299 Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
300 String factoryId = request.getParameter("departId");
301 String year = request.getParameter("year");
280 for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { 302 for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
281 MultipartFile file = entity.getValue();// 获取上传文件对象 303 MultipartFile file = entity.getValue();// 获取上传文件对象
282 ImportParams params = new ImportParams(); 304 ImportParams params = new ImportParams();
...@@ -284,8 +306,8 @@ public class AjhPlanScheduleConfigController { ...@@ -284,8 +306,8 @@ public class AjhPlanScheduleConfigController {
284 params.setHeadRows(1); 306 params.setHeadRows(1);
285 params.setNeedSave(true); 307 params.setNeedSave(true);
286 try { 308 try {
287 List<AjhPlanScheduleConfig> listAjhPlanScheduleConfigs = ExcelImportUtil.importExcel(file.getInputStream(), AjhPlanScheduleConfig.class, params); 309 List<AjhPlanScheduleConfigXls> listAjhPlanScheduleConfigs = ExcelImportUtil.importExcel(file.getInputStream(), AjhPlanScheduleConfigXls.class, params);
288 ajhPlanScheduleConfigService.saveBatch(listAjhPlanScheduleConfigs); 310 ajhPlanScheduleConfigService.importExcel(listAjhPlanScheduleConfigs,factoryId,year);
289 return Result.ok("文件导入成功!数据行数:" + listAjhPlanScheduleConfigs.size()); 311 return Result.ok("文件导入成功!数据行数:" + listAjhPlanScheduleConfigs.size());
290 } catch (Exception e) { 312 } catch (Exception e) {
291 log.error(e.getMessage(),e); 313 log.error(e.getMessage(),e);
......
...@@ -33,6 +33,9 @@ public class AjhPlanScheduleConfig { ...@@ -33,6 +33,9 @@ public class AjhPlanScheduleConfig {
33 @Excel(name = "所属厂站", width = 15) 33 @Excel(name = "所属厂站", width = 15)
34 @ApiModelProperty(value = "所属厂站") 34 @ApiModelProperty(value = "所属厂站")
35 private String factoryId; 35 private String factoryId;
36 @ApiModelProperty(value = "年份")
37 private String years;
38
36 /**上级编号*/ 39 /**上级编号*/
37 @Excel(name = "上级编号", width = 15) 40 @Excel(name = "上级编号", width = 15)
38 @ApiModelProperty(value = "上级编号") 41 @ApiModelProperty(value = "上级编号")
...@@ -82,4 +85,23 @@ public class AjhPlanScheduleConfig { ...@@ -82,4 +85,23 @@ public class AjhPlanScheduleConfig {
82 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 85 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
83 @ApiModelProperty(value = "修改时间") 86 @ApiModelProperty(value = "修改时间")
84 private Date updateTime; 87 private Date updateTime;
88
89 public AjhPlanScheduleConfig(){
90
91 }
92
93 public AjhPlanScheduleConfig( String factoryId,String years, String configName) {
94 this.years = years;
95 this.factoryId = factoryId;
96 this.configName = configName;
97 }
98
99 public AjhPlanScheduleConfig(String factoryId, String year, String parentId, String configName, String completeTime, String responsibler) {
100 this.factoryId = factoryId;
101 this.years = years;
102 this.parentId = parentId;
103 this.configName = configName;
104 this.completeTime = completeTime;
105 this.responsibler = responsibler;
106 }
85 } 107 }
......
...@@ -40,6 +40,14 @@ public class AjhPlanScheduleData { ...@@ -40,6 +40,14 @@ public class AjhPlanScheduleData {
40 private String configLevel2; 40 private String configLevel2;
41 @ApiModelProperty(value = "三级指标编号") 41 @ApiModelProperty(value = "三级指标编号")
42 private String configLevel3; 42 private String configLevel3;
43 /**完成时间*/
44 @Excel(name = "完成时间", width = 15)
45 @ApiModelProperty(value = "完成时间")
46 private String completeTime;
47 /**负责人*/
48 @Excel(name = "负责人", width = 15)
49 @ApiModelProperty(value = "负责人")
50 private String responsibler;
43 /**序时进度*/ 51 /**序时进度*/
44 @Excel(name = "序时进度", width = 15) 52 @Excel(name = "序时进度", width = 15)
45 @ApiModelProperty(value = "序时进度") 53 @ApiModelProperty(value = "序时进度")
......
...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 import com.skua.modules.ajh.entity.AjhPlanScheduleConfig; 4 import com.skua.modules.ajh.entity.AjhPlanScheduleConfig;
5 import com.baomidou.mybatisplus.extension.service.IService; 5 import com.baomidou.mybatisplus.extension.service.IService;
6 import com.skua.modules.common.vo.TreeNodeVO; 6 import com.skua.modules.common.vo.TreeNodeVO;
7 import com.skua.test.AjhPlanScheduleConfigXls;
8
7 import java.util.List; 9 import java.util.List;
8 10
9 11
...@@ -11,12 +13,16 @@ import java.util.List; ...@@ -11,12 +13,16 @@ import java.util.List;
11 * 经营方案计划表 13 * 经营方案计划表
12 */ 14 */
13 public interface IAjhPlanScheduleConfigService extends IService<AjhPlanScheduleConfig> { 15 public interface IAjhPlanScheduleConfigService extends IService<AjhPlanScheduleConfig> {
14
15
16 /*** 16 /***
17 * 列表查询 17 * 列表查询
18 * @param factoryId 18 * @param factoryId
19 * @return 19 * @return
20 */ 20 */
21 List<TreeNodeVO> queryTreeList(String factoryId); 21 List<TreeNodeVO> queryTreeList(String factoryId);
22
23 /**
24 * 导入excel文件
25 * @param listAjhPlanScheduleConfigs
26 */
27 void importExcel(List<AjhPlanScheduleConfigXls> listAjhPlanScheduleConfigs,String factoryId,String years);
22 } 28 }
......
...@@ -5,13 +5,18 @@ import com.skua.modules.ajh.entity.AjhPlanScheduleConfig; ...@@ -5,13 +5,18 @@ import com.skua.modules.ajh.entity.AjhPlanScheduleConfig;
5 import com.skua.modules.ajh.mapper.AjhPlanScheduleConfigMapper; 5 import com.skua.modules.ajh.mapper.AjhPlanScheduleConfigMapper;
6 import com.skua.modules.ajh.service.IAjhPlanScheduleConfigService; 6 import com.skua.modules.ajh.service.IAjhPlanScheduleConfigService;
7 import com.skua.modules.common.vo.TreeNodeVO; 7 import com.skua.modules.common.vo.TreeNodeVO;
8 import com.skua.test.AjhPlanScheduleConfigXls;
8 import com.skua.tool.util.TreeBuilder; 9 import com.skua.tool.util.TreeBuilder;
10 import com.skua.tool.util.UniqIdUtils;
9 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
10 12
11 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 13 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
14 import org.springframework.transaction.annotation.Transactional;
12 15
13 import java.util.ArrayList; 16 import java.util.ArrayList;
17 import java.util.HashMap;
14 import java.util.List; 18 import java.util.List;
19 import java.util.Map;
15 20
16 /** 21 /**
17 * 经营方案计划表 22 * 经营方案计划表
...@@ -38,5 +43,38 @@ public class AjhPlanScheduleConfigServiceImpl extends ServiceImpl<AjhPlanSchedul ...@@ -38,5 +43,38 @@ public class AjhPlanScheduleConfigServiceImpl extends ServiceImpl<AjhPlanSchedul
38 } 43 }
39 return treeList; 44 return treeList;
40 } 45 }
46 /**
47 * 导入excel文件
48 * @param listAjhPlanScheduleConfigs
49 */
50 @Transactional
51 public void importExcel(List<AjhPlanScheduleConfigXls> listAjhPlanScheduleConfigs,String factoryId,String year){
52 Map<String,List<AjhPlanScheduleConfigXls>> dataMap = new HashMap<>();
53 List<AjhPlanScheduleConfigXls> confiList = null;
54 for(AjhPlanScheduleConfigXls scheduleConfigXls :listAjhPlanScheduleConfigs){
55 confiList = dataMap.get(scheduleConfigXls.getWorkName());
56 if(confiList != null && !confiList.isEmpty()){
57 confiList.add(scheduleConfigXls);
58 }else{
59 confiList = new ArrayList<>();
60 confiList.add( scheduleConfigXls );
61 dataMap.put(scheduleConfigXls.getWorkName(),confiList);
62 }
63 }
64 AjhPlanScheduleConfig planScheduleConfig = null;
65 // 使用For-Each迭代entries,通过Map.entrySet遍历key和value
66 for (Map.Entry<String, List<AjhPlanScheduleConfigXls>> entry : dataMap.entrySet()) {
67 //System.out.println("key = " + entry.getKey() + ", value = " + entry.getValue());
68 //新增父类
69 //String configId = UniqIdUtils.getInstance().getUniqID();
70 planScheduleConfig = new AjhPlanScheduleConfig( factoryId ,year,entry.getKey());
71 this.baseMapper.insert(planScheduleConfig);
72 //新增子类
73 for( AjhPlanScheduleConfigXls planScheduleConfigXls : entry.getValue()){
74 this.baseMapper.insert(new AjhPlanScheduleConfig( factoryId,year ,planScheduleConfig.getParentId(),planScheduleConfig.getConfigName(),planScheduleConfig.getCompleteTime(),planScheduleConfig.getResponsibler()));
75 }
76 }
77 }
78
41 79
42 } 80 }
......
...@@ -386,7 +386,7 @@ public class ErpSettlementController { ...@@ -386,7 +386,7 @@ public class ErpSettlementController {
386 //导出文件名称 386 //导出文件名称
387 mv.addObject(NormalExcelConstants.FILE_NAME, "药剂结算单详情列表"); 387 mv.addObject(NormalExcelConstants.FILE_NAME, "药剂结算单详情列表");
388 mv.addObject(NormalExcelConstants.CLASS, ErpSettlement.class); 388 mv.addObject(NormalExcelConstants.CLASS, ErpSettlement.class);
389 mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("药剂结算单详情列表数据", "导出人:Jeecg", "导出信息")); 389 mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("药剂结算单详情列表数据", "", "导出信息"));
390 mv.addObject(NormalExcelConstants.DATA_LIST, pageList); 390 mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
391 return mv; 391 return mv;
392 } 392 }
......
...@@ -97,8 +97,8 @@ public class SafetyOffenceRecord { ...@@ -97,8 +97,8 @@ public class SafetyOffenceRecord {
97 @ApiModelProperty(value = "处理时间") 97 @ApiModelProperty(value = "处理时间")
98 private String handleTime; 98 private String handleTime;
99 /**处理状态【1 已处理 2 暂不处理】*/ 99 /**处理状态【1 已处理 2 暂不处理】*/
100 @Excel(name = "处理状态【1 已处理 2 暂不处理】", width = 15) 100 @Excel(name = "处理状态【1 认定违章、 2 不认定违章】", width = 15)
101 @ApiModelProperty(value = "处理状态【1 已处理 2 暂不处理】") 101 @ApiModelProperty(value = "处理状态【1 认定违章、 2 不认定违章】")
102 @Dict( dicCode = "safety_handle_status") 102 @Dict( dicCode = "safety_handle_status")
103 private String handleStatus; 103 private String handleStatus;
104 /**反馈意见*/ 104 /**反馈意见*/
......
...@@ -3,15 +3,18 @@ package com.skua.modules.dataAnalysis.controller; ...@@ -3,15 +3,18 @@ package com.skua.modules.dataAnalysis.controller;
3 import com.skua.common.constant.ReportConstant; 3 import com.skua.common.constant.ReportConstant;
4 import com.skua.common.report.ReportViewUtil; 4 import com.skua.common.report.ReportViewUtil;
5 import com.skua.core.api.vo.Result; 5 import com.skua.core.api.vo.Result;
6 import com.skua.core.context.BaseContextHandler;
6 import com.skua.core.context.SpringContextUtils; 7 import com.skua.core.context.SpringContextUtils;
7 import com.skua.modules.dataAnalysis.vo.SafeProgressVO; 8 import com.skua.modules.dataAnalysis.vo.SafeProgressVO;
8 import com.skua.modules.dataAnalysis.vo.WorkProgressVO; 9 import com.skua.modules.dataAnalysis.vo.WorkProgressVO;
10 import com.skua.modules.system.service.ISysDepartService;
9 import com.skua.tool.util.DateUtils; 11 import com.skua.tool.util.DateUtils;
10 import com.skua.tool.util.JSUtils; 12 import com.skua.tool.util.JSUtils;
11 import io.swagger.annotations.Api; 13 import io.swagger.annotations.Api;
12 import io.swagger.annotations.ApiOperation; 14 import io.swagger.annotations.ApiOperation;
13 import lombok.extern.slf4j.Slf4j; 15 import lombok.extern.slf4j.Slf4j;
14 import org.apache.commons.lang.StringUtils; 16 import org.apache.commons.lang.StringUtils;
17 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.jdbc.core.BeanPropertyRowMapper; 18 import org.springframework.jdbc.core.BeanPropertyRowMapper;
16 import org.springframework.jdbc.core.JdbcTemplate; 19 import org.springframework.jdbc.core.JdbcTemplate;
17 import org.springframework.web.bind.annotation.GetMapping; 20 import org.springframework.web.bind.annotation.GetMapping;
...@@ -33,7 +36,8 @@ import java.util.List; ...@@ -33,7 +36,8 @@ import java.util.List;
33 @RestController 36 @RestController
34 @RequestMapping("/v1/dataAnalysis/work") 37 @RequestMapping("/v1/dataAnalysis/work")
35 public class WorkAnalysisController { 38 public class WorkAnalysisController {
36 39 @Autowired
40 private ISysDepartService departService;
37 41
38 @ApiOperation(value = "工作进度列表", notes = "工作进度列表 departType = 1 自营水厂 departType=2 表示恩菲水厂 timeType = 1 表示月份,timeType=2 表示年") 42 @ApiOperation(value = "工作进度列表", notes = "工作进度列表 departType = 1 自营水厂 departType=2 表示恩菲水厂 timeType = 1 表示月份,timeType=2 表示年")
39 @GetMapping("/analysisByWorkProgress") 43 @GetMapping("/analysisByWorkProgress")
...@@ -43,14 +47,15 @@ public class WorkAnalysisController { ...@@ -43,14 +47,15 @@ public class WorkAnalysisController {
43 if(2 == timeType){//表示年 47 if(2 == timeType){//表示年
44 month = DateUtils.formatDate(startTime,"YYYY"); 48 month = DateUtils.formatDate(startTime,"YYYY");
45 } 49 }
46 String departIds = departId;//DAY(LAST_DAY('"+startTime+"')) 50 String departIds = BaseContextHandler.getDeparts();//DAY(LAST_DAY('"+startTime+"'))
47 if(StringUtils.isEmpty(departId )){ 51 if(StringUtils.isNotEmpty(departId )){
52 departIds = departService.getChildDepartId(departId);
53 }
48 if(departType == 1){//自营水厂 54 if(departType == 1){//自营水厂
49 departIds = getSelfDepartIds(); 55 departIds = getSelfDepartIds(departIds);
50 } 56 }
51 if(departType == 2){//恩菲水厂 57 if(departType == 2){//恩菲水厂
52 departIds = getEFDepartIds(); 58 departIds = getEFDepartIds(departIds);
53 }
54 } 59 }
55 endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 60 endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
56 int index =1; 61 int index =1;
...@@ -84,14 +89,15 @@ public class WorkAnalysisController { ...@@ -84,14 +89,15 @@ public class WorkAnalysisController {
84 if(2 == timeType){//表示年 89 if(2 == timeType){//表示年
85 month = DateUtils.formatDate(startTime,"YYYY"); 90 month = DateUtils.formatDate(startTime,"YYYY");
86 } 91 }
87 String departIds = departId;//DAY(LAST_DAY('"+startTime+"')) 92 String departIds = BaseContextHandler.getDeparts();//DAY(LAST_DAY('"+startTime+"'))
88 if(StringUtils.isEmpty(departId )){ 93 if(StringUtils.isNotEmpty(departId )){
94 departIds = departService.getChildDepartId(departId);
95 }
89 if(departType == 1){//自营水厂 96 if(departType == 1){//自营水厂
90 departIds = getSelfDepartIds(); 97 departIds = getSelfDepartIds(departIds);
91 } 98 }
92 if(departType == 2){//恩菲水厂 99 if(departType == 2){//恩菲水厂
93 departIds = getEFDepartIds(); 100 departIds = getEFDepartIds(departIds);
94 }
95 } 101 }
96 endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 102 endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
97 int index =1; 103 int index =1;
...@@ -123,14 +129,15 @@ public class WorkAnalysisController { ...@@ -123,14 +129,15 @@ public class WorkAnalysisController {
123 public Result<List<SafeProgressVO>> analysisBySafeProgress(@RequestParam(defaultValue = "1") Integer departType,String departId,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) { 129 public Result<List<SafeProgressVO>> analysisBySafeProgress(@RequestParam(defaultValue = "1") Integer departType,String departId,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
124 Result<List<SafeProgressVO>> result = new Result<>(); 130 Result<List<SafeProgressVO>> result = new Result<>();
125 JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master"); 131 JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master");
126 String departIds = departId;//DAY(LAST_DAY('"+startTime+"')) 132 String departIds = BaseContextHandler.getDeparts();//DAY(LAST_DAY('"+startTime+"'))
127 if(StringUtils.isEmpty(departId )){ 133 if(StringUtils.isNotEmpty(departId )){
134 departIds = departService.getChildDepartId(departId);
135 }
128 if(departType == 1){//自营水厂 136 if(departType == 1){//自营水厂
129 departIds = getSelfDepartIds(); 137 departIds = getSelfDepartIds(departIds);
130 } 138 }
131 if(departType == 2){//恩菲水厂 139 if(departType == 2){//恩菲水厂
132 departIds = getEFDepartIds(); 140 departIds = getEFDepartIds(departIds);
133 }
134 } 141 }
135 endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 142 endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
136 String sql = "select d.id 'depart_id' , d.depart_name , ifnull(aaa.count,0) 'meet_num', ifnull(bbb.count,0) 'meet_total', ifnull(ccc.count,0) 'exam_num', ifnull(ddd.count,0) 'exam_total',ifnull(eee.count, 0) 'frequency_num' , ifnull(fff.count , 0) 'frequency_total'"; 143 String sql = "select d.id 'depart_id' , d.depart_name , ifnull(aaa.count,0) 'meet_num', ifnull(bbb.count,0) 'meet_total', ifnull(ccc.count,0) 'exam_num', ifnull(ddd.count,0) 'exam_total',ifnull(eee.count, 0) 'frequency_num' , ifnull(fff.count , 0) 'frequency_total'";
...@@ -151,14 +158,15 @@ public class WorkAnalysisController { ...@@ -151,14 +158,15 @@ public class WorkAnalysisController {
151 @GetMapping("/analysisTotalBySafeProgress") 158 @GetMapping("/analysisTotalBySafeProgress")
152 public Result<SafeProgressVO> analysisTotalBySafeProgress(@RequestParam(defaultValue = "1") Integer departType, String departId ,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) { 159 public Result<SafeProgressVO> analysisTotalBySafeProgress(@RequestParam(defaultValue = "1") Integer departType, String departId ,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
153 Result<SafeProgressVO> result = new Result<>(); 160 Result<SafeProgressVO> result = new Result<>();
154 String departIds = departId;//DAY(LAST_DAY('"+startTime+"')) 161 String departIds = BaseContextHandler.getDeparts();//DAY(LAST_DAY('"+startTime+"'))
155 if(StringUtils.isEmpty(departId )){ 162 if(StringUtils.isNotEmpty(departId )){
163 departIds = departService.getChildDepartId(departId);
164 }
156 if(departType == 1){//自营水厂 165 if(departType == 1){//自营水厂
157 departIds = getSelfDepartIds(); 166 departIds = getSelfDepartIds(departIds);
158 } 167 }
159 if(departType == 2){//恩菲水厂 168 if(departType == 2){//恩菲水厂
160 departIds = getEFDepartIds(); 169 departIds = getEFDepartIds(departIds);
161 }
162 } 170 }
163 endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 171 endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
164 172
...@@ -233,12 +241,12 @@ public class WorkAnalysisController { ...@@ -233,12 +241,12 @@ public class WorkAnalysisController {
233 return sql; 241 return sql;
234 } 242 }
235 243
236 private String getSelfDepartIds(){ 244 private String getSelfDepartIds(String departIds){
237 String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id <> '1818215543140909056'"; 245 String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id <> '1818215543140909056' and id in ("+JSUtils.quoteEach(departIds,",")+")";
238 return getJdbcTemplate().queryForObject(sql,String.class); 246 return getJdbcTemplate().queryForObject(sql,String.class);
239 } 247 }
240 private String getEFDepartIds(){//获取恩菲水厂编号 248 private String getEFDepartIds(String departIds){//获取恩菲水厂编号
241 String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id = '1818215543140909056'"; 249 String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id = '1818215543140909056' and id in ("+JSUtils.quoteEach(departIds,",")+")";
242 return getJdbcTemplate().queryForObject(sql,String.class); 250 return getJdbcTemplate().queryForObject(sql,String.class);
243 } 251 }
244 252
......
...@@ -50,6 +50,9 @@ public class EquipmentCenterController { ...@@ -50,6 +50,9 @@ public class EquipmentCenterController {
50 public Result<FaultStatisticsVO> equipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) { 50 public Result<FaultStatisticsVO> equipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) {
51 Result<FaultStatisticsVO> result = new Result<>(); 51 Result<FaultStatisticsVO> result = new Result<>();
52 setDepartIds(reportStatisticsDTO); 52 setDepartIds(reportStatisticsDTO);
53 //取消时间参数
54 reportStatisticsDTO.setStartTime(null);
55 reportStatisticsDTO.setEndTime(null);
53 FaultStatisticsVO equipmentStatistics = iProductionEquipmentService.getEquipmentStatistics(reportStatisticsDTO); 56 FaultStatisticsVO equipmentStatistics = iProductionEquipmentService.getEquipmentStatistics(reportStatisticsDTO);
54 result.setResult(equipmentStatistics); 57 result.setResult(equipmentStatistics);
55 result.setSuccess(true); 58 result.setSuccess(true);
...@@ -65,6 +68,9 @@ public class EquipmentCenterController { ...@@ -65,6 +68,9 @@ public class EquipmentCenterController {
65 Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>(); 68 Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>();
66 Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize); 69 Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize);
67 setDepartIds(reportStatisticsDTO); 70 setDepartIds(reportStatisticsDTO);
71 //取消时间参数
72 reportStatisticsDTO.setStartTime(null);
73 reportStatisticsDTO.setEndTime(null);
68 pageList = iProductionEquipmentService.getEquipmentStatisticsDetails(pageList, reportStatisticsDTO); 74 pageList = iProductionEquipmentService.getEquipmentStatisticsDetails(pageList, reportStatisticsDTO);
69 result.setSuccess(true); 75 result.setSuccess(true);
70 result.setResult(pageList); 76 result.setResult(pageList);
...@@ -92,6 +98,9 @@ public class EquipmentCenterController { ...@@ -92,6 +98,9 @@ public class EquipmentCenterController {
92 public Result<List<TOPTenVO>> equipmentState(ReportStatisticsDTO reportStatisticsDTO) { 98 public Result<List<TOPTenVO>> equipmentState(ReportStatisticsDTO reportStatisticsDTO) {
93 Result<List<TOPTenVO>> result = new Result<>(); 99 Result<List<TOPTenVO>> result = new Result<>();
94 setDepartIds(reportStatisticsDTO); 100 setDepartIds(reportStatisticsDTO);
101 //取消时间参数
102 reportStatisticsDTO.setStartTime(null);
103 reportStatisticsDTO.setEndTime(null);
95 List<TOPTenVO> equipmentState = iProductionEquipmentService.getEquipmentState(reportStatisticsDTO); 104 List<TOPTenVO> equipmentState = iProductionEquipmentService.getEquipmentState(reportStatisticsDTO);
96 result.setSuccess(true); 105 result.setSuccess(true);
97 result.setResult(equipmentState); 106 result.setResult(equipmentState);
......
...@@ -29,7 +29,7 @@ import java.util.Map; ...@@ -29,7 +29,7 @@ import java.util.Map;
29 @Mapper 29 @Mapper
30 public interface ProductionEquipmentMapper { 30 public interface ProductionEquipmentMapper {
31 //根据时间获取设备数量 31 //根据时间获取设备数量
32 Integer getEquipmentNum(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("level") String level); 32 Integer getEquipmentNum(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("level") String level,@Param("departIds") String departIds);
33 33
34 //获取总的停机天数 34 //获取总的停机天数
35 Map getDowntime(@Param("startTime") String startTime, @Param("endTime") String endTime); 35 Map getDowntime(@Param("startTime") String startTime, @Param("endTime") String endTime);
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
15 <if test="endTime !=null and endTime !=''"> 15 <if test="endTime !=null and endTime !=''">
16 and #{endTime} 16 and #{endTime}
17 </if> 17 </if>
18 <if test="departIds !=null and departIds !=''">
19 and depart_id in(${departIds})
20 </if>
18 </where> 21 </where>
19 </select> 22 </select>
20 <select id="getDowntime" resultType="java.util.Map" parameterType="java.lang.String"> 23 <select id="getDowntime" resultType="java.util.Map" parameterType="java.lang.String">
...@@ -160,6 +163,10 @@ ...@@ -160,6 +163,10 @@
160 <if test="departIds != null "> 163 <if test="departIds != null ">
161 and ei.depart_id in(${departIds}) 164 and ei.depart_id in(${departIds})
162 </if> 165 </if>
166 <if test="departIds !=null and departIds !=''">
167 and ei.depart_id in(${departIds})
168 </if>
169
163 group by ei.equipment_level 170 group by ei.equipment_level
164 </select> 171 </select>
165 <select id="getTypeByTime" parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO" 172 <select id="getTypeByTime" parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO"
...@@ -208,6 +215,10 @@ ...@@ -208,6 +215,10 @@
208 <if test="endTime !=null and endTime !=''"> 215 <if test="endTime !=null and endTime !=''">
209 AND #{endTime} 216 AND #{endTime}
210 </if> 217 </if>
218 <if test="departIds !=null and departIds !=''">
219 and ei.depart_id in(${departIds})
220 </if>
221
211 </where> 222 </where>
212 GROUP BY 223 GROUP BY
213 sd1.id 224 sd1.id
...@@ -336,6 +347,10 @@ ...@@ -336,6 +347,10 @@
336 <if test="endTime !=null and endTime !=''"> 347 <if test="endTime !=null and endTime !=''">
337 AND #{endTime} 348 AND #{endTime}
338 </if> 349 </if>
350 <if test="departIds !=null and departIds !=''">
351 and depart_id in(${departIds})
352 </if>
353
339 </where> 354 </where>
340 </select> 355 </select>
341 <select id="getStatusByHeadquarters" resultType="java.util.Map" 356 <select id="getStatusByHeadquarters" resultType="java.util.Map"
......
...@@ -73,11 +73,11 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -73,11 +73,11 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
73 reportStatisticsDTO.setTime(reportStatisticsDTO.getEndTime().substring(0,7)); 73 reportStatisticsDTO.setTime(reportStatisticsDTO.getEndTime().substring(0,7));
74 } 74 }
75 //总数 75 //总数
76 equipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), null); 76 equipmentNum = productionEquipmentMapper.getEquipmentNum(null,null, null,reportStatisticsDTO.getDepartIds());
77 //ab总数 77 //ab总数
78 ABEquipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), "C"); 78 ABEquipmentNum = productionEquipmentMapper.getEquipmentNum(null,null, "C",reportStatisticsDTO.getDepartIds());
79 //这个月新增 79 //这个月新增
80 increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getStartTime(), reportStatisticsDTO.getEndTime(), null); 80 increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getStartTime(), reportStatisticsDTO.getEndTime(), null,reportStatisticsDTO.getDepartIds());
81 // DateFormat format = new SimpleDateFormat("yyyy-MM"); 81 // DateFormat format = new SimpleDateFormat("yyyy-MM");
82 String lastMonth = DateUtils.getHbMonth(DateUtils.formatDate(reportStatisticsDTO.getStartTime(),"yyyy-MM")); 82 String lastMonth = DateUtils.getHbMonth(DateUtils.formatDate(reportStatisticsDTO.getStartTime(),"yyyy-MM"));
83 /* Date parse = null; 83 /* Date parse = null;
...@@ -110,7 +110,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -110,7 +110,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
110 if (null != downtime2.get("downtime")) { 110 if (null != downtime2.get("downtime")) {
111 downtime3 = downtime2.get("downtime").toString(); 111 downtime3 = downtime2.get("downtime").toString();
112 } 112 }
113 Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastMonth + MONTH_START, lastMonth + MONTH_END, null); 113 Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastMonth + MONTH_START, lastMonth + MONTH_END, null,reportStatisticsDTO.getDepartIds());
114 Double v1 = 0.00; 114 Double v1 = 0.00;
115 if (increase1 > 0) { 115 if (increase1 > 0) {
116 v1 = (increase1 * 30 - Double.parseDouble(downtime3)) / (increase1 * 30); 116 v1 = (increase1 * 30 - Double.parseDouble(downtime3)) / (increase1 * 30);
...@@ -154,14 +154,14 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -154,14 +154,14 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
154 reportStatisticsDTO.setTime(reportStatisticsDTO.getEndTime().substring(0,4)); 154 reportStatisticsDTO.setTime(reportStatisticsDTO.getEndTime().substring(0,4));
155 } 155 }
156 //总数 156 //总数
157 equipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), null); 157 equipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), null,reportStatisticsDTO.getDepartIds());
158 //ab总数 158 //ab总数
159 ABEquipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), "C"); 159 ABEquipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), "C",reportStatisticsDTO.getDepartIds());
160 if (null == reportStatisticsDTO.getTime()) { 160 if (null == reportStatisticsDTO.getTime()) {
161 Calendar cal = Calendar.getInstance(); 161 Calendar cal = Calendar.getInstance();
162 reportStatisticsDTO.setTime(String.valueOf(cal.get(Calendar.YEAR))); 162 reportStatisticsDTO.setTime(String.valueOf(cal.get(Calendar.YEAR)));
163 } 163 }
164 increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END, null); 164 increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END, null,reportStatisticsDTO.getDepartIds());
165 //设备完好率 165 //设备完好率
166 //求总停机天数 166 //求总停机天数
167 Map downtime = productionEquipmentMapper.getDowntime(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END); 167 Map downtime = productionEquipmentMapper.getDowntime(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END);
...@@ -188,7 +188,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -188,7 +188,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
188 } else { 188 } else {
189 downtime3 = downtime2.get("downtime").toString(); 189 downtime3 = downtime2.get("downtime").toString();
190 } 190 }
191 Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastYear + YEAR_START, lastYear + YEAR_END, null); 191 Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastYear + YEAR_START, lastYear + YEAR_END, null,reportStatisticsDTO.getDepartIds());
192 Double v1 = 0.00; 192 Double v1 = 0.00;
193 if (increase1 > 0) { 193 if (increase1 > 0) {
194 v1 = (increase1 * 365 - Double.parseDouble(downtime3)) / (increase1 * 365); 194 v1 = (increase1 * 365 - Double.parseDouble(downtime3)) / (increase1 * 365);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!