yaozhixue 2 år sedan
förälder
incheckning
b6ca4c1245

+ 5 - 5
src/main/java/com/zfire/jiasm/syncdata/download/order/install/InstallBusiness.java → src/main/java/com/zfire/jiasm/syncdata/download/order/install/Business.java

@@ -32,10 +32,10 @@ import java.util.stream.Collectors;
  */
 @Slf4j
 @Component
-public class InstallBusiness {
+public class Business {
 
     @Resource
-    InstallBusiness installBusiness;
+    Business business;
     @Resource
     ItfTblAzAssignLcLsDownloadService itfTblAzAssignLcLsDownloadService;
     @Resource
@@ -138,10 +138,10 @@ public class InstallBusiness {
             try{
                 if (orderBaselist.contains(item.getPgguid())){
                     // 修改
-                    installBusiness.orderUpdate(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item);
+                    business.orderUpdate(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item);
                 } else {
-                    // 新增
-                    installBusiness.orderAdd(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item);
+                    // 新增 TL_SynDataFrom_tbl_az_assign_lc_ls_batch
+                    business.orderAdd(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item);
                     orderBaselist.add(item.getPgguid());
                 }
             } catch (Exception ex) {

+ 3 - 3
src/main/java/com/zfire/jiasm/syncdata/download/order/install/InstallDownload.java → src/main/java/com/zfire/jiasm/syncdata/download/order/install/Download.java

@@ -35,12 +35,12 @@ import java.util.*;
  */
 @Slf4j
 @Component
-public class InstallDownload {
+public class Download {
     @Value("${baseurl}")
     private String baseurl = "";
 
     @Resource
-    InstallDownload installDownload;
+    Download download;
     @Autowired
     private TokenCenter tokenCenter;
     @Resource
@@ -120,7 +120,7 @@ public class InstallDownload {
                             ESInstallEnum.SALES_WEBSIT_NUMBER.getCode());
                     // 历史下载记录中无数据时数据落表,有数据时不再下载
                     if (flag){
-                        installDownload.parseData(sheet, downloadTaskNo, downloadBatchNo, rec);
+                        download.parseData(sheet, downloadTaskNo, downloadBatchNo, rec);
                     }
                 } else {
                     log.info("安装工单找不到主表数据不做处理 mainTableData:{}" ,mainTableData);

+ 308 - 106
src/main/java/com/zfire/jiasm/syncdata/download/order/repair/RepairBusiness.java → src/main/java/com/zfire/jiasm/syncdata/download/order/repair/Business.java

@@ -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()

+ 5 - 6
src/main/java/com/zfire/jiasm/syncdata/download/order/repair/RepairDownload.java → src/main/java/com/zfire/jiasm/syncdata/download/order/repair/Download.java

@@ -32,14 +32,14 @@ import java.util.*;
  */
 @Slf4j
 @Component
-public class RepairDownload {
+public class Download {
     @Value("${baseurl}")
     private String baseurl = "";
     @Value("${nullCols}")
     private String nullCols;
 
     @Resource
-    RepairDownload repairDownload;
+    Download download;
     @Autowired
     TokenCenter tokenCenter;
     @Resource
@@ -52,10 +52,9 @@ public class RepairDownload {
     @Scheduled(fixedDelay = 1 * 10 * 1000)
     public void download() throws Exception {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
-        if (1 == 1) {
+        /*if (1 == 1) {
             return;
-        }
+        }*/
 
 
         try {
@@ -100,7 +99,7 @@ public class RepairDownload {
                 if (mainTableData != null) {
                     String downloadTaskNo = UUID.randomUUID().toString();
                     DataUtil.initLastModifiedDate(mainTableData,"last_modified_date");
-                    repairDownload.addRepairData(mainTableData, downloadBatchNo, downloadTaskNo, sheet,
+                    download.addRepairData(mainTableData, downloadBatchNo, downloadTaskNo, sheet,
                             srcTabnameArray, srcTabColListArray, destTabNameArray, destTabColListArray,
                             salesWebsitNumber);
                 } else {

+ 5 - 6
src/main/java/com/zfire/jiasm/syncdata/service/PublicService.java

@@ -1,12 +1,10 @@
 package com.zfire.jiasm.syncdata.service;
 
-import com.zfire.jiasm.syncdata.plus.entity.Brand;
-import com.zfire.jiasm.syncdata.plus.entity.OrderBase;
-import com.zfire.jiasm.syncdata.plus.entity.OrderWorker;
-import com.zfire.jiasm.syncdata.plus.entity.SysDictRef;
+import com.zfire.jiasm.syncdata.plus.entity.*;
 import com.zfire.jiasm.syncdata.response.WebsitPP;
 import com.zfire.jiasm.syncdata.response.WebsitSH;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -28,6 +26,7 @@ public interface PublicService {
     WebsitPP WebsitToPP(String websitNo, String brandId);
     String getSHWDPhone(String websitNo);
 
+    // 单号,主键,同步任务生成时间,同步的表名,工单类型,任务类型
+    OutJiasmToGreeUploadTaskList getUploadTaskList(String orderNo, String id, Date updateTime, String itemTableName, String itemOrderType, int i);
 
-
-}
+    }

+ 17 - 0
src/main/java/com/zfire/jiasm/syncdata/service/impl/PublicServiceImpl.java

@@ -8,9 +8,11 @@ import com.zfire.jiasm.syncdata.plus.service.*;
 import com.zfire.jiasm.syncdata.response.WebsitPP;
 import com.zfire.jiasm.syncdata.response.WebsitSH;
 import com.zfire.jiasm.syncdata.service.PublicService;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -215,4 +217,19 @@ public class PublicServiceImpl implements PublicService {
         return resultData;
     }
 
+
+    @Override
+    public OutJiasmToGreeUploadTaskList getUploadTaskList(String orderNo, String id, Date updateTime,
+                                                          String itemTableName, String itemOrderType, int taskType) {
+        OutJiasmToGreeUploadTaskList add = new OutJiasmToGreeUploadTaskList();
+        add.setUploadTaskType(taskType);
+        add.setOrderNo(orderNo);
+        add.setId(id);
+        add.setTableName(itemTableName);
+        add.setOrderType(itemOrderType);
+        add.setSynReqTime(new Date());
+        add.setUpdatetime(updateTime);
+        return add;
+    }
+
 }

+ 1 - 1
src/main/java/com/zfire/jiasm/syncdata/upload/order/ProduceDataUploadList.java → src/main/java/com/zfire/jiasm/syncdata/upload/order/install/ProduceDataUploadList.java

@@ -1,4 +1,4 @@
-package com.zfire.jiasm.syncdata.upload.order;
+package com.zfire.jiasm.syncdata.upload.order.install;
 
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.zfire.jiasm.syncdata.base.BaseService;

+ 11 - 23
src/main/java/com/zfire/jiasm/syncdata/upload/order/ProduceUploadList.java → src/main/java/com/zfire/jiasm/syncdata/upload/order/install/ProduceUploadList.java

@@ -1,10 +1,11 @@
-package com.zfire.jiasm.syncdata.upload.order;
+package com.zfire.jiasm.syncdata.upload.order.install;
 
 import com.zfire.jiasm.syncdata.constant.OrderStatusEnum;
 import com.zfire.jiasm.syncdata.constant.OrderTypeEnum;
 import com.zfire.jiasm.syncdata.plus.entity.*;
 import com.zfire.jiasm.syncdata.plus.service.*;
 import com.zfire.jiasm.syncdata.service.PrepareService;
+import com.zfire.jiasm.syncdata.service.PublicService;
 import com.zfire.jiasm.syncdata.utils.DataUtil;
 import com.zfire.jiasm.syncdata.utils.PrepareTaskLog;
 import com.zfire.jiasm.syncdata.utils.TokenCenter;
@@ -49,6 +50,8 @@ public class ProduceUploadList {
     OrderInstallOperatingLogService orderInstallOperatingLogService;
     @Resource
     OrderReAppointmentService orderReAppointmentService;
+    @Resource
+    PublicService publicService;
 
 
     @Scheduled(fixedDelay = 1 * 20 * 1000)
@@ -110,10 +113,6 @@ public class ProduceUploadList {
                     if (itemTableName.equals("order_re_appointment")){
                         produceUploadList.OrderReAppointment(item, itemTableName, itemOrderType);
                     }
-
-
-
-
                 } catch (Exception ex) {
                     errorMessage = ex.getMessage();
                     updateError(errorMessage, item);
@@ -133,7 +132,7 @@ public class ProduceUploadList {
                 .eq(OrderReAppointment::getId, item.getId()).one();
         // 同步任务增加一条数据
         if (rea !=null){
-            OutJiasmToGreeUploadTaskList add = getOutJiasmToGreeUploadTaskList(item.getOrderNo(), item.getId(),
+            OutJiasmToGreeUploadTaskList add = publicService.getUploadTaskList(item.getOrderNo(), item.getId(),
                     rea.getCreateTime(), itemTableName, itemOrderType, 230);
             outJiasmToGreeUploadTaskListService.save(add);
         }
@@ -149,7 +148,7 @@ public class ProduceUploadList {
                 .eq(OrderInstallOperatingLog::getId, item.getId()).one();
         // 同步任务增加一条数据
         if (logInfo !=null){
-            OutJiasmToGreeUploadTaskList add = getOutJiasmToGreeUploadTaskList(item.getOrderNo(), item.getId(),
+            OutJiasmToGreeUploadTaskList add = publicService.getUploadTaskList(item.getOrderNo(), item.getId(),
                     logInfo.getCreateTime(), itemTableName, itemOrderType, 23);
             outJiasmToGreeUploadTaskListService.save(add);
         }
@@ -207,7 +206,7 @@ public class ProduceUploadList {
         // 若工单被删除不再同步 不写上传记录表
 
         // 生成一条22类型的上传记录  out_jiasm_to_gree_upload_task_list
-        OutJiasmToGreeUploadTaskList add = getOutJiasmToGreeUploadTaskList(orderNo, orderBase.getId(), updateTime, itemTableName, itemOrderType, 22);
+        OutJiasmToGreeUploadTaskList add = publicService.getUploadTaskList(orderNo, orderBase.getId(), updateTime, itemTableName, itemOrderType, 22);
         ojtgutls.add(add);
         // 工单状态order_status 6, 7, 9, 10
         if (orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I6.getCode()) ||
@@ -215,32 +214,21 @@ public class ProduceUploadList {
                 orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I9.getCode()) ||
                 orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I10.getCode())){
             if (orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I6.getCode())){
-                OutJiasmToGreeUploadTaskList addo = getOutJiasmToGreeUploadTaskList(orderNo, orderBase.getId(), updateTime, itemTableName, itemOrderType, 221);
+                OutJiasmToGreeUploadTaskList addo = publicService.getUploadTaskList(orderNo, orderBase.getId(), updateTime, itemTableName, itemOrderType, 221);
                 ojtgutls.add(addo);
             } else if (orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I7.getCode()) ||
                     orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I9.getCode())){
-                OutJiasmToGreeUploadTaskList addt = getOutJiasmToGreeUploadTaskList(orderNo, orderBase.getId(), updateTime, itemTableName, itemOrderType, 221);
+                OutJiasmToGreeUploadTaskList addt = publicService.getUploadTaskList(orderNo, orderBase.getId(), updateTime, itemTableName, itemOrderType, 221);
                 ojtgutls.add(addt);
-                OutJiasmToGreeUploadTaskList addtt = getOutJiasmToGreeUploadTaskList(orderNo, orderBase.getId(), orderBase.getUpdateTime(), itemTableName, itemOrderType, 222);
+                OutJiasmToGreeUploadTaskList addtt = publicService.getUploadTaskList(orderNo, orderBase.getId(), orderBase.getUpdateTime(), itemTableName, itemOrderType, 222);
                 ojtgutls.add(addtt);
             } else {
-                OutJiasmToGreeUploadTaskList addttt = getOutJiasmToGreeUploadTaskList(orderNo, orderBase.getId(), updateTime, itemTableName, itemOrderType, 222);
+                OutJiasmToGreeUploadTaskList addttt = publicService.getUploadTaskList(orderNo, orderBase.getId(), updateTime, itemTableName, itemOrderType, 222);
                 ojtgutls.add(addttt);
             }
         }
     }
 
-    @NotNull
-    private OutJiasmToGreeUploadTaskList getOutJiasmToGreeUploadTaskList(String orderNo, String id, Date updateTime, String itemTableName, String itemOrderType, int i) {
-        OutJiasmToGreeUploadTaskList add = new OutJiasmToGreeUploadTaskList();
-        add.setUploadTaskType(i);
-        add.setOrderNo(orderNo);
-        add.setId(id);
-        add.setTableName(itemTableName);
-        add.setOrderType(itemOrderType);
-        add.setUpdatetime(updateTime);
-        return add;
-    }
 
     private String genInfoData(int taskId, String srcTabName, boolean isTimeOut, String errorMessage) {
         String result = "预处理任务[" + taskId + "," + srcTabName + "] " + (isTimeOut ? "超时!!!!" : "正常") + " "

+ 1 - 1
src/main/java/com/zfire/jiasm/syncdata/upload/order/UploadOrder.java → src/main/java/com/zfire/jiasm/syncdata/upload/order/install/UploadOrder.java

@@ -1,4 +1,4 @@
-package com.zfire.jiasm.syncdata.upload.order;
+package com.zfire.jiasm.syncdata.upload.order.install;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;

+ 156 - 0
src/main/java/com/zfire/jiasm/syncdata/upload/order/repair/ProduceUploadList.java

@@ -0,0 +1,156 @@
+package com.zfire.jiasm.syncdata.upload.order.repair;
+
+import com.zfire.jiasm.syncdata.constant.OrderStatusEnum;
+import com.zfire.jiasm.syncdata.constant.OrderTypeEnum;
+import com.zfire.jiasm.syncdata.plus.entity.OrderBase;
+import com.zfire.jiasm.syncdata.plus.entity.OutJiasmToGreeUploadTaskList;
+import com.zfire.jiasm.syncdata.plus.entity.OutJiasmToGreeUploadnotifylist;
+import com.zfire.jiasm.syncdata.plus.service.*;
+import com.zfire.jiasm.syncdata.service.PrepareService;
+import com.zfire.jiasm.syncdata.service.PublicService;
+import com.zfire.jiasm.syncdata.utils.PrepareTaskLog;
+import com.zfire.jiasm.syncdata.utils.TokenCenter;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 生成上传任务清单 out_jiasm_to_gree_upload_task_list
+ * 1:从需要上传的订单数据表中提取数据 out_jiasm_to_gree_uploadnotifylist
+ *:2:对应表中提取表中数据 生成上传任务清单
+ */
+@Slf4j
+@Component
+public class ProduceUploadList {
+    @Resource
+    com.zfire.jiasm.syncdata.upload.order.install.ProduceUploadList produceUploadList;
+    @Resource
+    PrepareService prepareService;
+    @Resource
+    OutJiasmToGreeUploadTaskListService outJiasmToGreeUploadTaskListService;
+    @Resource
+    OrderBaseService orderBaseService;
+    @Resource
+    OutJiasmToGreeUploadnotifylistService outJiasmToGreeUploadnotifylistService;
+    @Resource
+    OrderInstallOperatingLogService orderInstallOperatingLogService;
+    @Resource
+    OrderReAppointmentService orderReAppointmentService;
+    @Resource
+    PublicService publicService;
+
+
+    @Scheduled(fixedDelay = 1 * 20 * 1000)
+    private void produceList(){
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        List<OutJiasmToGreeUploadTaskList> ojtgutls = new ArrayList<>();
+
+
+        log.info("开始预处理需要上传的维修工单数据: {}",sdf.format(new Date()));
+
+        // 从需要上传的订单数据表中提取数据
+        List<OutJiasmToGreeUploadnotifylist> taskResults = outJiasmToGreeUploadnotifylistService.lambdaQuery()
+                .eq(OutJiasmToGreeUploadnotifylist::getSynStatus,0)
+                .orderByAsc(OutJiasmToGreeUploadnotifylist::getSynReqId).list();
+        try{
+            for (OutJiasmToGreeUploadnotifylist item : taskResults) {
+                Long itemSynReqId = item.getSynReqId();
+                // 同步的表名
+                String itemTableName = item.getTableName();
+                // 同步表中的工单号
+                String itemOrderNo = item.getOrderNo();
+                // 同步表中的主键id
+                String itemTableNameId = item.getId();
+                // 工单类型
+                String itemOrderType = item.getOrderType();
+
+                // 数据同步预处理规则表中提取对应表名的规则
+                Map<String, Object> row = prepareService.getTaskInfo(itemTableName);
+                int taskId = (Integer) row.get("id");
+                String srcTabName = (String) row.get("src_tab_name");
+
+                String errorMessage = null;
+                try{
+                    // 安装工单处理
+                    if (itemTableName.equals("order_base") &&
+                            itemOrderType.equals(OrderTypeEnum.ORDER_TYPE_REPAIR.getCode())){
+                        // 过程名,源表中的ID,源表中的数据最后修改时间,源表中的工单号,源表中的id,空值,false
+                        // TL_PrePare_task_by_fa_order_repair
+                        // 提取工单数据
+                        OrderBase orderBase = orderBaseService.lambdaQuery()
+                                .eq(OrderBase::getId,itemTableNameId).one();
+                        // 生成任务清单数据
+                        if (orderBase != null){
+                            // 删除工单更新被忽略
+
+                            // 生成66类型上传任务数据
+                            // 单号,主键,同步任务生成时间,同步的表名,工单类型,任务类型
+                            publicService.getUploadTaskList(itemOrderNo,itemTableNameId,orderBase.getUpdateTime(),itemTableName,
+                                    orderBase.getOrderType(),66);
+
+                            // 工单状态(8, 9, 10, 11, 12, 13, 14) 派工状态:(13, 14, 15) 未下载总部采集数据
+                            if (orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I6.getCode()) ||
+                                    orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I7.getCode()) ||
+                                    orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I9.getCode()) ||
+                                    orderBase.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_I10.getCode())){
+
+                            }
+
+
+
+
+
+
+                        }
+                    }
+
+                } catch (Exception ex) {
+                    errorMessage = ex.getMessage();
+                    updateError(errorMessage, item);
+                } finally {
+                    PrepareTaskLog.writeMessage(genInfoData(taskId, srcTabName, false, errorMessage));
+                }
+            }
+
+
+
+        } catch (Exception ex) {
+        ex.printStackTrace();
+        log.info("开始预处理需要上传的维修工单数据出错");
+    }
+
+
+    }
+
+    public void updateError(String errMessage, OutJiasmToGreeUploadnotifylist item) {
+        if (errMessage != null && errMessage.trim().length() > 255) {
+            errMessage = errMessage.substring(0, 255);
+        }
+        OutJiasmToGreeUploadnotifylist up = new OutJiasmToGreeUploadnotifylist();
+        up.setSynReqId(item.getSynReqId());
+        up.setSynTimes(item.getSynTimes()+1);
+        up.setSynErrMsg(errMessage);
+        up.setSynReqTime(new Date());
+        outJiasmToGreeUploadnotifylistService.updateById(up);
+    }
+
+    private String genInfoData(int taskId, String srcTabName, boolean isTimeOut, String errorMessage) {
+        String result = "预处理任务[" + taskId + "," + srcTabName + "] " + (isTimeOut ? "超时!!!!" : "正常") + " "
+                + (errorMessage != null ? "错误:[" + errorMessage + "]" : "");
+        return result;
+    }
+
+
+
+
+
+}

+ 3 - 2
src/main/resources/mapper/RepairDownloadMapper.xml

@@ -47,14 +47,14 @@
                                        (select websit_id from customer_information_websit
                                         where brand_id = #{request.brandId} and ref_websit_id in
                                                          (select xswdno from itf_tbl_assign_download where syn_req_id = #{request.synReqId}))
-        where a.syn_req_id = #{request.synReqId};
+        where a.syn_req_id = #{request.synReqId}
     </select>
 
     <select id="getUpOrderBase" parameterType="com.zfire.jiasm.syncdata.parameter.OrderPar" resultType="com.zfire.jiasm.syncdata.plus.entity.OrderBase">
         select a.yhmc as user_name,a.quhao as area_code,
                case a.yddh when '' then case a.dhhm when '' then '' else a.dhhm end  else a.yddh end as tel_phone,
                a.email,a.yddh2 as user_mobile2,a.sfen as province,a.cshi as city,a.xian as area,a.xzhen as street,
-               a.dizi as address,a.beiz as remark,
+               a.dizi as address,a.beiz as remark,IFNULL(a.last_modified_date,a.zjczsj) as update_time,
                case when a.spid=102 then '商用' when a.spid=109 then '商用' else '家用' end as service_flag,
                b.sfzen as worker_id,b.wxgmc as worker_name,b.yddh as worker_mobile,
                b.sfzen as worker_idcard,a.yxji as priority,a.gpsdzxx as gps_address,
@@ -73,6 +73,7 @@
                                        (select websit_id from customer_information_websit
                                         where brand_id = #{request.brandId} and ref_websit_id in
                                                          (select xswdno from itf_tbl_assign_download where syn_req_id = #{request.synReqId}))
+        where a.syn_req_id = #{request.synReqId}
     </select>
 
     <select id="getOrderBaseStatus" parameterType="com.zfire.jiasm.syncdata.parameter.OrderPar" resultType="com.zfire.jiasm.syncdata.plus.entity.OrderBase">

+ 1 - 0
src/main/resources/mapper/RepairMxDownloadMapper.xml

@@ -18,6 +18,7 @@
                           (select websit_id from customer_information_websit
                                   where brand_id = #{request.brandId} and ref_websit_id in
                                         (select fwdw from itf_tbl_assign_mx_download where syn_req_id = #{request.synReqId}))
+        where syn_req_id = #{request.synReqId}
     </select>