|
|
|
@ -68,14 +68,6 @@ public class DeviceInspectPlanServiceImpl implements DeviceInspectPlanService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse addDeviceInspectPlan(AddDeviceInspectPlanRequest deviceInspectPlanRequest) {
|
|
|
|
|
//判断启用状态下只有一条
|
|
|
|
|
QueryWrapper<DeviceInspectPlanEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("code", deviceInspectPlanRequest.getCode());
|
|
|
|
|
ew.eq("planStatus", 2);
|
|
|
|
|
Long count = deviceInspectPlanDao.selectCount(ew);
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
return ResultVOUtils.error(999, "已存在该设备启用的计划!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeviceInspectPlanEntity deviceInspectPlanEntity = new DeviceInspectPlanEntity();
|
|
|
|
|
BeanUtil.copyProperties(deviceInspectPlanRequest, deviceInspectPlanEntity);
|
|
|
|
@ -92,17 +84,6 @@ public class DeviceInspectPlanServiceImpl implements DeviceInspectPlanService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse updateDeviceInspectPlan(DeviceInspectPlanEntity deviceInspectPlanEntity) {
|
|
|
|
|
if(deviceInspectPlanEntity.getPlanStatus() == 2){
|
|
|
|
|
QueryWrapper<DeviceInspectPlanEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("code", deviceInspectPlanEntity.getCode());
|
|
|
|
|
ew.eq("planStatus", 2);
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
DeviceInspectPlanEntity deviceInspectPlanEntity1 = deviceInspectPlanDao.selectOne(ew);
|
|
|
|
|
if (deviceInspectPlanEntity1 != null && !deviceInspectPlanEntity1.getId().equals(deviceInspectPlanEntity.getId())) {
|
|
|
|
|
return ResultVOUtils.error(999, "已存在该设备启用的计划!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeviceInspectPlanEntity deviceInspectPlan = deviceInspectPlanDao.selectById(deviceInspectPlanEntity.getId());
|
|
|
|
|
BeanUtil.copyProperties(deviceInspectPlanEntity, deviceInspectPlan, "id", "createTime", "createUser");
|
|
|
|
|
deviceInspectPlan.setUpdateTime(new Date());
|
|
|
|
@ -136,10 +117,10 @@ public class DeviceInspectPlanServiceImpl implements DeviceInspectPlanService {
|
|
|
|
|
deviceInspectPlanEntity.setAuditUser(customerService.getUserIdStr());
|
|
|
|
|
// //审核通过,生成任务单
|
|
|
|
|
// deviceInspectOrderService.addByPlanOrderId(orderId);
|
|
|
|
|
//生成计划主表
|
|
|
|
|
DeviceInspectTaskEntity deviceInspectTaskEntity = getDeviceInspectTaskEntity(orderId,expectedTime);
|
|
|
|
|
//生成计划详情主表
|
|
|
|
|
getDeviceInspectTaskDetailEntity(orderId, deviceInspectTaskEntity.getOrderId());
|
|
|
|
|
// //生成计划主表
|
|
|
|
|
// DeviceInspectTaskEntity deviceInspectTaskEntity = getDeviceInspectTaskEntity(orderId,expectedTime);
|
|
|
|
|
// //生成计划详情主表
|
|
|
|
|
// getDeviceInspectTaskDetailEntity(orderId, deviceInspectTaskEntity.getOrderId());
|
|
|
|
|
}
|
|
|
|
|
deviceInspectPlanDao.updateById(deviceInspectPlanEntity);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|