|
|
@@ -1,30 +1,20 @@
|
|
|
package com.zfire.jiasm.syncdata.download.order;
|
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.zfire.jiasm.syncdata.base.BaseService;
|
|
|
import com.zfire.jiasm.syncdata.constant.DictTypeEnum;
|
|
|
import com.zfire.jiasm.syncdata.constant.DispatchStatusEnum;
|
|
|
-import com.zfire.jiasm.syncdata.constant.ESInstallEnum;
|
|
|
import com.zfire.jiasm.syncdata.constant.OrderStatusEnum;
|
|
|
import com.zfire.jiasm.syncdata.dao.mapper.AzGDFYQDDownloadMapper;
|
|
|
import com.zfire.jiasm.syncdata.dao.mapper.AzGDFkMxDownloadMapper;
|
|
|
import com.zfire.jiasm.syncdata.dao.mapper.AzGDLcLsDownloadMapper;
|
|
|
-import com.zfire.jiasm.syncdata.data.Token;
|
|
|
import com.zfire.jiasm.syncdata.parameter.OrderPar;
|
|
|
import com.zfire.jiasm.syncdata.plus.entity.*;
|
|
|
import com.zfire.jiasm.syncdata.plus.service.*;
|
|
|
-import com.zfire.jiasm.syncdata.utils.HttpUtil;
|
|
|
-import com.zfire.jiasm.syncdata.utils.JSONResult;
|
|
|
-import com.zfire.jiasm.syncdata.utils.TokenCenter;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -38,29 +28,18 @@ import java.util.stream.Collectors;
|
|
|
* 格力品牌安装工单下载后落本地数据表
|
|
|
* 3:落业务表
|
|
|
*:4:修改下载主表处理结果
|
|
|
- * 3-4需增加单独任务,确保中断异常
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
public class AnzhuangGongDanBusiness {
|
|
|
- @Value("${baseurl}")
|
|
|
- private String baseurl = "";
|
|
|
|
|
|
- @Autowired
|
|
|
- private TokenCenter tokenCenter;
|
|
|
@Resource
|
|
|
- ItfInstallBatchDownloadRecService itfInstallBatchDownloadRecService;
|
|
|
+ AnzhuangGongDanBusiness anzhuangGongDanBusiness;
|
|
|
@Resource
|
|
|
ItfTblAzAssignLcLsDownloadService itfTblAzAssignLcLsDownloadService;
|
|
|
@Resource
|
|
|
ItfTblAzAssignMxDownloadService itfTblAzAssignMxDownloadService;
|
|
|
@Resource
|
|
|
- ItfTblAzAssignFkmxDownloadService itfTblAzAssignFkMxDownloadService;
|
|
|
- @Resource
|
|
|
- ItfTblAzAssignLcFzryDownloadService itfTblAzAssignLcFzryDownloadService;
|
|
|
- @Resource
|
|
|
- ItfTblAzAssignPlatformDownloadService itfTblAzAssignPlatformDownloadService;
|
|
|
- @Resource
|
|
|
AzGDLcLsDownloadMapper azGDLcLsDownloadMapper;
|
|
|
@Resource
|
|
|
BaseService baseService;
|
|
|
@@ -107,17 +86,9 @@ public class AnzhuangGongDanBusiness {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// 3:工单落入本地表
|
|
|
- @Scheduled(fixedDelay = 1 * 30 * 1000)
|
|
|
- public void inputOrderInstall() throws Exception {
|
|
|
-
|
|
|
- /*if (1 == 1) {
|
|
|
- return;
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
+ @Scheduled(fixedDelay = 1 * 10 * 1000)
|
|
|
+ public void inputOrderInstall() {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
List<ItfTblAzAssignLcLsDownload> lcls = new ArrayList<>();
|
|
|
List<String> lclslist = new ArrayList<>();
|
|
|
@@ -127,7 +98,6 @@ public class AnzhuangGongDanBusiness {
|
|
|
Map<String, List<SysDictRef>> sysDictRefXLMap = new HashMap<>();
|
|
|
Map<String, List<SysDictRef>> sysDictRefXiLieMap = new HashMap<>();
|
|
|
|
|
|
-
|
|
|
// 提取品牌信息
|
|
|
Brand brand = baseService.getBrand();
|
|
|
if (brand == null) {
|
|
|
@@ -141,16 +111,20 @@ public class AnzhuangGongDanBusiness {
|
|
|
// 提取品牌商对应的系列信息
|
|
|
sysDictRefXiLieMap = getMap(brand);
|
|
|
|
|
|
- log.info("安装工单落本地表开始处理: {}",sdf.format(new Date()));
|
|
|
-
|
|
|
// 提取待落本地表的数据
|
|
|
lcls = itfTblAzAssignLcLsDownloadService.lambdaQuery()
|
|
|
.eq(ItfTblAzAssignLcLsDownload::getSynStatus,0)
|
|
|
.orderByAsc(ItfTblAzAssignLcLsDownload::getSynReqId)
|
|
|
.list();
|
|
|
|
|
|
- lclslist = lcls.stream().map(ItfTblAzAssignLcLsDownload::getPgguid).collect(Collectors.toList());
|
|
|
+ if (lcls.size()<1){
|
|
|
+ log.info("暂无待处理的安装工单: {}",sdf.format(new Date()));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("安装工单落本地表开始处理: {}",sdf.format(new Date()));
|
|
|
|
|
|
+ lclslist = lcls.stream().map(ItfTblAzAssignLcLsDownload::getPgguid).collect(Collectors.toList());
|
|
|
// 提取已有的订单数据
|
|
|
orderBasesRecs = orderBaseService.lambdaQuery()
|
|
|
.select(OrderBase::getPgguid)
|
|
|
@@ -162,127 +136,211 @@ public class AnzhuangGongDanBusiness {
|
|
|
for (ItfTblAzAssignLcLsDownload item: lcls) {
|
|
|
try{
|
|
|
if (orderBaselist.contains(item.getPgguid())){
|
|
|
- if (1==1){
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
// 修改
|
|
|
- // 提取本地订单
|
|
|
- OrderBase old = orderBaseService.lambdaQuery()
|
|
|
- .eq(OrderBase::getPgguid, item.getPgguid()).one();
|
|
|
-
|
|
|
- // 获取安装工单主表
|
|
|
- OrderBase newLCLS = getOrderBase(item, brand);
|
|
|
- // 这里一定不能少
|
|
|
- newLCLS.setId(old.getId());
|
|
|
-
|
|
|
- // 获取工单主表要同步的数据
|
|
|
- OrderBase upInfo = getOrderBase(old, brand, item, newLCLS);
|
|
|
-
|
|
|
- // 获取工单师傅信息来自于工单主表数据只有修改的情况
|
|
|
- OrderWorker own =getOrderWorkerUpdate(old.getId(), upInfo, newLCLS);
|
|
|
-
|
|
|
- // 获取产品明细要同步的数据 -只存在修改,减少与增加的情况不存在
|
|
|
- List<ItfTblAzAssignMxDownload> mxsynreqids = new ArrayList<>();
|
|
|
- List<OrderProduct> orderProductsUpdate = getOrderProductsUpdate(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, old, newLCLS, item.getDownloadTaskNo(),mxsynreqids);
|
|
|
-
|
|
|
- // 提取现有同步来的数据
|
|
|
- List<ItfTblAzAssignFkmxDownload> synreqids = new ArrayList<>();
|
|
|
-
|
|
|
- // 获取操作明细同步数据,即反馈明细
|
|
|
- List<OrderInstallOperatingLog> addoiolList = getOrderInstallOperatingLogsadd(brand, item, old, newLCLS, synreqids);
|
|
|
-
|
|
|
- // 获取评价同步数据
|
|
|
-
|
|
|
- // 提取已同步的
|
|
|
- List<OrderAppraise> oas = orderAppraiseService.lambdaQuery()
|
|
|
- .select(OrderAppraise::getPid,
|
|
|
- OrderAppraise::getPgguid)
|
|
|
- .eq(OrderAppraise::getOrderBaseId, old.getId()).list();
|
|
|
- List<String> oaslist = oas.stream().map(OrderAppraise::getPid).collect(Collectors.toList());
|
|
|
-
|
|
|
- // 提取本次获取的
|
|
|
- List<OrderAppraise> oanew = new ArrayList<>();
|
|
|
- List<Long> getpjSynReqId = new ArrayList<>();
|
|
|
- getOrderAppraise(newLCLS, sysDictRefDLMap, oanew, brand, item, getpjSynReqId);
|
|
|
-
|
|
|
- // 移除已同步过的
|
|
|
- List<OrderAppraise> addoalist = new ArrayList<>();
|
|
|
- for (OrderAppraise oa:oanew){
|
|
|
- if (!oaslist.contains(oa.getPid())){
|
|
|
- addoalist.add(oa);
|
|
|
- }
|
|
|
- }
|
|
|
+ anzhuangGongDanBusiness.orderUpdate(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item);
|
|
|
+ } else {
|
|
|
+ // 新增
|
|
|
+ anzhuangGongDanBusiness.orderAdd(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item);
|
|
|
+ orderBaselist.add(item.getPgguid());
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ log.info("安装工单落本地表失败 销售单号-派工单号:【" + item.getXsdh() + "-"+ item.getPgid()+"】");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ log.info("安装工单落本地表完成: {}",sdf.format(new Date()));
|
|
|
+ }
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void orderUpdate(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap, Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item) {
|
|
|
+ List<Long> synReqYfYyIds = new ArrayList<>();
|
|
|
+ List<OrderAppointment> addoalists = new ArrayList<>();
|
|
|
+ List<ItfTblAzAssignMxDownload> mxsynreqids = new ArrayList<>();
|
|
|
+ List<ItfTblAzAssignFkmxDownload> synreqids = new ArrayList<>();
|
|
|
+ List<OrderProduct> orderProductsUpdate = new ArrayList<>();
|
|
|
+ List<OrderInstallOperatingLog> addoiolList = new ArrayList<>();
|
|
|
+ List<Long> getpjSynReqId = new ArrayList<>();
|
|
|
+ List<OrderAppraise> addoalist = new ArrayList<>();
|
|
|
|
|
|
+ // 提取本地订单
|
|
|
+ OrderBase old = orderBaseService.lambdaQuery()
|
|
|
+ .eq(OrderBase::getPgguid, item.getPgguid()).one();
|
|
|
|
|
|
+ // 获取安装工单主表
|
|
|
+ OrderBase newLCLS = getOrderBase(item, brand);
|
|
|
+ // 这里一定不能少
|
|
|
+ newLCLS.setId(old.getId());
|
|
|
|
|
|
- // 同步修改订单基础表
|
|
|
- if (upInfo !=null){
|
|
|
- orderBaseService.updateById(upInfo);
|
|
|
- // lc_ls同步状态改成1 同步成功
|
|
|
- synItfTblAzAssignLcLsDownload(item.getSynReqId(),1,"更新完成");
|
|
|
- }
|
|
|
+ // 获取工单主表要同步的数据
|
|
|
+ OrderBase upInfo = getOrderBase(old, item, newLCLS);
|
|
|
|
|
|
- // 同步新增或修改师傅信息 own 从工单主表过来,无load表修改
|
|
|
- if (own != null){
|
|
|
- orderWorkerService.saveOrUpdate(own);
|
|
|
- }
|
|
|
+ // 获取工单师傅信息来自于工单主表数据只有修改的情况
|
|
|
+ OrderWorker own =getOrderWorkerUpdate(old.getId(), upInfo, newLCLS);
|
|
|
|
|
|
- // 同步修改产品明细表
|
|
|
- if (orderProductsUpdate.size()>0){
|
|
|
- orderProductService.updateBatchById(orderProductsUpdate);
|
|
|
- orderProductsUpdate.clear();
|
|
|
- }
|
|
|
- if (mxsynreqids.size()>0){
|
|
|
- itfTblAzAssignMxDownloadService.updateBatchById(mxsynreqids);
|
|
|
- }
|
|
|
+ // 获取产品明细要同步的数据 -只存在修改,减少与增加的情况不存在
|
|
|
+ orderProductsUpdate = getOrderProductsUpdate(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, old, newLCLS, item.getDownloadTaskNo(),mxsynreqids);
|
|
|
|
|
|
+ // 获取操作明细同步数据,即反馈明细
|
|
|
+ addoiolList = getOrderInstallOperatingLogsadd(brand, item, old, newLCLS, synreqids);
|
|
|
|
|
|
+ // 费用清单 放扩展表
|
|
|
+ // 提取已同步的数据
|
|
|
+ OrderInstall oldOrderInstall = orderInstallService.lambdaQuery()
|
|
|
+ .eq(OrderInstall::getOrderBaseId,old.getId()).one();
|
|
|
+ // 获取安装费用清单
|
|
|
+ ItfTblAzAssignFeeDownload fyqd = itfTblAzAssignFeeDownloadService.lambdaQuery()
|
|
|
+ .eq(ItfTblAzAssignFeeDownload::getDownloadTaskNo, item.getDownloadTaskNo())
|
|
|
+ .eq(ItfTblAzAssignFeeDownload::getSynStatus,0)
|
|
|
+ .one();
|
|
|
+ OrderInstall orderInstall = getOrderInstall(newLCLS, brand, item, fyqd);
|
|
|
+ // 已同步的有数据,后期的一定有数据 直接修改
|
|
|
+ if (oldOrderInstall != null){
|
|
|
+ orderInstall.setId(oldOrderInstall.getId());
|
|
|
+ orderInstall.setUpdateBy(newLCLS.getLastOperatorBy());
|
|
|
+ orderInstall.setUpdateTime(newLCLS.getLastOperatorTime());
|
|
|
+ }
|
|
|
|
|
|
+ // 获取用户预约改约信息
|
|
|
+ synReqYfYyIds = getYfYyLongs(item, old, newLCLS, addoalists);
|
|
|
|
|
|
- // 同步新增操作日志表
|
|
|
- if (addoiolList.size()>0){
|
|
|
- orderInstallOperatingLogService.saveBatch(addoiolList);
|
|
|
- addoiolList.clear();
|
|
|
- }
|
|
|
- if (synreqids.size()>0){
|
|
|
- itfTblAzAssignFkmxDownloadService.saveBatch(synreqids);
|
|
|
- }
|
|
|
+ // 获取评价同步数据
|
|
|
+ addoalist = getOrderAppraises(sysDictRefDLMap, brand, item, old, newLCLS, getpjSynReqId);
|
|
|
|
|
|
- // 同步评价新增的数据
|
|
|
- if (addoalist.size()>0){
|
|
|
- orderAppraiseService.saveBatch(addoalist);
|
|
|
- }
|
|
|
- if (getpjSynReqId.size()>0){
|
|
|
- upItfTblAzAssignSatisfactionDownload(getpjSynReqId);
|
|
|
- }
|
|
|
+ // 安装工单数据修改落本地表
|
|
|
+ addOrUpdateOrderData(item, upInfo, own, mxsynreqids, orderProductsUpdate, synreqids,
|
|
|
+ addoiolList, fyqd, orderInstall, synReqYfYyIds, addoalists, getpjSynReqId, addoalist);
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
- // 新增
|
|
|
- orderAdd(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item);
|
|
|
- orderBaselist.add(item.getPgguid());
|
|
|
- }
|
|
|
- } catch (Exception ex) {
|
|
|
- ex.printStackTrace();
|
|
|
- log.info("安装工单落本地表失败 销售单号-派工单号:【" + item.getXsdh() + "-"+ item.getPgid()+"】");
|
|
|
+ public void addOrUpdateOrderData(ItfTblAzAssignLcLsDownload item, OrderBase upInfo, OrderWorker own,
|
|
|
+ List<ItfTblAzAssignMxDownload> mxsynreqids, List<OrderProduct> orderProductsUpdate,
|
|
|
+ List<ItfTblAzAssignFkmxDownload> synreqids, List<OrderInstallOperatingLog> addoiolList,
|
|
|
+ ItfTblAzAssignFeeDownload fyqd, OrderInstall orderInstall, List<Long> synReqYfYyIds,
|
|
|
+ List<OrderAppointment> addoalists, List<Long> getpjSynReqId, List<OrderAppraise> addoalist) {
|
|
|
+ // 同步修改订单基础表
|
|
|
+ if (upInfo !=null){
|
|
|
+ orderBaseService.updateById(upInfo);
|
|
|
+ // lc_ls同步状态改成1 同步成功
|
|
|
+ synItfTblAzAssignLcLsDownload(item.getSynReqId(),1,"成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步新增或修改师傅信息 own 从工单主表过来,无load表修改
|
|
|
+ if (own != null){
|
|
|
+ orderWorkerService.saveOrUpdate(own);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步修改产品明细表
|
|
|
+ if (orderProductsUpdate.size()>0){
|
|
|
+ orderProductService.updateBatchById(orderProductsUpdate);
|
|
|
+ orderProductsUpdate.clear();
|
|
|
+ }
|
|
|
+ if (mxsynreqids.size()>0){
|
|
|
+ itfTblAzAssignMxDownloadService.updateBatchById(mxsynreqids);
|
|
|
+ mxsynreqids.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步新增操作日志表
|
|
|
+ if (addoiolList.size()>0){
|
|
|
+ orderInstallOperatingLogService.saveBatch(addoiolList);
|
|
|
+ addoiolList.clear();
|
|
|
+ }
|
|
|
+ if (synreqids.size()>0){
|
|
|
+ itfTblAzAssignFkmxDownloadService.updateBatchById(synreqids);
|
|
|
+ synreqids.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步修改安装工单扩展表
|
|
|
+ if (orderInstall !=null){
|
|
|
+ orderInstallService.saveOrUpdate(orderInstall);
|
|
|
+ }
|
|
|
+ if (fyqd != null){
|
|
|
+ upItfTblAzAssignFeeDownload(fyqd);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步用户预约表
|
|
|
+ if (addoalists.size()>0){
|
|
|
+ orderAppointmentService.saveBatch(addoalists);
|
|
|
+ addoalist.clear();
|
|
|
+ }
|
|
|
+ if (synReqYfYyIds.size()>0){
|
|
|
+ upItfTblAzAssignAppointment(synReqYfYyIds);
|
|
|
+ synReqYfYyIds.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同步评价新增的数据
|
|
|
+ if (addoalist.size()>0){
|
|
|
+ orderAppraiseService.saveBatch(addoalist);
|
|
|
+ addoalist.clear();
|
|
|
+ }
|
|
|
+ if (getpjSynReqId.size()>0){
|
|
|
+ upItfTblAzAssignSatisfactionDownload(getpjSynReqId);
|
|
|
+ getpjSynReqId.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @NotNull
|
|
|
+ private List<Long> getYfYyLongs(ItfTblAzAssignLcLsDownload item, OrderBase old, OrderBase newLCLS, List<OrderAppointment> addoalists) {
|
|
|
+ List<Long> synReqYfYyIds;
|
|
|
+ List<OrderAppointment> oaps = new ArrayList<>();
|
|
|
+ // 提取已同步的
|
|
|
+ List<OrderAppointment> oapps = orderAppointmentService.lambdaQuery()
|
|
|
+ .select(OrderAppointment::getId)
|
|
|
+ .eq(OrderAppointment::getOrderBaseId, old.getId()).list();
|
|
|
+ List<String> oappslist = oapps.stream().map(OrderAppointment::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 获取用户预约改约信息
|
|
|
+ List<ItfTblAzAssignAppointmentDownload> appointments = itfTblAzAssignAppointmentDownloadService.lambdaQuery()
|
|
|
+ .eq(ItfTblAzAssignAppointmentDownload::getDownloadTaskNo, item.getDownloadTaskNo())
|
|
|
+ .eq(ItfTblAzAssignAppointmentDownload::getSynStatus,0)
|
|
|
+ .orderByAsc(ItfTblAzAssignAppointmentDownload::getSynReqId)
|
|
|
+ .list();
|
|
|
+ synReqYfYyIds = appointments.stream().map(ItfTblAzAssignAppointmentDownload::getSynReqId).collect(Collectors.toList());
|
|
|
+ // 提取本次获取的
|
|
|
+ getOrderAppointment(newLCLS, oaps, appointments);
|
|
|
+
|
|
|
+ // 移除已同步过的
|
|
|
+ for (OrderAppointment oa:oaps){
|
|
|
+ if (!oappslist.contains(oa.getId())){
|
|
|
+ addoalists.add(oa);
|
|
|
}
|
|
|
}
|
|
|
+ return synReqYfYyIds;
|
|
|
+ }
|
|
|
|
|
|
- log.info("安装工单落本地表完成: {}",sdf.format(new Date()));
|
|
|
+ @NotNull
|
|
|
+ private List<OrderAppraise> getOrderAppraises(Map<String, List<SysDictRef>> sysDictRefDLMap, Brand brand, ItfTblAzAssignLcLsDownload item, OrderBase old, OrderBase newLCLS, List<Long> getpjSynReqId) {
|
|
|
+ // 提取已同步的
|
|
|
+ List<OrderAppraise> oas = orderAppraiseService.lambdaQuery()
|
|
|
+ .select(OrderAppraise::getPid,
|
|
|
+ OrderAppraise::getPgguid)
|
|
|
+ .eq(OrderAppraise::getOrderBaseId, old.getId()).list();
|
|
|
+ List<String> oaslist = oas.stream().map(OrderAppraise::getPid).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 提取本次获取的
|
|
|
+ List<OrderAppraise> oanew = new ArrayList<>();
|
|
|
+ getOrderAppraise(newLCLS, sysDictRefDLMap, oanew, brand, item, getpjSynReqId);
|
|
|
+
|
|
|
+ // 移除已同步过的
|
|
|
+ List<OrderAppraise> addoalist = new ArrayList<>();
|
|
|
+ for (OrderAppraise oa:oanew){
|
|
|
+ if (!oaslist.contains(oa.getPid())){
|
|
|
+ addoalist.add(oa);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return addoalist;
|
|
|
}
|
|
|
|
|
|
private void upItfTblAzAssignSatisfactionDownload(List<Long> getpjSynReqId) {
|
|
|
List<ItfTblAzAssignSatisfactionDownload> sas =new ArrayList<>();
|
|
|
for (int i = 0; i< getpjSynReqId.size(); i++){
|
|
|
- ItfTblAzAssignSatisfactionDownload its = new ItfTblAzAssignSatisfactionDownload();
|
|
|
- its.setSynReqId(getpjSynReqId.get(i));
|
|
|
- its.setSynStatus(1);
|
|
|
- its.setSynTime(new Date());
|
|
|
- sas.add(its);
|
|
|
+ ItfTblAzAssignSatisfactionDownload add = new ItfTblAzAssignSatisfactionDownload();
|
|
|
+ add.setSynReqId(getpjSynReqId.get(i));
|
|
|
+ add.setSynStatus(1);
|
|
|
+ add.setSynTime(new Date());
|
|
|
+ add.setSynErrMsg("成功");
|
|
|
+ sas.add(add);
|
|
|
}
|
|
|
- itfTblAzAssignSatisfactionDownloadService.saveBatch(sas);
|
|
|
+ itfTblAzAssignSatisfactionDownloadService.updateBatchById(sas);
|
|
|
}
|
|
|
|
|
|
@NotNull
|
|
|
@@ -322,7 +380,6 @@ public class AnzhuangGongDanBusiness {
|
|
|
return addoiolList;
|
|
|
}
|
|
|
|
|
|
- @NotNull
|
|
|
private OrderWorker getOrderWorkerUpdate(String id, OrderBase upInfo, OrderBase newLCLS){
|
|
|
OrderWorker oow = orderWorkerService.lambdaQuery()
|
|
|
.eq(OrderWorker::getOrderBaseId,id)
|
|
|
@@ -363,11 +420,9 @@ public class AnzhuangGongDanBusiness {
|
|
|
return own;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- @NotNull
|
|
|
private List<OrderProduct> getOrderProductsUpdate(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String,
|
|
|
List<SysDictRef>> sysDictRefXLMap, Map<String, List<SysDictRef>> sysDictRefXiLieMap,
|
|
|
OrderBase old, OrderBase newLCLS, String downloadTaskNo,
|
|
|
@@ -455,12 +510,12 @@ public class AnzhuangGongDanBusiness {
|
|
|
uf = Boolean.TRUE;
|
|
|
}
|
|
|
if (o.getNum() !=null && n.getNum() !=null) {
|
|
|
- if (!o.getOutCode().equals(n.getOutCode())){
|
|
|
+ if (!o.getNum().equals(n.getNum())){
|
|
|
v.setNum(n.getNum());
|
|
|
uf = Boolean.TRUE;
|
|
|
}
|
|
|
} else {
|
|
|
- if (o.getOutCode() !=null) {
|
|
|
+ if (o.getNum() !=null) {
|
|
|
v.setNum(null);
|
|
|
} else {
|
|
|
v.setNum(n.getNum());
|
|
|
@@ -566,7 +621,7 @@ public class AnzhuangGongDanBusiness {
|
|
|
}
|
|
|
|
|
|
@NotNull
|
|
|
- private OrderBase getOrderBase(OrderBase old, Brand brand, ItfTblAzAssignLcLsDownload item, OrderBase newLCLS) {
|
|
|
+ private OrderBase getOrderBase(OrderBase old, ItfTblAzAssignLcLsDownload item, OrderBase newLCLS) {
|
|
|
OrderBase upInfo = new OrderBase();
|
|
|
|
|
|
// 本地订单已关闭 且总部的最后修改时间晚于本地数据修改时间 不可修改
|
|
|
@@ -601,7 +656,7 @@ public class AnzhuangGongDanBusiness {
|
|
|
.eq(OrderInstall::getOrderBaseId,old.getId()).one();
|
|
|
|
|
|
// 3.2天猫工单,允许天猫自已预约
|
|
|
- if (StringUtils.isNotEmpty(oi.getExtendField2()) &&
|
|
|
+ if (oi !=null && StringUtils.isNotEmpty(oi.getExtendField2()) &&
|
|
|
oi.getExtendField2().equals("TBL_TMALL_ORDERINFO")){
|
|
|
upInfo.setAppointmentTime(newLCLS.getAppointmentTime());
|
|
|
}
|
|
|
@@ -734,13 +789,14 @@ public class AnzhuangGongDanBusiness {
|
|
|
return allowUpdate;
|
|
|
}
|
|
|
|
|
|
- private void orderAdd(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void orderAdd(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
|
|
|
Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item) {
|
|
|
List<OrderAppointment> oa = new ArrayList<>();
|
|
|
List<OrderAppraise> oanew = new ArrayList<>();
|
|
|
List<OrderProduct> orderProducts = new ArrayList<>();
|
|
|
List<ItfTblAzAssignFkmxDownload> fkmxs = new ArrayList<>();
|
|
|
- List<Integer> synReqIds = new ArrayList<>();
|
|
|
+ List<Long> synReqIds = new ArrayList<>();
|
|
|
List<Long> synReqFkMxIds = new ArrayList<>();
|
|
|
List<Long> synReqYfYyIds = new ArrayList<>();
|
|
|
|
|
|
@@ -779,7 +835,7 @@ public class AnzhuangGongDanBusiness {
|
|
|
.orderByAsc(ItfTblAzAssignAppointmentDownload::getSynReqId)
|
|
|
.list();
|
|
|
synReqYfYyIds = appointments.stream().map(ItfTblAzAssignAppointmentDownload::getSynReqId).collect(Collectors.toList());
|
|
|
- getOrderAppointment(orderBase, oa, item,appointments);
|
|
|
+ getOrderAppointment(orderBase, oa, appointments);
|
|
|
|
|
|
// 获取用户客户评价信息
|
|
|
List<Long> getpjSynReqId = new ArrayList<>();
|
|
|
@@ -787,8 +843,7 @@ public class AnzhuangGongDanBusiness {
|
|
|
|
|
|
// 安装工单数据落本地表
|
|
|
addOrderData(orderBase, orderWorker, orderInstall, orderProducts, oiolList, oa, oanew,
|
|
|
- item.getSynReqId(), synReqIds, synReqFkMxIds, synReqYfYyIds,
|
|
|
- fyqd, getpjSynReqId);
|
|
|
+ item.getSynReqId(), synReqIds, synReqFkMxIds, synReqYfYyIds, fyqd, getpjSynReqId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -796,10 +851,9 @@ public class AnzhuangGongDanBusiness {
|
|
|
* 操作明细表order_install_operating_log,安装费用清单表order_install,用户预约改约信息表order_appointment,
|
|
|
* 工单评价表order_appraise
|
|
|
*/
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
public void addOrderData(OrderBase orderBase, OrderWorker orderWorker, OrderInstall orderInstall, List<OrderProduct> orderProducts,
|
|
|
List<OrderInstallOperatingLog> oiolList, List<OrderAppointment> oa, List<OrderAppraise> oanew,
|
|
|
- Long synReqId, List<Integer> synReqIds, List<Long> synReqFkMxIds, List<Long> synReqYfYyIds,
|
|
|
+ Long synReqId, List<Long> synReqIds, List<Long> synReqFkMxIds, List<Long> synReqYfYyIds,
|
|
|
ItfTblAzAssignFeeDownload fyqd, List<Long> getpjSynReqId) {
|
|
|
// 工单基础表
|
|
|
if (orderBase != null) {
|
|
|
@@ -846,7 +900,7 @@ public class AnzhuangGongDanBusiness {
|
|
|
oa.clear();
|
|
|
}
|
|
|
if (synReqYfYyIds.size()>0){
|
|
|
- upItfTblAzAssignAppointment(synReqFkMxIds);
|
|
|
+ upItfTblAzAssignAppointment(synReqYfYyIds);
|
|
|
synReqYfYyIds.clear();
|
|
|
}
|
|
|
|
|
|
@@ -862,55 +916,66 @@ public class AnzhuangGongDanBusiness {
|
|
|
}
|
|
|
|
|
|
private void upItfTblAzAssignFeeDownload(ItfTblAzAssignFeeDownload fyqd) {
|
|
|
- ItfTblAzAssignFeeDownload n = new ItfTblAzAssignFeeDownload();
|
|
|
- n.setSynReqId(fyqd.getSynReqId());
|
|
|
- n.setSynStatus(1);
|
|
|
- n.setSynTime(new Date());
|
|
|
- itfTblAzAssignFeeDownloadService.updateById(n);
|
|
|
+ ItfTblAzAssignFeeDownload add = new ItfTblAzAssignFeeDownload();
|
|
|
+ add.setSynReqId(fyqd.getSynReqId());
|
|
|
+ add.setSynStatus(1);
|
|
|
+ add.setSynTime(new Date());
|
|
|
+ add.setSynErrMsg("成功");
|
|
|
+ itfTblAzAssignFeeDownloadService.updateById(add);
|
|
|
}
|
|
|
|
|
|
- private void upItfTblAzAssignMxDownload(List<Integer> synReqIds) {
|
|
|
+ private void upItfTblAzAssignMxDownload(List<Long> synReqIds) {
|
|
|
List<ItfTblAzAssignMxDownload> sas =new ArrayList<>();
|
|
|
for (int i = 0; i< synReqIds.size(); i++){
|
|
|
- ItfTblAzAssignMxDownload its = new ItfTblAzAssignMxDownload();
|
|
|
- its.setSynReqId(synReqIds.get(i));
|
|
|
- its.setSynStatus(1);
|
|
|
- its.setSynTime(new Date());
|
|
|
- sas.add(its);
|
|
|
- }
|
|
|
- itfTblAzAssignMxDownloadService.saveBatch(sas);
|
|
|
+ ItfTblAzAssignMxDownload add = new ItfTblAzAssignMxDownload();
|
|
|
+ add.setSynReqId(synReqIds.get(i));
|
|
|
+ add.setSynStatus(1);
|
|
|
+ add.setSynTime(new Date());
|
|
|
+ add.setSynErrMsg("成功");
|
|
|
+ sas.add(add);
|
|
|
+ }
|
|
|
+ itfTblAzAssignMxDownloadService.updateBatchById(sas);
|
|
|
+ // 测试用
|
|
|
+ /*if (synReqIds.get(0).equals(190L)){
|
|
|
+ itfTblAzAssignMxDownloadService.updateBatchById(sas);
|
|
|
+ } else {
|
|
|
+ itfTblAzAssignMxDownloadService.saveBatch(sas);
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
private void upItfTblAzAssignFkmxDownload(List<Long> synReqFkMxIds) {
|
|
|
List<ItfTblAzAssignFkmxDownload> sas =new ArrayList<>();
|
|
|
for (int i = 0; i< synReqFkMxIds.size(); i++){
|
|
|
- ItfTblAzAssignFkmxDownload its = new ItfTblAzAssignFkmxDownload();
|
|
|
- its.setSynReqId(synReqFkMxIds.get(i));
|
|
|
- its.setSynStatus(1);
|
|
|
- its.setSynTime(new Date());
|
|
|
- sas.add(its);
|
|
|
+ ItfTblAzAssignFkmxDownload add = new ItfTblAzAssignFkmxDownload();
|
|
|
+ add.setSynReqId(synReqFkMxIds.get(i));
|
|
|
+ add.setSynStatus(1);
|
|
|
+ add.setSynTime(new Date());
|
|
|
+ add.setSynErrMsg("成功");
|
|
|
+ sas.add(add);
|
|
|
}
|
|
|
- itfTblAzAssignFkmxDownloadService.saveBatch(sas);
|
|
|
+ itfTblAzAssignFkmxDownloadService.updateBatchById(sas);
|
|
|
}
|
|
|
|
|
|
private void upItfTblAzAssignAppointment(List<Long> synReqYfYYIds) {
|
|
|
List<ItfTblAzAssignAppointmentDownload> sas =new ArrayList<>();
|
|
|
for (int i = 0; i< synReqYfYYIds.size(); i++){
|
|
|
- ItfTblAzAssignAppointmentDownload its = new ItfTblAzAssignAppointmentDownload();
|
|
|
- its.setSynReqId(synReqYfYYIds.get(i));
|
|
|
- its.setSynStatus(1);
|
|
|
- its.setSynTime(new Date());
|
|
|
- sas.add(its);
|
|
|
+ ItfTblAzAssignAppointmentDownload add = new ItfTblAzAssignAppointmentDownload();
|
|
|
+ add.setSynReqId(synReqYfYYIds.get(i));
|
|
|
+ add.setSynStatus(1);
|
|
|
+ add.setSynTime(new Date());
|
|
|
+ add.setSynErrMsg("成功");
|
|
|
+ sas.add(add);
|
|
|
}
|
|
|
- itfTblAzAssignAppointmentDownloadService.saveBatch(sas);
|
|
|
+ itfTblAzAssignAppointmentDownloadService.updateBatchById(sas);
|
|
|
}
|
|
|
|
|
|
private void upItfTblAzAssignLcLsDownload(Long synReqId) {
|
|
|
- ItfTblAzAssignLcLsDownload lcls = new ItfTblAzAssignLcLsDownload();
|
|
|
- lcls.setSynReqId(synReqId);
|
|
|
- lcls.setSynStatus(1);
|
|
|
- lcls.setSynTime(new Date());
|
|
|
- itfTblAzAssignLcLsDownloadService.updateById(lcls);
|
|
|
+ ItfTblAzAssignLcLsDownload add = new ItfTblAzAssignLcLsDownload();
|
|
|
+ add.setSynReqId(synReqId);
|
|
|
+ add.setSynStatus(1);
|
|
|
+ add.setSynTime(new Date());
|
|
|
+ add.setSynErrMsg("成功");
|
|
|
+ itfTblAzAssignLcLsDownloadService.updateById(add);
|
|
|
}
|
|
|
|
|
|
private void getOrderAppraise(OrderBase orderBase, Map<String, List<SysDictRef>> sysDictRefDLMap, List<OrderAppraise> oanew, Brand brand,
|
|
|
@@ -979,10 +1044,10 @@ public class AnzhuangGongDanBusiness {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void getOrderAppointment(OrderBase orderBase, List<OrderAppointment> oa, ItfTblAzAssignLcLsDownload item,
|
|
|
- List<ItfTblAzAssignAppointmentDownload> appointments) {
|
|
|
+ private void getOrderAppointment(OrderBase orderBase, List<OrderAppointment> oa, List<ItfTblAzAssignAppointmentDownload> appointments) {
|
|
|
for (ItfTblAzAssignAppointmentDownload a :appointments){
|
|
|
OrderAppointment v = new OrderAppointment();
|
|
|
+ v.setId(a.getId());
|
|
|
v.setOrderBaseId(orderBase.getId());
|
|
|
v.setStartTime(a.getKssj());
|
|
|
v.setEndTime(a.getJssj());
|
|
|
@@ -1295,1202 +1360,5 @@ public class AnzhuangGongDanBusiness {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
- // 3:工单落入本地表
|
|
|
- @Scheduled(fixedDelay = 1 * 30 * 1000)
|
|
|
- public void inputOrderInstall() throws Exception {
|
|
|
- if (1 == 1) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- List<ItfTblAzAssignLcLsDownload> lcls = new ArrayList<>();
|
|
|
-
|
|
|
- log.info("安装工单落本地表开始处理: {}",sdf.format(new Date()));
|
|
|
-
|
|
|
- lcls = itfTblAzAssignLcLsDownloadService.lambdaQuery()
|
|
|
- .eq(ItfTblAzAssignLcLsDownload::getSynStatus,0)
|
|
|
- .eq(ItfTblAzAssignLcLsDownload::getSynReqId,167)
|
|
|
- .list();
|
|
|
- // 按单处理
|
|
|
- for (ItfTblAzAssignLcLsDownload item: lcls) {
|
|
|
- // 处理安装工单主表
|
|
|
- extractedOrderInstall(item);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- log.info("安装工单落本地表完成: {}",sdf.format(new Date()));
|
|
|
- }
|
|
|
-
|
|
|
- private Boolean extractedOrderInstall(ItfTblAzAssignLcLsDownload item) {
|
|
|
- List<OrderInstallDetail> recs = new ArrayList<>();
|
|
|
- Boolean flag = Boolean.FALSE;
|
|
|
- Boolean lclsAddFlag = Boolean.FALSE;
|
|
|
- OrderApplyDispatch orderapp = null;
|
|
|
- OrderApplyDispatch orderApplyDispatch = null;
|
|
|
- OrderInstallOperatingLog recLog = null;
|
|
|
- Integer orderState = 0;
|
|
|
- String workerOrderNo = "";
|
|
|
- String azwdno ="";
|
|
|
- Integer cjDownloadFlag = -1;
|
|
|
- Integer yjhxDownloadFlag = 0;
|
|
|
- String xslx = null;
|
|
|
- String mainName = null;
|
|
|
- Long sxlxid = 0l;
|
|
|
- recLog = null;
|
|
|
- orderapp = null;
|
|
|
- orderApplyDispatch = null;
|
|
|
- sxlxid = 1l;
|
|
|
-
|
|
|
- // 获取销售类型 ID
|
|
|
- sxlxid = getxslxid(item);
|
|
|
- azwdno = getAzwdno(item);
|
|
|
- xslx = null;
|
|
|
- if (BeanUtil.isNotEmpty(item.getXslx())){
|
|
|
- xslx = item.getXslx().trim();
|
|
|
- }
|
|
|
-
|
|
|
- // 判断安装网点编号是否为空或者为公司,如果为空或为公司,就写入接收派工网点
|
|
|
-
|
|
|
- // 看安装工单是否存在
|
|
|
- OrderInstall orderItem = orderInstallService.lambdaQuery()
|
|
|
- .eq(OrderInstall::getPgguid, item.getPgguid()).one();
|
|
|
-
|
|
|
- if (orderItem !=null){
|
|
|
- flag = Boolean.FALSE;
|
|
|
- lclsAddFlag = Boolean.FALSE;
|
|
|
-
|
|
|
- // 工单已关闭不再做更新操作
|
|
|
- if (orderItem.getOrderState().equals(10) && item.getLastModifiedDate().compareTo(orderItem.getUpdatetime())<0){
|
|
|
- item.setSynStatus(99);
|
|
|
- item.setSynTime(new Date());
|
|
|
- item.setSynErrMsg("广州系统已关闭或作废忽略更新");
|
|
|
- itfTblAzAssignLcLsDownloadService.updateById(item);
|
|
|
- return Boolean.FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- Date reservebegin = orderItem.getReserveBegin();
|
|
|
- cjDownloadFlag = orderItem.getCjDownloadFlag();
|
|
|
- mainName = null;
|
|
|
- if (BeanUtil.isNotEmpty(orderItem.getMainName())){
|
|
|
- mainName = orderItem.getMainName().trim();
|
|
|
- }
|
|
|
-
|
|
|
- yjhxDownloadFlag = 0;
|
|
|
- if (BeanUtil.isNotEmpty(orderItem.getYjhxDownloadFlag())){
|
|
|
- yjhxDownloadFlag = orderItem.getYjhxDownloadFlag();
|
|
|
- }
|
|
|
-
|
|
|
- // 判断京东虚拟号是否总部有更新
|
|
|
- if (BeanUtil.isNotEmpty(item.getFjhm())){
|
|
|
- orderItem.setGreeVirtualnumber(item.getFjhm());
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
-
|
|
|
- // 1:总部工单的修改时间时间晚于系统修改时间需更新系统订单信息
|
|
|
- flag = updateOldOrder(item, orderItem,sxlxid);
|
|
|
-
|
|
|
- // 2:网点修改
|
|
|
- flag = updateOldOrderWD(orderState, item, orderItem);
|
|
|
-
|
|
|
- // 3:预约时间更新
|
|
|
- flag = getUpdateOrderYYSJ(flag, item, orderItem, reservebegin);
|
|
|
-
|
|
|
- // 4:状态信息更新 获取安装工单的状态是否允许更新
|
|
|
- flag = getupdateStatus(flag, item, orderItem, orderState);
|
|
|
-
|
|
|
- // 5:预派工标志更新
|
|
|
- flag = getaBooleanFlag(flag, item, orderItem);
|
|
|
-
|
|
|
- } else {
|
|
|
- flag = Boolean.TRUE;
|
|
|
- // 新增
|
|
|
- lclsAddFlag = Boolean.TRUE;
|
|
|
-
|
|
|
- // 生成订单主表对象
|
|
|
- orderItem = getOrderInstall(item,sxlxid);
|
|
|
- if (orderItem == null){
|
|
|
- return Boolean.FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- // 分销商城订单 写入fa_order_install_operating_log表
|
|
|
- getOrderInstallLog(item, orderItem, recLog);
|
|
|
- }
|
|
|
-
|
|
|
- orderState = orderItem.getOrderState();
|
|
|
- workerOrderNo = orderItem.getWorkerOrderNo();
|
|
|
-
|
|
|
- // 处理1121,1125时判断after_number是否为中心,如果不是则order_state = '3';
|
|
|
- // 总部下来的关闭工单要修改最后更新时间,否则不会产生结算完工数据
|
|
|
- extractedOther(orderState, workerOrderNo, item, orderItem);
|
|
|
-
|
|
|
- // 改派处理
|
|
|
- orderApplyDispatch = getOrderApplyDispatch(orderapp, workerOrderNo, item, orderItem);
|
|
|
-
|
|
|
- // 处理跨区,如果接收派工网点与所属区域有差异时,直接修改
|
|
|
- extractedOrderJD(item, orderItem);
|
|
|
-
|
|
|
- BrandWebsit brandWebsit = null;
|
|
|
- if (azwdno.equals("99999999")){
|
|
|
- brandWebsit = brandWebsitService.lambdaQuery()
|
|
|
- .eq(BrandWebsit::getBrandWebsitNumber,azwdno)
|
|
|
- .eq(BrandWebsit::getType,"professionazwdno").one();
|
|
|
- } else {
|
|
|
- brandWebsit = brandWebsitService.lambdaQuery()
|
|
|
- .eq(BrandWebsit::getBrandWebsitNumber, item.getJspgwdno()).one();
|
|
|
- }
|
|
|
- // 修改销售公司信息 需确认网点信息表 修改订单主表 todo
|
|
|
-
|
|
|
- //增加处理采集数据下载
|
|
|
- OrderInstallDetail orderDetailRec = null;
|
|
|
- OrderInstallDetail delorderDetailRec = null;
|
|
|
- if ((item.getDqjd().equals(1304L) || item.getDqjd().equals(1309L)) && cjDownloadFlag == 0){
|
|
|
- orderDetailRec = orderInstallDetailService.lambdaQuery()
|
|
|
- .eq(OrderInstallDetail::getWorkerOrderNo,workerOrderNo)
|
|
|
- .eq(OrderInstallDetail::getStatus,1).one();
|
|
|
- // 存在状态为"已采集"的记录暂时忽略下载
|
|
|
- if (orderDetailRec !=null && item.getDqjd().equals(1309L) && orderDetailRec.getDetailSource().equals(1)){
|
|
|
- orderItem.setUploadNotifyFlag(1);
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 清除本地的采集数据
|
|
|
- delorderDetailRec = orderInstallDetailService.lambdaQuery()
|
|
|
- .eq(OrderInstallDetail::getWorkerOrderNo,workerOrderNo)
|
|
|
- .eq(OrderInstallDetail::getStatus,0).one();
|
|
|
- if (orderDetailRec !=null){
|
|
|
- orderInstallDetailService.removeById(delorderDetailRec);
|
|
|
- }
|
|
|
-
|
|
|
- // 仅向表 itf_gree_to_fa_download_task_list 写数据需确认,暂不处理 todo
|
|
|
- if (BeanUtil.isNotEmpty(mainName)
|
|
|
- && (mainName.equals("家用空调") || mainName.equals("家用空气能热水器") || mainName.equals("驻车空调"))){
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- // 仅向表 itf_gree_to_fa_download_task_list 写数据需确认,暂不处理 todo
|
|
|
- if (BeanUtil.isNotEmpty(xslx) && (xslx.equals("以旧换新") || xslx.equals("格力商城-以旧换新") || xslx.equals("格力商城-以旧换新2"))
|
|
|
- && (yjhxDownloadFlag == 0)) {
|
|
|
-
|
|
|
- }
|
|
|
- // // 仅向表 itf_gree_to_fa_download_task_list 写数据需确认,暂不处理 todo
|
|
|
- if (BeanUtil.isNotEmpty(xslx) && (xslx.equals("以旧换新") || xslx.equals("格力商城-以旧换新") || xslx.equals("格力商城-以旧换新2"))) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- // 数据插入或修改 事务统一处理
|
|
|
- insertOrUpdate(flag, lclsAddFlag, orderapp, orderApplyDispatch, recLog, item, orderItem);
|
|
|
-
|
|
|
- return Boolean.TRUE;
|
|
|
- }
|
|
|
-
|
|
|
- private Boolean getaBooleanFlag(Boolean flag, ItfTblAzAssignLcLsDownload item, OrderInstall orderItem) {
|
|
|
- if (orderItem.getIsReservation().equals("1") && item.getSfwcps().equals("已配送")
|
|
|
- && (item.getDqjd().equals(1100) || item.getDqjd().equals(1122) || item.getDqjd().equals(1130))){
|
|
|
- orderItem.setIsReservation("0");
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- return flag;
|
|
|
- }
|
|
|
-
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public void insertOrUpdate(Boolean flag, Boolean lclsAddFlag, OrderApplyDispatch orderapp, OrderApplyDispatch orderApplyDispatch, OrderInstallOperatingLog recLog, ItfTblAzAssignLcLsDownload item, OrderInstall orderItem) {
|
|
|
- // 数据落表
|
|
|
- // 工单主表
|
|
|
- if (flag){
|
|
|
- if (lclsAddFlag){
|
|
|
- orderInstallService.save(orderItem);
|
|
|
- log.info("新增安装工单完成-工单号: {}", orderItem.getPgid());
|
|
|
- } else {
|
|
|
- orderInstallService.updateById(orderItem);
|
|
|
- log.info("修改安装工单完成-工单号: {}", orderItem.getPgid());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 分销商城订单 写入fa_order_install_operating_log表
|
|
|
- if (recLog != null){
|
|
|
- orderInstallOperatingLogService.save(recLog);
|
|
|
- }
|
|
|
-
|
|
|
- // 改派
|
|
|
- if (orderapp !=null){
|
|
|
- orderApplyDispatchService.save(orderapp);
|
|
|
- }
|
|
|
- if (orderApplyDispatch != null){
|
|
|
- orderApplyDispatchService.updateById(orderApplyDispatch);
|
|
|
- }
|
|
|
-
|
|
|
- // 修改下截的安装工单主表 - 处理完成
|
|
|
- upLcLsDownLoad(item);
|
|
|
- }
|
|
|
-
|
|
|
- private void upLcLsDownLoad(ItfTblAzAssignLcLsDownload item) {
|
|
|
- item.setSynStatus(1);
|
|
|
- item.setSynTime(new Date());
|
|
|
- item.setSynErrMsg("新增数据成功");
|
|
|
- itfTblAzAssignLcLsDownloadService.updateById(item);
|
|
|
- }
|
|
|
-
|
|
|
- private void extractedOrderJD(ItfTblAzAssignLcLsDownload item, OrderInstall orderItem) {
|
|
|
- if (item.getJspgwdno().equals("S9219801")
|
|
|
- && (!item.getSsqy().equals("广州") || !item.getSsqy().equals("S9219801"))){
|
|
|
- orderItem.setBelongCompanyId(2);
|
|
|
- orderItem.setBelongCompany("S9219801");
|
|
|
- orderItem.setOrderState(getState(item.getDqjd()));
|
|
|
- orderItem.setLastAppointState(getAState(item.getDqjd()));
|
|
|
- } else if (item.getJspgwdno().equals("S9219807")
|
|
|
- && (!item.getSsqy().equals("广州") || !item.getSsqy().equals("S9219807"))){
|
|
|
- orderItem.setBelongCompanyId(1);
|
|
|
- orderItem.setBelongCompany("S9219807");
|
|
|
- orderItem.setOrderState(getState(item.getDqjd()));
|
|
|
- orderItem.setLastAppointState(getAState(item.getDqjd()));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Nullable
|
|
|
- private OrderApplyDispatch getOrderApplyDispatch(OrderApplyDispatch orderapp, String workerOrderNo, ItfTblAzAssignLcLsDownload item, OrderInstall orderItem) {
|
|
|
- OrderApplyDispatch orderApplyDispatch;
|
|
|
- if (item.getDqjd().equals(1135)){
|
|
|
- orderApplyDispatch = orderApplyDispatchService.lambdaQuery()
|
|
|
- .eq(OrderApplyDispatch::getWorkerOrderNo, workerOrderNo)
|
|
|
- .eq(OrderApplyDispatch::getAuditState,"0").one();
|
|
|
- if (orderApplyDispatch == null){
|
|
|
- BeanUtil.copyProperties(orderItem, orderapp);
|
|
|
- // 工单类型:install=安装工单,repair=维修工单
|
|
|
- orderapp.setType("install");
|
|
|
- orderapp.setWebsitNumber(orderItem.getAfterNumber());
|
|
|
- orderapp.setWebsitName(orderItem.getAfterWname());
|
|
|
- orderapp.setApplyContent("申请改派");
|
|
|
- orderapp.setCustomerName(orderItem.getUserName());
|
|
|
- orderapp.setCustomerPhone(orderItem.getContactPhone());
|
|
|
- orderapp.setCreatetime(new Date());
|
|
|
- orderapp.setUpdatetime(new Date());
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 判断是否有正在改派的工单,如果没有就更新改派请求
|
|
|
- orderApplyDispatch = orderApplyDispatchService.lambdaQuery()
|
|
|
- .eq(OrderApplyDispatch::getWorkerOrderNo, workerOrderNo)
|
|
|
- .eq(OrderApplyDispatch::getAuditState,"0").one();
|
|
|
- if (orderApplyDispatch !=null){
|
|
|
- orderApplyDispatch.setAuditState("2");
|
|
|
- orderApplyDispatch.setAuditDesc("无效申请记录,系统自动拒绝");
|
|
|
- }
|
|
|
- }
|
|
|
- return orderApplyDispatch;
|
|
|
- }
|
|
|
-
|
|
|
- private void extractedOther(Integer orderState, String workerOrderNo, ItfTblAzAssignLcLsDownload item, OrderInstall orderItem) {
|
|
|
- // 处理1121,1125时判断after_number是否为中心,如果不是则order_state = '3';
|
|
|
- if (item.getDqjd().equals(1121) || item.getDqjd().equals(1125)){
|
|
|
- // 这里的判断需要再增加条件
|
|
|
- if (!(orderItem.getAfterNumber().equals("S9219801")
|
|
|
- || orderItem.getAfterNumber().equals("S9219807")) && (orderState <6) ){
|
|
|
- // 修改
|
|
|
- orderItem.setOrderState(3);
|
|
|
- orderItem.setAppointState(0);
|
|
|
- }
|
|
|
- // 修改时这里需要再处理
|
|
|
- if (item.getDqjd().equals(1125) && !orderItem.getInstallWid().equals(orderItem.getAfterWid())){
|
|
|
- orderItem.setInstallWid(Integer.valueOf(orderItem.getAfterWid()));
|
|
|
- orderItem.setInstallNumber(orderItem.getAfterNumber());
|
|
|
- orderItem.setInstallName(orderItem.getAfterWname());
|
|
|
- }
|
|
|
- }
|
|
|
- if (item.getDqjd().equals(1129) || item.getDqjd().equals(1135)){
|
|
|
- OrderInstall oldrec = orderInstallService.lambdaQuery().eq(OrderInstall::getPgguid, item.getPgguid()).one();
|
|
|
- if (oldrec.getAfterNumber().equals("S9219801") || oldrec.getAfterNumber().equals("S9219807")){
|
|
|
- // 修改
|
|
|
- oldrec.setOrderState(2);
|
|
|
- oldrec.setAppointState(0);
|
|
|
- orderInstallService.updateById(oldrec);
|
|
|
- }
|
|
|
- }
|
|
|
- // 总部下来的关闭工单要修改最后更新时间,否则不会产生结算完工数据
|
|
|
- // 采集明细 有历史单再处理
|
|
|
- if (item.getDqjd().equals(1309)){
|
|
|
- List<OrderInstallDetail> recs = orderInstallDetailService.lambdaQuery()
|
|
|
- .eq(OrderInstallDetail::getWorkerOrderNo, workerOrderNo)
|
|
|
- .eq(OrderInstallDetail::getStatus,1).list();
|
|
|
- if (recs.size()>0 && recs.size()== orderItem.getMachineNum()){
|
|
|
- orderItem.setOrderState(10);
|
|
|
- orderItem.setAppointState(4);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private String getAzwdno (ItfTblAzAssignLcLsDownload item){
|
|
|
- String azwdno ="";
|
|
|
- if (BeanUtil.isNotEmpty(item.getAzwdno())){
|
|
|
- azwdno = item.getAzwdno();
|
|
|
- }
|
|
|
- if (StringUtils.isEmpty(azwdno) || azwdno.equals("S9219801") || azwdno.equals("S9219807")){
|
|
|
- azwdno = item.getJspgwdno();
|
|
|
- }
|
|
|
-
|
|
|
- return azwdno;
|
|
|
- }
|
|
|
-
|
|
|
- private void getOrderInstallLog(ItfTblAzAssignLcLsDownload item, OrderInstall rec, OrderInstallOperatingLog recLog) {
|
|
|
- if (item.getShopno().equals("88888888")){
|
|
|
- recLog = new OrderInstallOperatingLog();
|
|
|
-
|
|
|
- recLog.setBelongCompanyId(rec.getBelongCompanyId());
|
|
|
- recLog.setBelongCompany(rec.getBelongCompany());
|
|
|
- recLog.setWebsitNumber(rec.getSalesNumber());
|
|
|
- recLog.setWorkerOrderNo(rec.getWorkerOrderNo());
|
|
|
- recLog.setBeforeOrderState(0);
|
|
|
- recLog.setBeforeAppointState(0);
|
|
|
- recLog.setOrderState(0);
|
|
|
- recLog.setAppointState(0);
|
|
|
- recLog.setType("创建工单");
|
|
|
- recLog.setContent("[GF](家用空调)分销商城新增工单,操作网点:"+ rec.getSalesNumber());
|
|
|
- recLog.setFeedback("保存");
|
|
|
- recLog.setOperator(rec.getSalesWname());
|
|
|
- recLog.setOperateWebsit(rec.getSalesNumber());
|
|
|
- recLog.setStatus("1");
|
|
|
- recLog.setCreatetime(new Date());
|
|
|
- recLog.setUpdatetime(new Date());
|
|
|
- recLog.setPgguid(rec.getPgguid());
|
|
|
- recLog.setPgid(rec.getPgid());
|
|
|
- recLog.setDataSource("2");
|
|
|
- recLog.setUploadNotifyFlag(1);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private boolean getupdateStatus(Boolean flag, ItfTblAzAssignLcLsDownload item, OrderInstall oldOrder, Integer orderState) {
|
|
|
- Boolean orderf = getOrderStatFlag(oldOrder, orderState, item);
|
|
|
-
|
|
|
- if (orderf && item.getLastModifiedDate().compareTo(oldOrder.getUpdatetime())>0){
|
|
|
- oldOrder.setLastOrderState(getState(item.getSyjd()));
|
|
|
- oldOrder.setLastAppointState(getAState(item.getSyjd()));
|
|
|
-
|
|
|
- if (getOrderUpdatef(orderState, item.getDqjd())){
|
|
|
- oldOrder.setOrderState(getState(item.getDqjd()));
|
|
|
- }
|
|
|
- if (!item.getDqjd().equals(1301)){
|
|
|
- oldOrder.setAppointState(getAState(item.getDqjd()));
|
|
|
- }
|
|
|
-
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
-
|
|
|
- return flag;
|
|
|
- }
|
|
|
-
|
|
|
- private Boolean getOrderUpdatef(Integer orderState, Long dqjd){
|
|
|
- Boolean f = Boolean.FALSE;
|
|
|
- if (orderState>4 && (dqjd.equals(1304) || dqjd.equals(1306) || dqjd.equals(1307)
|
|
|
- || dqjd.equals(1308) || dqjd.equals(1309) || dqjd.equals(1135))){
|
|
|
- f = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(5) && dqjd.equals(1301)){
|
|
|
- f = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState <=4 ){
|
|
|
- f = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(9) && (dqjd.equals(1121) || dqjd.equals(1125) || dqjd.equals(1129))){
|
|
|
- f = Boolean.TRUE;
|
|
|
- }
|
|
|
- return f;
|
|
|
- }
|
|
|
-
|
|
|
- // 工单状态:1=已保存工单,2=待分部派工,3=待分中心派工,4=待网点派工,5=待审批改派,6=待服务人员处理,7=服务人员报完工,8=申请售后处理,9=已作废工单,10=已关闭工单,99=非广佛作废
|
|
|
- private Integer getState(Long i){
|
|
|
- Integer outf = 1;
|
|
|
- if (i.equals(1100)){
|
|
|
- outf = 1;
|
|
|
- } else if (i.equals(1101)){
|
|
|
- outf = 1;
|
|
|
- } else if (i.equals(1121)){
|
|
|
- outf = 2;
|
|
|
- } else if (i.equals(1122)){
|
|
|
- outf = 2;
|
|
|
- } else if (i.equals(1125)){
|
|
|
- outf = 3;
|
|
|
- } else if (i.equals(1129)){
|
|
|
- outf = 4;
|
|
|
- } else if (i.equals(1130)){
|
|
|
- outf = 4;
|
|
|
- } else if (i.equals(1135)){
|
|
|
- outf = 5;
|
|
|
- } else if (i.equals(1301)){
|
|
|
- outf = 6;
|
|
|
- } else if (i.equals(1304)){
|
|
|
- outf = 7;
|
|
|
- } else if (i.equals(1307)){
|
|
|
- outf = 8;
|
|
|
- } else if (i.equals(1308)){
|
|
|
- outf = 9;
|
|
|
- } else if (i.equals(1309)){
|
|
|
- outf = 10;
|
|
|
- }
|
|
|
- return outf;
|
|
|
- }
|
|
|
-
|
|
|
- private Integer getAState(Long i){
|
|
|
- Integer outf = 0;
|
|
|
- if (i.equals(1100) || i.equals(1101) || i.equals(1121) || i.equals(1122) || i.equals(1125)
|
|
|
- || i.equals(1129) || i.equals(1130) || i.equals(1135) || i.equals(1301)
|
|
|
- || i.equals(1307) || i.equals(1308)){
|
|
|
- outf = 0;
|
|
|
- } else if (i.equals(1304) || i.equals(1309)){
|
|
|
- outf = 4;
|
|
|
- }
|
|
|
-
|
|
|
- return outf;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 判断广州本地的安装工单的状态是否允许更新
|
|
|
- private Boolean getOrderStatFlag(OrderInstall oldOrder, Integer orderState, ItfTblAzAssignLcLsDownload item){
|
|
|
- Boolean orderf = Boolean.FALSE;
|
|
|
- Integer curAppointState = oldOrder.getAppointState();
|
|
|
-
|
|
|
- if (orderState.equals(1) || orderState.equals(2) || orderState.equals(3)){
|
|
|
- curAppointState = 0;
|
|
|
- } else {
|
|
|
- orderf = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(3) && curAppointState.equals(0)
|
|
|
- && (item.getDqjd().equals(1125) || item.getDqjd().equals(1129) || item.getDqjd().equals(1301))){
|
|
|
- orderf = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(4) && curAppointState.equals(0)
|
|
|
- && (item.getDqjd().equals(1304) || item.getDqjd().equals(1306)
|
|
|
- || item.getDqjd().equals(1307) || item.getDqjd().equals(1308) || item.getDqjd().equals(1309))){
|
|
|
- orderf = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(6)
|
|
|
- && (curAppointState.equals(0) || curAppointState.equals(1)
|
|
|
- || curAppointState.equals(2) || curAppointState.equals(3))
|
|
|
- && (item.getDqjd().equals(1304) || item.getDqjd().equals(1306)
|
|
|
- || item.getDqjd().equals(1307) || item.getDqjd().equals(1308) || item.getDqjd().equals(1309))){
|
|
|
- orderf = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(7) && curAppointState.equals(4)
|
|
|
- && (item.getDqjd().equals(1307) || item.getDqjd().equals(1308) || item.getDqjd().equals(1309))){
|
|
|
- orderf = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(5) && curAppointState.equals(5)
|
|
|
- && (item.getDqjd().equals(1307) || item.getDqjd().equals(1308) || item.getDqjd().equals(1309))){
|
|
|
- orderf = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(2) && curAppointState.equals(2)
|
|
|
- && (item.getDqjd().equals(1125) || item.getDqjd().equals(1129)
|
|
|
- || item.getDqjd().equals(1301) || item.getDqjd().equals(1308))){
|
|
|
- orderf = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(9) || orderState.equals(10)|| orderState.equals(99)){
|
|
|
- if (item.getDqjd().equals(1121) || item.getDqjd().equals(1125) || item.getDqjd().equals(1129)){
|
|
|
- orderf = Boolean.TRUE;
|
|
|
- } else {
|
|
|
- orderf = Boolean.FALSE;
|
|
|
- }
|
|
|
- } else {
|
|
|
- orderf = Boolean.TRUE;
|
|
|
- }
|
|
|
- if (orderState.equals(6) && curAppointState.equals(2)
|
|
|
- && (item.getDqjd().equals(1121) || item.getDqjd().equals(1125) || item.getDqjd().equals(1301))){
|
|
|
- orderf = Boolean.FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- return orderf;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- private Boolean getUpdateOrderYYSJ(Boolean flag, ItfTblAzAssignLcLsDownload item, OrderInstall oldOrder, Date reservebegin) {
|
|
|
- Integer isReserve =-1;
|
|
|
- Date yysj = new Date();
|
|
|
- Date orderReservebegin = new Date();
|
|
|
- Date orderReserveEnd = new Date();
|
|
|
-
|
|
|
- if (BeanUtil.isNotEmpty(oldOrder.getIsReserve())){
|
|
|
- isReserve=oldOrder.getIsReserve();
|
|
|
- }
|
|
|
-
|
|
|
- // 预约时间(优先以预约安装时间为准,不存在时取用户期望上门开始时间)
|
|
|
- if (StringUtils.isEmpty(item.getYyazsj())){
|
|
|
- yysj = item.getYhqwkssj();
|
|
|
- orderReservebegin = item.getYhqwkssj();
|
|
|
- orderReserveEnd = item.getYhqwjssj();
|
|
|
- } else {
|
|
|
- yysj = item.getYyazsj();
|
|
|
- orderReservebegin = item.getYyazsj();
|
|
|
- orderReserveEnd = item.getYyazsj();
|
|
|
- }
|
|
|
-
|
|
|
- // 已做用户预约不能更新 (0=未预约,1=已预约)
|
|
|
- if (isReserve.equals(0)){
|
|
|
- if (BeanUtil.isNotEmpty(item.getYyazsj())){
|
|
|
- oldOrder.setReserveDatetime(item.getYyazsj());
|
|
|
- }
|
|
|
- oldOrder.setReservePeriod(MyBeanUtils.getDateXS(yysj));
|
|
|
- oldOrder.setReserveBegin(orderReservebegin);
|
|
|
- oldOrder.setReserveEnd(orderReserveEnd);
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- // 天猫工单,允许天猫自已预约
|
|
|
- if (BeanUtil.isNotEmpty(item.getYyazsj()) && item.getQqlymc().equals("TBL_TMALL_ORDERINFO")
|
|
|
- && reservebegin.compareTo(orderReservebegin) !=0 ){
|
|
|
- oldOrder.setIsReserve(1);
|
|
|
- if (BeanUtil.isNotEmpty(item.getYyazsj())){
|
|
|
- oldOrder.setReserveDatetime(item.getYyazsj());
|
|
|
- }
|
|
|
- oldOrder.setReservePeriod(MyBeanUtils.getDateXS(yysj));
|
|
|
- oldOrder.setReserveBegin(orderReservebegin);
|
|
|
- oldOrder.setReserveEnd(orderReserveEnd);
|
|
|
- flag = Boolean.TRUE;
|
|
|
- }
|
|
|
- return flag;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private Boolean updateOldOrderWD(Integer orderState, ItfTblAzAssignLcLsDownload item, OrderInstall oldOrder) {
|
|
|
- // 需排除个例(如果广佛已待服务人员处理,不允更新网点)
|
|
|
- if (!(orderState.equals(6) || orderState.equals(7) || orderState.equals(10))){
|
|
|
- oldOrder.setAfterNumber(item.getJspgwdno());
|
|
|
- oldOrder.setAfterWname(item.getJspgwdmc());
|
|
|
- oldOrder.setAfterXtbh(item.getJspgwdxtbh());
|
|
|
- oldOrder.setInstallNumber(item.getAzwdno());
|
|
|
- oldOrder.setInstallName(item.getAzwdmc());
|
|
|
- oldOrder.setInstallXtbh(item.getAzwdxtbh());
|
|
|
- return Boolean.TRUE;
|
|
|
- }
|
|
|
-
|
|
|
- return Boolean.FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- private Boolean updateOldOrder(ItfTblAzAssignLcLsDownload item, OrderInstall oldOrder, Long sxlxid) {
|
|
|
- if (item.getLastModifiedDate().compareTo(oldOrder.getUpdatetime())>0){
|
|
|
- oldOrder.setLastUpdSynReqId(String.valueOf(item.getSynReqId()));
|
|
|
- oldOrder.setLastUpdSynTime(new Date());
|
|
|
- oldOrder.setUserPhone("");
|
|
|
- if (StringUtils.isEmpty(item.getYddh())){
|
|
|
- if (StringUtils.isEmpty(item.getYddh2())){
|
|
|
- oldOrder.setUserPhone(item.getYddh2());
|
|
|
- }
|
|
|
- } else {
|
|
|
- oldOrder.setUserPhone(item.getYddh());
|
|
|
- }
|
|
|
- oldOrder.setUserPhone2("");
|
|
|
- if (BeanUtil.isNotEmpty(item.getYddh2())){
|
|
|
- oldOrder.setUserPhone2(item.getYddh2());
|
|
|
- }
|
|
|
- oldOrder.setUserName("");
|
|
|
- if (BeanUtil.isNotEmpty(item.getYhmc())){
|
|
|
- oldOrder.setUserName(item.getYhmc());
|
|
|
- }
|
|
|
- oldOrder.setUserContact("");
|
|
|
- if (BeanUtil.isNotEmpty(item.getLxren())){
|
|
|
- oldOrder.setUserContact(item.getLxren());
|
|
|
- }
|
|
|
- oldOrder.setAreacode("");
|
|
|
- if (BeanUtil.isNotEmpty(item.getQuhao())){
|
|
|
- oldOrder.setAreacode(item.getQuhao());
|
|
|
- }
|
|
|
- oldOrder.setContactPhone("");
|
|
|
- if (BeanUtil.isNotEmpty(item.getDhhm())){
|
|
|
- oldOrder.setContactPhone(item.getDhhm());
|
|
|
- }
|
|
|
- oldOrder.setGreeVirtualnumber("");
|
|
|
- if (BeanUtil.isNotEmpty(item.getFjhm())){
|
|
|
- oldOrder.setGreeVirtualnumber(item.getFjhm());
|
|
|
- }
|
|
|
- oldOrder.setGreeVirtualnumber("");
|
|
|
- if (BeanUtil.isNotEmpty(item.getFjhm())){
|
|
|
- oldOrder.setGreeVirtualnumber(item.getFjhm());
|
|
|
- }
|
|
|
- /// 再添加成员变量
|
|
|
- oldOrder.setSalesTypeId(Integer.valueOf(sxlxid.toString()));
|
|
|
-
|
|
|
- return Boolean.TRUE;
|
|
|
- }
|
|
|
-
|
|
|
- return Boolean.FALSE;
|
|
|
- }
|
|
|
-
|
|
|
- private Long getxslxid(ItfTblAzAssignLcLsDownload item) {
|
|
|
- Long sxlxid = 1l;
|
|
|
- if (StringUtils.isEmpty(item.getXslxid()) || item.getXslxid() == 0) {
|
|
|
- SalesType rec = salesTypeService.lambdaQuery().eq(SalesType::getXslxmc, item.getXslx()).one();
|
|
|
- if (rec != null) {
|
|
|
- sxlxid = rec.getXslxid();
|
|
|
- } else {
|
|
|
- sxlxid = 1l;
|
|
|
- }
|
|
|
- if (sxlxid == 0 || StringUtils.isEmpty(sxlxid)) {
|
|
|
- sxlxid = 1l;
|
|
|
- }
|
|
|
- } else {
|
|
|
- sxlxid = item.getXslxid();
|
|
|
- }
|
|
|
- return sxlxid;
|
|
|
- }
|
|
|
-
|
|
|
- @NotNull
|
|
|
- private OrderInstall getOrderInstall(ItfTblAzAssignLcLsDownload item,Long sxlxid) {
|
|
|
- OrderInstall rec = new OrderInstall();
|
|
|
- String workerOrderNo = UUID.randomUUID().toString();
|
|
|
-
|
|
|
- // shopno: 销售网点编号 88888888为分销商城特殊单号 todo
|
|
|
- if (item.getShopno().equals("88888888")){
|
|
|
- ItfFxInstallReq itfFxInstallReq = itfFxInstallReqService.lambdaQuery().eq(ItfFxInstallReq::getPgguid,item.getPgguid()).one();
|
|
|
- if (itfFxInstallReq ==null || StringUtils.isEmpty(itfFxInstallReq.getWorkerOrderNo())){
|
|
|
- log.info("分销商城订单生成失败,工单号为空:{}",item.getPgguid());
|
|
|
- return null;
|
|
|
- }
|
|
|
- workerOrderNo = itfFxInstallReq.getWorkerOrderNo();
|
|
|
- }
|
|
|
-
|
|
|
- rec.setWorkerOrderNo(workerOrderNo);
|
|
|
- rec.setUploadNotifyFlag(0);
|
|
|
- rec.setLastUpdSynReqId(String.valueOf(item.getSynReqId()));
|
|
|
- rec.setLastUpdSynTime(new Date());
|
|
|
- // 所属公司编号Id belongCompanyId,belongCompany
|
|
|
- getBelongCompany(item, rec);
|
|
|
- // 销售网点id
|
|
|
- setSalesWid(item, rec);
|
|
|
-
|
|
|
- if (BeanUtil.isNotEmpty(item.getXsdwno())){
|
|
|
- rec.setSalesNumber(item.getXsdwno());
|
|
|
- }
|
|
|
- if (BeanUtil.isNotEmpty(item.getXswdmc())){
|
|
|
- rec.setSalesWname(item.getXswdmc());
|
|
|
- }
|
|
|
- if (BeanUtil.isNotEmpty(item.getXsdwxtbh())){
|
|
|
- rec.setSalesXtbh(item.getXsdwxtbh());
|
|
|
- }
|
|
|
- // 接收派工网点id
|
|
|
- setAfterWid(item, rec);
|
|
|
- if (BeanUtil.isNotEmpty(item.getJspgwdno())){
|
|
|
- rec.setAfterNumber(item.getJspgwdno());
|
|
|
- }
|
|
|
- if (BeanUtil.isNotEmpty(item.getJspgwdmc())){
|
|
|
- rec.setAfterWname(item.getJspgwdmc());
|
|
|
- }
|
|
|
- if (BeanUtil.isNotEmpty(item.getJspgwdxtbh())){
|
|
|
- rec.setAfterXtbh(item.getJspgwdxtbh());
|
|
|
- }
|
|
|
-
|
|
|
- rec.setAfterTime(item.getJspgwdsj());
|
|
|
- // 创建工单的网点
|
|
|
- setCreateWid(item, rec);
|
|
|
-
|
|
|
- rec.setCreatedUserNumber(item.getCjren());
|
|
|
- rec.setCreatedRealName(item.getCjrmc());
|
|
|
- rec.setSalesOrderNo(item.getXsdh());
|
|
|
- rec.setUserPhone(item.getYddh());
|
|
|
- rec.setUserName(item.getYhmc());
|
|
|
- rec.setMachineNum(item.getAzsl());
|
|
|
- rec.setPgguid(item.getPgguid());
|
|
|
- rec.setPgid(item.getPgid());
|
|
|
-
|
|
|
- rec.setIsReservation("0");
|
|
|
- if (item.getDqjd().equals(1100) || item.getDqjd().equals(1122) || item.getDqjd().equals(1130)){
|
|
|
- rec.setIsReservation("1");
|
|
|
- }
|
|
|
-
|
|
|
- rec.setAfterNumber("");
|
|
|
- if (!StringUtils.isEmpty(item.getJspgwdno())){
|
|
|
- rec.setAfterNumber(item.getJspgwdno());
|
|
|
- }
|
|
|
-
|
|
|
- rec.setOrderState(getDqjd(item));
|
|
|
- rec.setAppointState(getDqjd(item));
|
|
|
- if (StringUtils.isEmpty(item.getYhsxid())){
|
|
|
- rec.setUserTypeId(1);
|
|
|
- } else {
|
|
|
- if (item.getYhsxid().equals(0L)){
|
|
|
- rec.setUserTypeId(1);
|
|
|
- } else {
|
|
|
- rec.setUserTypeId(Integer.valueOf(item.getYhsxid().toString()));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 增加参数 todo
|
|
|
- rec.setSalesTypeId(Integer.valueOf(sxlxid.toString()));
|
|
|
-
|
|
|
-
|
|
|
- // 接收派工网点是否为中心,且下传的当前节点是不是1129或1301,如果是就更新为2待分部派工
|
|
|
- if ((item.getJspgwdno().equals("S9219801") || item.getJspgwdno().equals("S9219807"))
|
|
|
- && (item.getDqjd().equals(1129) || item.getDqjd().equals(1301))){
|
|
|
- rec.setOrderState(2);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return rec;
|
|
|
- }
|
|
|
-
|
|
|
- private void setCreateWid(ItfTblAzAssignLcLsDownload item, OrderInstall rec) {
|
|
|
- QueryWrapper<BrandWebsit> paytypeServiceQueryWrapper = new QueryWrapper<BrandWebsit>()
|
|
|
- .select("brand_websit_id")
|
|
|
- .eq("brand_websit_number", item.getCjwdno())
|
|
|
- .and(v -> v.eq("type",InterFaceTypeEnum.XS_WEBSIT_TYPE.getCode())
|
|
|
- .or()
|
|
|
- .eq("type", InterFaceTypeEnum.SH_WEBSIT_TYPE.getCode())
|
|
|
- .ne("brand_websit_number", "99999999"));
|
|
|
- List<BrandWebsit> brandWebsits = brandWebsitService.list(paytypeServiceQueryWrapper);
|
|
|
- if (brandWebsits !=null || brandWebsits.size()>0){
|
|
|
- if (BeanUtil.isNotEmpty(brandWebsits.get(0).getBrandWebsitId())){
|
|
|
- rec.setCreateWid(brandWebsits.get(0).getBrandWebsitId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void setAfterWid(ItfTblAzAssignLcLsDownload item, OrderInstall rec) {
|
|
|
- BrandWebsit oldWebsitRec = brandWebsitService.lambdaQuery()
|
|
|
- .eq(BrandWebsit::getBrandWebsitNumber, item.getJspgwdno()).one();
|
|
|
- if (oldWebsitRec !=null){
|
|
|
- if (BeanUtil.isNotEmpty(oldWebsitRec.getBrandWebsitId())){
|
|
|
- rec.setAfterWid(oldWebsitRec.getBrandWebsitId());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void setSalesWid(ItfTblAzAssignLcLsDownload item, OrderInstall rec) {
|
|
|
- BrandWebsit oldWebsitRec = brandWebsitService.lambdaQuery()
|
|
|
- .eq(BrandWebsit::getBrandWebsitNumber, item.getXsdwno())
|
|
|
- .eq(BrandWebsit::getType, InterFaceTypeEnum.XS_WEBSIT_TYPE.getCode())
|
|
|
- .one();
|
|
|
- if (oldWebsitRec !=null){
|
|
|
- if (BeanUtil.isNotEmpty(oldWebsitRec.getBrandWebsitId())){
|
|
|
- rec.setSalesWid(oldWebsitRec.getBrandWebsitId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void getBelongCompany(ItfTblAzAssignLcLsDownload item, OrderInstall rec) {
|
|
|
- BrandWebsit oldWebsitRec = brandWebsitService.lambdaQuery()
|
|
|
- .eq(BrandWebsit::getBrandWebsitNumber, item.getJspgwdno()).one();
|
|
|
- if (oldWebsitRec !=null){
|
|
|
- if (BeanUtil.isNotEmpty(oldWebsitRec.getBelongCompanyId())){
|
|
|
- rec.setBelongCompanyId(oldWebsitRec.getBelongCompanyId());
|
|
|
- }
|
|
|
- if (BeanUtil.isNotEmpty(oldWebsitRec.getBelongCompany())){
|
|
|
- rec.setBelongCompany(oldWebsitRec.getBelongCompany());
|
|
|
- }
|
|
|
- } else {
|
|
|
- rec.setBelongCompanyId(0);
|
|
|
- rec.setBelongCompany("0");
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
- @NotNull
|
|
|
- private Integer getDqjd(ItfTblAzAssignLcLsDownload item) {
|
|
|
- Integer dqjd;
|
|
|
- if (item.getDqjd() == 1100) {
|
|
|
- dqjd = 1;
|
|
|
- } else if (item.getDqjd() == 1101) {
|
|
|
- dqjd = 1;
|
|
|
- } else if (item.getDqjd() == 1121) {
|
|
|
- dqjd = 2;
|
|
|
- } else if (item.getDqjd() == 1122) {
|
|
|
- dqjd = 2;
|
|
|
- } else if (item.getDqjd() == 1125) {
|
|
|
- dqjd = 3;
|
|
|
- } else if (item.getDqjd() == 1129) {
|
|
|
- dqjd = 4;
|
|
|
- } else if (item.getDqjd() == 1130) {
|
|
|
- dqjd = 4;
|
|
|
- } else if (item.getDqjd() == 1135) {
|
|
|
- dqjd = 5;
|
|
|
- } else if (item.getDqjd() == 1301) {
|
|
|
- dqjd = 6;
|
|
|
- } else if (item.getDqjd() == 1304) {
|
|
|
- dqjd = 7;
|
|
|
- } else if (item.getDqjd() == 1306) {
|
|
|
- dqjd = 7;
|
|
|
- } else if (item.getDqjd() == 1307) {
|
|
|
- dqjd = 8;
|
|
|
- } else if (item.getDqjd() == 1308) {
|
|
|
- dqjd = 9;
|
|
|
- } else if (item.getDqjd() == 1309) {
|
|
|
- dqjd = 10;
|
|
|
- } else {
|
|
|
- dqjd = 1;
|
|
|
- }
|
|
|
- return dqjd;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 与总部进行状态同步下次获取时不再拉取数据
|
|
|
- private void updateStatus() {
|
|
|
- try {
|
|
|
- List<ItfInstallBatchDownloadRec> recs = new ArrayList<>();
|
|
|
- // greeStatSynStatus:总部同步标志是否已成功更新 0=否 1=是 99=其他
|
|
|
- recs = itfInstallBatchDownloadRecService.lambdaQuery()
|
|
|
- .eq(ItfInstallBatchDownloadRec::getGreeStatSynStatus,0)
|
|
|
- .or()
|
|
|
- .eq(ItfInstallBatchDownloadRec::getGreeStatSynStatus,99)
|
|
|
- .le(ItfInstallBatchDownloadRec::getSynTimes,5)
|
|
|
- .list();
|
|
|
- if (recs.size()>0){
|
|
|
- log.info("需要与总部同步安装工单下载状态记录数: {}",recs.size());
|
|
|
- Token token = tokenCenter.getCurrentToken();
|
|
|
- String url = baseurl + "tblAzAssignLcLs" + "/updateExtendfiled5";
|
|
|
- for (ItfInstallBatchDownloadRec item :recs){
|
|
|
- log.info("与总部同步下装状态的派工单号: {}",item.getPgid());
|
|
|
- String pgguid = item.getPgguid();
|
|
|
- Date lastModifiedDate = item.getLastModifiedDate();
|
|
|
- Map<String, Object> paramMap = new HashMap<String, Object>();
|
|
|
- paramMap.put("pgguid", pgguid);
|
|
|
- paramMap.put("lastModifiedDate", lastModifiedDate);
|
|
|
- JSONResult jsonResult = HttpUtil.httpRequestWithToken(url, "POST",
|
|
|
- JSON.toJSONStringWithDateFormat(paramMap, "yyyy-MM-dd HH:mm:ss"), token);
|
|
|
- // 与总部进行状态同步
|
|
|
- syncStatus(item, jsonResult);
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("与总部同步安装工单下载状态完成");
|
|
|
- } catch (Exception ex) {
|
|
|
- log.error("与总部同步更新安装工单下载状态失败", ex);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void syncStatus(ItfInstallBatchDownloadRec item, JSONResult jsonResult) {
|
|
|
- ItfInstallBatchDownloadRec update = new ItfInstallBatchDownloadRec();
|
|
|
- update.setSynReqId(item.getSynReqId());
|
|
|
- update.setGreeStatSynTime(new Date());
|
|
|
- update.setSynTimes(item.getSynTimes()+1);
|
|
|
-
|
|
|
- if (jsonResult.isOK()) {
|
|
|
- update.setGreeStatSynStatus(1);
|
|
|
- } else {
|
|
|
- update.setGreeStatSynStatus(99);
|
|
|
- update.setGreeStatSynErrMsg(jsonResult.getMsg());
|
|
|
- }
|
|
|
- itfInstallBatchDownloadRecService.updateById(update);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public void downloadAdd(List<ItfInstallBatchDownloadRec> rec, List<ItfTblAzAssignLcLsDownload> lcls, List<ItfTblAzAssignMxDownload> mx, List<ItfTblAzAssignFkmxDownload> fk, List<ItfTblAzAssignFeeDownload> fe, List<ItfTblAzAssignAppointmentDownload> app, List<ItfTblAzAssignLcFzryDownload> fz, List<ItfTblAzAssignSatisfactionDownload> sa, List<ItfTblAzAssignPlatformDownload> pla) {
|
|
|
- if (rec.size()>0){
|
|
|
- itfInstallBatchDownloadRecService.saveBatch(rec);
|
|
|
- }
|
|
|
- if (lcls.size()>0){
|
|
|
- itfTblAzAssignLcLsDownloadService.saveBatch(lcls);
|
|
|
- }
|
|
|
- if (mx.size()>0){
|
|
|
- itfTblAzAssignMxDownloadService.saveBatch(mx);
|
|
|
- }
|
|
|
- if (fk.size()>0){
|
|
|
- itfTblAzAssignFkMxDownloadService.saveBatch(fk);
|
|
|
- }
|
|
|
- if (fe.size()>0){
|
|
|
- itfTblAzAssignFeeDownloadService.saveBatch(fe);
|
|
|
- }
|
|
|
- if (app.size()>0){
|
|
|
- itfTblAzAssignAppointmentDownloadService.saveBatch(app);
|
|
|
- }
|
|
|
- if (fz.size()>0){
|
|
|
- itfTblAzAssignLcFzryDownloadService.saveBatch(fz);
|
|
|
- }
|
|
|
- if (sa.size()>0){
|
|
|
- itfTblAzAssignSatisfactionDownloadService.saveBatch(sa);
|
|
|
- }
|
|
|
- if (pla.size()>0){
|
|
|
- itfTblAzAssignPlatformDownloadService.saveBatch(pla);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void putLogInfo(JSONArray datas) {
|
|
|
- StringBuffer str = new StringBuffer();
|
|
|
- str.append("安装工单下载数据日志销售单号-派工单号:【");
|
|
|
- for (int i = 0; i < datas.size(); i++) {
|
|
|
- JSONObject sheet = datas.getJSONObject(i);
|
|
|
- // 提取主表数据
|
|
|
- JSONArray mainTableData = sheet.getJSONArray("TBL_AZ_ASSIGN_LC_LS");
|
|
|
- if (mainTableData != null && mainTableData.size() > 0) {
|
|
|
- JSONArray tableData = new JSONArray();
|
|
|
- tableData = sheet.getJSONArray(ESInstallEnum.TBL_AZ_ASSIGN_LC_LS.getCode());
|
|
|
- for (int j = 0; j < tableData.size(); j++) {
|
|
|
- // 生成安装工单主表对象
|
|
|
- ItfTblAzAssignLcLsDownload item = JSON.toJavaObject(tableData.getJSONObject(j),ItfTblAzAssignLcLsDownload.class);
|
|
|
- str.append("("+item.getXsdh()+"-"+ item.getPgid()+")");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- str.append("】");
|
|
|
- log.info(str.toString());
|
|
|
- }
|
|
|
-
|
|
|
- public void parseData(JSONObject sheet, String downloadTaskNo, String downloadBatchNo, List<ItfInstallBatchDownloadRec> rec) throws Exception {
|
|
|
- List<ItfTblAzAssignLcLsDownload> lcls = new ArrayList<>();
|
|
|
- List<ItfTblAzAssignMxDownload> mx = new ArrayList<>();
|
|
|
- List<ItfTblAzAssignFkmxDownload> fk = new ArrayList<>();
|
|
|
- List<ItfTblAzAssignFeeDownload> fe = new ArrayList<>();
|
|
|
- List<ItfTblAzAssignAppointmentDownload> app = new ArrayList<>();
|
|
|
- List<ItfTblAzAssignLcFzryDownload> fz = new ArrayList<>();
|
|
|
- List<ItfTblAzAssignSatisfactionDownload> sa = new ArrayList<>();
|
|
|
- List<ItfTblAzAssignPlatformDownload> pla = new ArrayList<>();
|
|
|
-
|
|
|
- try {
|
|
|
- // 获取报文对应数据信息
|
|
|
- getDataInfo(sheet, downloadTaskNo, downloadBatchNo, lcls, mx, fk, fe, app, fz, sa, pla);
|
|
|
-
|
|
|
- // 打印预落表安装工单信息方便查询出错的订单信息
|
|
|
- logAZGDInfo(lcls);
|
|
|
-
|
|
|
- // 数据同步落到同步信息表 事务处理
|
|
|
- downloadAdd(rec, lcls, mx, fk, fe, app, fz, sa, pla);
|
|
|
-
|
|
|
- log.info("落表成功");
|
|
|
-
|
|
|
- } catch (Exception ex) {
|
|
|
- log.error("安装工单落表失败:{}", ex);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void logAZGDInfo(List<ItfTblAzAssignLcLsDownload> lcls) {
|
|
|
- StringBuffer str = new StringBuffer();
|
|
|
- str.append("预落表安装工单信息销售单号-派工单号:【");
|
|
|
- if (lcls.size()>0){
|
|
|
- for (ItfTblAzAssignLcLsDownload item : lcls){
|
|
|
- str.append("("+item.getXsdh()+"-"+ item.getPgid()+")");
|
|
|
- }
|
|
|
- str.append("】");
|
|
|
- log.info(str.toString());
|
|
|
-
|
|
|
- for (ItfTblAzAssignLcLsDownload item : lcls){
|
|
|
- log.info("item: {}",item);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void getDataInfo(JSONObject sheet, String downloadTaskNo, String downloadBatchNo, List<ItfTblAzAssignLcLsDownload> lcls, List<ItfTblAzAssignMxDownload> mx, List<ItfTblAzAssignFkmxDownload> fk, List<ItfTblAzAssignFeeDownload> fe, List<ItfTblAzAssignAppointmentDownload> app, List<ItfTblAzAssignLcFzryDownload> fz, List<ItfTblAzAssignSatisfactionDownload> sa, List<ItfTblAzAssignPlatformDownload> pla) throws Exception {
|
|
|
- JSONArray tableData = new JSONArray();
|
|
|
- // 报文中提取安装工单主表数据 itf_tbl_az_assign_lc_ls_download
|
|
|
- tableData = sheet.getJSONArray(ESInstallEnum.TBL_AZ_ASSIGN_LC_LS.getCode());
|
|
|
- for (int j = 0; j < tableData.size(); j++) {
|
|
|
- // 生成安装工单主表对象
|
|
|
- parseTblAzAssignLcLsData(downloadBatchNo, downloadTaskNo, tableData.getJSONObject(j), lcls);
|
|
|
- }
|
|
|
-
|
|
|
- // 安装工单明细表 itf_tbl_az_assign_lc_ls_download
|
|
|
- tableData = sheet.getJSONArray(ESInstallEnum.TBL_AZ_ASSIGN_MX.getCode());
|
|
|
- for (int j = 0; j < tableData.size(); j++) {
|
|
|
- // 生成安装工单明细主表对象
|
|
|
- parseTblAzAssignMxData(downloadBatchNo, downloadTaskNo, tableData.getJSONObject(j), mx);
|
|
|
- }
|
|
|
- // 安装反馈明细表 itf_tbl_az_assign_fkmx_download
|
|
|
- tableData = sheet.getJSONArray(ESInstallEnum.TBL_AZ_ASSIGN_FKMX.getCode());
|
|
|
- for (int j = 0; j < tableData.size(); j++) {
|
|
|
- // 生成安装反馈明细表对象
|
|
|
- parseTblAzAssignFkMXData(downloadBatchNo, downloadTaskNo, tableData.getJSONObject(j), fk);
|
|
|
- }
|
|
|
- // 安装费用清单表 itf_tbl_az_assign_fee_download
|
|
|
- tableData = sheet.getJSONArray(ESInstallEnum.TBL_AZ_ASSIGN_FEE.getCode());
|
|
|
- for (int j = 0; j < tableData.size(); j++) {
|
|
|
- // 生成安装费用清单表对象
|
|
|
- parseTblAzAssignFeeData(downloadBatchNo, downloadTaskNo, tableData.getJSONObject(j), fe);
|
|
|
- }
|
|
|
- // 用户预约改约表 itf_tbl_az_assign_appointment_download
|
|
|
- tableData = sheet.getJSONArray(ESInstallEnum.TBL_AZ_ASSIGN_APPOINTMENT.getCode());
|
|
|
- for (int j = 0; j < tableData.size(); j++) {
|
|
|
- // 生成用户预约改约表对象
|
|
|
- parseTblAzAssignAppointmentData(downloadBatchNo, downloadTaskNo, tableData.getJSONObject(j), app);
|
|
|
- }
|
|
|
- // 安装辅助人员表 itf_tbl_az_assign_lc_fzry_download
|
|
|
- tableData = sheet.getJSONArray(ESInstallEnum.TBL_AZ_ASSIGN_LC_FZRY.getCode());
|
|
|
- for (int j = 0; j < tableData.size(); j++) {
|
|
|
- // 生成安装辅助人员表对象
|
|
|
- parseTblAzAssignLcFzryData(downloadBatchNo, downloadTaskNo, tableData.getJSONObject(j), fz);
|
|
|
- }
|
|
|
- // 客户评价表 itf_tbl_az_assign_satisfaction_download
|
|
|
- tableData = sheet.getJSONArray(ESInstallEnum.TBL_AZ_ASSIGN_SATISFACTION.getCode());
|
|
|
- for (int j = 0; j < tableData.size(); j++) {
|
|
|
- // 生成客户评价表对象
|
|
|
- parseTblAzAssignSatisfactionData(downloadBatchNo, downloadTaskNo, tableData.getJSONObject(j) , sa);
|
|
|
- }
|
|
|
- // 第三方平台订单信息表 itf_tbl_az_assign_platform_download
|
|
|
- tableData = sheet.getJSONArray(ESInstallEnum.TBL_AZ_ASSIGN_PLATFORM.getCode());
|
|
|
- for (int j = 0; j < tableData.size(); j++) {
|
|
|
- // 生成第三方平台订单信息表对象
|
|
|
- parseTblAzAssignPlatformData(downloadBatchNo, downloadTaskNo, tableData.getJSONObject(j), pla);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // itf_tbl_az_assign_platform_download
|
|
|
- private void parseTblAzAssignPlatformData(String downloadBatchNo, String downloadTaskNo, JSONObject aData,
|
|
|
- List<ItfTblAzAssignPlatformDownload> pla) throws Exception {
|
|
|
- ItfTblAzAssignPlatformDownload item = JSON.toJavaObject(aData,ItfTblAzAssignPlatformDownload.class);
|
|
|
- item.setDownloadBatchNo(downloadBatchNo);
|
|
|
- item.setDownloadTaskNo(downloadTaskNo);
|
|
|
- pla.add(item);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- // itf_tbl_az_assign_satisfaction_download
|
|
|
- private void parseTblAzAssignSatisfactionData(String downloadBatchNo, String downloadTaskNo, JSONObject aData ,
|
|
|
- List<ItfTblAzAssignSatisfactionDownload> sa) throws Exception {
|
|
|
- ItfTblAzAssignSatisfactionDownload item = JSON.toJavaObject(aData,ItfTblAzAssignSatisfactionDownload.class);
|
|
|
- item.setDownloadBatchNo(downloadBatchNo);
|
|
|
- item.setDownloadTaskNo(downloadTaskNo);
|
|
|
- sa.add(item);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // itf_tbl_az_assign_lc_fzry_download
|
|
|
- private void parseTblAzAssignLcFzryData(String downloadBatchNo, String downloadTaskNo, JSONObject aData,
|
|
|
- List<ItfTblAzAssignLcFzryDownload> fz) throws Exception {
|
|
|
- ItfTblAzAssignLcFzryDownload item = JSON.toJavaObject(aData,ItfTblAzAssignLcFzryDownload.class);
|
|
|
- item.setDownloadBatchNo(downloadBatchNo);
|
|
|
- item.setDownloadTaskNo(downloadTaskNo);
|
|
|
- fz.add(item);
|
|
|
- }
|
|
|
-
|
|
|
- // itf_tbl_az_assign_appointment_download
|
|
|
- private void parseTblAzAssignAppointmentData(String downloadBatchNo, String downloadTaskNo, JSONObject aData,
|
|
|
- List<ItfTblAzAssignAppointmentDownload> app) throws Exception {
|
|
|
- ItfTblAzAssignAppointmentDownload item = JSON.toJavaObject(aData,ItfTblAzAssignAppointmentDownload.class);
|
|
|
- item.setDownloadBatchNo(downloadBatchNo);
|
|
|
- item.setDownloadTaskNo(downloadTaskNo);
|
|
|
- app.add(item);
|
|
|
- }
|
|
|
-
|
|
|
- // itf_tbl_az_assign_fkmx_download
|
|
|
- private void parseTblAzAssignFeeData(String downloadBatchNo, String downloadTaskNo, JSONObject aData,
|
|
|
- List<ItfTblAzAssignFeeDownload> fe) throws Exception {
|
|
|
- ItfTblAzAssignFeeDownload item = JSON.toJavaObject(aData,ItfTblAzAssignFeeDownload.class);
|
|
|
- item.setDownloadBatchNo(downloadBatchNo);
|
|
|
- item.setDownloadTaskNo(downloadTaskNo);
|
|
|
- fe.add(item);
|
|
|
- }
|
|
|
-
|
|
|
- // itf_tbl_az_assign_fkmx_download
|
|
|
- private void parseTblAzAssignFkMXData(String downloadBatchNo, String downloadTaskNo, JSONObject aData,
|
|
|
- List<ItfTblAzAssignFkmxDownload> fk) throws Exception {
|
|
|
- ItfTblAzAssignFkmxDownload item = JSON.toJavaObject(aData,ItfTblAzAssignFkmxDownload.class);
|
|
|
- item.setDownloadBatchNo(downloadBatchNo);
|
|
|
- item.setDownloadTaskNo(downloadTaskNo);
|
|
|
- fk.add(item);
|
|
|
- }
|
|
|
-
|
|
|
- // itf_tbl_az_assign_mx_download
|
|
|
- private void parseTblAzAssignMxData(String downloadBatchNo, String downloadTaskNo, JSONObject aData,
|
|
|
- List<ItfTblAzAssignMxDownload> mx) throws Exception {
|
|
|
- ItfTblAzAssignMxDownload item = JSON.toJavaObject(aData,ItfTblAzAssignMxDownload.class);
|
|
|
- item.setDownloadBatchNo(downloadBatchNo);
|
|
|
- item.setDownloadTaskNo(downloadTaskNo);
|
|
|
- mx.add(item);
|
|
|
- }
|
|
|
-
|
|
|
- // itf_tbl_az_assign_lc_ls_download
|
|
|
- private void parseTblAzAssignLcLsData(String downloadBatchNo, String downloadTaskNo, JSONObject aData, List<ItfTblAzAssignLcLsDownload> lcls) throws Exception {
|
|
|
- ItfTblAzAssignLcLsDownload item = JSON.toJavaObject(aData,ItfTblAzAssignLcLsDownload.class);
|
|
|
- item.setDownloadBatchNo(downloadBatchNo);
|
|
|
- item.setDownloadTaskNo(downloadTaskNo);
|
|
|
- lcls.add(item);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查看下载记录表有无数据
|
|
|
- * 无数据,插入一条记录
|
|
|
- * 有数据
|
|
|
- * 还未做处理时不做插入动作 总部同步标志是否已成功更新 0=否
|
|
|
- * 其他插一条数据,做单独说明
|
|
|
- */
|
|
|
- public boolean insertInstallRecData(JSONObject aData, String downloadBatchNo, String downloadTaskNo,
|
|
|
- List<ItfInstallBatchDownloadRec> rec, String salesWebsitNumber) throws Exception {
|
|
|
- List<ItfInstallBatchDownloadRec> oldRec = new ArrayList<>();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
-
|
|
|
- // 下载记录表查看数据 同一修改时间同一订单 itf_install_batch_download_rec
|
|
|
- oldRec = itfInstallBatchDownloadRecService.lambdaQuery()
|
|
|
- .eq(ItfInstallBatchDownloadRec::getPgguid,aData.getString("pgguid"))
|
|
|
- .eq(ItfInstallBatchDownloadRec::getLastModifiedDate,sdf.parse(aData.getString("lastModifiedDate")))
|
|
|
- .list();
|
|
|
- boolean duplicate = (oldRec.size() > 0);
|
|
|
- // 下载记录表中存在数据
|
|
|
- if (duplicate) {
|
|
|
- // 相同修改时间、相同订单存在待同步的数据,不再插入
|
|
|
- if (!recHasNoUploadStatus(oldRec)) {
|
|
|
- // 数据处理失败的 插一条新数据再次同步并做说明
|
|
|
- ItfInstallBatchDownloadRec item = getItfInstallBatchDownloadRec(Boolean.TRUE,aData, downloadBatchNo, downloadTaskNo, salesWebsitNumber);
|
|
|
- rec.add(item);
|
|
|
- }
|
|
|
- return Boolean.FALSE;
|
|
|
- } else {
|
|
|
- // 无数据插入新记录 生成对象
|
|
|
- ItfInstallBatchDownloadRec item = getItfInstallBatchDownloadRec(Boolean.FALSE,aData, downloadBatchNo, downloadTaskNo, salesWebsitNumber);
|
|
|
- rec.add(item);
|
|
|
- return Boolean.TRUE;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @NotNull
|
|
|
- private ItfInstallBatchDownloadRec getItfInstallBatchDownloadRec(Boolean flag, JSONObject aData, String downloadBatchNo, String downloadTaskNo, String salesWebsitNumber) {
|
|
|
- ItfInstallBatchDownloadRec item = new ItfInstallBatchDownloadRec();
|
|
|
- item.setSalesWebsitNumber(salesWebsitNumber);
|
|
|
- item.setDownloadBatchNo(downloadBatchNo);
|
|
|
- item.setDownloadTaskNo(downloadTaskNo);
|
|
|
- item.setPgguid(aData.getString("pgguid"));
|
|
|
- item.setCreatedBy(aData.getString("createdBy"));
|
|
|
- item.setCreatedDate(aData.getDate("createdDate"));
|
|
|
- item.setLastModifiedBy(aData.getString("lastModifiedBy"));
|
|
|
- item.setLastModifiedDate(aData.getDate("lastModifiedDate"));
|
|
|
- item.setPgid(aData.getString("pgid"));
|
|
|
- item.setExtendfiled1(aData.getString("extendfiled1"));
|
|
|
- item.setExtendfiled2(aData.getString("extendfiled2"));
|
|
|
- item.setExtendfiled3(aData.getString("extendfiled3"));
|
|
|
- item.setExtendfiled4(aData.getString("extendfiled4"));
|
|
|
- item.setExtendfiled5(aData.getString("extendfiled5"));
|
|
|
- if (flag){
|
|
|
- item.setGreeStatSynErrMsg("任务已经存在,不再产生下载数据");
|
|
|
- }
|
|
|
- return item;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private boolean recHasNoUploadStatus(List<ItfInstallBatchDownloadRec> rec) {
|
|
|
- for (ItfInstallBatchDownloadRec data: rec){
|
|
|
- if (data.getGreeStatSynStatus() == 0){
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- private JSONArray getDownloadData(String downloadBatchNo, String salesWebsitNumber) throws Exception {
|
|
|
-
|
|
|
- Token token = tokenCenter.getCurrentToken();
|
|
|
- String url = baseurl + "api/install/search/batch?ssxsgs=" + salesWebsitNumber;
|
|
|
- // log.info("url[" + url + "],downloadBatchNo[" + downloadBatchNo + "],send[]");
|
|
|
- JSONObject jsonResult = HttpUtil.httpRequestGetPgid(url, "GET", token, downloadBatchNo, null);
|
|
|
- String statusCode = jsonResult.getString("statusCode");
|
|
|
- if ("200".equals(statusCode)) {
|
|
|
- JSONArray datas = jsonResult.getJSONArray("data");
|
|
|
- return datas;
|
|
|
- } else {
|
|
|
- String errorMessage = jsonResult.getString("message");
|
|
|
- if (errorMessage == null || errorMessage.trim().length() == 0) {
|
|
|
- errorMessage = "失败";
|
|
|
- }
|
|
|
- log.info(errorMessage);
|
|
|
- throw new Exception(errorMessage);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
}
|