|
@@ -0,0 +1,92 @@
|
|
|
|
+package com.usky.fire.service.impl;
|
|
|
|
+
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
+import com.usky.common.core.exception.BusinessException;
|
|
|
|
+import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
|
+import com.usky.fire.domain.BscEnterpriseScreen;
|
|
|
|
+import com.usky.fire.mapper.BscEnterpriseScreenMapper;
|
|
|
|
+import com.usky.fire.service.BaseUserCompanyService;
|
|
|
|
+import com.usky.fire.service.BscEnterpriseScreenService;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * <p>
|
|
|
|
+ * 企业大屏数据统计 服务实现类
|
|
|
|
+ * </p>
|
|
|
|
+ *
|
|
|
|
+ * @author JCB
|
|
|
|
+ * @since 2022-09-06
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class BscEnterpriseScreenServiceImpl extends AbstractCrudService<BscEnterpriseScreenMapper, BscEnterpriseScreen> implements BscEnterpriseScreenService {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private BaseUserCompanyService baseUserCompanyService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Object screenDataStatistic(String dataType, String moduleType) {
|
|
|
|
+ String companyId = baseUserCompanyService.companyId();
|
|
|
|
+ if (StringUtils.isBlank(companyId)) {
|
|
|
|
+ throw new BusinessException("用户未绑定联网单位");
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<BscEnterpriseScreen> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ switch (moduleType) {
|
|
|
|
+ case "patrolInspection":
|
|
|
|
+ queryWrapper.select(BscEnterpriseScreen::getPatrolInspection);
|
|
|
|
+ break;
|
|
|
|
+ case "postInspect":
|
|
|
|
+ queryWrapper.select(BscEnterpriseScreen::getPostInspect);
|
|
|
|
+ break;
|
|
|
|
+ case "fireAlarm":
|
|
|
|
+ queryWrapper.select(BscEnterpriseScreen::getFireAlarm);
|
|
|
|
+ break;
|
|
|
|
+ case "reservePlan":
|
|
|
|
+ queryWrapper.select(BscEnterpriseScreen::getReservePlan);
|
|
|
|
+ break;
|
|
|
|
+ case "hiddenDanger":
|
|
|
|
+ queryWrapper.select(BscEnterpriseScreen::getHiddenDanger);
|
|
|
|
+ break;
|
|
|
|
+ case "buildScore":
|
|
|
|
+ queryWrapper.select(BscEnterpriseScreen::getBuildScore);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ throw new BusinessException("参数错误");
|
|
|
|
+ }
|
|
|
|
+ queryWrapper.eq(BscEnterpriseScreen::getCompanyId, companyId);
|
|
|
|
+ List<BscEnterpriseScreen> list = this.list(queryWrapper);
|
|
|
|
+ Object data = null;
|
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
+ switch (moduleType) {
|
|
|
|
+ case "patrolInspection":
|
|
|
|
+ data = list.get(0).getPatrolInspection();
|
|
|
|
+ break;
|
|
|
|
+ case "postInspect":
|
|
|
|
+ data = list.get(0).getPostInspect();
|
|
|
|
+ break;
|
|
|
|
+ case "fireAlarm":
|
|
|
|
+ data = list.get(0).getFireAlarm();
|
|
|
|
+ break;
|
|
|
|
+ case "reservePlan":
|
|
|
|
+ data = list.get(0).getReservePlan();
|
|
|
|
+ break;
|
|
|
|
+ case "hiddenDanger":
|
|
|
|
+ data = list.get(0).getHiddenDanger();
|
|
|
|
+ break;
|
|
|
|
+ case "buildScore":
|
|
|
|
+ data = list.get(0).getBuildScore();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data.toString());
|
|
|
|
+ Object disparateData = jsonObject.get(dataType);
|
|
|
|
+
|
|
|
|
+ return disparateData;
|
|
|
|
+ }
|
|
|
|
+}
|