yaozhixue 1 year ago
parent
commit
a48b55d3ad

+ 1 - 1
src/main/java/com/zfire/jiasm/syncdata/service/impl/AddInstallBusinessImpl.java

@@ -192,7 +192,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
         List<OrderAppeal> orderAppeal = new ArrayList<>();
         List<ItfGreeToFaDownloadTaskList> its = new ArrayList<>();
 
-        // 工单机型
+        // 工单产品
         List<ItfTblAzAssignMxDownload> orderMx = itfTblAzAssignMxDownloadService.lambdaQuery()
                 .eq(ItfTblAzAssignMxDownload::getDownloadTaskNo, item.getDownloadTaskNo())
                 .eq(ItfTblAzAssignMxDownload::getSynStatus,0)

+ 179 - 4
src/main/java/com/zfire/jiasm/syncdata/service/impl/DetailDownloadServiceImpl.java

@@ -366,7 +366,7 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
 	}
 
 
-	public void processOrderInstallDetailJ(String downloadTaskNo, String pgguid) {
+	public void processOrderInstallDetailJBak(String downloadTaskNo, String pgguid) {
 		List<OrderInstallDetail> oids = new ArrayList<>();
 		List<OrderInstallDetailCode> oidcs = new ArrayList<>();
 		List<ItfGreeToFaDownloadTaskList> its = new ArrayList<>();
@@ -384,7 +384,6 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
 			OrderBase order = orderBaseService.lambdaQuery()
 					.eq(OrderBase::getPgguid,pgguid)
 					.last("limit 1").one();
-
 			for (ItfTblAzWgmxJyktDownload item :jykts){
 				// 生成采集明细数据
 				count = getOrderInstallDetail(oids, count, order, item,downloadTaskNo,pgguid);
@@ -415,6 +414,74 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
 		upSynStatusAzJykt(downloadTaskNo);
 	}
 
+
+	public void processOrderInstallDetailJ(String downloadTaskNo, String pgguid) {
+		List<OrderInstallDetail> oids = new ArrayList<>();
+		List<OrderInstallDetailCode> oidcs = new ArrayList<>();
+		List<ItfGreeToFaDownloadTaskList> its = new ArrayList<>();
+		int count = 1;
+		int outid=0;
+
+		// 提取数据 pgwcmxid 主键
+		List<ItfTblAzWgmxJyktDownload> jykts = itfTblAzWgmxJyktDownloadService.lambdaQuery()
+				.eq(ItfTblAzWgmxJyktDownload::getDownloadTaskNo, downloadTaskNo)
+				.eq(ItfTblAzWgmxJyktDownload::getSynStatus,0).list();
+
+
+		if (!CollectionUtils.isEmpty(jykts)){
+			// 提取工单数据
+			OrderBase order = orderBaseService.lambdaQuery()
+					.eq(OrderBase::getPgguid,pgguid)
+					.last("limit 1").one();
+
+			// outCjDownloadFlag = 1 代表需要从总部下载
+			if ((order !=null && order.getOutCjDownloadFlag().equals(1)) || (order ==null)) {
+				List<OrderInstallDetail> orderDetailRec = orderInstallDetailService.lambdaQuery()
+						.eq(OrderInstallDetail::getOrderBaseId, order.getId())
+						.eq(OrderInstallDetail::getStatus, 1).list();
+				if (CollectionUtils.isNotEmpty(orderDetailRec)){
+					// 存在已采集的数据忽略下载
+				} else {
+					// 清除本地的待采集数据
+					List<OrderInstallDetail> delorderDetailRec = orderInstallDetailService.lambdaQuery()
+							.eq(OrderInstallDetail::getOrderBaseId, order.getId())
+							.eq(OrderInstallDetail::getStatus,0).list();
+					if (CollectionUtils.isNotEmpty(delorderDetailRec)){
+						orderInstallDetailService.removeByIds(delorderDetailRec);
+					}
+
+					for (ItfTblAzWgmxJyktDownload item :jykts){
+						// 生成采集明细数据
+						count = getOrderInstallDetail(oids, count, order, item,downloadTaskNo,pgguid);
+
+						// 增加处理三级从表的下载任务
+						getItfGreeToFaDownloadTaskList(its, item);
+					}
+
+					// 生成采集条码数据
+					getOrderInstallDetailCode(oids, oidcs, outid, order);
+
+
+					if (oids.size()>0){
+						orderInstallDetailService.saveBatch(oids);
+						oids.clear();
+					}
+
+					if (oidcs.size()>0){
+						orderInstallDetailCodeService.saveBatch(oidcs);
+						oidcs.clear();
+					}
+
+					itfGreeToFaDownloadTaskListService.saveBatch(its);
+					its.clear();
+				}
+			}
+		}
+
+		// 修改同步状态
+		upSynStatusAzJykt(downloadTaskNo);
+	}
+
 	private void getOrderInstallDetailCode(List<OrderInstallDetail> oids, List<OrderInstallDetailCode> oidcs, int outid, OrderBase order) {
 		if (oids.size()>0){
 			for (OrderInstallDetail a : oids){
@@ -1646,7 +1713,7 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
 		return count;
 	}
 
-	public void processOrderInstallDetailS(String downloadTaskNo, String pgguid) throws Exception {
+	public void processOrderInstallDetailSBak(String downloadTaskNo, String pgguid) throws Exception {
 		List<OrderInstallDetail> oids = new ArrayList<>();
 		List<ItfGreeToFaDownloadTaskList> its = new ArrayList<>();
 		int count = 1;
@@ -1679,7 +1746,59 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
 		upSynStatusAzSykt(downloadTaskNo);
 	}
 
-	public void processOrderInstallDetailO(String downloadTaskNo, String pgguid) {
+
+	public void processOrderInstallDetailS(String downloadTaskNo, String pgguid) throws Exception {
+		List<OrderInstallDetail> oids = new ArrayList<>();
+		List<ItfGreeToFaDownloadTaskList> its = new ArrayList<>();
+		int count = 1;
+
+		// 提取数据
+		List<ItfTblAzWgmxSyktDownload> sykts = itfTblAzWgmxSyktDownloadService.lambdaQuery()
+				.eq(ItfTblAzWgmxSyktDownload::getDownloadTaskNo, downloadTaskNo)
+				.eq(ItfTblAzWgmxSyktDownload::getSynStatus,0).list();
+
+
+		if (!CollectionUtils.isEmpty(sykts)){
+			// 提取工单数据
+			OrderBase order = orderBaseService.lambdaQuery()
+					.eq(OrderBase::getPgguid,pgguid)
+					.last("limit 1").one();
+
+			// outCjDownloadFlag = 1 代表需要从总部下载
+			if ((order !=null && order.getOutCjDownloadFlag().equals(1)) || (order ==null)) {
+				List<OrderInstallDetail> orderDetailRec = orderInstallDetailService.lambdaQuery()
+						.eq(OrderInstallDetail::getOrderBaseId, order.getId())
+						.eq(OrderInstallDetail::getStatus, 1).list();
+				if (CollectionUtils.isNotEmpty(orderDetailRec)){
+					// 存在已采集的数据忽略下载
+				} else {
+					// 清除本地的待采集数据
+					List<OrderInstallDetail> delorderDetailRec = orderInstallDetailService.lambdaQuery()
+							.eq(OrderInstallDetail::getOrderBaseId, order.getId())
+							.eq(OrderInstallDetail::getStatus,0).list();
+					if (CollectionUtils.isNotEmpty(delorderDetailRec)){
+						orderInstallDetailService.removeByIds(delorderDetailRec);
+					}
+
+					for (ItfTblAzWgmxSyktDownload item :sykts){
+						// 生成采集明细数据
+						count = getOrderInstallDetailS(oids, count, order, item, downloadTaskNo, pgguid);
+						// 增加处理三级从表的下载任务
+						getItfGreeToFaDownloadTaskListS(its, item);
+					}
+					orderInstallDetailService.saveBatch(oids);
+					oids.clear();
+					itfGreeToFaDownloadTaskListService.saveBatch(its);
+					its.clear();
+				}
+			}
+		}
+
+		// 修改同步状态
+		upSynStatusAzSykt(downloadTaskNo);
+	}
+
+	public void processOrderInstallDetailOBak(String downloadTaskNo, String pgguid) {
 		List<OrderInstallDetail> oids = new ArrayList<>();
 		List<ItfGreeToFaDownloadTaskList> its = new ArrayList<>();
 		List<OrderInstallDetailCode> oidcs = new ArrayList<>();
@@ -1725,6 +1844,62 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
 		upSynStatusAzQita(downloadTaskNo);
 	}
 
+	public void processOrderInstallDetailO(String downloadTaskNo, String pgguid) {
+		List<OrderInstallDetail> oids = new ArrayList<>();
+		List<ItfGreeToFaDownloadTaskList> its = new ArrayList<>();
+		List<OrderInstallDetailCode> oidcs = new ArrayList<>();
+		int count = 1;
+
+		// 提取数据
+		List<ItfTblAzWgmxQitaDownload> qts = itfTblAzWgmxQitaDownloadService.lambdaQuery()
+				.eq(ItfTblAzWgmxQitaDownload::getDownloadTaskNo, downloadTaskNo)
+				.eq(ItfTblAzWgmxQitaDownload::getSynStatus,0).list();
+
+		if (!CollectionUtils.isEmpty(qts)){
+			// 提取工单数据
+			OrderBase order = orderBaseService.lambdaQuery()
+					.eq(OrderBase::getPgguid,pgguid)
+					.last("limit 1").one();
+
+			// outCjDownloadFlag = 1 代表需要从总部下载
+			if ((order !=null && order.getOutCjDownloadFlag().equals(1)) || (order ==null)) {
+				List<OrderInstallDetail> orderDetailRec = orderInstallDetailService.lambdaQuery()
+						.eq(OrderInstallDetail::getOrderBaseId, order.getId())
+						.eq(OrderInstallDetail::getStatus, 1).list();
+				if (CollectionUtils.isNotEmpty(orderDetailRec)){
+					// 存在已采集的数据忽略下载
+				} else {
+					// 清除本地的待采集数据
+					List<OrderInstallDetail> delorderDetailRec = orderInstallDetailService.lambdaQuery()
+							.eq(OrderInstallDetail::getOrderBaseId, order.getId())
+							.eq(OrderInstallDetail::getStatus,0).list();
+					if (CollectionUtils.isNotEmpty(delorderDetailRec)){
+						orderInstallDetailService.removeByIds(delorderDetailRec);
+					}
+
+					for (ItfTblAzWgmxQitaDownload item :qts){
+						// 生成采集明细数据
+						count = getOrderInstallDetailO(oids, count, order, item, downloadTaskNo, pgguid);
+
+						// 增加处理三级从表的下载任务
+						getItfGreeToFaDownloadTaskListO(its, item);
+					}
+
+					// 生成采集条码数据
+					getOrderInstallDetailOtherCode(oids, oidcs, order);
+
+					if (oidcs.size()>0){
+						orderInstallDetailCodeService.saveBatch(oidcs);
+						oidcs.clear();
+					}
+				}
+			}
+		}
+
+		// 修改同步状态
+		upSynStatusAzQita(downloadTaskNo);
+	}
+
 	// 存在进行修改,不存在则插入
 	public void processYjhxJdd(String downloadTaskNo, String pgguid) {
         // 提取数据