wangzhinan 3 лет назад
Родитель
Сommit
a1b79c5178

+ 33 - 30
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicinedeviceService.java

@ -2050,7 +2050,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
                    "t.del = 1 AND  \n" +
                    "t.`status` = 0 and ',"+ deviceIds +",' LIKE CONCAT('%,',t.id,',%')\n";
            if (!StringUtils.isEmpty(content)) {
                sencodSql += " AND CONCAT(IFNULL(tmu.`equ_num`,''), IFNULL(tmu.`equ_name`,'')) like '%" + content +"%'";
                sencodSql += " AND ( t.equ_name like '%"+content+"%' or t.equ_num like '%"+content+"%')\n";
            }
             deviceList = hibenateUtils.createSQLQuery(sencodSql);
        } else {
@ -2143,7 +2143,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
                    "t.del = 1 AND  \n" +
                    "t.`status` = 0 and ',"+ belongCommunitys +",' LIKE CONCAT('%,',t.belong_community,',%')\n";
            if (!StringUtils.isEmpty(content)) {
                sencodSql += " AND (tmu.`equ_name` like '%" + content + "%' or tmu.`equ_num` like '%" + content + "%')\n";
                sencodSql += " AND (t.`equ_name` like '%" + content + "%' or t.`equ_num` like '%" + content + "%')\n";
            }
@ -4920,34 +4920,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
        String onlineTotal = total + " and d.network_status = 1 ";
        //离线设备
        String noOnlineTotal = total + " and d.network_status = 0 ";
        //未分配
        String noDistributionTotal = total + " and d.belong_community is  null  ";
        Map<String,Object> totalMap = jdbcTemplate.queryForMap(total);
        Map<String,Object> onlineTotalMap = jdbcTemplate.queryForMap(onlineTotal);
        Map<String,Object> noOnlineTotalMap = jdbcTemplate.queryForMap(noOnlineTotal);
        Double onlineTotal1 = 0.0;
        Double total1 = 0.0;
        Integer noOnlineTotal1 = 0;
        if (onlineTotalMap!=null){
            onlineTotal1 = Double.parseDouble(onlineTotalMap.get("count").toString());
        }
        if (totalMap!=null){
            total1 = Double.parseDouble(totalMap.get("count").toString());
        }
        if (noOnlineTotalMap!=null){
            noOnlineTotal1 = Integer.parseInt(noOnlineTotalMap.get("count").toString());
        }
        DecimalFormat df = new DecimalFormat("#.##");
        String rate = df.format(onlineTotal1/total1);
        Double rate1 = Double.parseDouble(rate)*100;
        String onlineRate = rate1+"%";
        Map<String, Object> overview = new HashMap<>();
        overview.put("total", total1);
        overview.put("onlineTotal", onlineTotal1);
        overview.put("onlineRate",onlineRate);
        overview.put("noOnlineTotal",noOnlineTotal1);
        //设备概况
        jsonObject.put("overview", overview);
        UserDO user = userDao.findOne(userId);
        RoleDO role = roleDao.findOne(user.getRoleId());
        List<String> deviceIds = null;
@ -5011,6 +4984,36 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
        }
        conditionSql += "AND d.belong_community IS NOT NULL\n";
        Map<String, Object> totalMap = jdbcTemplate.queryForMap(total + conditionSql);
        Map<String,Object> onlineTotalMap = jdbcTemplate.queryForMap(onlineTotal + conditionSql);
        Map<String,Object> noOnlineTotalMap = jdbcTemplate.queryForMap(noOnlineTotal + conditionSql);
        Double onlineTotal1 = 0.0;
        Double total1 = 0.0;
        Integer noOnlineTotal1 = 0;
        if (onlineTotalMap!=null){
            onlineTotal1 = Double.parseDouble(onlineTotalMap.get("count").toString());
        }
        if (totalMap!=null){
            total1 = Double.parseDouble(totalMap.get("count").toString());
        }
        if (noOnlineTotalMap!=null){
            noOnlineTotal1 = Integer.parseInt(noOnlineTotalMap.get("count").toString());
        }
        DecimalFormat df = new DecimalFormat("#.##");
        String rate = df.format(onlineTotal1/total1);
        Double rate1 = Double.parseDouble(rate)*100;
        String onlineRate = rate1+"%";
        Map<String, Object> overview = new HashMap<>();
        overview.put("total", total1);
        overview.put("onlineTotal", onlineTotal1);
        overview.put("onlineRate",onlineRate);
        overview.put("noOnlineTotal",noOnlineTotal1);
        //设备概况
        jsonObject.put("overview", overview);
        //缺货设备
        String add_total = total + conditionSql + "AND d.status = 0\n";