server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/PlatformCloudController.java
@@ -96,6 +96,13 @@ return ApiResponse.success(platformService.findPage(pageWrap)); } @ApiOperation("æå°ä½ä¸ç»è®¡") @PostMapping("/platformWorkReportPage") @CloudRequiredPermission("business:platform:query") public ApiResponse<List<Platform>> platformWorkReportPage (@RequestBody Platform platform,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ return ApiResponse.success(platformService.platformWorkReportList(platform)); } @ApiOperation("æ ¹æ®æå°ç»è·åæå°å表信æ¯") @GetMapping("/listByGroupId") @@ -117,8 +124,6 @@ public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ return ApiResponse.success(platformService.findById(id)); } @ApiOperation("è·åæå°ç»ä¿¡æ¯") server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/PlatformJobCloudController.java
@@ -70,6 +70,8 @@ return ApiResponse.success(platformJobService.findPage(pageWrap)); } @ApiOperation("导åºExcel") @PostMapping("/exportExcel") @CloudRequiredPermission("business:platformjob:exportExcel") server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/Platform.java
@@ -187,7 +187,29 @@ @TableField(exist = false) private String workCarCode; @ApiModelProperty(value = "å¼å§æ¶é´ yyyy-MM-dd", example = "1") @TableField(exist = false) private Date queryDateStart; @ApiModelProperty(value = "ç»ææ¶é´ yyyy-MM-dd", example = "1") @TableField(exist = false) private Date queryDateEnd; @ApiModelProperty(value = "åé æ¬¡æ°", example = "1") @TableField(exist = false) private Integer stopCount; @ApiModelProperty(value = "工使¶é¿ åä½h", example = "1") @TableField(exist = false) private BigDecimal workCountTime; @ApiModelProperty(value = "æå°å·¥ä½å¼æ¾æ¶é¿" ,hidden = true) @TableField(exist = false) private BigDecimal openTime ; @ApiModelProperty(value = "使ç¨ç", example = "1") @TableField(exist = false) private BigDecimal useRata; @ApiModelProperty(value = "æå°ä½ä¸æ°æ®") @TableField(exist = false) server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformJob.java
@@ -355,14 +355,33 @@ @TableField(exist = false) private Integer jobType; @ApiModelProperty(value = "å¼å§ä»»å¡æ¶é´èµ·") @ApiModelProperty(value = "å¼å§ä½ä¸æ¶é´èµ·") @TableField(exist = false) private Date beginWorkDateStart; @ApiModelProperty(value = "å¼å§ä»»å¡æ¶é´æ¢") @ApiModelProperty(value = "å¼å§ä½ä¸æ¶é´æ¢") @TableField(exist = false) private Date beginWorkDateEnd; @ApiModelProperty(value = "å建æ¶é´èµ·") @TableField(exist = false) private Date createDateStart; @ApiModelProperty(value = "å建æ¶é´æ¢") @TableField(exist = false) private Date createDateEnd; @ApiModelProperty(value = "æå°ç»åç§°") @TableField(exist = false) private String platformGroupName ; @ApiModelProperty(value = "æå°å·¥ä½æ¶é¿" ,hidden = true) @TableField(exist = false) private BigDecimal workTimes ; @ApiModelProperty(value = "å¤ç¶ææ¥è¯¢ å¤ä¸ªä»¥,åå²") @TableField(exist = false) private String queryStatus; server/visits/dmvisit_service/src/main/java/com/doumee/dao/openapi/response/PlatformDataInfoResponse.java
@@ -32,5 +32,7 @@ private String repertotyAddress; @ApiModelProperty(value = "æ¥æºå°ï¼ä¾åºåå¤ä¸ªï¼") private List<String> inRepertotyCode; @ApiModelProperty(value = "æ¶è´§ä¿¡æ¯") private List<PlatformDataWmsInfoResponse> platformDataWmsInfoResponseList; } server/visits/dmvisit_service/src/main/java/com/doumee/dao/openapi/response/PlatformDataWmsInfoResponse.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,24 @@ package com.doumee.dao.openapi.response; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.List; /** * Created by IntelliJ IDEA. * * @Author : Rk * @create 2023/12/7 11:19 */ @Data @ApiModel("ãæå°ãæå°å½åä½ä¸ä¿¡æ¯WMS详æ è¿ååæ°") public class PlatformDataWmsInfoResponse { @ApiModelProperty(value = "è®¡åæ¶è´§æ°é", example = "1") private BigDecimal ioQty; @ApiModelProperty(value = "ç©æåç§°", example = "1") private String materialName; } server/visits/dmvisit_service/src/main/java/com/doumee/dao/web/reqeust/JobOperateDTO.java
@@ -24,6 +24,9 @@ @ApiModelProperty(value = "å车çå· èªå¨å¼å§ä»»å¡ä½¿ç¨") private String carCodeBack; @ApiModelProperty(value = "夿³¨") private String remark; @ApiModelProperty(value = "æå°ç¸æºä¸»é® èªå¨å¼å§ä»»å¡ä½¿ç¨") private Integer deviceId; server/visits/dmvisit_service/src/main/java/com/doumee/dao/web/response/PlatformWorkVO.java
@@ -22,7 +22,7 @@ @ApiModelProperty(value = "å·²å«å·æ°é") private Integer callNum = 0; @ApiModelProperty(value = "çå¾ æ°é") @ApiModelProperty(value = "çå¾ æ°é 转移 + æå°ç»ä¸ å·²ç¾å°æ°æ®") private Integer waitNum = 0; @ApiModelProperty(value = "å¼å¸¸æ°é") server/visits/dmvisit_service/src/main/java/com/doumee/service/business/PlatformService.java
@@ -104,4 +104,5 @@ List<PlatformStatusListResponse> getPlatformStatusList(); List<Platform> platformWorkReportList(Platform platform); } server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformGroupServiceImpl.java
@@ -261,7 +261,9 @@ Constants.PlatformJobStatus.CALLED.getKey(), Constants.PlatformJobStatus.WORKING.getKey(), Constants.PlatformJobStatus.EXCEPTION.getKey(), Constants.PlatformJobStatus.OVER_NUMBER.getKey() Constants.PlatformJobStatus.OVER_NUMBER.getKey(), Constants.PlatformJobStatus.TRANSFERING.getKey() ) // .like(PlatformJob::getArriveDate,DateUtil.getCurrDate()) .orderByDesc(PlatformJob::getCreateDate) @@ -282,7 +284,8 @@ PlatformWorkVO platformWorkVO = new PlatformWorkVO(); if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformJobList)){ //è·åæå°ä¸çææä½ä¸æ°æ® List<PlatformJob> platformJobs = platformJobList.stream().filter(i->Constants.equalsInteger(i.getPlatformId(),platformId)).collect(Collectors.toList()); List<PlatformJob> platformJobs = platformJobList.stream().filter(i->Constants.equalsInteger(i.getPlatformId(),platformId) && !Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.WAIT_CALL.getKey())).collect(Collectors.toList()); if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformJobs)){ platformWorkVO.setWorkNum( platformJobs.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.WORKING.getKey())).collect(Collectors.toList()).size() @@ -291,7 +294,11 @@ platformJobs.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())).collect(Collectors.toList()).size() ); platformWorkVO.setWaitNum( platformJobs.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.IN_WAIT.getKey())).collect(Collectors.toList()).size() platformJobs.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.TRANSFERING.getKey()) ).collect(Collectors.toList()).size() + platformJobList.stream().filter(i->Constants.equalsInteger(platformId,i.getPlatformId()) && Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.IN_WAIT.getKey())).collect(Collectors.toList()).size() ); platformWorkVO.setExceptionNum( platformJobs.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.EXCEPTION.getKey())).collect(Collectors.toList()).size() server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
@@ -158,10 +158,12 @@ queryWrapper .selectAll(PlatformJob.class) .selectAs(Platform::getName,PlatformJob::getPlatformName) .selectAs(PlatformGroup::getName,PlatformJob::getPlatformGroupName) .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate) .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName) .selectAs(SystemUser::getUsername,PlatformJob::getOutUserName) .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId) .leftJoin(PlatformGroup.class,PlatformGroup::getId,Platform::getGroupId) .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode) .leftJoin(SystemUser.class,SystemUser::getId,PlatformJob::getOutUserId) .eq(pageWrap.getModel().getId() != null, PlatformJob::getId, pageWrap.getModel().getId()) @@ -239,8 +241,11 @@ .eq(pageWrap.getModel().getPlatformGroupId() != null, PlatformJob::getPlatformGroupId, pageWrap.getModel().getPlatformGroupId()) .apply(pageWrap.getModel().getQueryStatus() != null, " find_in_set(t.`STATUS`,'"+pageWrap.getModel().getQueryStatus()+"')") .ge(pageWrap.getModel().getBeginWorkDateStart() != null, PlatformJob::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getBeginWorkDateStart())) .le(pageWrap.getModel().getBeginWorkDateEnd() != null, PlatformJob::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getBeginWorkDateEnd())) .ge(pageWrap.getModel().getBeginWorkDateStart() != null, PlatformJob::getStartDate, Utils.Date.getStart(pageWrap.getModel().getBeginWorkDateStart())) .le(pageWrap.getModel().getBeginWorkDateEnd() != null, PlatformJob::getStartDate, Utils.Date.getEnd(pageWrap.getModel().getBeginWorkDateEnd())) .ge(pageWrap.getModel().getCreateDateStart() != null, PlatformJob::getStartDate, Utils.Date.getStart(pageWrap.getModel().getCreateDateStart())) .le(pageWrap.getModel().getCreateDateEnd() != null, PlatformJob::getStartDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDateEnd())) .eq(pageWrap.getModel().getJobType() != null && Constants.equalsInteger(Constants.ONE,pageWrap.getModel().getJobType()), PlatformJob::getType, Constants.platformJobType.sgscxh) .ne(pageWrap.getModel().getJobType() != null && Constants.equalsInteger(Constants.ZERO,pageWrap.getModel().getJobType()), PlatformJob::getType, Constants.platformJobType.sgscxh) ; @@ -277,15 +282,31 @@ .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode) .eq(pageWrap.getModel().getPlatformGroupId() != null, PlatformJob::getPlatformGroupId, pageWrap.getModel().getPlatformGroupId()) .like(pageWrap.getModel().getCarCodeFront() != null, PlatformJob::getCarCodeFront, pageWrap.getModel().getCarCodeFront()) .eq(Objects.nonNull(pageWrap.getModel().getCallType()) &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.ONE),PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey() // .eq(Objects.nonNull(pageWrap.getModel().getCallType()) // &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.ONE), // PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey() // ) .apply(Objects.nonNull(pageWrap.getModel().getCallType()) &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.ONE), " ( " + " ( t.`STATUS` = "+Constants.PlatformJobStatus.WAIT_CALL.getKey()+" and t.PLATFORM_GROUP_ID = ( SELECT p.group_id FROM platform p WHERE p.id = "+pageWrap.getModel().getPlatformId()+" LIMIT 1 ) )" + ") " ) .and(Objects.nonNull(pageWrap.getModel().getCallType()) &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.TWO), i->i.eq(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey()).or() .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.IN_WAIT.getKey()).or() .apply(" ( t.status = "+Constants.PlatformJobStatus.TRANSFERING.getKey()+" and t.PLATFORM_ID = "+pageWrap.getModel().getPlatformId()+" ) ") .apply(Objects.nonNull(pageWrap.getModel().getCallType()) &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.TWO), " ( " + " ( t.`STATUS` = "+Constants.PlatformJobStatus.WAIT_CALL.getKey()+" and t.PLATFORM_GROUP_ID = ( SELECT p.group_id FROM platform p WHERE p.id = "+pageWrap.getModel().getPlatformId()+" LIMIT 1 ) )" + " or " + " (t.`STATUS` = "+Constants.PlatformJobStatus.IN_WAIT.getKey()+" and t.PLATFORM_ID = "+pageWrap.getModel().getPlatformId()+" )" + " or " + " (t.`STATUS` = "+Constants.PlatformJobStatus.TRANSFERING.getKey()+" and t.PLATFORM_ID = "+pageWrap.getModel().getPlatformId()+" ) " + ") " ) .and(Objects.nonNull(pageWrap.getModel().getCallType()) &&Constants.equalsInteger(pageWrap.getModel().getCallType(),Constants.THREE), i->i.eq(PlatformJob::getStatus,Constants.PlatformJobStatus.WAIT_CALL.getKey()).or() @@ -356,7 +377,7 @@ //计ç®é¢è®¡çå¾ æ¶é´ List<Platform> platformList = platformJoinMapper.selectList(new QueryWrapper<Platform>().lambda().eq(Platform::getIsdeleted,Constants.ZERO).eq(Platform::getGroupId,platformJob.getPlatformGroupId())); BigDecimal workRate = platformList.stream().map(m->m.getWorkRate()).reduce(BigDecimal.ZERO,BigDecimal::add); if(sumWorkRate.compareTo(BigDecimal.ZERO) == Constants.ZERO|| workRate.compareTo(BigDecimal.ZERO) == Constants.ZERO ){ if(sumWorkRate.compareTo(BigDecimal.ZERO) > Constants.ZERO && workRate.compareTo(BigDecimal.ZERO) > Constants.ZERO ){ BigDecimal sumMinute = sumWorkRate.divide(workRate,1, RoundingMode.HALF_DOWN).multiply(BigDecimal.valueOf(60L)); Integer sumMinuteInteger = sumMinute.intValue(); Integer hours = sumMinuteInteger/60; @@ -510,6 +531,8 @@ ){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ä¸å¡ç¶æå·²æµè½¬ï¼è¯·å·æ°æ¥ç"); } platformJob.setArriveDate(Objects.isNull(platformJob.getArriveDate())?new Date():null); platformJob.setConfirmTaskDate(Objects.isNull(platformJob.getConfirmTaskDate())?new Date():null); }else{ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"ç¾å°ç±»åé误"); } @@ -707,7 +730,8 @@ @Transactional(rollbackFor = {Exception.class,BusinessException.class}) public void platformInPark(JobOperateDTO jobOperateDTO){ if(Objects.isNull(jobOperateDTO) || Objects.isNull(jobOperateDTO.getJobId())){ || Objects.isNull(jobOperateDTO.getJobId()) || Objects.isNull(jobOperateDTO.getPlatformId())){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } PlatformJob platformJob = platformJobMapper.selectById(jobOperateDTO.getJobId()); @@ -717,9 +741,26 @@ if(!Constants.equalsInteger(platformJob.getStatus(),Constants.PlatformJobStatus.WAIT_CALL.getKey())){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·,ä¸å¡ç¶æå·²æµè½¬ï¼"); } Platform platform = platformJoinMapper.selectById(jobOperateDTO.getPlatformId()); if(Objects.isNull(platform)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°æå°ä¿¡æ¯"); } //夿æ¯å¦éè¦å¡«å è¿å» if(StringUtils.isBlank(platformJob.getPlatforms())){ platformJob.setPlatforms(jobOperateDTO.getPlatformId().toString()); platformJob.setPlatformNames(platform.getName()); }else{ if(!Constants.equalsInteger(platform.getId(),platformJob.getPlatformId())){ platformJob.setPlatforms(platformJob.getPlatforms() + "," +jobOperateDTO.getPlatformId().toString()); platformJob.setPlatformNames(platformJob.getPlatformNames() + "," +platform.getName()); } } PlatformJob oldPlatformJob = new PlatformJob(); BeanUtils.copyProperties(platformJob,oldPlatformJob); platformJob.setPlatformId(platform.getId()); platformJob.setInwaitDate(new Date()); platformJob.setInwaitUserId(jobOperateDTO.getLoginUserInfo().getId()); platformJob.setStatus(Constants.PlatformJobStatus.IN_WAIT.getKey()); @@ -764,10 +805,19 @@ if(Objects.isNull(platform)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°æå°ä¿¡æ¯"); } //æ¥è¯¢æå°ä»»å¡çå¾ ä½ä¸æ°é if(platformJobMapper.selectCount(new QueryWrapper<PlatformJob>().lambda() .eq(PlatformJob::getPlatformId,platform.getId()) .in(PlatformJob::getStatus,Constants.PlatformJobStatus.CALLED.getKey(),Constants.PlatformJobStatus.WORKING.getKey()) )>platform.getWorkingNum()){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"è¶ åºæå°å¯åæ¶ä½ä¸æ°é["+platform.getWorkingNum()+"è¾]"); }; PlatformJob oldPlatformJob = new PlatformJob(); BeanUtils.copyProperties(platformJob,oldPlatformJob); platformJob.setCallDate(new Date()); platformJob.setCallDate(Objects.isNull(platformJob.getCallDate())?new Date():null); platformJob.setCallUserId(jobOperateDTO.getLoginUserInfo().getId()); platformJob.setStatus(Constants.PlatformJobStatus.CALLED.getKey()); platformJob.setPlatformId(jobOperateDTO.getPlatformId()); @@ -776,8 +826,10 @@ platformJob.setPlatforms(jobOperateDTO.getPlatformId().toString()); platformJob.setPlatformNames(platform.getName()); }else{ platformJob.setPlatforms(platformJob.getPlatforms() + "," +jobOperateDTO.getPlatformId().toString()); platformJob.setPlatformNames(platformJob.getPlatformNames() + "," +platform.getName()); if(!Constants.equalsInteger(platform.getId(),platformJob.getPlatformId())){ platformJob.setPlatforms(platformJob.getPlatforms() + "," +jobOperateDTO.getPlatformId().toString()); platformJob.setPlatformNames(platformJob.getPlatformNames() + "," +platform.getName()); } } platformJob.setEditDate(new Date()); platformJobMapper.updateById(platformJob); @@ -924,10 +976,9 @@ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°æå°ä¿¡æ¯"); } PlatformJob oldPlatformJob = new PlatformJob(); BeanUtils.copyProperties(platformJob,oldPlatformJob); if(Objects.isNull(platformJob.getStartDate())){ platformJob.setStartDate(new Date()); } @@ -1006,7 +1057,6 @@ //å卿使¥å¿ savePlatformLog(Constants.PlatformJobLogType.AUTHED_LEAVE.getKey(),oldPlatformJob,platformJob , Constants.PlatformJobLogType.AUTHED_LEAVE.getInfo()); //TODO ææè½¦è¾ç¦»åºæé } @@ -1372,7 +1422,16 @@ if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformWmsDetailList)){ List<String> stringList = platformWmsDetailList.stream().map(m->m.getInRepertotyCode()).collect(Collectors.toList()); response.setInRepertotyCode(stringList); List<PlatformDataWmsInfoResponse> platformDataWmsInfoResponseList = new ArrayList<>(); for (PlatformWmsDetail platformWmsDetail:platformWmsDetailList) { PlatformDataWmsInfoResponse platformDataWmsInfoResponse = new PlatformDataWmsInfoResponse(); platformDataWmsInfoResponse.setMaterialName(platformWmsDetail.getMaterialName()); platformDataWmsInfoResponse.setIoQty(platformWmsDetail.getIoQty()); platformDataWmsInfoResponseList.add(platformDataWmsInfoResponse); } response.setPlatformDataWmsInfoResponseList(platformDataWmsInfoResponseList); } } } return response; server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformServiceImpl.java
@@ -7,10 +7,13 @@ import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.core.utils.Constants; import com.doumee.core.utils.DateUtil; import com.doumee.core.utils.Utils; import com.doumee.dao.business.DeviceMapper; import com.doumee.dao.business.PlatformDeviceMapper; import com.doumee.dao.business.PlatformJobMapper; import com.doumee.dao.business.PlatformMapper; import com.doumee.dao.business.join.PlatformJobJoinMapper; import com.doumee.dao.business.join.PlatformJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.dao.openapi.response.PlatformNumByStatusResponse; @@ -29,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -48,6 +52,8 @@ private PlatformDeviceMapper platformDeviceMapper; @Autowired private DeviceMapper deviceMapper; @Autowired private PlatformJobJoinMapper platformJobJoinMapper; @@ -294,10 +300,66 @@ ); } } } return platformPageData; } @Override public List<Platform> platformWorkReportList(Platform platform) { if(Objects.isNull(platform) || Objects.isNull(platform.getQueryDateStart()) || Objects.isNull(platform.getQueryDateEnd())){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"åæ°é误"); } MPJLambdaWrapper<Platform> queryWrapper = new MPJLambdaWrapper<>(); queryWrapper.selectAll(Platform.class) .selectAs(PlatformGroup::getName,Platform::getGroupName) .select(" (select ifnull(TIMESTAMPDIFF(HOUR, '2023-01-01 '||pg.start_time||':00', '2023-01-01 '||pg.end_time||':00' ),0) from platform_group pg " + " where t.group_id = pg.id ) as openTime ") .leftJoin(PlatformGroup.class,PlatformGroup::getId,Platform::getGroupId); queryWrapper .eq(platform.getGroupId() != null, Platform::getGroupId, platform.getGroupId()) .eq( Platform::getIsdeleted, Constants.ZERO) .like(platform.getName() != null, Platform::getName, platform.getName()) .orderByDesc(Platform::getId); List<Platform> platformList = platformJoinMapper.selectList(queryWrapper); if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformList)){ //æ¥è¯¢æææå°æ°æ®ä¸ç 任塿°æ® 任塿°æ®ä¸º List<PlatformJob> platformJobList = platformJobJoinMapper.selectJoinList(PlatformJob.class, new MPJLambdaWrapper<PlatformJob>() .selectAll(PlatformJob.class) .select(" ( select ROUND( ifnull(SUM(pl.PARAM3),0) / 3600 , 2 ) from platform_log pl where pl.OBJ_ID = t.id " + " ) as workTimes ") .in(PlatformJob::getStatus,Constants.PlatformJobStatus.WORKING.getKey(), Constants.PlatformJobStatus.DONE.getKey(), Constants.PlatformJobStatus.TRANSFERING.getKey(), Constants.PlatformJobStatus.EXCEPTION.getKey(), Constants.PlatformJobStatus.AUTHED_LEAVE.getKey(), Constants.PlatformJobStatus.LEAVED.getKey() ) .in(PlatformJob::getPlatformId,platformList.stream().map(i->i.getId()).collect(Collectors.toList())) .ge(platform.getQueryDateStart() != null, PlatformJob::getStartDate, Utils.Date.getStart(platform.getQueryDateStart())) .le(platform.getQueryDateEnd() != null, PlatformJob::getStartDate, Utils.Date.getEnd(platform.getQueryDateEnd())) ); //æ¥è¯¢2æ¥æç¸å·®å¤©æ° Integer sumDays = DateUtil.daysBetweenDates(platform.getQueryDateStart(),platform.getQueryDateEnd()); for (Platform bean:platformList) { List<PlatformJob> beanJobList = platformJobList.stream().filter(i->Constants.equalsInteger(i.getPlatformId(),bean.getId())).collect(Collectors.toList()); bean.setStopCount(beanJobList.size()); bean.setWorkCountTime( beanJobList.stream().map(i->i.getWorkTimes()).reduce(BigDecimal.ZERO,BigDecimal::add) ); if(Objects.isNull(bean.getOpenTime())||bean.getOpenTime().compareTo(BigDecimal.ZERO)<=0){ bean.setUseRata(BigDecimal.ZERO); continue; } BigDecimal sumTime = BigDecimal.valueOf(sumDays).multiply(bean.getOpenTime()); bean.setUseRata( bean.getWorkCountTime().divide(sumTime,BigDecimal.ROUND_HALF_DOWN,2) ); } } return platformList; } @Override @@ -352,17 +414,17 @@ if(Constants.equalsInteger(platform.getPlatformStatus(),Constants.ONE)){ response.setCarCode(platform.getWorkCarCode()); } } } return platformStatusListResponses; } }