| | |
| | | import com.ycl.platform.base.CheckIndex; |
| | | import com.ycl.platform.domain.entity.YwPoint; |
| | | import com.ycl.platform.mapper.YwPointMapper; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public class IndexCalculationServe { |
| | | @Autowired |
| | | private YwPointMapper pointMapper; |
| | | |
| | | //一机一档合格率 |
| | | public BigDecimal monitorQualify(Map<String, Object> param) { |
| | | BigDecimal totalMonitors = new BigDecimal((Integer) param.get("totalMonitors")); |
| | | BigDecimal qualifyMonitor = new BigDecimal((Integer) param.get("qualifyMonitor")); |
| | | return qualifyMonitor.divide(totalMonitors, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //点位在线率 |
| | | public BigDecimal siteOnline(Map<String, Object> param) { |
| | |
| | | // 检查是否已存在今日数据 |
| | | Optional<T> existingIndex = checkIndexList.stream() |
| | | .filter(index -> key.equals(index.getDeptId().toString()) && |
| | | (key.startsWith("Province_") ? CheckConstants.Examine_Tag_Province.equals(index.getExamineTag()) |
| | | (key.startsWith(ApiConstants.Province) ? CheckConstants.Examine_Tag_Province.equals(index.getExamineTag()) |
| | | : CheckConstants.Examine_Tag_County.equals(index.getExamineTag()))) |
| | | .findFirst(); |
| | | |
| | |
| | | } else { |
| | | try { |
| | | checkIndex = clazz.getDeclaredConstructor().newInstance(); |
| | | checkIndex.setDeptId(key.startsWith("Province_") ? Long.parseLong(key.split("_")[1]) : Long.parseLong(key)); |
| | | checkIndex.setExamineTag(key.startsWith("Province_") ? CheckConstants.Examine_Tag_Province : CheckConstants.Examine_Tag_County); |
| | | checkIndex.setDeptId(key.startsWith(ApiConstants.Province ) ? Long.parseLong(key.split("_")[1]) : Long.parseLong(key)); |
| | | checkIndex.setExamineTag(key.startsWith(ApiConstants.Province ) ? CheckConstants.Examine_Tag_Province : CheckConstants.Examine_Tag_County); |
| | | checkIndex.setCreateTime(new Date()); |
| | | } catch (Exception e) { |
| | | checkIndex = null; |