lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java
@@ -593,6 +593,11 @@ String DICT_EQUIPMENT_RATE_NORMAL = "equipment_rate_normal"; /** * é éå°ç»åå ¸ç¼å· */ String DICT_MDC_STAFF_TEAM = "mdc_staff_team"; /** * å çæ°æ® èªå¨è®¡ç®æ è¯ 1(æ¯) 2(å¦) */ Integer AUTO_FLAG_Y = 1; @@ -608,4 +613,6 @@ String CLOSE_TYPE_0 = "0"; String CLOSE_TYPE_1 = "1"; String ORG_TYPE = "3"; } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java
@@ -182,4 +182,8 @@ /**éæ©ç³»ç»ç±»å*/ private transient String systemValue; @Dict(dicCode = "mdc_staff_team") @ApiModelProperty(value = "é éå°ç»") private String teamCode; } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -129,4 +129,6 @@ * @return */ MdcEquipmentDetailedDto findById(@Param("id") String id); List<MdcEquipment> findByProductionIds(@Param("mdcProductionIds") List<String> mdcProductionIds); } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -296,4 +296,16 @@ 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> </mapper> lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -216,4 +216,11 @@ * @param productionId */ void addNewEquipmentFromEam(MdcEquipment mdcEquipment, String productionId); /** * æ ¹æ®äº§çº¿idéåæ¥è¯¢è®¾å¤å表 * @param mdcProductionIds * @return */ List<MdcEquipment> findByProductionIds(List<String> mdcProductionIds); } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -1010,4 +1010,14 @@ this.saveMdcEquipment(mdcEquipment, null, productionId); } /** * æ ¹æ®äº§çº¿idéåæ¥è¯¢è®¾å¤å表 * @param mdcProductionIds * @return */ @Override public List<MdcEquipment> findByProductionIds(List<String> mdcProductionIds) { return this.baseMapper.findByProductionIds(mdcProductionIds); } } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java
@@ -164,6 +164,7 @@ 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"; lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java
@@ -13,9 +13,11 @@ import org.jeecg.modules.mdc.vo.*; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.Map; /** * @author: LiuS @@ -30,7 +32,6 @@ @Resource private MdcEfficiencyReportService mdcEfficiencyReportService; @AutoLog(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çå表æ¥è¯¢") @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çå表æ¥è¯¢", notes = "è®¾å¤æçæ¥è¡¨-å©ç¨çå表æ¥è¯¢") @GetMapping("/efficiencyList") public Result efficiencyList(MdcEfficiencyReportQueryVo vo) { @@ -40,7 +41,6 @@ return Result.OK(result); } @AutoLog(value = "è®¾å¤æçæ¥è¡¨-å¼å¨çå表æ¥è¯¢") @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-å¼å¨çå表æ¥è¯¢", notes = "è®¾å¤æçæ¥è¡¨-å¼å¨çå表æ¥è¯¢") @GetMapping("/efficiencyPOList") public Result efficiencyPOList(MdcEfficiencyReportQueryVo vo) { @@ -50,7 +50,6 @@ return Result.OK(result); } @AutoLog(value = "è®¾å¤æçæ¥è¡¨-çæ¬¡å©ç¨çå表æ¥è¯¢") @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-çæ¬¡å©ç¨çå表æ¥è¯¢", notes = "è®¾å¤æçæ¥è¡¨-çæ¬¡å©ç¨çå表æ¥è¯¢") @GetMapping("/efficiencyShiftList") public Result efficiencyShiftList(MdcEfficiencyReportShiftQueryVo vo) { @@ -60,7 +59,6 @@ return Result.OK(result); } @AutoLog(value = "è®¾å¤æçæ¥è¡¨-ç»è®¡åæå表") @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-ç»è®¡åæå表", notes = "è®¾å¤æçæ¥è¡¨-ç»è®¡åæå表") @GetMapping("/dayStatisticalRate") public Result dayStatisticalRate(MdcEfficiencyReportQueryVo vo) { @@ -70,7 +68,6 @@ return Result.OK(result); } @AutoLog(value = "è®¾å¤æçæ¥è¡¨-对æ¯åæ") @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-对æ¯åæ", notes = "è®¾å¤æçæ¥è¡¨-对æ¯åæ") @GetMapping("/comparativeAnalysis") public Result comparativeAnalysis(ComparativeAnalysisQueryVo vo) { @@ -80,7 +77,6 @@ return Result.OK(result); } @AutoLog(value = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç") @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç", notes = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç") @GetMapping("/dayUtilizationRate") public Result dayUtilizationRate(DayUtilizationRateQueryVo vo) { @@ -90,7 +86,6 @@ return Result.OK(result); } @AutoLog(value = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç对æ¯") @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç对æ¯", notes = "è®¾å¤æçæ¥è¡¨-è®¾å¤æ¥å©ç¨ç对æ¯") @GetMapping("/dayUtilizationRateContrast") public Result dayUtilizationRateContrast(DayUtilizationRateContrastQueryVo vo) { @@ -100,7 +95,6 @@ return Result.OK(result); } @AutoLog(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çèµ°å¿åæå表") @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çèµ°å¿åæå表", notes = "è®¾å¤æçæ¥è¡¨-å©ç¨çèµ°å¿åæå表") @GetMapping("/utilizationRateTrendAnalyze") public Result utilizationRateTrendAnalyze(DayUtilizationRateContrastQueryVo vo) { @@ -110,7 +104,6 @@ return Result.OK(result); } @AutoLog(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çåæ®µåæå表") @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-å©ç¨çåæ®µåæå表", notes = "è®¾å¤æçæ¥è¡¨-å©ç¨çåæ®µåæå表") @GetMapping("/utilizationRateSectionAnalyze") public Result utilizationRateSectionAnalyze(DayUtilizationRateContrastQueryVo vo) { @@ -120,4 +113,36 @@ 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(TeamEquEffVo teamEquEffVo) { // Map<String, Object> result = mdcEfficiencyReportService.teamEquipmentEfficiencyAnalyze(teamEquEffVo); // return Result.OK(result); // } @ApiOperation(value = "è®¾å¤æçæ¥è¡¨-设å¤ç»´åº¦åçç»æè®¾å¤å©ç¨åå¸", notes = "è®¾å¤æçæ¥è¡¨-设å¤ç»´åº¦åçç»æè®¾å¤å©ç¨åå¸") @GetMapping("/equipmentEfficiencyAnalyze") public Result<?> equipmentEfficiencyAnalyze(TeamEquEffVo teamEquEffVo) { Map<String, Object> result = mdcEfficiencyReportService.teamEquipmentEfficiencyAnalyze(teamEquEffVo); return Result.OK(result); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -13,7 +13,6 @@ 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; lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentStatisticalDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,43 @@ 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; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/TeamEquipmentEfficiencyAnalyzeDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,29 @@ package org.jeecg.modules.mdc.dto; import lombok.Data; import java.math.BigDecimal; /** * @Author: Lius * @CreateTime: 2025-03-26 * @Description: */ @Data public class TeamEquipmentEfficiencyAnalyzeDto { private String equipmentName; /** * å©ç¨ç */ private BigDecimal utilizationRate = BigDecimal.ZERO; /** * çæ¬¡å©ç¨ç */ private BigDecimal shiftUtilizationRate = BigDecimal.ZERO; /** * ä¿®æ£å©ç¨ç */ private BigDecimal amendUtilizationRate = BigDecimal.ZERO; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfoMonth.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,106 @@ 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; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalShiftInfoMonth.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,107 @@ 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; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,147 @@ 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); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java
@@ -7,6 +7,7 @@ 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.TeamEquipmentEfficiencyAnalyzeDto; import java.math.BigDecimal; import java.util.List; @@ -50,4 +51,6 @@ List<MdcComAnaDto> comparativeAnalysis(@Param("vo") ComparativeAnalysisQueryVo vo); List<BigDecimal> getEfficiencyRate(@Param("equipmentId") String equipmentId, @Param("date") String date); List<TeamEquipmentEfficiencyAnalyzeDto> teamEquipmentEfficiencyAnalyze(@Param("equipmentIdList") List<String> equipmentIdList, @Param("month") String month); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java
@@ -2,6 +2,7 @@ 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; /** @@ -25,4 +26,6 @@ * @return */ Integer selectProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); MdcEquipmentStatisticalDto findByEquipmentAndMonth(@Param("equipmentId") String equipmentId, @Param("date") String date); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMonthMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,14 @@ 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> { } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java
@@ -2,6 +2,7 @@ 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; @@ -21,4 +22,6 @@ 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); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMonthMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,14 @@ 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> { } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
@@ -186,4 +186,24 @@ equipment_id = #{ equipmentId } AND the_date >= #{ date } ORDER BY the_date ASC </select> <select id="teamEquipmentEfficiencyAnalyze" resultType="org.jeecg.modules.mdc.dto.TeamEquipmentEfficiencyAnalyzeDto"> 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> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml
@@ -12,4 +12,18 @@ <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> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMonthMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,5 @@ <?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> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml
@@ -17,4 +17,18 @@ 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> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMonthMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,5 @@ <?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> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoMonthService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,14 @@ 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> { } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java
@@ -1,5 +1,6 @@ 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; @@ -26,4 +27,6 @@ * @return */ Integer selectProcessLong(String equipmentId, String validDate); MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoMonthService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,14 @@ 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> { } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java
@@ -1,6 +1,7 @@ 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; @@ -28,4 +29,5 @@ */ BigDecimal findSpindleRunDuration(String equipmentId, String validDate); MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java
@@ -6,6 +6,7 @@ import java.math.BigDecimal; import java.util.List; import java.util.Map; /** * @author: LiuS @@ -102,4 +103,6 @@ * @return */ List<BigDecimal> getEfficiencyRate(String equipmentId, String date); Map<String, Object> teamEquipmentEfficiencyAnalyze(TeamEquEffVo teamEquEffVo); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -448,7 +448,7 @@ 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); @@ -1736,6 +1736,33 @@ return mdcEfficiencyReportMapper.getEfficiencyRate(equipmentId, date); } /** * çç»å设å¤ç»¼åå©ç¨ç * * @param teamEquEffVo * @return */ @Override public Map<String, Object> teamEquipmentEfficiencyAnalyze(TeamEquEffVo teamEquEffVo) { Map<String, Object> result = new HashMap<>(); List<String> mdcProductionIds = new ArrayList<>(); if (StringUtils.isEmpty(teamEquEffVo.getProductionIds())) { mdcProductionIds.add(teamEquEffVo.getProductionId()); } else { mdcProductionIds.addAll(Arrays.asList(teamEquEffVo.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<TeamEquipmentEfficiencyAnalyzeDto> dataList = mdcEfficiencyReportMapper.teamEquipmentEfficiencyAnalyze(equipmentIdList, teamEquEffVo.getMonth()); result.put("dataList", dataList); List<String> equipmentNameList = dataList.stream().map(TeamEquipmentEfficiencyAnalyzeDto::getEquipmentName).collect(Collectors.toList()); result.put("equipmentNameList", equipmentNameList); } return result; } 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); lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoMonthServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ 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 { } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
@@ -4,6 +4,7 @@ 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.*; @@ -317,4 +318,9 @@ 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); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoMonthServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ 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 { } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java
@@ -3,6 +3,7 @@ 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; @@ -93,8 +94,13 @@ } } @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)) { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/TeamEquEffVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ package org.jeecg.modules.mdc.vo; import lombok.Data; /** * @Author: Lius * @CreateTime: 2025-03-27 * @Description: */ @Data public class TeamEquEffVo { /** * ä¸å¿ */ private String productionId; /** * çç»ids */ private String productionIds; /** * æä»½ */ private String month; } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/controller/MdcProductionController.java
@@ -19,6 +19,7 @@ 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; @@ -321,4 +322,36 @@ 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; } } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java
@@ -53,4 +53,10 @@ * @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); } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
@@ -42,6 +42,7 @@ t3.id = #{userId} AND t1.org_type = '3' </select> <select id="recursionChildrenByList" resultType="java.lang.String"> WITH temp (id) AS ( -- åå§æ¥è¯¢ï¼è·åæå® id çè®°å½ @@ -68,4 +69,59 @@ 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> lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java
@@ -4,6 +4,7 @@ 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; @@ -141,4 +142,27 @@ * æ¥è¯¢ææäº§çº¿ä¿¡æ¯ï¼å¹¶åèç¹è¿è¡æ¾ç¤º */ 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); } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -11,6 +11,7 @@ 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.*; @@ -21,8 +22,10 @@ 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; @@ -51,6 +54,9 @@ @Resource private ISysParamsService sysParamsService; @Resource private ISysDictService sysDictService; /** * queryTreeList å¯¹åº queryTreeList æ¥è¯¢ææçäº§çº¿æ°æ®,以æ ç»æå½¢å¼ååºç»å端 */ @@ -521,6 +527,54 @@ 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 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/vo/MdcProOptionsVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,38 @@ 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; } }