|
|
|
@ -2,18 +2,23 @@ package com.glxp.api.service.inv.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
|
import com.glxp.api.dao.inv.DeviceInspectPlanDao;
|
|
|
|
|
import com.glxp.api.dao.inv.DeviceInspectPlanDelectMapper;
|
|
|
|
|
import com.glxp.api.dao.inv.DeviceRepairOrderDao;
|
|
|
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.api.entity.inv.DeviceRepairOrderEntity;
|
|
|
|
|
import com.glxp.api.entity.inv.*;
|
|
|
|
|
import com.glxp.api.req.inv.AddDeviceRepairOrderRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterDeviceRepairOrderRequest;
|
|
|
|
|
import com.glxp.api.res.inv.DeviceRepairOrderResponse;
|
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.service.inv.DeviceInspectOrderService;
|
|
|
|
|
import com.glxp.api.service.inv.DeviceInspectTaskDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.DeviceInspectTaskService;
|
|
|
|
|
import com.glxp.api.service.inv.DeviceRepairOrderService;
|
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
|
import com.glxp.api.util.OrderNoTypeBean;
|
|
|
|
@ -22,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -39,6 +45,15 @@ public class DeviceRepairOrderServiceImpl implements DeviceRepairOrderService {
|
|
|
|
|
private GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceInspectOrderService deviceInspectOrderService;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceInspectTaskService deviceInspectTaskService;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceInspectPlanDelectMapper deviceInspectPlanDelectMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceInspectTaskDetailService deviceInspectTaskDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceInspectPlanDao deviceInspectPlanDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DeviceRepairOrderResponse> filterList(FilterDeviceRepairOrderRequest filterDeviceRepairOrderRequest) {
|
|
|
|
@ -67,7 +82,7 @@ public class DeviceRepairOrderServiceImpl implements DeviceRepairOrderService {
|
|
|
|
|
deviceRepairOrderEntity.setPlanTime(addDeviceRepairOrderRequest.getPlanTime());
|
|
|
|
|
deviceRepairOrderEntity.setUploadImage(addDeviceRepairOrderRequest.getUploadImage());
|
|
|
|
|
deviceRepairOrderDao.insert(deviceRepairOrderEntity);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
return ResultVOUtils.success(deviceRepairOrderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -76,7 +91,7 @@ public class DeviceRepairOrderServiceImpl implements DeviceRepairOrderService {
|
|
|
|
|
BeanUtil.copyProperties(deviceRepairOrderEntity, repairOrderEntity, "id", "createTime", "createUser");
|
|
|
|
|
repairOrderEntity.setUpdateTime(new Date());
|
|
|
|
|
deviceRepairOrderDao.updateById(repairOrderEntity);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
return ResultVOUtils.success(repairOrderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -92,27 +107,25 @@ public class DeviceRepairOrderServiceImpl implements DeviceRepairOrderService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse updateStatus(String orderId, Integer status,String repariName) {
|
|
|
|
|
public BaseResponse updateStatus(String orderId, Integer status, String repariName) {
|
|
|
|
|
if (StrUtil.isBlank(orderId) || null == status) {
|
|
|
|
|
return ResultVOUtils.paramVerifyFail();
|
|
|
|
|
}
|
|
|
|
|
AuthAdmin authAdmin=customerService.getUserBean();
|
|
|
|
|
AuthAdmin authAdmin = customerService.getUserBean();
|
|
|
|
|
DeviceRepairOrderEntity deviceRepairOrderEntity = deviceRepairOrderDao.selectByOrderId(orderId);
|
|
|
|
|
deviceRepairOrderEntity.setStatus(status);
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
// if (status == 2) {
|
|
|
|
|
// //审核通过,生成维保单
|
|
|
|
|
// deviceInspectOrderService.addByRepairOrderId(orderId);
|
|
|
|
|
// deviceRepairOrderEntity.setAuditUser(customerService.getUserIdStr());
|
|
|
|
|
// deviceRepairOrderEntity.setAuditTime(date);
|
|
|
|
|
// }
|
|
|
|
|
deviceRepairOrderEntity.setUpdateTime(date);
|
|
|
|
|
deviceRepairOrderEntity.setAuditTime(date);
|
|
|
|
|
deviceRepairOrderEntity.setAuditUser(authAdmin.getId()+"");
|
|
|
|
|
if(null != repariName){
|
|
|
|
|
deviceRepairOrderEntity.setAuditUser(authAdmin.getId() + "");
|
|
|
|
|
if (null != repariName) {
|
|
|
|
|
deviceRepairOrderEntity.setRepariName(repariName);
|
|
|
|
|
}
|
|
|
|
|
deviceRepairOrderDao.updateById(deviceRepairOrderEntity);
|
|
|
|
|
//生成计划主表
|
|
|
|
|
DeviceInspectTaskEntity deviceInspectTaskEntity = getDeviceInspectTaskEntity(orderId);
|
|
|
|
|
//生成计划详情主表
|
|
|
|
|
getDeviceInspectTaskDetailEntity(orderId, deviceInspectTaskEntity.getOrderId());
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -154,4 +167,53 @@ public class DeviceRepairOrderServiceImpl implements DeviceRepairOrderService {
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//组装任务实体
|
|
|
|
|
public DeviceInspectTaskEntity getDeviceInspectTaskEntity(String orderId) {
|
|
|
|
|
//查询保修单
|
|
|
|
|
DeviceRepairOrderEntity deviceRepairOrderEntity = deviceRepairOrderDao.selectByOrderId(orderId);
|
|
|
|
|
if (deviceRepairOrderEntity == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
String takeOrderId = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.DEVICE_INSPECT_TAKE_ORDER, "yyyyMMdd"));
|
|
|
|
|
DeviceInspectTaskEntity deviceInspectTaskEntity = new DeviceInspectTaskEntity();
|
|
|
|
|
deviceInspectTaskEntity.setOrderId(takeOrderId);
|
|
|
|
|
deviceInspectTaskEntity.setPlanOrderIdFk(orderId);
|
|
|
|
|
deviceInspectTaskEntity.setDeptCode(deviceRepairOrderEntity.getDeptCode());
|
|
|
|
|
deviceInspectTaskEntity.setInvCode(deviceRepairOrderEntity.getInvCode());
|
|
|
|
|
deviceInspectTaskEntity.setCode(deviceRepairOrderEntity.getCode());
|
|
|
|
|
deviceInspectTaskEntity.setStatus(0);
|
|
|
|
|
deviceInspectTaskEntity.setRemark(deviceRepairOrderEntity.getRemark());
|
|
|
|
|
deviceInspectTaskEntity.setCreateTime(new Date());
|
|
|
|
|
deviceInspectTaskEntity.setUpdateTime(new Date());
|
|
|
|
|
deviceInspectTaskService.addDeviceInspectTask(deviceInspectTaskEntity);
|
|
|
|
|
return deviceInspectTaskEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//组装任务实体
|
|
|
|
|
public List<DeviceInspectTaskDetailEntity> getDeviceInspectTaskDetailEntity(String orderId, String taskOrderIdFk) {
|
|
|
|
|
//查询计划详情单
|
|
|
|
|
DeviceInspectPlanEntity deviceInspectPlanEntity = deviceInspectPlanDao.selectByOrderId(orderId);
|
|
|
|
|
List<DeviceInspectTaskDetailEntity> deviceInspectTaskDetailEntityLis = new ArrayList<>();
|
|
|
|
|
QueryWrapper<DeviceInspectPlanDelectEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("orderIdFK", orderId);
|
|
|
|
|
List<DeviceInspectPlanDelectEntity> deviceInspectPlanDelectEntityList = deviceInspectPlanDelectMapper.selectList(ew);
|
|
|
|
|
if (deviceInspectPlanDelectEntityList == null && deviceInspectPlanDelectEntityList.size() == 0) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
for (DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity : deviceInspectPlanDelectEntityList) {
|
|
|
|
|
DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity = new DeviceInspectTaskDetailEntity();
|
|
|
|
|
deviceInspectTaskDetailEntity.setProjectCode(deviceInspectPlanEntity.getCode());
|
|
|
|
|
deviceInspectTaskDetailEntity.setProjectContent(deviceInspectPlanDelectEntity.getContent());
|
|
|
|
|
deviceInspectTaskDetailEntity.setStatus(1);
|
|
|
|
|
deviceInspectTaskDetailEntity.setInspectUser(deviceInspectPlanEntity.getInspectUser());
|
|
|
|
|
deviceInspectTaskDetailEntity.setUpdateTime(new Date());
|
|
|
|
|
deviceInspectTaskDetailEntity.setTaskOrderIdFk(taskOrderIdFk);
|
|
|
|
|
deviceInspectTaskDetailEntityLis.add(deviceInspectTaskDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
deviceInspectTaskDetailService.addDeviceInspectTaskDelectList(deviceInspectTaskDetailEntityLis);
|
|
|
|
|
return deviceInspectTaskDetailEntityLis;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|