Quellcode durchsuchen

数据同步代码更新

yangwanyi vor 3 Jahren
Ursprung
Commit
46ecd72570

+ 7 - 7
src/main/java/com/persagy/transfer/constant/InfosKeyConstant.java

@@ -60,22 +60,22 @@ public class InfosKeyConstant {
     /**
      * 生产商
      */
-    public static final String MANUFACTURER = "Manufacturer";
+    public static final String MANUFACTURER = "manufacturer";
 
     /**
      * 供应商
      */
-    public static final String SUPPLIER = "Supplier";
+    public static final String SUPPLIER = "supplier";
 
     /**
      * 服务商
      */
-    public static final String MAINTAINER = "Maintainer";
+    public static final String MAINTAINER = "maintainer";
 
     /**
      * 采购金额(元)
      */
-    public static final String PURCHASE_PRICE = "PurchasePrice";
+    public static final String PURCHASE_PRICE = "purchasePrice";
 
     /**
      * 折旧/使用年限
@@ -85,17 +85,17 @@ public class InfosKeyConstant {
     /**
      * 生产日期/出厂日期
      */
-    public static final String PRODUCT_DATE = "wD_productdate";
+    public static final String PRODUCT_DATE = "productDate";
 
     /**
      * 采购日期
      */
-    public static final String PURCHASE_DATE = "PurchaseDate";
+    public static final String PURCHASE_DATE = "purchaseDate";
 
     /**
      * 安装日期
      */
-    public static final String INSTALL_DATE = "InstallDate";
+    public static final String INSTALL_DATE = "installDate";
 
     /**
      * 启用日期

+ 10 - 2
src/main/java/com/persagy/transfer/controller/DemoController.java

@@ -1,5 +1,7 @@
 package com.persagy.transfer.controller;
 
+import com.persagy.transfer.service.PersagyDbService;
+import com.persagy.transfer.service.WdDbService;
 import com.persagy.transfer.service.impl.DemoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -21,16 +23,22 @@ public class DemoController {
     @Autowired
     private DemoService demoService;
 
+    @Autowired
+    private PersagyDbService persagyDbService;
+
+    @Autowired
+    private WdDbService wdDbService;
+
     @RequestMapping("/test")
     public Object queryCount(HttpServletRequest request) {
         String datasource = request.getHeader("datasource");
-        return "1".equals(datasource) ? this.demoService.getDataByMasterOne() : this.demoService.getDataByMasterTwo();
+        return "1".equals(datasource) ? this.demoService.getDataByMasterOne() : this.wdDbService.getDataByMasterTwo();
     }
 
     @RequestMapping("/syncNow")
     public Object syncNow() {
         try {
-            this.demoService.syncData2WD();
+            this.persagyDbService.syncData2WD();
             return true;
         } catch (Exception e) {
             e.printStackTrace();

Datei-Diff unterdrückt, da er zu groß ist
+ 693 - 694
src/main/java/com/persagy/transfer/pojo/dto/HydomcAsset.java


+ 349 - 351
src/main/java/com/persagy/transfer/pojo/dto/HydomcAssetspec.java

@@ -1,26 +1,23 @@
 package com.persagy.transfer.pojo.dto;
 
-import java.util.Date;
-
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.persagy.common.utils.StringUtil;
-
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
 
+import java.util.Date;
+
 /**
  * 设备参数信息
- * 
+ *
+ * @author zhangqiankun
  * @version 1.0.0
  * @company persagy
- * @author zhangqiankun
  * @date 2021-09-16 10:45:41
  */
 @Getter
@@ -29,347 +26,348 @@ import lombok.ToString;
 @EqualsAndHashCode(callSuper = false)
 @TableName("hydomc_assetspec")
 public class HydomcAssetspec extends Model<HydomcAssetspec> {
-	private static final long serialVersionUID = 1994016672442325413L;
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String assetspecid;	//主键ID
-	
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String assetattrid; // 设备分类ID
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String siteid; // 关联的设备信息字段
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String sbybm; // 关联的设备信息字段
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String classstructureid; // 设备分类id
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String classqc; // 设备分类名称, 电梯系统/扶梯/人行步道
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String csdesc; // 设备参数名称,传输能力
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String datatype; // 设备参数类型,字母数字
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String measureunitid; // 设备参数单位编码
-
-	@TableField(updateStrategy = FieldStrategy.NOT_NULL)
-	private String csjldw; // 设备参数单位名称
-
-	@TableField(updateStrategy = FieldStrategy.NOT_NULL)
-	private Double numvalue; // 设备参数数字值
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String alnvalue; // 设备参数文本值
-
-	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String datastatus; // 数据状态
-
-	@TableField(updateStrategy = FieldStrategy.NOT_NULL)
-	private Date changedate; // 数据更新时间
-
-	public static Builder builder() {
-		return new Builder();
-	}
-
-	public static class BuilderQueryWrapper {
-
-		private LambdaQueryWrapper<HydomcAssetspec> queryWrapper = new LambdaQueryWrapper<HydomcAssetspec>();
-
-		public BuilderQueryWrapper assetspecidEq(String assetspecid) {
-			if (StringUtil.isNotBlank(assetspecid)) {
-				queryWrapper.eq(HydomcAssetspec::getAssetspecid, assetspecid);
-			}
-			return this;
-		}
-		
-		public BuilderQueryWrapper assetattridEq(String assetattrid) {
-			if (StringUtil.isNotBlank(assetattrid)) {
-				queryWrapper.eq(HydomcAssetspec::getAssetattrid, assetattrid);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper siteidEq(String siteid) {
-			if (StringUtil.isNotBlank(siteid)) {
-				queryWrapper.eq(HydomcAssetspec::getSiteid, siteid);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper sbybmEq(String sbybm) {
-			if (StringUtil.isNotBlank(sbybm)) {
-				queryWrapper.eq(HydomcAssetspec::getSbybm, sbybm);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper classstructureidEq(String classstructureid) {
-			if (StringUtil.isNotBlank(classstructureid)) {
-				queryWrapper.eq(HydomcAssetspec::getClassstructureid, classstructureid);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper classqcEq(String classqc) {
-			if (StringUtil.isNotBlank(classqc)) {
-				queryWrapper.eq(HydomcAssetspec::getClassqc, classqc);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper csdescEq(String csdesc) {
-			if (StringUtil.isNotBlank(csdesc)) {
-				queryWrapper.eq(HydomcAssetspec::getCsdesc, csdesc);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper datatypeEq(String datatype) {
-			if (StringUtil.isNotBlank(datatype)) {
-				queryWrapper.eq(HydomcAssetspec::getDatatype, datatype);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper measureunitidEq(String measureunitid) {
-			if (StringUtil.isNotBlank(measureunitid)) {
-				queryWrapper.eq(HydomcAssetspec::getMeasureunitid, measureunitid);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper csjldwEq(String csjldw) {
-			if (StringUtil.isNotBlank(csjldw)) {
-				queryWrapper.eq(HydomcAssetspec::getCsjldw, csjldw);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper numvalueEq(Double numvalue) {
-			if (null != numvalue) {
-				queryWrapper.eq(HydomcAssetspec::getNumvalue, numvalue);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper alnvalueEq(String alnvalue) {
-			if (StringUtil.isNotBlank(alnvalue)) {
-				queryWrapper.eq(HydomcAssetspec::getAlnvalue, alnvalue);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper datastatusEq(String datastatus) {
-			if (StringUtil.isNotBlank(datastatus)) {
-				queryWrapper.eq(HydomcAssetspec::getDatastatus, datastatus);
-			}
-			return this;
-		}
-
-		public BuilderQueryWrapper changedateEq(Date changedate) {
-			if (null != changedate) {
-				queryWrapper.eq(HydomcAssetspec::getChangedate, changedate);
-			}
-			return this;
-		}
-
-		public LambdaQueryWrapper<HydomcAssetspec> builder() {
-			return queryWrapper;
-		}
-
-	}
-
-	public static class BuilderUpdateWrapper {
-
-		private LambdaUpdateWrapper<HydomcAssetspec> updateWrapper = new LambdaUpdateWrapper<HydomcAssetspec>();
-
-		public BuilderUpdateWrapper assetspecidEq(String assetspecid) {
-			if (StringUtil.isNotBlank(assetspecid)) {
-				updateWrapper.eq(HydomcAssetspec::getAssetspecid, assetspecid);
-			}
-			return this;
-		}
-		
-		public BuilderUpdateWrapper assetattridEq(String assetattrid) {
-			if (StringUtil.isNotBlank(assetattrid)) {
-				updateWrapper.eq(HydomcAssetspec::getAssetattrid, assetattrid);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper siteidEq(String siteid) {
-			if (StringUtil.isNotBlank(siteid)) {
-				updateWrapper.eq(HydomcAssetspec::getSiteid, siteid);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper sbybmEq(String sbybm) {
-			if (StringUtil.isNotBlank(sbybm)) {
-				updateWrapper.eq(HydomcAssetspec::getSbybm, sbybm);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper classstructureidEq(String classstructureid) {
-			if (StringUtil.isNotBlank(classstructureid)) {
-				updateWrapper.eq(HydomcAssetspec::getClassstructureid, classstructureid);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper classqcEq(String classqc) {
-			if (StringUtil.isNotBlank(classqc)) {
-				updateWrapper.eq(HydomcAssetspec::getClassqc, classqc);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper csdescEq(String csdesc) {
-			if (StringUtil.isNotBlank(csdesc)) {
-				updateWrapper.eq(HydomcAssetspec::getCsdesc, csdesc);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper datatypeEq(String datatype) {
-			if (StringUtil.isNotBlank(datatype)) {
-				updateWrapper.eq(HydomcAssetspec::getDatatype, datatype);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper measureunitidEq(String measureunitid) {
-			if (StringUtil.isNotBlank(measureunitid)) {
-				updateWrapper.eq(HydomcAssetspec::getMeasureunitid, measureunitid);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper csjldwEq(String csjldw) {
-			if (StringUtil.isNotBlank(csjldw)) {
-				updateWrapper.eq(HydomcAssetspec::getCsjldw, csjldw);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper numvalueEq(Double numvalue) {
-			if (null != numvalue) {
-				updateWrapper.eq(HydomcAssetspec::getNumvalue, numvalue);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper alnvalueEq(String alnvalue) {
-			if (StringUtil.isNotBlank(alnvalue)) {
-				updateWrapper.eq(HydomcAssetspec::getAlnvalue, alnvalue);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper datastatusEq(String datastatus) {
-			if (StringUtil.isNotBlank(datastatus)) {
-				updateWrapper.eq(HydomcAssetspec::getDatastatus, datastatus);
-			}
-			return this;
-		}
-
-		public BuilderUpdateWrapper changedateEq(Date changedate) {
-			if (null != changedate) {
-				updateWrapper.eq(HydomcAssetspec::getChangedate, changedate);
-			}
-			return this;
-		}
-
-		public LambdaUpdateWrapper<HydomcAssetspec> builder() {
-			return updateWrapper;
-		}
-
-	}
-
-	public static class Builder {
-
-		private HydomcAssetspec hydomcAssetspec = new HydomcAssetspec();
-
-		public Builder assetspecid(String assetspecid) {
-			hydomcAssetspec.setAssetspecid(assetspecid);
-			return this;
-		}
-		
-		public Builder assetattrid(String assetattrid) {
-			hydomcAssetspec.setAssetattrid(assetattrid);
-			return this;
-		}
-
-		public Builder siteid(String siteid) {
-			hydomcAssetspec.setSiteid(siteid);
-			return this;
-		}
-
-		public Builder sbybm(String sbybm) {
-			hydomcAssetspec.setSbybm(sbybm);
-			return this;
-		}
-
-		public Builder classstructureid(String classstructureid) {
-			hydomcAssetspec.setClassstructureid(classstructureid);
-			return this;
-		}
-
-		public Builder classqc(String classqc) {
-			hydomcAssetspec.setClassqc(classqc);
-			return this;
-		}
-
-		public Builder csdesc(String csdesc) {
-			hydomcAssetspec.setCsdesc(csdesc);
-			return this;
-		}
-
-		public Builder datatype(String datatype) {
-			hydomcAssetspec.setDatatype(datatype);
-			return this;
-		}
-
-		public Builder measureunitid(String measureunitid) {
-			hydomcAssetspec.setMeasureunitid(measureunitid);
-			return this;
-		}
-
-		public Builder csjldw(String csjldw) {
-			hydomcAssetspec.setCsjldw(csjldw);
-			return this;
-		}
-
-		public Builder numvalue(Double numvalue) {
-			hydomcAssetspec.setNumvalue(numvalue);
-			return this;
-		}
-
-		public Builder alnvalue(String alnvalue) {
-			hydomcAssetspec.setAlnvalue(alnvalue);
-			return this;
-		}
-
-		public Builder datastatus(String datastatus) {
-			hydomcAssetspec.setDatastatus(datastatus);
-			return this;
-		}
-
-		public Builder changedate(Date changedate) {
-			hydomcAssetspec.setChangedate(changedate);
-			return this;
-		}
-
-		public HydomcAssetspec build() {
-			return hydomcAssetspec;
-		}
-
-	}
+    private static final long serialVersionUID = 1994016672442325413L;
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY, fill = FieldFill.INSERT)
+    @TableId(type = IdType.ASSIGN_ID)
+    private String assetspecid;    //主键ID
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String assetattrid; // 设备分类ID
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String siteid; // 关联的设备信息字段
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String sbybm; // 关联的设备信息字段
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String classstructureid; // 设备分类id
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String classqc; // 设备分类名称, 电梯系统/扶梯/人行步道
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String csdesc; // 设备参数名称,传输能力
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String datatype; // 设备参数类型,字母数字
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String measureunitid; // 设备参数单位编码
+
+    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
+    private String csjldw; // 设备参数单位名称
+
+    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
+    private Double numvalue; // 设备参数数字值
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String alnvalue; // 设备参数文本值
+
+    @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+    private String datastatus; // 数据状态
+
+    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
+    private Date changedate; // 数据更新时间
+
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    public static class BuilderQueryWrapper {
+
+        private LambdaQueryWrapper<HydomcAssetspec> queryWrapper = new LambdaQueryWrapper<>();
+
+        public BuilderQueryWrapper assetspecidEq(String assetspecid) {
+            if (StringUtil.isNotBlank(assetspecid)) {
+                queryWrapper.eq(HydomcAssetspec::getAssetspecid, assetspecid);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper assetattridEq(String assetattrid) {
+            if (StringUtil.isNotBlank(assetattrid)) {
+                queryWrapper.eq(HydomcAssetspec::getAssetattrid, assetattrid);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper siteidEq(String siteid) {
+            if (StringUtil.isNotBlank(siteid)) {
+                queryWrapper.eq(HydomcAssetspec::getSiteid, siteid);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper sbybmEq(String sbybm) {
+            if (StringUtil.isNotBlank(sbybm)) {
+                queryWrapper.eq(HydomcAssetspec::getSbybm, sbybm);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper classstructureidEq(String classstructureid) {
+            if (StringUtil.isNotBlank(classstructureid)) {
+                queryWrapper.eq(HydomcAssetspec::getClassstructureid, classstructureid);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper classqcEq(String classqc) {
+            if (StringUtil.isNotBlank(classqc)) {
+                queryWrapper.eq(HydomcAssetspec::getClassqc, classqc);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper csdescEq(String csdesc) {
+            if (StringUtil.isNotBlank(csdesc)) {
+                queryWrapper.eq(HydomcAssetspec::getCsdesc, csdesc);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper datatypeEq(String datatype) {
+            if (StringUtil.isNotBlank(datatype)) {
+                queryWrapper.eq(HydomcAssetspec::getDatatype, datatype);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper measureunitidEq(String measureunitid) {
+            if (StringUtil.isNotBlank(measureunitid)) {
+                queryWrapper.eq(HydomcAssetspec::getMeasureunitid, measureunitid);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper csjldwEq(String csjldw) {
+            if (StringUtil.isNotBlank(csjldw)) {
+                queryWrapper.eq(HydomcAssetspec::getCsjldw, csjldw);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper numvalueEq(Double numvalue) {
+            if (null != numvalue) {
+                queryWrapper.eq(HydomcAssetspec::getNumvalue, numvalue);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper alnvalueEq(String alnvalue) {
+            if (StringUtil.isNotBlank(alnvalue)) {
+                queryWrapper.eq(HydomcAssetspec::getAlnvalue, alnvalue);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper datastatusEq(String datastatus) {
+            if (StringUtil.isNotBlank(datastatus)) {
+                queryWrapper.eq(HydomcAssetspec::getDatastatus, datastatus);
+            }
+            return this;
+        }
+
+        public BuilderQueryWrapper changedateEq(Date changedate) {
+            if (null != changedate) {
+                queryWrapper.eq(HydomcAssetspec::getChangedate, changedate);
+            }
+            return this;
+        }
+
+        public LambdaQueryWrapper<HydomcAssetspec> builder() {
+            return queryWrapper;
+        }
+
+    }
+
+    public static class BuilderUpdateWrapper {
+
+        private LambdaUpdateWrapper<HydomcAssetspec> updateWrapper = new LambdaUpdateWrapper<>();
+
+        public BuilderUpdateWrapper assetspecidEq(String assetspecid) {
+            if (StringUtil.isNotBlank(assetspecid)) {
+                updateWrapper.eq(HydomcAssetspec::getAssetspecid, assetspecid);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper assetattridEq(String assetattrid) {
+            if (StringUtil.isNotBlank(assetattrid)) {
+                updateWrapper.eq(HydomcAssetspec::getAssetattrid, assetattrid);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper siteidEq(String siteid) {
+            if (StringUtil.isNotBlank(siteid)) {
+                updateWrapper.eq(HydomcAssetspec::getSiteid, siteid);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper sbybmEq(String sbybm) {
+            if (StringUtil.isNotBlank(sbybm)) {
+                updateWrapper.eq(HydomcAssetspec::getSbybm, sbybm);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper classstructureidEq(String classstructureid) {
+            if (StringUtil.isNotBlank(classstructureid)) {
+                updateWrapper.eq(HydomcAssetspec::getClassstructureid, classstructureid);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper classqcEq(String classqc) {
+            if (StringUtil.isNotBlank(classqc)) {
+                updateWrapper.eq(HydomcAssetspec::getClassqc, classqc);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper csdescEq(String csdesc) {
+            if (StringUtil.isNotBlank(csdesc)) {
+                updateWrapper.eq(HydomcAssetspec::getCsdesc, csdesc);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper datatypeEq(String datatype) {
+            if (StringUtil.isNotBlank(datatype)) {
+                updateWrapper.eq(HydomcAssetspec::getDatatype, datatype);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper measureunitidEq(String measureunitid) {
+            if (StringUtil.isNotBlank(measureunitid)) {
+                updateWrapper.eq(HydomcAssetspec::getMeasureunitid, measureunitid);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper csjldwEq(String csjldw) {
+            if (StringUtil.isNotBlank(csjldw)) {
+                updateWrapper.eq(HydomcAssetspec::getCsjldw, csjldw);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper numvalueEq(Double numvalue) {
+            if (null != numvalue) {
+                updateWrapper.eq(HydomcAssetspec::getNumvalue, numvalue);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper alnvalueEq(String alnvalue) {
+            if (StringUtil.isNotBlank(alnvalue)) {
+                updateWrapper.eq(HydomcAssetspec::getAlnvalue, alnvalue);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper datastatusEq(String datastatus) {
+            if (StringUtil.isNotBlank(datastatus)) {
+                updateWrapper.eq(HydomcAssetspec::getDatastatus, datastatus);
+            }
+            return this;
+        }
+
+        public BuilderUpdateWrapper changedateEq(Date changedate) {
+            if (null != changedate) {
+                updateWrapper.eq(HydomcAssetspec::getChangedate, changedate);
+            }
+            return this;
+        }
+
+        public LambdaUpdateWrapper<HydomcAssetspec> builder() {
+            return updateWrapper;
+        }
+
+    }
+
+    public static class Builder {
+
+        private HydomcAssetspec hydomcAssetspec = new HydomcAssetspec();
+
+        public Builder assetspecid(String assetspecid) {
+            hydomcAssetspec.setAssetspecid(assetspecid);
+            return this;
+        }
+
+        public Builder assetattrid(String assetattrid) {
+            hydomcAssetspec.setAssetattrid(assetattrid);
+            return this;
+        }
+
+        public Builder siteid(String siteid) {
+            hydomcAssetspec.setSiteid(siteid);
+            return this;
+        }
+
+        public Builder sbybm(String sbybm) {
+            hydomcAssetspec.setSbybm(sbybm);
+            return this;
+        }
+
+        public Builder classstructureid(String classstructureid) {
+            hydomcAssetspec.setClassstructureid(classstructureid);
+            return this;
+        }
+
+        public Builder classqc(String classqc) {
+            hydomcAssetspec.setClassqc(classqc);
+            return this;
+        }
+
+        public Builder csdesc(String csdesc) {
+            hydomcAssetspec.setCsdesc(csdesc);
+            return this;
+        }
+
+        public Builder datatype(String datatype) {
+            hydomcAssetspec.setDatatype(datatype);
+            return this;
+        }
+
+        public Builder measureunitid(String measureunitid) {
+            hydomcAssetspec.setMeasureunitid(measureunitid);
+            return this;
+        }
+
+        public Builder csjldw(String csjldw) {
+            hydomcAssetspec.setCsjldw(csjldw);
+            return this;
+        }
+
+        public Builder numvalue(Double numvalue) {
+            hydomcAssetspec.setNumvalue(numvalue);
+            return this;
+        }
+
+        public Builder alnvalue(String alnvalue) {
+            hydomcAssetspec.setAlnvalue(alnvalue);
+            return this;
+        }
+
+        public Builder datastatus(String datastatus) {
+            hydomcAssetspec.setDatastatus(datastatus);
+            return this;
+        }
+
+        public Builder changedate(Date changedate) {
+            hydomcAssetspec.setChangedate(changedate);
+            return this;
+        }
+
+        public HydomcAssetspec build() {
+            return hydomcAssetspec;
+        }
+
+    }
 }

+ 119 - 109
src/main/java/com/persagy/transfer/pojo/dto/RwdObjecWd.java

@@ -1,20 +1,18 @@
 package com.persagy.transfer.pojo.dto;
 
-import java.util.Date;
-
-import com.alibaba.fastjson.JSONObject;
-
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
 
+import java.util.Date;
+
 /**
  * 对象实例表
- * 
+ *
+ * @author zhangqiankun
  * @version 1.0.0
  * @company persagy
- * @author zhangqiankun
  * @date 2021-09-16 13:16:57
  */
 @Getter
@@ -22,144 +20,156 @@ import lombok.ToString;
 @ToString
 @EqualsAndHashCode(callSuper = false)
 public class RwdObjecWd {
-	
-	private String id; // 主键ID
 
-	private String name; // 对象名称
+    private String id; // 主键ID
+
+    private String name; // 对象名称
+
+    private String localId; // 对象本地编码
 
-	private String localId; // 对象本地编码
+    private String localName; // 对象本地名称
 
-	private String localName; // 对象本地名称
+    private String groupCode; //
 
-	private String groupCode; //
+    private String projectId; // 项目id
 
-	private String projectId; // 项目id
+    private String objType; // 对象分类
 
-	private String objType; // 对象分类
+    private String classCode; // 对象类型编码
 
-	private String classCode; // 对象类型编码
+    private Integer grouping; // 1单个对象,2对象组
 
-	private Integer grouping; // 1单个对象,2对象组
+    private Integer valid; // 对象状态:1有效,0无效
 
-	private Integer valid; // 对象状态:1有效,0无效
+    //	private JSONObject infos; // 边类型编码
+    private String infos; // 边类型编码
 
-	private JSONObject infos; // 边类型编码
+    //	private JSONObject virtualInfoCodes; // 虚点清单
+    private String virtualInfoCodes; // 虚点清单
 
-	private JSONObject virtualInfoCodes; // 虚点清单
+    private Date createTime; // 创建时间
 
-	private Date createTime; // 创建时间
+    private Date updateTime; // 最后更新时间
 
-	private Date updateTime; // 最后更新时间
+    private String createUser; // 创建用户
 
-	private String createUser; // 创建用户
+    private String updateUser; // 最后更新用户
 
-	private String updateUser; // 最后更新用户
+    private String createApp; // 创建应用
 
-	private String createApp; // 创建应用
+    private String updateApp; // 最后更新应用
 
-	private String updateApp; // 最后更新应用
+    public static Builder builder() {
+        return new Builder();
+    }
 
-	public static Builder builder() {
-		return new Builder();
-	}
+    public static class Builder {
 
-	public static class Builder {
+        private RwdObjecWd rwdObjecWd = new RwdObjecWd();
 
-		private RwdObjecWd rwdObjecWd = new RwdObjecWd();
+        public Builder id(String id) {
+            rwdObjecWd.setId(id);
+            return this;
+        }
 
-		public Builder id(String id) {
-			rwdObjecWd.setId(id);
-			return this;
-		}
+        public Builder name(String name) {
+            rwdObjecWd.setName(name);
+            return this;
+        }
 
-		public Builder name(String name) {
-			rwdObjecWd.setName(name);
-			return this;
-		}
+        public Builder localId(String localId) {
+            rwdObjecWd.setLocalId(localId);
+            return this;
+        }
 
-		public Builder localId(String localId) {
-			rwdObjecWd.setLocalId(localId);
-			return this;
-		}
+        public Builder localName(String localName) {
+            rwdObjecWd.setLocalName(localName);
+            return this;
+        }
 
-		public Builder localName(String localName) {
-			rwdObjecWd.setLocalName(localName);
-			return this;
-		}
+        public Builder groupCode(String groupCode) {
+            rwdObjecWd.setGroupCode(groupCode);
+            return this;
+        }
 
-		public Builder groupCode(String groupCode) {
-			rwdObjecWd.setGroupCode(groupCode);
-			return this;
-		}
+        public Builder projectId(String projectId) {
+            rwdObjecWd.setProjectId(projectId);
+            return this;
+        }
 
-		public Builder projectId(String projectId) {
-			rwdObjecWd.setProjectId(projectId);
-			return this;
-		}
+        public Builder objType(String objType) {
+            rwdObjecWd.setObjType(objType);
+            return this;
+        }
 
-		public Builder objType(String objType) {
-			rwdObjecWd.setObjType(objType);
-			return this;
-		}
+        public Builder classCode(String classCode) {
+            rwdObjecWd.setClassCode(classCode);
+            return this;
+        }
 
-		public Builder classCode(String classCode) {
-			rwdObjecWd.setClassCode(classCode);
-			return this;
-		}
+        public Builder grouping(Integer grouping) {
+            rwdObjecWd.setGrouping(grouping);
+            return this;
+        }
 
-		public Builder grouping(Integer grouping) {
-			rwdObjecWd.setGrouping(grouping);
-			return this;
-		}
+        public Builder valid(Integer valid) {
+            rwdObjecWd.setValid(valid);
+            return this;
+        }
 
-		public Builder valid(Integer valid) {
-			rwdObjecWd.setValid(valid);
-			return this;
-		}
+//		public Builder infos(JSONObject infos) {
+//			rwdObjecWd.setInfos(infos);
+//			return this;
+//		}
 
-		public Builder infos(JSONObject infos) {
-			rwdObjecWd.setInfos(infos);
-			return this;
-		}
+        public Builder infos(String infos) {
+            rwdObjecWd.setInfos(infos);
+            return this;
+        }
 
-		public Builder virtualInfoCodes(JSONObject virtualInfoCodes) {
-			rwdObjecWd.setVirtualInfoCodes(virtualInfoCodes);
-			return this;
-		}
 
-		public Builder createTime(Date createTime) {
-			rwdObjecWd.setCreateTime(createTime);
-			return this;
-		}
+//		public Builder virtualInfoCodes(JSONObject virtualInfoCodes) {
+//			rwdObjecWd.setVirtualInfoCodes(virtualInfoCodes);
+//			return this;
 
-		public Builder updateTime(Date updateTime) {
-			rwdObjecWd.setUpdateTime(updateTime);
-			return this;
-		}
+        public Builder virtualInfoCodes(String virtualInfoCodes) {
+            rwdObjecWd.setVirtualInfoCodes(virtualInfoCodes);
+            return this;
+        }
 
-		public Builder createUser(String createUser) {
-			rwdObjecWd.setCreateUser(createUser);
-			return this;
-		}
+        public Builder createTime(Date createTime) {
+            rwdObjecWd.setCreateTime(createTime);
+            return this;
+        }
 
-		public Builder updateUser(String updateUser) {
-			rwdObjecWd.setUpdateUser(updateUser);
-			return this;
-		}
+        public Builder updateTime(Date updateTime) {
+            rwdObjecWd.setUpdateTime(updateTime);
+            return this;
+        }
 
-		public Builder createApp(String createApp) {
-			rwdObjecWd.setCreateApp(createApp);
-			return this;
-		}
-
-		public Builder updateApp(String updateApp) {
-			rwdObjecWd.setUpdateApp(updateApp);
-			return this;
-		}
-
-		public RwdObjecWd build() {
-			return rwdObjecWd;
-		}
-
-	}
+        public Builder createUser(String createUser) {
+            rwdObjecWd.setCreateUser(createUser);
+            return this;
+        }
+
+        public Builder updateUser(String updateUser) {
+            rwdObjecWd.setUpdateUser(updateUser);
+            return this;
+        }
+
+        public Builder createApp(String createApp) {
+            rwdObjecWd.setCreateApp(createApp);
+            return this;
+        }
+
+        public Builder updateApp(String updateApp) {
+            rwdObjecWd.setUpdateApp(updateApp);
+            return this;
+        }
+
+        public RwdObjecWd build() {
+            return rwdObjecWd;
+        }
+
+    }
 }

+ 11 - 11
src/main/java/com/persagy/transfer/pojo/dto/WdclassRelPersagy.java

@@ -33,7 +33,7 @@ public class WdclassRelPersagy extends BaseEntity<WdclassRelPersagy> {
 	private String classCode; // BDTP类编码
 
 	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String classstrucrureid;//万达设备分类ID
+	private String classstructureid;//万达设备分类ID
 	
 	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
 	private String wdClassCode; // 万达类编码
@@ -47,7 +47,7 @@ public class WdclassRelPersagy extends BaseEntity<WdclassRelPersagy> {
 
 	public static class BuilderQueryWrapper {
 
-		private LambdaQueryWrapper<WdclassRelPersagy> queryWrapper = new LambdaQueryWrapper<WdclassRelPersagy>();
+		private LambdaQueryWrapper<WdclassRelPersagy> queryWrapper = new LambdaQueryWrapper<>();
 
 		public BuilderQueryWrapper idEq(String id) {
 			if (StringUtil.isNotBlank(id)) {
@@ -63,9 +63,9 @@ public class WdclassRelPersagy extends BaseEntity<WdclassRelPersagy> {
 			return this;
 		}
 		
-		public BuilderQueryWrapper classstrucrureidEq(String classstrucrureid) {
-			if (StringUtil.isNotBlank(classstrucrureid)) {
-				queryWrapper.eq(WdclassRelPersagy::getClassstrucrureid, classstrucrureid);
+		public BuilderQueryWrapper classstructureidEq(String classstructureid) {
+			if (StringUtil.isNotBlank(classstructureid)) {
+				queryWrapper.eq(WdclassRelPersagy::getClassstructureid, classstructureid);
 			}
 			return this;
 		}
@@ -92,7 +92,7 @@ public class WdclassRelPersagy extends BaseEntity<WdclassRelPersagy> {
 
 	public static class BuilderUpdateWrapper {
 
-		private LambdaUpdateWrapper<WdclassRelPersagy> updateWrapper = new LambdaUpdateWrapper<WdclassRelPersagy>();
+		private LambdaUpdateWrapper<WdclassRelPersagy> updateWrapper = new LambdaUpdateWrapper<>();
 
 		public BuilderUpdateWrapper idEq(String id) {
 			if (StringUtil.isNotBlank(id)) {
@@ -108,9 +108,9 @@ public class WdclassRelPersagy extends BaseEntity<WdclassRelPersagy> {
 			return this;
 		}
 		
-		public BuilderUpdateWrapper classstrucrureidEq(String classstrucrureid) {
-			if (StringUtil.isNotBlank(classstrucrureid)) {
-				updateWrapper.eq(WdclassRelPersagy::getClassstrucrureid, classstrucrureid);
+		public BuilderUpdateWrapper classstructureidEq(String classstructureid) {
+			if (StringUtil.isNotBlank(classstructureid)) {
+				updateWrapper.eq(WdclassRelPersagy::getClassstructureid, classstructureid);
 			}
 			return this;
 		}
@@ -149,8 +149,8 @@ public class WdclassRelPersagy extends BaseEntity<WdclassRelPersagy> {
 			return this;
 		}
 		
-		public Builder classstrucrureid(String classstrucrureid) {
-			wdclassRelPersagy.setClassstrucrureid(classstrucrureid);
+		public Builder classstructureid(String classstructureid) {
+			wdclassRelPersagy.setClassstructureid(classstructureid);
 			return this;
 		}
 		

+ 11 - 11
src/main/java/com/persagy/transfer/pojo/dto/WdfacilityRelPersagy.java

@@ -36,7 +36,7 @@ public class WdfacilityRelPersagy extends BaseEntity<WdfacilityRelPersagy> {
 	private String wdClassCode; // 万达设备类编码
 
 	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
-	private String classstrucrureid; // 万达设备分类表id
+	private String classstructureid; // 万达设备分类表id
 
 	@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
 	private String assetattrid; // 万达设备参数id
@@ -62,7 +62,7 @@ public class WdfacilityRelPersagy extends BaseEntity<WdfacilityRelPersagy> {
 
 	public static class BuilderQueryWrapper {
 
-		private LambdaQueryWrapper<WdfacilityRelPersagy> queryWrapper = new LambdaQueryWrapper<WdfacilityRelPersagy>();
+		private LambdaQueryWrapper<WdfacilityRelPersagy> queryWrapper = new LambdaQueryWrapper<>();
 
 		public BuilderQueryWrapper idEq(String id) {
 			if (StringUtil.isNotBlank(id)) {
@@ -85,9 +85,9 @@ public class WdfacilityRelPersagy extends BaseEntity<WdfacilityRelPersagy> {
 			return this;
 		}
 
-		public BuilderQueryWrapper classstrucrureidEq(String classstrucrureid) {
-			if (StringUtil.isNotBlank(classstrucrureid)) {
-				queryWrapper.eq(WdfacilityRelPersagy::getClassstrucrureid, classstrucrureid);
+		public BuilderQueryWrapper classstructureidEq(String classstructureid) {
+			if (StringUtil.isNotBlank(classstructureid)) {
+				queryWrapper.eq(WdfacilityRelPersagy::getClassstructureid, classstructureid);
 			}
 			return this;
 		}
@@ -142,7 +142,7 @@ public class WdfacilityRelPersagy extends BaseEntity<WdfacilityRelPersagy> {
 
 	public static class BuilderUpdateWrapper {
 
-		private LambdaUpdateWrapper<WdfacilityRelPersagy> updateWrapper = new LambdaUpdateWrapper<WdfacilityRelPersagy>();
+		private LambdaUpdateWrapper<WdfacilityRelPersagy> updateWrapper = new LambdaUpdateWrapper<>();
 
 		public BuilderUpdateWrapper idEq(String id) {
 			if (StringUtil.isNotBlank(id)) {
@@ -165,9 +165,9 @@ public class WdfacilityRelPersagy extends BaseEntity<WdfacilityRelPersagy> {
 			return this;
 		}
 
-		public BuilderUpdateWrapper classstrucrureidEq(String classstrucrureid) {
-			if (StringUtil.isNotBlank(classstrucrureid)) {
-				updateWrapper.eq(WdfacilityRelPersagy::getClassstrucrureid, classstrucrureid);
+		public BuilderUpdateWrapper classstructureidEq(String classstructureid) {
+			if (StringUtil.isNotBlank(classstructureid)) {
+				updateWrapper.eq(WdfacilityRelPersagy::getClassstructureid, classstructureid);
 			}
 			return this;
 		}
@@ -239,8 +239,8 @@ public class WdfacilityRelPersagy extends BaseEntity<WdfacilityRelPersagy> {
 			return this;
 		}
 
-		public Builder classstrucrureid(String classstrucrureid) {
-			wdfacilityRelPersagy.setClassstrucrureid(classstrucrureid);
+		public Builder classstructureid(String classstructureid) {
+			wdfacilityRelPersagy.setClassstructureid(classstructureid);
 			return this;
 		}
 

+ 0 - 7
src/main/java/com/persagy/transfer/service/IDemoService.java

@@ -12,12 +12,5 @@ public interface IDemoService {
 
     Object getDataByMasterOne();
 
-    Object getDataByMasterTwo();
 
-    /**
-     * @author YangWanYi
-     * @describe 向万达数据库同步设备数据
-     * @date 2021/9/16 11:38
-     */
-    void syncData2WD();
 }

+ 11 - 0
src/main/java/com/persagy/transfer/service/PersagyDbService.java

@@ -0,0 +1,11 @@
+package com.persagy.transfer.service;
+
+public interface PersagyDbService {
+
+    /**
+     * @author YangWanYi
+     * @describe 向万达数据库同步设备数据
+     * @date 2021/9/16 11:38
+     */
+    void syncData2WD();
+}

+ 56 - 0
src/main/java/com/persagy/transfer/service/WdDbService.java

@@ -0,0 +1,56 @@
+package com.persagy.transfer.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.transfer.pojo.dto.HydomcAsset;
+import com.persagy.transfer.pojo.dto.HydomcAssetspec;
+import com.persagy.transfer.pojo.dto.WdfacilityRelPersagy;
+
+import java.util.List;
+
+public interface WdDbService {
+    Object getDataByMasterTwo();
+
+    /**
+     * @param primaryKey 万达设备信息主表主键
+     * @return com.persagy.transfer.pojo.dto.HydomcAsset
+     * @author YangWanYi
+     * @describe 根据主键获取万达设备信息
+     * @date 2021/9/16 15:31
+     */
+    HydomcAsset getHydomcAssetByPKey(String primaryKey);
+
+    /**
+     * @param infosObj         博锐尚格项目表的infos字段值
+     * @param wdProjectId      博锐尚格项目ID映射的万达项目ID
+     * @param hydomcAsset      万达设备信息对象
+     * @param valid            项目数据对象状态:1有效,0无效
+     * @param updateTime       项目最后更新时间
+     * @param classstrucrureid 万达设备分类ID
+     * @author YangWanYi
+     * @describe 万达设备信息对象数据同步
+     * @date 2021/9/16 16:00
+     */
+    void sycnHydomcAsset(JSONObject infosObj, String wdProjectId, HydomcAsset hydomcAsset, Integer valid, java.util.Date updateTime, String classstrucrureid);
+
+    /**
+     * @param wdfacilityRelList 筛选后的万达设备参数信息表与博锐尚格信息点的映射表数据
+     * @param wdProjectid       万达项目ID(广场ID)
+     * @param infosObj          博锐尚格项目表的infos字段值
+     * @param updateTime        项目最后更新时间
+     * @author YangWanYi
+     * @describe 同步万达设备参数对象数据
+     * @date 2021/9/16 18:56
+     */
+    void sycnHydomcAssetspec(List<WdfacilityRelPersagy> wdfacilityRelList, String wdProjectid, JSONObject infosObj, java.util.Date updateTime);
+
+    /**
+     * @param siteId      关联的设备信息字段 广场ID 即万达项目ID
+     * @param sbybm       关联的设备信息字段 设备编码
+     * @param assetAttrId 设备分类ID
+     * @return com.persagy.transfer.pojo.dto.HydomcAssetspec
+     * @author YangWanYi
+     * @describe 根据SITEID、SBYBM、ASSETATTRID查询万达设备信息表数据
+     * @date 2021/9/17 10:13
+     */
+    HydomcAssetspec getHydomcAssetspec(String siteId, String sbybm, String assetAttrId);
+}

+ 1 - 271
src/main/java/com/persagy/transfer/service/impl/DemoService.java

@@ -1,23 +1,13 @@
 package com.persagy.transfer.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.persagy.transfer.constant.InfosKeyConstant;
 import com.persagy.transfer.constant.SwitchConstant;
-import com.persagy.transfer.mapper.*;
-import com.persagy.transfer.pojo.dto.*;
+import com.persagy.transfer.mapper.MasterOneMapper;
 import com.persagy.transfer.service.IDemoService;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.sql.Date;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
 /**
  * 多数据源测试
  *
@@ -34,269 +24,9 @@ public class DemoService implements IDemoService {
     @Autowired
     private MasterOneMapper masterOneMapper;
 
-    @Autowired
-    private MasterTwoMapper masterTwoMapper;
-
-    @Autowired
-    private WdclassRelPersagyMapper wdclassRelPersagyMapper;
-
-    @Autowired
-    private WdprojRelPersagyprojMapper wdprojRelPersagyprojMapper;
-
-    @Autowired
-    private RwdObjecWdMapper rwdObjecWdMapper;
-
-    @Autowired
-    private WdfacilityRelPersagyMapper wdfacilityRelPersagyMapper;
-
-    @Autowired
-    private HydomcAssetMapper hydomcAssetMapper;
-
-    @Autowired
-    private HydomcAssetspecMapper hydomcAssetspecMapper;
-
     @Override
     public Object getDataByMasterOne() {
         return this.masterOneMapper.queryOne();
     }
 
-    @Override
-    @DS(value = SwitchConstant.DS_MASTER_2)
-    public Object getDataByMasterTwo() {
-        return this.masterTwoMapper.queryTwo();
-    }
-
-    /**
-     * @author YangWanYi
-     * @describe 向万达数据库同步设备数据
-     * @date 2021/9/16 11:38
-     */
-    @Override
-    public void syncData2WD() {
-        /*
-            处理逻辑
-            1、获取表wdclass_rel_persagy去重class_code的数据
-            2、获取表wdproj_rel_persagyproj去重博锐尚格项目ID的数据
-            3、根据1的class_code,2的persagy_project_id、obj_type='equipment',获取表rwd_object_wd_*的数据
-            4、对应数据进行insert或者update或者delete
-         */
-
-        // 1.获取表wdclass_rel_persagy去重class_code的数据
-        log.info("准备同步设备数据到万达数据库");
-        LambdaQueryWrapper<WdclassRelPersagy> queryWdclassRelWrapper = new WdclassRelPersagy.BuilderQueryWrapper().builder();
-        List<WdclassRelPersagy> funcList = this.wdclassRelPersagyMapper.selectList(queryWdclassRelWrapper);
-
-        // 2.获取表wdproj_rel_persagyproj所有数据
-        LambdaQueryWrapper<WdprojRelPersagyproj> queryProjRelWrapper = new WdprojRelPersagyproj.BuilderQueryWrapper().builder();
-        List<WdprojRelPersagyproj> projList = this.wdprojRelPersagyprojMapper.selectList(queryProjRelWrapper);
-
-        // 3.遍历获取rwd_object_wd_?的数据
-        List<RwdObjecWd> rwdObjecWdList;
-        final String OBJ_TYPE = "equipment"; // 对象分类(设备类)
-        List<String> classCodeList = new ArrayList<>();
-        List<String> persagyProjectIdList = new ArrayList<>();
-        for (WdclassRelPersagy wdclassRelPersagy : funcList) {
-            for (WdprojRelPersagyproj wdprojRelPersagyproj : projList) {
-                // classCode和persagyProjectid去重
-                if (classCodeList.contains(wdclassRelPersagy.getClassCode()) || persagyProjectIdList.contains(wdprojRelPersagyproj.getPersagyProjectid())) {
-                    log.info("有已经处理过的BDTP类编码或者博锐尚格项目id,准备跳过此次处理");
-                    continue;
-                }
-                classCodeList.add(wdclassRelPersagy.getClassCode());
-                persagyProjectIdList.add(wdprojRelPersagyproj.getPersagyProjectid());
-                // 根据外循环对象的classCode、objType='equipment',内循环对象的persagyProjectId,查询wd_object_wd_?表
-                rwdObjecWdList = this.rwdObjecWdMapper.listByProjectId(wdclassRelPersagy.getClassCode(), OBJ_TYPE, wdprojRelPersagyproj.getPersagyProjectid());
-                if (rwdObjecWdList != null && !rwdObjecWdList.isEmpty()) {
-                    this.handleFieldMapping(rwdObjecWdList, wdprojRelPersagyproj, wdclassRelPersagy);
-                }
-            }
-        }
-    }
-
-    /**
-     * @param rwdObjecWdList       博锐尚格的项目对象
-     * @param wdprojRelPersagyproj 万达项目ID与博锐尚格项目ID映射表实体
-     * @author YangWanYi
-     * @describe 同步万达设备数据的新增与更新
-     * @date 2021/9/16 14:19
-     */
-    private void handleFieldMapping(List<RwdObjecWd> rwdObjecWdList, WdprojRelPersagyproj wdprojRelPersagyproj, WdclassRelPersagy wdclassRelPersagy) {
-        JSONObject infosObj;
-        HydomcAsset hydomcAsset = null; // 万达数据库的设备信息表实体
-        List<WdfacilityRelPersagy> wdfacilityRelList = null;
-        for (RwdObjecWd rwdObjecWd : rwdObjecWdList) {
-            infosObj = rwdObjecWd.getInfos();
-            /*万达设备信息对象数据同步*/
-            this.sycnHydomcAsset(infosObj, wdprojRelPersagyproj.getWdProjectid(), hydomcAsset, rwdObjecWd.getValid(), rwdObjecWd.getUpdateTime(), wdclassRelPersagy.getClassstrucrureid());
-            /*万达设备参数信息数据同步*/
-            if (wdfacilityRelList == null) { // 循环万达项目ID与博锐尚格项目ID映射表数据时,wdfacility_rel_persagy只查询一次
-                wdfacilityRelList = this.listWdfacilityRelPersagy(wdclassRelPersagy.getWdClassCode(), wdclassRelPersagy.getClassstrucrureid());
-            }
-            this.sycnHydomcAssetspec(wdfacilityRelList, wdprojRelPersagyproj.getWdProjectid(), infosObj, rwdObjecWd.getUpdateTime());
-        }
-    }
-
-    /**
-     * @param wdfacilityRelList 筛选后的万达设备参数信息表与博锐尚格信息点的映射表数据
-     * @param wdProjectid       万达项目ID(广场ID)
-     * @param infosObj          博锐尚格项目表的infos字段值
-     * @param updateTime        项目最后更新时间
-     * @author YangWanYi
-     * @describe 同步万达设备参数对象数据
-     * @date 2021/9/16 18:56
-     */
-    @DS(value = SwitchConstant.DS_MASTER_2)
-    private void sycnHydomcAssetspec(List<WdfacilityRelPersagy> wdfacilityRelList, String wdProjectid, JSONObject infosObj, java.util.Date updateTime) {
-        log.info("准备同步万达设备参数对象数据");
-        boolean isInsert = false; // 默认操作类型为更新
-        HydomcAssetspec hydomcAssetspec;
-        final String IS_NUMBER = "数字";
-        final String IS_LETTER = "字母";
-        for (WdfacilityRelPersagy wdfacilityRelPersagy : wdfacilityRelList) {
-            // 根据万达设备信息表的主键查询数据是否存在
-            hydomcAssetspec = this.getHydomcAssetspecByPKey(wdfacilityRelPersagy.getAssetattrid());
-            if (hydomcAssetspec == null) {
-                hydomcAssetspec = new HydomcAssetspec(); // 万达设备参数信息表实体
-                isInsert = true; // 万达数据库没有这条数据 需要新增
-            }
-            hydomcAssetspec.setSiteid(wdProjectid); // 广场id 关联设备信息 Pj4403070003
-            if (!infosObj.isEmpty()) {
-                hydomcAssetspec.setSbybm(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_CODE))); // 设备编码 关联设备信息 wD_gongchengxinxihua
-                hydomcAssetspec.setClassstructureid(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_SORT))); // 设备分类id 1507
-                // 根据Datatype判断设置设备参数数字值还是设备参数文本值 key为wdfacility_rel_persagy的code值从infos取
-                if (IS_NUMBER.equals(wdfacilityRelPersagy.getDatatype())) { // 是数字
-                    log.info("dataType是数字");
-                    hydomcAssetspec.setNumvalue(Double.valueOf(String.valueOf(infosObj.get(wdfacilityRelPersagy.getCode())))); // 设备参数数字值 (取自infos)
-                } else if (IS_LETTER.equals(wdfacilityRelPersagy.getDatatype())) { // 是字母
-                    log.info("dataType是字母");
-                    hydomcAssetspec.setAlnvalue(String.valueOf(infosObj.get(wdfacilityRelPersagy.getCode()))); // 设备参数文本值 (取自infos)
-                }
-                // key为wdfacility_rel_persagy的code值从infos取 有值update 无值(空、空字符串)就是delete
-                if (StringUtils.isBlank(String.valueOf(infosObj.get(wdfacilityRelPersagy.getCode())))) {
-                    // 无值 delete
-                    log.info("code没有值,数据状态设置为delete");
-                    hydomcAssetspec.setDatastatus(SwitchConstant.IS_DELETE); // 数据状态 update/delete
-                } else {
-                    // 有值 update
-                    log.info("code有值,数据状态设置为update");
-                    hydomcAssetspec.setDatastatus(SwitchConstant.IS_UPDATE); // 数据状态 update/delete
-                }
-            }
-            hydomcAssetspec.setClassqc(wdfacilityRelPersagy.getClassqc()); // 设备分类名称 电梯系统/扶梯/人行步道 (取自中间表wdfacility_rel_persagy)
-            hydomcAssetspec.setAssetattrid(wdfacilityRelPersagy.getAssetattrid()); // 主键 设备参数id 1106 (取自中间表wdfacility_rel_persagy)
-            hydomcAssetspec.setCsdesc(wdfacilityRelPersagy.getCsdesc()); // 设备参数名称 (取自中间表wdfacility_rel_persagy)
-            hydomcAssetspec.setDatatype(wdfacilityRelPersagy.getDatatype()); // 设备参数类型 (取自中间表wdfacility_rel_persagy)
-            hydomcAssetspec.setMeasureunitid(wdfacilityRelPersagy.getMeasureunitid()); // 设备参数单位编码 (取自中间表wdfacility_rel_persagy)
-            hydomcAssetspec.setCsjldw(wdfacilityRelPersagy.getCsjldw()); // 设备参数单位名称 (取自中间表wdfacility_rel_persagy)
-            hydomcAssetspec.setChangedate(updateTime); // 数据更新时间 增量字段
-            if (isInsert) {
-                this.hydomcAssetspecMapper.insert(hydomcAssetspec);
-            } else {
-                this.hydomcAssetspecMapper.updateById(hydomcAssetspec);
-            }
-        }
-    }
-
-
-    /**
-     * @param primaryKey 万达设备参数信息表主键
-     * @return com.persagy.transfer.pojo.dto.HydomcAssetspec
-     * @author YangWanYi
-     * @describe 根据主键查询设备参数信息
-     * @date 2021/9/16 18:17
-     */
-    @DS(value = SwitchConstant.DS_MASTER_2)
-    private HydomcAssetspec getHydomcAssetspecByPKey(String primaryKey) {
-        return this.hydomcAssetspecMapper.selectById(primaryKey);
-    }
-
-    /**
-     * @param wdClassCode      万达设备类编码 (从wdclass_rel_persagy获取)
-     * @param classStrucrureId 万达设备分类表id (从wdclass_rel_persagy获取)
-     * @return java.util.List<com.persagy.transfer.pojo.dto.WdfacilityRelPersagy>
-     * @author YangWanYi
-     * @describe 根据万达设备类编码和万达设备分类表id查询表wdfacility_rel_persagy数据
-     * @date 2021/9/16 17:49
-     */
-    private List<WdfacilityRelPersagy> listWdfacilityRelPersagy(String wdClassCode, String classStrucrureId) {
-        HashMap<String, Object> columnMap = new HashMap<>();
-        columnMap.put("wdClassCode", wdClassCode); // 万达设备类编码
-        columnMap.put("classstrucrureid", classStrucrureId); // 万达设备分类表id
-        return this.wdfacilityRelPersagyMapper.selectByMap(columnMap);
-    }
-
-    /**
-     * @param infosObj         博锐尚格项目表的infos字段值
-     * @param wdProjectId      博锐尚格项目ID映射的万达项目ID
-     * @param hydomcAsset      万达设备信息对象
-     * @param valid            项目数据对象状态:1有效,0无效
-     * @param updateTime       项目最后更新时间
-     * @param classstrucrureid 万达设备分类ID
-     * @return int
-     * @author YangWanYi
-     * @describe 万达设备信息对象数据同步
-     * @date 2021/9/16 16:00
-     */
-    @DS(value = SwitchConstant.DS_MASTER_2)
-    private int sycnHydomcAsset(JSONObject infosObj, String wdProjectId, HydomcAsset hydomcAsset, Integer valid, java.util.Date updateTime, String classstrucrureid) {
-        log.info("准备同步万达设备信息对象数据");
-        boolean isInsert = false; // 默认操作类型为更新
-        if (!infosObj.isEmpty()) {
-            // 根据万达设备信息表的主键查询数据是否存在
-            hydomcAsset = this.getHydomcAssetByPKey(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_CODE)));
-            if (hydomcAsset == null) {
-                hydomcAsset = new HydomcAsset(); // 万达设备信息主表实体
-                isInsert = true; // 万达数据库没有这条数据 需要新增
-            }
-            hydomcAsset.setSbybm(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_CODE))); // 主键  无其他主键可采用设备编码为主键,但要确保唯一(工程信息化设备原码)
-            hydomcAsset.setDescription(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_NAME))); // 设备名称
-            // hydomcAsset.setWzqy(); // 详细设备安装位置,格式:楼体-楼层-区域 没有key 后续补充
-            hydomcAsset.setFwqy(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_SERVICE_ZONE))); // 设备服务区域 设备/系统服务范围
-            hydomcAsset.setSbxh(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_MODEL))); // 厂商设备型号
-            hydomcAsset.setClassstructureid(classstrucrureid); // 对接设备分类id,同步后不可更改
-            hydomcAsset.setStatus(valid == 0 ? SwitchConstant.SCRAP : SwitchConstant.RUNNING); // 设备状态 运行中/报废    默认都为运行中
-            hydomcAsset.setSbxhh(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_IDX))); // 设备序号 同类设备的序号,即第几台设备:第几台电梯
-            hydomcAsset.setCjsbxh(String.valueOf(infosObj.get(InfosKeyConstant.SERIAL_NUM))); // 厂家设备序列号
-            hydomcAsset.setManufacturer(String.valueOf(infosObj.get(InfosKeyConstant.MANUFACTURER))); // 生产商公司供方管理系统编码code
-            hydomcAsset.setVendor(String.valueOf(infosObj.get(InfosKeyConstant.SUPPLIER))); // 供应商公司供方管理系统编码code
-            hydomcAsset.setFws(String.valueOf(infosObj.get(InfosKeyConstant.MAINTAINER))); // 服务商公司供方管理系统编码code
-            hydomcAsset.setPurchaseprice(Double.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.PURCHASE_PRICE)))); // 采购金额 填写人民币元
-            hydomcAsset.setZjsynx(Double.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.SERVICE_LIFE)))); // 折旧/使用年限 按年填写 如3年半则填写 3.5
-            hydomcAsset.setScrq(Date.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.PRODUCT_DATE)))); // 生产日期/出厂日期 年/月/日
-            hydomcAsset.setCgrq(Date.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.PURCHASE_DATE)))); // 采购日期
-            hydomcAsset.setAzdate(Date.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.INSTALL_DATE)))); // 安装日期
-            hydomcAsset.setInstalldate(Date.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.ENABLE_DATE)))); // 启用日期
-            hydomcAsset.setZbksrq(Date.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.WARRANTY_START_DATE)))); // 质保开始日期
-            hydomcAsset.setZbjsrq(Date.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.WARRANTY_END_DATE)))); // 质保结束日期
-            hydomcAsset.setZxzq(Integer.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.MEDIUM_REPAIR_CYCLE)))); // 中修周期 单位为月
-            hydomcAsset.setDxzq(Integer.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.OVERHAUL_CYCLE)))); // 大修周期 单位为月
-            hydomcAsset.setWylx(String.valueOf(infosObj.get(InfosKeyConstant.PROPERTY_TYPE))); // 物业类型 自持/销售/合作方
-            hydomcAsset.setSbglgs(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_MANAGE_OWNERSHIP))); // 设备管理归属 商管/百货/大歌星/超市/影院/大酒楼/其他
-            hydomcAsset.setHysbbm(String.valueOf(infosObj.get(InfosKeyConstant.WISDOM_CLOUD_LOCAL_CODE))); // 慧云设备编码
-            hydomcAsset.setSfhysy(String.valueOf(infosObj.get(InfosKeyConstant.WISDOM_CLOUD_USE))); // 是否慧云使用 是/否   缺省为 是
-            hydomcAsset.setSfzld(String.valueOf(infosObj.get(InfosKeyConstant.MAIN_STORE))); // 是否是主力店 缺省为 否
-            hydomcAsset.setMark(String.valueOf(infosObj.get(InfosKeyConstant.REMARK))); // 备注 wD_beizhu
-        }
-        hydomcAsset.setSiteid(wdProjectId); // 项目唯一id,可采用租赁系统广场id,同步后不可更改
-        hydomcAsset.setDatastatus(valid == 0 ? SwitchConstant.IS_DELETE : SwitchConstant.IS_UPDATE); // 数据状态 update/delete 当数据状态为delete时,设备状态需改为报废
-        hydomcAsset.setChangedate(updateTime); // 数据更新时间 增量字段
-        if (isInsert) {
-            return this.hydomcAssetMapper.insert(hydomcAsset);
-        } else {
-            return this.hydomcAssetMapper.updateById(hydomcAsset);
-        }
-    }
-
-    /**
-     * @param primaryKey 万达设备信息主表主键
-     * @return com.persagy.transfer.pojo.dto.HydomcAsset
-     * @author YangWanYi
-     * @describe 根据主键获取万达设备信息
-     * @date 2021/9/16 15:31
-     */
-    @DS(value = SwitchConstant.DS_MASTER_2)
-    private HydomcAsset getHydomcAssetByPKey(String primaryKey) {
-        return this.hydomcAssetMapper.selectById(primaryKey);
-    }
-
 }

+ 135 - 0
src/main/java/com/persagy/transfer/service/impl/PersagyDbServiceImpl.java

@@ -0,0 +1,135 @@
+package com.persagy.transfer.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.common.utils.StringUtil;
+import com.persagy.transfer.constant.SwitchConstant;
+import com.persagy.transfer.mapper.RwdObjecWdMapper;
+import com.persagy.transfer.mapper.WdclassRelPersagyMapper;
+import com.persagy.transfer.mapper.WdfacilityRelPersagyMapper;
+import com.persagy.transfer.mapper.WdprojRelPersagyprojMapper;
+import com.persagy.transfer.pojo.dto.*;
+import com.persagy.transfer.service.PersagyDbService;
+import com.persagy.transfer.service.WdDbService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @description: 博锐尚格数据源业务处理
+ * @author: YangWanYi
+ * @create: 2021-09-16 20:29
+ **/
+@Service
+@DS(value = SwitchConstant.DS_MASTER_1)
+@Slf4j
+public class PersagyDbServiceImpl implements PersagyDbService {
+
+    @Autowired
+    private WdDbService wdDbService;
+
+    @Autowired
+    private WdclassRelPersagyMapper wdclassRelPersagyMapper;
+
+    @Autowired
+    private WdprojRelPersagyprojMapper wdprojRelPersagyprojMapper;
+
+    @Autowired
+    private RwdObjecWdMapper rwdObjecWdMapper;
+
+    @Autowired
+    private WdfacilityRelPersagyMapper wdfacilityRelPersagyMapper;
+
+    /**
+     * @author YangWanYi
+     * @describe 向万达数据库同步设备数据
+     * @date 2021/9/16 11:38
+     */
+    @Override
+    public void syncData2WD() {
+        /*
+            处理逻辑
+            1、获取表wdclass_rel_persagy去重class_code的数据
+            2、获取表wdproj_rel_persagyproj去重博锐尚格项目ID的数据
+            3、根据1的class_code,2的persagy_project_id、obj_type='equipment',获取表rwd_object_wd_*的数据
+            4、对应数据进行insert或者update或者delete
+         */
+
+        // 1.获取表wdclass_rel_persagy去重class_code的数据
+        log.info("准备同步设备数据到万达数据库");
+        LambdaQueryWrapper<WdclassRelPersagy> queryWdclassRelWrapper = new WdclassRelPersagy.BuilderQueryWrapper().builder();
+        List<WdclassRelPersagy> funcList = this.wdclassRelPersagyMapper.selectList(queryWdclassRelWrapper);
+
+        // 2.获取表wdproj_rel_persagyproj所有数据
+        LambdaQueryWrapper<WdprojRelPersagyproj> queryProjRelWrapper = new WdprojRelPersagyproj.BuilderQueryWrapper().builder();
+        List<WdprojRelPersagyproj> projList = this.wdprojRelPersagyprojMapper.selectList(queryProjRelWrapper);
+
+        // 3.遍历获取rwd_object_wd_?的数据
+        List<RwdObjecWd> rwdObjecWdList;
+        final String OBJ_TYPE = "equipment"; // 对象分类(设备类)
+        List<String> classCodeList = new ArrayList<>();
+        List<String> persagyProjectIdList = new ArrayList<>();
+        for (WdclassRelPersagy wdclassRelPersagy : funcList) {
+            for (WdprojRelPersagyproj wdprojRelPersagyproj : projList) {
+                // classCode和persagyProjectid去重
+                if (classCodeList.contains(wdclassRelPersagy.getClassCode()) || persagyProjectIdList.contains(wdprojRelPersagyproj.getPersagyProjectid())) {
+                    log.info("有已经处理过的BDTP类编码或者博锐尚格项目id,准备跳过此次处理");
+                    continue;
+                }
+                classCodeList.add(wdclassRelPersagy.getClassCode());
+                persagyProjectIdList.add(wdprojRelPersagyproj.getPersagyProjectid());
+                // 根据外循环对象的classCode、objType='equipment',内循环对象的persagyProjectId,查询wd_object_wd_?表
+                rwdObjecWdList = this.rwdObjecWdMapper.listByProjectId(wdclassRelPersagy.getClassCode(), OBJ_TYPE, StringUtil.lowerFirst(wdprojRelPersagyproj.getPersagyProjectid()));
+                if (rwdObjecWdList != null && !rwdObjecWdList.isEmpty()) {
+                    this.handleFieldMapping(rwdObjecWdList, wdprojRelPersagyproj, wdclassRelPersagy);
+                }
+            }
+        }
+    }
+
+    /**
+     * @param rwdObjecWdList       博锐尚格的项目对象
+     * @param wdprojRelPersagyproj 万达项目ID与博锐尚格项目ID映射表实体
+     * @author YangWanYi
+     * @describe 同步万达设备数据的新增与更新
+     * @date 2021/9/16 14:19
+     */
+    private void handleFieldMapping(List<RwdObjecWd> rwdObjecWdList, WdprojRelPersagyproj wdprojRelPersagyproj, WdclassRelPersagy wdclassRelPersagy) {
+        JSONObject infosObj;
+        HydomcAsset hydomcAsset = null; // 万达数据库的设备信息表实体
+        List<WdfacilityRelPersagy> wdfacilityRelList = null;
+        for (RwdObjecWd rwdObjecWd : rwdObjecWdList) {
+            infosObj = JSONObject.parseObject(rwdObjecWd.getInfos());
+            if (infosObj != null && !infosObj.isEmpty()) {
+                /*万达设备信息对象数据同步*/
+                this.wdDbService.sycnHydomcAsset(infosObj, wdprojRelPersagyproj.getWdProjectid(), hydomcAsset, rwdObjecWd.getValid(), rwdObjecWd.getUpdateTime(), wdclassRelPersagy.getClassstructureid());
+                /*万达设备参数信息数据同步*/
+                if (wdfacilityRelList == null) { // 循环万达项目ID与博锐尚格项目ID映射表数据时,wdfacility_rel_persagy只查询一次
+                    wdfacilityRelList = this.listWdfacilityRelPersagy(wdclassRelPersagy.getWdClassCode(), wdclassRelPersagy.getClassstructureid());
+                }
+                this.wdDbService.sycnHydomcAssetspec(wdfacilityRelList, wdprojRelPersagyproj.getWdProjectid(), infosObj, rwdObjecWd.getUpdateTime());
+            }
+        }
+    }
+
+
+    /**
+     * @param wdClassCode      万达设备类编码 (从wdclass_rel_persagy获取)
+     * @param classStructureId 万达设备分类表id (从wdclass_rel_persagy获取)
+     * @return java.util.List<com.persagy.transfer.pojo.dto.WdfacilityRelPersagy>
+     * @author YangWanYi
+     * @describe 根据万达设备类编码和万达设备分类表id查询表wdfacility_rel_persagy数据
+     * @date 2021/9/16 17:49
+     */
+    private List<WdfacilityRelPersagy> listWdfacilityRelPersagy(String wdClassCode, String classStructureId) {
+        HashMap<String, Object> columnMap = new HashMap<>();
+        columnMap.put("wd_class_code", wdClassCode); // 万达设备类编码
+        columnMap.put("classstructureid", classStructureId); // 万达设备分类表id
+        return this.wdfacilityRelPersagyMapper.selectByMap(columnMap);
+    }
+}

+ 261 - 0
src/main/java/com/persagy/transfer/service/impl/WdDbServiceImpl.java

@@ -0,0 +1,261 @@
+package com.persagy.transfer.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.persagy.common.utils.IdGenerator;
+import com.persagy.transfer.constant.InfosKeyConstant;
+import com.persagy.transfer.constant.SwitchConstant;
+import com.persagy.transfer.mapper.HydomcAssetMapper;
+import com.persagy.transfer.mapper.HydomcAssetspecMapper;
+import com.persagy.transfer.mapper.MasterTwoMapper;
+import com.persagy.transfer.pojo.dto.HydomcAsset;
+import com.persagy.transfer.pojo.dto.HydomcAssetspec;
+import com.persagy.transfer.pojo.dto.WdfacilityRelPersagy;
+import com.persagy.transfer.service.WdDbService;
+import com.persagy.transfer.utils.StringTool;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @description: 万达数据源业务处理
+ * @author: YangWanYi
+ * @create: 2021-09-16 20:19
+ **/
+@Service
+@DS(value = SwitchConstant.DS_MASTER_2)
+@Slf4j
+public class WdDbServiceImpl implements WdDbService {
+
+    @Autowired
+    private MasterTwoMapper masterTwoMapper;
+
+    @Autowired
+    private HydomcAssetMapper hydomcAssetMapper;
+
+    @Autowired
+    private HydomcAssetspecMapper hydomcAssetspecMapper;
+
+    @Override
+    @DS(value = SwitchConstant.DS_MASTER_2)
+    public Object getDataByMasterTwo() {
+        return this.masterTwoMapper.queryTwo();
+    }
+
+    /**
+     * @param infosObj         博锐尚格项目表的infos字段值
+     * @param wdProjectId      博锐尚格项目ID映射的万达项目ID
+     * @param hydomcAsset      万达设备信息对象
+     * @param valid            项目数据对象状态:1有效,0无效
+     * @param updateTime       项目最后更新时间
+     * @param classstrucrureid 万达设备分类ID
+     * @author YangWanYi
+     * @describe 万达设备信息对象数据同步
+     * @date 2021/9/16 16:00
+     */
+    @DS(value = SwitchConstant.DS_MASTER_2)
+    public void sycnHydomcAsset(JSONObject infosObj, String wdProjectId, HydomcAsset hydomcAsset, Integer valid, java.util.Date updateTime, String classstrucrureid) {
+        log.info("准备同步万达设备信息对象数据");
+        // 根据万达设备信息表的主键查询数据是否存在
+        hydomcAsset = this.getHydomcAssetByPKey(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_CODE)));
+        if (hydomcAsset == null) {
+            log.info("万达数据库没有这条数据,准备新增");
+            hydomcAsset = new HydomcAsset(); // 万达设备信息主表实体
+            hydomcAsset.setSbybm(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_CODE))); // 主键  无其他主键可采用设备编码为主键,但要确保唯一(工程信息化设备原码)
+            hydomcAsset.setDescription(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_NAME))); // 设备名称
+            // hydomcAsset.setWzqy(); // 详细设备安装位置,格式:楼体-楼层-区域 没有key 后续补充
+            hydomcAsset.setFwqy(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_SERVICE_ZONE))); // 设备服务区域 设备/系统服务范围
+            hydomcAsset.setSbxh(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_MODEL))); // 厂商设备型号
+            hydomcAsset.setClassstructureid(classstrucrureid); // 对接设备分类id,同步后不可更改
+            hydomcAsset.setStatus(valid == 0 ? SwitchConstant.SCRAP : SwitchConstant.RUNNING); // 设备状态 运行中/报废    默认都为运行中
+            hydomcAsset.setSbxhh(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_IDX))); // 设备序号 同类设备的序号,即第几台设备:第几台电梯
+            hydomcAsset.setCjsbxh(String.valueOf(infosObj.get(InfosKeyConstant.SERIAL_NUM))); // 厂家设备序列号
+            hydomcAsset.setManufacturer(String.valueOf(infosObj.get(InfosKeyConstant.MANUFACTURER))); // 生产商公司供方管理系统编码code
+            hydomcAsset.setVendor(String.valueOf(infosObj.get(InfosKeyConstant.SUPPLIER))); // 供应商公司供方管理系统编码code
+            hydomcAsset.setFws(String.valueOf(infosObj.get(InfosKeyConstant.MAINTAINER))); // 服务商公司供方管理系统编码code
+            hydomcAsset.setPurchaseprice(Double.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.PURCHASE_PRICE)))); // 采购金额 填写人民币元
+            hydomcAsset.setZjsynx(StringTool.object2Double(infosObj.get(InfosKeyConstant.SERVICE_LIFE))); // 折旧/使用年限 按年填写 如3年半则填写 3.5
+            hydomcAsset.setScrq(StringTool.object2DateTime(infosObj.get(InfosKeyConstant.PRODUCT_DATE))); // 生产日期/出厂日期 年/月/日
+            hydomcAsset.setCgrq(StringTool.object2DateTime(infosObj.get(InfosKeyConstant.PURCHASE_DATE))); // 采购日期
+            hydomcAsset.setAzdate(StringTool.object2DateTime(infosObj.get(InfosKeyConstant.INSTALL_DATE))); // 安装日期
+            hydomcAsset.setInstalldate(StringTool.object2DateTime(infosObj.get(InfosKeyConstant.ENABLE_DATE))); // 启用日期
+            hydomcAsset.setZbksrq(StringTool.object2DateTime(infosObj.get(InfosKeyConstant.WARRANTY_START_DATE))); // 质保开始日期
+            hydomcAsset.setZbjsrq(StringTool.object2DateTime(infosObj.get(InfosKeyConstant.WARRANTY_END_DATE))); // 质保结束日期
+            hydomcAsset.setZxzq(StringTool.object2Integer(infosObj.get(InfosKeyConstant.MEDIUM_REPAIR_CYCLE))); // 中修周期 单位为月
+            hydomcAsset.setDxzq(StringTool.object2Integer(infosObj.get(InfosKeyConstant.OVERHAUL_CYCLE))); // 大修周期 单位为月
+            hydomcAsset.setWylx(String.valueOf(infosObj.get(InfosKeyConstant.PROPERTY_TYPE))); // 物业类型 自持/销售/合作方
+            hydomcAsset.setSbglgs(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_MANAGE_OWNERSHIP))); // 设备管理归属 商管/百货/大歌星/超市/影院/大酒楼/其他
+            hydomcAsset.setHysbbm(String.valueOf(infosObj.get(InfosKeyConstant.WISDOM_CLOUD_LOCAL_CODE))); // 慧云设备编码
+            hydomcAsset.setSfhysy(String.valueOf(infosObj.get(InfosKeyConstant.WISDOM_CLOUD_USE))); // 是否慧云使用 是/否   缺省为 是
+            hydomcAsset.setSfzld(String.valueOf(infosObj.get(InfosKeyConstant.MAIN_STORE))); // 是否是主力店 缺省为 否
+            hydomcAsset.setMark(String.valueOf(infosObj.get(InfosKeyConstant.REMARK))); // 备注 wD_beizhu
+            hydomcAsset.setSiteid(wdProjectId); // 项目唯一id,可采用租赁系统广场id,同步后不可更改
+            hydomcAsset.setDatastatus(valid == 0 ? SwitchConstant.IS_DELETE : SwitchConstant.IS_UPDATE); // 数据状态 update/delete 当数据状态为delete时,设备状态需改为报废
+            hydomcAsset.setChangedate(updateTime); // 数据更新时间 增量字段
+            this.hydomcAssetMapper.insert(hydomcAsset);
+        } else {
+            UpdateWrapper<HydomcAsset> updateWrapper = new UpdateWrapper<>();
+            // 数据更新时间 增量字段
+            if (valid == 0) {
+                log.info("万达数据库已经存在该条数据,且博锐尚格这条数据状态为无效,因此直接更新万达这条数据状态为delete即可");
+                updateWrapper.set("status", SwitchConstant.SCRAP); // 设备状态 运行中/报废    默认都为运行中
+                updateWrapper.set("datastatus", SwitchConstant.IS_DELETE); // 数据状态 update/delete 当数据状态为delete时,设备状态需改为报废
+            } else {
+                log.info("万达数据库已经存在该条数据,但博锐尚格这条数据状态为有效,因此需要更新所有字段");
+                updateWrapper.set("sbybm", String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_CODE))); // 主键  无其他主键可采用设备编码为主键,但要确保唯一(工程信息化设备原码)
+                updateWrapper.set("description", String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_NAME))); // 设备名称
+                // updateWrapper.setWzqy(); // 详细设备安装位置,格式:楼体-楼层-区域 没有key 后续补充
+                updateWrapper.set("fwqy", String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_SERVICE_ZONE))); // 设备服务区域 设备/系统服务范围
+                updateWrapper.set("sbxh", String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_MODEL))); // 厂商设备型号
+                updateWrapper.set("classstructureid", classstrucrureid); // 对接设备分类id,同步后不可更改
+                updateWrapper.set("status", SwitchConstant.RUNNING); // 设备状态 运行中/报废    默认都为运行中
+                updateWrapper.set("sbxhh", String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_IDX))); // 设备序号 同类设备的序号,即第几台设备:第几台电梯
+                updateWrapper.set("cjsbxh", String.valueOf(infosObj.get(InfosKeyConstant.SERIAL_NUM))); // 厂家设备序列号
+                updateWrapper.set("manufacturer", String.valueOf(infosObj.get(InfosKeyConstant.MANUFACTURER))); // 生产商公司供方管理系统编码code
+                updateWrapper.set("vendor", String.valueOf(infosObj.get(InfosKeyConstant.SUPPLIER))); // 供应商公司供方管理系统编码code
+                updateWrapper.set("fws", String.valueOf(infosObj.get(InfosKeyConstant.MAINTAINER))); // 服务商公司供方管理系统编码code
+                updateWrapper.set("purchaseprice", Double.valueOf(String.valueOf(infosObj.get(InfosKeyConstant.PURCHASE_PRICE)))); // 采购金额 填写人民币元
+                updateWrapper.set("zjsynx", StringTool.object2Double(infosObj.get(InfosKeyConstant.SERVICE_LIFE))); // 折旧/使用年限 按年填写 如3年半则填写 3.5
+                updateWrapper.set("scrq", StringTool.object2DateTime(infosObj.get(InfosKeyConstant.PRODUCT_DATE))); // 生产日期/出厂日期 年/月/日
+                updateWrapper.set("cgrq", StringTool.object2DateTime(infosObj.get(InfosKeyConstant.PURCHASE_DATE))); // 采购日期
+                updateWrapper.set("azdate", StringTool.object2DateTime(infosObj.get(InfosKeyConstant.INSTALL_DATE))); // 安装日期
+                updateWrapper.set("installdate", StringTool.object2DateTime(infosObj.get(InfosKeyConstant.ENABLE_DATE))); // 启用日期
+                updateWrapper.set("zbksrq", StringTool.object2DateTime(infosObj.get(InfosKeyConstant.WARRANTY_START_DATE))); // 质保开始日期
+                updateWrapper.set("zbjsrq", StringTool.object2DateTime(infosObj.get(InfosKeyConstant.WARRANTY_END_DATE))); // 质保结束日期
+                updateWrapper.set("zxzq", StringTool.object2Integer(infosObj.get(InfosKeyConstant.MEDIUM_REPAIR_CYCLE))); // 中修周期 单位为月
+                updateWrapper.set("dxzq", StringTool.object2Integer(infosObj.get(InfosKeyConstant.OVERHAUL_CYCLE))); // 大修周期 单位为月
+                updateWrapper.set("wylx", String.valueOf(infosObj.get(InfosKeyConstant.PROPERTY_TYPE))); // 物业类型 自持/销售/合作方
+                updateWrapper.set("sbglgs", String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_MANAGE_OWNERSHIP))); // 设备管理归属 商管/百货/大歌星/超市/影院/大酒楼/其他
+                updateWrapper.set("hysbbm", String.valueOf(infosObj.get(InfosKeyConstant.WISDOM_CLOUD_LOCAL_CODE))); // 慧云设备编码
+                updateWrapper.set("sfhysy", String.valueOf(infosObj.get(InfosKeyConstant.WISDOM_CLOUD_USE))); // 是否慧云使用 是/否   缺省为 是
+                updateWrapper.set("sfzld", String.valueOf(infosObj.get(InfosKeyConstant.MAIN_STORE))); // 是否是主力店 缺省为 否
+                updateWrapper.set("mark", String.valueOf(infosObj.get(InfosKeyConstant.REMARK))); // 备注 wD_beizhu
+                updateWrapper.set("siteid", wdProjectId); // 项目唯一id,可采用租赁系统广场id,同步后不可更改
+                updateWrapper.set("datastatus", SwitchConstant.IS_UPDATE); // 数据状态 update/delete 当数据状态为delete时,设备状态需改为报废
+            }
+            updateWrapper.set("changedate", updateTime); // 数据更新时间 增量字段
+            this.hydomcAssetMapper.update(hydomcAsset, updateWrapper);
+        }
+    }
+
+
+    /**
+     * @param wdfacilityRelList 筛选后的万达设备参数信息表与博锐尚格信息点的映射表数据
+     * @param wdProjectid       万达项目ID(广场ID)
+     * @param infosObj          博锐尚格项目表的infos字段值
+     * @param updateTime        项目最后更新时间
+     * @author YangWanYi
+     * @describe 同步万达设备参数对象数据
+     * @date 2021/9/16 18:56
+     */
+    @DS(value = SwitchConstant.DS_MASTER_2)
+    public void sycnHydomcAssetspec(List<WdfacilityRelPersagy> wdfacilityRelList, String wdProjectid, JSONObject infosObj, java.util.Date updateTime) {
+        log.info("准备同步万达设备参数对象数据");
+        HydomcAssetspec hydomcAssetspec;
+        for (WdfacilityRelPersagy wdfacilityRelPersagy : wdfacilityRelList) {
+            // 根据万达设备信息表的SITEID、SBYBM、ASSETATTRID查询数据是否存在
+            hydomcAssetspec = this.getHydomcAssetspec(wdProjectid, String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_CODE)), wdfacilityRelPersagy.getAssetattrid());
+            if (hydomcAssetspec == null) {
+                log.info("万达表hydomc_assetspec没有这条数据,准备新增");
+//                hydomcAssetspec = new HydomcAssetspec();
+//                hydomcAssetspec.setAssetspecid(IdGenerator.getSnowIdStr(prefix););
+                hydomcAssetspec = this.handleHydomcAssetspec(new HydomcAssetspec(), wdProjectid, infosObj, wdfacilityRelPersagy, updateTime);
+                this.hydomcAssetspecMapper.insert(hydomcAssetspec);
+            } else {
+                // key为wdfacility_rel_persagy的code值从infos取 有值update 无值(空、空字符串)就是delete
+                if (StringUtils.isBlank(String.valueOf(infosObj.get(wdfacilityRelPersagy.getCode())))) {
+                    log.info("万达表hydomc_assetspec有这条数据,但code没有值,只需要更新数据状态为delete即可");
+                    hydomcAssetspec.setDatastatus(SwitchConstant.IS_DELETE); // 数据状态 update/delete
+                    hydomcAssetspec.setChangedate(updateTime); // 数据更新时间 增量字段
+                } else {
+                    log.info("万达表hydomc_assetspec有这条数据,code有值,需要更新所有字段");
+                    hydomcAssetspec = this.handleHydomcAssetspec(hydomcAssetspec, wdProjectid, infosObj, wdfacilityRelPersagy, updateTime);
+                }
+                this.hydomcAssetspecMapper.updateById(hydomcAssetspec);
+            }
+        }
+    }
+
+    /**
+     * @param hydomcAssetspec      设备参数信息对象
+     * @param wdProjectid          广场ID(万达项目ID)
+     * @param infosObj             博锐尚格项目表infos字段数据
+     * @param wdfacilityRelPersagy 万达设备参数信息表与博锐尚格信息点的映射表
+     * @param changedate           数据更新时间
+     * @return com.persagy.transfer.pojo.dto.HydomcAssetspec
+     * @author YangWanYi
+     * @describe 处理设备参数信息对象字段映射
+     * @date 2021/9/17 10:55
+     */
+    public HydomcAssetspec handleHydomcAssetspec(HydomcAssetspec hydomcAssetspec, String wdProjectid, JSONObject infosObj, WdfacilityRelPersagy wdfacilityRelPersagy, Date changedate) {
+        hydomcAssetspec.setSiteid(wdProjectid); // 广场id 关联设备信息 Pj4403070003
+        hydomcAssetspec.setSbybm(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_CODE))); // 设备编码 关联设备信息 wD_gongchengxinxihua
+        hydomcAssetspec.setClassstructureid(String.valueOf(infosObj.get(InfosKeyConstant.EQUIPMENT_SORT))); // 设备分类id 1507
+        // 根据Datatype判断设置设备参数数字值还是设备参数文本值 key为wdfacility_rel_persagy的code值从infos取
+        final String IS_NUMBER = "数字";
+        final String IS_LETTER = "字母";
+        if (IS_NUMBER.equals(wdfacilityRelPersagy.getDatatype())) { // 是数字
+            log.info("dataType是数字");
+            hydomcAssetspec.setNumvalue(StringTool.object2Double(infosObj.get(wdfacilityRelPersagy.getCode()))); // 设备参数数字值 (取自infos)
+        } else if (IS_LETTER.equals(wdfacilityRelPersagy.getDatatype())) { // 是字母
+            log.info("dataType是字母");
+            hydomcAssetspec.setAlnvalue(String.valueOf(infosObj.get(wdfacilityRelPersagy.getCode()))); // 设备参数文本值 (取自infos)
+        }
+        // key为wdfacility_rel_persagy的code值从infos取 有值update 无值(空、空字符串)就是delete
+        if (StringUtils.isBlank(String.valueOf(infosObj.get(wdfacilityRelPersagy.getCode())))) {
+            log.info("code没有值,数据状态设置为delete");
+            hydomcAssetspec.setDatastatus(SwitchConstant.IS_DELETE); // 数据状态 update/delete
+        } else {
+            log.info("code有值,数据状态设置为update");
+            hydomcAssetspec.setDatastatus(SwitchConstant.IS_UPDATE); // 数据状态 update/delete
+        }
+        hydomcAssetspec.setClassqc(wdfacilityRelPersagy.getClassqc()); // 设备分类名称 电梯系统/扶梯/人行步道 (取自中间表wdfacility_rel_persagy)
+        hydomcAssetspec.setAssetattrid(wdfacilityRelPersagy.getAssetattrid()); // 主键 设备参数id 1106 (取自中间表wdfacility_rel_persagy)
+        hydomcAssetspec.setCsdesc(wdfacilityRelPersagy.getCsdesc()); // 设备参数名称 (取自中间表wdfacility_rel_persagy)
+        hydomcAssetspec.setDatatype(wdfacilityRelPersagy.getDatatype()); // 设备参数类型 (取自中间表wdfacility_rel_persagy)
+        hydomcAssetspec.setMeasureunitid(wdfacilityRelPersagy.getMeasureunitid()); // 设备参数单位编码 (取自中间表wdfacility_rel_persagy)
+        hydomcAssetspec.setCsjldw(wdfacilityRelPersagy.getCsjldw()); // 设备参数单位名称 (取自中间表wdfacility_rel_persagy)
+        hydomcAssetspec.setChangedate(changedate); // 数据更新时间 增量字段
+        return hydomcAssetspec;
+    }
+
+    /**
+     * @param siteId      关联的设备信息字段 广场ID 即万达项目ID
+     * @param sbybm       关联的设备信息字段 设备编码
+     * @param assetAttrId 设备分类ID
+     * @return com.persagy.transfer.pojo.dto.HydomcAssetspec
+     * @author YangWanYi
+     * @describe 根据SITEID、SBYBM、ASSETATTRID查询万达设备信息表数据
+     * @date 2021/9/17 10:13
+     */
+    @Override
+    @DS(value = SwitchConstant.DS_MASTER_2)
+    public HydomcAssetspec getHydomcAssetspec(String siteId, String sbybm, String assetAttrId) {
+        LambdaQueryWrapper<HydomcAssetspec> queryHydomcAssetWrapper = new HydomcAssetspec.BuilderQueryWrapper().builder();
+        queryHydomcAssetWrapper.eq(HydomcAssetspec::getSiteid, siteId);
+        queryHydomcAssetWrapper.eq(HydomcAssetspec::getSbybm, sbybm);
+        queryHydomcAssetWrapper.eq(HydomcAssetspec::getAssetattrid, assetAttrId);
+        return this.hydomcAssetspecMapper.selectOne(queryHydomcAssetWrapper);
+    }
+
+    /**
+     * @param primaryKey 万达设备信息主表主键
+     * @return com.persagy.transfer.pojo.dto.HydomcAsset
+     * @author YangWanYi
+     * @describe 根据主键获取万达设备信息
+     * @date 2021/9/16 15:31
+     */
+    @DS(value = SwitchConstant.DS_MASTER_2)
+    public HydomcAsset getHydomcAssetByPKey(String primaryKey) {
+        LambdaQueryWrapper<HydomcAsset> queryHydomcAssetWrapper = new HydomcAsset.BuilderQueryWrapper().builder();
+        queryHydomcAssetWrapper.eq(HydomcAsset::getSbybm, primaryKey);
+        return this.hydomcAssetMapper.selectOne(queryHydomcAssetWrapper);
+    }
+
+}

+ 57 - 0
src/main/java/com/persagy/transfer/utils/StringTool.java

@@ -0,0 +1,57 @@
+package com.persagy.transfer.utils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Date;
+
+/**
+ * @description: 字符串相关扩展工具类
+ * @author: YangWanYi
+ * @create: 2021-09-16 21:05
+ **/
+public class StringTool {
+
+    public static Double object2Double(Object obj) {
+        if (obj != null && StringUtils.isNotBlank(String.valueOf(obj))) {
+            return Double.valueOf(String.valueOf(obj));
+        } else {
+            return 0d;
+        }
+    }
+
+    public static Date object2DateTime(Object obj) {
+        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        if (obj != null && StringUtils.isNotBlank(String.valueOf(obj))) {
+            ZoneId zoneId = ZoneId.systemDefault();
+            ZonedDateTime zdt = LocalDateTime.parse(String.valueOf(obj), dtf).atZone(zoneId);
+            return Date.from(zdt.toInstant());
+        } else {
+            return null;
+        }
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        Date date = null;
+//        if (str != null && StringUtils.isNotBlank(String.valueOf(str))) {
+//            try {
+//                date = sdf.parse(String.valueOf(str));
+//            } catch (ParseException e) {
+//                e.printStackTrace();
+//            }
+//        }
+//        return date;
+//    }
+
+    }
+
+    public static Integer object2Integer(Object obj) {
+        if (obj != null && StringUtils.isNotBlank(String.valueOf(obj))) {
+            return Integer.valueOf(String.valueOf(obj));
+        } else {
+            return 0;
+        }
+    }
+
+}

+ 1 - 1
src/main/resources/mapper/RwdObjecWdMapper.xml

@@ -26,7 +26,7 @@
         <result column="update_app" property="updateApp" jdbcType="VARCHAR"/>
     </resultMap>
     <select id="listByProjectId" resultType="com.persagy.transfer.pojo.dto.RwdObjecWd">
-        select * from wd_object_wd_${projectId} where 1=1
+        select * from rwd_object_wd_${projectId} where 1=1
         <if test="objType != null and objType.trim() != ''">
             and obj_type = #{objType}
         </if>