DMS:完善PDA接口完成保养和完成润滑
master
xins 8 months ago
parent 2bad839d2b
commit d0208b3072

@ -265,12 +265,10 @@ public class DmsMobileController extends BaseController {
@Log(title = "保养工单", businessType = BusinessType.COMPLETE)
@PostMapping("/completeMaint")
public AjaxResult completeMaint(@RequestBody DmsBillsMaintDetail dmsBillsMaintDetail) {
return success(dmsBillsMaintInstanceService.completeMaint(dmsBillsMaintDetail));
}
/**
*
*

@ -3,6 +3,7 @@ package com.hw.dms.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import com.hw.common.core.constant.DmsConstants;
import com.hw.common.core.constant.SecurityConstants;
@ -225,8 +226,9 @@ public class DmsBillsLubeInstanceServiceImpl implements IDmsBillsLubeInstanceSer
@Override
@Transactional(rollbackFor = Exception.class)
public int completeLube(DmsBillsLubeDetail dmsBillsLubeDetail) {
Long lubeInstanceId = dmsBillsLubeDetail.getLubeInstanceId();
DmsBillsLubeInstance dmsBillsLubeInstance = dmsBillsLubeInstanceMapper
.selectDmsBillsLubeInstanceByLubeInstanceId(dmsBillsLubeDetail.getLubeInstanceId());
.selectDmsBillsLubeInstanceByLubeInstanceId(lubeInstanceId);
String lubeStatus = StringUtils.isEmpty(dmsBillsLubeInstance.getLubeStatus()) ?
DmsConstants.DMS_BILLS_LUBE_INSTANCE_STATUS_TO_LUBE : dmsBillsLubeInstance.getLubeStatus();
if (lubeStatus.equals(DmsConstants.DMS_BILLS_LUBE_INSTANCE_STATUS_COMPLETE)) {//润滑完成
@ -240,12 +242,25 @@ public class DmsBillsLubeInstanceServiceImpl implements IDmsBillsLubeInstanceSer
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
//todo:判断是否已都保养完成,修改工单状态
// dmsBillsMaintInstance.setMaintStatus(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_MAINTING);
// dmsBillsMaintInstance.setRealBeginTime(currentDate);
// dmsBillsMaintInstance.setUpdateTime(currentDate);
// dmsBillsMaintInstance.setUpdateBy(userName);
// dmsBillsMaintInstanceMapper.updateDmsBillsMaintInstance(dmsBillsMaintInstance);
DmsBillsLubeDetail queryLubeDetail = new DmsBillsLubeDetail();
queryLubeDetail.setLubeInstanceId(lubeInstanceId);
List<DmsBillsLubeDetail> lubeDetails = dmsBillsLubeDetailMapper.selectDmsBillsLubeDetailList(queryLubeDetail);
/**获取未完成的润滑明细,并且需要排除当前提交完成的润滑明细*/
List<DmsBillsLubeDetail> inCompleteLubeDetails = lubeDetails.stream().
filter(lubeDetail -> !lubeDetail.getBillsLubeDetailId().equals(dmsBillsLubeDetail.getBillsLubeDetailId())
&& (lubeDetail.getMaintStatus() == null || lubeDetail.getMaintStatus().equals("")
|| lubeDetail.getMaintStatus().equals(DmsConstants.DMS_BILLS_LUBE_INSTANCE_STATUS_TO_LUBE)
|| lubeDetail.getMaintStatus().equals(DmsConstants.DMS_BILLS_LUBE_INSTANCE_STATUS_LUBING))).collect(Collectors.toList());
/**如果已经没有未完成的,则需要将工单修改成已完成,并更新结束时间*/
if (inCompleteLubeDetails == null || inCompleteLubeDetails.isEmpty()) {
dmsBillsLubeInstance.setLubeStatus(DmsConstants.DMS_BILLS_LUBE_INSTANCE_STATUS_COMPLETE);
dmsBillsLubeInstance.setRealEndTime(currentDate);
dmsBillsLubeInstance.setUpdateTime(currentDate);
dmsBillsLubeInstance.setUpdateBy(userName);
dmsBillsLubeInstanceMapper.updateDmsBillsLubeInstance(dmsBillsLubeInstance);
}
dmsBillsLubeDetail.setEndTime(currentDate);
dmsBillsLubeDetail.setUpdateBy(userName);

@ -4,6 +4,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import com.hw.common.core.constant.DmsConstants;
import com.hw.common.core.constant.SecurityConstants;
@ -245,8 +246,9 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
@Override
@Transactional(rollbackFor = Exception.class)
public int completeMaint(DmsBillsMaintDetail dmsBillsMaintDetail) {
Long maintInstanceId = dmsBillsMaintDetail.getMaintInstanceId();
DmsBillsMaintInstance dmsBillsMaintInstance = dmsBillsMaintInstanceMapper.
selectDmsBillsMaintInstanceByMaintInstanceId(dmsBillsMaintDetail.getMaintInstanceId());
selectDmsBillsMaintInstanceByMaintInstanceId(maintInstanceId);
Long maintStatus = dmsBillsMaintInstance.getMaintStatus() == null ?
DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_TO_MAINT : dmsBillsMaintInstance.getMaintStatus();
if (maintStatus.equals(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_COMPLETE)) {//保养完成
@ -260,12 +262,25 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
//todo:判断是否已都保养完成,修改工单状态
// dmsBillsMaintInstance.setMaintStatus(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_MAINTING);
// dmsBillsMaintInstance.setRealBeginTime(currentDate);
// dmsBillsMaintInstance.setUpdateTime(currentDate);
// dmsBillsMaintInstance.setUpdateBy(userName);
// dmsBillsMaintInstanceMapper.updateDmsBillsMaintInstance(dmsBillsMaintInstance);
DmsBillsMaintDetail queryMaintDetail = new DmsBillsMaintDetail();
queryMaintDetail.setMaintInstanceId(maintInstanceId);
List<DmsBillsMaintDetail> maintDetails = dmsBillsMaintDetailMapper.selectDmsBillsMaintDetailList(queryMaintDetail);
/**获取未完成的保养明细,并且需要排除当前提交完成的保养明细*/
List<DmsBillsMaintDetail> inCompleteMaintDetails = maintDetails.stream().
filter(maintDetail -> !maintDetail.getBillsMaintDetailId().equals(dmsBillsMaintDetail.getBillsMaintDetailId())
&& (maintDetail.getMaintStatus() == null || maintDetail.getMaintStatus().equals("")
|| maintDetail.getMaintStatus().equals(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_TO_MAINT)
|| maintDetail.getMaintStatus().equals(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_MAINTING))).collect(Collectors.toList());
/**如果已经没有未完成的,则需要将工单修改成已完成,并更新结束时间*/
if (inCompleteMaintDetails == null || inCompleteMaintDetails.isEmpty()) {
dmsBillsMaintInstance.setMaintStatus(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_COMPLETE);
dmsBillsMaintInstance.setRealEndTime(currentDate);
dmsBillsMaintInstance.setUpdateTime(currentDate);
dmsBillsMaintInstance.setUpdateBy(userName);
dmsBillsMaintInstanceMapper.updateDmsBillsMaintInstance(dmsBillsMaintInstance);
}
dmsBillsMaintDetail.setEndTime(currentDate);
dmsBillsMaintDetail.setUpdateBy(userName);

@ -152,4 +152,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
</mapper>

Loading…
Cancel
Save