|
|
|
@ -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);
|
|
|
|
|