| 
					
				 | 
			
			
				@@ -30,10 +30,10 @@ import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Component 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class Business { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    RepairBusiness repairBusiness; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Business business; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ItfTblAssignDownloadService itfTblAssignDownloadService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -83,7 +83,6 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 1:工单落入本地表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Scheduled(fixedDelay = 1 * 10 * 1000) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void inputOrder() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -91,7 +90,6 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<ItfTblAssignDownload> repairRec = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Long> pgids = new ArrayList<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -138,31 +136,11 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (orderBaselist.contains(String.valueOf(item.getPgid()))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     log.info("修改:"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // TL_SynDataFrom_tbl_assign_batch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // TL_SynDataFrom_tbl_assign 主单的 syn_req_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 处理维修工单主表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    modifyOrderBase(brand, sysDictRefDLMap, item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    OrderBase order = orderBaseService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .eq(OrderBase::getPgid, item.getPgid()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .eq(OrderBase::getOrderType, OrderTypeEnum.ORDER_TYPE_REPAIR.getCode()).one(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 工单师傅信息更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    upOrderWorker(order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 工单扩展信息更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    getOrderInstall(item, order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 维修单明细表更新 TL_SynDataFrom_tbl_assign_mx 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    generateMxUpdate(brand, item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    business.updateOrder(brand, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // 新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 新增 TL_SynDataFrom_tbl_assign_batch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     log.info("新增:"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    repairBusiness.addOrder(brand, item, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    business.addOrder(brand, item, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     orderBaselist.add(String.valueOf(item.getPgid())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -175,6 +153,36 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("维修工单落本地表处理完成: {}",sdf.format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void updateOrder(Brand brand, Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap, Map<String, List<SysDictRef>> sysDictRefXiLieMap, ItfTblAssignDownload item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ItfTblAssignXzydDownload> yds = itfTblAssignXzydDownloadService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(ItfTblAssignXzydDownload::getDownloadTaskNo, item.getDownloadTaskNo()).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // TL_SynDataFrom_tbl_assign_batch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // TL_SynDataFrom_tbl_assign 主单的 syn_req_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 处理维修工单主表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        modifyOrderBase(brand, sysDictRefDLMap, item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OrderBase order = orderBaseService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(OrderBase::getPgid, item.getPgid()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(OrderBase::getOrderType, OrderTypeEnum.ORDER_TYPE_REPAIR.getCode()).one(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 工单师傅信息更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        upOrderWorker(order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 工单扩展信息更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        getOrderInstall(item, order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 维修单明细表更新 TL_SynDataFrom_tbl_assign_mx 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        generateMxUpdate(brand, item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 处理维修单过程反馈(只新增不修改)  放入操作日志表 TL_SynDataFrom_tbl_assign_fkmx 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        generateFkmxUpdate(brand, item, order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 处理用户评价数据 TL_SynDataFrom_tbl_assign_satisfaction 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        generateSstisfactionUpdate(brand, item, sysDictRefDLMap, order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 阅读要求数据处理 TL_SynDataFrom_tbl_assign_xzyd 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        generateXzydUpdate(brand, yds, order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 用户预约改约数据处理 TL_SynDataFrom_tbl_assign_appointment 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        generateAppointmentUpdate(item, order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private void upOrderWorker(OrderBase order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (StringUtils.isEmpty(order.getWorkerName())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 清理师傅表 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -242,7 +250,7 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 增加判断是否有未处理的待改派,如果广佛有待改派但总部工单不是待改派,直接更新改派标志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 无删除标识,暂不处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 增加处理采集数据下载 新增不用操作 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 增加处理采集数据下载 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ((oldOrder.getOrderStatus().equals("B41") || oldOrder.getOrderStatus().equals("B102")) && cjDowFlag ==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<OrderRepairDetail> ords = orderRepairDetailService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     .eq(OrderRepairDetail::getOrderBaseId,oldOrder.getId()) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -251,7 +259,7 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!(ords !=null && ords.size()>0)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 清除待采集数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 delOrderRepairDetail(oldOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 向表内写数据,另起任务下载数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 向表内写数据,另起任务下载数据 todo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 修改基础表已采集下载标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 OrderBase up = new OrderBase(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -375,18 +383,13 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 更新网点信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 字段赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            OrderBase upOrder = getOrderBase(brand, item, oldOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            orderBaseService.updateById(upOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            oldOrder = orderBaseService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .eq(OrderBase::getPgid, item.getPgid()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .eq(OrderBase::getOrderType, OrderTypeEnum.ORDER_TYPE_REPAIR.getCode()).one(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            getOrderBase(brand, item, oldOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orderBaseService.updateById(oldOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @NotNull 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private OrderBase getOrderBase(Brand brand, ItfTblAssignDownload item, OrderBase oldOrder) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        OrderBase upOrder = new OrderBase(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        upOrder.setId(oldOrder.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void getOrderBase(Brand brand, ItfTblAssignDownload item, OrderBase upOrder) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (StringUtils.isNotEmpty(item.getXxlb())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             upOrder.setInfoType(item.getXxlb()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -415,7 +418,6 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             upOrder.setReceWebsitId(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             upOrder.setReceWebsitName(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return upOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @NotNull 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -462,7 +464,7 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         upOrder.setId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         upOrder.setOutUpdateSynReqId(item.getSynReqId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         upOrder.setOutUpdateSynReqTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        upOrder.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // upOrder.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return upOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -496,56 +498,161 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private void generateAppointment(ItfTblAssignDownload item, OrderBase order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OrderBase up = new OrderBase(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ItfTblAssignAppointmentDownload> us = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 新增工单,直接修改主表预约时间最近一次的数据修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<ItfTblAssignAppointmentDownload> appoint = itfTblAssignAppointmentDownloadService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(ItfTblAssignAppointmentDownload::getDownloadTaskNo, item.getDownloadTaskNo()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .orderByAsc(ItfTblAssignAppointmentDownload::getSynReqId).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (ItfTblAssignAppointmentDownload a:appoint){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            OrderBase up = new OrderBase(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             up.setId(order.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 这里填写首次预约人信息同时也方便其他地方以此来判断该订单是否已预约 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             up.setFirstAppointmentId(a.getCzren()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             up.setExpectStartTime(a.getKssj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             up.setExpectEndTime(a.getJssj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ItfTblAssignAppointmentDownload u = new ItfTblAssignAppointmentDownload(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            u.setSynReqId(a.getSynReqId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            u.setSynStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            u.setSynTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            us.add(u); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (appoint !=null && appoint.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderBaseService.updateById(up); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            itfTblAssignAppointmentDownloadService.updateBatchById(us); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            us.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void generateAppointmentUpdate(ItfTblAssignDownload item, OrderBase order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OrderBase up = new OrderBase(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ItfTblAssignAppointmentDownload> us = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 新增工单,直接修改主表预约时间最近一次的数据修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ItfTblAssignAppointmentDownload> appoint = itfTblAssignAppointmentDownloadService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(ItfTblAssignAppointmentDownload::getDownloadTaskNo, item.getDownloadTaskNo()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .orderByAsc(ItfTblAssignAppointmentDownload::getSynReqId).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (ItfTblAssignAppointmentDownload a:appoint){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            up.setId(order.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 这里填写首次预约人信息同时也方便其他地方以此来判断该订单是否已预约 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            up.setFirstAppointmentId(a.getCzren()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            up.setExpectStartTime(a.getKssj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            up.setExpectEndTime(a.getJssj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ItfTblAssignAppointmentDownload u = new ItfTblAssignAppointmentDownload(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             u.setSynReqId(a.getSynReqId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             u.setSynStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             u.setSynTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            itfTblAssignAppointmentDownloadService.updateById(u); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            us.add(u); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (appoint !=null && appoint.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isEmpty(order.getFirstAppointmentId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                orderBaseService.updateById(up); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            itfTblAssignAppointmentDownloadService.updateBatchById(us); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            us.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private void generateXzyd(Brand brand, List<ItfTblAssignXzydDownload> yds, OrderBase order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<OrderInformation> oilist = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ItfTblAssignXzydDownload> ups = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (ItfTblAssignXzydDownload yd: yds){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            OrderInformation add = new OrderInformation(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setId(String.valueOf(yd.getXzid())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setAskCategoryId(yd.getXzyqlb()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setAskCategoryName(yd.getXzyq()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setOrderBaseId(order.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setCreateBy(yd.getCreatedBy()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setCreateTime(yd.getCreatedDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setUpdateBy(yd.getLastModifiedBy()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setUpdateTime(yd.getLastModifiedDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setReadStatus(yd.getYdbz()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setReadName(yd.getYdrmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setReadTime(yd.getYdsj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            WebsitSH websitSH = publicService.WebsitToSH(yd.getWdno(), brand.getBrandId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setWebsitId(websitSH.getWdId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setWebsitName(websitSH.getWdmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            orderInformationService.save(add); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 获取阅读要求数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            getAddOrderInfor(brand, order, oilist, yd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ItfTblAssignXzydDownload up = new ItfTblAssignXzydDownload(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             up.setSynReqId(yd.getSynReqId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             up.setSynStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             up.setSynTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            itfTblAssignXzydDownloadService.updateById(up); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ups.add(up); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (oilist.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orderInformationService.saveBatch(oilist); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            oilist.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ups.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            itfTblAssignXzydDownloadService.updateBatchById(ups); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ups.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void generateXzydUpdate(Brand brand, List<ItfTblAssignXzydDownload> yds, OrderBase order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<OrderInformation> oilist = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<OrderInformation> oilistUp = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ItfTblAssignXzydDownload> ups = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String,List<OrderInformation>> oisMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 提取原有的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<OrderInformation> ois = orderInformationService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(OrderInformation::getOrderBaseId,order.getId()).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        oisMap = ois.stream().collect(Collectors.groupingBy(OrderInformation::getId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (ItfTblAssignXzydDownload yd: yds){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 存在修改,不存在新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (oisMap.containsKey(String.valueOf(yd.getXzid()))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                getUpOrderInfor(brand, oilistUp, yd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                getAddOrderInfor(brand, order, oilist, yd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ItfTblAssignXzydDownload up = new ItfTblAssignXzydDownload(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            up.setSynReqId(yd.getSynReqId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            up.setSynStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            up.setSynTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ups.add(up); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (oilist.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orderInformationService.saveBatch(oilist); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            oilist.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (oilistUp.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orderInformationService.updateBatchById(oilistUp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            oilistUp.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ups.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            itfTblAssignXzydDownloadService.updateBatchById(ups); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ups.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void getUpOrderInfor(Brand brand, List<OrderInformation> oilistUp, ItfTblAssignXzydDownload yd) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OrderInformation up = new OrderInformation(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        up.setId(String.valueOf(yd.getXzid())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        up.setAskCategoryId(yd.getXzyqlb()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        up.setAskCategoryName(yd.getXzyq()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        up.setReadStatus(yd.getYdbz()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        up.setReadTime(yd.getYdsj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        up.setReadName(yd.getYdrmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WebsitSH websitSH = publicService.WebsitToSH(yd.getWdno(), brand.getBrandId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        up.setWebsitId(websitSH.getWdId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        up.setWebsitName(websitSH.getWdmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        oilistUp.add(up); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void getAddOrderInfor(Brand brand, OrderBase order, List<OrderInformation> oilist, ItfTblAssignXzydDownload yd) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OrderInformation add = new OrderInformation(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setId(String.valueOf(yd.getXzid())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setAskCategoryId(yd.getXzyqlb()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setAskCategoryName(yd.getXzyq()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setOrderBaseId(order.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setCreateBy(yd.getCreatedBy()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setCreateTime(yd.getCreatedDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setUpdateBy(yd.getLastModifiedBy()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setUpdateTime(yd.getLastModifiedDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setReadStatus(yd.getYdbz()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setReadName(yd.getYdrmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setReadTime(yd.getYdsj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WebsitSH websitSH = publicService.WebsitToSH(yd.getWdno(), brand.getBrandId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setWebsitId(websitSH.getWdId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setWebsitName(websitSH.getWdmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        oilist.add(add); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private void generateSstisfaction(Brand brand, ItfTblAssignDownload item, Map<String, List<SysDictRef>> sysDictRefDLMap, OrderBase order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<ItfTblAssignSatisfactionDownload> satis = itfTblAssignSatisfactionDownloadService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(ItfTblAssignSatisfactionDownload::getDownloadTaskNo, item.getDownloadTaskNo()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .orderByAsc(ItfTblAssignSatisfactionDownload::getHfsj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (ItfTblAssignSatisfactionDownload s:satis){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -568,8 +675,65 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 upSyncstatus(s.getSynReqId(), 9 ,"评价已同步,忽略更新"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 判断评价是否为中差评,如果是中差评,检查上一条记录是否为中差评,如果是则新插入的不需要再申诉 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 这里并没查表, 需要一张表类工单系统 TL_get_satisfaction_pjly(itf_tbl_satisfaction_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 判断评价是否为中差评,下面处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer canInsert =1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 检查fa_order_repair是否有一条sxlx = 0的首评记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (s.getSxlx().equals(0) && s.getSynStatus().equals(0)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ReAppointment r = new ReAppointment(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                r.setId(String.valueOf(s.getSynReqId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ItfTblAssignSatisfactionDownload sa = assignSatisfactionDownloadMapper.getSatisfaction(r); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (sa !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    canInsert = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 只插入一条sxlx = 0的首评记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (canInsert.equals(1)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 增加评价记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                WebsitSH websitSH = addappraise(brand, sysDictRefDLMap, s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 增加差评短信 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                addcpsms(order, s, websitSH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 已评价过 新增时基础表不再操作追评 因为工单基础表无追评数据可存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (order.getAppraiseTime() ==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 这里为首次评价 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                upOrderBasePJ(order, s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 修改同步状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            upSatisfactionSynstatus(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void generateSstisfactionUpdate(Brand brand, ItfTblAssignDownload item, Map<String, List<SysDictRef>> sysDictRefDLMap, OrderBase order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ItfTblAssignSatisfactionDownload> satis = itfTblAssignSatisfactionDownloadService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(ItfTblAssignSatisfactionDownload::getDownloadTaskNo, item.getDownloadTaskNo()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .orderByAsc(ItfTblAssignSatisfactionDownload::getHfsj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (ItfTblAssignSatisfactionDownload s:satis){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 查看是否已同步 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ReAppointment request = new ReAppointment(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            request.setId(s.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OrderAppraise old = appraiseMapper.getAppraise(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (old!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                upSyncstatus(s.getSynReqId(), 9, "评价已同步,忽略更新"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 查看该工单有无较早前下载相同的评价(同一工单,同一主键,同一内容,更早时间) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<ItfTblAssignSatisfactionDownload> rec = itfTblAssignSatisfactionDownloadService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .lt(ItfTblAssignSatisfactionDownload::getSynReqId,s.getSynReqId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .eq(ItfTblAssignSatisfactionDownload::getPgid,s.getPgid()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .eq(ItfTblAssignSatisfactionDownload::getId,s.getId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .le(ItfTblAssignSatisfactionDownload::getLastModifiedDate,s.getLastModifiedDate()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .eq(ItfTblAssignSatisfactionDownload::getPjly,s.getPjly()).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (rec!=null && rec.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                upSyncstatus(s.getSynReqId(), 9 ,"评价已同步,忽略更新"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 判断评价是否为中差评,下面处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer canInsert =1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 检查fa_order_repair是否有一条sxlx = 0的首评记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (s.getSxlx().equals(0) && s.getSynStatus().equals(0)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -580,7 +744,7 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     canInsert = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             // 只插入一条sxlx = 0的首评记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 只插入一条sxlx = 0的首评记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (canInsert.equals(1)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 增加评价记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 WebsitSH websitSH = addappraise(brand, sysDictRefDLMap, s); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -588,9 +752,10 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 addcpsms(order, s, websitSH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 已评价过,则更新追评  新增时无,不需操作 appraise_datetime字段新增时无操作,只需查工单基础表,判断不为null即可 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 这里改为首次评价 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            upOrderBasePJ(order, s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 未评价过工单基础表写入首次评价数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (order.getAppraiseTime() ==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                upOrderBasePJ(order, s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 修改同步状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             upSatisfactionSynstatus(s); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -629,7 +794,6 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 检查上一条记录是否为中差评,如果是则新插入的不需要再申诉 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (canAppeal){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ReAppointment req = new ReAppointment(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             req.setId(String.valueOf(s.getPgid())); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -706,43 +870,8 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .orderByAsc(ItfTblAssignFkmxDownload::getCreatedDate,ItfTblAssignFkmxDownload::getFkid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (ItfTblAssignFkmxDownload fkmx :fkmxRec){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 查看是否存在,存在为修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 新增时是不会存在的,所以这里只做新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            OrderRepairOperatingLog add = new OrderRepairOperatingLog(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setWebsitName(order.getWebsitName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setWebsitId(order.getWebsitId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setOrderBaseId(order.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setCustomerName(order.getUserName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setCustomerPhone(order.getUserMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setType(fkmx.getFklb()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setContent(fkmx.getFknr()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setFeedback(fkmx.getFkjg()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setOperator(fkmx.getFkren()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setOperatorNumber(fkmx.getFkrenmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            WebsitSH websitSH = publicService.WebsitToSH(fkmx.getFkwdno(), brand.getBrandId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setOperateWebsit(websitSH.getWdmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setWebsitPhone(websitSH.getWdlxdh()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setWorkerOrderStatus(order.getOrderStatus());// 反馈时的工单状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setBeforeOrderStatus(order.getLastOrderStatus());// 操作前工单状态 - 上一流程状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setBeforeDispatchStatus(order.getDispatchStatus());// 操作前派工状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setOrderStatus("DJS"); // 操作后工单状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 总部下来的工单统一为待接收状态-派工状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setDispatchStatus("DJS"); // 操作后派工状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 附件地址 todo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setPgguid(order.getPgguid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setFkmxguid(fkmx.getFkmxguid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setFkid(String.valueOf(fkmx.getFkid())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setPgid(fkmx.getPgid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setBrandFileId(fkmx.getScid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setBrandFileName(fkmx.getScwj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setWjid(fkmx.getWjid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setReqSourceNum(fkmx.getQqlyxh()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setUploadNotifyFlag(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setCreateTime(fkmx.getFksj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setUpdateTime(fkmx.getLastModifiedDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setCreateBy(fkmx.getCreatedBy()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            add.setUpdateBy(fkmx.getLastModifiedBy()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            orols.add(add); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 获取操作明细数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            getoroldata(brand, order, orols, fkmx); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ItfTblAssignFkmxDownload u = new ItfTblAssignFkmxDownload(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             u.setSynReqId(fkmx.getSynReqId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             u.setSynStatus(1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -757,6 +886,81 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void generateFkmxUpdate(Brand brand, ItfTblAssignDownload item, OrderBase order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ItfTblAssignFkmxDownload> fkmxRec = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<OrderRepairOperatingLog> orols = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ItfTblAssignFkmxDownload> ups = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, List<OrderRepairOperatingLog>> orolMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 提取已有的,有则更新,无则新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<OrderRepairOperatingLog> olds = orderRepairOperatingLogService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(OrderRepairOperatingLog::getOrderBaseId,order.getId()).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orolMap = olds.stream().collect(Collectors.groupingBy(OrderRepairOperatingLog::getFkid)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        fkmxRec = itfTblAssignFkmxDownloadService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(ItfTblAssignFkmxDownload::getDownloadTaskNo, item.getDownloadTaskNo()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(ItfTblAssignFkmxDownload::getSynStatus,0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .orderByAsc(ItfTblAssignFkmxDownload::getCreatedDate,ItfTblAssignFkmxDownload::getFkid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (ItfTblAssignFkmxDownload fkmx :fkmxRec){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 存在不做更新?过程是这样写的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!orolMap.containsKey(fkmx.getFkid())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                getoroldata(brand, order, orols, fkmx); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ItfTblAssignFkmxDownload u = new ItfTblAssignFkmxDownload(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            u.setSynReqId(fkmx.getSynReqId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            u.setSynStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            u.setSynTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ups.add(u); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (orols.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orderRepairOperatingLogService.saveBatch(orols); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orols.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            itfTblAssignFkmxDownloadService.updateBatchById(ups); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ups.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void getoroldata(Brand brand, OrderBase order, List<OrderRepairOperatingLog> orols, ItfTblAssignFkmxDownload fkmx) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OrderRepairOperatingLog add = new OrderRepairOperatingLog(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setWebsitName(order.getWebsitName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setWebsitId(order.getWebsitId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setOrderBaseId(order.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setCustomerName(order.getUserName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setCustomerPhone(order.getUserMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setType(fkmx.getFklb()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setContent(fkmx.getFknr()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setFeedback(fkmx.getFkjg()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setOperator(fkmx.getFkren()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setOperatorNumber(fkmx.getFkrenmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WebsitSH websitSH = publicService.WebsitToSH(fkmx.getFkwdno(), brand.getBrandId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setOperateWebsit(websitSH.getWdmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setWebsitPhone(websitSH.getWdlxdh()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setWorkerOrderStatus(order.getOrderStatus());// 反馈时的工单状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setBeforeOrderStatus(order.getLastOrderStatus());// 操作前工单状态 - 上一流程状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setBeforeDispatchStatus(order.getDispatchStatus());// 操作前派工状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setOrderStatus("DJS"); // 操作后工单状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 总部下来的工单统一为待接收状态-派工状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setDispatchStatus("DJS"); // 操作后派工状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 附件地址 todo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setPgguid(order.getPgguid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setFkmxguid(fkmx.getFkmxguid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setFkid(String.valueOf(fkmx.getFkid())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setPgid(fkmx.getPgid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setBrandFileId(fkmx.getScid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setBrandFileName(fkmx.getScwj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setWjid(fkmx.getWjid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setReqSourceNum(fkmx.getQqlyxh()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setUploadNotifyFlag(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setCreateTime(fkmx.getFksj()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setUpdateTime(fkmx.getLastModifiedDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setCreateBy(fkmx.getCreatedBy()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        add.setUpdateBy(fkmx.getLastModifiedBy()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orols.add(add); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private void getOrderInstall(ItfTblAssignDownload item, OrderBase order) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         OrderInstall oit = new OrderInstall(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         oit.setOrderBaseId(order.getId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -843,13 +1047,11 @@ public class RepairBusiness { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<ItfTblAssignMxDownload> ups = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, List<OrderProduct>> opsMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 提取现有的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<OrderProduct> ops = orderProductService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(OrderProduct::getOrderBaseId,order.getId()).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        opsMap = ops.stream(). 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                collect(Collectors.groupingBy(OrderProduct::getPgmxid)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        opsMap = ops.stream().collect(Collectors.groupingBy(OrderProduct::getPgmxid)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 提取明细表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mxRec = itfTblAssignMxDownloadService.lambdaQuery() 
			 |