Merge remote-tracking branch 'origin/0205cmt' into 0205cmt

0927cmt
songwenxuan 2024-04-26 15:02:01 +08:00
commit b4ec8333d5
2 changed files with 131 additions and 0 deletions

View File

@ -1460,7 +1460,131 @@ public class HiddenApiController extends BaseController {
return mv; return mv;
} }
/**
*
* @param response
* @return
* @throws Exception
*/
@RequestMapping(value = "/getCountSelect")
@ResponseBody
public Object getCountSelect(HttpServletResponse response) throws Exception {
PageData pd = new PageData();
pd = this.getPageData();
//这里进入开始获取数据阶段 首先拿到所有部门数据
String url ="department_list.html?DEPARTMENT_ID=";
List<Department> departments = departmentService.listAllDepartment(Jurisdiction.getCORPINFO_ID(), url);
//装船部 zcb id集合 89f3d30c4031432da53b75bed442ced8
List<String> zcbdepartmentIds = new ArrayList<>();
//保障部 bzb id集合 fcae9cc13a354be699d85d6aea3b3450
List<String> bzbdepartmentIds = new ArrayList<>();
//卸车部 xcb id集合 aad337cf728b4cc2b63e210caf4e185f
List<String> xcbdepartmentIds = new ArrayList<>();
//安监部 ajb id集合 4c4b7bc93e3347978f5a3e1f0c4a0b56
List<String> ajbdepartmentIds = new ArrayList<>();
//开始处理数据 扔进对应结合中
for(Department department:departments){
if(StringUtils.equals("89f3d30c4031432da53b75bed442ced8",department.getDEPARTMENT_ID())){
zcbdepartmentIds = getIdsList(department,zcbdepartmentIds);
}
if(StringUtils.equals("fcae9cc13a354be699d85d6aea3b3450",department.getDEPARTMENT_ID())){
bzbdepartmentIds = getIdsList(department,bzbdepartmentIds);
}
if(StringUtils.equals("aad337cf728b4cc2b63e210caf4e185f",department.getDEPARTMENT_ID())){
xcbdepartmentIds = getIdsList(department,xcbdepartmentIds);
}
if(StringUtils.equals("4c4b7bc93e3347978f5a3e1f0c4a0b56",department.getDEPARTMENT_ID())){
ajbdepartmentIds = getIdsList(department,ajbdepartmentIds);
}
}
//处理日期 类型 年 季度 月
String type = pd.getString("type");
String year = pd.getString("year");
String num = pd.getString("num");
String startTime = "";
String endTime = "";
//年
if(StringUtils.equals("1",type)){
startTime = year+"-01-01 00:00:00";
endTime = year+"-12-31 23:59:59";
}
//季度
if(StringUtils.equals("2",type)){
switch (num){
case "1" :
startTime = year+"-01-01 00:00:00";
endTime = year+"-03-31 23:59:59";
break;
case "2" :
startTime = year+"-04-01 00:00:00";
endTime = year+"-06-30 23:59:59";
break;
case "3" :
startTime = year+"-07-01 00:00:00";
endTime = year+"-09-30 23:59:59";
break;
case "4" :
startTime = year+"-10-01 00:00:00";
endTime = year+"-12-31 23:59:59";
break;
}
}
//月
if(StringUtils.equals("3",type)){
startTime = year+"-01 00:00:00";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 解析字符串为LocalDateTime
LocalDateTime dateTime = LocalDateTime.parse(startTime, formatter);
LocalDate localDate = dateTime.toLocalDate();
LocalDate lastDayOfMonth = localDate.with(java.time.temporal.TemporalAdjusters.lastDayOfMonth());
// 将LocalDateTime转换为ZonedDateTime如果需要的话
ZonedDateTime zonedDateTime = lastDayOfMonth.atStartOfDay(ZoneId.of("Asia/Shanghai"));
// 定义日期格式化器(仅日期部分)
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化ZonedDateTime对象为仅包含日期的字符串
String formattedDate = dateFormatter.format(zonedDateTime);
endTime = formattedDate+" 23:59:59";
}
//前置搜索条件处理完毕
pd.put("zcbdepartmentIds",zcbdepartmentIds);
pd.put("bzbdepartmentIds",bzbdepartmentIds);
pd.put("xcbdepartmentIds",xcbdepartmentIds);
pd.put("ajbdepartmentIds",ajbdepartmentIds);
pd.put("startTime",startTime);
pd.put("endTime",endTime);
//这里获取数据 获取指定日期范围内和指定部门集合创建的隐患总数
Map<String,Object> map = hiddenService.getExcelMap(pd);
//年
if(StringUtils.equals("1",type)){
map.put("type","统计年度:");
map.put("num",year+"年");
}
//季度
if(StringUtils.equals("2",type)){
map.put("type","统计季度:");
map.put("num",year+"年第"+num+"季度");
}
//月
if(StringUtils.equals("3",type)){
String[] month = year.split("-");
map.put("type","统计月度:");
map.put("num",month[0]+"年第"+month[1]+"月");
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
String date =sdf.format(new Date());
map.put("date","填表日期:"+date);
map.put("weidu",map.get("type").toString()+map.get("num").toString());
Map<String, Object> Returnmap = new HashMap<String, Object>();
Returnmap.put("result", "success");
Returnmap.put("pd",map);
return Returnmap;
}
/**
*
* @param response
* @throws Exception
*/
@RequestMapping(value = "/getCountExcel") @RequestMapping(value = "/getCountExcel")
public void exportExcels(HttpServletResponse response) throws Exception { public void exportExcels(HttpServletResponse response) throws Exception {
PageData pd = new PageData(); PageData pd = new PageData();

View File

@ -927,6 +927,13 @@ public class HiddenServiceImpl implements HiddenService{
//保障 //保障
map.put("ajbBzbGsc","保障部公司检查"+map.get("bzbGscZs").toString()+"项,已完成"+map.get("bzbGscZg").toString()+"项"); map.put("ajbBzbGsc","保障部公司检查"+map.get("bzbGscZs").toString()+"项,已完成"+map.get("bzbGscZg").toString()+"项");
map.put("ajbBzbZc","自查"+map.get("bzbZcZs").toString()+"项,已完成"+map.get("bzbZcZg").toString()+"项"); map.put("ajbBzbZc","自查"+map.get("bzbZcZs").toString()+"项,已完成"+map.get("bzbZcZg").toString()+"项");
//各部门合计
int allBuMenZs = Integer.parseInt(map.get("zcbZcZs").toString())+Integer.parseInt(map.get("xcbZcZs").toString())+Integer.parseInt(map.get("bzbZcZs").toString());
int allBuMenHjZg = Integer.parseInt(map.get("zcbZcZg").toString())+Integer.parseInt(map.get("xcbZcZg").toString())+Integer.parseInt(map.get("bzbZcZg").toString());
map.put("ajbHjZsTable",ajbHjZs);
map.put("ajbHjZgTable",ajbHjZg);
map.put("allBuMenZs",allBuMenZs);
map.put("allBuMenHjZg",allBuMenHjZg);
return map; return map;
} }
} }