|
|
@@ -179,6 +179,7 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
|
|
|
// 各部门设备维护完成情况
|
|
|
|
|
|
+
|
|
|
// 各部门设备检定/校准完成情况
|
|
|
|
|
|
// 检验科设备停用/报废列表
|
|
|
@@ -188,6 +189,11 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ private List<EquipMaintenanceDTO> getEquipMaintenanceByDept(){
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
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 " +
|
|
|
@@ -302,52 +308,97 @@ public class StatisticServiceImpl implements StatisticService {
|
|
|
|
|
|
private EquipEntiretyDTO getEquipEntirety(int total){
|
|
|
EquipEntiretyDTO entiretyDTO = new EquipEntiretyDTO();
|
|
|
+ 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')) ";
|
|
|
// 设备总数
|
|
|
EquipTotalityDTO totalityDTO = new EquipTotalityDTO();
|
|
|
totalityDTO.setSum(total);
|
|
|
- Map<String,Object> tYear = new HashMap<>();
|
|
|
- Map<String,Object> tMonth = new HashMap<>();
|
|
|
- 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",ywxty+ybfty);// 停用
|
|
|
- tYear.put("scrap",ybfNums);// 报废
|
|
|
- // 本月
|
|
|
- tMonth.put("add",mAdd);
|
|
|
- tMonth.put("outService",mwxty+mbfty);
|
|
|
- tMonth.put("scrap",mbfNums);
|
|
|
- totalityDTO.setMonth(tMonth);
|
|
|
- totalityDTO.setYear(tYear);
|
|
|
+ String stopSQL= "SELECT COUNT(*) as nums from t_sbdj WHERE she_bei_zhuang_ta='停用' and di_dian_='%s'";
|
|
|
+ stopSQL = String.format(stopSQL,getDiDian());
|
|
|
+ int stopNums = Integer.parseInt(commonDao.queryOne(stopSQL).get("nums").toString());
|
|
|
+ totalityDTO.setStop(stopNums);
|
|
|
+ totalityDTO.setUse(total-stopNums);
|
|
|
entiretyDTO.setTotality(totalityDTO);
|
|
|
+// // 报废停用
|
|
|
+// 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 bfSql = "SELECT count(*)as nums from t_sbtybfjlb WHERE shi_fou_guo_shen_='已完成' and chu_li_lei_xing_='报废' and di_dian_='%s' %s ";
|
|
|
+
|
|
|
|
|
|
// 校准设备数
|
|
|
+ String finishSql = "SELECT id_ from t_mjsbjdxzjh WHERE shi_fou_guo_shen_='已完成' and di_dian_='%s' %s";
|
|
|
+ String planSql = "SELECT id_ from t_mjsbjdxzjh WHERE shi_fou_guo_shen_!='已完成' and di_dian_='%s' %s";
|
|
|
+ String jzSumSql = "SELECT id_ from t_mjsbjdxzjh WHERE di_dian_='%s' %s";
|
|
|
+ String subSql = "SELECT count(id_) as nums from (SELECT id_ from t_mjsbjdxzjhzb WHERE parent_id_ in(%s) " +
|
|
|
+ " or record_parentid_ in(%s) GROUP BY she_bei_bian_hao_) a";
|
|
|
+ String talSql = String.format(jzSumSql,getDiDian(),"");
|
|
|
+ // 总数
|
|
|
+ talSql = String.format(subSql,talSql,talSql);
|
|
|
+ int jzSums = Integer.parseInt(commonDao.queryOne(talSql).get("nums").toString());
|
|
|
+ // 当月已校准
|
|
|
+ String mFinishSql = String.format(finishSql,getDiDian(),mCondition);
|
|
|
+ mFinishSql = String.format(subSql,mFinishSql,mFinishSql);
|
|
|
+ int mAldyNum = Integer.parseInt(commonDao.queryOne(mFinishSql).get("nums").toString());
|
|
|
+ // 当月计划
|
|
|
+ String mPlanSql = String.format(planSql,getDiDian(),mCondition);
|
|
|
+ mPlanSql = String.format(subSql,mPlanSql,mPlanSql);
|
|
|
+ int mPlanNum = Integer.parseInt(commonDao.queryOne(mPlanSql).get("nums").toString());
|
|
|
+ // 下月计划
|
|
|
+ String nextCondition = "AND DATE_FORMAT(CREATE_TIME_,'%Y-%m')=DATE_FORMAT(DATE_ADD(CURRENT_DATE,INTERVAL 1 MONTH),'%Y-%m') ";
|
|
|
+ String nextPlanSql = String.format(planSql,getDiDian(),nextCondition);
|
|
|
+ nextPlanSql = String.format(subSql,nextPlanSql,nextPlanSql);
|
|
|
+ int nextPlanNum = Integer.parseInt(commonDao.queryOne(nextPlanSql).get("nums").toString());
|
|
|
+ // 本年计划
|
|
|
+ String yPlanSql = String.format(planSql,getDiDian(),yCondition);
|
|
|
+ yPlanSql = String.format(subSql,yPlanSql,yPlanSql);
|
|
|
+ int yPlanNum = Integer.parseInt(commonDao.queryOne(yPlanSql).get("nums").toString());
|
|
|
+ EquipCalibrateDTO calibrateDTO = new EquipCalibrateDTO();
|
|
|
+ calibrateDTO.setSum(jzSums);
|
|
|
+ calibrateDTO.setMonthAldyNum(mAldyNum);
|
|
|
+ calibrateDTO.setMonthPlanNum(mPlanNum);
|
|
|
+ calibrateDTO.setNextMonthPlanNum(nextPlanNum);
|
|
|
+ calibrateDTO.setYearPlanNum(yPlanNum);
|
|
|
+ entiretyDTO.setCalibrate(calibrateDTO);
|
|
|
|
|
|
// 设备保养数
|
|
|
+ String byFinishSql = "SELECT id_ from t_mjsbwhjhb where shi_fou_guo_shen_='已完成' and di_dian_='%s' %s";
|
|
|
+ String byPlanSql = "SELECT id_ from t_mjsbwhjhb where shi_fou_guo_shen_!='已完成' and di_dian_='%s' %s";
|
|
|
+ String bySql = "SELECT count(id_) as nums from (SELECT id_ from t_mjsbwhjhzb WHERE parent_id_ in(%s) GROUP BY yuan_she_bei_bian) a";
|
|
|
+ String bySumSql = "SELECT id_ from t_mjsbwhjhb WHERE di_dian_='%s' %s";
|
|
|
+ bySumSql = String.format(bySumSql,getDiDian(),"");
|
|
|
+ bySumSql = String.format(bySql,bySumSql);
|
|
|
+ int bySums = Integer.parseInt(commonDao.queryOne(bySumSql).get("nums").toString());
|
|
|
+
|
|
|
+ String mAldySql = String.format(byFinishSql,getDiDian(),mCondition);
|
|
|
+ mAldySql = String.format(bySql,mAldySql);
|
|
|
+ int mAldyByNum = Integer.parseInt(commonDao.queryOne(mAldySql).get("nums").toString());
|
|
|
+
|
|
|
+ String mPalnBySql = String.format(byPlanSql,getDiDian(),mCondition);
|
|
|
+ mPalnBySql = String.format(bySql,mPalnBySql);
|
|
|
+ int mPlanByNum = Integer.parseInt(commonDao.queryOne(mPalnBySql).get("nums").toString());
|
|
|
+
|
|
|
+ String yAldySql = String.format(byFinishSql,getDiDian(),yCondition);
|
|
|
+ yAldySql = String.format(bySql,yAldySql);
|
|
|
+ int yAldyByNum = Integer.parseInt(commonDao.queryOne(yAldySql).get("nums").toString());
|
|
|
+
|
|
|
+ String yPlanBySql = String.format(byPlanSql,getDiDian(),yCondition);
|
|
|
+ yPlanBySql = String.format(bySql,yPlanBySql);
|
|
|
+ int yPlanByNum = Integer.parseInt(commonDao.queryOne(yPlanBySql).get("nums").toString());
|
|
|
+
|
|
|
+ EquipUpKeepDTO upKeepDTO = new EquipUpKeepDTO();
|
|
|
+ upKeepDTO.setSum(bySums);
|
|
|
+ Map<String,Object> yByMap = new HashMap<>();
|
|
|
+ Map<String,Object> mByMap = new HashMap<>();
|
|
|
+ mByMap.put("upkeep",mAldyByNum);
|
|
|
+ mByMap.put("unUpkeep",mPlanByNum);
|
|
|
+ yByMap.put("upkeep",yAldyByNum);
|
|
|
+ yByMap.put("unUpkeep",yPlanByNum);
|
|
|
+ upKeepDTO.setMonth(mByMap);
|
|
|
+ upKeepDTO.setYear(yByMap);
|
|
|
+ entiretyDTO.setUpKeep(upKeepDTO);
|
|
|
+
|
|
|
return entiretyDTO;
|
|
|
}
|
|
|
|