@ -0,0 +1,955 @@
package com.zcloud.controller.statisticsdata ;
import com.zcloud.controller.base.BaseController ;
import com.zcloud.entity.Page ;
import com.zcloud.entity.PageData ;
import com.zcloud.entity.system.Dictionaries ;
import com.zcloud.service.bus.* ;
import com.zcloud.service.highriskwork.HighWorkService ;
import com.zcloud.service.majordangersource.MajordangersourceDisposalService ;
import com.zcloud.service.system.* ;
import com.zcloud.util.* ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Controller ;
import org.springframework.web.bind.annotation.RequestMapping ;
import org.springframework.web.bind.annotation.ResponseBody ;
import java.text.DecimalFormat ;
import java.text.SimpleDateFormat ;
import java.util.* ;
@Controller
@RequestMapping ( "/getStatisticsData" )
public class StatisticsDataController extends BaseController {
private final static String CORPINFO_ID = "21590a00ea5e462e9ee44dd332dddc26" ;
private final static String USER_ID = "48a8ca9815814c979814ddcf041c5cd5" ;
private final static String USER_NAME = "秦港股份九公司" ;
private final static String DEPT_ID = "21590a00ea5e462e9ee44dd332dddc26" ;
@Autowired
private RiskPointService riskpointService ;
@Autowired
private UsersService usersService ;
@Autowired
private DepartmentService departmentService ;
@Autowired
private ListManagerService listmanagerService ;
@Autowired
private HiddenService hiddenService ;
@Autowired
private CardUserService cardUserService ;
@Autowired
private MajordangersourceDisposalService majordangersourceDisposalService ;
@Autowired
private HighWorkService highworkService ;
@Autowired
private DictionariesService dictionariesService ;
@Autowired
private VideoService videoService ;
@Autowired
private MajordangersourceDisposalService majordangersourcedisposalService ;
@Autowired
private PhotoService photoService ;
@Autowired
private FhsmsService fhsmsService ;
@Autowired
private RoleService roleService ;
@Autowired
private PostService postService ;
@Autowired
private CheckRecordService checkrecordService ;
@Autowired
private ListStatisticsService listStatisticsService ;
@Autowired
private IdentificationPartsService identificationPartsService ;
@Autowired
private RiskUnitService riskUnitService ;
@Autowired
private NoticeCorpService noticecorpService ;
@Autowired
private ServiceNoticeService noticeService ;
/ * *
* 可 视 化 首 页 统 计 数 据
*
* @param
* @throws Exception
* /
@RequestMapping ( value = "/findFormCount" )
@ResponseBody
public Object findFormCount ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
/*风险管控 数据统计*/
PageData risk = riskpointService . statisticsRiskCount ( pd ) ;
map . put ( "risk" , risk ) ;
/* 隐患排查数据统计 */
Map < String , Object > corp = new HashMap < > ( ) ;
//部门
List < PageData > userCount = usersService . statisticsByCorp ( pd ) ;
corp . put ( "USERCOUNT" , userCount . get ( 0 ) . get ( "COUNT" ) ) ; //人员总数
corp . put ( "USERCHECKCOUNT" , userCount . get ( 1 ) . get ( "COUNT" ) ) ; //人员总数
//部门
List < PageData > deptCount = departmentService . statisticsByCorp ( pd ) ;
corp . put ( "DEPTCOUNT" , deptCount . get ( 0 ) . get ( "COUNT" ) ) ; //人员总数
corp . put ( "DEPTCHECKCOUNT" , deptCount . get ( 1 ) . get ( "COUNT" ) ) ; //人员总数
//清单
List < PageData > listCount = listmanagerService . statisticsByCorp ( pd ) ; //列出ListManager列表
corp . put ( "LISTCOUNT" , listCount . get ( 0 ) . get ( "COUNT" ) ) ; //人员总数
corp . put ( "LISTCHECKCOUNT" , listCount . get ( 1 ) . get ( "COUNT" ) ) ; //人员总数
map . put ( "corp" , corp ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 可 视 化 首 页 清 单 类 型 占 比 统 计
*
* @param
* @throws Exception
* /
@RequestMapping ( value = "/findListTypeChartData" )
@ResponseBody
public Object findListTypeChartData ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
//清单类型占比统计
List < PageData > chartData = listmanagerService . statisticsGroupType ( pd ) ;
map . put ( "chartData" , chartData ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 可 视 化 首 页 隐 患 整 改 趋 势
*
* @param
* @throws Exception
* /
@RequestMapping ( value = "/findHdRecTrendChartData" )
@ResponseBody
public Object findHdRecTrendChartData ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
//隐患整改趋势(近半年)
Map < String , Object > chartData = new HashMap < String , Object > ( ) ;
List < String > legendData = Arrays . asList ( new String [ ] { "已发现" , "待确认" , "已确认" , "待验收" , "已验收" , "延期处置" } ) ;
chartData . put ( "legendData" , legendData ) ;
List < String > halfYearMonth = DateUtil . getHalfYearMonth ( true ) ;
chartData . put ( "xAxisData" , halfYearMonth ) ;
List seriesData = new ArrayList ( ) ;
for ( int i = 0 ; i < legendData . size ( ) ; i + + ) {
PageData pd = new PageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
pd . put ( "STATENAME" , legendData . get ( i ) ) ;
List data = new ArrayList ( ) ;
List < PageData > hdRecChart = hiddenService . statisticsGroupMonthByState ( pd ) ; //根据状态按时间分组统计隐患数据
for ( int j = 0 ; j < halfYearMonth . size ( ) ; j + + ) {
boolean flag = true ;
for ( int k = 0 ; k < hdRecChart . size ( ) ; k + + ) {
if ( halfYearMonth . get ( j ) . equals ( hdRecChart . get ( k ) . getString ( "CREATMONTH" ) ) ) {
flag = false ;
data . add ( hdRecChart . get ( k ) . get ( "COUNT" ) ) ;
break ;
}
}
if ( flag ) {
data . add ( 0 ) ;
}
}
seriesData . add ( data ) ;
}
chartData . put ( "seriesData" , seriesData ) ;
map . put ( "chartData" , chartData ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 可 视 化 首 页 风 险 程 度 统 计
*
* @param
* @throws Exception
* /
@RequestMapping ( value = "/findRiskPointChartData" )
@ResponseBody
public Object findRiskPointChartData ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
Map < String , Object > chartData = new HashMap < String , Object > ( ) ;
List < PageData > deptList = riskpointService . listDeptByPoint ( pd ) ;
List < String > yAxisData = new ArrayList < String > ( ) ;
for ( PageData d : deptList ) {
PageData pdf = new PageData ( ) ;
yAxisData . add ( d . getString ( "DEPT_NAME" ) ) ;
}
chartData . put ( "yAxisData" , yAxisData ) ;
List < Dictionaries > varList = dictionariesService . listSubDictByParentId ( "5a81e63ec0e94d919b3138bc01dbef6b" ) ;
List < String > legendData = new ArrayList < String > ( ) ;
List seriesData = new ArrayList ( ) ;
for ( Dictionaries d : varList ) {
PageData pdf = new PageData ( ) ;
legendData . add ( d . getNAME ( ) ) ;
seriesData . add ( new ArrayList ( ) ) ;
}
chartData . put ( "legendData" , legendData ) ;
//隐患整改趋势(近半年)
for ( int i = 0 ; i < deptList . size ( ) ; i + + ) {
PageData dept = new PageData ( ) ;
dept . put ( "DEPARTMENT_ID" , deptList . get ( i ) . getString ( "DEPARTMENT_ID" ) ) ;
List < PageData > dataChart = riskpointService . statisticsGroupLevelByDept ( dept ) ; //按照级别分类统计各部门风险管控数据
for ( int j = 0 ; j < varList . size ( ) ; j + + ) {
List secondList = ( List ) seriesData . get ( j ) ;
secondList . add ( i , dataChart . get ( j ) . getString ( "COUNT" ) ) ;
}
}
chartData . put ( "seriesData" , seriesData ) ;
map . put ( "chartData" , chartData ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 可 视 化 首 页 本 月 人 员 进 出
*
* @param
* @throws Exception
* /
@RequestMapping ( value = "/findCarUserChartData" )
@ResponseBody
public Object findCarUserChartData ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
//隐患整改趋势(近半年)
Map < String , Object > chartData = new HashMap < String , Object > ( ) ;
// List<String> legendData = Arrays.asList(new String[]{"进入人员", "外出人员", "刷卡率"});
List < String > legendData = Arrays . asList ( new String [ ] { "进入人员" , "外出人员" } ) ;
chartData . put ( "legendData" , legendData ) ;
List < String > thisMonth = DateUtil . getThisMonth ( false ) ; // 本月日期
chartData . put ( "xAxisData" , thisMonth ) ;
List seriesData = new ArrayList ( ) ;
for ( int i = 0 ; i < legendData . size ( ) ; i + + ) {
PageData pd = new PageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
pd . put ( "STATENAME" , legendData . get ( i ) ) ;
List data = new ArrayList ( ) ;
List < PageData > hdRecChart = cardUserService . statisticsGroupDay ( pd ) ; //根据状态按时间分组统计人员进出刷卡
for ( int j = 0 ; j < thisMonth . size ( ) ; j + + ) {
boolean flag = true ;
for ( int k = 0 ; k < hdRecChart . size ( ) ; k + + ) {
if ( thisMonth . get ( j ) . equals ( hdRecChart . get ( k ) . getString ( "CREATDAY" ) ) ) {
flag = false ;
data . add ( hdRecChart . get ( k ) . get ( "COUNT" ) ) ;
break ;
}
}
if ( flag ) {
data . add ( 0 ) ;
}
}
seriesData . add ( data ) ;
}
chartData . put ( "seriesData" , seriesData ) ;
map . put ( "chartData" , chartData ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 可 视 化 首 页 报 警 处 置 情 况
*
* @param
* @throws Exception
* /
@RequestMapping ( value = "/findAlarmDisposalChartData" )
@ResponseBody
public Object findAlarmDisposalChartData ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
//隐患整改趋势(近半年)
Map < String , Object > chartData = new HashMap < String , Object > ( ) ;
List < String > legendData = Arrays . asList ( new String [ ] { "报警数" , "已处置" , "处置中" } ) ;
chartData . put ( "legendData" , legendData ) ;
List < String > xAxisData = new ArrayList < String > ( ) ;
List seriesData1 = new ArrayList ( ) ;
List seriesData2 = new ArrayList ( ) ;
List seriesData3 = new ArrayList ( ) ;
List < PageData > disposalChart = majordangersourceDisposalService . statisticsGroupMajordangersource ( pd ) ; //根据重大危险源分组统计报警处置情况
List seriesData = new ArrayList ( ) ;
for ( PageData data : disposalChart ) {
xAxisData . add ( data . getString ( "MAJORDANGERSOURCE_NAME" ) ) ;
seriesData1 . add ( data . get ( "COUNTALARM" ) ) ;
seriesData2 . add ( data . get ( "COUNTDISPOSED" ) ) ;
seriesData3 . add ( data . get ( "COUNTDISPOSAL" ) ) ;
}
chartData . put ( "xAxisData" , xAxisData ) ;
seriesData . add ( seriesData1 ) ;
seriesData . add ( seriesData2 ) ;
seriesData . add ( seriesData3 ) ;
chartData . put ( "seriesData" , seriesData ) ;
map . put ( "chartData" , chartData ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 可 视 化 首 页 作 业 类 型 统 计 分 析
*
* @param
* @throws Exception
* /
@RequestMapping ( value = "/findHighRiskWorkChartData" )
@ResponseBody
public Object findHighRiskWorkChartData ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
//隐患整改趋势(近半年)
Map < String , Object > chartData = new HashMap < String , Object > ( ) ;
List < String > legendData = Arrays . asList ( new String [ ] { "动火作业" , "临时用电作业" , "盲板作业" , "高处作业" , "有限空间作业" , "吊装作业" } ) ;
List < PageData > workChart = highworkService . statisticsAllHighRiskWork ( pd ) ; //统计高危作业里各作业数
List seriesData = new ArrayList ( ) ;
for ( int i = 0 ; i < legendData . size ( ) ; i + + ) {
PageData pie = new PageData ( ) ;
pie . put ( "name" , legendData . get ( i ) ) ;
pie . put ( "value" , workChart . get ( i ) . get ( "COUNT" ) ) ;
seriesData . add ( pie ) ;
}
chartData . put ( "seriesData" , seriesData ) ;
map . put ( "chartData" , chartData ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * * 数 据 可 视 化 平 台 首 页 获 取
* 1. 获 取 企 业 的 置 顶 视 频
* 2. 获 取 管 理 的 置 顶 视 频
* 3. 没 有 视 频 或 者 没 有 置 顶 视 频
* @param
* @throws Exception
* /
@RequestMapping ( value = "/getObjectForBiLogin" )
@ResponseBody
public Object getObjectForBiLogin ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = new PageData ( ) ;
pd . put ( "TYPE" , "1" ) ;
pd . put ( "CORPINFO_TYPE" , "1" ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
List < PageData > cpvarList = videoService . listAll ( pd ) ; //企业视频
pd = new PageData ( ) ;
pd . put ( "CORPINFO_TYPE" , "2" ) ;
pd . put ( "TYPE" , "1" ) ;
List < PageData > ptVarList = videoService . listAll ( pd ) ; //平台视频
map . put ( "ptVarList" , ptVarList ) ;
map . put ( "cpvarList" , cpvarList ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * * 获 取 重 大 危 险 源 数 据
* @param
* @throws Exception
* /
@RequestMapping ( value = "/findValidateData" )
@ResponseBody
public Object findValidateData ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
List < PageData > varList = majordangersourcedisposalService . listAll ( pd ) ; //根据ID读取
map . put ( "varList" , varList ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 清 单 检 查 完 成 率 统 计
*
* @param
* @throws Exception
* /
@RequestMapping ( value = "/goIndexCount" )
@ResponseBody
public Object goIndexCount ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ; // 企业
String STARTTIME = pd . getString ( "STARTTIME" ) ; // 关键词检索条件
if ( Tools . notEmpty ( STARTTIME ) )
pd . put ( "STARTTIME" , STARTTIME . trim ( ) + " 00:00:00" ) ;
String ENDTIME = pd . getString ( "ENDTIME" ) ; // 关键词检索条件
if ( Tools . notEmpty ( ENDTIME ) )
pd . put ( "ENDTIME" , ENDTIME . trim ( ) + " 23:59:59" ) ;
List < PageData > varList = new ArrayList < PageData > ( ) ;
PageData listType0001 = new PageData ( ) ;
PageData listType0002 = new PageData ( ) ;
PageData listType0003 = new PageData ( ) ;
PageData listType0004 = new PageData ( ) ;
PageData listType0005 = new PageData ( ) ;
PageData all = new PageData ( ) ;
Map < String , PageData > varMap = new HashMap < String , PageData > ( ) ;
listType0001 . put ( "type" , "listType0001" ) ;
listType0001 . put ( "name" , "日常" ) ;
listType0001 . put ( "molecule" , 0 ) ;
listType0001 . put ( "denominator" , 0 ) ;
listType0001 . put ( "percentage" , 0d ) ;
listType0002 . put ( "type" , "listType0002" ) ;
listType0002 . put ( "name" , "综合" ) ;
listType0002 . put ( "molecule" , 0 ) ;
listType0002 . put ( "denominator" , 0 ) ;
listType0002 . put ( "percentage" , 0d ) ;
listType0003 . put ( "type" , "listType0003" ) ;
listType0003 . put ( "name" , "专业" ) ;
listType0003 . put ( "molecule" , 0 ) ;
listType0003 . put ( "denominator" , 0 ) ;
listType0003 . put ( "percentage" , 0d ) ;
listType0004 . put ( "type" , "listType0004" ) ;
listType0004 . put ( "name" , "季节性" ) ;
listType0004 . put ( "molecule" , 0 ) ;
listType0004 . put ( "denominator" , 0 ) ;
listType0004 . put ( "percentage" , 0d ) ;
listType0005 . put ( "type" , "listType0005" ) ;
listType0005 . put ( "name" , "节假日" ) ;
listType0005 . put ( "molecule" , 0 ) ;
listType0005 . put ( "denominator" , 0 ) ;
listType0005 . put ( "percentage" , 0d ) ;
all . put ( "type" , "all" ) ;
all . put ( "name" , "合计" ) ;
all . put ( "molecule" , 0 ) ;
all . put ( "denominator" , 0 ) ;
all . put ( "percentage" , 0d ) ;
varMap . put ( "listType0001" , listType0001 ) ;
varMap . put ( "listType0002" , listType0002 ) ;
varMap . put ( "listType0003" , listType0003 ) ;
varMap . put ( "listType0004" , listType0004 ) ;
varMap . put ( "listType0005" , listType0005 ) ;
varMap . put ( "all" , all ) ;
List < PageData > countList = listStatisticsService . getCountList ( pd ) ; // 统计分母
if ( countList ! = null & & countList . size ( ) > 0 ) {
List < PageData > dayList = checkrecordService . listCountDay ( pd ) ; // 统计--日
if ( dayList ! = null & & dayList . size ( ) > 0 ) {
for ( PageData count : dayList ) {
Integer molecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( count . get ( "TYPE" ) ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( count . get ( "TYPE" ) ) . put ( "molecule" , molecule ) ;
Integer allMolecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( "all" ) . put ( "molecule" , allMolecule ) ;
}
}
List < PageData > weekList = checkrecordService . listCountWeek ( pd ) ; // 统计--周
if ( weekList ! = null & & weekList . size ( ) > 0 ) {
for ( PageData count : weekList ) {
Integer molecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( count . get ( "TYPE" ) ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( count . get ( "TYPE" ) ) . put ( "molecule" , molecule ) ;
Integer allMolecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( "all" ) . put ( "molecule" , allMolecule ) ;
}
}
List < PageData > monthList = checkrecordService . listCountMonth ( pd ) ; // 统计--月
if ( monthList ! = null & & monthList . size ( ) > 0 ) {
for ( PageData count : monthList ) {
Integer molecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( count . get ( "TYPE" ) ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( count . get ( "TYPE" ) ) . put ( "molecule" , molecule ) ;
Integer allMolecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( "all" ) . put ( "molecule" , allMolecule ) ;
}
}
List < PageData > quarterList = checkrecordService . listCountQuarter ( pd ) ; // 统计--季
if ( quarterList ! = null & & quarterList . size ( ) > 0 ) {
for ( PageData count : quarterList ) {
Integer molecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( count . get ( "TYPE" ) ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( count . get ( "TYPE" ) ) . put ( "molecule" , molecule ) ;
Integer allMolecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( "all" ) . put ( "molecule" , allMolecule ) ;
}
}
List < PageData > halfYearList = checkrecordService . listCountHalfYear ( pd ) ; // 统计--半年
if ( halfYearList ! = null & & halfYearList . size ( ) > 0 ) {
for ( PageData count : halfYearList ) {
Integer molecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( count . get ( "TYPE" ) ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( count . get ( "TYPE" ) ) . put ( "molecule" , molecule ) ;
Integer allMolecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( "all" ) . put ( "molecule" , allMolecule ) ;
}
}
List < PageData > yearList = checkrecordService . listCountYear ( pd ) ; // 统计--年
if ( yearList ! = null & & yearList . size ( ) > 0 ) {
for ( PageData count : yearList ) {
Integer molecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( count . get ( "TYPE" ) ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( count . get ( "TYPE" ) ) . put ( "molecule" , molecule ) ;
Integer allMolecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( "all" ) . put ( "molecule" , allMolecule ) ;
}
}
// 处理旬时间
StringBuffer stt = new StringBuffer ( ) ;
stt . append ( pd . getString ( "STARTTIME" ) ) ;
stt . setCharAt ( 9 , '1' ) ;
pd . put ( "STARTTIME" , stt . toString ( ) ) ;
String endDay = ENDTIME . substring ( 8 , 10 ) ;
Integer endTime = Integer . parseInt ( endDay ) ;
StringBuffer et = new StringBuffer ( ) ;
et . append ( pd . getString ( "ENDTIME" ) ) ;
if ( endTime < = 10 ) {
stt . setCharAt ( 8 , '1' ) ;
stt . setCharAt ( 9 , '0' ) ;
pd . put ( "ENDTIME" , et . toString ( ) ) ;
} else if ( endTime < = 20 ) {
stt . setCharAt ( 8 , '2' ) ;
stt . setCharAt ( 9 , '0' ) ;
pd . put ( "ENDTIME" , et . toString ( ) ) ;
} else {
Integer endMonth = Integer . parseInt ( ENDTIME . substring ( 5 , 7 ) ) ;
Integer endYear = Integer . parseInt ( ENDTIME . substring ( 0 , 4 ) ) ;
pd . put ( "ENDTIME" , getLastDayOfMonth ( endYear , endMonth ) + " 23:59:59" ) ;
}
List < PageData > tenDaysList = checkrecordService . listCountTenDays ( pd ) ; // 统计--旬
if ( tenDaysList ! = null & & tenDaysList . size ( ) > 0 ) {
for ( PageData count : tenDaysList ) {
Integer molecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( count . get ( "TYPE" ) ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( count . get ( "TYPE" ) ) . put ( "molecule" , molecule ) ;
Integer allMolecule = Integer . parseInt ( count . get ( "NUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( "all" ) . put ( "molecule" , allMolecule ) ;
}
}
// 分母
for ( PageData count : countList ) {
Integer denominator = Integer . parseInt ( count . get ( "NOTEXAMINEDNUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( count . get ( "TYPE" ) ) . get ( "denominator" ) . toString ( ) ) ;
varMap . get ( count . get ( "TYPE" ) ) . put ( "denominator" , denominator ) ;
Integer allDenominator = Integer . parseInt ( count . get ( "NOTEXAMINEDNUM" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( "all" ) . get ( "denominator" ) . toString ( ) ) ;
varMap . get ( "all" ) . put ( "denominator" , allDenominator ) ;
}
}
for ( int i = 1 ; i < 5 ; i + + ) {
String type = "listType000" + i ;
if ( ! varMap . get ( type ) . get ( "denominator" ) . toString ( ) . equals ( "0" ) ) {
if ( varMap . get ( type ) . get ( "molecule" ) . toString ( ) . equals ( "0" ) ) {
varMap . get ( type ) . put ( "percentage" , 0d ) ;
} else {
Double denominator = Double . parseDouble ( varMap . get ( type ) . get ( "denominator" ) . toString ( ) ) ;
Double molecule = Double . parseDouble ( varMap . get ( type ) . get ( "molecule" ) . toString ( ) ) ;
Double percentage = molecule / denominator * 100 ;
DecimalFormat df = new DecimalFormat ( "#.00" ) ;
varMap . get ( type ) . put ( "percentage" , df . format ( percentage ) ) ;
}
}
varList . add ( varMap . get ( type ) ) ;
}
if ( ! varMap . get ( "listType0005" ) . get ( "denominator" ) . toString ( ) . equals ( "0" ) ) {
Integer jjr = checkrecordService . listCountJjr ( pd ) = = null ? 0 : checkrecordService . listCountJjr ( pd ) ;
if ( jjr = = 0 ) {
varMap . get ( "listType0005" ) . put ( "percentage" , 0d ) ;
} else {
Double denominator = Double . parseDouble ( varMap . get ( "listType0005" ) . get ( "denominator" ) . toString ( ) ) ;
Double molecule = Double . valueOf ( jjr ) ;
Double percentage = molecule / denominator * 100 ;
DecimalFormat df = new DecimalFormat ( "#.00" ) ;
varMap . get ( "listType0005" ) . put ( "percentage" , df . format ( percentage ) ) ;
}
}
Integer allMolecule = Integer . parseInt ( varMap . get ( "listType0005" ) . get ( "molecule" ) . toString ( ) )
+ Integer . parseInt ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) ) ;
varMap . get ( "all" ) . put ( "molecule" , allMolecule ) ;
varList . add ( varMap . get ( "listType0005" ) ) ;
if ( ! varMap . get ( "all" ) . get ( "denominator" ) . toString ( ) . equals ( "0" ) ) {
if ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) . equals ( "0" ) ) {
varMap . get ( "all" ) . put ( "percentage" , 0d ) ;
} else {
Double denominator = Double . parseDouble ( varMap . get ( "all" ) . get ( "denominator" ) . toString ( ) ) ;
Double molecule = Double . parseDouble ( varMap . get ( "all" ) . get ( "molecule" ) . toString ( ) ) ;
Double percentage = molecule / denominator * 100 ;
DecimalFormat df = new DecimalFormat ( "#.00" ) ;
varMap . get ( "all" ) . put ( "percentage" , df . format ( percentage ) ) ;
}
}
varList . add ( varMap . get ( "all" ) ) ;
map . put ( "varList" , varList ) ;
map . put ( "varMap" , varMap ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
public static String getLastDayOfMonth ( int year , int month ) {
Calendar cal = Calendar . getInstance ( ) ;
// 设置年份
cal . set ( Calendar . YEAR , year ) ;
// 设置月份
cal . set ( Calendar . MONTH , month - 1 ) ;
// 获取某月最大天数
int lastDay = cal . getActualMaximum ( Calendar . DAY_OF_MONTH ) ;
// 设置日历中月份的最大天数
cal . set ( Calendar . DAY_OF_MONTH , lastDay ) ;
// 格式化日期
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
String lastDayOfMonth = sdf . format ( cal . getTime ( ) ) ;
return lastDayOfMonth ;
}
/ * * 首 页 获 取 折 线 图
* @param
* @throws Exception
* /
@RequestMapping ( value = "/listmanagerIndexCount" )
@ResponseBody
public Object listmanagerIndexCount ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ; //企业
List < PageData > valList = listmanagerService . goIndexCount ( pd ) ;
List valList1 = new ArrayList ( ) ;
//杨明图标数据
// {months: "2022-06", count: 0, screenType: "riskChecklistType0001"}
// 6 * 3 近6個月 , 3 三种类型
Map < String , String > monSCrMap = new HashMap < > ( ) ;
for ( PageData pageData : valList ) {
String key = pageData . getString ( "months" ) + "*" + pageData . getString ( "screenType" ) ;
monSCrMap . put ( key , pageData . getString ( "count" ) ) ;
}
List < String > halfYearMonth = DateUtil . getHalfYearMonth ( true ) ;
String [ ] typeAll = new String [ ] { "riskChecklistType0001" , "riskChecklistType0002" , "zhqd03" } ;
List < Map < String , Object > > list = new ArrayList < > ( ) ; // 整理完成的数据 size 6 * 3
for ( String month : halfYearMonth ) {
for ( String type : typeAll ) {
String count = "0" ;
String key = month + "*" + type ;
if ( monSCrMap . containsKey ( key ) ) {
count = monSCrMap . get ( key ) ;
}
Map < String , Object > monAndType = new HashMap < > ( ) ;
monAndType . put ( "months" , month ) ;
monAndType . put ( "screenType" , type ) ;
monAndType . put ( "count" , count ) ;
list . add ( monAndType ) ;
}
}
System . out . println ( list ) ;
map . put ( "xAxisData" , halfYearMonth ) ;
map . put ( "valList" , list ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 隐 患 数 量 统 计
*
* @param page
* @throws Exception
* /
@RequestMapping ( value = "/getCountByUserId" )
@ResponseBody
public Object getCountByUserId ( Page page ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
Map < String , Object > hidCount = new HashMap < > ( ) ;
pd . put ( "userId" , USER_ID ) ; // 发现人
Integer dzg = 0 ; // 待整改 1
Integer ycq = 0 ; // 已超期 5
Integer dfc = 0 ; // 待复查 2
Integer yys = 0 ; // 已验收 4
// STATE -- 隐患状态 0-未提交 1- 未整改 2-已整改 3-已复查 4-已验收 5-已过期
if ( Tools . notEmpty ( pd . get ( "userId" ) . toString ( ) ) ) {
pd . put ( "SELFUSERID" , USER_ID ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
List < PageData > rectifiHid = hiddenService . getCountByRectifiCationorId ( pd ) ; // 根据人员id获取整改隐患信息 state 1 5
for ( int i = 0 ; i < rectifiHid . size ( ) ; i + + ) {
PageData rec = rectifiHid . get ( i ) ;
if ( null = = rec . get ( "STATE" ) ) {
continue ;
}
if ( rec . get ( "STATE" ) . equals ( "1" ) | | rec . get ( "STATE" ) . equals ( "-1" ) ) {
dzg + + ;
}
}
List < PageData > creatorHid = hiddenService . getCountByCreatorId ( pd ) ; // 根据人员id获取发现隐患信息
for ( int i = 0 ; i < creatorHid . size ( ) ; i + + ) {
PageData cre = creatorHid . get ( i ) ;
if ( null = = cre . get ( "STATE" ) ) {
continue ;
}
if ( cre . get ( "STATE" ) . equals ( "2" ) ) {
dfc + + ;
}
if ( cre . get ( "STATE" ) . equals ( "4" ) ) {
yys + + ;
}
if ( cre . get ( "STATE" ) . equals ( "-1" ) ) {
ycq + + ;
}
}
}
hidCount . put ( "dzg" , dzg ) ;
hidCount . put ( "ycq" , ycq ) ;
hidCount . put ( "dfc" , dfc ) ;
hidCount . put ( "yys" , yys ) ;
map . put ( "hidCount" , hidCount ) ;
map . put ( "page" , page ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 风 险 点 统 计
*
* @param
* @throws Exception
* /
@RequestMapping ( value = "/statistic" )
@ResponseBody
public Object statistic ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
List < PageData > riskAll = riskpointService . statisticsAll ( pd ) ;
List < PageData > idAll = identificationPartsService . listIndexAll ( pd ) ;
List < PageData > unitAll = riskUnitService . listIndexAll ( pd ) ;
Integer idcount = 0 ;
Integer unitcount = 0 ;
Integer cnzfx = 0 ;
if ( idAll ! = null & & idAll . size ( ) > 0 ) {
idcount = idAll . size ( ) ;
}
if ( unitAll ! = null & & unitAll . size ( ) > 0 ) {
unitcount = unitAll . size ( ) ;
}
for ( int i = 0 ; riskAll . size ( ) > i ; i + + ) {
if ( riskAll . get ( i ) . get ( "LEVELID" ) ! = null & & Tools . notEmpty ( riskAll . get ( i ) . get ( "LEVELID" ) . toString ( ) ) ) {
if ( "levelA" . equals ( riskAll . get ( i ) . get ( "LEVELID" ) . toString ( ) )
| | "levelB" . equals ( riskAll . get ( i ) . get ( "LEVELID" ) . toString ( ) )
| | "levelC" . equals ( riskAll . get ( i ) . get ( "LEVELID" ) . toString ( ) )
| | "levelD" . equals ( riskAll . get ( i ) . get ( "LEVELID" ) . toString ( ) ) ) {
cnzfx + = Integer . valueOf ( riskAll . get ( i ) . get ( "COUNT" ) . toString ( ) ) ;
}
}
}
Map < String , Object > riskCount = new HashMap < > ( ) ;
riskCount . put ( "idcount" , idcount ) ;
riskCount . put ( "unitcount" , unitcount ) ;
riskCount . put ( "cnzfx" , cnzfx ) ;
// 风险点-只按名称统计 辨识部位-统计不同单元内的辨识部位名称的总数
map . put ( "riskCount" , riskCount ) ;
map . put ( "riskAll" , riskAll ) ;
map . put ( "idAll" , idAll ) ;
map . put ( "unitAll" , unitAll ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * *
* 隐 患 类 型 数 量 统 计
*
* @param page
* @throws Exception
* /
@RequestMapping ( value = "/getCountByHiddenType" )
@ResponseBody
public Object getCountByHiddenType ( Page page ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ;
List < PageData > dicIdsList = dictionariesService . getIdsByRecuByParentId ( "3babc15144444bdc8d763d0af2bdfff6" ) ;
int anl = 0 ;
int hbl = 0 ;
String anlIDs = dicIdsList . get ( 0 ) . getString ( "ids" ) ;
String hblIDs = dicIdsList . get ( 1 ) . getString ( "ids" ) ;
List < PageData > hiddList = hiddenService . getCountByHiddenType ( pd ) ;
for ( PageData pageData : hiddList ) {
String hiddenType = pageData . getString ( "DICTIONARIES_ID" ) ;
if ( anlIDs . indexOf ( hiddenType ) ! = - 1 ) {
anl + = Integer . parseInt ( pageData . getString ( "count" ) ) ;
}
if ( hblIDs . indexOf ( hiddenType ) ! = - 1 ) {
hbl + = Integer . parseInt ( pageData . getString ( "count" ) ) ;
}
}
List valList = new ArrayList ( ) ;
Map < String , Object > valMap = new HashMap < > ( ) ;
valMap . put ( "name" , "安全隐患" ) ;
valMap . put ( "value" , anl ) ;
valList . add ( valMap ) ;
valMap = new HashMap < > ( ) ;
valMap . put ( "name" , "卫生环保" ) ;
valMap . put ( "value" , hbl ) ;
valList . add ( valMap ) ;
map . put ( "hiddenTypeCount" , valList ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * * 平 台 公 告
* @param page
* @throws Exception
* /
@RequestMapping ( value = "/listByIndex" )
@ResponseBody
public Object listByIndex ( Page page ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
//获取发布给这个企业的信息
pd . put ( "CORP_INFO_ID" , CORPINFO_ID ) ;
page . setPd ( pd ) ;
List < PageData > varList = noticeService . getNotAndCorpByCorpId ( page ) ;
map . put ( "varList" , varList ) ;
map . put ( "page" , page ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * * 企 业 公 告
* @param page
* @throws Exception
* /
@RequestMapping ( value = "/enterpriseListByIndex" )
@ResponseBody
public Object enterpriseListByIndex ( Page page ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = this . getPageData ( ) ;
String KEYWORDS = pd . getString ( "KEYWORDS" ) ; //关键词检索条件
if ( Tools . notEmpty ( KEYWORDS ) ) pd . put ( "KEYWORDS" , KEYWORDS . trim ( ) ) ;
pd . put ( "USER_ID" , USER_ID ) ;
page . setPd ( pd ) ;
List < PageData > varList = noticecorpService . listByIndex ( page ) ; //列出NOTICECORP列表
map . put ( "varList" , varList ) ;
map . put ( "page" , page ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
/ * * 清 單 列 表
* @param
* @throws Exception
* /
@RequestMapping ( value = "/checkListIndex" )
@ResponseBody
public Object checkListIndex ( ) throws Exception {
Map < String , Object > map = new HashMap < String , Object > ( ) ;
String errInfo = "success" ;
PageData pd = new PageData ( ) ;
pd = this . getPageData ( ) ;
pd . put ( "CORPINFO_ID" , CORPINFO_ID ) ; //企业
pd . put ( "USER_ID" , USER_ID ) ;
pd . put ( "DEPARTMENT_ID" , DEPT_ID ) ;
pd . put ( "USER_ID" , "" ) ;
List < PageData > varList = listmanagerService . listAll ( pd ) ; //列出ListManager列表
int wjcNum = 0 ;
int yjcNum = 0 ;
for ( PageData list : varList ) {
if ( list . getString ( "TYPE" ) . equals ( "listType0005" ) ) {
if ( Integer . parseInt ( list . get ( "checkCount" ) . toString ( ) ) > 0 ) {
yjcNum + + ;
} else {
wjcNum + + ;
}
continue ;
}
if ( Integer . parseInt ( list . get ( "checkCount" ) . toString ( ) ) > 0 ) {
yjcNum + + ;
} else {
wjcNum + + ;
}
}
map . put ( "yjcNum" , yjcNum ) ;
map . put ( "wjcNum" , wjcNum ) ;
map . put ( "varList" , varList ) ;
map . put ( "result" , errInfo ) ;
return map ;
}
}