|
@@ -1,5 +1,8 @@
|
|
package com.szwl.controller;
|
|
package com.szwl.controller;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
+import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;
|
|
import com.szwl.feign.bean.SyncOldFeign;
|
|
import com.szwl.feign.bean.SyncOldFeign;
|
|
import com.szwl.model.bo.R;
|
|
import com.szwl.model.bo.R;
|
|
import com.szwl.model.bo.ResponseModel;
|
|
import com.szwl.model.bo.ResponseModel;
|
|
@@ -12,6 +15,7 @@ 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.apache.ibatis.session.SqlSessionFactory;
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
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;
|
|
@@ -36,7 +40,8 @@ public class SyncByTimeController {
|
|
this.syncOldFeign = syncOldFeign;
|
|
this.syncOldFeign = syncOldFeign;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "同步旧系统某一时间段内的 t_equipment ")
|
|
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "同步旧系统某一时间段内的 t_equipment ") // 废弃~~~ 改用 getEquipmentByAdmin
|
|
@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)) {
|
|
@@ -44,7 +49,9 @@ public class SyncByTimeController {
|
|
|
|
|
|
// 构建MybatisBatch
|
|
// 构建MybatisBatch
|
|
// new MybatisBatch<>(SqlSessionFactory, )
|
|
// new MybatisBatch<>(SqlSessionFactory, )
|
|
-
|
|
|
|
|
|
+// equipmentService.
|
|
|
|
+ // TODO: 批量插入
|
|
|
|
+// InsertBatchSomeColumn
|
|
for (TEquipment oldEquipment : oldEquipmentList) {
|
|
for (TEquipment oldEquipment : oldEquipmentList) {
|
|
// equipmentService.saveOrUpdate(oldEquipment); // 防止新旧表结构不同,不做直接插入
|
|
// equipmentService.saveOrUpdate(oldEquipment); // 防止新旧表结构不同,不做直接插入
|
|
Long id = oldEquipment.getId();
|
|
Long id = oldEquipment.getId();
|
|
@@ -172,14 +179,45 @@ public class SyncByTimeController {
|
|
equipment.setCompanyType(companyType);
|
|
equipment.setCompanyType(companyType);
|
|
equipment.setPaymentType(paymentType);
|
|
equipment.setPaymentType(paymentType);
|
|
|
|
|
|
- equipmentService.saveOrUpdate(oldEquipment);
|
|
|
|
|
|
+ equipmentService.save(oldEquipment);
|
|
}
|
|
}
|
|
|
|
+ return R.ok("同步" + startTime + "至" + endTime + "的 equipment 信息成功");
|
|
|
|
+ } else {
|
|
|
|
+ return R.fail("时间参数不能为空");
|
|
}
|
|
}
|
|
- return R.fail("时间参数有误");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "修改 admin 的 type 类型")
|
|
|
|
+ @PostMapping("/updateAdminInfo")
|
|
|
|
+ public ResponseModel<?> updateAdminInfo(String startTime, String endTime) {
|
|
|
|
+ if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
|
|
+ LambdaQueryWrapper<TAdmin> lqw = Wrappers.lambdaQuery();
|
|
|
|
+ lqw.between(TAdmin::getCreateDate, startTime, endTime);
|
|
|
|
+ List<TAdmin> adminList = adminService.list(lqw);
|
|
|
|
+ for (TAdmin admin : adminList) {
|
|
|
|
+ Integer type = admin.getType();
|
|
|
|
+ if (type == 0) {
|
|
|
|
+ admin.setType(1);
|
|
|
|
+ adminService.updateById(admin);
|
|
|
|
+ }
|
|
|
|
+ if (type == 1) {
|
|
|
|
+ admin.setType(2);
|
|
|
|
+ adminService.updateById(admin);
|
|
|
|
+ }
|
|
|
|
+ // 旧系统的是按照:管理,省级,市级,终端进行划分
|
|
|
|
+// if (type == 3) {
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+ }
|
|
|
|
+ return R.ok("修改 admin 信息成功");
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ return R.fail("时间参数不能为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- @ApiOperation(value = "同步旧系统某一时间段内的 t_admin ")
|
|
|
|
|
|
+ @ApiOperation(value = "同步旧系统某一时间段内的 t_admin ") // admin 表已改回自增
|
|
@PostMapping("/getAdminInTime")
|
|
@PostMapping("/getAdminInTime")
|
|
public ResponseModel<?> getAdminInTime(String startTime, String endTime) {
|
|
public ResponseModel<?> getAdminInTime(String startTime, String endTime) {
|
|
if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime)) {
|
|
@@ -270,11 +308,12 @@ public class SyncByTimeController {
|
|
admin.setCompanyType(companyType);
|
|
admin.setCompanyType(companyType);
|
|
admin.setCurrencySymbol(currencySymbol);
|
|
admin.setCurrencySymbol(currencySymbol);
|
|
|
|
|
|
- adminService.saveOrUpdate(admin);
|
|
|
|
|
|
+ adminService.save(admin);
|
|
}
|
|
}
|
|
return R.ok("同步" + startTime + "至" + endTime + "的 admin 信息成功");
|
|
return R.ok("同步" + startTime + "至" + endTime + "的 admin 信息成功");
|
|
|
|
+ }else {
|
|
|
|
+ return R.fail("时间参数不能为空");
|
|
}
|
|
}
|
|
- return R.fail("时间参数有误");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|