|
@@ -1044,8 +1044,10 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
public void processSyktFjAndTM(String downloadTaskNo, String pgguid) {
|
|
|
// 附件
|
|
|
processSyktFj(downloadTaskNo, pgguid);
|
|
|
+
|
|
|
// 条码
|
|
|
processSyktTM(downloadTaskNo, pgguid);
|
|
|
+
|
|
|
// 修改同步状态
|
|
|
upSynStatusAzFJTM(downloadTaskNo);
|
|
|
}
|
|
@@ -1126,33 +1128,96 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
.eq(OrderBase::getId,oids.get(0).getOrderBaseId())
|
|
|
.last("limit 1").one();
|
|
|
if (order!=null){
|
|
|
- // 提取现有的条码数据
|
|
|
- List<OrderInstallDetailCode> codes = orderInstallDetailCodeService.lambdaQuery()
|
|
|
- .select(OrderInstallDetailCode::getTmguid,OrderInstallDetailCode::getStatus)
|
|
|
- .eq(OrderInstallDetailCode::getOrderBaseId,order.getId()).list();
|
|
|
- if (CollectionUtils.isEmpty(codes)){
|
|
|
- codes.stream().forEach(event->{
|
|
|
- tmguidS.add(event.getTmguid());
|
|
|
+ // 生成商用空调采集条码数据
|
|
|
+ processCode(addCodes, oidsMap, tmguidS, tms, order);
|
|
|
+
|
|
|
+ // 条码信息也要放附件表中
|
|
|
+ processSyktTMFj(downloadTaskNo, pgguid);
|
|
|
+
|
|
|
+ // 修改同步状态
|
|
|
+ upSynStatusAzSyktTM(downloadTaskNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void processCode(List<OrderInstallDetailCode> addCodes, Map<String, List<OrderInstallDetail>> oidsMap, List<String> tmguidS, List<ItfTblAzWgmxSyktTmmxLsDownload> tms, OrderBase order) {
|
|
|
+ // 提取现有的条码数据
|
|
|
+ List<OrderInstallDetailCode> codes = orderInstallDetailCodeService.lambdaQuery()
|
|
|
+ .select(OrderInstallDetailCode::getTmguid,OrderInstallDetailCode::getStatus)
|
|
|
+ .eq(OrderInstallDetailCode::getOrderBaseId, order.getId()).list();
|
|
|
+ if (CollectionUtils.isEmpty(codes)){
|
|
|
+ codes.stream().forEach(event->{
|
|
|
+ tmguidS.add(event.getTmguid());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ for (ItfTblAzWgmxSyktTmmxLsDownload item : tms){
|
|
|
+ // 采集明细表未同步不处理
|
|
|
+ if (!oidsMap.containsKey(item.getPgwcmxid())){
|
|
|
+ addCodes.clear();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // 生成采集附件明细数据 暂时忽略更新,无新增
|
|
|
+ if (!tmguidS.contains(item.getTmguid())){
|
|
|
+ getItfTblAzWgmxSyktTM(addCodes, oidsMap.get(item.getPgwcmxid()).get(0), order, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (addCodes.size()>0) {
|
|
|
+ orderInstallDetailCodeService.saveBatch(addCodes);
|
|
|
+ addCodes.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void processSyktTMFj(String downloadTaskNo, String pgguid) {
|
|
|
+ List<OrderDetailFile> odfs = new ArrayList<>();
|
|
|
+ List<OrderInstallDetail> oids = new ArrayList<>();
|
|
|
+ Map<String,List<OrderInstallDetail>> oidsMap = new HashMap<>();
|
|
|
+ List<String> fsFjguid = new ArrayList<>();
|
|
|
+
|
|
|
+ // 提取条码数据
|
|
|
+ List<ItfTblAzWgmxSyktTmmxLsDownload> tms = itfTblAzWgmxSyktTmmxLsDownloadService.lambdaQuery()
|
|
|
+ .eq(ItfTblAzWgmxSyktTmmxLsDownload::getDownloadTaskNo, downloadTaskNo)
|
|
|
+ .eq(ItfTblAzWgmxSyktTmmxLsDownload::getSynStatus,0).list();
|
|
|
+
|
|
|
+ // 提取采集数据
|
|
|
+ oids = orderInstallDetailService.lambdaQuery()
|
|
|
+ .eq(OrderInstallDetail::getPgwcmxid, pgguid).list();
|
|
|
+ oidsMap = oids.stream().collect(Collectors.groupingBy(OrderInstallDetail::getPgwcmxid));
|
|
|
+
|
|
|
+ if (!CollectionUtils.isEmpty(tms)){
|
|
|
+ // 提取工单数据
|
|
|
+ OrderBase order = orderBaseService.lambdaQuery()
|
|
|
+ .eq(OrderBase::getId,oids.get(0).getOrderBaseId())
|
|
|
+ .last("limit 1").one();
|
|
|
+ if (order!=null){
|
|
|
+ // 提取现有的采集附件数据
|
|
|
+ List<OrderDetailFile> fs = orderDetailFileService.lambdaQuery()
|
|
|
+ .select(OrderDetailFile::getFjguid,OrderDetailFile::getFileType)
|
|
|
+ .eq(OrderDetailFile::getOrderBaseId,order.getId()).list();
|
|
|
+ if (CollectionUtils.isEmpty(fs)){
|
|
|
+ fs.stream().forEach(event->{
|
|
|
+ fsFjguid.add(event.getFjguid());
|
|
|
});
|
|
|
}
|
|
|
|
|
|
for (ItfTblAzWgmxSyktTmmxLsDownload item :tms){
|
|
|
// 采集明细表未同步不处理
|
|
|
if (!oidsMap.containsKey(item.getPgwcmxid())){
|
|
|
- addCodes.clear();
|
|
|
+ odfs.clear();
|
|
|
break;
|
|
|
}
|
|
|
// 生成采集附件明细数据 暂时忽略更新,无新增
|
|
|
- if (!tmguidS.contains(item.getTmguid())){
|
|
|
- getItfTblAzWgmxSyktTM(addCodes,oidsMap.get(item.getPgwcmxid()).get(0), order, item);
|
|
|
+ if (!fsFjguid.contains(item.getTmguid())){
|
|
|
+ getItfTblAzWgmxSyktTMFj(odfs,oidsMap.get(item.getPgwcmxid()).get(0), order, item);
|
|
|
}
|
|
|
}
|
|
|
- if (addCodes.size()>0) {
|
|
|
- orderInstallDetailCodeService.saveBatch(addCodes);
|
|
|
- addCodes.clear();
|
|
|
+ if (odfs.size()>0) {
|
|
|
+ orderDetailFileService.saveBatch(odfs);
|
|
|
+ odfs.clear();
|
|
|
}
|
|
|
+
|
|
|
// 修改同步状态
|
|
|
- upSynStatusAzSyktTM(downloadTaskNo);
|
|
|
+ upSynStatusAzSyktFJ(downloadTaskNo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1468,6 +1533,34 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
odfs.add(a);
|
|
|
}
|
|
|
|
|
|
+ private void getItfTblAzWgmxSyktTMFj(List<OrderDetailFile> odfs,OrderInstallDetail oid,
|
|
|
+ OrderBase order, ItfTblAzWgmxSyktTmmxLsDownload item) {
|
|
|
+ OrderDetailFile a = new OrderDetailFile();
|
|
|
+ a.setId(IdWorker.getIdStr());
|
|
|
+ a.setFjguid(item.getTmguid());
|
|
|
+ a.setOrderBaseId(order.getId());
|
|
|
+ a.setOrderDetailId(oid.getId());
|
|
|
+ a.setFileName("外机条码");
|
|
|
+ if (item.getTmlx()==2){
|
|
|
+ a.setFileName("内机条码");
|
|
|
+ }
|
|
|
+
|
|
|
+ a.setPgwcmxid(item.getPgwcmxid());
|
|
|
+ // 服务器存储图片路径
|
|
|
+ a.setBrandFilePath(item.getScwj());
|
|
|
+ a.setFileType(3);
|
|
|
+ if (item.getTmlx()==2){
|
|
|
+ a.setFileType(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ a.setCreateTime(item.getCreatedDate());
|
|
|
+ a.setCreateBy(item.getCreatedBy());
|
|
|
+ a.setUpdateTime(item.getLastModifiedDate());
|
|
|
+ a.setUpdateBy(item.getLastModifiedBy());
|
|
|
+ a.setOutPicture(item.getScwj());
|
|
|
+ odfs.add(a);
|
|
|
+ }
|
|
|
+
|
|
|
private int getOrderInstallDetailS(List<OrderInstallDetail> oids, int count, OrderBase order, ItfTblAzWgmxSyktDownload item,
|
|
|
String downloadTaskNo,String pgguid) throws Exception {
|
|
|
WebsitSH websitSH;
|