From 658c1d5fcc47ca30c72c51f98f2df739700fe125 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 12 十一月 2024 17:26:22 +0800
Subject: [PATCH] 最新版本541200007
---
server/system_service/src/main/java/com/doumee/core/utils/Constants.java | 4
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformWmsDetail.java | 3
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java | 4
server/visits/dmvisit_service/src/main/java/com/doumee/dao/web/response/platformReport/PlatformWorkDataVO.java | 10 ++
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java | 143 +++++++++++++++++++++++++++++++++++
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/board/ChangNeiDiaoduController.java | 30 +------
server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java | 3
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/third/BoardService.java | 4 +
8 files changed, 167 insertions(+), 34 deletions(-)
diff --git a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
index 3c04472..91918e1 100644
--- a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -304,10 +304,10 @@
}
int l = s.length();
if(Constants.equalsInteger(l,7)){
- return s.substring(0,3)+"***"+s.substring(l-1,l);
+ return s.substring(0,3)+"**"+s.substring(l-2,l);
}
if(l <= 8){
- return s.substring(0,3)+"****"+s.substring(l-1,l);
+ return s.substring(0,3)+"***"+s.substring(l-2,l);
}
return s;
}
diff --git a/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java b/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java
index 5ca5eba..c03cf47 100644
--- a/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java
+++ b/server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -1283,6 +1283,9 @@
* @return
*/
public static Date getXMinuteAfterDate(Date date, int minute) {
+ if(date ==null){
+ date = new Date();
+ }
Calendar now = Calendar.getInstance();
now.setTime(date);
now.set(Calendar.MINUTE, now.get(Calendar.MINUTE) + minute);
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/board/ChangNeiDiaoduController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/board/ChangNeiDiaoduController.java
index 823f3fe..f125304 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/board/ChangNeiDiaoduController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/board/ChangNeiDiaoduController.java
@@ -103,22 +103,10 @@
@ApiOperation("瀹炴椂浣滀笟鏁堢巼")
@GetMapping("/workEfficiency")
@ApiImplicitParams({
- @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "鏌ヨ绫诲瀷锛�0=鍏ュ簱锛�1=鍑哄簱", required = true),
+ @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "鏌ヨ绫诲瀷锛�0=鍏ュ簱锛�1=鍑哄簱,榛樿 0", required = true),
})
public ApiResponse<List<WorkEfficiencyVO>> workEfficiency(@RequestParam Integer type) {
- List<WorkEfficiencyVO> workEfficiencyVOList = new ArrayList<>();
- Random random = new Random();
- Integer totalWorkNum = 0;
- for (int i = 8; i <= 20; i++) {
- if(i%2==0){
- WorkEfficiencyVO workEfficiencyVO = new WorkEfficiencyVO();
- workEfficiencyVO.setWorkNum(200+random.nextInt(100));
- totalWorkNum = totalWorkNum + workEfficiencyVO.getWorkNum();
- workEfficiencyVO.setTotalWorkNum(totalWorkNum);
- workEfficiencyVO.setWorkTime(StringUtils.leftPad(i+"",2,"0") +":00");
- workEfficiencyVOList.add(workEfficiencyVO);
- }
- }
+ List<WorkEfficiencyVO> workEfficiencyVOList = boardService.workEfficiency(type);
return ApiResponse.success(workEfficiencyVOList);
}
@@ -129,19 +117,9 @@
@ApiOperation("瀹炴椂鏈堝彴浣滀笟淇℃伅")
@GetMapping("/platformWorkData")
public ApiResponse<List<PlatformWorkDataVO>> platformWorkData() {
- List<PlatformWorkDataVO> platformWorkDataVOList = new ArrayList<>();
- Random random = new Random();
- for (int i = 0; i < 3; i++) {
- PlatformWorkDataVO platformDurationVO = new PlatformWorkDataVO();
- platformDurationVO.setPlatformName(i+"_鏈堝彴鍚嶇О");
- platformDurationVO.setCarNo("鐨朅8" + random.nextInt(9) + random.nextInt(9) + random.nextInt(9) + random.nextInt(9));
- platformDurationVO.setWorkType(random.nextInt(1));
- platformDurationVO.setWorkNum(100+random.nextInt(100));
- platformDurationVO.setFinishTime(Long.valueOf(System.currentTimeMillis()/1000 + 200+random.nextInt(100)));
- platformDurationVO.setStatus(random.nextInt(2));
- platformWorkDataVOList.add(platformDurationVO);
- }
+ List<PlatformWorkDataVO> platformWorkDataVOList = boardService.platformWorkData();
return ApiResponse.success(platformWorkDataVOList);
+
}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformWmsDetail.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformWmsDetail.java
index 872e112..0581eef 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformWmsDetail.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/PlatformWmsDetail.java
@@ -92,4 +92,7 @@
@ApiModelProperty(value = "鏈堝垎缁勫悕绉�" ,hidden = true)
@TableField(exist = false)
private String groupName ;
+ @ApiModelProperty(value = "浣滀笟瀹屾垚鏃堕棿锛堟渶缁堟椂闂达級")
+ @TableField(exist = false)
+ private Date doneDate;
}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/web/response/platformReport/PlatformWorkDataVO.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/web/response/platformReport/PlatformWorkDataVO.java
index 49416df..e03762f 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/web/response/platformReport/PlatformWorkDataVO.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/web/response/platformReport/PlatformWorkDataVO.java
@@ -17,6 +17,10 @@
@ApiModelProperty(value = "鏈堝彴鍚嶇О")
private String platformName;
+ @ApiModelProperty(value = "鏈堝彴缂栫爜")
+ private Integer platformId;
+ @ApiModelProperty(value = "鏈堝彴鎺掑簭")
+ private Integer platformSort;
@ApiModelProperty(value = "杞︾墝鍙�")
private String carNo;
@@ -28,12 +32,14 @@
private Integer workType;
@ApiModelProperty(value = "浣滀笟鏃堕暱 鍗曚綅 鍒嗛挓")
- private Integer workTime;
+ private Long workTime;
@ApiModelProperty(value = "棰勮瀹屾垚鏃堕棿 鍗曚綅锛氭椂闂存埑")
private Long finishTime;
+ @ApiModelProperty(value = "棰勮瀹屾垚鏃堕棿 鏍煎紡HH锛歮m")
+ private String finishTimeStr;
- @ApiModelProperty(value = "鏈堝彴鐘舵�侊細0=浣滀笟涓紱1=绌洪棽涓紱2=浣滀笟瓒呮椂")
+ @ApiModelProperty(value = "鏈堝彴鐘舵�侊細0=浣滀笟涓紱1=绌洪棽涓紱2=浣滀笟瓒呮椂;3=鍙彿涓�")
private Integer status;
}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
index a37bbe6..271cc27 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
@@ -694,7 +694,7 @@
}
}
platformJob.dealTime();
- this.getWorkTime(platformJob);
+ this.getWorkTime(platformJob,platformLogMapper);
this.getWmsJobData(platformJob);
return platformJob;
}
@@ -776,7 +776,7 @@
* 鑾峰彇宸蹭綔涓氭椂闂�
* @param platformJob
*/
- public Long getWorkTime(PlatformJob platformJob){
+ public static Long getWorkTime(PlatformJob platformJob,PlatformLogMapper platformLogMapper){
List<PlatformLog> platformLogList = platformLogMapper.selectList(new QueryWrapper<PlatformLog>()
.lambda().eq(PlatformLog::getIsdeleted,Constants.ZERO)
.eq(PlatformLog::getJobId,platformJob.getId())
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java
index c55fe52..2e64ef8 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/BoardServiceImpl.java
@@ -14,11 +14,15 @@
import com.doumee.core.haikang.model.param.respose.PageRegionInfoResponse;
import com.doumee.core.haikang.model.param.respose.PageSensorStatusResponse;
import com.doumee.core.haikang.service.HKService;
+import com.doumee.core.model.ApiResponse;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
+import com.doumee.core.utils.Utils;
import com.doumee.dao.business.*;
import com.doumee.dao.business.model.*;
+import com.doumee.dao.web.reqeust.SavePlatformWarnEventDTO;
import com.doumee.dao.web.response.platformReport.*;
+import com.doumee.service.business.impl.PlatformJobServiceImpl;
import com.doumee.service.business.third.BoardService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.extern.slf4j.Slf4j;
@@ -26,6 +30,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@@ -253,7 +258,7 @@
.in(PlatformJob::getStatus, Constants.PlatformJobStatus.DONE.getKey()
, Constants.PlatformJobStatus.AUTHED_LEAVE.getKey()
, Constants.PlatformJobStatus.LEAVED.getKey())
- .apply("to_days(t1.create_data) = to_days(now())")
+ .apply("to_days(t1.create_date) = to_days(now())")
.groupBy(PlatformGroup::getId)
);
if(jobList!=null){
@@ -274,6 +279,140 @@
);
carWorkSituationVO.setPlatformLogList(platformLogList);
return carWorkSituationVO;
+ }
+
+ @Override
+ public List<PlatformWorkDataVO> platformWorkData(){
+
+ List<PlatformWorkDataVO> platformWorkDataVOList = new ArrayList<>();
+ List<Platform> platformList = platformMapper.selectJoinList(Platform.class, new MPJLambdaWrapper<Platform>()
+ .selectAll( Platform.class)
+ .eq(Platform::getIsdeleted, Constants.ZERO)
+ .orderByAsc(Platform::getSortnum)
+ );
+ /**
+ * WAIT_CONFIRM(0, "寰呯‘璁�","寰呯‘璁�" ),
+ * WART_SIGN_IN(1, "寰呯鍒�","寰呯鍒�" ),
+ * WAIT_CALL(2, "宸茬鍒�","宸茬鍒�"),
+ * IN_WAIT(3, "鍏ュ洯绛夊緟","鍏ュ洯绛夊緟" ),
+ * CALLED(4, "宸插彨鍙�","宸插彨鍙�" ),
+ * WORKING(5, "浣滀笟涓�","浣滀笟涓�" ),
+ * DONE(6, "浣滀笟瀹屾垚 ","浣滀笟瀹屾垚" ),
+ * TRANSFERING(7, "杞Щ涓�","杞Щ涓�" ),
+ * EXCEPTION(8, "寮傚父鎸傝捣","寮傚父鎸傝捣" ),
+ * AUTHED_LEAVE(9, "宸叉巿鏉冪鍥�","宸叉巿鏉冪鍥�" ),
+ * LEAVED(10, "宸茬鍥� ","宸茬鍥� " ),
+ * OVER_NUMBER(11, "宸茶繃鍙�","宸茶繃鍙�" ),
+ * CANCEL(12, "宸插彇娑�","宸插彇娑�" ),
+ */
+
+ if(platformList!=null && platformList.size()>0){
+ List<PlatformJob> jobList = platformJobMapper.selectJoinList(PlatformJob.class, new MPJLambdaWrapper<PlatformJob>()
+ .selectAll( PlatformJob.class)
+ .select("( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = "+Constants.PlatformJobLogType.WORKING.getKey()+" order by pl.CREATE_DATE desc limit 1 ) as newStartDate")
+ .select(" (select sum(ifnull(pl.IO_QTY , 0 )) from platform_wms_detail pl where pl.job_id = t.id and pl.isdeleted=0 )",PlatformJob::getWorkNum)
+ .apply("to_days(t.create_date) = to_days(now())")
+ .eq(Platform::getIsdeleted, Constants.ZERO)
+ .in(PlatformJob ::getStatus,new Integer[]{Constants.PlatformJobStatus.WORKING.getKey(),Constants.PlatformJobStatus.CALLED.getKey() })
+ .orderByDesc(PlatformJob::getStatus ));
+ //鏈堝彴鐘舵�侊細0=浣滀笟涓紱1=绌洪棽涓紱2=浣滀笟瓒呮椂;3=鍙彿
+ for(Platform model : platformList){
+ PlatformWorkDataVO platformDurationVO = new PlatformWorkDataVO();
+ platformDurationVO.setPlatformName(model.getName());
+ platformDurationVO.setPlatformId(model.getId());
+ platformDurationVO.setPlatformSort(model.getSortnum());
+ PlatformJob job = getJobFromListById(model.getId(),jobList);
+ if(job != null){
+ if(Constants.equalsInteger(job.getType(),Constants.ONE) || Constants.equalsInteger(job.getType(),Constants.THREE)){
+ platformDurationVO.setWorkType(Constants.ONE);//濡傛灉鏄璐�
+ }else{
+ platformDurationVO.setWorkType(Constants.ZERO);//濡傛灉鏄嵏璐�
+ }
+ Integer workMinute = job.getWorkNum().multiply(new BigDecimal(60)).divide(model.getWorkRate(),0,BigDecimal.ROUND_HALF_UP).intValue();
+ Date overDate = DateUtil.getXMinuteAfterDate(job.getNewStartDate(),workMinute + model.getWorkTimeoutAlarmTime());//棰勮瀹屾垚鏃堕棿
+ platformDurationVO.setFinishTimeStr(DateUtil.DateToStr(overDate,"HH:mm"));
+
+ platformDurationVO.setWorkNum(Constants.formatBigdecimal(job.getWorkNum()).intValue());
+ platformDurationVO.setCarNo(job.getCarCodeFront());//杞︾墝鍙�
+ if(Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.CALLED.getKey() )){
+ platformDurationVO.setStatus(Constants.THREE); //鍙彿涓�
+ }else{
+ platformDurationVO.setStatus(Constants.ZERO); //浣滀笟涓�
+ platformDurationVO.setWorkTime(PlatformJobServiceImpl.getWorkTime(job,platformLogMapper));//宸插伐浣滄椂闂�
+ if(overDate.getTime() < System.currentTimeMillis() ){
+ model.setStatus(Constants.TWO); //浣滀笟宸茶秴鏃�
+ }
+ }
+ }else{
+ platformDurationVO.setStatus(Constants.ONE);//绌洪棽涓�
+ }
+ platformWorkDataVOList.add(platformDurationVO);
+ }
+ }
+ return platformWorkDataVOList;
+ }
+
+ private PlatformJob getJobFromListById(Integer id, List<PlatformJob> jobList) {
+ if(jobList!=null){
+ for(PlatformJob job :jobList){
+ if(Constants.equalsInteger(job.getPlatformId(),id)){
+ return job;
+ }
+ }
+
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @param type 鏌ヨ绫诲瀷锛�0=鍏ュ簱锛�1=鍑哄簱
+ * @return
+ */
+ @Override
+ public List<WorkEfficiencyVO> workEfficiency(Integer type){
+ //浣滀笟绫诲瀷 0鑷湁杞﹀嵏璐� 1鑷湁杞﹁璐� 2澶栧崗杞﹀嵏璐� 3澶栧崗杞﹁璐� 4甯傚叕鍙稿鍗忚溅鍗歌揣
+ List<WorkEfficiencyVO> workEfficiencyVOList = new ArrayList<>();
+ List<PlatformWmsDetail> jobList = platformWmsDetailMapper.selectJoinList(PlatformWmsDetail.class, new MPJLambdaWrapper<PlatformWmsDetail>()
+ .selectAll( PlatformWmsDetail.class)
+ .selectAs( PlatformJob::getDoneDate,PlatformWmsDetail::getDoneDate)
+ .leftJoin(PlatformJob.class,PlatformJob::getId,PlatformWmsDetail::getJobId)
+ .eq(PlatformWmsDetail::getIsdeleted, Constants.ZERO)
+ .eq(PlatformJob::getIsdeleted, Constants.ZERO)
+ .in(Constants.equalsInteger(type,Constants.ZERO),PlatformJob::getType,new Integer[]{0,2,4})
+ .in(Constants.equalsInteger(type,Constants.ONE),PlatformJob::getType,new Integer[]{1,3})
+ .in(PlatformJob::getStatus, Constants.PlatformJobStatus.DONE.getKey()
+ , Constants.PlatformJobStatus.AUTHED_LEAVE.getKey()
+ , Constants.PlatformJobStatus.LEAVED.getKey())
+ .apply("to_days(t1.create_date) = to_days(now())")
+ );
+ int curtotalNum = 0;
+ Date today = Utils.Date.getStart(new Date());
+ long curTime=0, lastTime=0;
+ for (int i = 0; i < 8; i++) {
+ lastTime = curTime;//涓婃鐨勬椂闂�
+ int curHour = 8+(i*2);
+ long time = curHour*60*60*1000 + today.getTime();
+ WorkEfficiencyVO workEfficiencyVO = new WorkEfficiencyVO();
+ workEfficiencyVO.setWorkTime(curHour+":00");
+ if(jobList!=null && jobList.size()>0){
+ for(PlatformWmsDetail detail : jobList){
+ if(detail.getDoneDate()!=null && detail.getDoneDate().getTime()<= time){
+ //褰撳墠閲�
+ if(detail.getDoneDate()!=null && detail.getDoneDate().getTime() > lastTime){
+ //鍖洪棿鍊� 鍙栧疄杩�2灏忔椂鍐呯殑绱鍊�
+ workEfficiencyVO.setWorkNum(Constants.formatIntegerNum(workEfficiencyVO.getWorkNum())+Constants.formatBigdecimal(detail.getIoQty()).intValue());
+ }
+ //绱Н閲�
+ curtotalNum += Constants.formatBigdecimal(detail.getIoQty()).intValue();
+ }
+ }
+ }
+ workEfficiencyVO.setTotalWorkNum(curtotalNum);//绱鍊�
+ workEfficiencyVOList.add(workEfficiencyVO);
+ }
+ return workEfficiencyVOList;
}
@Override
public List<PlatformDurationVO> platformDuration(){
@@ -330,7 +469,7 @@
.selectAll(PlatformJob.class)
.select("count(id)" ,PlatformJob::getCountum)
.eq(PlatformJob::getIsdeleted,Constants.ZERO)
- .apply("to_days(create_data) = to_days(now())" )
+ .apply("to_days(create_date) = to_days(now())" )
.groupBy(PlatformJob::getStatus )
);
if(jobList!=null){
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/third/BoardService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/third/BoardService.java
index 3416950..727d217 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/third/BoardService.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/third/BoardService.java
@@ -44,4 +44,8 @@
List<PlatformWarnEvent> warningList(int limit);
List<PlatformDurationVO> platformDuration();
+
+ List<WorkEfficiencyVO> workEfficiency(Integer type);
+
+ List<PlatformWorkDataVO> platformWorkData();
}
--
Gitblit v1.9.3