2b22db2d 康伟

kangwei: 工作进度

1、增加机构筛选,机构筛选到区域级即可。可以单独查询某个区域的水厂
5、年度目标报表改成生产经营报表的统计
6、如果是查询当月,应填报表数应该是当月当天的日期减1
1 个父辈 42c7dd8e
......@@ -18,6 +18,10 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.List;
/**
......@@ -48,8 +52,14 @@ public class WorkAnalysisController {
departIds = getEFDepartIds();
}
}
endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
int index =1;
LocalDate currentDate = LocalDate.now();
if(currentDate.toString().equals(endTime)){
index = 0 ;
}
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 ";
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 ";
sql += getWorkProgressSql(departIds, startTime, endTime, month);
sql += " where d.depart_type =1 ";
if(StringUtils.isNotEmpty(departIds)){
......@@ -83,7 +93,13 @@ public class WorkAnalysisController {
departIds = getEFDepartIds();
}
}
String sql = "select count(d.id) 'departNum', (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"') + 1) month_num,";
endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
int index =1;
LocalDate currentDate = LocalDate.now();
if(currentDate.toString().equals(endTime)){
index = 0 ;
}
String sql = "select count(d.id) 'departNum', (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"')+"+index+" ) month_num,";
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' ";
sql += " from sys_depart d ";
sql += getWorkProgressSql(departIds, startTime, endTime, month);
......@@ -91,7 +107,7 @@ public class WorkAnalysisController {
if(StringUtils.isNotEmpty(departIds)){
sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +")";
}
System.out.println("sql = "+sql);
//System.out.println("sql = "+sql);
List<WorkProgressVO> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<WorkProgressVO>(WorkProgressVO.class));
if(dataList != null && !dataList.isEmpty()){
workProgressVO = dataList.get(0);
......@@ -116,6 +132,7 @@ public class WorkAnalysisController {
departIds = getEFDepartIds();
}
}
endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
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'";
sql += " from sys_depart d ";
sql += getSafeProgressSql(departIds, startTime,endTime);
......@@ -143,6 +160,8 @@ public class WorkAnalysisController {
departIds = getEFDepartIds();
}
}
endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比
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' ";
sql += " from sys_depart d ";
sql += getSafeProgressSql(departIds, startTime,endTime);
......@@ -208,8 +227,9 @@ public class WorkAnalysisController {
String view4411Sql = ReportViewUtil.buildView(ReportConstant.view4411,"yyf,ysfsl",departIds,startTime,endTime);
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 ";
sql += " ";
//目标年报
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 ";
//目标年报 :年度目标报表改成生产经营报表的统计
//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 ";
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";
return sql;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!