Browse Source

设备大屏和巡检优化

guarantee-lsq 2 years ago
parent
commit
45d1d88255
18 changed files with 409 additions and 5 deletions
  1. 13 0
      platform-common/src/main/java/com/platform/common/util/BigDecimalUtil.java
  2. 43 0
      platform-dao/src/main/java/com/platform/dao/enums/RepairCategoryEnum.java
  3. 21 0
      platform-dao/src/main/java/com/platform/dao/mapper/repair/RepairApplicationFormMapper.java
  4. 2 0
      platform-dao/src/main/java/com/platform/dao/mapper/sb/SbInfoMapper.java
  5. 1 0
      platform-dao/src/main/java/com/platform/dao/vo/query/fill/FillGatherTaskDetailVO.java
  6. 38 0
      platform-dao/src/main/java/com/platform/dao/vo/repair/IndexStatisticVO.java
  7. 6 0
      platform-dao/src/main/java/com/platform/dao/vo/repair/RepairApplicationFormVO.java
  8. 2 1
      platform-dao/src/main/resources/mapper/fill/FillGatherTaskDetailMapper.xml
  9. 35 0
      platform-dao/src/main/resources/mapper/repair/RepairApplicationFormMapper.xml
  10. 18 0
      platform-dao/src/main/resources/mapper/sb/SbInfoMapper.xml
  11. 1 1
      platform-service/src/main/java/com/platform/service/business/impl/OutStoreFormActivitiServiceImpl.java
  12. 21 0
      platform-service/src/main/java/com/platform/service/repair/RepairApplicationFormService.java
  13. 15 0
      platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java
  14. 17 0
      platform-service/src/main/java/com/platform/service/util/SendMessageUtils.java
  15. 21 0
      platform-service/src/main/java/com/platform/service/wechat/model/request/WechatTemplateRequestBuilder.java
  16. 15 0
      platform-service/src/main/java/com/platform/service/wechat/util/WeChatMessageUtil.java
  17. 21 0
      platform-service/src/main/java/com/platform/service/workplace/IndexService.java
  18. 119 3
      platform-service/src/main/java/com/platform/service/workplace/impl/IndexServiceImpl.java

+ 13 - 0
platform-common/src/main/java/com/platform/common/util/BigDecimalUtil.java

@@ -148,6 +148,19 @@ public class BigDecimalUtil {
         return v1.divide(v2, scale, BigDecimal.ROUND_HALF_UP);
     }
 
+    public static BigDecimal divPercent(BigDecimal v1, BigDecimal v2, int scale) {
+        if (scale < 0) {
+            throw new IllegalArgumentException("The scale must be a positive integer or zero");
+        }
+        //被除数必须大于0
+        if (new BigDecimal(0).equals(v2)) {
+            throw new RuntimeException("The dividend must be greater than zero");
+        }
+        v1 = v1.multiply(new BigDecimal(100));
+        //BigDecimal.ROUND_HALF_UP表示四舍五入
+        return v1.divide(v2, scale, BigDecimal.ROUND_HALF_UP);
+    }
+
     /**
      * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 定精度,以后的数字四舍五入。
      *

+ 43 - 0
platform-dao/src/main/java/com/platform/dao/enums/RepairCategoryEnum.java

@@ -0,0 +1,43 @@
+package com.platform.dao.enums;
+
+import com.google.common.collect.Lists;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description 维修类别枚举
+ * @Author liuyu
+ * @Date 2020/05/05
+ * @Version Copyright (c) 2020,合肥乾元坤合科技有限公司 All rights reserved.
+ */
+@Getter
+@AllArgsConstructor
+public enum RepairCategoryEnum {
+    /**
+     * 计划性
+     */
+    PLAN(1,"计划性维修"),
+    /**
+     * 非计划性
+     */
+    PLAN_NOT(2,"非计划性维修"),
+    /**
+     * 日常维修
+     */
+    OTHER(3,"日常维修");
+    private final Integer value;
+    private final String name;
+
+    public static Map<String, Integer> toList() {
+        Map<String, Integer> maps = new HashMap<>();
+        //  一样, 唯一它帮你做的(其实是javac帮你做的), 就是自动推导(不是"倒")尖括号里的数据类型.
+        for (RepairCategoryEnum obj : RepairCategoryEnum.values()) {
+            maps.put(obj.getName(), obj.getValue());
+        }
+        return maps;
+    }
+}

+ 21 - 0
platform-dao/src/main/java/com/platform/dao/mapper/repair/RepairApplicationFormMapper.java

@@ -69,4 +69,25 @@ public interface RepairApplicationFormMapper extends MyMapper<RepairApplicationF
     RepairApplicationFormVO getFirstRepairApplicationFormVO(RepairApplicationFormDTO repairApplicationFormDTO);
 
     BigDecimal getRepairCount1(RepairApplicationFormDTO repairApplicationFormDTO);
+
+    /**
+     * 获取维修类别总数
+     * @param model
+     * @return
+     */
+    List<RepairApplicationFormVO> selectCountByCategory(RepairApplicationFormDTO model);
+
+    /**
+     * 各个车间维修数量倒序
+     * @param model
+     * @return
+     */
+    List<RepairApplicationFormVO> selectCountByPosition(RepairApplicationFormDTO model);
+
+    /**
+     * 获取维修单数量
+     * @param model
+     * @return
+     */
+    Integer countRepair(RepairApplicationFormDTO model);
 }

+ 2 - 0
platform-dao/src/main/java/com/platform/dao/mapper/sb/SbInfoMapper.java

@@ -163,4 +163,6 @@ public interface SbInfoMapper extends MyMapper<SbInfo> {
     void updateLongYanForInStore(SbInfoDTO sbInfoDTO);
 
     List<SbInfo> selectByPositionNo(String sbPositionNo);
+
+    Integer countNum(SbInfoDTO model);
 }

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/fill/FillGatherTaskDetailVO.java

@@ -71,6 +71,7 @@ public class FillGatherTaskDetailVO extends BaseVO implements Serializable {
     private String sbName; // 设备名称
     private String positionName; // 设备位置
     private String sbNo; // 设备编号
+    private String positionNo; // 设备位号
 
     /**
      * 排序 默认是 1

+ 38 - 0
platform-dao/src/main/java/com/platform/dao/vo/repair/IndexStatisticVO.java

@@ -0,0 +1,38 @@
+package com.platform.dao.vo.repair;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description
+ * @Author chenli
+ * @Date 2019/8/5
+ * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+public class IndexStatisticVO implements Serializable {
+
+   private BigDecimal repairNum;  // 维修数量
+
+   private BigDecimal repairCompleteRate; // 维修完成率
+
+   private BigDecimal calculateSbNum; // 计量设备数量
+
+   private BigDecimal calculateCompleteRate; // 计量检定完成率
+
+   private BigDecimal specialSbNum; // 特种设备数量
+
+   private BigDecimal specialCompleteRate; // 特种设备检定完成率
+
+   private BigDecimal hiddenDangerNum; // 隐患任务数量
+
+   private BigDecimal hiddenDangerCompleteRate; // 隐患转维修率
+
+   public IndexStatisticVO(){
+      this.repairNum = this.repairCompleteRate = this.calculateSbNum = this.calculateCompleteRate
+              = this.specialCompleteRate = this.specialSbNum = this.hiddenDangerNum = this.hiddenDangerCompleteRate = new BigDecimal(0);
+   }
+
+}

+ 6 - 0
platform-dao/src/main/java/com/platform/dao/vo/repair/RepairApplicationFormVO.java

@@ -446,4 +446,10 @@ public class RepairApplicationFormVO extends BaseVO implements Serializable {
      */
     private String positionNo;
 
+    private Integer repairNum;
+
+    private String categoryName;
+
+    private BigDecimal repairRate;
+
 }

+ 2 - 1
platform-dao/src/main/resources/mapper/fill/FillGatherTaskDetailMapper.xml

@@ -72,7 +72,8 @@
     </sql>
     <select id="selectList" parameterType="com.platform.dao.dto.fill.FillGatherTaskDetailDTO"
             resultType="com.platform.dao.vo.query.fill.FillGatherTaskDetailVO">
-        select fill.*,sb.name as sbName,sp.name as positionName,sb.no as sbNo from t_fill_gather_task_detail as fill
+        select fill.*,sb.name as sbName,sp.name as positionName,sb.no as sbNo,sb.positionNo as positionNo,
+         from t_fill_gather_task_detail as fill
         join t_sb_info sb on fill.sb_id = sb.id left join t_sb_position sp on sb.position_id = sp.id
         <where>
             <if test="taskId != null and taskId != ''">

+ 35 - 0
platform-dao/src/main/resources/mapper/repair/RepairApplicationFormMapper.xml

@@ -415,4 +415,39 @@
             </if>
         </where>
     </select>
+
+    <select id="selectCountByCategory" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
+            resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
+        select count(form.id) as repairNum,form.category from t_repair_application_form form
+        left join t_sb_info sb on form.sb_id = sb.id
+        <where>
+            <if test="positionId != null and positionId != ''">
+                and sb.position_id = #{positionId}
+            </if>
+        </where>
+        group form.category
+    </select>
+
+    <select id="selectCountByPosition" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
+            resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
+        select count(form.id) as repairNum, sb.position_id from t_repair_application_form form
+        left join t_sb_info sb on form.sb_id = sb.id group by sb.position_id order by repairNum desc
+    </select>
+
+    <select id="countRepair" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
+            resultType="java.lang.Integer">
+        select count(1) from t_repair_application_form form
+        left join t_sb_info sb on form.sb_id = sb.id
+        <where>
+            <if test="statusList != null and statusList.size > 0">
+                AND form.status in
+                <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="positionId != null and positionId != ''">
+                and sb.position_id = #{positionId}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 18 - 0
platform-dao/src/main/resources/mapper/sb/SbInfoMapper.xml

@@ -862,4 +862,22 @@ sb.scrap_user_name,sb.repair_dept_id
     <update id="updateLongYanForInStore" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
         update t_sb_info set status = #{status},position_id = null,positionNo = null,ppNo = null,parentId = null where id = #{id}
     </update>
+
+    <select id="countNum" parameterType="com.platform.dao.dto.sb.SbInfoDTO" resultType="java.lang.Integer">
+        select count(1) from t_sb_info
+        <where>
+            <if test="positionId != null and positionId != ''">
+                and position_id = #{positionId}
+            </if>
+            <if test="useType != null">
+                and use_type = #{useType}
+            </if>
+            <if test="isMeasure != null">
+                and is_measure = #{isMeasure}
+            </if>
+            <if test="measureStatus != null">
+                and measure_status = #{measureStatus}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 1 - 1
platform-service/src/main/java/com/platform/service/business/impl/OutStoreFormActivitiServiceImpl.java

@@ -127,7 +127,7 @@ public class OutStoreFormActivitiServiceImpl extends BaseFormCheckServiceAbstrac
         // 1、站内信
         sendWorkplaceAndEmailNew(mails,userIds,outForm.getId(),info, detailType);
         // 2、微信
-        SendMessageUtils.sendWechatNew(openIds,detailUrl,values,wechatTemplateId);
+        SendMessageUtils.sendWechatAudit(openIds,detailUrl,values,wechatTemplateId);
         // 3、短信
         SendMessageUtils.sendCommonSms(phones,info);
     }

+ 21 - 0
platform-service/src/main/java/com/platform/service/repair/RepairApplicationFormService.java

@@ -156,4 +156,25 @@ public interface RepairApplicationFormService extends IBaseService<RepairApplica
     MyVOPage<RepairApplicationFormVO> selectPoolPageInfoVO(RepairApplicationFormDTO record, int pageNum, int pageSize);
 
     void editErrorInfo(RepairApplicationFormDTO record);
+
+    /**
+     * 获取维修类别总数
+     * @param model
+     * @return
+     */
+    List<RepairApplicationFormVO> selectCountByCategory(RepairApplicationFormDTO model);
+
+    /**
+     * 各个车间维修数量倒序
+     * @param model
+     * @return
+     */
+    List<RepairApplicationFormVO> selectCountByPosition(RepairApplicationFormDTO model);
+
+    /**
+     * 获取维修单数量
+     * @param model
+     * @return
+     */
+    Integer countRepair(RepairApplicationFormDTO model);
 }

+ 15 - 0
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -638,6 +638,21 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
         mapper.updateByPrimaryKeySelective(form);
     }
 
+    @Override
+    public List<RepairApplicationFormVO> selectCountByCategory(RepairApplicationFormDTO model) {
+        return mapper.selectCountByCategory(model);
+    }
+
+    @Override
+    public List<RepairApplicationFormVO> selectCountByPosition(RepairApplicationFormDTO model) {
+        return mapper.selectCountByPosition(model);
+    }
+
+    @Override
+    public Integer countRepair(RepairApplicationFormDTO model) {
+        return mapper.countRepair(model);
+    }
+
     @Override
     public R getStoreForm(UserInfo userInfo) {
         InStoreFormDTO inStoreFormDTO=new InStoreFormDTO();

+ 17 - 0
platform-service/src/main/java/com/platform/service/util/SendMessageUtils.java

@@ -68,4 +68,21 @@ public class SendMessageUtils {
             }
         }
     }
+
+    public static void sendWechatAudit(List<String> openIds,String detailUrl,String[] values,String wechatTemplateId){
+        if (CollectionUtil.isNotEmpty(openIds)) {
+            String mobileDomain = ConfigCache.getLabelByValueAllowNull(SysConfigEnum.SYSTEM_DOMAIN_MOBILE.name());
+            if (StringUtils.isBlank(mobileDomain)) {
+                throw new BusinessException("请先设置系统域名地址,系统管理-》系统参数配置-》SYSTEM_DOMAIN_MOBILE");
+            }
+            if (!mobileDomain.endsWith("/")) {
+                mobileDomain = mobileDomain + "/";
+            }
+            detailUrl = mobileDomain + detailUrl;
+            for (String openId : openIds) {
+                log.info("开始发送微信通知,用户openId: " + openId);
+                WeChatMessageUtil.sendAuditWechatMessage(openId, detailUrl, values,wechatTemplateId);
+            }
+        }
+    }
 }

+ 21 - 0
platform-service/src/main/java/com/platform/service/wechat/model/request/WechatTemplateRequestBuilder.java

@@ -30,6 +30,11 @@ public class WechatTemplateRequestBuilder {
      */
     public static String[] TEMPLATE_KEYS_REPAIR = new String[]{"first", "keyword1", "keyword2","keyword3", "keyword4", "remark"};
 
+	/**
+	 * 审批提醒模板keys 模板ID:njA6sdMf0EPi1k8iruwe2aw0miH6q-0AvB_GCEyzJpE  审批提醒
+	 */
+	public static String[] TEMPLATE_KEYS_AUDIT = new String[]{"first", "keyword1", "keyword2","keyword3", "remark"};
+
     /**
 	 * 修改提醒模板keys 模板6VegnWIea-Gj1F1GeLPFlekkznoPaqS-vs1H-liFp10  修改提醒
 	 */
@@ -277,4 +282,20 @@ public class WechatTemplateRequestBuilder {
         return wechatTemplateRequest;
     }
 
+	public static WechatTemplateRequest getAuditRequest(String url, String templateId, String openId, String[] values, String[] colors) {
+		WechatTemplateRequest wechatTemplateRequest = new WechatTemplateRequest();
+		wechatTemplateRequest.setUrl(url);
+		wechatTemplateRequest.setTemplate_id(templateId);
+		wechatTemplateRequest.setTouser(openId);
+		// 填充模版数据
+		Map<String, WechatTemplateRequestData> m = new HashMap<String, WechatTemplateRequestData>();
+		for (int i = 0; i < TEMPLATE_KEYS_AUDIT.length; i++) {
+			WechatTemplateRequestData data = new WechatTemplateRequestData();
+			data.setValue(values[i]);
+			data.setColor(colors[i]);
+			m.put(TEMPLATE_KEYS_AUDIT[i], data);
+		}
+		wechatTemplateRequest.setData(m);
+		return wechatTemplateRequest;
+	}
 }

+ 15 - 0
platform-service/src/main/java/com/platform/service/wechat/util/WeChatMessageUtil.java

@@ -131,6 +131,21 @@ public class WeChatMessageUtil {
         }
     }
 
+    public static void sendAuditWechatMessage(String openId, String url, String[] values,String wechatTemplateId) {
+        try {
+            if(StringUtils.isBlank(url)){
+                throw new DeniedException("跳转详情url不能为空");
+            }
+            if (isSend() && StringUtils.isNotBlank(openId)) {
+                String[] colors = getColors(values.length);
+                WechatTemplateRequest request = WechatTemplateRequestBuilder.getAuditRequest(url, wechatTemplateId,openId, values, colors);
+                SpringContextHolder.publishEvent(new WechatEvent(request));
+            }
+        } catch (Exception e) {
+            log.error("发送微信消息失败", e);
+        }
+    }
+
     /**
      * 获取微信colors
      * @param length

+ 21 - 0
platform-service/src/main/java/com/platform/service/workplace/IndexService.java

@@ -24,4 +24,25 @@ public interface IndexService {
      * @return
      */
     R getWorkplaceWeekData(String roleCode);
+
+    /**
+     * 获取维修类别统计
+     * @param positionId
+     * @return
+     */
+    R getStatisticRepairCategory(String positionId);
+
+    /**
+     * 获取统计数据
+     * @param positionId
+     * @return
+     */
+    R getStatisticData(String positionId);
+
+    /**
+     * 统计厂区各车间维修数据和占比率
+     * @return
+     */
+    R getStatisticRepairNum();
+
 }

+ 119 - 3
platform-service/src/main/java/com/platform/service/workplace/impl/IndexServiceImpl.java

@@ -1,9 +1,16 @@
 package com.platform.service.workplace.impl;
 
 import com.platform.common.constant.CommonConstants;
-import com.platform.common.util.DateUtils;
-import com.platform.common.util.R;
-import com.platform.common.util.SecurityUtils;
+import com.platform.common.util.*;
+import com.platform.dao.dto.repair.RepairApplicationFormDTO;
+import com.platform.dao.dto.sb.SbInfoDTO;
+import com.platform.dao.enums.RepairApplicationFormStatusEnum;
+import com.platform.dao.enums.RepairCategoryEnum;
+import com.platform.dao.enums.SbUseType;
+import com.platform.dao.enums.YesNoEnum;
+import com.platform.dao.mapper.sb.SbInfoMapper;
+import com.platform.dao.vo.repair.IndexStatisticVO;
+import com.platform.dao.vo.repair.RepairApplicationFormVO;
 import com.platform.service.repair.RepairApplicationFormService;
 import com.platform.service.repair.RepairFeeService;
 import com.platform.service.sqarepartmanage.SparePartInfoService;
@@ -12,7 +19,10 @@ import com.platform.service.workplace.IndexService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Map;
 
 @Service("indexService")
 public class IndexServiceImpl implements IndexService {
@@ -24,6 +34,8 @@ public class IndexServiceImpl implements IndexService {
     private InStoreFormService inStoreFormService;
     @Resource
     private SparePartInfoService sparePartInfoService;
+    @Resource
+    private SbInfoMapper sbInfoMapper;
 
 
     @Override
@@ -92,4 +104,108 @@ public class IndexServiceImpl implements IndexService {
         }
         return r;
     }
+
+    @Override
+    public R getStatisticRepairCategory(String positionId) {
+        RepairApplicationFormDTO model = new RepairApplicationFormDTO();
+        model.setPositionId(positionId);
+        List<RepairApplicationFormVO> list = repairApplicationFormService.selectCountByCategory(model);
+        List<RepairApplicationFormVO> result = ListUtils.newArrayList();
+        Map<String, Integer> enums = RepairCategoryEnum.toList();
+        for(Map.Entry<String,Integer> entry : enums.entrySet()){
+            RepairApplicationFormVO vo = new RepairApplicationFormVO();
+            vo.setRepairNum(0);
+            vo.setCategory(entry.getValue());
+            vo.setCategoryName(entry.getKey());
+            result.add(vo);
+        }
+        if(list != null && list.size() > 0){
+            for(RepairApplicationFormVO tempVO : list){
+                // 拿到数据库中的值和返回集合对比,替换
+                for(RepairApplicationFormVO tempFinal : result){
+                    if(tempVO.getCategory().equals(tempFinal.getCategory())){
+                        tempFinal.setRepairNum(tempVO.getRepairNum());
+                        break;
+                    }
+                }
+            }
+        }
+        return new R(result);
+    }
+
+    @Override
+    public R getStatisticData(String positionId) {
+        IndexStatisticVO vo = new IndexStatisticVO();
+        R r = new R();
+        // 维修和完成率
+        RepairApplicationFormDTO repairQuery = new RepairApplicationFormDTO();
+        repairQuery.setPositionId(positionId);
+        Integer repairNum = repairApplicationFormService.countRepair(repairQuery); // 维修总数
+        vo.setRepairNum(new BigDecimal(repairNum));
+        List<Integer> statusList = ListUtils.newArrayList();
+        statusList.add(RepairApplicationFormStatusEnum.FINISHED.getValue());
+        statusList.add(RepairApplicationFormStatusEnum.MM_REPAIR_CLOSE.getValue());
+        repairQuery.setStatusList(statusList);
+        Integer finishNum = repairApplicationFormService.countRepair(repairQuery); // 完成总数
+        vo.setRepairCompleteRate(BigDecimalUtil.divPercent(new BigDecimal(finishNum),vo.getRepairNum(),2));
+        // 特种设备和检定完成率
+        SbInfoDTO sbQuery = new SbInfoDTO();
+        sbQuery.setUseType(SbUseType.TZSB.getValue());
+        sbQuery.setPositionId(positionId);
+        sbQuery.setIsMeasure(YesNoEnum.YES.getValue());
+        Integer specialTotal = sbInfoMapper.countNum(sbQuery);
+        vo.setSpecialSbNum(new BigDecimal(specialTotal)); // 特种设备总数
+        sbQuery.setMeasureStatus(YesNoEnum.YES.getValue()); // 待检定
+        Integer waitNum = sbInfoMapper.countNum(sbQuery); // 待检定数量
+        vo.setSpecialCompleteRate(BigDecimalUtil.divPercent(new BigDecimal(specialTotal - waitNum),vo.getSpecialSbNum(),2));
+        // 计量设备和检定完成率
+        sbQuery.setUseType(SbUseType.BGCL.getValue());
+        sbQuery.setMeasureStatus(null);
+        Integer bgclTotal = sbInfoMapper.countNum(sbQuery); // 计量设备总数
+        vo.setCalculateSbNum(new BigDecimal(bgclTotal));
+        sbQuery.setMeasureStatus(YesNoEnum.YES.getValue()); // 待检定
+        Integer waitBgclNum = sbInfoMapper.countNum(sbQuery); // 待检定数量
+        vo.setSpecialCompleteRate(BigDecimalUtil.divPercent(new BigDecimal(bgclTotal - waitBgclNum),vo.getCalculateSbNum(),2));
+        // 隐患和转维修率
+
+        return r.setData(vo);
+    }
+
+    @Override
+    public R getStatisticRepairNum() {
+        R r = new R();
+        List<RepairApplicationFormVO> result = ListUtils.newArrayList();
+        // 获取各个车间的报修数量和占比情况
+        List<RepairApplicationFormVO> list = repairApplicationFormService.selectCountByPosition(new RepairApplicationFormDTO());
+        if(list != null && list.size() > 0){
+            // 获取总数
+            int totalNum = 0;
+            for(int i=0;i<list.size();i++){
+                RepairApplicationFormVO vo = list.get(i);
+                totalNum += vo.getRepairNum();
+                if(i <= 5){
+                    result.add(list.get(i));
+                }
+            }
+            // 计算占比
+            calculate(result,totalNum);
+            r.setData(result);
+        }else{
+            r.setData(null);
+        }
+        return r;
+    }
+
+    /**
+     * 计算车间维修占比
+     * @param result
+     * @param totalNum
+     */
+    private void calculate(List<RepairApplicationFormVO> result,int totalNum){
+        BigDecimal total = new BigDecimal(totalNum);
+        result.forEach(item -> {
+            item.setRepairRate(BigDecimalUtil.divPercent(new BigDecimal(item.getRepairNum()),total,2));
+        });
+    }
+
 }