From cc75dc22053806bff7aa0f4432823b43cea43132 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 09 十二月 2024 17:23:25 +0800
Subject: [PATCH] 最新版本541200007
---
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java | 164 +++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 135 insertions(+), 29 deletions(-)
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 d1ca0f1..f8d9293 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
@@ -17,7 +17,10 @@
import com.doumee.core.tms.model.response.TmsBaseResponse;
import com.doumee.core.tms.model.response.TmsLockStatusQueryResponse;
import com.doumee.core.utils.*;
+import com.doumee.core.wx.wxPlat.WxPlatConstants;
+import com.doumee.core.wx.wxPlat.WxPlatNotice;
import com.doumee.dao.business.*;
+import com.doumee.dao.business.dao.SmsConfigMapper;
import com.doumee.dao.business.dao.SmsEmailMapper;
import com.doumee.dao.business.join.PlatformJobJoinMapper;
import com.doumee.dao.business.join.PlatformJoinMapper;
@@ -117,6 +120,10 @@
private PlatformBroadcastLogMapper platformBroadcastLogMapper;
@Autowired
private PlatformWarnEventServiceImpl platformWarnEventService;
+ @Autowired
+ private MemberMapper memberMapper;
+ @Autowired
+ private WxNoticeConfigMapper wxNoticeConfigMapper;
@Override
public Integer create(PlatformJob platformJob) {
@@ -321,6 +328,7 @@
.selectAs(Platform::getName,PlatformJob::getPlatformName)
.selectAs(Platform::getWorkRate,PlatformJob::getWorkRate)
.selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName)
+ .select(" case when t.total_num is null then ( select sum(pwd.IO_QTY) from platform_wms_detail pwd where pwd.JOB_ID = t.id ) else t.total_num end ioQty ")
.leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
.leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode)
.leftJoin(PlatformBooks.class,PlatformBooks::getJobId,PlatformJob::getId)
@@ -362,8 +370,9 @@
IPage<PlatformJob> platformJobIPage = platformJobJoinMapper.selectJoinPage(page,PlatformJob.class,queryWrapper);
platformJobIPage.getRecords().forEach(i->{
i.dealTime();
- this.getWmsJobData(i);
- this.queryWaitNum(i);
+ i.setTotalNum(i.getIoQty());
+// this.getWmsJobData(i);
+// this.queryWaitNum(i);
});
return PageData.from(platformJobIPage);
}
@@ -374,7 +383,6 @@
|| Constants.equalsInteger(platformJob.getType(),Constants.platformJobType.zyczh)
|| Constants.equalsInteger(platformJob.getType(),Constants.platformJobType.wxcxh)
|| Constants.equalsInteger(platformJob.getType(),Constants.platformJobType.wxczh)) {
-
PlatformWmsJob platformWmsJob = platformWmsJobMapper.selectOne(new QueryWrapper<PlatformWmsJob>().lambda()
.eq(PlatformWmsJob::getIsdeleted,Constants.ZERO)
.eq(PlatformWmsJob::getJobId,platformJob.getId())
@@ -406,11 +414,7 @@
}else{
platformJob.setLockStatus(Constants.ONE); //閮ㄥ垎涓婇攣
}
-
}
-
-
-
}
}
}
@@ -441,7 +445,8 @@
sumWorkRate = sumWorkRate.add(linePlatformJob.getTotalNum());
}
//璁$畻棰勮绛夊緟鏃堕棿
- List<Platform> platformList = platformJoinMapper.selectList(new QueryWrapper<Platform>().lambda().eq(Platform::getIsdeleted,Constants.ZERO).eq(Platform::getGroupId,platformJob.getPlatformGroupId()));
+ 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 ){
BigDecimal sumMinute = sumWorkRate.divide(workRate,1, RoundingMode.HALF_DOWN).multiply(BigDecimal.valueOf(60L));
@@ -695,7 +700,7 @@
}
}
platformJob.dealTime();
- this.getWorkTime(platformJob);
+ this.getWorkTime(platformJob,platformLogMapper);
this.getWmsJobData(platformJob);
return platformJob;
}
@@ -777,7 +782,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())
@@ -800,7 +805,7 @@
.last(" limit 1 ")
);
if(Objects.nonNull(lastBeginPlatform)){
- String v = Long.toString(System.currentTimeMillis() - lastBeginPlatform.getCreateDate().getTime() / 1000) ;
+ String v = Long.toString((System.currentTimeMillis() - lastBeginPlatform.getCreateDate().getTime() )/ 1000) ;
optTime = optTime + Long.valueOf(v);
}
}
@@ -861,6 +866,20 @@
emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(),
SmsConstants.platformJobContent.platformJobCallIn,null,null
);
+
+ //鍏紬鍙锋ā鏉挎秷鎭�
+ if(Objects.nonNull(platformJob.getDriverId())) {
+ Member member = memberMapper.selectById(platformJob.getDriverId());
+ if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) {
+ WxPlatNotice wxPlatNotice = new WxPlatNotice();
+ wxPlatNotice.sendPlatformJobTemplateNotice(
+ wxNoticeConfigMapper, platformJob,
+ WxPlatConstants.platformJobContent.platformJobCallIn,
+ systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+ Arrays.asList(member.getOpenid().split(","))
+ );
+ }
+ }
return platformJob;
}
@@ -966,6 +985,7 @@
public void cancelInPark(PlatformJob platformJob){
if(Constants.equalsInteger(platformJob.getType(),Constants.TWO)
|| Constants.equalsInteger(platformJob.getType(),Constants.THREE)
+ || StringUtils.isBlank(platformJob.getCarCodeFront())
|| Constants.equalsInteger(platformJob.getType(),Constants.FOUR)){
List<VisitPark> visitParkList = visitParkMapper.selectList(new QueryWrapper<VisitPark>().lambda()
@@ -1057,6 +1077,21 @@
emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(),
SmsConstants.platformJobContent.platformJobSingIn,platform.getName(),null
);
+
+ //鍏紬鍙锋ā鏉挎秷鎭�
+ if(Objects.nonNull(platformJob.getDriverId())){
+ Member member = memberMapper.selectById(platformJob.getDriverId());
+ if(Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())){
+ WxPlatNotice wxPlatNotice = new WxPlatNotice();
+ wxPlatNotice.sendPlatformJobTemplateNotice(
+ wxNoticeConfigMapper,platformJob,
+ WxPlatConstants.platformJobContent.platformJobSingIn,
+ systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+ Arrays.asList(member.getOpenid().split(","))
+ );
+ }
+ }
+
//骞挎挱 led閫氱煡
platformJob.setPlatformName(platform.getName());
@@ -1188,6 +1223,20 @@
SmsConstants.platformJobContent.platformJobMove,oldPlatform.getName(),platform.getName()
);
+ //鍏紬鍙锋ā鏉挎秷鎭�
+ if(Objects.nonNull(platformJob.getDriverId())) {
+ Member member = memberMapper.selectById(platformJob.getDriverId());
+ if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) {
+ WxPlatNotice wxPlatNotice = new WxPlatNotice();
+ wxPlatNotice.sendPlatformJobTemplateNotice(
+ wxNoticeConfigMapper, platformJob,
+ WxPlatConstants.platformJobContent.platformJobMove,
+ systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+ Arrays.asList(member.getOpenid().split(","))
+ );
+ }
+ }
+
platformJob.setPlatformName(oldPlatform.getName());
platformJob.setPlatformId(oldPlatform.getId());
this.broadcastAndLEed(platformJob, StringUtils.isBlank(oldPlatform.getLedContent())?Constants.PlatformLedContent.IDEL_CONTNET.getName():oldPlatform.getLedContent(),
@@ -1216,7 +1265,7 @@
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧�,涓氬姟鐘舵�佸凡娴佽浆锛�");
}
- Platform platform = platformJoinMapper.selectById(jobOperateDTO.getPlatformId());
+ Platform platform = platformJoinMapper.selectById(platformJob.getPlatformId());
if(Objects.isNull(platform)){
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鏈堝彴淇℃伅");
}
@@ -1235,6 +1284,21 @@
emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(),
SmsConstants.platformJobContent.platformJobOverNum,null,null
);
+
+ //鍏紬鍙锋ā鏉挎秷鎭�
+ if(Objects.nonNull(platformJob.getDriverId())){
+ Member member = memberMapper.selectById(platformJob.getDriverId());
+ if(Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())){
+ WxPlatNotice wxPlatNotice = new WxPlatNotice();
+ wxPlatNotice.sendPlatformJobTemplateNotice(
+ wxNoticeConfigMapper,platformJob,
+ WxPlatConstants.platformJobContent.platformJobOverNum,
+ systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+ Arrays.asList(member.getOpenid().split(","))
+ );
+ }
+ }
+
platformJob.setPlatformName(platform.getName());
this.broadcastAndLEed(platformJob, StringUtils.isBlank(platform.getLedContent())?Constants.PlatformLedContent.IDEL_CONTNET.getName():platform.getLedContent(),
null
@@ -1281,6 +1345,20 @@
emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(),
SmsConstants.platformJobContent.platformJobError,platform.getName(),null
);
+
+ //鍏紬鍙锋ā鏉挎秷鎭�
+ if(Objects.nonNull(platformJob.getDriverId())) {
+ Member member = memberMapper.selectById(platformJob.getDriverId());
+ if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) {
+ WxPlatNotice wxPlatNotice = new WxPlatNotice();
+ wxPlatNotice.sendPlatformJobTemplateNotice(
+ wxNoticeConfigMapper, platformJob,
+ WxPlatConstants.platformJobContent.platformJobError,
+ systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+ Arrays.asList(member.getOpenid().split(","))
+ );
+ }
+ }
platformJob.setPlatformName(platform.getName());
this.broadcastAndLEed(platformJob, StringUtils.isBlank(platform.getLedContent())?Constants.PlatformLedContent.IDEL_CONTNET.getName():platform.getLedContent(),
@@ -1331,7 +1409,19 @@
emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(),
SmsConstants.platformJobContent.platformJobWorking,platform.getName(),null
);
-
+ //鍏紬鍙锋ā鏉挎秷鎭�
+ if(Objects.nonNull(platformJob.getDriverId())) {
+ Member member = memberMapper.selectById(platformJob.getDriverId());
+ if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) {
+ WxPlatNotice wxPlatNotice = new WxPlatNotice();
+ wxPlatNotice.sendPlatformJobTemplateNotice(
+ wxNoticeConfigMapper, platformJob,
+ WxPlatConstants.platformJobContent.platformJobWorking,
+ systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+ Arrays.asList(member.getOpenid().split(","))
+ );
+ }
+ }
//骞挎挱 led閫氱煡
platformJob.setPlatformName(platform.getName());
this.broadcastAndLEed(platformJob,Constants.PlatformLedContent.WORKING.getInfo(),
@@ -1416,6 +1506,21 @@
emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,platformJob.getId(),
SmsConstants.platformJobContent.platformJobFinish,platform.getName(),null
);
+
+ //鍏紬鍙锋ā鏉挎秷鎭�
+ if(Objects.nonNull(platformJob.getDriverId())) {
+ Member member = memberMapper.selectById(platformJob.getDriverId());
+ if (Objects.nonNull(member) && StringUtils.isNotBlank(member.getOpenid())) {
+ WxPlatNotice wxPlatNotice = new WxPlatNotice();
+ wxPlatNotice.sendPlatformJobTemplateNotice(
+ wxNoticeConfigMapper, platformJob,
+ WxPlatConstants.platformJobContent.platformJobFinish,
+ systemDictDataBiz.queryByCode(Constants.WX_PLATFORM, Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+ Arrays.asList(member.getOpenid().split(","))
+ );
+ }
+ }
+
//骞挎挱 led閫氱煡
platformJob.setPlatformName(platform.getName());
this.broadcastAndLEed(platformJob,Constants.PlatformLedContent.DONE.getInfo(),
@@ -1685,10 +1790,11 @@
@Override
public PlatformWorkVO getPlatformWorkVOById(Integer platformId){
//鑾峰彇鏈堝彴涓嬬殑鎵�鏈変綔涓氭暟鎹�
- List<PlatformJob> platformJobList = platformJobJoinMapper.selectJoinList(PlatformJob.class,new MPJLambdaWrapper<PlatformJob>()
+ List<PlatformJob> allPlatformJobList = platformJobJoinMapper.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 = 5 order by pl.CREATE_DATE desc limit 1 ) as newStartDate ")
- .select(" ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = 4 order by pl.CREATE_DATE desc limit 1 ) as newCallDate ")
+ .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 pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = "+Constants.PlatformJobLogType.CALLED.getKey()+" order by pl.CREATE_DATE desc limit 1 ) as newCallDate ")
+ .select(" case when t.total_num is null then ( select sum(pwd.IO_QTY) from platform_wms_detail pwd where pwd.JOB_ID = t.id ) else t.total_num end ioQty ")
.selectAs(Platform::getName,PlatformJob::getPlatformName)
.selectAs(Platform::getWorkRate,PlatformJob::getWorkRate)
.selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName)
@@ -1708,13 +1814,13 @@
)
.orderByDesc(PlatformJob::getId)
);
- for (PlatformJob platformJob:platformJobList) {
- //澶勭悊WSM鏁伴噺
- this.getWmsJobData(platformJob);
- //鏌ヨ鍓嶆柟鎺掗槦鏁伴噺
- this.queryWaitNum(platformJob);
- }
- PlatformWorkVO platformWorkVO = PlatformGroupServiceImpl.getPlatformWorkVO(platformJoinMapper.selectById(platformId),platformJobList);
+// List<PlatformJob> platformJobList = allPlatformJobList.stream().filter(i->Constants.equalsInteger(i.getPlatformId(),platformId)).collect(Collectors.toList());
+// for (PlatformJob platformJob:platformJobList) {
+// platformJob.setTotalNum(platformJob.getIoQty());
+// //鏌ヨ鍓嶆柟鎺掗槦鏁伴噺
+// this.queryWaitNum(platformJob);
+// }
+ PlatformWorkVO platformWorkVO = PlatformGroupServiceImpl.getPlatformWorkVO(platformJoinMapper.selectById(platformId),allPlatformJobList);
return platformWorkVO;
}
@@ -1766,8 +1872,8 @@
.selectAs(Platform::getWorkRate, PlatformJob::getWorkRate)
.selectAs(Platform::getName, PlatformJob::getPlatformName)
.select(" case when t.total_num is null then ( select sum(pwd.IO_QTY) from platform_wms_detail pwd where pwd.JOB_ID = t.id ) else t.total_num end workNum ")
- .select(" ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = 5 order by pl.CREATE_DATE desc limit 1 ) as newStartDate ")
- .select(" ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = 4 order by pl.CREATE_DATE desc limit 1 ) as newCallDate ")
+ .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 pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = "+Constants.PlatformJobLogType.CALLED.getKey()+" order by pl.CREATE_DATE desc limit 1 ) as newCallDate ")
.leftJoin(Platform.class, Platform::getId, PlatformJob::getPlatformId)
.eq(PlatformJob::getStatus, Constants.PlatformJobStatus.WORKING.getKey())
.eq(PlatformJob::getPlatformId, platform.getId())
@@ -1967,8 +2073,8 @@
.selectAs(Platform::getName,PlatformJob::getPlatformName)
.selectAs(PlatformGroup::getWaitCallTime,PlatformJob::getWorktimeOutAlarmTime)
.select(" case when t.total_num is null then ( select sum(pwd.IO_QTY) from platform_wms_detail pwd where pwd.JOB_ID = t.id ) else t.total_num end workNum ")
- .select(" ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = 5 order by pl.CREATE_DATE desc limit 1 ) as newStartDate ")
- .select(" ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = 4 order by pl.CREATE_DATE desc limit 1 ) as newCallDate ")
+ .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 pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = "+Constants.PlatformJobLogType.CALLED.getKey()+" order by pl.CREATE_DATE desc limit 1 ) as newCallDate ")
.leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
.leftJoin(PlatformGroup.class,PlatformGroup::getId,Platform::getGroupId)
.eq(PlatformJob::getIsdeleted,Constants.ZERO)
@@ -2052,7 +2158,7 @@
List<PlatformJob> platformJobList = platformJobJoinMapper.selectJoinList(PlatformJob.class,new MPJLambdaWrapper<PlatformJob>()
.selectAll(PlatformJob.class)
.selectAs(Platform::getName,PlatformJob::getPlatformName)
- .select(" ( now() >= DATE_ADD( ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = 4 " +
+ .select(" ( now() >= DATE_ADD( ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = "+Constants.PlatformJobLogType.CALLED.getKey()+" " +
"order by pl.CREATE_DATE desc limit 1 ) ,INTERVAL t2.WAIT_CALL_TIME MINUTE) ) as isTimeOut ")
.leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
.leftJoin(PlatformGroup.class,PlatformGroup::getId,Platform::getGroupId)
@@ -2084,7 +2190,7 @@
.selectAs(Platform::getWorkRate, PlatformJob::getWorkRate)
.selectAs(Platform::getWorkTimeoutAlarmTime, PlatformJob::getWorktimeOutAlarmTime)
.select(" case when t.total_num is null then ( select sum(pwd.IO_QTY) from platform_wms_detail pwd where pwd.JOB_ID = t.id ) else t.total_num end workNum ")
- .select(" ( select pl.CREATE_DATE from platform_log pl where t.id = pl.obj_id and pl.OBJ_TYPE = 5 order by pl.CREATE_DATE desc limit 1 ) as newStartDate ")
+ .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 ")
.leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
.eq(PlatformJob::getStatus,Constants.PlatformJobStatus.WORKING.getKey())
.eq(PlatformJob::getInOut,Constants.ONE)
--
Gitblit v1.9.3