|
@@ -6,7 +6,12 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.zfire.jiasm.syncdata.base.BaseService;
|
|
import com.zfire.jiasm.syncdata.base.BaseService;
|
|
|
|
|
+import com.zfire.jiasm.syncdata.constant.DictTypeEnum;
|
|
|
import com.zfire.jiasm.syncdata.constant.ESInstallEnum;
|
|
import com.zfire.jiasm.syncdata.constant.ESInstallEnum;
|
|
|
|
|
+import com.zfire.jiasm.syncdata.constant.OrderStatusEnum;
|
|
|
|
|
+import com.zfire.jiasm.syncdata.constant.OrderTypeEnum;
|
|
|
|
|
+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.dao.mapper.AzGDLcLsDownloadMapper;
|
|
|
import com.zfire.jiasm.syncdata.data.Token;
|
|
import com.zfire.jiasm.syncdata.data.Token;
|
|
|
import com.zfire.jiasm.syncdata.parameter.OrderPar;
|
|
import com.zfire.jiasm.syncdata.parameter.OrderPar;
|
|
@@ -52,14 +57,8 @@ public class AnzhuangGongDanBusiness {
|
|
|
@Resource
|
|
@Resource
|
|
|
ItfTblAzAssignFkmxDownloadService itfTblAzAssignFkMxDownloadService;
|
|
ItfTblAzAssignFkmxDownloadService itfTblAzAssignFkMxDownloadService;
|
|
|
@Resource
|
|
@Resource
|
|
|
- ItfTblAzAssignFeeDownloadService itfTblAzAssignFeeDownloadService;
|
|
|
|
|
- @Resource
|
|
|
|
|
- ItfTblAzAssignAppointmentDownloadService itfTblAzAssignAppointmentDownloadService;
|
|
|
|
|
- @Resource
|
|
|
|
|
ItfTblAzAssignLcFzryDownloadService itfTblAzAssignLcFzryDownloadService;
|
|
ItfTblAzAssignLcFzryDownloadService itfTblAzAssignLcFzryDownloadService;
|
|
|
@Resource
|
|
@Resource
|
|
|
- ItfTblAzAssignSatisfactionDownloadService itfTblAzAssignSatisfactionDownloadService;
|
|
|
|
|
- @Resource
|
|
|
|
|
ItfTblAzAssignPlatformDownloadService itfTblAzAssignPlatformDownloadService;
|
|
ItfTblAzAssignPlatformDownloadService itfTblAzAssignPlatformDownloadService;
|
|
|
@Resource
|
|
@Resource
|
|
|
AzGDLcLsDownloadMapper azGDLcLsDownloadMapper;
|
|
AzGDLcLsDownloadMapper azGDLcLsDownloadMapper;
|
|
@@ -79,6 +78,33 @@ public class AnzhuangGongDanBusiness {
|
|
|
OrderBaseService orderBaseService;
|
|
OrderBaseService orderBaseService;
|
|
|
@Resource
|
|
@Resource
|
|
|
OrderWorkerService orderWorkerService;
|
|
OrderWorkerService orderWorkerService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ SysDictRefService sysDictRefService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ OrderProductService orderProductService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ ItfTblAzAssignFkmxDownloadService itfTblAzAssignFkmxDownloadService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ OrderInstallOperatingLogService orderInstallOperatingLogService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ AzGDFkMxDownloadMapper azGDFkMxDownloadMapper;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ ItfTblAzAssignFeeDownloadService itfTblAzAssignFeeDownloadService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ AzGDFYQDDownloadMapper azGDFYQDDownloadMapper;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ OrderInstallService orderInstallService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ ItfTblAzAssignAppointmentDownloadService itfTblAzAssignAppointmentDownloadService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ OrderAppointmentService orderAppointmentService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ ItfTblAzAssignSatisfactionDownloadService itfTblAzAssignSatisfactionDownloadService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ WebsitService websitService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ OrderAppraiseService orderAppraiseService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -95,20 +121,34 @@ public class AnzhuangGongDanBusiness {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
List<ItfTblAzAssignLcLsDownload> lcls = new ArrayList<>();
|
|
List<ItfTblAzAssignLcLsDownload> lcls = new ArrayList<>();
|
|
|
List<String> lclslist = new ArrayList<>();
|
|
List<String> lclslist = new ArrayList<>();
|
|
|
- OrderBase orderBase = new OrderBase();
|
|
|
|
|
- OrderWorker orderWorker = new OrderWorker();
|
|
|
|
|
- List<ItfTblAzAssignMxDownload> orderMx = new ArrayList<>();
|
|
|
|
|
List<OrderBase> orderBasesRecs = new ArrayList<>();
|
|
List<OrderBase> orderBasesRecs = new ArrayList<>();
|
|
|
List<String> orderBaselist = new ArrayList<>();
|
|
List<String> orderBaselist = new ArrayList<>();
|
|
|
- List<OrderProduct> orderProducts = new ArrayList<>();
|
|
|
|
|
|
|
+ Map<String, List<SysDictRef>> sysDictRefDLMap = new HashMap<>();
|
|
|
|
|
+ Map<String, List<SysDictRef>> sysDictRefXLMap = new HashMap<>();
|
|
|
|
|
+ Map<String, List<SysDictRef>> sysDictRefXiLieMap = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
+ // 提取品牌信息
|
|
|
|
|
+ Brand brand = baseService.getBrand();
|
|
|
|
|
+ if (brand == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 提取品牌商对应的大类信息
|
|
|
|
|
+ sysDictRefDLMap = getStringListMap(brand);
|
|
|
|
|
+ // 提取品牌商对应的小类信息
|
|
|
|
|
+ sysDictRefXLMap = getListMap(brand);
|
|
|
|
|
+ // 提取品牌商对应的系列信息
|
|
|
|
|
+ sysDictRefXiLieMap = getMap(brand);
|
|
|
|
|
|
|
|
log.info("安装工单落本地表开始处理: {}",sdf.format(new Date()));
|
|
log.info("安装工单落本地表开始处理: {}",sdf.format(new Date()));
|
|
|
|
|
|
|
|
// 提取待落本地表的数据
|
|
// 提取待落本地表的数据
|
|
|
lcls = itfTblAzAssignLcLsDownloadService.lambdaQuery()
|
|
lcls = itfTblAzAssignLcLsDownloadService.lambdaQuery()
|
|
|
.eq(ItfTblAzAssignLcLsDownload::getSynStatus,0)
|
|
.eq(ItfTblAzAssignLcLsDownload::getSynStatus,0)
|
|
|
|
|
+ .orderByAsc(ItfTblAzAssignLcLsDownload::getSynReqId)
|
|
|
.list();
|
|
.list();
|
|
|
|
|
+
|
|
|
lclslist = lcls.stream().map(ItfTblAzAssignLcLsDownload::getPgguid).collect(Collectors.toList());
|
|
lclslist = lcls.stream().map(ItfTblAzAssignLcLsDownload::getPgguid).collect(Collectors.toList());
|
|
|
|
|
|
|
|
// 提取已有的订单数据
|
|
// 提取已有的订单数据
|
|
@@ -118,53 +158,373 @@ public class AnzhuangGongDanBusiness {
|
|
|
orderBaselist = orderBasesRecs.stream().map(OrderBase::getPgguid).collect(Collectors.toList());
|
|
orderBaselist = orderBasesRecs.stream().map(OrderBase::getPgguid).collect(Collectors.toList());
|
|
|
|
|
|
|
|
// 按单处理 这里是直接生成新单到本地表,并没判断是否已存在,
|
|
// 按单处理 这里是直接生成新单到本地表,并没判断是否已存在,
|
|
|
|
|
+ // 按任务号download_task_no,按单来处理
|
|
|
for (ItfTblAzAssignLcLsDownload item: lcls) {
|
|
for (ItfTblAzAssignLcLsDownload item: lcls) {
|
|
|
- if (orderBaselist.contains(item.getPgguid())){
|
|
|
|
|
- // 修改
|
|
|
|
|
- } else {
|
|
|
|
|
- // 新增
|
|
|
|
|
|
|
+ if (!item.getSynReqId().equals(194L)){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 处理安装工单主表
|
|
|
|
|
- orderBase = getOrderBase(item);
|
|
|
|
|
- // 处理师傅
|
|
|
|
|
- orderWorker = getOrderWorker(orderBase);
|
|
|
|
|
|
|
+ try{
|
|
|
|
|
+ if (orderBaselist.contains(item.getPgguid())){
|
|
|
|
|
+ // 修改
|
|
|
|
|
+
|
|
|
|
|
+ // 提取本地订单
|
|
|
|
|
+ OrderBase old = orderBaseService.lambdaQuery()
|
|
|
|
|
+ .eq(OrderBase::getPgguid,item.getPgguid())
|
|
|
|
|
+ .one();
|
|
|
|
|
+ if (old.getOrderType().equals(OrderTypeEnum.ORDER_TYPE_INSTALL.getCode())){
|
|
|
|
|
+ // 本地订单已关闭 且总部的最后修改时间晚于本地数据修改时间 不可修改
|
|
|
|
|
+ if (old.getOrderStatus().equals(OrderStatusEnum.INSTALL_STATUS_A1309.getCode()) &&
|
|
|
|
|
+ item.getLastModifiedDate().compareTo(old.getUpdateTime())<0){
|
|
|
|
|
+ ItfTblAzAssignLcLsDownload uplcls = new ItfTblAzAssignLcLsDownload();
|
|
|
|
|
+ uplcls.setSynReqId(item.getSynReqId());
|
|
|
|
|
+ uplcls.setSynStatus(99);
|
|
|
|
|
+ uplcls.setSynTime(new Date());
|
|
|
|
|
+ uplcls.setSynErrMsg("本地工单已关闭或作废忽略更新");
|
|
|
|
|
+ itfTblAzAssignLcLsDownloadService.updateById(uplcls);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 1.安装工单主表基础信息更新
|
|
|
|
|
+ if (item.getLastModifiedDate().compareTo(old.getUpdateTime())>0){
|
|
|
|
|
+ // 获取安装工单主表
|
|
|
|
|
+ OrderBase orderBase = getOrderBase(item, brand);
|
|
|
|
|
+ OrderBase upInfo = new OrderBase();
|
|
|
|
|
+ BeanUtils.copyProperties(orderBase,upInfo);
|
|
|
|
|
+
|
|
|
|
|
+ upInfo.setId(old.getId());
|
|
|
|
|
+ upInfo.setOutUpdateSynReqId(item.getSynReqId());
|
|
|
|
|
+ upInfo.setOutUpdateSynReqTime(new Date());
|
|
|
|
|
+ upInfo.setUpdateTime(new Date());
|
|
|
|
|
+
|
|
|
|
|
+ orderBaseService.updateById(upInfo);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 新增
|
|
|
|
|
+ orderAdd(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
|
+ ex.printStackTrace();
|
|
|
|
|
+ log.info("安装工单落本地表失败 销售单号-派工单号:【" + item.getXsdh() + "-"+ item.getPgid()+"】");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 处理工单机型
|
|
|
|
|
- orderMx = itfTblAzAssignMxDownloadService.lambdaQuery()
|
|
|
|
|
- .eq(ItfTblAzAssignMxDownload::getPgguid,orderBase.getPgguid())
|
|
|
|
|
- .list();
|
|
|
|
|
- // 生成对象
|
|
|
|
|
- for (ItfTblAzAssignMxDownload mx:orderMx){
|
|
|
|
|
- OrderProduct op = new OrderProduct();
|
|
|
|
|
- op.setOrderBaseId(orderBase.getId());
|
|
|
|
|
- op.setPgmxid(mx.getPgmxid());
|
|
|
|
|
- op.setPgguid(mx.getPgguid());
|
|
|
|
|
|
|
+ log.info("安装工单落本地表完成: {}",sdf.format(new Date()));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ private 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<>();
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 获取安装工单主表
|
|
|
|
|
+ OrderBase orderBase = getOrderBase(item, brand);
|
|
|
|
|
+ // 获取工单师傅信息
|
|
|
|
|
+ OrderWorker orderWorker = getOrderWorker(orderBase);
|
|
|
|
|
+ // 获取工单机型
|
|
|
|
|
+ getOrderProduct(orderBase, orderProducts, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, item.getDownloadTaskNo());
|
|
|
|
|
+ // 获取工单操作明细- 操作日志表
|
|
|
|
|
+ List<OrderInstallOperatingLog> oiolList = getOrderInstallOperatingLogs(orderBase, brand, item);
|
|
|
|
|
+ // 获取安装费用清单
|
|
|
|
|
+ OrderInstall orderInstall = getOrderInstall(orderBase, brand, item);
|
|
|
|
|
+ // 获取用户预约改约信息
|
|
|
|
|
+ getOrderAppointment(orderBase, oa, item);
|
|
|
|
|
+ // 获取用户客户评价信息
|
|
|
|
|
+ getOrderAppraise(orderBase, sysDictRefDLMap, oanew, brand, item);
|
|
|
|
|
+
|
|
|
|
|
+ // 安装工单数据落本地表
|
|
|
|
|
+ addOrderData(orderBase, orderWorker, orderInstall, orderProducts, oiolList, oa, oanew);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 工单基础表order_base,工单师傅表order_worker,工单机型表order_product,
|
|
|
|
|
+ * 操作明细表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) {
|
|
|
|
|
+ // 工单基础表
|
|
|
|
|
+ if (orderBase != null) {
|
|
|
|
|
+ orderBaseService.save(orderBase);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 工单师傅表
|
|
|
|
|
+ if (orderWorker != null) {
|
|
|
|
|
+ orderWorkerService.save(orderWorker);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 工单机型表
|
|
|
|
|
+ if (orderProducts.size()>0){
|
|
|
|
|
+ orderProductService.saveBatch(orderProducts);
|
|
|
|
|
+ orderProducts.clear();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 操作明细表
|
|
|
|
|
+ if (oiolList.size()>0){
|
|
|
|
|
+ orderInstallOperatingLogService.saveBatch(oiolList);
|
|
|
|
|
+ oiolList.clear();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 安装费用清单表
|
|
|
|
|
+ if (orderInstall != null){
|
|
|
|
|
+ orderInstallService.save(orderInstall);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ // 用户预约改约信息表
|
|
|
|
|
+ if (oa.size()>0){
|
|
|
|
|
+ orderAppointmentService.saveBatch(oa);
|
|
|
|
|
+ oa.clear();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 工单基础表
|
|
|
|
|
- if (orderBase != null) {
|
|
|
|
|
- orderBaseService.save(orderBase);
|
|
|
|
|
|
|
+ // 工单评价表
|
|
|
|
|
+ if (oanew.size()>0){
|
|
|
|
|
+ orderAppraiseService.saveBatch(oanew);
|
|
|
|
|
+ oanew.clear();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void getOrderAppraise(OrderBase orderBase, Map<String, List<SysDictRef>> sysDictRefDLMap, List<OrderAppraise> oanew, Brand brand, ItfTblAzAssignLcLsDownload item) {
|
|
|
|
|
+ List<ItfTblAzAssignSatisfactionDownload> sas;
|
|
|
|
|
+ sas = itfTblAzAssignSatisfactionDownloadService.lambdaQuery()
|
|
|
|
|
+ .eq(ItfTblAzAssignSatisfactionDownload::getDownloadTaskNo, item.getDownloadTaskNo())
|
|
|
|
|
+ .eq(ItfTblAzAssignSatisfactionDownload::getSynStatus,0)
|
|
|
|
|
+ .list();
|
|
|
|
|
+ for (ItfTblAzAssignSatisfactionDownload s :sas){
|
|
|
|
|
+ OrderAppraise o = new OrderAppraise();
|
|
|
|
|
+ o.setPgguid(s.getPgguid());
|
|
|
|
|
+ // 工单号
|
|
|
|
|
+ o.setOrderBaseId(orderBase.getId());
|
|
|
|
|
+ if (s.getPjly().equals("1")){
|
|
|
|
|
+ o.setAppraiseStatus("A");
|
|
|
|
|
+ } else if (s.getPjly().equals("2")){
|
|
|
|
|
+ o.setAppraiseStatus("B");
|
|
|
|
|
+ } else if (s.getPjly().equals("3")){
|
|
|
|
|
+ o.setAppraiseStatus("C");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ o.setAppraiseStatus("X");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 回访人id无
|
|
|
|
|
+ o.setRvisitNickName(s.getHfren());
|
|
|
|
|
+ // 回访人网点信息
|
|
|
|
|
+
|
|
|
|
|
+ // 先从售后网点查
|
|
|
|
|
+ CustomerInformationWebsit ciw = null;
|
|
|
|
|
+ WebsitOrderSign wos = websitOrderSignService.lambdaQuery()
|
|
|
|
|
+ .eq(WebsitOrderSign::getBrandWebsitId, s.getHfwdno())
|
|
|
|
|
+ .eq(WebsitOrderSign::getBrandId, brand.getBrandId())
|
|
|
|
|
+ .one();
|
|
|
|
|
+ if (wos !=null){
|
|
|
|
|
+ o.setRvisitWebsitId(wos.getWebsitId());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ciw = customerInformationWebsitService.lambdaQuery()
|
|
|
|
|
+ .eq(CustomerInformationWebsit::getRefWebsitId, s.getHfwdno())
|
|
|
|
|
+ .eq(CustomerInformationWebsit::getBrandId, brand.getBrandId())
|
|
|
|
|
+ .one();
|
|
|
|
|
+ if (ciw !=null){
|
|
|
|
|
+ o.setRvisitWebsitId(wos.getWebsitId());
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+ if (wos !=null || ciw !=null){
|
|
|
|
|
+ Websit websit = websitService.lambdaQuery()
|
|
|
|
|
+ .eq(Websit::getWebsitId,o.getRvisitWebsitId())
|
|
|
|
|
+ .one();
|
|
|
|
|
+ o.setRvisitWebsitName(websit.getWebsitName());
|
|
|
|
|
+ }
|
|
|
|
|
+ o.setRvisitTime(s.getHfsj());
|
|
|
|
|
+ o.setNegativeType(s.getBmylx());
|
|
|
|
|
+ o.setNegativeRemark(s.getBmybeiz());
|
|
|
|
|
+ o.setNegativeTime(s.getBmysj());
|
|
|
|
|
+ // 产品大类
|
|
|
|
|
+ o.setMainId(sysDictRefDLMap.get(String.valueOf(s.getSplb())).get(0).getDictCode());
|
|
|
|
|
+
|
|
|
|
|
+ o.setAppointmentType(s.getMydlx());
|
|
|
|
|
+ o.setType(s.getSxlx());
|
|
|
|
|
+ o.setCreateBy(s.getCreatedBy());
|
|
|
|
|
+ o.setCreateTime(s.getCreatedDate());
|
|
|
|
|
+ oanew.add(o);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 工单师傅表
|
|
|
|
|
- if (orderWorker != null) {
|
|
|
|
|
- orderWorkerService.save(orderWorker);
|
|
|
|
|
|
|
+ private void getOrderAppointment(OrderBase orderBase, List<OrderAppointment> oa, ItfTblAzAssignLcLsDownload item) {
|
|
|
|
|
+ List<ItfTblAzAssignAppointmentDownload> appointments;
|
|
|
|
|
+ appointments = itfTblAzAssignAppointmentDownloadService.lambdaQuery()
|
|
|
|
|
+ .eq(ItfTblAzAssignAppointmentDownload::getDownloadTaskNo, item.getDownloadTaskNo())
|
|
|
|
|
+ .eq(ItfTblAzAssignAppointmentDownload::getSynStatus,0)
|
|
|
|
|
+ .list();
|
|
|
|
|
+ for (ItfTblAzAssignAppointmentDownload a :appointments){
|
|
|
|
|
+ OrderAppointment v = new OrderAppointment();
|
|
|
|
|
+ v.setOrderBaseId(orderBase.getId());
|
|
|
|
|
+ v.setStartTime(a.getKssj());
|
|
|
|
|
+ v.setEndTime(a.getJssj());
|
|
|
|
|
+ v.setType(a.getLeix());
|
|
|
|
|
+ v.setDelayType(a.getReason());
|
|
|
|
|
+ v.setRemark(a.getBeiz());
|
|
|
|
|
+ v.setCreateBy(a.getCzren());
|
|
|
|
|
+ v.setCreateTime(a.getCzsj());
|
|
|
|
|
+ oa.add(v);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private OrderInstall getOrderInstall(OrderBase orderBase, Brand brand, ItfTblAzAssignLcLsDownload item) {
|
|
|
|
|
+ OrderInstall orderInstall = new OrderInstall();
|
|
|
|
|
+ ItfTblAzAssignFeeDownload fyqd = itfTblAzAssignFeeDownloadService.lambdaQuery()
|
|
|
|
|
+ .eq(ItfTblAzAssignFeeDownload::getDownloadTaskNo, item.getDownloadTaskNo())
|
|
|
|
|
+ .eq(ItfTblAzAssignFeeDownload::getSynStatus,0).one();
|
|
|
|
|
+ if (fyqd !=null){
|
|
|
|
|
+ OrderPar request = new OrderPar();
|
|
|
|
|
+ request.setSynReqId(fyqd.getSynReqId());
|
|
|
|
|
+ request.setBrandId(brand.getBrandId());
|
|
|
|
|
+ request.setMainSynReqId(item.getSynReqId());
|
|
|
|
|
+
|
|
|
|
|
+ orderInstall = azGDFYQDDownloadMapper.getOrderFYQD(request);
|
|
|
|
|
+ // 工单号
|
|
|
|
|
+ orderInstall.setOrderBaseId(orderBase.getId());
|
|
|
|
|
+ // 创建人,创建时间
|
|
|
|
|
+ orderInstall.setCreateBy(orderBase.getCreateBy());
|
|
|
|
|
+ orderInstall.setCreateTime(orderBase.getCreateTime());
|
|
|
|
|
+ return orderInstall;
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @NotNull
|
|
|
|
|
+ private List<OrderInstallOperatingLog> getOrderInstallOperatingLogs(OrderBase orderBase, Brand brand, ItfTblAzAssignLcLsDownload item) {
|
|
|
|
|
+ List<ItfTblAzAssignFkmxDownload> fkmxs = new ArrayList<>();
|
|
|
|
|
+ List<OrderInstallOperatingLog> oiolList = new ArrayList<>();
|
|
|
|
|
+ fkmxs = itfTblAzAssignFkmxDownloadService.lambdaQuery()
|
|
|
|
|
+ .eq(ItfTblAzAssignFkmxDownload::getDownloadTaskNo, item.getDownloadTaskNo())
|
|
|
|
|
+ .eq(ItfTblAzAssignFkmxDownload::getSynStatus,0)
|
|
|
|
|
+ .orderByAsc(ItfTblAzAssignFkmxDownload::getCreatedDate)
|
|
|
|
|
+ .list();
|
|
|
|
|
+ for (ItfTblAzAssignFkmxDownload fkmx : fkmxs){
|
|
|
|
|
+ OrderPar orderPar = new OrderPar();
|
|
|
|
|
+ orderPar.setSynReqId(fkmx.getSynReqId());
|
|
|
|
|
+ orderPar.setBrandId(brand.getBrandId());
|
|
|
|
|
+ OrderInstallOperatingLog oiol = azGDFkMxDownloadMapper.getOrderFkMx(orderPar);
|
|
|
|
|
+
|
|
|
|
|
+ // 工单号码
|
|
|
|
|
+ oiol.setOrderBaseId(orderBase.getId());
|
|
|
|
|
+ // 客户名称,客户联系电话
|
|
|
|
|
+ oiol.setCustomer(orderBase.getUserName());
|
|
|
|
|
+ oiol.setCustomerPhone(orderBase.getUserMobile());
|
|
|
|
|
+ oiol.setPgid(orderBase.getPgid());
|
|
|
|
|
+ oiol.setUploadNotifyFlag(0);
|
|
|
|
|
+ // websit_number及operate_websit 可能为空,需从销售网点再次查询
|
|
|
|
|
+ if (StringUtils.isNotEmpty(fkmx.getWdno()) && StringUtils.isEmpty(oiol.getWebsitNumber())){
|
|
|
|
|
+ // 从销售网点查
|
|
|
|
|
+ CustomerInformationWebsit ciw = customerInformationWebsitService.lambdaQuery()
|
|
|
|
|
+ .eq(CustomerInformationWebsit::getRefWebsitId, fkmx.getWdno())
|
|
|
|
|
+ .eq(CustomerInformationWebsit::getBrandId, brand.getBrandId())
|
|
|
|
|
+ .one();
|
|
|
|
|
+ if (ciw !=null){
|
|
|
|
|
+ oiol.setWebsitNumber(ciw.getWebsitId());
|
|
|
|
|
+ oiol.setOperateWebsit(ciw.getWebsitId());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 操作前工单状态,操作前派工状态,操作后工单状态,操作后派工状态 这些字段不处理
|
|
|
|
|
+ oiolList.add(oiol);
|
|
|
}
|
|
}
|
|
|
|
|
+ return oiolList;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- log.info("安装工单落本地表完成: {}",sdf.format(new Date()));
|
|
|
|
|
|
|
+ private void getOrderProduct(OrderBase orderBase, List<OrderProduct> orderProducts, Map<String,
|
|
|
|
|
+ List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
|
|
|
|
|
+ Map<String, List<SysDictRef>> sysDictRefXiLieMap, String downloadTaskNo) {
|
|
|
|
|
+ List<ItfTblAzAssignMxDownload> orderMx;
|
|
|
|
|
+ orderMx = itfTblAzAssignMxDownloadService.lambdaQuery()
|
|
|
|
|
+ .eq(ItfTblAzAssignMxDownload::getDownloadTaskNo, downloadTaskNo)
|
|
|
|
|
+ .eq(ItfTblAzAssignMxDownload::getSynStatus,0)
|
|
|
|
|
+ .list();
|
|
|
|
|
+ // pgmxid主键
|
|
|
|
|
+
|
|
|
|
|
+ // 生成对象
|
|
|
|
|
+ for (ItfTblAzAssignMxDownload mx:orderMx){
|
|
|
|
|
+ OrderProduct op = new OrderProduct();
|
|
|
|
|
+ op.setId(UUID.randomUUID().toString());
|
|
|
|
|
+ op.setOrderBaseId(orderBase.getId());
|
|
|
|
|
+ op.setPgmxid(mx.getPgmxid());
|
|
|
|
|
+ op.setPgguid(mx.getPgguid());
|
|
|
|
|
+ op.setMainId(sysDictRefDLMap.get(String.valueOf(mx.getSpid())).get(0).getDictCode());
|
|
|
|
|
+ op.setMainName(sysDictRefDLMap.get(String.valueOf(mx.getSpid())).get(0).getDictValue());
|
|
|
|
|
+ if (!mx.getXlid().equals(0L)){
|
|
|
|
|
+ op.setSmallId(sysDictRefXLMap.get(String.valueOf(mx.getXlid())).get(0).getDictCode());
|
|
|
|
|
+ op.setSmallName(sysDictRefXLMap.get(String.valueOf(mx.getXlid())).get(0).getDictValue());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ op.setSmallId(String.valueOf(mx.getXlid()));
|
|
|
|
|
+ op.setSmallName(mx.getXlmc());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ if (!mx.getXiid().equals("0")){
|
|
|
|
|
+ op.setSeriesId(sysDictRefXiLieMap.get(mx.getXiid()).get(0).getDictCode());
|
|
|
|
|
+ op.setSeriesName(sysDictRefXiLieMap.get(mx.getXiid()).get(0).getDictValue());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ op.setSeriesId(mx.getXiid());
|
|
|
|
|
+ op.setSeriesName(mx.getXimc());
|
|
|
|
|
+ }
|
|
|
|
|
+ op.setProductId(mx.getJxno());
|
|
|
|
|
+ op.setProductName(mx.getJxmc());
|
|
|
|
|
+ op.setInsideCode(mx.getNjtm());
|
|
|
|
|
+ op.setOutCode(mx.getWjtm());
|
|
|
|
|
+ op.setNum(mx.getShul());
|
|
|
|
|
+ op.setPrice(mx.getJiage());
|
|
|
|
|
+ op.setUnit(mx.getDanw());
|
|
|
|
|
+ op.setMaterialNumber(mx.getWldm());
|
|
|
|
|
+ op.setInsideNum(mx.getNjsl());
|
|
|
|
|
+ op.setOutNum(mx.getWjsl());
|
|
|
|
|
+ op.setUndoneNum(mx.getWwsl());
|
|
|
|
|
+ op.setCreateTime(mx.getCjdt());
|
|
|
|
|
+ op.setCreateBy(mx.getCreatedBy());
|
|
|
|
|
+ // 销售单位
|
|
|
|
|
+ op.setSaleWebsit(orderBase.getSaleWebsitId());
|
|
|
|
|
+ // 无销售单位联系人电话
|
|
|
|
|
+ op.setSeriesId(orderBase.getWebsitId());
|
|
|
|
|
+ // 无服务单位电话信息 最好取websit表中的热线,先不取
|
|
|
|
|
+ op.setBuyTime(orderBase.getBuyTime());
|
|
|
|
|
+ op.setRemark(mx.getBeiz());
|
|
|
|
|
+ orderProducts.add(op);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Map<String, List<SysDictRef>> getMap(Brand brand) {
|
|
|
|
|
+ List<SysDictRef> sysDictxilieRef;
|
|
|
|
|
+ Map<String, List<SysDictRef>> sysDictRefXiLieMap;
|
|
|
|
|
+ sysDictxilieRef = sysDictRefService.lambdaQuery()
|
|
|
|
|
+ .select(SysDictRef::getDictCode,SysDictRef::getDictValue,SysDictRef::getRefDictCode)
|
|
|
|
|
+ .eq(SysDictRef::getBrandId, brand.getBrandId())
|
|
|
|
|
+ .eq(SysDictRef::getDictType, DictTypeEnum.DICT_TYPE_SERIES.getCode())
|
|
|
|
|
+ .list();
|
|
|
|
|
+ sysDictRefXiLieMap = sysDictxilieRef.stream().
|
|
|
|
|
+ collect(Collectors.groupingBy(SysDictRef::getRefDictCode));
|
|
|
|
|
+ return sysDictRefXiLieMap;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ private Map<String, List<SysDictRef>> getListMap(Brand brand) {
|
|
|
|
|
+ List<SysDictRef> sysDictxlRef;
|
|
|
|
|
+ Map<String, List<SysDictRef>> sysDictRefXLMap;
|
|
|
|
|
+ sysDictxlRef = sysDictRefService.lambdaQuery()
|
|
|
|
|
+ .select(SysDictRef::getDictCode,SysDictRef::getDictValue,SysDictRef::getRefDictCode)
|
|
|
|
|
+ .eq(SysDictRef::getBrandId, brand.getBrandId())
|
|
|
|
|
+ .eq(SysDictRef::getDictType, DictTypeEnum.DICT_TYPE_SMALL_TYPE.getCode())
|
|
|
|
|
+ .list();
|
|
|
|
|
+ sysDictRefXLMap = sysDictxlRef.stream().
|
|
|
|
|
+ collect(Collectors.groupingBy(SysDictRef::getRefDictCode));
|
|
|
|
|
+ return sysDictRefXLMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Map<String, List<SysDictRef>> getStringListMap(Brand brand) {
|
|
|
|
|
+ List<SysDictRef> sysDictRef;
|
|
|
|
|
+ Map<String, List<SysDictRef>> sysDictRefDLMap;
|
|
|
|
|
+ sysDictRef = sysDictRefService.lambdaQuery()
|
|
|
|
|
+ .select(SysDictRef::getDictCode,SysDictRef::getDictValue,SysDictRef::getRefDictCode)
|
|
|
|
|
+ .eq(SysDictRef::getBrandId, brand.getBrandId())
|
|
|
|
|
+ .eq(SysDictRef::getDictType, DictTypeEnum.DICT_TYPE_MAIN_TYPE.getCode())
|
|
|
|
|
+ .list();
|
|
|
|
|
+ sysDictRefDLMap = sysDictRef.stream().
|
|
|
|
|
+ collect(Collectors.groupingBy(SysDictRef::getRefDictCode));
|
|
|
|
|
+ return sysDictRefDLMap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private OrderWorker getOrderWorker(OrderBase orderBase) {
|
|
private OrderWorker getOrderWorker(OrderBase orderBase) {
|
|
@@ -186,15 +546,8 @@ public class AnzhuangGongDanBusiness {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private OrderBase getOrderBase(ItfTblAzAssignLcLsDownload item) {
|
|
|
|
|
|
|
+ private OrderBase getOrderBase(ItfTblAzAssignLcLsDownload item, Brand brand) {
|
|
|
OrderBase orderBase = new OrderBase();
|
|
OrderBase orderBase = new OrderBase();
|
|
|
- List<BrandLbsRelate> br = new ArrayList<>();
|
|
|
|
|
- // 提取品牌信息
|
|
|
|
|
- Brand brand = baseService.getBrand();
|
|
|
|
|
- if (brand == null) {
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
OrderPar orderPar = new OrderPar();
|
|
OrderPar orderPar = new OrderPar();
|
|
|
orderPar.setSynReqId(item.getSynReqId());
|
|
orderPar.setSynReqId(item.getSynReqId());
|
|
|
orderPar.setBrandId(brand.getBrandId());
|
|
orderPar.setBrandId(brand.getBrandId());
|
|
@@ -203,16 +556,24 @@ public class AnzhuangGongDanBusiness {
|
|
|
orderBase = azGDLcLsDownloadMapper.getOrderBase(orderPar);
|
|
orderBase = azGDLcLsDownloadMapper.getOrderBase(orderPar);
|
|
|
|
|
|
|
|
// 重置部分数据
|
|
// 重置部分数据
|
|
|
- setPar(orderBase, brand);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ setPar(item, orderBase, brand);
|
|
|
|
|
|
|
|
return orderBase;
|
|
return orderBase;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void setPar(OrderBase orderBase, Brand brand) {
|
|
|
|
|
|
|
+ private void setPar(ItfTblAzAssignLcLsDownload item, OrderBase orderBase, Brand brand) {
|
|
|
// 品牌信息
|
|
// 品牌信息
|
|
|
orderBase.setBrandId(brand.getBrandId());
|
|
orderBase.setBrandId(brand.getBrandId());
|
|
|
orderBase.setBrandName(brand.getBrand());
|
|
orderBase.setBrandName(brand.getBrand());
|
|
|
|
|
+
|
|
|
|
|
+ // 判断安装网点编号是否为空或者为公司,如果为空或为公司,就写入接收派工网点
|
|
|
|
|
+ if (StringUtils.isEmpty(item.getAzwdno()) || item.getAzwdno().equals("S9219801") || item.getAzwdno().equals("S9219807")){
|
|
|
|
|
+ if (orderBase.getReceWebsitId() !=null){
|
|
|
|
|
+ orderBase.setWebsitId(orderBase.getReceWebsitId());
|
|
|
|
|
+ orderBase.setWebsitName(orderBase.getReceWebsitName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 省市区单独处理
|
|
// 省市区单独处理
|
|
|
getPCAS(orderBase);
|
|
getPCAS(orderBase);
|
|
|
// 派工方式,新创建订单时 azren 名称不为空时为手动派工 (dispatch_flag派工方式 A=自动派工 B=手动派工)
|
|
// 派工方式,新创建订单时 azren 名称不为空时为手动派工 (dispatch_flag派工方式 A=自动派工 B=手动派工)
|