|
@@ -11,6 +11,7 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
+import org.apache.ibatis.session.SqlSessionFactory;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -35,14 +36,17 @@ public class SyncByTimeController {
|
|
this.syncOldFeign = syncOldFeign;
|
|
this.syncOldFeign = syncOldFeign;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "同步旧系统某一时间段内的 t_admin ")
|
|
|
|
|
|
+ @ApiOperation(value = "同步旧系统某一时间段内的 t_equipment ")
|
|
@PostMapping("/getEquipmentInTime")
|
|
@PostMapping("/getEquipmentInTime")
|
|
public ResponseModel<?> getEquipmentInTime(String startTime, String endTime) {
|
|
public ResponseModel<?> getEquipmentInTime(String startTime, String endTime) {
|
|
if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
List<TEquipment> oldEquipmentList = R.getDataIfSuccess(syncOldFeign.getEquipmentInTime(startTime, endTime));
|
|
List<TEquipment> oldEquipmentList = R.getDataIfSuccess(syncOldFeign.getEquipmentInTime(startTime, endTime));
|
|
|
|
+
|
|
|
|
+ // 构建MybatisBatch
|
|
|
|
+// new MybatisBatch<>(SqlSessionFactory, )
|
|
|
|
+
|
|
for (TEquipment oldEquipment : oldEquipmentList) {
|
|
for (TEquipment oldEquipment : oldEquipmentList) {
|
|
// equipmentService.saveOrUpdate(oldEquipment); // 防止新旧表结构不同,不做直接插入
|
|
// equipmentService.saveOrUpdate(oldEquipment); // 防止新旧表结构不同,不做直接插入
|
|
-
|
|
|
|
Long id = oldEquipment.getId();
|
|
Long id = oldEquipment.getId();
|
|
Date createDate = oldEquipment.getCreateDate();
|
|
Date createDate = oldEquipment.getCreateDate();
|
|
Date modifyDate = oldEquipment.getModifyDate();
|
|
Date modifyDate = oldEquipment.getModifyDate();
|
|
@@ -168,10 +172,7 @@ public class SyncByTimeController {
|
|
equipment.setCompanyType(companyType);
|
|
equipment.setCompanyType(companyType);
|
|
equipment.setPaymentType(paymentType);
|
|
equipment.setPaymentType(paymentType);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
equipmentService.saveOrUpdate(oldEquipment);
|
|
equipmentService.saveOrUpdate(oldEquipment);
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return R.fail("时间参数有误");
|
|
return R.fail("时间参数有误");
|