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