|  |  | @ -2,18 +2,23 @@ package com.glxp.api.service.inv.impl; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.bean.BeanUtil; |  |  |  | import cn.hutool.core.bean.BeanUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.util.StrUtil; |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.github.pagehelper.PageHelper; |  |  |  | import com.github.pagehelper.PageHelper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.res.BaseResponse; |  |  |  | import com.glxp.api.common.res.BaseResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.util.ResultVOUtils; |  |  |  | import com.glxp.api.common.util.ResultVOUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.constant.Constant; |  |  |  | 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.dao.inv.DeviceRepairOrderDao; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.auth.AuthAdmin; |  |  |  | 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.AddDeviceRepairOrderRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.inv.FilterDeviceRepairOrderRequest; |  |  |  | import com.glxp.api.req.inv.FilterDeviceRepairOrderRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.inv.DeviceRepairOrderResponse; |  |  |  | import com.glxp.api.res.inv.DeviceRepairOrderResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.auth.CustomerService; |  |  |  | import com.glxp.api.service.auth.CustomerService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inv.DeviceInspectOrderService; |  |  |  | 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.service.inv.DeviceRepairOrderService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.GennerOrderUtils; |  |  |  | import com.glxp.api.util.GennerOrderUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.OrderNoTypeBean; |  |  |  | import com.glxp.api.util.OrderNoTypeBean; | 
			
		
	
	
		
		
			
				
					|  |  | @ -22,6 +27,7 @@ import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.transaction.annotation.Transactional; |  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.annotation.Resource; |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.util.ArrayList; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Collections; |  |  |  | import java.util.Collections; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Date; |  |  |  | import java.util.Date; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.List; |  |  |  | import java.util.List; | 
			
		
	
	
		
		
			
				
					|  |  | @ -39,6 +45,15 @@ public class DeviceRepairOrderServiceImpl implements DeviceRepairOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     private GennerOrderUtils gennerOrderUtils; |  |  |  |     private GennerOrderUtils gennerOrderUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     private DeviceInspectOrderService deviceInspectOrderService; |  |  |  |     private DeviceInspectOrderService deviceInspectOrderService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private DeviceInspectTaskService deviceInspectTaskService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private DeviceInspectPlanDelectMapper deviceInspectPlanDelectMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private DeviceInspectTaskDetailService deviceInspectTaskDetailService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private DeviceInspectPlanDao deviceInspectPlanDao; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Override |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |     public List<DeviceRepairOrderResponse> filterList(FilterDeviceRepairOrderRequest filterDeviceRepairOrderRequest) { |  |  |  |     public List<DeviceRepairOrderResponse> filterList(FilterDeviceRepairOrderRequest filterDeviceRepairOrderRequest) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -100,12 +115,6 @@ public class DeviceRepairOrderServiceImpl implements DeviceRepairOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         DeviceRepairOrderEntity deviceRepairOrderEntity = deviceRepairOrderDao.selectByOrderId(orderId); |  |  |  |         DeviceRepairOrderEntity deviceRepairOrderEntity = deviceRepairOrderDao.selectByOrderId(orderId); | 
			
		
	
		
		
			
				
					
					|  |  |  |         deviceRepairOrderEntity.setStatus(status); |  |  |  |         deviceRepairOrderEntity.setStatus(status); | 
			
		
	
		
		
			
				
					
					|  |  |  |         Date date = new Date(); |  |  |  |         Date date = new Date(); | 
			
		
	
		
		
			
				
					
					|  |  |  | //        if (status == 2) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            //审核通过,生成维保单
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            deviceInspectOrderService.addByRepairOrderId(orderId);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            deviceRepairOrderEntity.setAuditUser(customerService.getUserIdStr());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            deviceRepairOrderEntity.setAuditTime(date);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         deviceRepairOrderEntity.setUpdateTime(date); |  |  |  |         deviceRepairOrderEntity.setUpdateTime(date); | 
			
		
	
		
		
			
				
					
					|  |  |  |         deviceRepairOrderEntity.setAuditTime(date); |  |  |  |         deviceRepairOrderEntity.setAuditTime(date); | 
			
		
	
		
		
			
				
					
					|  |  |  |         deviceRepairOrderEntity.setAuditUser(authAdmin.getId() + ""); |  |  |  |         deviceRepairOrderEntity.setAuditUser(authAdmin.getId() + ""); | 
			
		
	
	
		
		
			
				
					|  |  | @ -113,6 +122,10 @@ public class DeviceRepairOrderServiceImpl implements DeviceRepairOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |             deviceRepairOrderEntity.setRepariName(repariName); |  |  |  |             deviceRepairOrderEntity.setRepariName(repariName); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         deviceRepairOrderDao.updateById(deviceRepairOrderEntity); |  |  |  |         deviceRepairOrderDao.updateById(deviceRepairOrderEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //生成计划主表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         DeviceInspectTaskEntity deviceInspectTaskEntity = getDeviceInspectTaskEntity(orderId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //生成计划详情主表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         getDeviceInspectTaskDetailEntity(orderId, deviceInspectTaskEntity.getOrderId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         return ResultVOUtils.success(); |  |  |  |         return ResultVOUtils.success(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -154,4 +167,53 @@ public class DeviceRepairOrderServiceImpl implements DeviceRepairOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return ResultVOUtils.success(); |  |  |  |         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; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |