Merge remote-tracking branch 'origin/master'
正在显示
1 个修改的文件
包含
25 行增加
和
5 行删除
... | @@ -18,6 +18,10 @@ import org.springframework.web.bind.annotation.GetMapping; | ... | @@ -18,6 +18,10 @@ import org.springframework.web.bind.annotation.GetMapping; |
18 | import org.springframework.web.bind.annotation.RequestMapping; | 18 | import org.springframework.web.bind.annotation.RequestMapping; |
19 | import org.springframework.web.bind.annotation.RequestParam; | 19 | import org.springframework.web.bind.annotation.RequestParam; |
20 | import org.springframework.web.bind.annotation.RestController; | 20 | import org.springframework.web.bind.annotation.RestController; |
21 | |||
22 | import java.time.LocalDate; | ||
23 | import java.time.format.DateTimeFormatter; | ||
24 | import java.time.temporal.ChronoUnit; | ||
21 | import java.util.List; | 25 | import java.util.List; |
22 | 26 | ||
23 | /** | 27 | /** |
... | @@ -48,8 +52,14 @@ public class WorkAnalysisController { | ... | @@ -48,8 +52,14 @@ public class WorkAnalysisController { |
48 | departIds = getEFDepartIds(); | 52 | departIds = getEFDepartIds(); |
49 | } | 53 | } |
50 | } | 54 | } |
55 | endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 | ||
56 | int index =1; | ||
57 | LocalDate currentDate = LocalDate.now(); | ||
58 | if(currentDate.toString().equals(endTime)){ | ||
59 | index = 0 ; | ||
60 | } | ||
51 | 61 | ||
52 | String sql = "select d.id 'depart_id' , d.depart_name , (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"') + 1) month_num,ifnull(aaa.count,0) 'nh_num' ,ifnull(bbb.count,0) 'szsl_num' ,ifnull(ccc.count,0) 'hy_num' ,ifnull(ddd.count,0) 'yy_month_num',ifnull(fff.count,0) 'df_month_num' ,ifnull(ggg.count,0) 'year_target_num' from sys_depart d "; | 62 | String sql = "select d.id 'depart_id' , d.depart_name , (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"')+"+index+" ) month_num,ifnull(aaa.count,0) 'nh_num' ,ifnull(bbb.count,0) 'szsl_num' ,ifnull(ccc.count,0) 'hy_num' ,ifnull(ddd.count,0) 'yy_month_num',ifnull(fff.count,0) 'df_month_num' ,ifnull(ggg.count,0) 'year_target_num' from sys_depart d "; |
53 | sql += getWorkProgressSql(departIds, startTime, endTime, month); | 63 | sql += getWorkProgressSql(departIds, startTime, endTime, month); |
54 | sql += " where d.depart_type =1 "; | 64 | sql += " where d.depart_type =1 "; |
55 | if(StringUtils.isNotEmpty(departIds)){ | 65 | if(StringUtils.isNotEmpty(departIds)){ |
... | @@ -83,7 +93,13 @@ public class WorkAnalysisController { | ... | @@ -83,7 +93,13 @@ public class WorkAnalysisController { |
83 | departIds = getEFDepartIds(); | 93 | departIds = getEFDepartIds(); |
84 | } | 94 | } |
85 | } | 95 | } |
86 | String sql = "select count(d.id) 'departNum', (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"') + 1) month_num,"; | 96 | endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 |
97 | int index =1; | ||
98 | LocalDate currentDate = LocalDate.now(); | ||
99 | if(currentDate.toString().equals(endTime)){ | ||
100 | index = 0 ; | ||
101 | } | ||
102 | String sql = "select count(d.id) 'departNum', (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"')+"+index+" ) month_num,"; | ||
87 | sql += " ifnull(sum(aaa.count),0) 'nh_num' ,ifnull(sum(bbb.count),0) 'szsl_num' ,ifnull(sum(ccc.count),0) 'hy_num' ,ifnull(sum(ddd.count),0) 'yy_month_num',ifnull(sum(fff.count),0) 'df_month_num' ,ifnull(sum(ggg.count),0) 'year_target_num' "; | 103 | sql += " ifnull(sum(aaa.count),0) 'nh_num' ,ifnull(sum(bbb.count),0) 'szsl_num' ,ifnull(sum(ccc.count),0) 'hy_num' ,ifnull(sum(ddd.count),0) 'yy_month_num',ifnull(sum(fff.count),0) 'df_month_num' ,ifnull(sum(ggg.count),0) 'year_target_num' "; |
88 | sql += " from sys_depart d "; | 104 | sql += " from sys_depart d "; |
89 | sql += getWorkProgressSql(departIds, startTime, endTime, month); | 105 | sql += getWorkProgressSql(departIds, startTime, endTime, month); |
... | @@ -91,7 +107,7 @@ public class WorkAnalysisController { | ... | @@ -91,7 +107,7 @@ public class WorkAnalysisController { |
91 | if(StringUtils.isNotEmpty(departIds)){ | 107 | if(StringUtils.isNotEmpty(departIds)){ |
92 | sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +")"; | 108 | sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +")"; |
93 | } | 109 | } |
94 | System.out.println("sql = "+sql); | 110 | //System.out.println("sql = "+sql); |
95 | List<WorkProgressVO> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<WorkProgressVO>(WorkProgressVO.class)); | 111 | List<WorkProgressVO> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<WorkProgressVO>(WorkProgressVO.class)); |
96 | if(dataList != null && !dataList.isEmpty()){ | 112 | if(dataList != null && !dataList.isEmpty()){ |
97 | workProgressVO = dataList.get(0); | 113 | workProgressVO = dataList.get(0); |
... | @@ -116,6 +132,7 @@ public class WorkAnalysisController { | ... | @@ -116,6 +132,7 @@ public class WorkAnalysisController { |
116 | departIds = getEFDepartIds(); | 132 | departIds = getEFDepartIds(); |
117 | } | 133 | } |
118 | } | 134 | } |
135 | endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 | ||
119 | 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'"; | 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'"; |
120 | sql += " from sys_depart d "; | 137 | sql += " from sys_depart d "; |
121 | sql += getSafeProgressSql(departIds, startTime,endTime); | 138 | sql += getSafeProgressSql(departIds, startTime,endTime); |
... | @@ -143,6 +160,8 @@ public class WorkAnalysisController { | ... | @@ -143,6 +160,8 @@ public class WorkAnalysisController { |
143 | departIds = getEFDepartIds(); | 160 | departIds = getEFDepartIds(); |
144 | } | 161 | } |
145 | } | 162 | } |
163 | endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 | ||
164 | |||
146 | String sql = "select count(d.id) 'departNum', ifnull(sum(aaa.count),0) 'meet_num' ,ifnull(sum(bbb.count),0) 'meet_total' ,ifnull(sum(ccc.count),0) 'exam_num' ,ifnull(sum(ddd.count),0) 'exam_total',ifnull(sum(eee.count),0) 'frequency_num' ,ifnull(sum(fff.count),0) 'frequency_total' "; | 165 | String sql = "select count(d.id) 'departNum', ifnull(sum(aaa.count),0) 'meet_num' ,ifnull(sum(bbb.count),0) 'meet_total' ,ifnull(sum(ccc.count),0) 'exam_num' ,ifnull(sum(ddd.count),0) 'exam_total',ifnull(sum(eee.count),0) 'frequency_num' ,ifnull(sum(fff.count),0) 'frequency_total' "; |
147 | sql += " from sys_depart d "; | 166 | sql += " from sys_depart d "; |
148 | sql += getSafeProgressSql(departIds, startTime,endTime); | 167 | sql += getSafeProgressSql(departIds, startTime,endTime); |
... | @@ -208,8 +227,9 @@ public class WorkAnalysisController { | ... | @@ -208,8 +227,9 @@ public class WorkAnalysisController { |
208 | String view4411Sql = ReportViewUtil.buildView(ReportConstant.view4411,"yyf,ysfsl",departIds,startTime,endTime); | 227 | String view4411Sql = ReportViewUtil.buildView(ReportConstant.view4411,"yyf,ysfsl",departIds,startTime,endTime); |
209 | sql += " left join (select eee.depart_id ,count(1) 'count' from (select left(ee.time,7) time , ee.depart_id from "+view4411Sql+ " ee where 1=1 and ee.yyf is not null and ee.yyf <> '' and ee.ysfsl is not null and ee.ysfsl <> '' group by ee.depart_id ,left(ee.time,7) )eee group by eee.depart_id )fff on fff.depart_id = d.id "; | 228 | sql += " left join (select eee.depart_id ,count(1) 'count' from (select left(ee.time,7) time , ee.depart_id from "+view4411Sql+ " ee where 1=1 and ee.yyf is not null and ee.yyf <> '' and ee.ysfsl is not null and ee.ysfsl <> '' group by ee.depart_id ,left(ee.time,7) )eee group by eee.depart_id )fff on fff.depart_id = d.id "; |
210 | sql += " "; | 229 | sql += " "; |
211 | //目标年报 | 230 | //目标年报 :年度目标报表改成生产经营报表的统计 |
212 | sql += " left join(select depart_id ,count(depart_id) 'count' from report_target_config where target_year = year('"+startTime+"') group by depart_id) ggg on ggg.depart_id = d.id "; | 231 | //sql += " left join(select depart_id ,count(depart_id) 'count' from report_target_config where target_year = year('"+startTime+"') group by depart_id) ggg on ggg.depart_id = d.id "; |
232 | sql += " left join( select factory_id,count(id) 'count' from ajh_plan_schedule_data where LEFT(date_time,4) = year('"+startTime+"') group by factory_id ) ggg on ggg.factory_id = d.id"; | ||
213 | return sql; | 233 | return sql; |
214 | } | 234 | } |
215 | 235 | ... | ... |
-
请 注册 或 登录 后发表评论