新增供应商优化
This commit is contained in:
parent
3d09568e6c
commit
225f2b56ef
|
|
@ -93,7 +93,11 @@ public class SupplierInfoController extends BaseController {
|
||||||
@SysLog(title = "物资厂家管理", businessType = OperaType.INSERT, module = "物资管理->新增物资厂家管理")
|
@SysLog(title = "物资厂家管理", businessType = OperaType.INSERT, module = "物资管理->新增物资厂家管理")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody SupplierInfo supplierInfo) {
|
public AjaxResult add(@RequestBody SupplierInfo supplierInfo) {
|
||||||
|
try {
|
||||||
return supplierInfoService.insertSupplierInfo(supplierInfo);
|
return supplierInfoService.insertSupplierInfo(supplierInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error("系统错误, " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -105,7 +109,11 @@ public class SupplierInfoController extends BaseController {
|
||||||
@SysLog(title = "物资厂家管理", businessType = OperaType.UPDATE, module = "物资管理->修改物资厂家管理")
|
@SysLog(title = "物资厂家管理", businessType = OperaType.UPDATE, module = "物资管理->修改物资厂家管理")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody SupplierInfo supplierInfo) {
|
public AjaxResult edit(@RequestBody SupplierInfo supplierInfo) {
|
||||||
|
try {
|
||||||
return toAjax(supplierInfoService.updateSupplierInfo(supplierInfo));
|
return toAjax(supplierInfoService.updateSupplierInfo(supplierInfo));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error("系统错误, " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.ma.service.impl;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.basic.domain.BmFileInfo;
|
import com.bonus.material.basic.domain.BmFileInfo;
|
||||||
|
|
@ -64,6 +65,7 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult insertSupplierInfo(SupplierInfo supplierInfo) {
|
public AjaxResult insertSupplierInfo(SupplierInfo supplierInfo) {
|
||||||
|
try {
|
||||||
supplierInfo.setCreateTime(DateUtils.getNowDate());
|
supplierInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
int insertedSupplierInfoResult = supplierInfoMapper.insertSupplierInfo(supplierInfo);
|
int insertedSupplierInfoResult = supplierInfoMapper.insertSupplierInfo(supplierInfo);
|
||||||
if (insertedSupplierInfoResult > 0) {
|
if (insertedSupplierInfoResult > 0) {
|
||||||
|
|
@ -85,9 +87,9 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService {
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.error("新增任务失败,info表插入0条");
|
return AjaxResult.error("新增任务失败,info表插入0条");
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException("数据库错误或供应商名称重复");
|
||||||
|
}
|
||||||
|
|
||||||
// if (insertedSupplierInfoResult > 0 && ArrayUtil.isNotEmpty(supplierInfo.getFiles())) {
|
// if (insertedSupplierInfoResult > 0 && ArrayUtil.isNotEmpty(supplierInfo.getFiles())) {
|
||||||
// AjaxResult uploadedFilesResult = remoteFileService.uploadFile(supplierInfo.getFiles());
|
// AjaxResult uploadedFilesResult = remoteFileService.uploadFile(supplierInfo.getFiles());
|
||||||
|
|
@ -113,7 +115,11 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService {
|
||||||
@Override
|
@Override
|
||||||
public int updateSupplierInfo(SupplierInfo supplierInfo) {
|
public int updateSupplierInfo(SupplierInfo supplierInfo) {
|
||||||
supplierInfo.setUpdateTime(DateUtils.getNowDate());
|
supplierInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
try {
|
||||||
return supplierInfoMapper.updateSupplierInfo(supplierInfo);
|
return supplierInfoMapper.updateSupplierInfo(supplierInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException("数据库错误或供应商名称重复");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue