|
@@ -76,11 +76,18 @@ public class HealthShowApiController {
|
|
|
HashMap<String, Object> mapData = new HashMap<>();
|
|
|
try {
|
|
|
CompanyInfo companyInfo = companyInfoService.get(subject);
|
|
|
+
|
|
|
+ //当companyInfo为空时,则不是通过微信端入口进入
|
|
|
if (companyInfo == null) {
|
|
|
PersonInfo personInfo = personInfoService.get(new Long(subject));
|
|
|
if (personInfo == null) {
|
|
|
throw new Exception("参数异常");
|
|
|
}
|
|
|
+
|
|
|
+ //个人所在公司
|
|
|
+ CompanyInfo company = companyInfoService.get(personInfo.getCompanyId());
|
|
|
+
|
|
|
+ //人员包含监管者权限,找出此人所关联的所有公司
|
|
|
if (personInfo.getPopedom().contains("3")) {
|
|
|
List<PersonCompany> personCompanyList = personCompanyService.findByPersonId(personInfo.getId());
|
|
|
if (personCompanyList.size() > 0) {
|
|
@@ -91,6 +98,12 @@ public class HealthShowApiController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //如果人员关联的公司不包含自己所在的公司则加入
|
|
|
+ if (!list.contains(company)) {
|
|
|
+ list.add(company);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -116,21 +129,20 @@ public class HealthShowApiController {
|
|
|
|
|
|
//已测访客数
|
|
|
Integer checkedVisitorNum = 0;
|
|
|
- if (deviceNoList.size()>0){
|
|
|
- checkedVisitorNum = personDeviceLogService.getDayCheckedVistorNumByDeviceNoList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), deviceNoList);
|
|
|
+ if (deviceNoList.size() > 0) {
|
|
|
+ checkedVisitorNum = personDeviceLogService.getDayCheckedVistorNumByDeviceNoList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), deviceNoList);
|
|
|
}
|
|
|
|
|
|
//已测员工人次
|
|
|
Integer checkPersonTotal = personDeviceLogService.getDayCheckedPersonTotalByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, null);
|
|
|
|
|
|
|
|
|
-
|
|
|
Integer num = checkNumCompanyService.getDayCheckNumByCompanyList(DateUtil.format(new Date(), "yyyy-MM-dd"), list);
|
|
|
Integer totalNum = totalCheckCompanyService.getTotalCheckNum(list);
|
|
|
Integer dayCheckNum = num == null ? 0 : num;
|
|
|
|
|
|
//当日累计检测数
|
|
|
- // Integer totalCheckNum = totalNum == null ? dayCheckNum : totalNum + dayCheckNum;
|
|
|
+ // Integer totalCheckNum = totalNum == null ? dayCheckNum : totalNum + dayCheckNum;
|
|
|
Integer totalCheckNum = checkPersonTotal + checkedVisitorNum;
|
|
|
|
|
|
Integer num2 = personDeviceFilterLogService.getDayAbnormalNumByCompanyList(DateUtil.beginOfDay(new Date()), new Date(), list);
|
|
@@ -193,6 +205,9 @@ public class HealthShowApiController {
|
|
|
if (personInfo == null) {
|
|
|
throw new Exception("参数异常");
|
|
|
}
|
|
|
+
|
|
|
+ //个人所在公司
|
|
|
+ CompanyInfo company = companyInfoService.get(personInfo.getCompanyId());
|
|
|
if (personInfo.getPopedom().contains("3")) {
|
|
|
List<PersonCompany> personCompanyList = personCompanyService.findByPersonId(personInfo.getId());
|
|
|
if (personCompanyList.size() > 0) {
|
|
@@ -203,6 +218,11 @@ public class HealthShowApiController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //如果人员关联的公司不包含自己所在的公司则加入
|
|
|
+ if (!list.contains(company)) {
|
|
|
+ list.add(company);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -229,7 +249,7 @@ public class HealthShowApiController {
|
|
|
} else if ("person".equals(type)) {
|
|
|
personDeviceLogList = personDeviceLogService.findLastPersonLogByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, pageIndex, pageSize);
|
|
|
} else if ("visitor".equals(type)) {
|
|
|
- if (deviceNoList.size()>0){
|
|
|
+ if (deviceNoList.size() > 0) {
|
|
|
personDeviceLogList = personDeviceLogService.findVisitorLogByDeviceNoList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), deviceNoList, pageIndex, pageSize);
|
|
|
}
|
|
|
}
|
|
@@ -261,59 +281,98 @@ public class HealthShowApiController {
|
|
|
})
|
|
|
public MessageResult<Map> numDataForSchool(String token, @RequestAttribute String subject) {
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+ List<CompanyInfo> list = new ArrayList<>();
|
|
|
+ HashMap<String, Object> mapData = new HashMap<>();
|
|
|
|
|
|
try {
|
|
|
CompanyInfo companyInfo = companyInfoService.get(subject);
|
|
|
if (companyInfo == null) {
|
|
|
- throw new Exception("学校不存在");
|
|
|
+ PersonInfo personInfo = personInfoService.get(new Long(subject));
|
|
|
+ if (personInfo == null) {
|
|
|
+ throw new Exception("参数异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ //个人所在公司
|
|
|
+ CompanyInfo company = companyInfoService.get(personInfo.getCompanyId());
|
|
|
+ if (personInfo.getPopedom().contains("3")) {
|
|
|
+ List<PersonCompany> personCompanyList = personCompanyService.findByPersonId(personInfo.getId());
|
|
|
+ if (personCompanyList.size() > 0) {
|
|
|
+ for (PersonCompany personCompany : personCompanyList) {
|
|
|
+ CompanyInfo companyInfo1 = companyInfoService.get(personCompany.getCompanyId());
|
|
|
+ if (companyInfo1 != null) {
|
|
|
+ list.add(companyInfo1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果人员关联的公司不包含自己所在的公司则加入
|
|
|
+ if (!list.contains(company)) {
|
|
|
+ list.add(company);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ list = companyInfoService.findByCompanyCode(companyInfo.getCode() + "%", null);
|
|
|
}
|
|
|
- List<CompanyInfo> list = companyInfoService.findByCompanyCode(companyInfo.getCode() + "%", null);
|
|
|
- List<String> deviceNoList = new ArrayList<>();
|
|
|
- for (CompanyInfo companyInfo1 : list) {
|
|
|
- List<DeviceInfo> deviceInfoList = companyDeviceRelationService.findDeviceByCompanyId(companyInfo1.getId());
|
|
|
- for (DeviceInfo deviceInfo : deviceInfoList) {
|
|
|
- if (!deviceNoList.contains(deviceInfo.getDeviceNo())) {
|
|
|
- deviceNoList.add(deviceInfo.getDeviceNo());
|
|
|
+
|
|
|
+ // List<CompanyInfo> list = companyInfoService.findByCompanyCode(companyInfo.getCode() + "%", null);
|
|
|
+
|
|
|
+ if (list.size() > 0) {
|
|
|
+
|
|
|
+
|
|
|
+ List<String> deviceNoList = new ArrayList<>();
|
|
|
+ for (CompanyInfo companyInfo1 : list) {
|
|
|
+ List<DeviceInfo> deviceInfoList = companyDeviceRelationService.findDeviceByCompanyId(companyInfo1.getId());
|
|
|
+ for (DeviceInfo deviceInfo : deviceInfoList) {
|
|
|
+ if (!deviceNoList.contains(deviceInfo.getDeviceNo())) {
|
|
|
+ deviceNoList.add(deviceInfo.getDeviceNo());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ //应测教职工数
|
|
|
+ Integer teacherNum = Math.toIntExact(personInfoService.countByCompanyListAndPopedom("teacher", list));
|
|
|
+ //应测学生数
|
|
|
+ Integer studentNum = Math.toIntExact(personInfoService.countByCompanyListAndPopedom("student", list));
|
|
|
+ //已测教职工数
|
|
|
+ Integer checkedTeacherNum = personDeviceFilterLogService.getDayCheckedPersonNumByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, "2");
|
|
|
+ Integer checkedTeacherAndStudentNum = personDeviceFilterLogService.getDayCheckedPersonNumByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, "1");
|
|
|
+
|
|
|
+ //已测学生数
|
|
|
+ Integer checkedStudentNum = checkedTeacherAndStudentNum - checkedTeacherNum;
|
|
|
+
|
|
|
+ Integer num = checkNumCompanyService.getDayCheckNumByCompanyList(DateUtil.format(new Date(), "yyyy-MM-dd"), list);
|
|
|
+ Integer totalNum = totalCheckCompanyService.getTotalCheckNum(list);
|
|
|
+ Integer dayCheckNum = num == null ? 0 : num;
|
|
|
+ Integer totalCheckNum = totalNum == null ? dayCheckNum : totalNum + dayCheckNum;
|
|
|
+
|
|
|
+ Integer num2 = personDeviceFilterLogService.getDayAbnormalNumByCompanyList(DateUtil.beginOfDay(new Date()), new Date(), list);
|
|
|
+ Integer totalNum2 = totalCheckCompanyService.getTotalAbnormalNumByCompanyList(list);
|
|
|
+
|
|
|
+ //当日异常
|
|
|
+ Integer dayAbnormalNum = num2 == null ? 0 : num2;
|
|
|
+
|
|
|
+ //总异常
|
|
|
+ Integer totalAbnormalNum = totalNum2 == null ? 0 : totalNum2 + dayAbnormalNum;
|
|
|
+
|
|
|
+ Integer normalDaysNum = totalCheckCompanyService.findMinNormalDayByCompanyList(list);
|
|
|
+ //连续无异常天数
|
|
|
+ Integer normalDays = normalDaysNum == null ? 0 : normalDaysNum;
|
|
|
+
|
|
|
+ // HashMap<String, Object> mapData = new HashMap<>();
|
|
|
+ mapData.put("teacherNum", teacherNum);
|
|
|
+ mapData.put("studentNum", studentNum);
|
|
|
+ mapData.put("checkedTeacherNum", checkedTeacherNum);
|
|
|
+ mapData.put("checkedStudentNum", checkedStudentNum);
|
|
|
+ mapData.put("dayAbnormalNum", dayAbnormalNum);
|
|
|
+ mapData.put("totalAbnormalNum", totalAbnormalNum);
|
|
|
+ mapData.put("normalDays", normalDays);
|
|
|
+ msgResult.setData(mapData);
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ msgResult.setData(mapData);
|
|
|
}
|
|
|
- //应测教职工数
|
|
|
- Integer teacherNum = Math.toIntExact(personInfoService.countByCompanyListAndPopedom("teacher", list));
|
|
|
- //应测学生数
|
|
|
- Integer studentNum = Math.toIntExact(personInfoService.countByCompanyListAndPopedom("student", list));
|
|
|
- //已测教职工数
|
|
|
- Integer checkedTeacherNum = personDeviceFilterLogService.getDayCheckedPersonNumByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, "2");
|
|
|
- Integer checkedTeacherAndStudentNum = personDeviceFilterLogService.getDayCheckedPersonNumByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, "1");
|
|
|
-
|
|
|
- //已测学生数
|
|
|
- Integer checkedStudentNum = checkedTeacherAndStudentNum - checkedTeacherNum;
|
|
|
-
|
|
|
- Integer num = checkNumCompanyService.getDayCheckNumByCompanyList(DateUtil.format(new Date(), "yyyy-MM-dd"), list);
|
|
|
- Integer totalNum = totalCheckCompanyService.getTotalCheckNum(list);
|
|
|
- Integer dayCheckNum = num == null ? 0 : num;
|
|
|
- Integer totalCheckNum = totalNum == null ? dayCheckNum : totalNum + dayCheckNum;
|
|
|
-
|
|
|
- Integer num2 = personDeviceFilterLogService.getDayAbnormalNumByCompanyList(DateUtil.beginOfDay(new Date()), new Date(), list);
|
|
|
- Integer totalNum2 = totalCheckCompanyService.getTotalAbnormalNumByCompanyList(list);
|
|
|
-
|
|
|
- //当日异常
|
|
|
- Integer dayAbnormalNum = num2 == null ? 0 : num2;
|
|
|
-
|
|
|
- //总异常
|
|
|
- Integer totalAbnormalNum = totalNum2 == null ? 0 : totalNum2 + dayAbnormalNum;
|
|
|
-
|
|
|
- Integer normalDaysNum = totalCheckCompanyService.findMinNormalDayByCompanyList(list);
|
|
|
- //连续无异常天数
|
|
|
- Integer normalDays = normalDaysNum == null ? 0 : normalDaysNum;
|
|
|
-
|
|
|
- HashMap<String, Object> mapData = new HashMap<>();
|
|
|
- mapData.put("teacherNum", teacherNum);
|
|
|
- mapData.put("studentNum", studentNum);
|
|
|
- mapData.put("checkedTeacherNum", checkedTeacherNum);
|
|
|
- mapData.put("checkedStudentNum", checkedStudentNum);
|
|
|
- mapData.put("dayAbnormalNum", dayAbnormalNum);
|
|
|
- mapData.put("totalAbnormalNum", totalAbnormalNum);
|
|
|
- mapData.put("normalDays", normalDays);
|
|
|
+
|
|
|
msgResult.setMessage("查询成功");
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(mapData);
|
|
@@ -343,36 +402,69 @@ public class HealthShowApiController {
|
|
|
@RequestParam(value = "pageSize", defaultValue = "12") int pageSize,
|
|
|
String token, @RequestAttribute String subject) {
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+ List<CompanyInfo> list = new ArrayList<>();
|
|
|
+ HashMap<String, Object> mapData = new HashMap<>();
|
|
|
|
|
|
try {
|
|
|
CompanyInfo companyInfo = companyInfoService.get(subject);
|
|
|
if (companyInfo == null) {
|
|
|
- throw new Exception("公司不存在");
|
|
|
- }
|
|
|
- List<CompanyInfo> list = companyInfoService.findByCompanyCode(companyInfo.getCode() + "%", null);
|
|
|
- List<String> deviceNoList = new ArrayList<>();
|
|
|
- for (CompanyInfo companyInfo1 : list) {
|
|
|
- List<DeviceInfo> deviceInfoList = companyDeviceRelationService.findDeviceByCompanyId(companyInfo1.getId());
|
|
|
- for (DeviceInfo deviceInfo : deviceInfoList) {
|
|
|
- if (!deviceNoList.contains(deviceInfo.getDeviceNo())) {
|
|
|
- deviceNoList.add(deviceInfo.getDeviceNo());
|
|
|
+ // throw new Exception("学校不存在");
|
|
|
+ PersonInfo personInfo = personInfoService.get(new Long(subject));
|
|
|
+ if (personInfo == null) {
|
|
|
+ throw new Exception("参数异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ //个人所在公司
|
|
|
+ CompanyInfo company = companyInfoService.get(personInfo.getCompanyId());
|
|
|
+ if (personInfo.getPopedom().contains("3")) {
|
|
|
+ List<PersonCompany> personCompanyList = personCompanyService.findByPersonId(personInfo.getId());
|
|
|
+ if (personCompanyList.size() > 0) {
|
|
|
+ for (PersonCompany personCompany : personCompanyList) {
|
|
|
+ CompanyInfo companyInfo1 = companyInfoService.get(personCompany.getCompanyId());
|
|
|
+ if (companyInfo1 != null) {
|
|
|
+ list.add(companyInfo1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果人员关联的公司不包含自己所在的公司则加入
|
|
|
+ if (!list.contains(company)) {
|
|
|
+ list.add(company);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- Page<PersonDeviceLog> personDeviceLogList = new Page<>();
|
|
|
- if ("all".equals(type)) {
|
|
|
- personDeviceLogList = personDeviceLogService.findLastPersonLogByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, pageIndex, pageSize);
|
|
|
- } else if ("teacher".equals(type)) {
|
|
|
- personDeviceLogList = personDeviceLogService.findLastTeacherLogByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, pageIndex, pageSize);
|
|
|
- } else if ("student".equals(type)) {
|
|
|
- personDeviceLogList = personDeviceLogService.findLastStudentLogByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, pageIndex, pageSize);
|
|
|
|
|
|
+ } else {
|
|
|
+ list = companyInfoService.findByCompanyCode(companyInfo.getCode() + "%", null);
|
|
|
}
|
|
|
+ // List<CompanyInfo> list = companyInfoService.findByCompanyCode(companyInfo.getCode() + "%", null);
|
|
|
+ if (list.size() > 0) {
|
|
|
+
|
|
|
+
|
|
|
+ List<String> deviceNoList = new ArrayList<>();
|
|
|
+ for (CompanyInfo companyInfo1 : list) {
|
|
|
+ List<DeviceInfo> deviceInfoList = companyDeviceRelationService.findDeviceByCompanyId(companyInfo1.getId());
|
|
|
+ for (DeviceInfo deviceInfo : deviceInfoList) {
|
|
|
+ if (!deviceNoList.contains(deviceInfo.getDeviceNo())) {
|
|
|
+ deviceNoList.add(deviceInfo.getDeviceNo());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Page<PersonDeviceLog> personDeviceLogList = new Page<>();
|
|
|
+ if ("all".equals(type)) {
|
|
|
+ personDeviceLogList = personDeviceLogService.findLastPersonLogByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, pageIndex, pageSize);
|
|
|
+ } else if ("teacher".equals(type)) {
|
|
|
+ personDeviceLogList = personDeviceLogService.findLastTeacherLogByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, pageIndex, pageSize);
|
|
|
+ } else if ("student".equals(type)) {
|
|
|
+ personDeviceLogList = personDeviceLogService.findLastStudentLogByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, pageIndex, pageSize);
|
|
|
|
|
|
+ }
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(personDeviceLogList));
|
|
|
|
|
|
+ } else {
|
|
|
+ msgResult.setData(mapData);
|
|
|
+ }
|
|
|
msgResult.setMessage("查询成功");
|
|
|
msgResult.setResult(true);
|
|
|
- msgResult.setData(PojoUtils.pageWrapper(personDeviceLogList));
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
@@ -390,8 +482,8 @@ public class HealthShowApiController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "companyInfoId", paramType = "query", required = true, value = "公司id")
|
|
|
})
|
|
|
- public MessageResult<String> getCompanyToken(String companyInfoId, @ApiIgnore HttpSession session) {
|
|
|
- MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+ public MessageResult<Map> getCompanyToken(String companyInfoId, @ApiIgnore HttpSession session) {
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
CompanyInfo companyInfo = companyInfoService.get(companyInfoId);
|
|
@@ -406,8 +498,11 @@ public class HealthShowApiController {
|
|
|
|
|
|
session.setAttribute("companyToken", token);
|
|
|
|
|
|
+ HashMap map = new HashMap();
|
|
|
+ map.put("token", token);
|
|
|
+ map.put("companyName", companyInfo.getName());
|
|
|
messageResult.setResult(true);
|
|
|
- messageResult.setData(token);
|
|
|
+ messageResult.setData(map);
|
|
|
} else {
|
|
|
messageResult.setResult(false);
|
|
|
messageResult.setMessage("公司不存在!");
|