Commit f608dd96 by 刘宇峰

新增车辆-车型管理-异步保存

1 parent f7ca3c82
package cn.com.glsx.admin.modules.controller;
import cn.com.glsx.admin.common.constants.Constants;
import cn.com.glsx.admin.common.enums.ResultEnum;
import cn.com.glsx.admin.common.exception.AdminException;
import cn.com.glsx.admin.modules.model.*;
import cn.com.glsx.admin.modules.model.export.TrialDriveVehicleExport;
import cn.com.glsx.admin.modules.model.imports.TrialDriveVehicleImport;
......@@ -220,7 +222,15 @@ public class VehicleController {
@ApiOperation(value = "保存车型库")
@PostMapping("/savetypes")
public R<List<Cartype>> saveVehicleTypes(@RequestBody VehicleTypesBO typesBO) {
TenantTypesDTO typesDTO = vehicleService.getTenantTypes(typesBO.getTenantId());
//新增且车型库已经存在
if (typesBO.getFrom() == 1 && typesDTO != null) {
throw new AdminException(ResultEnum.TENANT_VEHICLE_TYPES_EXISTED);
}
vehicleService.saveVehicleTypes(typesBO);
return R.ok();
}
......
......@@ -41,6 +41,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -785,15 +786,9 @@ public class VehicleService {
return cartypeService.getByCarTypeId(typeId);
}
@Async
public void saveVehicleTypes(VehicleTypesBO typesBO) {
TenantTypesDTO typesDTO = getTenantTypes(typesBO.getTenantId());
//新增且车型库已经存在
if (typesBO.getFrom() == 1 && typesDTO != null) {
throw new AdminException(ResultEnum.TENANT_VEHICLE_TYPES_EXISTED);
}
Date now = new Date();
List<TenantVehicleType> tvTypeList = Lists.newArrayListWithCapacity(typesBO.getTypeIds().size());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!