|
@ -6,12 +6,12 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.iot.dao.dict.IotSystemDictDao;
|
|
|
import com.yihu.iot.dao.equipment.IotEquipmentDetailDao;
|
|
|
import com.yihu.iot.dao.statistics.IotStatisticsCommonDao;
|
|
|
import com.yihu.iot.dao.statistics.IotStatisticsStockDao;
|
|
|
import com.yihu.iot.service.analyzer.WlyyIotTzDict;
|
|
|
import com.yihu.iot.service.analyzer.WlyyIotTzDictDao;
|
|
|
import com.yihu.iot.service.common.MyJdbcTemplate;
|
|
|
import com.yihu.iot.service.device.IotPatientDeviceService;
|
|
|
import com.yihu.iot.service.equipment.IotEqtDetailService;
|
|
|
import com.yihu.iot.service.label.FigureLabelSerachService;
|
|
|
import com.yihu.iot.service.platform.IotInterfaceLogService;
|
|
|
import com.yihu.iot.util.conceal.ConcealUtil;
|
|
|
import com.yihu.iot.util.excel.HibenateUtils;
|
|
@ -19,6 +19,7 @@ import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
|
|
|
import com.yihu.jw.entity.iot.equipment.IotEquipmentDetailDO;
|
|
|
import com.yihu.jw.entity.iot.statistics.IotStatisticsCommonDO;
|
|
|
import com.yihu.jw.entity.iot.statistics.IotStatisticsRealtimeDO;
|
|
|
import com.yihu.jw.entity.iot.statistics.IotStatisticsStockDO;
|
|
|
import com.yihu.jw.entity.util.AesEncryptUtils;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.util.common.LatitudeUtils;
|
|
@ -70,7 +71,7 @@ public class MonitorPlatformService {
|
|
|
@Autowired
|
|
|
private MyJdbcTemplate myJdbcTemplate;
|
|
|
@Autowired
|
|
|
private FigureLabelSerachService figureLabelSerachService;
|
|
|
private IotStatisticsStockDao iotStatisticsStockDao;
|
|
|
@Autowired
|
|
|
private IotEqtDetailService iotEqtDetailService;
|
|
|
@Autowired
|
|
@ -1249,16 +1250,73 @@ public class MonitorPlatformService {
|
|
|
}
|
|
|
|
|
|
//入驻设备管理
|
|
|
public JSONObject onboardingDeviceManagement(String parentType){
|
|
|
JSONObject result = new JSONObject();
|
|
|
public IotStatisticsStockDO onboardingDeviceManagement(String type,String town){
|
|
|
IotStatisticsStockDO stockDO;
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
String sql = "select sum(total) total,sum(useing) useing,SUM(stock) stock,SUM(iot_count) iot_count,SUM(lost_count) lost_count, " +
|
|
|
"SUM(intervene_count) intervene_count,SUM(issue_count) issue_count,SUM(binding_count) binding_count,SUM(disease_patient_count) disease_patient_count, " +
|
|
|
"SUM(disease_patient_device_count) disease_patient_device_count,SUM(disease_patient_use_count) disease_patient_use_count, " +
|
|
|
"SUM(fault_count) fault_count from iot_statistics_stock WHERE parent_type = '"+type+"' and town = '"+town+"'";
|
|
|
List<IotStatisticsStockDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(IotStatisticsStockDO.class));
|
|
|
if(list.size()>0){
|
|
|
stockDO = list.get(0);
|
|
|
stockDO.setBindingRate(rateLong(stockDO.getBindingCount(),stockDO.getTotal()));
|
|
|
stockDO.setDiseasePatientDeviceRate(rateLong(stockDO.getDiseasePatientDeviceCount(),stockDO.getDiseasePatientCount()));
|
|
|
stockDO.setDiseasePatientUseRate(rateLong(stockDO.getDiseasePatientUseCount(),stockDO.getDiseasePatientDeviceCount()));
|
|
|
stockDO.setFaultRate(rateLong(stockDO.getFaultCount(),stockDO.getTotal()));
|
|
|
stockDO.setInterveneRate(rateLong(stockDO.getInterveneCount(),stockDO.getTotal()));
|
|
|
stockDO.setIotRate(rateLong(stockDO.getIotCount(),stockDO.getIssueCount()));
|
|
|
stockDO.setIssueRate(rateLong(stockDO.getIssueCount(),stockDO.getTotal()));
|
|
|
stockDO.setLostRate(rateLong(stockDO.getLostCount(),stockDO.getIssueCount()));
|
|
|
return stockDO;
|
|
|
}else {
|
|
|
stockDO = new IotStatisticsStockDO();
|
|
|
stockDO.setBindingRate("0.00%");
|
|
|
stockDO.setDiseasePatientDeviceRate("0.00%");
|
|
|
stockDO.setDiseasePatientUseRate("0.00%");
|
|
|
stockDO.setFaultRate("0.00%");
|
|
|
stockDO.setInterveneRate("0.00%");
|
|
|
stockDO.setIotRate("0.00%");
|
|
|
stockDO.setIssueRate("0.00%");
|
|
|
stockDO.setLostRate("0.00%");
|
|
|
stockDO.setTotal(0l);//总数
|
|
|
stockDO.setUseing(0l);//使用数
|
|
|
stockDO.setStock(0l);//库存数
|
|
|
stockDO.setIotCount(0l);//物联数
|
|
|
stockDO.setLostCount(0l);//失联数
|
|
|
stockDO.setInterveneCount(0l);//干预数
|
|
|
stockDO.setIssueCount(0l);//发放数
|
|
|
stockDO.setBindingCount(0l);//绑定数
|
|
|
stockDO.setDiseasePatientCount(0l);//慢病患者数
|
|
|
stockDO.setDiseasePatientDeviceCount(0l);//慢病患者设备数
|
|
|
stockDO.setDiseasePatientUseCount(0l);//慢病患者设备使用数
|
|
|
stockDO.setFaultCount(0l);//设备故障数
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
stockDO = new IotStatisticsStockDO();
|
|
|
}
|
|
|
return result;
|
|
|
return stockDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 计算百分比
|
|
|
* @param molecule 分子
|
|
|
* @param denominator 分母
|
|
|
*/
|
|
|
public String rateLong(Long molecule,Long denominator){
|
|
|
if(molecule==null||denominator==null){
|
|
|
return "0.00%";
|
|
|
}
|
|
|
if (denominator == 0 && molecule > 0) {
|
|
|
return "100%";
|
|
|
} else if (molecule == 0 && denominator == 0) {
|
|
|
return "0.00%";
|
|
|
}
|
|
|
float size = (float) (molecule * 100) / denominator;
|
|
|
DecimalFormat df = new DecimalFormat("0.00");//格式化小数,不足的补0
|
|
|
String filesize = df.format(size);
|
|
|
return filesize + "%";
|
|
|
}
|
|
|
|
|
|
//设备库存、使用中、总备案、物联率、失联率
|