demand:报价管理页面新增批量修改报价接口
committer: heyu
This commit is contained in:
parent
9d911d5db5
commit
ec274798ed
@ -164,6 +164,25 @@ public class EmisQuotePriceController extends EmisBaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改费用报价
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisQuotePrice:edit')")
|
||||||
|
@Log(title = "费用报价", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public AjaxResult batchEdit(@RequestBody List<EmisQuotePrice> emisQuotePriceList) {
|
||||||
|
try {
|
||||||
|
return toAjax(emisQuotePriceService.batchUpdateEmisQuotePrice(emisQuotePriceList));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
// 返回自定义异常
|
||||||
|
if (ex instanceof EmisBizError) {
|
||||||
|
return AjaxResult.error(ex.getMessage(), ((EmisBizError) ex).getErrorCode());
|
||||||
|
}
|
||||||
|
return AjaxResult.error("服务器异常,联系客服");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除费用报价
|
* 删除费用报价
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -70,4 +70,12 @@ public interface IEmisQuotePriceService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteEmisQuotePriceByQuoteId(Long quoteId);
|
public int deleteEmisQuotePriceByQuoteId(Long quoteId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改费用报价
|
||||||
|
*
|
||||||
|
* @param emisQuotePriceList 费用报价列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int batchUpdateEmisQuotePrice(List<EmisQuotePrice> emisQuotePriceList) throws EmisBizError;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,4 +152,42 @@ public class EmisQuotePriceServiceImpl implements IEmisQuotePriceService
|
|||||||
return emisQuotePriceMapper.deleteEmisQuotePriceByQuoteId(quoteId);
|
return emisQuotePriceMapper.deleteEmisQuotePriceByQuoteId(quoteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改费用报价
|
||||||
|
*
|
||||||
|
* @param emisQuotePriceList 费用报价列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int batchUpdateEmisQuotePrice(List<EmisQuotePrice> emisQuotePriceList) throws EmisBizError {
|
||||||
|
if (CollectionUtil.isEmpty(emisQuotePriceList)) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "费用报价列表不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
int successCount = 0;
|
||||||
|
for (EmisQuotePrice emisQuotePrice : emisQuotePriceList) {
|
||||||
|
try {
|
||||||
|
// 检查是否重复
|
||||||
|
List<EmisQuotePrice> listOld = emisQuotePriceMapper.checkUnique(emisQuotePrice);
|
||||||
|
if (!CollectionUtil.isEmpty(listOld)) {
|
||||||
|
String estNameStr = "";
|
||||||
|
for (EmisQuotePrice item : listOld) {
|
||||||
|
estNameStr = estNameStr + item.getQuoteName() + ",";
|
||||||
|
}
|
||||||
|
throw new EmisBizError(EmisBizErrorType.EXISTS, "报价重复[" + estNameStr + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新主表
|
||||||
|
int ret = emisQuotePriceMapper.updateEmisQuotePrice(emisQuotePrice);
|
||||||
|
if (ret > 0) {
|
||||||
|
successCount++;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.SYS_EXCEPTION, "批量修改费用报价失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return successCount;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user