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) @Log(title = "保养工单", businessType = BusinessType.COMPLETE)
@PostMapping("/completeMaint") @PostMapping("/completeMaint")
public AjaxResult completeMaint(@RequestBody DmsBillsMaintDetail dmsBillsMaintDetail) { public AjaxResult completeMaint(@RequestBody DmsBillsMaintDetail dmsBillsMaintDetail) {
return success(dmsBillsMaintInstanceService.completeMaint(dmsBillsMaintDetail)); return success(dmsBillsMaintInstanceService.completeMaint(dmsBillsMaintDetail));
} }
/** /**
* *
* *

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

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

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

Loading…
Cancel
Save