新增隐患处理等接口

pet
shanao 2024-09-30 15:33:42 +08:00
parent 13448e2af1
commit 029399c877
1 changed files with 273 additions and 0 deletions

View File

@ -951,5 +951,278 @@ public class StatisticsDataController extends BaseController {
return map;
}
/**
* <h1></h1>
*
* <p>
* //
* </p>
*
* @Data 2024930
*/
@RequestMapping(value = "/getBICount")
@ResponseBody
public Object getBICount() throws Exception {
Map<String, Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = this.getPageData();
pd.put("CORPINFO_ID", CORPINFO_ID);
// 旬
if (pd.get("IS_XUN") != null && Tools.notEmpty(pd.get("IS_XUN").toString())) {
// 1-10
if (DateUtil.timeCalendar(new Date(),
DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "01 00:00:00"),
DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "10 23:59:59"))) {
pd.put("STARTTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "01 00:00:00");
pd.put("ENDTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "10 23:59:59");
}
// 10-20
if (DateUtil.timeCalendar(new Date(),
DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "11 00:00:00"),
DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "20 23:59:59"))) {
pd.put("STARTTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "11 00:00:00");
pd.put("ENDTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "20 23:59:59");
}
// 20-月底
if (DateUtil.timeCalendar(new Date(),
DateUtil.fomatDateTime(DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "21 00:00:00"),
DateUtil.fomatDateTime(DateUtil.getMonthEndDay() + " 23:59:59"))) {
pd.put("STARTTIME", DateUtil.getYear() + "-" + DateUtil.getMonth() + "-" + "21 00:00:00");
pd.put("ENDTIME", DateUtil.getMonthEndDay() + " 23:59:59");
}
}
// 季度
if (pd.get("IS_QUARTER") != null && Tools.notEmpty(pd.get("IS_QUARTER").toString())) {
pd.put("STARTTIME", DateUtil.quarterStart() + " 00:00:00");
pd.put("ENDTIME", DateUtil.quarterEnd() + " 23:59:59");
}
List<PageData> varList = hiddenService.getBICount(pd);
if (varList != null && !varList.isEmpty()) {
map.put("total", varList.size());
int checked = 0;
int uncheck = 0;
for (PageData hidden : varList) {
if (hidden.get("STATE").toString().equals("4") || hidden.get("STATE").toString().equals("15") || hidden.get("STATE").toString().equals("5") || hidden.get("STATE").toString().equals("6")) {
checked++;
} else {
uncheck++;
}
}
map.put("checked", checked);
map.put("uncheck", uncheck);
} else {
map.put("total", 0);
map.put("checked", 0);
map.put("uncheck", 0);
}
map.put("result", errInfo);
return map;
}
/**
* <h1><h1/>
*
* <p>//</p>
*/
@RequestMapping(value = "/goBiListCount")
@ResponseBody
public Object goBiListCount() throws Exception {
Map<String, Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = this.getPageData();
pd.put("CORPINFO_ID", CORPINFO_ID); // 企业
switch (pd.get("COUNTTYPE").toString()) {
case "day":// 每日
pd.put("STARTTIME", DateUtil.getDay() + " 00:00:00");
pd.put("ENDTIME", DateUtil.getDay() + " 23:59:59");
break;
case "week":// 每周
pd.put("STARTTIME", DateUtil.getWeekStart());
pd.put("ENDTIME", DateUtil.getWeekEnd());
break;
case "xun":// 每旬
String year = DateUtil.getYear();
String month = DateUtil.getMonth();
Integer day = Integer.parseInt(DateUtil.getOnlyDay());
String startTime = year + "-" + month + "-";
String endTime = year + "-" + month + "-";
if (day <= 10) {
startTime = startTime + "01 00:00:00";
endTime = endTime + "10 23:59:59";
} else if (day > 10 && day <= 20) {
startTime = startTime + "11 00:00:00";
endTime = endTime + "20 23:59:59";
} else {
startTime = startTime + "21 00:00:00";
endTime = DateUtil.getMonthEndDay() + " 23:59:59";
}
pd.put("STARTTIME", startTime);
pd.put("ENDTIME", endTime);
break;
case "month":// 每月
pd.put("STARTTIME", DateUtil.getMonthFirstDay() + " 00:00:00");
pd.put("ENDTIME", DateUtil.getMonthEndDay() + " 23:59:59");
break;
case "quarter":// 每季
pd.put("STARTTIME", DateUtil.quarterStart() + " 00:00:00");
pd.put("ENDTIME", DateUtil.quarterEnd() + " 23:59:59");
break;
case "year":// 每年
pd.put("STARTTIME", DateUtil.getCurrYearFirst() + " 00:00:00");
pd.put("ENDTIME", DateUtil.getCurrYearLast() + " 23:59:59");
break;
case "halfyear":// 半年
String byear = DateUtil.getYear();
Integer bmonth = Integer.parseInt(DateUtil.getMonth());
if (bmonth <= 6) {
pd.put("STARTTIME", byear + "-01-01 00:00:00");
pd.put("ENDTIME", byear + "-06-30 23:59:59");
} else if (bmonth > 6) {
pd.put("STARTTIME", byear + "-07-01 00:00:00");
pd.put("ENDTIME", byear + "-12-31 23:59:59");
}
break;
default:
break;
}
String STARTTIME = pd.getString("STARTTIME");
String ENDTIME = pd.getString("ENDTIME");
PageData all = new PageData();
all.put("type", "all");
all.put("name", "合计");
all.put("molecule", 0);
all.put("denominator", 0);
all.put("percentage", 0d);
List<PageData> countList = listStatisticsService.getCountList(pd);// 统计分母
if (countList != null && !countList.isEmpty()) {
int sum = 0;
List<PageData> dayList = checkrecordService.listCountDay(pd); // 统计--日
if (dayList != null && !dayList.isEmpty()) {
for (PageData count : dayList) {
sum += Integer.parseInt(count.get("NUM").toString());
}
}
List<PageData> weekList = checkrecordService.listCountWeek(pd); // 统计--周
if (weekList != null && !weekList.isEmpty()) {
for (PageData count : weekList) {
sum += Integer.parseInt(count.get("NUM").toString());
}
}
List<PageData> monthList = checkrecordService.listCountMonth(pd); // 统计--月
if (monthList != null && !monthList.isEmpty()) {
for (PageData count : monthList) {
sum += Integer.parseInt(count.get("NUM").toString());
}
}
List<PageData> quarterList = checkrecordService.listCountQuarter(pd); // 统计--季
if (quarterList != null && !quarterList.isEmpty()) {
for (PageData count : quarterList) {
sum += Integer.parseInt(count.get("NUM").toString());
}
}
List<PageData> halfYearList = checkrecordService.listCountHalfYear(pd); // 统计--半年
if (halfYearList != null && !halfYearList.isEmpty()) {
for (PageData count : halfYearList) {
sum += Integer.parseInt(count.get("NUM").toString());
}
}
List<PageData> yearList = checkrecordService.listCountYear(pd); // 统计--年
if (yearList != null && !yearList.isEmpty()) {
for (PageData count : yearList) {
sum += Integer.parseInt(count.get("NUM").toString());
}
}
// 处理旬时间
StringBuilder stt = new StringBuilder();
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.isEmpty()) {
for (PageData count : tenDaysList) {
sum += Integer.parseInt(count.get("NUM").toString());
}
}
// 分母
for (PageData count : countList) {
Integer allDenominator = Integer.parseInt(count.get("NOTEXAMINEDNUM").toString())
+ Integer.parseInt(all.get("denominator").toString());
all.put("denominator", allDenominator);
}
Integer jjr = checkrecordService.listCountJjr(pd) == null ? 0 : checkrecordService.listCountJjr(pd);
all.put("molecule", sum + jjr);
}
if (!all.get("denominator").toString().equals("0")) {
if (all.get("molecule").toString().equals("0")) {
all.put("percentage", 0d);
} else {
Double denominator = Double.parseDouble(all.get("denominator").toString());
Double molecule = Double.parseDouble(all.get("molecule").toString());
Double percentage = molecule / denominator * 100;
DecimalFormat df = new DecimalFormat("#.00");
all.put("percentage", df.format(percentage));
}
}
map.put("all", all);
map.put("result", errInfo);
return map;
}
/**
* <h1></h1>
* <p></p>
*/
@RequestMapping(value = "/listLogByIde")
@ResponseBody
public Object listLogByIde() throws Exception {
Map<String, Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = this.getPageData();
pd.put("CORPINFO_ID", CORPINFO_ID); // 企业
List<PageData> varList = checkrecordService.listLogByIde(pd);
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
}