|
@@ -239,13 +239,18 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
sysCustom.setProvince(e.getProvince());
|
|
|
sysCustom.setPeoperDay(e.getPeoperDay());
|
|
|
SysUser sysUser = sysUserService.getOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getRealName, e.getManager()));
|
|
|
+ if (Objects.isNull(sysUser)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("客户经理不存在!");
|
|
|
+ }
|
|
|
sysCustom.setManagerId(sysUser.getId());
|
|
|
SysLevel sysLevel = sysLevelService.getOne(new QueryWrapper<SysLevel>().lambda().eq(SysLevel::getLevel, e.getLevel()).eq(SysLevel::getType, type));
|
|
|
+ if (Objects.isNull(sysLevel)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("服务档位不存在!");
|
|
|
+ }
|
|
|
sysCustom.setLevelId(sysLevel.getId());
|
|
|
sysCustom.setSync(false);
|
|
|
sysCustom.setEnable(true);
|
|
|
- SysUser ssysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- sysCustom.setCreateId(ssysUser.getId());
|
|
|
+ sysCustom.setCreateId(((SysUser)map.get("account")).getId());
|
|
|
sysCustom.setCreateTime(System.currentTimeMillis());
|
|
|
sysCustomService.saveOrUpdate(sysCustom);
|
|
|
|
|
@@ -381,7 +386,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
|
|
|
if (errorSize == 0) {
|
|
|
List<SysDevice> sysDevices = new ArrayList<>();
|
|
|
- SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+// SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
List<SysSupplier> supplierList = sysSupplierService.list(new QueryWrapper<SysSupplier>().lambda().eq(SysSupplier::getType, SupplierTypeEnum.DEVICE));
|
|
|
Objects.requireNonNull(customImportDtoLinkedMultiValueMap.get(BasicExcelListener.SUCCESS)).forEach(e -> {
|
|
|
SysDevice device = new SysDevice();
|
|
@@ -389,21 +394,26 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
InOutTypeEnum bound = InOutTypeEnum.IN.getTitle().equals(e.getBound()) ? InOutTypeEnum.IN : InOutTypeEnum.OUT;
|
|
|
device.setBound(bound);
|
|
|
device.setBrand(e.getBrand());
|
|
|
+ device.setModel(e.getModel());
|
|
|
device.setLocation(e.getLocation());
|
|
|
device.setEnable(true);
|
|
|
//日期字符串转换时间戳
|
|
|
try {
|
|
|
device.setBuyTime(new SimpleDateFormat("yyyy/MM/dd").parse(e.getBuyTime()).getTime());
|
|
|
} catch (ParseException ex) {
|
|
|
- throw new RuntimeException(ex);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("购买时间格式错误");
|
|
|
}
|
|
|
+
|
|
|
device.setScanCount(e.getScanCount());
|
|
|
+ if (supplierList.stream().noneMatch(s -> s.getName().equals(e.getSupplier()))) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("供应商不存在!");
|
|
|
+ }
|
|
|
device.setSupplierId(supplierList.stream().filter(s -> s.getName().equals(e.getSupplier())).findFirst().get().getId());
|
|
|
device.setSerialNo(e.getSerialNo());
|
|
|
DeviceStatusEnum status = DeviceStatusEnum.NORMAL.getTitle().equals(e.getStatus()) ? DeviceStatusEnum.NORMAL : DeviceStatusEnum.BREAK_DOWN;
|
|
|
device.setStatus(status);
|
|
|
device.setSync(false);
|
|
|
- device.insertInfo(sysUser.getId());
|
|
|
+ device.insertInfo(((SysUser)map.get("account")).getId());
|
|
|
sysDevices.add(device);
|
|
|
});
|
|
|
sysDeviceService.saveSysDevice(sysDevices);
|