|
|
@@ -5,14 +5,22 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zksy.base.domain.WorkOrder;
|
|
|
+import com.zksy.base.domain.WorkOrderLog;
|
|
|
+import com.zksy.base.mapper.WorkOrderLogMapper;
|
|
|
import com.zksy.base.mapper.WorkOrderMapper;
|
|
|
import com.zksy.base.service.WorkOrderService;
|
|
|
+import com.zksy.common.core.domain.entity.SysUser;
|
|
|
+import com.zksy.common.exception.ServiceException;
|
|
|
+import com.zksy.manhole.dto.in.WorkOrderOperInDTO;
|
|
|
import com.zksy.manhole.dto.in.WorkOrderPageInDTO;
|
|
|
import com.zksy.manhole.dto.out.WorkOrderOutDTO;
|
|
|
+import com.zksy.system.service.ISysUserService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -25,6 +33,12 @@ import java.util.List;
|
|
|
public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder>
|
|
|
implements WorkOrderService{
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysUserService sysUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WorkOrderLogMapper workOrderLogMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 分页查询工单信息列表
|
|
|
* @param pageInDTO
|
|
|
@@ -44,6 +58,67 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
|
|
|
outPage.setRecords(outDTOList);
|
|
|
return outPage;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 操作工单
|
|
|
+ * @param inDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public boolean operWorkOrder(WorkOrderOperInDTO inDTO) {
|
|
|
+ log.info("操作工单-入参:{}", inDTO);
|
|
|
+ WorkOrder workOrder = this.getById(inDTO.getOrderId());
|
|
|
+ if(workOrder == null){
|
|
|
+ throw new ServiceException("工单ID不存在");
|
|
|
+ }
|
|
|
+ SysUser user = sysUserService.selectUserById(inDTO.getOperUserId());
|
|
|
+ if(user == null){
|
|
|
+ throw new ServiceException("操作人ID不存在");
|
|
|
+ }
|
|
|
+ if(inDTO.getOperType() == null){
|
|
|
+ throw new ServiceException("操作类型不能为空");
|
|
|
+ }
|
|
|
+ WorkOrder entity = new WorkOrder();
|
|
|
+ entity.setOrderId(inDTO.getOrderId());
|
|
|
+ if(inDTO.getOperType() == 2){
|
|
|
+ //2-派单
|
|
|
+ entity.setOrderStatus(2);
|
|
|
+ entity.setDispatchUser(inDTO.getOperUserId());
|
|
|
+ entity.setDispatchTime(new Date());
|
|
|
+ entity.setReceiveUser(inDTO.getReceiveUser());
|
|
|
+ } else if(inDTO.getOperType() == 3){
|
|
|
+ //3-接单
|
|
|
+ entity.setOrderStatus(3);
|
|
|
+ entity.setReceiveUser(inDTO.getOperUserId());
|
|
|
+ } else if(inDTO.getOperType() == 4){
|
|
|
+ //4-开始维修
|
|
|
+ entity.setOrderStatus(4);
|
|
|
+ } else if(inDTO.getOperType() == 5){
|
|
|
+ //5-提交验收
|
|
|
+ entity.setOrderStatus(5);
|
|
|
+ entity.setVerifyUser(workOrder.getDispatchUser());
|
|
|
+ } else if(inDTO.getOperType() == 6){
|
|
|
+ //6-验收通过
|
|
|
+ entity.setOrderStatus(6);
|
|
|
+ entity.setVerifyUser(inDTO.getOperUserId());
|
|
|
+ entity.setVerifyTime(new Date());
|
|
|
+ } else if(inDTO.getOperType() == 7){
|
|
|
+ //7-驳回工单
|
|
|
+ entity.setOrderStatus(7);
|
|
|
+ } else if(inDTO.getOperType() == 8){
|
|
|
+ //8-申请延期
|
|
|
+ entity.setOrderStatus(8);
|
|
|
+ entity.setDelayedReason(inDTO.getDelayedReason());
|
|
|
+ entity.setDelayedDeadline(inDTO.getDelayedDeadline());
|
|
|
+ } else if(inDTO.getOperType() == 9){
|
|
|
+ //9-延期审核通过
|
|
|
+ entity.setOrderStatus(9);
|
|
|
+ }
|
|
|
+ WorkOrderLog workOrderLog = BeanUtil.copyProperties(inDTO, WorkOrderLog.class);
|
|
|
+ workOrderLog.setOperUserName(user.getNickName());
|
|
|
+ workOrderLogMapper.insert(workOrderLog);
|
|
|
+ return this.updateById(entity);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|