调整基础数据、车船务、项目、合同
This commit is contained in:
+4
@@ -34,6 +34,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 费用项 Excel
|
||||
@@ -60,6 +61,9 @@ public class FeeItemExcel implements Serializable {
|
||||
@ExcelProperty("*费用项")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("*税率")
|
||||
private BigDecimal taxRate;
|
||||
|
||||
@ExcelIgnore
|
||||
private String errorMessage;
|
||||
|
||||
|
||||
+4
@@ -15,6 +15,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -40,6 +41,9 @@ public class FeeItemExportExcel implements Serializable {
|
||||
@ExcelProperty("费用项")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("税率")
|
||||
private BigDecimal taxRate;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
+4
@@ -33,6 +33,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 费用项导入失败 Excel
|
||||
@@ -56,6 +57,9 @@ public class FeeItemImportFailureExcel implements Serializable {
|
||||
@ExcelProperty("*费用项")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("*税率")
|
||||
private BigDecimal taxRate;
|
||||
|
||||
@ExcelProperty("导入失败原因")
|
||||
private String failureReason;
|
||||
|
||||
|
||||
+1
@@ -16,6 +16,7 @@
|
||||
<result column="fee_category" property="feeCategory"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="english_name" property="englishName"/>
|
||||
<result column="tax_rate" property="taxRate"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
+16
-1
@@ -47,6 +47,7 @@ import org.springblade.system.service.IFeeItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -66,6 +67,8 @@ public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem>
|
||||
private static final int NAME_MAX_LENGTH = 50;
|
||||
private static final int ENGLISH_NAME_MAX_LENGTH = 100;
|
||||
private static final int REMARK_MAX_LENGTH = 200;
|
||||
private static final BigDecimal TAX_RATE_MIN = BigDecimal.ZERO;
|
||||
private static final BigDecimal TAX_RATE_MAX = new BigDecimal("100");
|
||||
|
||||
@Override
|
||||
public IPage<FeeItemVO> selectFeeItemPage(IPage<FeeItemVO> page, FeeItemVO feeItem) {
|
||||
@@ -115,7 +118,7 @@ public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem>
|
||||
save(feeItem);
|
||||
} catch (Exception exception) {
|
||||
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
|
||||
failureList.add(toImportFailureExcel(excel, message));
|
||||
failureList.add(toImportFailureExcel(excel, "第" + (index + 2) + "行:" + message));
|
||||
}
|
||||
}
|
||||
return failureList;
|
||||
@@ -156,6 +159,16 @@ public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem>
|
||||
if (Func.isNotEmpty(feeItem.getEnglishName()) && feeItem.getEnglishName().length() > ENGLISH_NAME_MAX_LENGTH) {
|
||||
throw new ServiceException("费用项代码不能超过100字");
|
||||
}
|
||||
BigDecimal taxRate = feeItem.getTaxRate();
|
||||
if (taxRate == null) {
|
||||
throw new ServiceException("税率不能为空");
|
||||
}
|
||||
if (taxRate.compareTo(TAX_RATE_MIN) < 0 || taxRate.compareTo(TAX_RATE_MAX) > 0) {
|
||||
throw new ServiceException("税率必须在0到100之间");
|
||||
}
|
||||
if (taxRate.stripTrailingZeros().scale() > 2) {
|
||||
throw new ServiceException("税率最多保留2位小数");
|
||||
}
|
||||
if (Func.isNotEmpty(feeItem.getRemark()) && feeItem.getRemark().length() > REMARK_MAX_LENGTH) {
|
||||
throw new ServiceException("备注不能超过200个字");
|
||||
}
|
||||
@@ -192,6 +205,7 @@ public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem>
|
||||
feeItem.setFeeCategory(resolveFeeCategory(excel.getFeeCategory()));
|
||||
feeItem.setEnglishName(trimToNull(excel.getEnglishName()));
|
||||
feeItem.setName(trimToEmpty(excel.getName()));
|
||||
feeItem.setTaxRate(excel.getTaxRate());
|
||||
feeItem.setStatus(STATUS_ENABLED);
|
||||
return feeItem;
|
||||
}
|
||||
@@ -212,6 +226,7 @@ public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem>
|
||||
failureExcel.setFeeCategory(excel.getFeeCategory());
|
||||
failureExcel.setEnglishName(excel.getEnglishName());
|
||||
failureExcel.setName(excel.getName());
|
||||
failureExcel.setTaxRate(excel.getTaxRate());
|
||||
failureExcel.setFailureReason(failureReason);
|
||||
return failureExcel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user