Przeglądaj źródła

[task-2106]子设备管理看板开发/设备管理看板接口

szjbdgzl 1 rok temu
rodzic
commit
0d6eced434

+ 65 - 0
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/business/dto/EquipIntactDTO.java

@@ -0,0 +1,65 @@
+package com.lc.ibps.business.dto;
+
+public class EquipIntactDTO {
+
+
+    private String org;
+
+    private int numAll;//总数
+
+    private int numR;// 合格
+
+    private int numS;// 停用
+
+    private int numLimit; // 限用
+
+    private int numScrap; // 报废
+
+    public int getNumLimit() {
+        return numLimit;
+    }
+
+    public void setNumLimit(int numLimit) {
+        this.numLimit = numLimit;
+    }
+
+    public int getNumScrap() {
+        return numScrap;
+    }
+
+    public void setNumScrap(int numScrap) {
+        this.numScrap = numScrap;
+    }
+
+    public String getOrg() {
+        return org;
+    }
+
+    public void setOrg(String org) {
+        this.org = org;
+    }
+
+    public int getNumAll() {
+        return numAll;
+    }
+
+    public void setNumAll(int numAll) {
+        this.numAll = numAll;
+    }
+
+    public int getNumR() {
+        return numR;
+    }
+
+    public void setNumR(int numR) {
+        this.numR = numR;
+    }
+
+    public int getNumS() {
+        return numS;
+    }
+
+    public void setNumS(int numS) {
+        this.numS = numS;
+    }
+}

+ 21 - 1
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/business/dto/EquipmentDashBoardDTO.java

@@ -13,7 +13,27 @@ public class EquipmentDashBoardDTO {
 
     private List<EquipServiceLifeDTO> lifeTimeData; // 部门设备寿命情况统计
 
-    private EquipEntiretyDTO entiretyData;//  设备调整情况
+    private EquipEntiretyDTO entiretyData;//  设备整体情况
+
+    private List<EquipIntactDTO> intactData;  // 各部门设备完好情况
+
+    private List<List<String>> scrapData; // 检验科设备停用/报废列表
+
+    public List<List<String>> getScrapData() {
+        return scrapData;
+    }
+
+    public void setScrapData(List<List<String>> scrapData) {
+        this.scrapData = scrapData;
+    }
+
+    public List<EquipIntactDTO> getIntactData() {
+        return intactData;
+    }
+
+    public void setIntactData(List<EquipIntactDTO> intactData) {
+        this.intactData = intactData;
+    }
 
     public EquipEntiretyDTO getEntiretyData() {
         return entiretyData;

+ 150 - 10
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/business/service/impl/StatisticServiceImpl.java

@@ -172,43 +172,183 @@ public class StatisticServiceImpl implements StatisticService {
         equipDTO.setLifeTimeData(getEquipServiceLife());
 
         //  设备整体情况
+        equipDTO.setEntiretyData(getEquipEntirety(total));
 
         //  各部门设备完好情况
+        equipDTO.setIntactData(getEquipSituation());
 
         //  各部门设备维护完成情况
 
         //  各部门设备检定/校准完成情况
 
         //  检验科设备停用/报废列表
+        equipDTO.setScrapData(getEquipScrapList());
 
         list.add(equipDTO);
         return list;
     }
 
-    private void setEntirety(int total){
+    private List<List<String>> getEquipScrapList(){
+        String sql = "SELECT e.name_,a.she_bei_ming_chen,a.she_bei_bian_hao_,a.chu_li_lei_xing_ from " +
+                "(SELECT bian_zhi_bu_men_,she_bei_ming_chen,she_bei_bian_hao_,chu_li_lei_xing_ from t_sbtybfjlb WHERE " +
+                "shi_fou_guo_shen_='已完成' and di_dian_='%s' ORDER BY create_time_ desc)a , " +
+                "ibps_party_entity e where a.bian_zhi_bu_men_=e.id_ ";
+        sql = String.format(sql,getDiDian());
+        List<Map<String,Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
+        List<List<String>> equipList = new ArrayList<>();
+        if (BeanUtils.isNotEmpty(list)){
+            for (Map<String,Object> map : list){
+                List<String> str = new ArrayList<>();
+                str.add(map.get("name_").toString());
+                str.add(map.get("she_bei_ming_chen").toString());
+                str.add(map.get("she_bei_bian_hao_").toString());
+                str.add(map.get("chu_li_lei_xing_").toString());
+                equipList.add(str);
+            }
+        }
+        return equipList;
+    }
+
+    private List<EquipIntactDTO> getEquipSituation(){
+        List<EquipIntactDTO> intactData = new ArrayList<>();
+        Set<String> existsDept = new HashSet<>();
+        String sql = "SELECT p.name_,q.bian_zhi_bu_men_,COUNT(bian_zhi_bu_men_)as value from ( " +
+                "SELECT bian_zhi_bu_men_ from t_sbdj WHERE %s) q, " +
+                "(SELECT name_,id_ from ibps_party_entity WHERE path_ like '%%%s%%' and DEPTH_>=3) p " +
+                "where q.bian_zhi_bu_men_=p.id_ GROUP BY q.bian_zhi_bu_men_";
+
+        String stop = " she_bei_zhuang_ta='停用' and di_dian_='"+getDiDian()+"' ";
+        String enable = " she_bei_zhuang_ta='合格' and di_dian_='"+getDiDian()+"' ";
+        String sum = " di_dian_='"+getDiDian()+"'";
+        String limit = " she_bei_zhuang_ta='限用' and di_dian_='"+getDiDian()+"' ";
+        String scrap = " she_bei_zhuang_ta='报废' and di_dian_='"+getDiDian()+"' ";
+
+        String stopSql = String.format(sql,stop,getDiDian());
+        String enableSql = String.format(sql,enable,getDiDian());
+        String sumSql = String.format(sql,sum,getDiDian());
+        String limitSql = String.format(sql,limit,getDiDian());
+        String scrapSql = String.format(sql,scrap,getDiDian());
+
+        List<Map<String, Object>> stopList  = (List<Map<String, Object>>) commonDao.query(stopSql);
+        for (Map<String, Object> map : stopList){
+            EquipIntactDTO intac = new EquipIntactDTO();
+            intac.setOrg(map.get("name_").toString());
+            intac.setNumS(Integer.parseInt(map.get("value").toString()));
+            existsDept.add(map.get("name_").toString());
+            intactData.add(intac);
+        }
+        List<Map<String, Object>> enableList  = (List<Map<String, Object>>) commonDao.query(enableSql);
+        for (Map<String, Object> map : enableList){
+            EquipIntactDTO intac = new EquipIntactDTO();
+            intac.setOrg(map.get("name_").toString());
+            intac.setNumR(Integer.parseInt(map.get("value").toString()));
+            existsDept.add(map.get("name_").toString());
+            intactData.add(intac);
+        }
+        List<Map<String, Object>> sumList  = (List<Map<String, Object>>) commonDao.query(sumSql);
+        for (Map<String, Object> map : sumList){
+            EquipIntactDTO intac = new EquipIntactDTO();
+            intac.setOrg(map.get("name_").toString());
+            intac.setNumAll(Integer.parseInt(map.get("value").toString()));
+            existsDept.add(map.get("name_").toString());
+            intactData.add(intac);
+        }
+        List<Map<String, Object>> limitList  = (List<Map<String, Object>>) commonDao.query(limitSql);
+        for (Map<String, Object> map : limitList){
+            EquipIntactDTO intac = new EquipIntactDTO();
+            intac.setOrg(map.get("name_").toString());
+            intac.setNumLimit(Integer.parseInt(map.get("value").toString()));
+            existsDept.add(map.get("name_").toString());
+            intactData.add(intac);
+        }
+        List<Map<String, Object>> scrapList  = (List<Map<String, Object>>) commonDao.query(scrapSql);
+        for (Map<String, Object> map : scrapList){
+            EquipIntactDTO intac = new EquipIntactDTO();
+            intac.setOrg(map.get("name_").toString());
+            intac.setNumScrap(Integer.parseInt(map.get("value").toString()));
+            existsDept.add(map.get("name_").toString());
+            intactData.add(intac);
+        }
+
+        Map<String, EquipIntactDTO> mergedDTOMap = new HashMap<>();
+        for (EquipIntactDTO dto : intactData) {
+            if (!mergedDTOMap.containsKey(dto.getOrg())) {
+                mergedDTOMap.put(dto.getOrg(), dto);
+            } else {
+                EquipIntactDTO mergedDTO = mergedDTOMap.get(dto.getOrg());
+                mergedDTO.setNumAll(mergedDTO.getNumAll() + dto.getNumAll());
+                mergedDTO.setNumS(mergedDTO.getNumS() + dto.getNumS());
+                mergedDTO.setNumR(mergedDTO.getNumR() + dto.getNumR());
+                mergedDTO.setNumLimit(mergedDTO.getNumLimit() + dto.getNumLimit());
+                mergedDTO.setNumScrap(mergedDTO.getNumScrap() + dto.getNumScrap());
+            }
+        }
+        List<EquipIntactDTO> mergedList = new ArrayList<>(mergedDTOMap.values());
+
+        List<EquipIntactDTO> finalList = new ArrayList<>(mergedList);
+        List<Map<String, Object>> deptList = getPositionBy34(getDiDian());
+        for (Map<String, Object> dept : deptList) {
+            if (!existsDept.contains(dept.get("name_"))) {
+                EquipIntactDTO intact = new EquipIntactDTO();
+                intact.setOrg(dept.get("name_").toString());
+                intact.setNumAll(0);
+                intact.setNumS(0);
+                intact.setNumR(0);
+                finalList.add(intact);
+            }
+        }
+        return finalList;
+    }
+
+    private EquipEntiretyDTO getEquipEntirety(int total){
         EquipEntiretyDTO entiretyDTO = new EquipEntiretyDTO();
         // 设备总数
         EquipTotalityDTO totalityDTO = new EquipTotalityDTO();
         totalityDTO.setSum(total);
         Map<String,Object> tYear = new HashMap<>();
         Map<String,Object> tMonth = new HashMap<>();
-        String ySql = "SELECT count(*)as nums from t_sbdj WHERE DATE_FORMAT(create_time_,'%Y')=YEAR(CURDATE()) and di_dian_='%s' ";
-        String mSql = "SELECT count(*)as nums from t_sbdj WHERE DATE_FORMAT(create_time_,'%Y-%m')=CONCAT(YEAR(CURDATE()),'-',LPAD(MONTH(CURDATE()),2,'0')) and di_dian_='%s'";
-        ySql = String.format(ySql,getDiDian());
-        mSql = String.format(mSql,getDiDian());
+        String yCondition = " AND DATE_FORMAT(CREATE_TIME_,'%%Y')=YEAR(CURDATE()) ";
+        String mCondition = " AND DATE_FORMAT(CREATE_TIME_,'%%Y-%%m')=CONCAT(YEAR(CURDATE()),'-',LPAD(MONTH(CURDATE()),2,'0')) ";
+        String ySql = "select count(*)as nums from t_sbdj where di_dian_='%s' %s ";
+        String mSql = "select count(*)as nums from t_sbdj where di_dian_='%s' %s ";
+        ySql = String.format(ySql,getDiDian(),yCondition);
+        mSql = String.format(mSql,getDiDian(),mCondition);
         int yAdd = Integer.parseInt(commonDao.queryOne(ySql).get("nums").toString());
         int mAdd = Integer.parseInt(commonDao.queryOne(mSql).get("nums").toString());
+        // 报废停用
+        String wxsq = "SELECT count(*)as nums from t_sbtybfjlb WHERE shi_fou_guo_shen_='已完成' and chu_li_lei_xing_='停用' and di_dian_='%s' %s ";
+        // 维修申请停用
+        String tybf = "select count(*)as nums from t_sbwxsqb where shi_fou_guo_shen_='已完成' and shi_fou_ting_yong='是' and di_dian_='%s' %s ";
+        String ywxsq = String.format(wxsq,getDiDian(),yCondition);
+        String ytybf = String.format(tybf,getDiDian(),yCondition);
+        String mwxsq = String.format(wxsq,getDiDian(),mCondition);
+        String mtybf = String.format(tybf,getDiDian(),mCondition);
+        int ywxty = Integer.parseInt(commonDao.queryOne(ywxsq).get("nums").toString());
+        int ybfty = Integer.parseInt(commonDao.queryOne(ytybf).get("nums").toString());
+        int mwxty = Integer.parseInt(commonDao.queryOne(mwxsq).get("nums").toString());
+        int mbfty = Integer.parseInt(commonDao.queryOne(mtybf).get("nums").toString());
+        //  报废
+        String bfSql = "SELECT count(*)as nums from t_sbtybfjlb WHERE shi_fou_guo_shen_='已完成' and chu_li_lei_xing_='报废' and di_dian_='%s' %s ";
+        String ybfSql = String.format(bfSql,getDiDian(),yCondition);
+        String mbfSql = String.format(bfSql,getDiDian(),mCondition);
+        int ybfNums = Integer.parseInt(commonDao.queryOne(ybfSql).get("nums").toString());
+        int mbfNums = Integer.parseInt(commonDao.queryOne(mbfSql).get("nums").toString());
         // 本年
         tYear.put("add",yAdd);//  新增
-        tYear.put("outService","");// 停用
-        tYear.put("scrap","");//  报废
+        tYear.put("outService",ywxty+ybfty);// 停用
+        tYear.put("scrap",ybfNums);//  报废
         // 本月
         tMonth.put("add",mAdd);
-        tMonth.put("outService","");
-        tMonth.put("scrap","");
-
+        tMonth.put("outService",mwxty+mbfty);
+        tMonth.put("scrap",mbfNums);
+        totalityDTO.setMonth(tMonth);
+        totalityDTO.setYear(tYear);
+        entiretyDTO.setTotality(totalityDTO);
 
+        // 校准设备数
 
+        // 设备保养数
+        return entiretyDTO;
     }
 
 

+ 21 - 1
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/employee/persistence/entity/AdjustmentTbl.java

@@ -34,8 +34,28 @@ public class AdjustmentTbl extends AbstractPo<String>{
 	protected String  executor; 		/*执行人*/
 	@ApiModelProperty(value = "执行时间")
 	protected String  executeDate; 		/*执行时间*/
+	@ApiModelProperty(value = "概览")
+	protected String  overview;       /*概览*/
+	@ApiModelProperty(value = "排班ID")
+	protected String  scheduleId;     /*排班ID*/
 
-	public void setId(String id) 
+	public String getOverview() {
+		return overview;
+	}
+
+	public void setOverview(String overview) {
+		this.overview = overview;
+	}
+
+	public String getScheduleId() {
+		return scheduleId;
+	}
+
+	public void setScheduleId(String scheduleId) {
+		this.scheduleId = scheduleId;
+	}
+
+	public void setId(String id)
 	{
 		this.id = id;
 	}

+ 9 - 3
ibps-provider-root/modules/provider-business/src/main/resources/com/lc/ibps/employee/persistence/mapping/Adjustment.map.xml

@@ -15,17 +15,21 @@
 		<result property="status" column="STATUS" jdbcType="VARCHAR"/>
 		<result property="executor" column="EXECUTOR_" jdbcType="VARCHAR"/>
 		<result property="executeDate" column="EXECUTE_DATE_" jdbcType="VARCHAR"/>
+		<result property="overview" column="OVERVIEW_" jdbcType="VARCHAR"/>
+		<result property="scheduleId" column="SCHEDULE_ID_" jdbcType="VARCHAR"/>
 	</resultMap>
 	
 	<sql id="columns">
-		ID_,TENANT_ID_,IP_,CREATE_BY_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_,DI_DIAN_,REASON_,STATUS,EXECUTOR_,EXECUTE_DATE_
+		ID_,TENANT_ID_,IP_,CREATE_BY_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_,DI_DIAN_,REASON_,STATUS,EXECUTOR_,EXECUTE_DATE_,OVERVIEW_,SCHEDULE_ID_
 	</sql>
 	
 	<insert id="create" parameterType="com.lc.ibps.components.employee.persistence.entity.AdjustmentPo">
 		INSERT INTO T_ADJUSTMENT
 		(<include refid="columns"/>)
 		VALUES 
-		(#{id,jdbcType=VARCHAR}, #{tenantId,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{diDian,jdbcType=VARCHAR}, #{reason,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{executor,jdbcType=VARCHAR}, #{executeDate,jdbcType=VARCHAR})
+		(#{id,jdbcType=VARCHAR}, #{tenantId,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
+		#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{diDian,jdbcType=VARCHAR}, #{reason,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
+		#{executor,jdbcType=VARCHAR}, #{executeDate,jdbcType=VARCHAR},#{overview,jdbcType=VARCHAR}, #{scheduleId,jdbcType=VARCHAR})
 	</insert>
 	
 	<select id="get" parameterType="java.lang.String" resultMap="AdjustmentPo">
@@ -77,7 +81,9 @@
 		REASON_=#{reason,jdbcType=VARCHAR},
 		STATUS=#{status,jdbcType=VARCHAR},
 		EXECUTOR_=#{executor,jdbcType=VARCHAR},
-		EXECUTE_DATE_=#{executeDate,jdbcType=VARCHAR}
+		EXECUTE_DATE_=#{executeDate,jdbcType=VARCHAR},
+		OVERVIEW_=#{overview,jdbcType=VARCHAR},
+		SCHEDULE_ID_=#{scheduleId,jdbcType=VARCHAR}
 		WHERE
 		ID_=#{id}
 	</update>