ソースを参照

[bug-1909]岗前培训查询优化:根据头部选择的年份动态查询岗前计划信息

szjbdgzl 1 年間 前
コミット
99e8b7211d

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

@@ -0,0 +1,36 @@
+package com.lc.ibps.business.dto;
+
+import java.util.Map;
+
+public class EquipCalibrateDTO {
+
+    private int sum;
+
+    private Map<String,Object> year;
+
+    private Map<String,Object> month;
+
+    public int getSum() {
+        return sum;
+    }
+
+    public void setSum(int sum) {
+        this.sum = sum;
+    }
+
+    public Map<String, Object> getYear() {
+        return year;
+    }
+
+    public void setYear(Map<String, Object> year) {
+        this.year = year;
+    }
+
+    public Map<String, Object> getMonth() {
+        return month;
+    }
+
+    public void setMonth(Map<String, Object> month) {
+        this.month = month;
+    }
+}

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

@@ -0,0 +1,34 @@
+package com.lc.ibps.business.dto;
+
+public class EquipEntiretyDTO {
+
+    private EquipTotalityDTO totality;
+
+    private EquipCalibrateDTO calibrate;
+
+    private EquipUpKeepDTO upKeep;
+
+    public EquipTotalityDTO getTotality() {
+        return totality;
+    }
+
+    public void setTotality(EquipTotalityDTO totality) {
+        this.totality = totality;
+    }
+
+    public EquipCalibrateDTO getCalibrate() {
+        return calibrate;
+    }
+
+    public void setCalibrate(EquipCalibrateDTO calibrate) {
+        this.calibrate = calibrate;
+    }
+
+    public EquipUpKeepDTO getUpKeep() {
+        return upKeep;
+    }
+
+    public void setUpKeep(EquipUpKeepDTO upKeep) {
+        this.upKeep = upKeep;
+    }
+}

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

@@ -0,0 +1,36 @@
+package com.lc.ibps.business.dto;
+
+import java.util.Map;
+
+public class EquipTotalityDTO {
+
+    private int sum;
+
+    private Map<String,Object> year;
+
+    private Map<String,Object> month;
+
+    public Map<String, Object> getYear() {
+        return year;
+    }
+
+    public void setYear(Map<String, Object> year) {
+        this.year = year;
+    }
+
+    public Map<String, Object> getMonth() {
+        return month;
+    }
+
+    public void setMonth(Map<String, Object> month) {
+        this.month = month;
+    }
+
+    public int getSum() {
+        return sum;
+    }
+
+    public void setSum(int sum) {
+        this.sum = sum;
+    }
+}

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

@@ -0,0 +1,36 @@
+package com.lc.ibps.business.dto;
+
+import java.util.Map;
+
+public class EquipUpKeepDTO {
+
+    private int sum;
+
+    private Map<String,Object> year;
+
+    private Map<String,Object> month;
+
+    public int getSum() {
+        return sum;
+    }
+
+    public void setSum(int sum) {
+        this.sum = sum;
+    }
+
+    public Map<String, Object> getYear() {
+        return year;
+    }
+
+    public void setYear(Map<String, Object> year) {
+        this.year = year;
+    }
+
+    public Map<String, Object> getMonth() {
+        return month;
+    }
+
+    public void setMonth(Map<String, Object> month) {
+        this.month = month;
+    }
+}

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

@@ -13,6 +13,16 @@ public class EquipmentDashBoardDTO {
 
     private List<EquipServiceLifeDTO> lifeTimeData; // 部门设备寿命情况统计
 
+    private EquipEntiretyDTO entiretyData;//  设备调整情况
+
+    public EquipEntiretyDTO getEntiretyData() {
+        return entiretyData;
+    }
+
+    public void setEntiretyData(EquipEntiretyDTO entiretyData) {
+        this.entiretyData = entiretyData;
+    }
+
     public List<EquipServiceLifeDTO> getLifeTimeData() {
         return lifeTimeData;
     }

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

@@ -120,15 +120,17 @@ public class StatisticServiceImpl implements StatisticService {
         // 年 year  去年 lastYear  今年 nowYear
 
 
-        String dateCondition = "";
+        String dateCondition = "";String year = "";
 
         // 在岗培训人员统计情况
         if (dates.contains("-")){
+            year = dates.substring(0,4);
             // 月
             dashBoardDTO.setPxrytjqkDtoList(getYmdData(getAllDatesOfMonth(dates),dept,"month",""));
             dateCondition = String.format(" AND DATE_FORMAT(pei_xun_shi_jian_, '%%Y-%%m') = '%s'", dates);
         }else {
             // 年
+            year =dates;
             dashBoardDTO.setPxrytjqkDtoList(getYmdData(getYearMonth(),dept,"year",dates));
             dateCondition = String.format(" AND DATE_FORMAT(pei_xun_shi_jian_, '%%Y') = '%s'", dates);
         }
@@ -143,10 +145,10 @@ public class StatisticServiceImpl implements StatisticService {
         dashBoardDTO.setObjectDto(getObjectRate(dept,dateCondition));
 
         //  本年度岗前培训计划
-        dashBoardDTO.setNdgqpxList(getCurrentYearData(getYearMonth(),dept));
+        dashBoardDTO.setNdgqpxList(getCurrentYearData(getYearMonth(),dept,year));
 
         //  本年度岗前培训类别占比
-        dashBoardDTO.setYearPreWorkDto(getYearPre(dept));
+        dashBoardDTO.setYearPreWorkDto(getYearPre(dept,year));
 
         list.add(dashBoardDTO);
         return list;
@@ -169,7 +171,7 @@ public class StatisticServiceImpl implements StatisticService {
         //  部门设备寿命情况统计
         equipDTO.setLifeTimeData(getEquipServiceLife());
 
-        //  设备整情况
+        //  设备整情况
 
         //  各部门设备完好情况
 
@@ -183,6 +185,33 @@ public class StatisticServiceImpl implements StatisticService {
         return list;
     }
 
+    private void setEntirety(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());
+        int yAdd = Integer.parseInt(commonDao.queryOne(ySql).get("nums").toString());
+        int mAdd = Integer.parseInt(commonDao.queryOne(mSql).get("nums").toString());
+        // 本年
+        tYear.put("add",yAdd);//  新增
+        tYear.put("outService","");// 停用
+        tYear.put("scrap","");//  报废
+        // 本月
+        tMonth.put("add",mAdd);
+        tMonth.put("outService","");
+        tMonth.put("scrap","");
+
+
+
+    }
+
+
     public List<EquipServiceLifeDTO> getEquipServiceLife(){
         Set<String> existsDept = new HashSet<>();
         List<EquipServiceLifeDTO> lifeDTOList = new ArrayList<>();
@@ -343,9 +372,10 @@ public class StatisticServiceImpl implements StatisticService {
 
     public TrainGuardAutoPlanDto getPlanRate(String dept){
         TrainGuardAutoPlanDto planDto = new TrainGuardAutoPlanDto();
-        String zdSql = "select count(*) as auto from t_rypxcjb where ji_hua_wai_jian_ in(select id_ from t_ndrypxjhzb) and ji_hua_lei_xing_='在岗培训' %s";
+        String zdSql = "select count(*) as auto from t_rypxcjb where ji_hua_wai_jian_ in(select id_ from t_ndrypxjhzb " +
+                "where di_dian_='"+getDiDian()+"') and ji_hua_lei_xing_='在岗培训' %s";
         String zsSql = "select count(*) as total from t_rypxcjb where ji_hua_lei_xing_='在岗培训' %s ";
-        String dateCondition = String.format(" AND di_dian_ = '%s' ", getDiDian());
+        String dateCondition = String.format(" AND di_dian_ = '%s' and shi_fou_guo_shen_='已结束' ", getDiDian());
         if (BeanUtils.isNotEmpty(dept)){
             dateCondition += String.format(" AND bian_zhi_bu_men_ = '%s' ", dept);
         }
@@ -459,7 +489,7 @@ public class StatisticServiceImpl implements StatisticService {
         return typeDto;
     }
 
-    public TrainYearPreWorkDto getYearPre(String dept){
+    public TrainYearPreWorkDto getYearPre(String dept,String year){
         TrainYearPreWorkDto preWorkDto = new TrainYearPreWorkDto();
         preWorkDto.setRemark("本年度岗前培训类别占比");
         List<TrainRateDto> rateDtoList = new ArrayList<>();
@@ -471,6 +501,7 @@ public class StatisticServiceImpl implements StatisticService {
         if (BeanUtils.isNotEmpty(dept)){
             dateCondition += String.format(" AND bian_zhi_bu_men_ = '%s' ", dept);
         }
+        dateCondition += String.format(" AND DATE_FORMAT(pei_xun_shi_jian_,'%%Y-%%m')='%s' ", year);
         sql = String.format(sql,dateCondition);
         talSql = String.format(talSql,dateCondition);
         List<Map<String,Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
@@ -490,11 +521,10 @@ public class StatisticServiceImpl implements StatisticService {
         return preWorkDto;
     }
 
-    public List<Map<String, Object>> getCurrentYearData(List<String> dateStr, String dept) {
+    public List<Map<String, Object>> getCurrentYearData(List<String> dateStr, String dept,String year) {
         String baseSql = "SELECT count(*) AS total FROM t_rypxcjb WHERE ji_hua_lei_xing_ = '岗前培训' AND shi_fou_guo_shen_ = '已结束' and di_dian_='%s'";
         baseSql = String.format(baseSql,getDiDian());
         List<Map<String, Object>> list = new ArrayList<>();
-        int year = Year.now().getValue();
         for (String date : dateStr) {
             Map<String, Object> map = new HashMap<>();
             map.put("date", date + "月");

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

@@ -38,8 +38,20 @@ public class ScheduleConfigTbl extends AbstractPo<String>{
 	protected String  isEffective; 		/*是否生效*/
 	@ApiModelProperty(value = "是否审批")
 	protected String isApproval; 		/*是否审批*/
+	@ApiModelProperty(value = "配置名称")
+	protected String name; 		/*配置名称*/
 
-	public void setId(String id) 
+	@Override
+	public String getName() {
+		return name;
+	}
+
+	@Override
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public void setId(String id)
 	{
 		this.id = id;
 	}

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

@@ -18,17 +18,21 @@
 		<result property="approver" column="APPROVER_" jdbcType="VARCHAR"/>
 		<result property="isEffective" column="IS_EFFECTIVE_" jdbcType="VARCHAR"/>
 		<result property="isApproval" column="IS_APPROVAL_" jdbcType="VARCHAR"/>
+		<result property="name" column="name_" jdbcType="VARCHAR"/>
 	</resultMap>
 	
 	<sql id="columns">
-		ID_,TENANT_ID_,IP_,CREATE_BY_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_,DI_DIAN_,SCHEDULE_TYPE_,SCHEDULE_RULE_,SCHEDULE_SHIFT_,SCHEDULE_STAFF_,APPROVER_,IS_EFFECTIVE_,IS_APPROVAL_
+		ID_,TENANT_ID_,IP_,CREATE_BY_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_,DI_DIAN_,SCHEDULE_TYPE_,SCHEDULE_RULE_,SCHEDULE_SHIFT_,SCHEDULE_STAFF_,APPROVER_,IS_EFFECTIVE_,IS_APPROVAL_,NAME_
 	</sql>
 	
 	<insert id="create" parameterType="com.lc.ibps.components.employee.persistence.entity.ScheduleConfigPo">
 		INSERT INTO T_SCHEDULE_CONFIG
 		(<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}, #{scheduleType,jdbcType=BLOB}, #{scheduleRule,jdbcType=BLOB}, #{scheduleShift,jdbcType=BLOB}, #{scheduleStaff,jdbcType=BLOB}, #{approver,jdbcType=VARCHAR}, #{isEffective,jdbcType=VARCHAR}, #{isApproval,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},
+		#{scheduleType,jdbcType=BLOB}, #{scheduleRule,jdbcType=BLOB}, #{scheduleShift,jdbcType=BLOB}, #{scheduleStaff,jdbcType=BLOB},
+		#{approver,jdbcType=VARCHAR}, #{isEffective,jdbcType=VARCHAR}, #{isApproval,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR})
 	</insert>
 	
 	<select id="get" parameterType="java.lang.String" resultMap="ScheduleConfigPo">
@@ -83,7 +87,8 @@
 		SCHEDULE_STAFF_=#{scheduleStaff,jdbcType=BLOB},
 		APPROVER_=#{approver,jdbcType=VARCHAR},
 		IS_EFFECTIVE_=#{isEffective,jdbcType=VARCHAR},
-		IS_APPROVAL_=#{isApproval,jdbcType=VARCHAR}
+		IS_APPROVAL_=#{isApproval,jdbcType=VARCHAR},
+		NAME_=#{name,jdbcType=VARCHAR}
 		WHERE
 		ID_=#{id}
 	</update>