|
|
@@ -3,6 +3,7 @@ package com.zfire.jiasm.syncdata.service.impl;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.zfire.jiasm.syncdata.dao.mapper.*;
|
|
|
import com.zfire.jiasm.syncdata.data.DetailDownloadData;
|
|
|
import com.zfire.jiasm.syncdata.parameter.OrderPar;
|
|
|
@@ -21,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
@@ -219,10 +219,12 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
if (downloadTaskType == 2201){
|
|
|
// 安装工单采集数据下载(家用空调) TL_SynDataFrom_tbl_az_wgmx_jykt
|
|
|
// 安装工单主表的order_base pgguid OK
|
|
|
+ // itf_tbl_az_wgmx_jykt_download.pgguid=order_base.pgguid
|
|
|
processOrderInstallDetailJ(downloadTaskNo, pgguid);
|
|
|
} else if (downloadTaskType == 220101){
|
|
|
// 安装工单采集附件表数据下载(家用空调) TL_SynDataFrom_tbl_az_wgmx_jykt_child
|
|
|
// pgguid = 家用空调完工明细(itf_tbl_az_wgmx_jykt_download)的pgwcmxid ok
|
|
|
+ // itf_tbl_az_wgmx_jykt_download.pgwcmxid = itf_tbl_az_wgmx_jykt_fj_download.pgwcmxid
|
|
|
processJyktFj(downloadTaskNo, pgguid);
|
|
|
} else if (downloadTaskType == 2202){
|
|
|
// 安装工单采集数据下载(商用空调) TL_SynDataFrom_tbl_az_wgmx_sykt
|
|
|
@@ -333,8 +335,10 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
|
|
|
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;
|
|
|
|
|
|
// 提取数据
|
|
|
List<ItfTblAzWgmxJyktDownload> jykts = itfTblAzWgmxJyktDownloadService.lambdaQuery()
|
|
|
@@ -349,14 +353,31 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
.last("limit 1").one();
|
|
|
|
|
|
for (ItfTblAzWgmxJyktDownload item :jykts){
|
|
|
+ OrderInstallDetail a = new OrderInstallDetail();
|
|
|
// 生成采集明细数据
|
|
|
- count = getOrderInstallDetail(oids, count, order, item);
|
|
|
+ count = getOrderInstallDetail(oids, count, order, item,a);
|
|
|
+
|
|
|
+ // 把条码信息放在采集条码表中使用
|
|
|
+ if (StringUtils.isNotEmpty(a.getInsideCode())){
|
|
|
+ outid = getInOutid(oidcs, outid, order, a, a.getInsideCode(), "1");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(a.getOutCode())){
|
|
|
+ outid = getInOutid(oidcs, outid, order, a, a.getOutCode(), "2");
|
|
|
+ }
|
|
|
|
|
|
// 增加处理三级从表的下载任务
|
|
|
getItfGreeToFaDownloadTaskList(its, item);
|
|
|
}
|
|
|
- orderInstallDetailService.saveBatch(oids);
|
|
|
- oids.clear();
|
|
|
+ if (oids.size()>0){
|
|
|
+ orderInstallDetailService.saveBatch(oids);
|
|
|
+ oids.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (oidcs.size()>0){
|
|
|
+ orderInstallDetailCodeService.saveBatch(oidcs);
|
|
|
+ oidcs.clear();
|
|
|
+ }
|
|
|
+
|
|
|
itfGreeToFaDownloadTaskListService.saveBatch(its);
|
|
|
its.clear();
|
|
|
}
|
|
|
@@ -365,10 +386,43 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
upSynStatusAzJykt(downloadTaskNo);
|
|
|
}
|
|
|
|
|
|
+ private int getInOutid(List<OrderInstallDetailCode> oidcs, int outid, OrderBase order, OrderInstallDetail a, String insideCode, String s) {
|
|
|
+ OrderInstallDetailCode odf = new OrderInstallDetailCode();
|
|
|
+ odf.setId(IdWorker.getIdStr());
|
|
|
+ // 结算网点
|
|
|
+ odf.setWebsitId(a.getSettleWebsitId());
|
|
|
+ odf.setOrderBaseId(order.getId());
|
|
|
+ odf.setOrderDetailId(a.getId());
|
|
|
+ odf.setCode(insideCode);
|
|
|
+ odf.setType(s);
|
|
|
+ // 图放在附件中提取
|
|
|
+ odf.setPassword(a.getInsidePassword());
|
|
|
+
|
|
|
+ if (a.getCreateTime() != null) {
|
|
|
+ odf.setCreateTime(a.getCreateTime());
|
|
|
+ }
|
|
|
+ if (a.getUpdateTime() != null) {
|
|
|
+ odf.setUpdateTime(a.getUpdateTime());
|
|
|
+ }
|
|
|
+ odf.setPgguid(order.getPgguid());
|
|
|
+ odf.setPgwcmxid(a.getPgwcmxid());
|
|
|
+ odf.setStatus(1);
|
|
|
+ if (a.getStatus() == 2) {
|
|
|
+ odf.setStatus(0);
|
|
|
+ }
|
|
|
+ odf.setOutId(outid);
|
|
|
+ odf.setSortNum(outid);
|
|
|
+ outid = outid + 1;
|
|
|
+ oidcs.add(odf);
|
|
|
+ return outid;
|
|
|
+ }
|
|
|
+
|
|
|
// pgguid = order_install_detail.pgwcmxid
|
|
|
public void processJyktFj(String downloadTaskNo, String pgguid) {
|
|
|
List<OrderDetailFile> odfs = new ArrayList<>();
|
|
|
List<OrderInstallDetail> oids = new ArrayList<>();
|
|
|
+ List<OrderInstallDetailCode> oidcs = new ArrayList<>();
|
|
|
+ Map<String,List<OrderInstallDetailCode>> oidcsMap = new HashMap<>();
|
|
|
Map<String,List<OrderInstallDetail>> oidsMap = new HashMap<>();
|
|
|
List<String> fsFjguid = new ArrayList<>();
|
|
|
|
|
|
@@ -385,6 +439,8 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
.eq(OrderInstallDetail::getPgwcmxid,pgguid).list();
|
|
|
oidsMap = oids.stream().collect(Collectors.groupingBy(OrderInstallDetail::getPgwcmxid));
|
|
|
|
|
|
+
|
|
|
+
|
|
|
if (!CollectionUtils.isEmpty(jykts)){
|
|
|
log.info("采集明细a {}", JSONObject.toJSONString(jykts));
|
|
|
|
|
|
@@ -408,6 +464,13 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ // 提取采集条码明细数据
|
|
|
+ oidcs = orderInstallDetailCodeService.lambdaQuery()
|
|
|
+ .eq(OrderInstallDetailCode::getOrderBaseId,order.getId()).list();
|
|
|
+ if (CollectionUtils.isNotEmpty(oidcs)){
|
|
|
+ oidcsMap = oidcs.stream().collect(Collectors.groupingBy(OrderInstallDetailCode::getOrderDetailId));
|
|
|
+ }
|
|
|
+
|
|
|
log.info("采集明细 fsFjguid {}", JSONObject.toJSONString(fsFjguid));
|
|
|
|
|
|
for (ItfTblAzWgmxJyktFjDownload item :jykts){
|
|
|
@@ -423,8 +486,31 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
|
|
|
// 生成采集附件明细数据 暂时忽略更新,无新增
|
|
|
if (!fsFjguid.contains(item.getFjguid())){
|
|
|
- getItfTblAzWgmxJyktFj(odfs,oidsMap.get(item.getPgwcmxid()).get(0), order, item);
|
|
|
+ OrderDetailFile a = new OrderDetailFile();
|
|
|
+ getItfTblAzWgmxJyktFj(odfs,oidsMap.get(item.getPgwcmxid()).get(0), order, item, a);
|
|
|
+
|
|
|
+ /*// 填充采集条码明细表图片数据
|
|
|
+ // 附件类型 1=内机条码 2=上墙图片 3=外机条码
|
|
|
+ if (oidcsMap.containsKey(a.getOrderDetailId())){
|
|
|
+ // 内机
|
|
|
+ if (a.getFileType()==1){
|
|
|
+ for (OrderInstallDetailCode u :oidcsMap.get(a.getOrderDetailId())){
|
|
|
+ if (u.getType().equals("1") && StringUtils.isEmpty(u.getPath())){
|
|
|
+ u.setPath(a.getFilePath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (a.getFileType()==3){
|
|
|
+ for (OrderInstallDetailCode u :oidcsMap.get(a.getOrderDetailId())){
|
|
|
+ if (u.getType().equals("2")){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
log.info("采集明细 odfs {}", JSONObject.toJSONString(odfs));
|
|
|
|
|
|
@@ -1104,9 +1190,9 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
its.add(tl);
|
|
|
}
|
|
|
|
|
|
- private int getOrderInstallDetail(List<OrderInstallDetail> oids, int count, OrderBase order, ItfTblAzWgmxJyktDownload item) {
|
|
|
+ private int getOrderInstallDetail(List<OrderInstallDetail> oids, int count, OrderBase order, ItfTblAzWgmxJyktDownload item,OrderInstallDetail a) {
|
|
|
WebsitSH websitSH;
|
|
|
- OrderInstallDetail a = new OrderInstallDetail();
|
|
|
+
|
|
|
OrderPar req = new OrderPar();
|
|
|
req.setSynReqId(item.getSynReqId());
|
|
|
a= azWgmxJyktDownloadMapper.getAzjyktInfo(req);
|
|
|
@@ -1141,8 +1227,8 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
}
|
|
|
|
|
|
private void getItfTblAzWgmxJyktFj(List<OrderDetailFile> odfs,OrderInstallDetail oid,
|
|
|
- OrderBase order, ItfTblAzWgmxJyktFjDownload item) {
|
|
|
- OrderDetailFile a = new OrderDetailFile();
|
|
|
+ OrderBase order, ItfTblAzWgmxJyktFjDownload item, OrderDetailFile a) {
|
|
|
+
|
|
|
a.setId(IdWorker.getIdStr());
|
|
|
a.setFjguid(item.getFjguid());
|
|
|
a.setOrderBaseId(order.getId());
|
|
|
@@ -1157,11 +1243,40 @@ public class DetailDownloadServiceImpl implements DetailDownloadService {
|
|
|
a.setPgwcmxid(item.getPgwcmxid());
|
|
|
// 服务器存储图片路径
|
|
|
a.setBrandFilePath(item.getFjserverpath());
|
|
|
- a.setFileType(item.getType());
|
|
|
+ // 类型 0:内机条码1:外机条码4:内机其他图片5:默认拿第一张图片为抽真空图,
|
|
|
+ // 其他为外机图片7:上墙图8:特殊安装确认图 2:商用信息采集(必填)3:商用信息采集(选填)
|
|
|
+
|
|
|
+ // '附件类型 1=内机条码 2=上墙图片 3=外机条码 4=内机其他 5=外机其他 6=旧机内机整机图片 7=旧机外机整机图片
|
|
|
+ // 8=定位确认书 9=室外机固定图 10=冷凝水管软接图 11=外机电源接线图 12=外机出管处封堵图 13=室内机安装图 14=冷凝水管通气孔图
|
|
|
+
|
|
|
+ // 15=室内机走管图 16=抽真空保压图片 17=电子清单 18=安装完成图片 19=验收报告 20=故障位置图 21=其他图片 22=旧配件名牌Logo图片
|
|
|
+ // 23=新配件图片 24=新旧配件图片 25=旧配件图片 26=旧压缩机条码 27=新压缩机条码 28=噪音视频 29=其他噪音视频 30=旧配件名牌
|
|
|
+ // 31=变更雪种压力图片 32=变更雪种漏点图片 33=水箱环境安装图 34=供电开关(插头、插座)图 35=安全阀图 36=试水视频(视频格式)
|
|
|
+ // 37=临时内机条码 38=临时外机条码 39=旧机内机整机图片 40=旧机外机整机图片 41=机器条码 42=整机安装效果图 43=外机位置图,44:特殊环境安装确认书',
|
|
|
+
|
|
|
+ a.setFileType(21);
|
|
|
+ if (item.getType()==0){
|
|
|
+ a.setFileType(1);
|
|
|
+ } else if (item.getType()==1){
|
|
|
+ a.setFileType(3);
|
|
|
+ } else if (item.getType()==4){
|
|
|
+ a.setFileType(4);
|
|
|
+ } else if (item.getType()==5){
|
|
|
+ a.setFileType(16);
|
|
|
+ } else if (item.getType()==7){
|
|
|
+ a.setFileType(5);
|
|
|
+ } else if (item.getType()==8){
|
|
|
+ a.setFileType(44);
|
|
|
+ }
|
|
|
a.setSortNum(item.getFjsequence());
|
|
|
- a.setCreateTime(item.getCreatedDate());
|
|
|
+ if (item.getCreatedDate()!=null){
|
|
|
+ a.setCreateTime(item.getCreatedDate());
|
|
|
+ }
|
|
|
+
|
|
|
a.setCreateBy(item.getCreatedBy());
|
|
|
- a.setUpdateTime(item.getLastModifiedDate());
|
|
|
+ if (item.getLastModifiedDate()!=null){
|
|
|
+ a.setUpdateTime(item.getLastModifiedDate());
|
|
|
+ }
|
|
|
a.setUpdateBy(item.getLastModifiedBy());
|
|
|
a.setOutPicture(item.getFjserverpath());
|
|
|
odfs.add(a);
|