Merge remote-tracking branch 'origin/master'
| | |
| | | String DICT_EQUIPMENT_RATE_NORMAL = "equipment_rate_normal"; |
| | | |
| | | /** |
| | | * é
éå°ç»åå
¸ç¼å· |
| | | */ |
| | | String DICT_MDC_STAFF_TEAM = "mdc_staff_team"; |
| | | |
| | | /** |
| | | * å çæ°æ® èªå¨è®¡ç®æ è¯ 1(æ¯) 2(å¦) |
| | | */ |
| | | Integer AUTO_FLAG_Y = 1; |
| | |
| | | String CLOSE_TYPE_0 = "0"; |
| | | String CLOSE_TYPE_1 = "1"; |
| | | |
| | | String ORG_TYPE = "3"; |
| | | |
| | | } |
| | |
| | | |
| | | /**éæ©ç³»ç»ç±»å*/ |
| | | private transient String systemValue; |
| | | |
| | | @Dict(dicCode = "mdc_staff_team") |
| | | @ApiModelProperty(value = "é
éå°ç»") |
| | | private String teamCode; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | MdcEquipmentDetailedDto findById(@Param("id") String id); |
| | | |
| | | List<MdcEquipment> findByProductionIds(@Param("mdcProductionIds") List<String> mdcProductionIds); |
| | | |
| | | List<MdcEquipment> findByProIdsAndTeamCode(@Param("mdcProductionIds") List<String> mdcProductionIds, @Param("teamCodeList") List<String> teamCodeList); |
| | | |
| | | } |
| | |
| | | ORDER BY me.equipment_id |
| | | </select> |
| | | |
| | | <select id="findByProductionIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipment"> |
| | | SELECT |
| | | t1.* |
| | | FROM |
| | | mdc_equipment t1 |
| | | LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id |
| | | WHERE t2.production_id IN |
| | | <foreach collection="mdcProductionIds" item = "productionId" index = "index" open = "(" close= ")" separator = ","> |
| | | #{productionId} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="findByProIdsAndTeamCode" resultType="org.jeecg.modules.mdc.entity.MdcEquipment"> |
| | | SELECT |
| | | t1.* |
| | | FROM |
| | | mdc_equipment t1 |
| | | LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id |
| | | WHERE t2.production_id IN |
| | | <foreach collection="mdcProductionIds" item = "productionId" index = "index" open = "(" close= ")" separator = ","> |
| | | #{productionId} |
| | | </foreach> |
| | | AND t1.team_code IN |
| | | <foreach collection="teamCodeList" item = "teamCode" index = "index" open = "(" close= ")" separator = ","> |
| | | #{teamCode} |
| | | </foreach> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | * @param productionId |
| | | */ |
| | | void addNewEquipmentFromEam(MdcEquipment mdcEquipment, String productionId); |
| | | |
| | | /** |
| | | * æ ¹æ®äº§çº¿idéåæ¥è¯¢è®¾å¤å表 |
| | | * @param mdcProductionIds |
| | | * @return |
| | | */ |
| | | List<MdcEquipment> findByProductionIds(List<String> mdcProductionIds); |
| | | |
| | | /** |
| | | * æ ¹æ®äº§çº¿idéååé
éå°ç»æ¥è¯¢è®¾å¤å表 |
| | | * @param allProductionIds |
| | | * @param teamCodelist |
| | | * @return |
| | | */ |
| | | List<MdcEquipment> findByProIdsAndTeamCode(List<String> allProductionIds, List<String> teamCodelist); |
| | | } |
| | |
| | | this.saveMdcEquipment(mdcEquipment, null, productionId); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®äº§çº¿idéåæ¥è¯¢è®¾å¤å表 |
| | | * @param mdcProductionIds |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MdcEquipment> findByProductionIds(List<String> mdcProductionIds) { |
| | | return this.baseMapper.findByProductionIds(mdcProductionIds); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®äº§çº¿idéååé
éå°ç»æ¥è¯¢è®¾å¤å表 |
| | | * @param mdcProductionIds |
| | | * @param teamCodeList |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MdcEquipment> findByProIdsAndTeamCode(List<String> mdcProductionIds, List<String> teamCodeList) { |
| | | return this.baseMapper.findByProIdsAndTeamCode(mdcProductionIds, teamCodeList); |
| | | } |
| | | |
| | | } |
| | |
| | | public static final String STR_DATE = "yyyy-MM-dd"; |
| | | public static final String STRDATE = "yyyyMMdd"; |
| | | public static final String STR_YEAR_MONTH = "yyyy-MM"; |
| | | public static final String STRYEARMONTH = "yyyyMM"; |
| | | public static final String STR_DATE_TIME = "yyyy-MM-dd HH:mm:ss.SSS"; |
| | | public static final String STR_DATE_TIME_SMALL = "yyyy-MM-dd HH:mm:ss"; |
| | | public static final String STR_DATE_TIME_MIN = "yyyy-MM-dd HH:mm"; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.dto.ComparativeAnalysisDto; |
| | | import org.jeecg.modules.mdc.dto.DayUtilizationRateDto; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author: LiuS |
| | |
| | | @Resource |
| | | private MdcEfficiencyReportService mdcEfficiencyReportService; |
| | | |
| | | @AutoLog(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çå表æ¥è¯¢") |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çå表æ¥è¯¢", notes = "è®¾å¤æçæ¥è¡¨-å©ç¨çå表æ¥è¯¢") |
| | | @GetMapping("/efficiencyList") |
| | | public Result efficiencyList(MdcEfficiencyReportQueryVo vo) { |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @AutoLog(value = "è®¾å¤æçæ¥è¡¨-å¼å¨çå表æ¥è¯¢") |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-å¼å¨çå表æ¥è¯¢", notes = "è®¾å¤æçæ¥è¡¨-å¼å¨çå表æ¥è¯¢") |
| | | @GetMapping("/efficiencyPOList") |
| | | public Result efficiencyPOList(MdcEfficiencyReportQueryVo vo) { |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @AutoLog(value = "è®¾å¤æçæ¥è¡¨-çæ¬¡å©ç¨çå表æ¥è¯¢") |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-çæ¬¡å©ç¨çå表æ¥è¯¢", notes = "è®¾å¤æçæ¥è¡¨-çæ¬¡å©ç¨çå表æ¥è¯¢") |
| | | @GetMapping("/efficiencyShiftList") |
| | | public Result efficiencyShiftList(MdcEfficiencyReportShiftQueryVo vo) { |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @AutoLog(value = "è®¾å¤æçæ¥è¡¨-ç»è®¡åæå表") |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-ç»è®¡åæå表", notes = "è®¾å¤æçæ¥è¡¨-ç»è®¡åæå表") |
| | | @GetMapping("/dayStatisticalRate") |
| | | public Result dayStatisticalRate(MdcEfficiencyReportQueryVo vo) { |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @AutoLog(value = "è®¾å¤æçæ¥è¡¨-对æ¯åæ") |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-对æ¯åæ", notes = "è®¾å¤æçæ¥è¡¨-对æ¯åæ") |
| | | @GetMapping("/comparativeAnalysis") |
| | | public Result comparativeAnalysis(ComparativeAnalysisQueryVo vo) { |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @AutoLog(value = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç") |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç", notes = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç") |
| | | @GetMapping("/dayUtilizationRate") |
| | | public Result dayUtilizationRate(DayUtilizationRateQueryVo vo) { |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @AutoLog(value = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç对æ¯") |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç对æ¯", notes = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç对æ¯") |
| | | @GetMapping("/dayUtilizationRateContrast") |
| | | public Result dayUtilizationRateContrast(DayUtilizationRateContrastQueryVo vo) { |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @AutoLog(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çèµ°å¿åæå表") |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çèµ°å¿åæå表", notes = "è®¾å¤æçæ¥è¡¨-å©ç¨çèµ°å¿åæå表") |
| | | @GetMapping("/utilizationRateTrendAnalyze") |
| | | public Result utilizationRateTrendAnalyze(DayUtilizationRateContrastQueryVo vo) { |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @AutoLog(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çåæ®µåæå表") |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çåæ®µåæå表", notes = "è®¾å¤æçæ¥è¡¨-å©ç¨çåæ®µåæå表") |
| | | @GetMapping("/utilizationRateSectionAnalyze") |
| | | public Result utilizationRateSectionAnalyze(DayUtilizationRateContrastQueryVo vo) { |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | // @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-综åå©ç¨çç»è®¡åæ", notes = "è®¾å¤æçæ¥è¡¨-综åå©ç¨çç»è®¡åæ") |
| | | // @GetMapping("/comprehensiveRayeAnalyze") |
| | | // public Result comprehensiveRayeAnalyze(DayUtilizationRateContrastQueryVo vo) { |
| | | // LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | // String userId = user.getId(); |
| | | // MdcUtilizationRateDto result = mdcEfficiencyReportService.comprehensiveRayeAnalyze(userId, vo); |
| | | // return Result.OK(result); |
| | | // } |
| | | |
| | | // @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-çç»ç»¼åå©ç¨çç»è®¡åæ", notes = "è®¾å¤æçæ¥è¡¨-综åå©ç¨çç»è®¡åæ") |
| | | // @GetMapping("/teamComprehensiveRateAnalyze") |
| | | // public Result teamComprehensiveRateAnalyze(DayUtilizationRateContrastQueryVo vo) { |
| | | // LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | // String userId = user.getId(); |
| | | // MdcUtilizationRateDto result = mdcEfficiencyReportService.teamComprehensiveRateAnalyze(userId, vo); |
| | | // return Result.OK(result);Equipment utilization distribution of each team |
| | | // } |
| | | |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-é
éå°ç»ç»´åº¦åçç»æè®¾å¤å©ç¨åå¸", notes = "è®¾å¤æçæ¥è¡¨-é
éå°ç»ç»´åº¦åçç»æè®¾å¤å©ç¨åå¸") |
| | | @GetMapping("/teamEquipmentEfficiencyAnalyze") |
| | | public Result<?> teamEquipmentEfficiencyAnalyze(EquEffVo equEffVo) { |
| | | Map<String, Object> result = mdcEfficiencyReportService.teamEquipmentEfficiencyAnalyze(equEffVo); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-设å¤ç»´åº¦åçç»æè®¾å¤å©ç¨åå¸", notes = "è®¾å¤æçæ¥è¡¨-设å¤ç»´åº¦åçç»æè®¾å¤å©ç¨åå¸") |
| | | @GetMapping("/equipmentEfficiencyAnalyze") |
| | | public Result<?> equipmentEfficiencyAnalyze(EquEffVo equEffVo) { |
| | | Map<String, Object> result = mdcEfficiencyReportService.equipmentEfficiencyAnalyze(equEffVo); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; |
| | | import org.jeecg.modules.mdc.model.MdcEquipmentTree; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-03-26 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class EquipmentEfficiencyAnalyzeDto { |
| | | |
| | | private String equipmentName; |
| | | |
| | | /** |
| | | * å©ç¨ç |
| | | */ |
| | | private BigDecimal utilizationRate = BigDecimal.ZERO; |
| | | /** |
| | | * çæ¬¡å©ç¨ç |
| | | */ |
| | | private BigDecimal shiftUtilizationRate = BigDecimal.ZERO; |
| | | /** |
| | | * ä¿®æ£å©ç¨ç |
| | | */ |
| | | private BigDecimal amendUtilizationRate = BigDecimal.ZERO; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-03-25 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class MdcEquipmentStatisticalDto { |
| | | |
| | | /** |
| | | * 弿ºæ¶é¿ |
| | | */ |
| | | private BigDecimal openLong = new BigDecimal("0"); |
| | | /** |
| | | * å¾
æºæ¶é¿ |
| | | */ |
| | | private BigDecimal waitLong = new BigDecimal("0"); |
| | | /** |
| | | * å å·¥æ¶é¿ |
| | | */ |
| | | private BigDecimal processLong = new BigDecimal("0"); |
| | | /** |
| | | * æ¥è¦ |
| | | */ |
| | | private BigDecimal errorLong = new BigDecimal("0"); |
| | | /** |
| | | * å
³æºæ¶é¿ |
| | | */ |
| | | private BigDecimal closeLong = new BigDecimal("0"); |
| | | /** |
| | | * æ»æ¶é¿ |
| | | */ |
| | | private BigDecimal totalLong = new BigDecimal("0"); |
| | | /** |
| | | * å¤©æ° |
| | | */ |
| | | private BigDecimal dayNum; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-03-28 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class TeamEquEffDto { |
| | | |
| | | private String teamCode; |
| | | |
| | | /** |
| | | * å©ç¨ç |
| | | */ |
| | | private BigDecimal utilizationRate = BigDecimal.ZERO; |
| | | /** |
| | | * çæ¬¡å©ç¨ç |
| | | */ |
| | | private BigDecimal shiftUtilizationRate = BigDecimal.ZERO; |
| | | /** |
| | | * ä¿®æ£å©ç¨ç |
| | | */ |
| | | private BigDecimal amendUtilizationRate = BigDecimal.ZERO; |
| | | |
| | | public TeamEquEffDto() { |
| | | } |
| | | |
| | | public TeamEquEffDto(String teamCode, BigDecimal utilizationRate, BigDecimal shiftUtilizationRate, BigDecimal amendUtilizationRate) { |
| | | this.teamCode = teamCode; |
| | | this.utilizationRate = utilizationRate; |
| | | this.shiftUtilizationRate = shiftUtilizationRate; |
| | | this.amendUtilizationRate = amendUtilizationRate; |
| | | } |
| | | |
| | | public TeamEquEffDto(BigDecimal utilizationRate, BigDecimal shiftUtilizationRate, BigDecimal amendUtilizationRate) { |
| | | this.utilizationRate = utilizationRate; |
| | | this.shiftUtilizationRate = shiftUtilizationRate; |
| | | this.amendUtilizationRate = amendUtilizationRate; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.dto; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-03-28 |
| | | * @Description: |
| | | */ |
| | | public class UtilizationRateAvg { |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Description: æè®¾å¤è¿è¡æ°æ®è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2025-03-25 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @TableName("mdc_equipment_statistical_info_month") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "mdc_equipment_statistical_info_month对象", description = "æè®¾å¤è¿è¡æ°æ®è¡¨") |
| | | public class MdcEquipmentStatisticalInfoMonth implements Serializable { |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | @ApiModelProperty(value = "主é®") |
| | | private String id; |
| | | /** |
| | | * 设å¤id |
| | | */ |
| | | @Excel(name = "设å¤id", width = 15) |
| | | @ApiModelProperty(value = "设å¤id") |
| | | private String equipmentId; |
| | | /** |
| | | * æææä»½ |
| | | */ |
| | | @Excel(name = "æææä»½", width = 15) |
| | | @ApiModelProperty(value = "æææä»½") |
| | | private String theMonth; |
| | | /** |
| | | * 弿ºæ¶é¿ |
| | | */ |
| | | @Excel(name = "弿ºæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "弿ºæ¶é¿") |
| | | private Integer openLong; |
| | | /** |
| | | * å
³æºæ¶é¿ |
| | | */ |
| | | @Excel(name = "å
³æºæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "å
³æºæ¶é¿") |
| | | private Integer closeLong; |
| | | /** |
| | | * å¾
æºæ¶é¿ |
| | | */ |
| | | @Excel(name = "å¾
æºæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "å¾
æºæ¶é¿") |
| | | private Integer waitLong; |
| | | /** |
| | | * å å·¥æ¶é¿ |
| | | */ |
| | | @Excel(name = "å å·¥æ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "å å·¥æ¶é¿") |
| | | private Integer processLong; |
| | | /** |
| | | * æ¥è¦æ¶é¿ |
| | | */ |
| | | @Excel(name = "æ¥è¦æ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "æ¥è¦æ¶é¿") |
| | | private Integer errorLong; |
| | | /** |
| | | * å©ç¨ç |
| | | */ |
| | | @Excel(name = "å©ç¨ç", width = 15) |
| | | @ApiModelProperty(value = "å©ç¨ç") |
| | | private BigDecimal utilizationRate; |
| | | /** |
| | | * å¼å¨ç |
| | | */ |
| | | @Excel(name = "å¼å¨ç", width = 15) |
| | | @ApiModelProperty(value = "å¼å¨ç") |
| | | private BigDecimal startRate; |
| | | /** |
| | | * 弿ºç |
| | | */ |
| | | @Excel(name = "弿ºç", width = 15) |
| | | @ApiModelProperty(value = "弿ºç") |
| | | private BigDecimal openRate; |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Excel(name = "å建æ¶é´", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Description: æç次设å¤è¿è¡æ°æ®è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2025-03-25 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @TableName("mdc_equipment_statistical_shift_info_month") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "mdc_equipment_statistical_shift_info_month对象", description = "æç次设å¤è¿è¡æ°æ®è¡¨") |
| | | public class MdcEquipmentStatisticalShiftInfoMonth implements Serializable { |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | @ApiModelProperty(value = "主é®") |
| | | private String id; |
| | | /** |
| | | * 设å¤id |
| | | */ |
| | | @Excel(name = "设å¤id", width = 15) |
| | | @ApiModelProperty(value = "设å¤id") |
| | | private String equipmentId; |
| | | /** |
| | | * æææä»½ |
| | | */ |
| | | @Excel(name = "æææä»½", width = 15) |
| | | @ApiModelProperty(value = "æææä»½") |
| | | private String theMonth; |
| | | /** |
| | | * å
³æºæ¶é¿ |
| | | */ |
| | | @Excel(name = "å
³æºæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "å
³æºæ¶é¿") |
| | | private Integer closeLong; |
| | | /** |
| | | * 弿ºæ¶é¿ |
| | | */ |
| | | @Excel(name = "弿ºæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "弿ºæ¶é¿") |
| | | private Integer openLong; |
| | | /** |
| | | * æ¥è¦æ¶é¿ |
| | | */ |
| | | @Excel(name = "æ¥è¦æ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "æ¥è¦æ¶é¿") |
| | | private Integer errorLong; |
| | | /** |
| | | * å¾
æºæ¶é¿ |
| | | */ |
| | | @Excel(name = "å¾
æºæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "å¾
æºæ¶é¿") |
| | | private Integer waitLong; |
| | | /** |
| | | * å å·¥æ¶é¿ |
| | | */ |
| | | @Excel(name = "å å·¥æ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "å å·¥æ¶é¿") |
| | | private Integer processLong; |
| | | /** |
| | | * æææ¶é¿ |
| | | */ |
| | | @Excel(name = "æææ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "æææ¶é¿") |
| | | private Integer totalLong; |
| | | /** |
| | | * å©ç¨ç |
| | | */ |
| | | @Excel(name = "å©ç¨ç", width = 15) |
| | | @ApiModelProperty(value = "å©ç¨ç") |
| | | private BigDecimal utilizationRate; |
| | | /** |
| | | * å¼å¨ç |
| | | */ |
| | | @Excel(name = "å¼å¨ç", width = 15) |
| | | @ApiModelProperty(value = "å¼å¨ç") |
| | | private BigDecimal startRate; |
| | | /** |
| | | * 弿ºç |
| | | */ |
| | | @Excel(name = "弿ºç", width = 15) |
| | | @ApiModelProperty(value = "弿ºç") |
| | | private BigDecimal openRate; |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.job; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfoMonth; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfoMonth; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.util.ThrowableUtil; |
| | | import org.jeecg.modules.quartz.entity.QuartzJob; |
| | | import org.jeecg.modules.quartz.entity.SysQuartzLog; |
| | | import org.jeecg.modules.quartz.service.IQuartzJobService; |
| | | import org.jeecg.modules.quartz.service.ISysQuartzLogService; |
| | | import org.jeecg.modules.system.service.ISysAnnouncementService; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-03-24 |
| | | * @Description: ç»è®¡ææ±æ»æ°æ® |
| | | */ |
| | | @Slf4j |
| | | public class CollectEquipmentDataMonthJob implements Job { |
| | | |
| | | /** |
| | | * è¥åæ°åéåä¿®æ¹ QuartzJobControllerä¸ä¹é对åºä¿®æ¹ æ¶é´ï¼ yyyyMMdd ä¾ï¼ 20230414 |
| | | */ |
| | | private String parameter; |
| | | |
| | | public void setParameter(String parameter) { |
| | | this.parameter = parameter; |
| | | } |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Resource |
| | | private ISysAnnouncementService sysAnnouncementService; |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentStatisticalInfoMonthService mdcEquipmentStatisticalInfoMonthService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentStatisticalShiftInfoMonthService mdcEquipmentStatisticalShiftInfoMonthService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException { |
| | | SysQuartzLog quartzLog = new SysQuartzLog(); |
| | | quartzLog.setCreateTime(new Date()); |
| | | List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); |
| | | if (byJobClassName != null && !byJobClassName.isEmpty()) { |
| | | quartzLog.setJobId(byJobClassName.get(0).getId()); |
| | | } |
| | | quartzLog.setParams(this.parameter); |
| | | log.info(String.format("ç»è®¡ææ±æ»æ°æ® param: %s CollectEquipmentDataMonthJob start! æ¶é´:" + DateUtils.getNow(), this.parameter)); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | String date = ""; |
| | | if (StringUtils.isNotBlank(this.parameter)) { |
| | | date = DateUtils.format(DateUtils.toDate(this.parameter, DateUtils.STRYEARMONTH), DateUtils.STRYEARMONTH); |
| | | } else { |
| | | date = DateUtils.format(DateUtils.getNow(), DateUtils.STRYEARMONTH); |
| | | } |
| | | mdcEquipmentStatisticalInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalInfoMonth>().eq(MdcEquipmentStatisticalInfoMonth::getTheMonth, date)); |
| | | mdcEquipmentStatisticalShiftInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalShiftInfoMonth>().eq(MdcEquipmentStatisticalShiftInfoMonth::getTheMonth, date)); |
| | | |
| | | // step.1 è·å设å¤å表 |
| | | List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(); |
| | | List<MdcEquipmentStatisticalInfoMonth> mdcEquipmentStatisticalInfoMonthList = new ArrayList<>(); |
| | | List<MdcEquipmentStatisticalShiftInfoMonth> mdcEquipmentStatisticalShiftInfoMonthList = new ArrayList<>(); |
| | | if (mdcEquipmentList != null && !mdcEquipmentList.isEmpty()) { |
| | | for (MdcEquipment mdcEquipment : mdcEquipmentList) { |
| | | // step.2 æ±æ»24å°æ¶å©ç¨çæ°æ® |
| | | MdcEquipmentStatisticalDto mdcEquipmentStatisticalDto = mdcEquipmentStatisticalInfoService.findByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date); |
| | | MdcEquipmentStatisticalInfoMonth mdcEquipmentStatisticalInfoMonth = new MdcEquipmentStatisticalInfoMonth(); |
| | | mdcEquipmentStatisticalInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | mdcEquipmentStatisticalInfoMonth.setTheMonth(date); |
| | | mdcEquipmentStatisticalInfoMonth.setCloseLong(mdcEquipmentStatisticalDto.getCloseLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setErrorLong(mdcEquipmentStatisticalDto.getErrorLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setOpenLong(mdcEquipmentStatisticalDto.getOpenLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setProcessLong(mdcEquipmentStatisticalDto.getProcessLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setWaitLong(mdcEquipmentStatisticalDto.getWaitLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setOpenRate(mdcEquipmentStatisticalDto.getOpenLong().divide((new BigDecimal("86400").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); |
| | | mdcEquipmentStatisticalInfoMonth.setStartRate(mdcEquipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentStatisticalDto.getProcessLong().divide(mdcEquipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentStatisticalInfoMonth.setUtilizationRate(mdcEquipmentStatisticalDto.getProcessLong().divide((new BigDecimal("86400").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); |
| | | mdcEquipmentStatisticalInfoMonthList.add(mdcEquipmentStatisticalInfoMonth); |
| | | // step.3 æ±æ»ç次å©ç¨çæ°æ® |
| | | MdcEquipmentStatisticalDto mdcEquipmentShiftStatisticalDto = mdcEquipmentStatisticalShiftInfoService.findByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date); |
| | | MdcEquipmentStatisticalShiftInfoMonth mdcEquipmentShiftInfoMonth = new MdcEquipmentStatisticalShiftInfoMonth(); |
| | | mdcEquipmentShiftInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | mdcEquipmentShiftInfoMonth.setTheMonth(date); |
| | | mdcEquipmentShiftInfoMonth.setCloseLong(mdcEquipmentShiftStatisticalDto.getCloseLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setTotalLong(mdcEquipmentShiftStatisticalDto.getTotalLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setOpenLong(mdcEquipmentShiftStatisticalDto.getOpenLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setErrorLong(mdcEquipmentShiftStatisticalDto.getErrorLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setWaitLong(mdcEquipmentShiftStatisticalDto.getWaitLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setProcessLong(mdcEquipmentShiftStatisticalDto.getProcessLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setUtilizationRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentStatisticalShiftInfoMonthList.add(mdcEquipmentShiftInfoMonth); |
| | | } |
| | | } |
| | | if (!mdcEquipmentStatisticalInfoMonthList.isEmpty()) { |
| | | mdcEquipmentStatisticalInfoMonthService.saveBatch(mdcEquipmentStatisticalInfoMonthList); |
| | | } |
| | | if (!mdcEquipmentStatisticalShiftInfoMonthList.isEmpty()) { |
| | | mdcEquipmentStatisticalShiftInfoMonthService.saveBatch(mdcEquipmentStatisticalShiftInfoMonthList); |
| | | } |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | // åéæ¶æ¯éç¥ |
| | | sysAnnouncementService.jobSendMessage("ç»è®¡ææ±æ»æ°æ®", quartzLog.getExceptionDetail()); |
| | | } |
| | | long endTime = System.currentTimeMillis(); |
| | | quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); |
| | | sysQuartzLogService.save(quartzLog); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.dto.MdcComAnaDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEfficiencyDto; |
| | | import org.jeecg.modules.mdc.dto.TeamEquEffDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; |
| | | import org.jeecg.modules.mdc.vo.ComparativeAnalysisQueryVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEfficiencyReportShiftQueryVo; |
| | | import org.jeecg.modules.mdc.dto.EquipmentEfficiencyAnalyzeDto; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | |
| | | List<MdcComAnaDto> comparativeAnalysis(@Param("vo") ComparativeAnalysisQueryVo vo); |
| | | |
| | | List<BigDecimal> getEfficiencyRate(@Param("equipmentId") String equipmentId, @Param("date") String date); |
| | | |
| | | List<EquipmentEfficiencyAnalyzeDto> equipmentEfficiencyAnalyze(@Param("equipmentIdList") List<String> equipmentIdList, @Param("month") String month); |
| | | |
| | | List<TeamEquEffDto> teamEquipmentEfficiencyAnalyze(@Param("equipmentIdList") List<String> equipmentIdList, @Param("month") String month); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | Integer selectProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | |
| | | MdcEquipmentStatisticalDto findByEquipmentAndMonth(@Param("equipmentId") String equipmentId, @Param("date") String date); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfoMonth; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * @Description: æè®¾å¤è¿è¡æ°æ®è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2025-03-25 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface MdcEquipmentStatisticalInfoMonthMapper extends BaseMapper<MdcEquipmentStatisticalInfoMonth> { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | MdcEquipmentStatisticalShiftInfo getMaxStaticsData(@Param("equipmentId") String equipmentid); |
| | | |
| | | BigDecimal findSpindleRunDuration(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | |
| | | MdcEquipmentStatisticalDto findByEquipmentAndMonth(@Param("equipmentId") String equipmentId, @Param("date") String date); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfoMonth; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * @Description: æç次设å¤è¿è¡æ°æ®è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2025-03-25 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface MdcEquipmentStatisticalShiftInfoMonthMapper extends BaseMapper<MdcEquipmentStatisticalShiftInfoMonth> { |
| | | |
| | | } |
| | |
| | | equipment_id = #{ equipmentId } AND the_date >= #{ date } |
| | | ORDER BY the_date ASC |
| | | </select> |
| | | |
| | | <select id="equipmentEfficiencyAnalyze" resultType="org.jeecg.modules.mdc.dto.EquipmentEfficiencyAnalyzeDto"> |
| | | SELECT |
| | | t3.equipment_name, |
| | | t1.utilization_rate AS utilizationRate, |
| | | t2.utilization_rate AS shiftUtilizationRate |
| | | FROM |
| | | mdc_equipment_statistical_info_month t1 |
| | | LEFT JOIN mdc_equipment_statistical_shift_info_month t2 ON t1.the_month = t2.the_month |
| | | AND t1.equipment_id = t2.equipment_id |
| | | LEFT JOIN mdc_equipment t3 ON t3.equipment_id = t1.equipment_id |
| | | WHERE |
| | | t1.equipment_id IN |
| | | <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | AND t1.the_month = #{month} |
| | | ORDER BY |
| | | t1.utilization_rate DESC |
| | | </select> |
| | | |
| | | <select id="teamEquipmentEfficiencyAnalyze" resultType="org.jeecg.modules.mdc.dto.TeamEquEffDto"> |
| | | SELECT |
| | | t3.team_code AS teamCode, |
| | | t1.utilization_rate AS utilizationRate, |
| | | t2.utilization_rate AS shiftUtilizationRate |
| | | FROM |
| | | mdc_equipment_statistical_info_month t1 |
| | | LEFT JOIN mdc_equipment_statistical_shift_info_month t2 ON t1.the_month = t2.the_month |
| | | AND t1.equipment_id = t2.equipment_id |
| | | LEFT JOIN mdc_equipment t3 ON t3.equipment_id = t1.equipment_id |
| | | WHERE |
| | | t1.equipment_id IN |
| | | <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | AND t1.the_month = #{month} |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="selectProcessLong" resultType="java.lang.Integer"> |
| | | SELECT TOP 1 process_long FROM mdc_equipment_statistical_info WHERE equipment_id = #{equipmentId} AND the_date = #{validDate} |
| | | </select> |
| | | |
| | | <select id="findByEquipmentAndMonth" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto"> |
| | | SELECT |
| | | SUM(open_long) openLong, |
| | | SUM(close_long) closeLong, |
| | | SUM(wait_long) waitLong, |
| | | SUM(process_long) processLong, |
| | | SUM(error_long) errorLong, |
| | | COUNT(*) dayNum |
| | | FROM |
| | | mdc_equipment_statistical_info |
| | | WHERE |
| | | equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{date}, '%') |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMonthMapper"> |
| | | |
| | | </mapper> |
| | |
| | | equipment_id = #{ equipmentId } |
| | | AND the_date LIKE CONCAT(#{ validDate },'%') |
| | | </select> |
| | | |
| | | <select id="findByEquipmentAndMonth" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto"> |
| | | SELECT |
| | | SUM(open_long) openLong, |
| | | SUM(close_long) closeLong, |
| | | SUM(wait_long) waitLong, |
| | | SUM(process_long) processLong, |
| | | SUM(error_long) errorLong, |
| | | SUM ( total_long ) totalLong |
| | | FROM |
| | | mdc_equipment_statistical_shift_info |
| | | WHERE |
| | | equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{date}, '%') |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalShiftInfoMonthMapper"> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfoMonth; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * @Description: æè®¾å¤è¿è¡æ°æ®è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2025-03-25 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IMdcEquipmentStatisticalInfoMonthService extends IService<MdcEquipmentStatisticalInfoMonth> { |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | Integer selectProcessLong(String equipmentId, String validDate); |
| | | |
| | | MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfoMonth; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * @Description: æç次设å¤è¿è¡æ°æ®è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2025-03-25 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IMdcEquipmentStatisticalShiftInfoMonthService extends IService<MdcEquipmentStatisticalShiftInfoMonth> { |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | */ |
| | | BigDecimal findSpindleRunDuration(String equipmentId, String validDate); |
| | | |
| | | MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date); |
| | | } |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author: LiuS |
| | |
| | | * @return |
| | | */ |
| | | List<BigDecimal> getEfficiencyRate(String equipmentId, String date); |
| | | |
| | | Map<String, Object> equipmentEfficiencyAnalyze(EquEffVo equEffVo); |
| | | |
| | | Map<String, Object> teamEquipmentEfficiencyAnalyze(EquEffVo equEffVo); |
| | | } |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.modules.mdc.dto.*; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | | import org.jeecg.modules.mdc.mapper.MdcEfficiencyReportMapper; |
| | |
| | | import org.jeecg.modules.system.entity.SysDepart; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.ISysDepartService; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; |
| | | |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | /** |
| | | * å©ç¨çæ¥è¡¨ |
| | |
| | | if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { |
| | | result.setMdcEfficiencyList(listDtos); |
| | | } else { |
| | | |
| | | |
| | | List<String> equipmentIdList = mdcEquipmentService.listEquipmentId(vo); |
| | | if (equipmentIdList != null && !equipmentIdList.isEmpty()) { |
| | | vo.setEquipmentIdList(equipmentIdList); |
| | |
| | | return mdcEfficiencyReportMapper.getEfficiencyRate(equipmentId, date); |
| | | } |
| | | |
| | | /** |
| | | * çç»å设å¤ç»¼åå©ç¨ç |
| | | * |
| | | * @param equEffVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> equipmentEfficiencyAnalyze(EquEffVo equEffVo) { |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<String> mdcProductionIds = new ArrayList<>(); |
| | | if (StringUtils.isBlank(equEffVo.getProductionIds())) { |
| | | mdcProductionIds.add(equEffVo.getProductionId()); |
| | | } else { |
| | | mdcProductionIds.addAll(Arrays.asList(equEffVo.getProductionIds().split(","))); |
| | | } |
| | | List<String> allProductionIds = mdcProductionService.findChildren(mdcProductionIds); |
| | | List<MdcEquipment> equipmentList = mdcEquipmentService.findByProductionIds(allProductionIds); |
| | | if (equipmentList != null && !equipmentList.isEmpty()) { |
| | | List<String> equipmentIdList = equipmentList.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList()); |
| | | List<EquipmentEfficiencyAnalyzeDto> dataList = mdcEfficiencyReportMapper.equipmentEfficiencyAnalyze(equipmentIdList, equEffVo.getMonth()); |
| | | result.put("dataList", dataList); |
| | | List<String> equipmentNameList = dataList.stream().map(EquipmentEfficiencyAnalyzeDto::getEquipmentName).collect(Collectors.toList()); |
| | | result.put("equipmentNameList", equipmentNameList); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> teamEquipmentEfficiencyAnalyze(EquEffVo equEffVo) { |
| | | Map<String, Object> result = new HashMap<>(); |
| | | // 1. å¤çç产ID |
| | | List<String> mdcProductionIds = StringUtils.isBlank(equEffVo.getProductionIds()) |
| | | ? Collections.singletonList(equEffVo.getProductionId()) |
| | | : Arrays.asList(equEffVo.getProductionIds().split(",")); |
| | | |
| | | List<String> allProductionIds = mdcProductionService.findChildren(mdcProductionIds); |
| | | if (allProductionIds.isEmpty()) { |
| | | return result; // æåè¿åç©ºç»æ |
| | | } |
| | | |
| | | // 2. è·å设å¤å表 |
| | | List<MdcEquipment> equipmentList = StringUtils.isNotBlank(equEffVo.getTeamCodes()) |
| | | ? mdcEquipmentService.findByProIdsAndTeamCode(allProductionIds, Arrays.asList(equEffVo.getTeamCodes().split(","))) |
| | | : mdcEquipmentService.findByProductionIds(allProductionIds); |
| | | |
| | | if (equipmentList.isEmpty()) { |
| | | return result; |
| | | } |
| | | |
| | | // 3. æ°æ®å¤ç |
| | | List<String> equipmentIdList = equipmentList.stream() |
| | | .map(MdcEquipment::getEquipmentId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<TeamEquEffDto> dataList = mdcEfficiencyReportMapper |
| | | .teamEquipmentEfficiencyAnalyze(equipmentIdList, equEffVo.getMonth()); |
| | | |
| | | if (dataList.isEmpty()) { |
| | | return result; |
| | | } |
| | | |
| | | // 4. åç»è®¡ç®å¹³åå¼ |
| | | Map<String, TeamEquEffDto> grouped = dataList.stream() |
| | | .collect(Collectors.groupingBy( |
| | | TeamEquEffDto::getTeamCode, |
| | | Collectors.collectingAndThen( |
| | | Collectors.toList(), |
| | | this::calculateAverages // æåè®¡ç®æ¹æ³ |
| | | ))); |
| | | |
| | | // 5. åå
¸è½¬æ¢ |
| | | Map<String, String> dictMap = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_MDC_STAFF_TEAM) |
| | | .stream() |
| | | .collect(Collectors.toMap(DictModel::getValue, DictModel::getText)); |
| | | |
| | | List<TeamEquEffDto> resultList = grouped.entrySet().stream() |
| | | .map(entry -> buildResultDto(entry, dictMap))// æåæå»ºæ¹æ³ |
| | | .sorted(Comparator.comparing(TeamEquEffDto::getUtilizationRate).reversed()) |
| | | .collect(Collectors.toList()); |
| | | |
| | | result.put("dataList", resultList); |
| | | result.put("teamCodeList", resultList.stream() |
| | | .map(TeamEquEffDto::getTeamCode) |
| | | .collect(Collectors.toList())); |
| | | |
| | | return result; |
| | | |
| | | } |
| | | |
| | | // æåçå¹³åå¼è®¡ç®æ¹æ³ |
| | | private TeamEquEffDto calculateAverages(List<TeamEquEffDto> items) { |
| | | BigDecimal size = new BigDecimal(items.size()); |
| | | return new TeamEquEffDto( |
| | | calculateAverage(items, TeamEquEffDto::getUtilizationRate, size), |
| | | calculateAverage(items, TeamEquEffDto::getShiftUtilizationRate, size), |
| | | calculateAverage(items, TeamEquEffDto::getAmendUtilizationRate, size) |
| | | ); |
| | | } |
| | | |
| | | // éç¨çå¹³åå¼è®¡ç® |
| | | private BigDecimal calculateAverage(List<TeamEquEffDto> items, Function<TeamEquEffDto, BigDecimal> mapper, BigDecimal size) { |
| | | return items.stream() |
| | | .map(mapper) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .divide(size, 2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | // æå»ºç»æDTO |
| | | private TeamEquEffDto buildResultDto(Map.Entry<String, TeamEquEffDto> entry, Map<String, String> dictMap) { |
| | | TeamEquEffDto dto = entry.getValue(); |
| | | dto.setTeamCode(dictMap.getOrDefault(entry.getKey(), entry.getKey())); |
| | | return dto; |
| | | } |
| | | |
| | | private MdcUtilizationResultDto utilizationRate(String equipmentId, String equipmentName, String equipmentType, Date startTime, Date endTime, String date, List<MdcUtilizationRate> mdcUtilizationRateList) { |
| | | MdcUtilizationResultDto dto = new MdcUtilizationResultDto(); |
| | | dto.setEquipmentId(equipmentId); |
| | |
| | | } |
| | | } |
| | | BigDecimal totalLong = new BigDecimal(DateUtils.differentSecond(startTime, endTime)); |
| | | BigDecimal utilizationRate = processLong.divide(totalLong, 6, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal utilizationRate = processLong.divide(totalLong, 6, RoundingMode.HALF_UP); |
| | | dto.setUtilizationRate(utilizationRate); |
| | | } else { |
| | | dto.setUtilizationRate(new BigDecimal("0")); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfoMonth; |
| | | import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMonthMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoMonthService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | /** |
| | | * @Description: æè®¾å¤è¿è¡æ°æ®è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2025-03-25 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class MdcEquipmentStatisticalInfoMonthServiceImpl extends ServiceImpl<MdcEquipmentStatisticalInfoMonthMapper, MdcEquipmentStatisticalInfoMonth> implements IMdcEquipmentStatisticalInfoMonthService { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | | import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMapper; |
| | | import org.jeecg.modules.mdc.service.*; |
| | |
| | | return Integer.parseInt(new BigDecimal(processLong).divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date) { |
| | | return this.baseMapper.findByEquipmentAndMonth(equipmentId, date); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfoMonth; |
| | | import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalShiftInfoMonthMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalShiftInfoMonthService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | /** |
| | | * @Description: æç次设å¤è¿è¡æ°æ®è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2025-03-25 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class MdcEquipmentStatisticalShiftInfoMonthServiceImpl extends ServiceImpl<MdcEquipmentStatisticalShiftInfoMonthMapper, MdcEquipmentStatisticalShiftInfoMonth> implements IMdcEquipmentStatisticalShiftInfoMonthService { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; |
| | | import org.jeecg.modules.mdc.entity.Equipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentRepair; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date) { |
| | | return this.baseMapper.findByEquipmentAndMonth(equipmentId, date); |
| | | } |
| | | |
| | | @Transactional(readOnly = true) |
| | | List<MdcEquipmentStatisticalShiftInfo> equipmentShiftStatisticalProcess(Equipment equipment, String dateTime) { |
| | | public List<MdcEquipmentStatisticalShiftInfo> equipmentShiftStatisticalProcess(Equipment equipment, String dateTime) { |
| | | Date initDate = null; |
| | | //åæåçç»è®¡æ°æ® |
| | | if (StringUtils.isBlank(dateTime)) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-03-27 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class EquEffVo { |
| | | |
| | | /** |
| | | * ä¸å¿ |
| | | */ |
| | | private String productionId; |
| | | /** |
| | | * çç»ids |
| | | */ |
| | | private String productionIds; |
| | | /** |
| | | * é
éå°ç»ID |
| | | */ |
| | | private String teamCodes; |
| | | /** |
| | | * æä»½ |
| | | */ |
| | | private String month; |
| | | |
| | | |
| | | } |
| | |
| | | import org.jeecg.modules.system.model.MdcProductionTreeModel; |
| | | import org.jeecg.modules.system.model.ProductionIdModel; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.vo.MdcProOptionsVo; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | |
| | | return super.importExcel(request, response, MdcProduction.class); |
| | | } |
| | | |
| | | @ApiOperation(value = "产线表-æ ¹æ®ç¨æ·idè·åMDC产线(ä¸å¿)æçç»ä¸æé项", notes = "产线表-æ ¹æ®ç¨æ·idè·åMDC产线(ä¸å¿)æçç»ä¸æé项") |
| | | @GetMapping(value = "/loadProductionOptions") |
| | | public Result<?> loadProductionOptions(String productionId) { |
| | | Result<List<MdcProOptionsVo>> result = new Result<>(); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | try { |
| | | List<MdcProOptionsVo> list = mdcProductionService.loadProductionOptions(userId, productionId); |
| | | result.setSuccess(true); |
| | | result.setResult(list); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation(value = "产线表-æ ¹æ®çç»idè·åé
éç»ä¸æé项", notes = "产线表-æ ¹æ®çç»idè·åé
éç»ä¸æé项") |
| | | @GetMapping(value = "/loadTeamOptions") |
| | | public Result<?> loadTeamOptions(@RequestParam(name = "productionId", required = true) String productionId) { |
| | | Result<List<MdcProOptionsVo>> result = new Result<>(); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | try { |
| | | List<MdcProOptionsVo> list = mdcProductionService.loadTeamOptions(userId, productionId); |
| | | result.setSuccess(true); |
| | | result.setResult(list); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<MdcProduction> findAllProductionId(@Param("userId") String userId); |
| | | |
| | | List<String> findChildren(@Param("mdcProductionIds") List<String> mdcProductionIds); |
| | | |
| | | List<MdcProduction> loadProductionOptions(@Param("userId") String userId, @Param("productionId") String productionId); |
| | | |
| | | List<String> findTeamValue(@Param("userId") String userId, @Param("productionList") List<String> productionList); |
| | | } |
| | |
| | | t3.id = #{userId} |
| | | AND t1.org_type = '3' |
| | | </select> |
| | | |
| | | <select id="recursionChildrenByList" resultType="java.lang.String"> |
| | | WITH temp (id) AS ( |
| | | -- åå§æ¥è¯¢ï¼è·åæå® id çè®°å½ |
| | |
| | | FROM |
| | | temp; |
| | | </select> |
| | | |
| | | <select id="findChildren" resultType="java.lang.String"> |
| | | WITH temp ( id ) AS ( |
| | | SELECT |
| | | id |
| | | FROM |
| | | mdc_production |
| | | WHERE |
| | | id IN |
| | | <foreach collection="mdcProductionIds" item = "id" index = "index" open = "(" close = ")" separator = ","> |
| | | #{id} |
| | | </foreach> |
| | | AND mdc_flag = '1' UNION ALL |
| | | SELECT |
| | | a.id |
| | | FROM |
| | | mdc_production a |
| | | INNER JOIN temp ON a.parent_id = temp.id |
| | | WHERE |
| | | a.mdc_flag = '1' |
| | | ) SELECT |
| | | * |
| | | FROM |
| | | temp |
| | | </select> |
| | | |
| | | <select id="loadProductionOptions" resultType="org.jeecg.modules.system.entity.MdcProduction"> |
| | | SELECT |
| | | t1.* |
| | | FROM |
| | | mdc_production t1 |
| | | LEFT JOIN mdc_user_production t2 ON t1.id = t2.pro_id |
| | | WHERE |
| | | t2.user_id = #{userId} AND t1.mdc_flag = '1' |
| | | <choose> |
| | | <when test="productionId != null and productionId != ''"> |
| | | AND t1.org_type = '3' AND t1.parent_id = #{productionId} |
| | | </when> |
| | | <otherwise> |
| | | AND t1.org_type = '2' |
| | | </otherwise> |
| | | </choose> |
| | | </select> |
| | | |
| | | <select id="findTeamValue" resultType="java.lang.String"> |
| | | SELECT DISTINCT |
| | | t1.team_code deamCode |
| | | FROM |
| | | mdc_equipment t1 |
| | | LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id |
| | | WHERE t2.production_id IN |
| | | <foreach collection="productionList" item = "productionId" index = "index" open = "(" close= ")" separator = ","> |
| | | #{productionId} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
| | |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.model.MdcProductionTreeModel; |
| | | import org.jeecg.modules.system.model.ProductionIdModel; |
| | | import org.jeecg.modules.system.vo.MdcProOptionsVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * æ¥è¯¢ææäº§çº¿ä¿¡æ¯ï¼å¹¶åèç¹è¿è¡æ¾ç¤º |
| | | */ |
| | | List<MdcProductionTreeModel> queryTreeListByMdc(); |
| | | |
| | | /** |
| | | * æ¥è¯¢åèç¹ |
| | | * @param mdcProductionIds |
| | | * @return |
| | | */ |
| | | List<String> findChildren(List<String> mdcProductionIds); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idè·å产线(ä¸å¿)æçç»ä¸æé项 |
| | | * @param userId |
| | | * @param productionId |
| | | * @return |
| | | */ |
| | | List<MdcProOptionsVo> loadProductionOptions(String userId, String productionId); |
| | | |
| | | /** |
| | | * |
| | | * @param userId |
| | | * @param productionId |
| | | * @return |
| | | */ |
| | | List<MdcProOptionsVo> loadTeamOptions(String userId, String productionId); |
| | | } |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.constant.FillRuleConstant; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.common.util.FillRuleUtil; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.system.entity.*; |
| | |
| | | import org.jeecg.modules.system.model.MdcProductionTreeModel; |
| | | import org.jeecg.modules.system.model.ProductionIdModel; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.jeecg.modules.system.service.ISysParamsService; |
| | | import org.jeecg.modules.system.util.FindsProductionsChildrenUtil; |
| | | import org.jeecg.modules.system.vo.MdcProOptionsVo; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Resource |
| | | private ISysParamsService sysParamsService; |
| | | |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | /** |
| | | * queryTreeList å¯¹åº queryTreeList æ¥è¯¢ææçäº§çº¿æ°æ®,以æ ç»æå½¢å¼ååºç»å端 |
| | | */ |
| | |
| | | return FindsProductionsChildrenUtil.wrapTreeDataToTreeList(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> findChildren(List<String> mdcProductionIds) { |
| | | return this.baseMapper.findChildren(mdcProductionIds); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idè·å产线(ä¸å¿)æçç»ä¸æé项 |
| | | * @param userId |
| | | * @param productionId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MdcProOptionsVo> loadProductionOptions(String userId, String productionId) { |
| | | List<MdcProOptionsVo> result = new ArrayList<>(); |
| | | List<MdcProduction> mdcProductionList = this.baseMapper.loadProductionOptions(userId, productionId); |
| | | if (mdcProductionList != null && !mdcProductionList.isEmpty()) { |
| | | for (MdcProduction mdcProduction : mdcProductionList) { |
| | | MdcProOptionsVo vo = new MdcProOptionsVo().convert(mdcProduction); |
| | | result.add(vo); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcProOptionsVo> loadTeamOptions(String userId, String productionId) { |
| | | List<MdcProOptionsVo> result = new ArrayList<>(); |
| | | List<String> productionList = this.findChildren(Arrays.asList(productionId.split(","))); |
| | | if (productionList != null && !productionList.isEmpty()) { |
| | | List<String> dictValues = this.baseMapper.findTeamValue(userId, productionList); |
| | | if (dictValues != null && !dictValues.isEmpty()) { |
| | | List<DictModel> dictModels = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_MDC_STAFF_TEAM); |
| | | if (dictModels != null && !dictModels.isEmpty()) { |
| | | for (DictModel dictModel : dictModels) { |
| | | if (dictValues.contains(dictModel.getValue())) { |
| | | MdcProOptionsVo vo = new MdcProOptionsVo(); |
| | | vo.setKey(dictModel.getValue()); |
| | | vo.setValue(dictModel.getValue()); |
| | | vo.setTitle(dictModel.getText()); |
| | | result.add(vo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æå¼ ç¶èç¹ å 以ä¸çmdcæ è®° |
| | | * @param parentId |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.system.vo; |
| | | |
| | | import lombok.Data; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-03-27 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class MdcProOptionsVo { |
| | | /** |
| | | * id |
| | | */ |
| | | private String key; |
| | | /** |
| | | * id |
| | | */ |
| | | private String value; |
| | | /** |
| | | * åç§° |
| | | */ |
| | | private String title; |
| | | |
| | | /** |
| | | * |
| | | * |
| | | * @param mdcProduction |
| | | * @return |
| | | */ |
| | | public MdcProOptionsVo convert(MdcProduction mdcProduction) { |
| | | this.key = mdcProduction.getId(); |
| | | this.value = mdcProduction.getId(); |
| | | this.title = mdcProduction.getProductionName(); |
| | | return this; |
| | | } |
| | | } |