|
@@ -1,14 +1,19 @@
|
|
|
package com.zcxk.meterreadingsystemv2.service;
|
|
|
|
|
|
+import com.zcxk.meterreadingsystemv2.common.JacksonUtil;
|
|
|
import com.zcxk.meterreadingsystemv2.dao.DeviceMapper;
|
|
|
import com.zcxk.meterreadingsystemv2.dao.TRemoteCustomerMapper;
|
|
|
+import com.zcxk.meterreadingsystemv2.dao.YcblhbMapper;
|
|
|
import com.zcxk.meterreadingsystemv2.dbs.DynamicDataSourceContextHolder;
|
|
|
import com.zcxk.meterreadingsystemv2.dto.DeviceCustomerInfo;
|
|
|
import com.zcxk.meterreadingsystemv2.entity.TRemoteCustomer;
|
|
|
+import com.zcxk.meterreadingsystemv2.entity.Ycblhb;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
@@ -21,6 +26,8 @@ public class MssqlService {
|
|
|
private DeviceMapper deviceMapper;
|
|
|
@Resource
|
|
|
private TRemoteCustomerMapper tRemoteCustomerMapper;
|
|
|
+ @Resource
|
|
|
+ YcblhbMapper ycblhbMapper;
|
|
|
|
|
|
public void addCustomer() {
|
|
|
String originName = "jl";
|
|
@@ -71,4 +78,44 @@ public class MssqlService {
|
|
|
log.info("=======================end list size="+list.size()+"-count="+count.get());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public void addHuichuanCustomer() {
|
|
|
+ String originName = "huichuan";
|
|
|
+ String commOrgLevel = "10001002";
|
|
|
+ String commOrgIdenty = "10001002";
|
|
|
+ AtomicInteger count = new AtomicInteger(0);
|
|
|
+ DynamicDataSourceContextHolder.setDataSourceKey("smart-city");
|
|
|
+ log.info("=====service当前连接的数据库是:" + DynamicDataSourceContextHolder.getDataSourceKey());
|
|
|
+ List<DeviceCustomerInfo> list = deviceMapper.getDeviceCustomerInfoByCustomerId(38);
|
|
|
+
|
|
|
+ DynamicDataSourceContextHolder.setDataSourceKey(originName);
|
|
|
+ //log.info("=====service当前连接的数据库是:" + DynamicDataSourceContextHolder.getDataSourceKey());
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
+ log.info("=======================list size="+list.size());
|
|
|
+ for (DeviceCustomerInfo info : list) {
|
|
|
+ Ycblhb ycblhb = new Ycblhb();
|
|
|
+ ycblhb.setYhdz(info.getBuildingName() + info.getLocation());
|
|
|
+ ycblhb.setSbdz(info.getBuildingName() + info.getLocation());
|
|
|
+ ycblhb.setBc("001");
|
|
|
+ ycblhb.setBsm(info.getWaterMeterNo());
|
|
|
+ ycblhb.setZdsj("0101");//汇川0101
|
|
|
+ ycblhb.setYys("020101");
|
|
|
+ ycblhb.setBw(info.getBuildingName() + info.getLocation());
|
|
|
+ ycblhb.setBxh("4");
|
|
|
+ //ycblhb.setBqds(acceptListData.getReadData());
|
|
|
+ ycblhb.setBqds(BigDecimal.ZERO);
|
|
|
+ ycblhb.setNhrq(info.getInstallTime());
|
|
|
+ ycblhb.setLdh(info.getBuildingName());
|
|
|
+ ycblhb.setDyh(info.getCommunityName());
|
|
|
+ ycblhb.setMph(info.getLocation());
|
|
|
+ ycblhb.setBcj("31");
|
|
|
+ ycblhb.setCommOrgLevel(commOrgLevel);
|
|
|
+ ycblhb.setCommOrgIdenty(commOrgIdenty);
|
|
|
+ log.info(JacksonUtil.obj2String(ycblhb));
|
|
|
+ ycblhbMapper.insertSelective(ycblhb);
|
|
|
+ count.incrementAndGet();
|
|
|
+ }
|
|
|
+ log.info("=======================end list size="+list.size()+"-count="+count.get());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|