Merge pull request 'develop' (#41) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/41
This commit is contained in:
commit
780868584e
@ -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 结果
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改费用报价
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -11,6 +11,9 @@
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -150,6 +153,9 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
|
||||
}
|
||||
}
|
||||
|
||||
// 校验交易日期不能晚于当天
|
||||
checkDate(emisSettlePayRecord);
|
||||
|
||||
emisSettlePayRecord.setSettleBillNo(WaybillHelper.formatQueryValue(emisSettlePayRecord.getSettleBillNo()));
|
||||
// 多账单合并收款
|
||||
String [] settleBillNoArr = emisSettlePayRecord.getSettleBillNo().split(",");
|
||||
@ -232,6 +238,28 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static void checkDate(EmisSettlePayRecord emisSettlePayRecord) throws EmisBizError {
|
||||
LocalDate today = LocalDate.now();
|
||||
if (emisSettlePayRecord.getTradeDate() != null) {
|
||||
LocalDate tradeDate = emisSettlePayRecord.getTradeDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
if (tradeDate.isAfter(today)) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,
|
||||
"交易时间不能晚于当天(" + today.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ")");
|
||||
}
|
||||
}
|
||||
if (emisSettlePayRecord.getRefundDate() != null) {
|
||||
LocalDate refundDate = emisSettlePayRecord.getRefundDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
if (refundDate.isAfter(today)) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,
|
||||
"退款时间不能晚于当天(" + today.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 收款退款
|
||||
* @param id
|
||||
|
||||
@ -1451,6 +1451,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// 检查是否已锁单
|
||||
checkDBBillIsLock(emisWaybillOld);
|
||||
|
||||
// 校验寄件国家是否匹配线路
|
||||
checkCountry(emisWaybillSave);
|
||||
|
||||
emisWaybillSave.setId(emisWaybillOld.getId());
|
||||
|
||||
// 把历史发货日期带过来用于重新计算预估到到时间
|
||||
@ -3023,6 +3026,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "单号与子单号相同,请换单号");
|
||||
}
|
||||
|
||||
// 校验寄件国家是否匹配线路
|
||||
checkCountry(emisWaybillSave);
|
||||
|
||||
// 子单号做扣减
|
||||
if ("1".equals(emisWaybillSave.getBlGenSubbill())) {
|
||||
Integer subBillCount = emisElectronicSitePagService.getTotalAvailablePagCount(emisWaybillSave.getSendSiteCode(), "T7080", "1002");
|
||||
@ -3208,6 +3214,19 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCountry(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
EmisTransLine emisTransLine = new EmisTransLine();
|
||||
emisTransLine.setLineCode(emisWaybillSave.getTransLineType());
|
||||
List<EmisTransLine> emisTransLines = emisTransLineMapper.selectEmisTransLineList(emisTransLine);
|
||||
if(CollectionUtil.isEmpty(emisTransLines)){
|
||||
return;
|
||||
}
|
||||
if(emisWaybillSave.getSendCountry().equals(emisTransLines.get(0).getFromCountry())){
|
||||
return;
|
||||
}
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "寄件国家与所选线路不匹配" );
|
||||
}
|
||||
|
||||
|
||||
public int bindSalesmen(String empCode,String customerCode) throws EmisBizError {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user