1、新增评分量化表

2、新增费用项
3、新增币种
4、新增客商类型
5、其他bug修复
This commit is contained in:
2026-07-16 17:04:46 +08:00
parent 29bbd5144d
commit 0eba4ca98d
57 changed files with 4740 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
import java.math.BigDecimal;
/**
* 币种主数据实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_currency")
@Schema(description = "币种主数据")
public class Currency extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 币种代码
*/
@Schema(description = "币种代码")
private String code;
/**
* 币种中文名称
*/
@Schema(description = "币种中文名称")
private String name;
/**
* 币种英文名称
*/
@Schema(description = "币种英文名称")
private String englishName;
/**
* 货币符号
*/
@Schema(description = "货币符号")
private String symbol;
/**
* 小数位数
*/
@Schema(description = "小数位数")
private Integer decimalPlaces;
/**
* 汇率
*/
@Schema(description = "汇率")
private BigDecimal exchangeRate;
/**
* 是否本位币
*/
@Schema(description = "是否本位币")
private Integer baseCurrency;
/**
* 数据来源
*/
@Schema(description = "数据来源")
private String dataSource;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}

View File

@@ -0,0 +1,61 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 客商类型实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_customer_type")
@Schema(description = "客商类型")
public class CustomerType extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 中文名称
*/
@Schema(description = "中文名称")
private String name;
/**
* 英文名称
*/
@Schema(description = "英文名称")
private String englishName;
}

View File

@@ -0,0 +1,61 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 费用项实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_fee_item")
@Schema(description = "费用项")
public class FeeItem extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 中文名称
*/
@Schema(description = "中文名称")
private String name;
/**
* 英文名称
*/
@Schema(description = "英文名称")
private String englishName;
}

View File

@@ -0,0 +1,55 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.system.pojo.entity.Currency;
import java.io.Serial;
/**
* 币种主数据视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "币种主数据")
public class CurrencyVO extends Currency {
@Serial
private static final long serialVersionUID = 1L;
/**
* 导入错误信息
*/
@TableField(exist = false)
@Schema(description = "导入错误信息")
private String errorMessage;
}

View File

@@ -0,0 +1,47 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.pojo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.system.pojo.entity.CustomerType;
import java.io.Serial;
/**
* 客商类型视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "客商类型")
public class CustomerTypeVO extends CustomerType {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,47 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.pojo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.system.pojo.entity.FeeItem;
import java.io.Serial;
/**
* 费用项视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "费用项")
public class FeeItemVO extends FeeItem {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,105 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serial;
import java.math.BigDecimal;
/**
* 信用等级评估标准实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_credit_rating_standard")
@Schema(description = "信用等级评估标准")
public class CreditRatingStandard extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 评分量化表ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "评分量化表ID")
private Long quantificationId;
/**
* 信用等级
*/
@Schema(description = "信用等级")
private String creditLevel;
/**
* 得分率下限
*/
@Schema(description = "得分率下限")
private Integer scoreRateLower;
/**
* 得分率上限
*/
@Schema(description = "得分率上限")
private Integer scoreRateUpper;
/**
* 得分率每增加
*/
@Schema(description = "得分率每增加")
private Integer scoreRateIncrease;
/**
* 最大资金使用额度下限
*/
@Schema(description = "最大资金使用额度下限")
private BigDecimal creditLimitLower;
/**
* 最大资金使用额度上限
*/
@Schema(description = "最大资金使用额度上限")
private BigDecimal creditLimitUpper;
/**
* 额度增加
*/
@Schema(description = "额度增加")
private BigDecimal creditLimitIncrease;
/**
* 标准说明
*/
@Schema(description = "标准说明")
private String standardDescription;
/**
* 排序
*/
@Schema(description = "排序")
private Integer sort;
}

View File

@@ -0,0 +1,74 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serial;
/**
* 评分分类实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_credit_score_category")
@Schema(description = "评分分类")
public class CreditScoreCategory extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 评分量化表ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "评分量化表ID")
private Long quantificationId;
/**
* 分类编码
*/
@Schema(description = "分类编码")
private String categoryCode;
/**
* 分类名称
*/
@Schema(description = "分类名称")
private String categoryName;
/**
* 排序
*/
@Schema(description = "排序")
private Integer sort;
}

View File

@@ -0,0 +1,90 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serial;
/**
* 评分项目实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_credit_score_item")
@Schema(description = "评分项目")
public class CreditScoreItem extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 评分量化表ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "评分量化表ID")
private Long quantificationId;
/**
* 评分分类ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "评分分类ID")
private Long categoryId;
/**
* 分类编码
*/
@Schema(description = "分类编码")
private String categoryCode;
/**
* 评分项目
*/
@Schema(description = "评分项目")
private String itemName;
/**
* 得分说明
*/
@Schema(description = "得分说明")
private String scoreDescription;
/**
* 选项描述
*/
@Schema(description = "选项描述")
private String optionDescription;
/**
* 排序
*/
@Schema(description = "排序")
private Integer sort;
}

View File

@@ -0,0 +1,81 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serial;
import java.math.BigDecimal;
/**
* 评分项目选项实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_credit_score_item_option")
@Schema(description = "评分项目选项")
public class CreditScoreItemOption extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 评分量化表ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "评分量化表ID")
private Long quantificationId;
/**
* 评分项目ID
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "评分项目ID")
private Long itemId;
/**
* 选项描述
*/
@Schema(description = "选项描述")
private String optionName;
/**
* 分值
*/
@Schema(description = "分值")
private BigDecimal score;
/**
* 排序
*/
@Schema(description = "排序")
private Integer sort;
}

View File

@@ -0,0 +1,66 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serial;
/**
* 评分量化表实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("blade_credit_score_quantification")
@Schema(description = "评分量化表")
public class CreditScoreQuantification extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 评定表名称
*/
@Schema(description = "评定表名称")
private String name;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 标准说明
*/
@Schema(description = "标准说明")
private String standardDescription;
}

View File

@@ -0,0 +1,48 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.transport.pojo.entity.CreditRatingStandard;
import java.io.Serial;
/**
* 信用等级评估标准视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "信用等级评估标准")
public class CreditRatingStandardVO extends CreditRatingStandard {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,55 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.transport.pojo.entity.CreditScoreCategory;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
/**
* 评分分类视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "评分分类")
public class CreditScoreCategoryVO extends CreditScoreCategory {
@Serial
private static final long serialVersionUID = 1L;
@TableField(exist = false)
@Schema(description = "评分项目")
private List<CreditScoreItemVO> items = new ArrayList<>();
}

View File

@@ -0,0 +1,48 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.transport.pojo.entity.CreditScoreItemOption;
import java.io.Serial;
/**
* 评分项目选项视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "评分项目选项")
public class CreditScoreItemOptionVO extends CreditScoreItemOption {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,55 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.transport.pojo.entity.CreditScoreItem;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
/**
* 评分项目视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "评分项目")
public class CreditScoreItemVO extends CreditScoreItem {
@Serial
private static final long serialVersionUID = 1L;
@TableField(exist = false)
@Schema(description = "选项明细")
private List<CreditScoreItemOptionVO> options = new ArrayList<>();
}

View File

@@ -0,0 +1,71 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.transport.pojo.entity.CreditScoreQuantification;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serial;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 评分量化表视图实体类
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "评分量化表")
public class CreditScoreQuantificationVO extends CreditScoreQuantification {
@Serial
private static final long serialVersionUID = 1L;
@TableField(exist = false)
@Schema(description = "创建开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTimeStart;
@TableField(exist = false)
@Schema(description = "创建结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTimeEnd;
@TableField(exist = false)
@Schema(description = "评分分类")
private List<CreditScoreCategoryVO> categories = new ArrayList<>();
@TableField(exist = false)
@Schema(description = "评估标准")
private List<CreditRatingStandardVO> standards = new ArrayList<>();
}

View File

@@ -0,0 +1,171 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.excel.CurrencyExcel;
import org.springblade.system.excel.CurrencyImporter;
import org.springblade.system.pojo.entity.Currency;
import org.springblade.system.pojo.vo.CurrencyVO;
import org.springblade.system.service.ICurrencyService;
import org.springblade.system.wrapper.CurrencyWrapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 币种主数据 控制器
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@PreAuth(menu = "currency")
@RequestMapping("/currency")
@Tag(name = "币种主数据", description = "币种主数据")
public class CurrencyController extends BladeController {
private final ICurrencyService currencyService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入currency")
public R<CurrencyVO> detail(Currency currency) {
Currency detail = currencyService.getOne(Condition.getQueryWrapper(currency));
return R.data(CurrencyWrapper.build().entityVO(detail));
}
/**
* 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入currency")
public R<IPage<CurrencyVO>> list(CurrencyVO currency, Query query) {
IPage<CurrencyVO> pages = currencyService.selectCurrencyPage(Condition.getPage(query), currency);
return R.data(pages);
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 3)
@Operation(summary = "新增或修改", description = "传入currency")
public R submit(@Valid @RequestBody Currency currency) {
return R.status(currencyService.submit(currency));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(currencyService.deleteLogic(Func.toLongList(ids)));
}
/**
* 启用或停用
*/
@PostMapping("/status")
@ApiOperationSupport(order = 5)
@Operation(summary = "启用或停用", description = "传入id和status")
public R status(@Parameter(description = "主键", required = true) @RequestParam Long id,
@Parameter(description = "状态", required = true) @RequestParam Integer status) {
return R.status(currencyService.changeStatus(id, status));
}
/**
* 导入币种主数据
*/
@PostMapping("/import-currency")
@ApiOperationSupport(order = 6)
@Operation(summary = "导入币种主数据", description = "传入excel")
public R importCurrency(MultipartFile file) {
CurrencyImporter currencyImporter = new CurrencyImporter(currencyService);
ExcelUtil.save(file, currencyImporter, CurrencyExcel.class);
return R.success("操作成功");
}
/**
* 导出币种主数据
*/
@GetMapping("/export-currency")
@ApiOperationSupport(order = 7)
@Operation(summary = "导出币种主数据")
public void exportCurrency(@Parameter(hidden = true) @RequestParam Map<String, Object> currency, HttpServletResponse response) {
Object ids = currency.remove("ids");
QueryWrapper<Currency> queryWrapper = Condition.getQueryWrapper(currency, Currency.class);
if (Func.isNotEmpty(ids)) {
queryWrapper.lambda().in(Currency::getId, Func.toLongList(ids.toString()));
}
List<CurrencyExcel> list = currencyService.exportCurrency(queryWrapper);
ExcelUtil.export(response, "币种主数据" + DateUtil.time(), "币种主数据表", list, CurrencyExcel.class);
}
/**
* 导出模板
*/
@GetMapping("/export-template")
@ApiOperationSupport(order = 8)
@Operation(summary = "导出模板")
public void exportTemplate(HttpServletResponse response) {
List<CurrencyExcel> list = new ArrayList<>();
ExcelUtil.export(response, "币种主数据模板", "币种主数据表", list, CurrencyExcel.class);
}
}

View File

@@ -0,0 +1,121 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.pojo.entity.CustomerType;
import org.springblade.system.pojo.vo.CustomerTypeVO;
import org.springblade.system.service.ICustomerTypeService;
import org.springblade.system.wrapper.CustomerTypeWrapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 客商类型 控制器
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@PreAuth(menu = "customer_type")
@RequestMapping("/customer-type")
@Tag(name = "客商类型", description = "客商类型")
public class CustomerTypeController extends BladeController {
private final ICustomerTypeService customerTypeService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入customerType")
public R<CustomerTypeVO> detail(CustomerType customerType) {
CustomerType detail = customerTypeService.getOne(Condition.getQueryWrapper(customerType));
return R.data(CustomerTypeWrapper.build().entityVO(detail));
}
/**
* 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入customerType")
public R<IPage<CustomerTypeVO>> list(CustomerTypeVO customerType, Query query) {
IPage<CustomerTypeVO> pages = customerTypeService.selectCustomerTypePage(Condition.getPage(query), customerType);
return R.data(pages);
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 3)
@Operation(summary = "新增或修改", description = "传入customerType")
public R submit(@Valid @RequestBody CustomerType customerType) {
return R.status(customerTypeService.submit(customerType));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(customerTypeService.deleteLogic(Func.toLongList(ids)));
}
/**
* 启用或停用
*/
@PostMapping("/status")
@ApiOperationSupport(order = 5)
@Operation(summary = "启用或停用", description = "传入id和status")
public R status(@Parameter(description = "主键", required = true) @RequestParam Long id,
@Parameter(description = "状态", required = true) @RequestParam Integer status) {
return R.status(customerTypeService.changeStatus(id, status));
}
}

View File

@@ -0,0 +1,121 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.pojo.entity.FeeItem;
import org.springblade.system.pojo.vo.FeeItemVO;
import org.springblade.system.service.IFeeItemService;
import org.springblade.system.wrapper.FeeItemWrapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 费用项 控制器
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@PreAuth(menu = "fee_item")
@RequestMapping("/fee-item")
@Tag(name = "费用项", description = "费用项")
public class FeeItemController extends BladeController {
private final IFeeItemService feeItemService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入feeItem")
public R<FeeItemVO> detail(FeeItem feeItem) {
FeeItem detail = feeItemService.getOne(Condition.getQueryWrapper(feeItem));
return R.data(FeeItemWrapper.build().entityVO(detail));
}
/**
* 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入feeItem")
public R<IPage<FeeItemVO>> list(FeeItemVO feeItem, Query query) {
IPage<FeeItemVO> pages = feeItemService.selectFeeItemPage(Condition.getPage(query), feeItem);
return R.data(pages);
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 3)
@Operation(summary = "新增或修改", description = "传入feeItem")
public R submit(@Valid @RequestBody FeeItem feeItem) {
return R.status(feeItemService.submit(feeItem));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(feeItemService.deleteLogic(Func.toLongList(ids)));
}
/**
* 启用或停用
*/
@PostMapping("/status")
@ApiOperationSupport(order = 5)
@Operation(summary = "启用或停用", description = "传入id和status")
public R status(@Parameter(description = "主键", required = true) @RequestParam Long id,
@Parameter(description = "状态", required = true) @RequestParam Integer status) {
return R.status(feeItemService.changeStatus(id, status));
}
}

View File

@@ -0,0 +1,88 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.excel;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 币种主数据 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(18)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class CurrencyExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelIgnore
private Long id;
@ExcelProperty("币种代码")
private String code;
@ExcelProperty("币种中文名称")
private String name;
@ExcelProperty("币种英文名称")
private String englishName;
@ExcelProperty("货币符号")
private String symbol;
@ExcelProperty("小数位数")
private Integer decimalPlaces;
@ExcelProperty("汇率")
private BigDecimal exchangeRate;
@ExcelProperty("是否本位币")
private String baseCurrencyName;
@ExcelProperty("数据来源")
private String dataSource;
@ExcelProperty("状态")
private String statusName;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("报错文案")
private String errorMessage;
}

View File

@@ -0,0 +1,49 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.excel;
import lombok.RequiredArgsConstructor;
import org.springblade.core.excel.support.ExcelImporter;
import org.springblade.system.service.ICurrencyService;
import java.util.List;
/**
* 币种主数据导入类
*
* @author Chill
*/
@RequiredArgsConstructor
public class CurrencyImporter implements ExcelImporter<CurrencyExcel> {
private final ICurrencyService service;
@Override
public void save(List<CurrencyExcel> data) {
service.importCurrency(data);
}
}

View File

@@ -0,0 +1,52 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.system.pojo.entity.Currency;
import org.springblade.system.pojo.vo.CurrencyVO;
import java.util.List;
/**
* 币种主数据 Mapper 接口
*
* @author Chill
*/
public interface CurrencyMapper extends BaseMapper<Currency> {
/**
* 自定义分页
*
* @param page 分页参数
* @param currency 查询参数
* @return 币种分页
*/
List<CurrencyVO> selectCurrencyPage(IPage<CurrencyVO> page, @Param("currency") CurrencyVO currency);
}

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.system.mapper.CurrencyMapper">
<resultMap id="currencyResultMap" type="org.springblade.system.pojo.vo.CurrencyVO">
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="code" property="code"/>
<result column="name" property="name"/>
<result column="english_name" property="englishName"/>
<result column="symbol" property="symbol"/>
<result column="decimal_places" property="decimalPlaces"/>
<result column="exchange_rate" property="exchangeRate"/>
<result column="is_base_currency" property="baseCurrency"/>
<result column="data_source" property="dataSource"/>
<result column="remark" property="remark"/>
</resultMap>
<select id="selectCurrencyPage" resultMap="currencyResultMap">
SELECT
*
FROM
blade_currency
WHERE
is_deleted = 0
<if test="currency.code != null and currency.code != ''">
<bind name="codeLike" value="'%' + currency.code + '%'"/>
AND code LIKE #{codeLike}
</if>
<if test="currency.name != null and currency.name != ''">
<bind name="nameLike" value="'%' + currency.name + '%'"/>
AND name LIKE #{nameLike}
</if>
<if test="currency.englishName != null and currency.englishName != ''">
<bind name="englishNameLike" value="'%' + currency.englishName + '%'"/>
AND english_name LIKE #{englishNameLike}
</if>
<if test="currency.baseCurrency != null">
AND is_base_currency = #{currency.baseCurrency}
</if>
<if test="currency.dataSource != null and currency.dataSource != ''">
AND data_source = #{currency.dataSource}
</if>
<if test="currency.status != null">
AND status = #{currency.status}
</if>
ORDER BY update_time DESC, create_time DESC
</select>
</mapper>

View File

@@ -0,0 +1,52 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.system.pojo.entity.CustomerType;
import org.springblade.system.pojo.vo.CustomerTypeVO;
import java.util.List;
/**
* 客商类型 Mapper 接口
*
* @author Chill
*/
public interface CustomerTypeMapper extends BaseMapper<CustomerType> {
/**
* 自定义分页
*
* @param page 分页参数
* @param customerType 查询参数
* @return 客商类型分页
*/
List<CustomerTypeVO> selectCustomerTypePage(IPage<CustomerTypeVO> page, @Param("customerType") CustomerTypeVO customerType);
}

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.system.mapper.CustomerTypeMapper">
<resultMap id="customerTypeResultMap" type="org.springblade.system.pojo.vo.CustomerTypeVO">
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="name" property="name"/>
<result column="english_name" property="englishName"/>
</resultMap>
<select id="selectCustomerTypePage" resultMap="customerTypeResultMap">
SELECT
*
FROM
blade_customer_type
WHERE
is_deleted = 0
<if test="customerType.name != null and customerType.name != ''">
<bind name="nameLike" value="'%' + customerType.name + '%'"/>
AND name LIKE #{nameLike}
</if>
<if test="customerType.englishName != null and customerType.englishName != ''">
<bind name="englishNameLike" value="'%' + customerType.englishName + '%'"/>
AND english_name LIKE #{englishNameLike}
</if>
<if test="customerType.status != null">
AND status = #{customerType.status}
</if>
ORDER BY update_time DESC, create_time DESC
</select>
</mapper>

View File

@@ -0,0 +1,52 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.system.pojo.entity.FeeItem;
import org.springblade.system.pojo.vo.FeeItemVO;
import java.util.List;
/**
* 费用项 Mapper 接口
*
* @author Chill
*/
public interface FeeItemMapper extends BaseMapper<FeeItem> {
/**
* 自定义分页
*
* @param page 分页参数
* @param feeItem 查询参数
* @return 费用项分页
*/
List<FeeItemVO> selectFeeItemPage(IPage<FeeItemVO> page, @Param("feeItem") FeeItemVO feeItem);
}

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.system.mapper.FeeItemMapper">
<resultMap id="feeItemResultMap" type="org.springblade.system.pojo.vo.FeeItemVO">
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="name" property="name"/>
<result column="english_name" property="englishName"/>
</resultMap>
<select id="selectFeeItemPage" resultMap="feeItemResultMap">
SELECT
*
FROM
blade_fee_item
WHERE
is_deleted = 0
<if test="feeItem.name != null and feeItem.name != ''">
<bind name="nameLike" value="'%' + feeItem.name + '%'"/>
AND name LIKE #{nameLike}
</if>
<if test="feeItem.englishName != null and feeItem.englishName != ''">
<bind name="englishNameLike" value="'%' + feeItem.englishName + '%'"/>
AND english_name LIKE #{englishNameLike}
</if>
<if test="feeItem.status != null">
AND status = #{feeItem.status}
</if>
ORDER BY update_time DESC, create_time DESC
</select>
</mapper>

View File

@@ -0,0 +1,85 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.system.excel.CurrencyExcel;
import org.springblade.system.pojo.entity.Currency;
import org.springblade.system.pojo.vo.CurrencyVO;
import java.util.List;
/**
* 币种主数据 服务类
*
* @author Chill
*/
public interface ICurrencyService extends BaseService<Currency> {
/**
* 自定义分页
*
* @param page 分页参数
* @param currency 查询参数
* @return 币种分页
*/
IPage<CurrencyVO> selectCurrencyPage(IPage<CurrencyVO> page, CurrencyVO currency);
/**
* 新增或修改币种
*
* @param currency 币种
* @return 是否成功
*/
boolean submit(Currency currency);
/**
* 启用或停用
*
* @param id 主键
* @param status 状态
* @return 是否成功
*/
boolean changeStatus(Long id, Integer status);
/**
* 导入币种
*
* @param data 导入数据
*/
void importCurrency(List<CurrencyExcel> data);
/**
* 导出币种
*
* @param queryWrapper 查询条件
* @return 导出数据
*/
List<CurrencyExcel> exportCurrency(Wrapper<Currency> queryWrapper);
}

View File

@@ -0,0 +1,66 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.system.pojo.entity.CustomerType;
import org.springblade.system.pojo.vo.CustomerTypeVO;
/**
* 客商类型 服务类
*
* @author Chill
*/
public interface ICustomerTypeService extends BaseService<CustomerType> {
/**
* 自定义分页
*
* @param page 分页参数
* @param customerType 查询参数
* @return 客商类型分页
*/
IPage<CustomerTypeVO> selectCustomerTypePage(IPage<CustomerTypeVO> page, CustomerTypeVO customerType);
/**
* 新增或修改客商类型
*
* @param customerType 客商类型
* @return 是否成功
*/
boolean submit(CustomerType customerType);
/**
* 启用或停用
*
* @param id 主键
* @param status 状态
* @return 是否成功
*/
boolean changeStatus(Long id, Integer status);
}

View File

@@ -0,0 +1,66 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.system.pojo.entity.FeeItem;
import org.springblade.system.pojo.vo.FeeItemVO;
/**
* 费用项 服务类
*
* @author Chill
*/
public interface IFeeItemService extends BaseService<FeeItem> {
/**
* 自定义分页
*
* @param page 分页参数
* @param feeItem 查询参数
* @return 费用项分页
*/
IPage<FeeItemVO> selectFeeItemPage(IPage<FeeItemVO> page, FeeItemVO feeItem);
/**
* 新增或修改费用项
*
* @param feeItem 费用项
* @return 是否成功
*/
boolean submit(FeeItem feeItem);
/**
* 启用或停用
*
* @param id 主键
* @param status 状态
* @return 是否成功
*/
boolean changeStatus(Long id, Integer status);
}

View File

@@ -0,0 +1,234 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.excel.CurrencyExcel;
import org.springblade.system.mapper.CurrencyMapper;
import org.springblade.system.pojo.entity.Currency;
import org.springblade.system.pojo.vo.CurrencyVO;
import org.springblade.system.service.ICurrencyService;
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.Locale;
import java.util.Objects;
import java.util.regex.Pattern;
/**
* 币种主数据 服务实现类
*
* @author Chill
*/
@Service
public class CurrencyServiceImpl extends BaseServiceImpl<CurrencyMapper, Currency> implements ICurrencyService {
private static final String SOURCE_BATCH = "批量导入";
private static final String SOURCE_MANUAL = "手工导入";
private static final int STATUS_ENABLED = 1;
private static final int STATUS_DISABLED = 2;
private static final int YES = 1;
private static final int NO = 0;
private static final int REMARK_MAX_LENGTH = 200;
private static final int MIN_DECIMAL_PLACES = 0;
private static final int MAX_DECIMAL_PLACES = 8;
private static final Pattern CURRENCY_CODE_PATTERN = Pattern.compile("^[A-Z]{3}$");
@Override
public IPage<CurrencyVO> selectCurrencyPage(IPage<CurrencyVO> page, CurrencyVO currency) {
return page.setRecords(baseMapper.selectCurrencyPage(page, currency));
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submit(Currency currency) {
prepare(currency, SOURCE_MANUAL);
validate(currency);
return saveOrUpdate(currency);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean changeStatus(Long id, Integer status) {
if (Func.isEmpty(id)) {
throw new ServiceException("主键不能为空");
}
Currency currency = getById(id);
if (Func.isEmpty(currency)) {
throw new ServiceException("币种不存在");
}
if (!Objects.equals(status, STATUS_ENABLED) && !Objects.equals(status, STATUS_DISABLED)) {
throw new ServiceException("启停状态不正确");
}
Currency update = new Currency();
update.setId(id);
update.setStatus(status);
return updateById(update);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void importCurrency(List<CurrencyExcel> data) {
List<String> errorList = new ArrayList<>();
for (int index = 0; index < data.size(); index++) {
CurrencyExcel excel = data.get(index);
try {
Currency currency = Objects.requireNonNull(BeanUtil.copyProperties(excel, Currency.class));
currency.setBaseCurrency(parseBaseCurrency(excel.getBaseCurrencyName()));
currency.setDataSource(SOURCE_BATCH);
currency.setStatus(STATUS_ENABLED);
prepare(currency, SOURCE_BATCH);
validate(currency);
save(currency);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
errorList.add("" + (index + 2) + "行:" + message);
}
}
if (Func.isNotEmpty(errorList)) {
throw new ServiceException(String.join("", errorList));
}
}
@Override
public List<CurrencyExcel> exportCurrency(Wrapper<Currency> queryWrapper) {
List<Currency> currencyList = list(queryWrapper);
return currencyList.stream().map(currency -> {
CurrencyExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(currency, CurrencyExcel.class));
excel.setBaseCurrencyName(Objects.equals(currency.getBaseCurrency(), YES) ? "" : "");
excel.setStatusName(Objects.equals(currency.getStatus(), STATUS_ENABLED) ? "启用" : "停用");
return excel;
}).toList();
}
private void prepare(Currency currency, String defaultDataSource) {
currency.setCode(trimToEmpty(currency.getCode()).toUpperCase(Locale.ROOT));
currency.setName(trimToEmpty(currency.getName()));
currency.setEnglishName(trimToNull(currency.getEnglishName()));
currency.setSymbol(trimToNull(currency.getSymbol()));
currency.setRemark(trimToNull(currency.getRemark()));
currency.setDataSource(Func.toStrWithEmpty(currency.getDataSource(), defaultDataSource));
if (Func.isEmpty(currency.getDecimalPlaces())) {
currency.setDecimalPlaces(2);
}
if (Func.isEmpty(currency.getExchangeRate())) {
currency.setExchangeRate(BigDecimal.ONE);
}
if (Func.isEmpty(currency.getBaseCurrency())) {
currency.setBaseCurrency(NO);
}
if (Func.isEmpty(currency.getStatus())) {
currency.setStatus(STATUS_ENABLED);
}
}
private void validate(Currency currency) {
if (Func.isEmpty(currency.getCode())) {
throw new ServiceException("币种代码不能为空");
}
if (!CURRENCY_CODE_PATTERN.matcher(currency.getCode()).matches()) {
throw new ServiceException("币种代码为3位大写字母");
}
if (Func.isEmpty(currency.getName())) {
throw new ServiceException("币种中文名称不能为空");
}
if (currency.getDecimalPlaces() < MIN_DECIMAL_PLACES || currency.getDecimalPlaces() > MAX_DECIMAL_PLACES) {
throw new ServiceException("小数位数范围为0到8");
}
if (currency.getExchangeRate().compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("汇率必须大于0");
}
if (!Objects.equals(currency.getBaseCurrency(), YES) && !Objects.equals(currency.getBaseCurrency(), NO)) {
throw new ServiceException("是否本位币取值不正确");
}
if (Objects.equals(currency.getBaseCurrency(), YES) && currency.getExchangeRate().compareTo(BigDecimal.ONE) != 0) {
throw new ServiceException("本位币汇率必须为1");
}
if (Func.isNotEmpty(currency.getRemark()) && currency.getRemark().length() > REMARK_MAX_LENGTH) {
throw new ServiceException("备注不能超过200字");
}
validateUnique(currency, Currency::getCode, currency.getCode(), "该币种代码已存在");
validateBaseCurrency(currency);
}
private void validateUnique(Currency currency, com.baomidou.mybatisplus.core.toolkit.support.SFunction<Currency, ?> column, String value, String message) {
LambdaQueryWrapper<Currency> queryWrapper = Wrappers.<Currency>lambdaQuery()
.eq(column, value)
.eq(Currency::getIsDeleted, 0);
if (Func.isNotEmpty(currency.getId())) {
queryWrapper.ne(Currency::getId, currency.getId());
}
if (count(queryWrapper) > 0L) {
throw new ServiceException(message);
}
}
private void validateBaseCurrency(Currency currency) {
if (!Objects.equals(currency.getBaseCurrency(), YES)) {
return;
}
LambdaQueryWrapper<Currency> queryWrapper = Wrappers.<Currency>lambdaQuery()
.eq(Currency::getBaseCurrency, YES)
.eq(Currency::getIsDeleted, 0);
if (Func.isNotEmpty(currency.getId())) {
queryWrapper.ne(Currency::getId, currency.getId());
}
if (count(queryWrapper) > 0L) {
throw new ServiceException("本位币只能设置一个");
}
}
private Integer parseBaseCurrency(String value) {
String trimValue = trimToEmpty(value);
if (Func.isEmpty(trimValue) || "".equals(trimValue) || "0".equals(trimValue)) {
return NO;
}
if ("".equals(trimValue) || "1".equals(trimValue)) {
return YES;
}
throw new ServiceException("是否本位币只能填写是或否");
}
private String trimToEmpty(String value) {
return value == null ? "" : value.trim();
}
private String trimToNull(String value) {
String trimValue = trimToEmpty(value);
return trimValue.isEmpty() ? null : trimValue;
}
}

View File

@@ -0,0 +1,130 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.mapper.CustomerTypeMapper;
import org.springblade.system.pojo.entity.CustomerType;
import org.springblade.system.pojo.vo.CustomerTypeVO;
import org.springblade.system.service.ICustomerTypeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
/**
* 客商类型 服务实现类
*
* @author Chill
*/
@Service
public class CustomerTypeServiceImpl extends BaseServiceImpl<CustomerTypeMapper, CustomerType> implements ICustomerTypeService {
private static final int STATUS_ENABLED = 1;
private static final int STATUS_DISABLED = 2;
private static final int NAME_MAX_LENGTH = 50;
private static final int ENGLISH_NAME_MAX_LENGTH = 100;
@Override
public IPage<CustomerTypeVO> selectCustomerTypePage(IPage<CustomerTypeVO> page, CustomerTypeVO customerType) {
return page.setRecords(baseMapper.selectCustomerTypePage(page, customerType));
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submit(CustomerType customerType) {
prepare(customerType);
validate(customerType);
return saveOrUpdate(customerType);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean changeStatus(Long id, Integer status) {
if (Func.isEmpty(id)) {
throw new ServiceException("主键不能为空");
}
CustomerType customerType = getById(id);
if (Func.isEmpty(customerType)) {
throw new ServiceException("客商类型不存在");
}
if (!Objects.equals(status, STATUS_ENABLED) && !Objects.equals(status, STATUS_DISABLED)) {
throw new ServiceException("启停状态不正确");
}
CustomerType update = new CustomerType();
update.setId(id);
update.setStatus(status);
return updateById(update);
}
private void prepare(CustomerType customerType) {
customerType.setName(trimToEmpty(customerType.getName()));
customerType.setEnglishName(trimToNull(customerType.getEnglishName()));
if (Func.isEmpty(customerType.getStatus())) {
customerType.setStatus(STATUS_ENABLED);
}
}
private void validate(CustomerType customerType) {
if (Func.isEmpty(customerType.getName())) {
throw new ServiceException("中文名称不能为空");
}
if (customerType.getName().length() > NAME_MAX_LENGTH) {
throw new ServiceException("中文名称不能超过50字");
}
if (Func.isNotEmpty(customerType.getEnglishName()) && customerType.getEnglishName().length() > ENGLISH_NAME_MAX_LENGTH) {
throw new ServiceException("英文名称不能超过100字");
}
validateUniqueName(customerType);
}
private void validateUniqueName(CustomerType customerType) {
LambdaQueryWrapper<CustomerType> queryWrapper = Wrappers.<CustomerType>lambdaQuery()
.eq(CustomerType::getName, customerType.getName())
.eq(CustomerType::getIsDeleted, 0);
if (Func.isNotEmpty(customerType.getId())) {
queryWrapper.ne(CustomerType::getId, customerType.getId());
}
if (count(queryWrapper) > 0L) {
throw new ServiceException("该中文名称已存在");
}
}
private String trimToEmpty(String value) {
return value == null ? "" : value.trim();
}
private String trimToNull(String value) {
String trimValue = trimToEmpty(value);
return trimValue.isEmpty() ? null : trimValue;
}
}

View File

@@ -0,0 +1,130 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.mapper.FeeItemMapper;
import org.springblade.system.pojo.entity.FeeItem;
import org.springblade.system.pojo.vo.FeeItemVO;
import org.springblade.system.service.IFeeItemService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
/**
* 费用项 服务实现类
*
* @author Chill
*/
@Service
public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem> implements IFeeItemService {
private static final int STATUS_ENABLED = 1;
private static final int STATUS_DISABLED = 2;
private static final int NAME_MAX_LENGTH = 50;
private static final int ENGLISH_NAME_MAX_LENGTH = 100;
@Override
public IPage<FeeItemVO> selectFeeItemPage(IPage<FeeItemVO> page, FeeItemVO feeItem) {
return page.setRecords(baseMapper.selectFeeItemPage(page, feeItem));
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submit(FeeItem feeItem) {
prepare(feeItem);
validate(feeItem);
return saveOrUpdate(feeItem);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean changeStatus(Long id, Integer status) {
if (Func.isEmpty(id)) {
throw new ServiceException("主键不能为空");
}
FeeItem feeItem = getById(id);
if (Func.isEmpty(feeItem)) {
throw new ServiceException("费用项不存在");
}
if (!Objects.equals(status, STATUS_ENABLED) && !Objects.equals(status, STATUS_DISABLED)) {
throw new ServiceException("启停状态不正确");
}
FeeItem update = new FeeItem();
update.setId(id);
update.setStatus(status);
return updateById(update);
}
private void prepare(FeeItem feeItem) {
feeItem.setName(trimToEmpty(feeItem.getName()));
feeItem.setEnglishName(trimToNull(feeItem.getEnglishName()));
if (Func.isEmpty(feeItem.getStatus())) {
feeItem.setStatus(STATUS_ENABLED);
}
}
private void validate(FeeItem feeItem) {
if (Func.isEmpty(feeItem.getName())) {
throw new ServiceException("中文名称不能为空");
}
if (feeItem.getName().length() > NAME_MAX_LENGTH) {
throw new ServiceException("中文名称不能超过50字");
}
if (Func.isNotEmpty(feeItem.getEnglishName()) && feeItem.getEnglishName().length() > ENGLISH_NAME_MAX_LENGTH) {
throw new ServiceException("英文名称不能超过100字");
}
validateUniqueName(feeItem);
}
private void validateUniqueName(FeeItem feeItem) {
LambdaQueryWrapper<FeeItem> queryWrapper = Wrappers.<FeeItem>lambdaQuery()
.eq(FeeItem::getName, feeItem.getName())
.eq(FeeItem::getIsDeleted, 0);
if (Func.isNotEmpty(feeItem.getId())) {
queryWrapper.ne(FeeItem::getId, feeItem.getId());
}
if (count(queryWrapper) > 0L) {
throw new ServiceException("该中文名称已存在");
}
}
private String trimToEmpty(String value) {
return value == null ? "" : value.trim();
}
private String trimToNull(String value) {
String trimValue = trimToEmpty(value);
return trimValue.isEmpty() ? null : trimValue;
}
}

View File

@@ -0,0 +1,51 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.pojo.entity.Currency;
import org.springblade.system.pojo.vo.CurrencyVO;
import java.util.Objects;
/**
* 币种主数据包装类
*
* @author Chill
*/
public class CurrencyWrapper extends BaseEntityWrapper<Currency, CurrencyVO> {
public static CurrencyWrapper build() {
return new CurrencyWrapper();
}
@Override
public CurrencyVO entityVO(Currency currency) {
return Objects.requireNonNull(BeanUtil.copyProperties(currency, CurrencyVO.class));
}
}

View File

@@ -0,0 +1,51 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.pojo.entity.CustomerType;
import org.springblade.system.pojo.vo.CustomerTypeVO;
import java.util.Objects;
/**
* 客商类型包装类
*
* @author Chill
*/
public class CustomerTypeWrapper extends BaseEntityWrapper<CustomerType, CustomerTypeVO> {
public static CustomerTypeWrapper build() {
return new CustomerTypeWrapper();
}
@Override
public CustomerTypeVO entityVO(CustomerType customerType) {
return Objects.requireNonNull(BeanUtil.copyProperties(customerType, CustomerTypeVO.class));
}
}

View File

@@ -0,0 +1,51 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.system.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.pojo.entity.FeeItem;
import org.springblade.system.pojo.vo.FeeItemVO;
import java.util.Objects;
/**
* 费用项包装类
*
* @author Chill
*/
public class FeeItemWrapper extends BaseEntityWrapper<FeeItem, FeeItemVO> {
public static FeeItemWrapper build() {
return new FeeItemWrapper();
}
@Override
public FeeItemVO entityVO(FeeItem feeItem) {
return Objects.requireNonNull(BeanUtil.copyProperties(feeItem, FeeItemVO.class));
}
}

View File

@@ -0,0 +1,192 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.CreditScoreQuantificationExcel;
import org.springblade.transport.excel.CreditScoreQuantificationImporter;
import org.springblade.transport.pojo.entity.CreditScoreQuantification;
import org.springblade.transport.pojo.vo.CreditScoreQuantificationVO;
import org.springblade.transport.service.ICreditScoreQuantificationService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
/**
* 评分量化表 控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@PreAuth(menu = "credit_score_quantification")
@RequestMapping("/credit-score-quantification")
@Tag(name = "评分量化表", description = "评分量化表")
public class CreditScoreQuantificationController extends BladeController {
private final ICreditScoreQuantificationService creditScoreQuantificationService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入id")
public R<CreditScoreQuantificationVO> detail(@Parameter(description = "主键", required = true) @RequestParam Long id) {
return R.data(creditScoreQuantificationService.detail(id));
}
/**
* 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入creditScoreQuantification")
public R<IPage<CreditScoreQuantificationVO>> list(CreditScoreQuantificationVO creditScoreQuantification, Query query) {
IPage<CreditScoreQuantificationVO> pages = creditScoreQuantificationService.selectCreditScoreQuantificationPage(Condition.getPage(query), creditScoreQuantification);
return R.data(pages);
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 3)
@Operation(summary = "新增或修改", description = "传入creditScoreQuantification")
public R submit(@RequestBody CreditScoreQuantificationVO creditScoreQuantification) {
return R.status(creditScoreQuantificationService.submit(creditScoreQuantification));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(creditScoreQuantificationService.removeDraft(ids));
}
/**
* 发布
*/
@PostMapping("/publish")
@ApiOperationSupport(order = 5)
@Operation(summary = "发布", description = "传入id")
public R publish(@Parameter(description = "主键", required = true) @RequestParam Long id) {
return R.status(creditScoreQuantificationService.publish(id));
}
/**
* 启用或停用
*/
@PostMapping("/status")
@ApiOperationSupport(order = 6)
@Operation(summary = "启用或停用", description = "传入id和status")
public R status(@Parameter(description = "主键", required = true) @RequestParam Long id,
@Parameter(description = "状态", required = true) @RequestParam Integer status) {
return R.status(creditScoreQuantificationService.changeStatus(id, status));
}
/**
* 导入评分量化表
*/
@PostMapping("/import-credit-score-quantification")
@ApiOperationSupport(order = 7)
@Operation(summary = "导入评分量化表", description = "传入excel")
public R importCreditScoreQuantification(MultipartFile file) {
CreditScoreQuantificationImporter importer = new CreditScoreQuantificationImporter(creditScoreQuantificationService);
ExcelUtil.save(file, importer, CreditScoreQuantificationExcel.class);
return R.success("操作成功");
}
/**
* 导出评分量化表
*/
@GetMapping("/export-credit-score-quantification")
@ApiOperationSupport(order = 8)
@Operation(summary = "导出评分量化表")
public void exportCreditScoreQuantification(CreditScoreQuantificationVO creditScoreQuantification,
@RequestParam(required = false) String ids,
HttpServletResponse response) {
List<CreditScoreQuantificationExcel> list = creditScoreQuantificationService.exportCreditScoreQuantification(buildExportQuery(creditScoreQuantification, ids));
ExcelUtil.export(response, "评分量化表" + DateUtil.time(), "评分量化表", list, CreditScoreQuantificationExcel.class);
}
/**
* 导出模板
*/
@GetMapping("/export-template")
@ApiOperationSupport(order = 9)
@Operation(summary = "导出模板")
public void exportTemplate(HttpServletResponse response) {
List<CreditScoreQuantificationExcel> list = new ArrayList<>();
ExcelUtil.export(response, "评分量化表模板", "评分量化表", list, CreditScoreQuantificationExcel.class);
}
private LambdaQueryWrapper<CreditScoreQuantification> buildExportQuery(CreditScoreQuantificationVO creditScoreQuantification, String ids) {
LambdaQueryWrapper<CreditScoreQuantification> queryWrapper = Wrappers.<CreditScoreQuantification>lambdaQuery()
.eq(CreditScoreQuantification::getIsDeleted, 0)
.orderByDesc(CreditScoreQuantification::getCreateTime);
if (Func.isNotEmpty(ids)) {
queryWrapper.in(CreditScoreQuantification::getId, Func.toLongList(ids));
}
if (Func.isNotEmpty(creditScoreQuantification.getName())) {
queryWrapper.like(CreditScoreQuantification::getName, creditScoreQuantification.getName());
}
if (Func.isNotEmpty(creditScoreQuantification.getStatus())) {
queryWrapper.eq(CreditScoreQuantification::getStatus, creditScoreQuantification.getStatus());
}
if (Func.isNotEmpty(creditScoreQuantification.getCreateTimeStart())) {
queryWrapper.ge(CreditScoreQuantification::getCreateTime, creditScoreQuantification.getCreateTimeStart());
}
if (Func.isNotEmpty(creditScoreQuantification.getCreateTimeEnd())) {
queryWrapper.le(CreditScoreQuantification::getCreateTime, creditScoreQuantification.getCreateTimeEnd());
}
return queryWrapper;
}
}

View File

@@ -0,0 +1,109 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 评分量化表 Excel
*
* @author Chill
*/
@Data
@ColumnWidth(20)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class CreditScoreQuantificationExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ExcelProperty("评定表名称")
private String tableName;
@ExcelProperty("数据类型")
private String rowType;
@ExcelProperty("量表备注")
private String remark;
@ExcelProperty("量表标准说明")
private String tableStandardDescription;
@ExcelProperty("状态")
private String statusName;
@ExcelProperty("评分分类")
private String categoryName;
@ExcelProperty("评分项目")
private String itemName;
@ExcelProperty("得分说明")
private String scoreDescription;
@ExcelProperty("选项描述")
private String optionDescription;
@ExcelProperty("档位选项")
private String optionName;
@ExcelProperty("分值")
private BigDecimal score;
@ExcelProperty("信用等级")
private String creditLevel;
@ExcelProperty("得分率下限")
private Integer scoreRateLower;
@ExcelProperty("得分率上限")
private Integer scoreRateUpper;
@ExcelProperty("得分率每增加")
private Integer scoreRateIncrease;
@ExcelProperty("额度下限(万元)")
private BigDecimal creditLimitLower;
@ExcelProperty("额度上限(万元)")
private BigDecimal creditLimitUpper;
@ExcelProperty("额度增加(万元)")
private BigDecimal creditLimitIncrease;
@ExcelProperty("评估标准说明")
private String ratingStandardDescription;
@ExcelProperty("报错文案")
private String errorMessage;
}

View File

@@ -0,0 +1,43 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.excel;
import lombok.RequiredArgsConstructor;
import org.springblade.core.excel.support.ExcelImporter;
import org.springblade.transport.service.ICreditScoreQuantificationService;
import java.util.List;
/**
* 评分量化表导入类
*
* @author Chill
*/
@RequiredArgsConstructor
public class CreditScoreQuantificationImporter implements ExcelImporter<CreditScoreQuantificationExcel> {
private final ICreditScoreQuantificationService service;
@Override
public void save(List<CreditScoreQuantificationExcel> data) {
service.importCreditScoreQuantification(data);
}
}

View File

@@ -0,0 +1,34 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.transport.pojo.entity.CreditRatingStandard;
/**
* 信用等级评估标准 Mapper 接口
*
* @author Chill
*/
public interface CreditRatingStandardMapper extends BaseMapper<CreditRatingStandard> {
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.transport.mapper.CreditRatingStandardMapper">
</mapper>

View File

@@ -0,0 +1,37 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.transport.pojo.entity.CreditScoreCategory;
/**
* 评分分类 Mapper 接口
*
* @author Chill
*/
public interface CreditScoreCategoryMapper extends BaseMapper<CreditScoreCategory> {
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.transport.mapper.CreditScoreCategoryMapper">
</mapper>

View File

@@ -0,0 +1,37 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.transport.pojo.entity.CreditScoreItem;
/**
* 评分项目 Mapper 接口
*
* @author Chill
*/
public interface CreditScoreItemMapper extends BaseMapper<CreditScoreItem> {
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.transport.mapper.CreditScoreItemMapper">
</mapper>

View File

@@ -0,0 +1,34 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.transport.pojo.entity.CreditScoreItemOption;
/**
* 评分项目选项 Mapper 接口
*
* @author Chill
*/
public interface CreditScoreItemOptionMapper extends BaseMapper<CreditScoreItemOption> {
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.transport.mapper.CreditScoreItemOptionMapper">
</mapper>

View File

@@ -0,0 +1,52 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.transport.pojo.entity.CreditScoreQuantification;
import org.springblade.transport.pojo.vo.CreditScoreQuantificationVO;
import java.util.List;
/**
* 评分量化表 Mapper 接口
*
* @author Chill
*/
public interface CreditScoreQuantificationMapper extends BaseMapper<CreditScoreQuantification> {
/**
* 自定义分页
*
* @param page 分页参数
* @param quantification 查询参数
* @return 评分量化表列表
*/
List<CreditScoreQuantificationVO> selectCreditScoreQuantificationPage(IPage<CreditScoreQuantificationVO> page, @Param("quantification") CreditScoreQuantificationVO quantification);
}

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.transport.mapper.CreditScoreQuantificationMapper">
<resultMap id="creditScoreQuantificationResultMap" type="org.springblade.transport.pojo.vo.CreditScoreQuantificationVO">
<result column="id" property="id"/>
<result column="tenant_id" property="tenantId"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="name" property="name"/>
<result column="remark" property="remark"/>
<result column="standard_description" property="standardDescription"/>
</resultMap>
<select id="selectCreditScoreQuantificationPage" resultMap="creditScoreQuantificationResultMap">
SELECT
id,
tenant_id,
create_user,
create_dept,
create_time,
update_user,
update_time,
status,
is_deleted,
name,
remark,
standard_description
FROM
blade_credit_score_quantification
WHERE
is_deleted = 0
<if test="quantification.name != null and quantification.name != ''">
<bind name="nameLike" value="'%' + quantification.name + '%'"/>
AND name LIKE #{nameLike}
</if>
<if test="quantification.status != null">
AND status = #{quantification.status}
</if>
<if test="quantification.createTimeStart != null and quantification.createTimeStart != ''">
AND create_time &gt;= #{quantification.createTimeStart}
</if>
<if test="quantification.createTimeEnd != null and quantification.createTimeEnd != ''">
AND create_time &lt;= #{quantification.createTimeEnd}
</if>
ORDER BY create_time DESC
</select>
</mapper>

View File

@@ -0,0 +1,109 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springblade.core.mp.base.BaseService;
import org.springblade.transport.excel.CreditScoreQuantificationExcel;
import org.springblade.transport.pojo.entity.CreditScoreQuantification;
import org.springblade.transport.pojo.vo.CreditScoreQuantificationVO;
import java.util.List;
/**
* 评分量化表 服务类
*
* @author Chill
*/
public interface ICreditScoreQuantificationService extends BaseService<CreditScoreQuantification> {
/**
* 自定义分页
*
* @param page 分页参数
* @param quantification 查询参数
* @return 评分量化表分页
*/
IPage<CreditScoreQuantificationVO> selectCreditScoreQuantificationPage(IPage<CreditScoreQuantificationVO> page, CreditScoreQuantificationVO quantification);
/**
* 聚合详情
*
* @param id 主键
* @return 评分量化表详情
*/
CreditScoreQuantificationVO detail(Long id);
/**
* 新增或修改评分量化表全部配置
*
* @param quantification 评分量化表
* @return 是否成功
*/
boolean submit(CreditScoreQuantificationVO quantification);
/**
* 发布评分量化表
*
* @param id 主键
* @return 是否成功
*/
boolean publish(Long id);
/**
* 启用或停用
*
* @param id 主键
* @param status 状态
* @return 是否成功
*/
boolean changeStatus(Long id, Integer status);
/**
* 删除草稿量表
*
* @param ids 主键集合
* @return 是否成功
*/
boolean removeDraft(String ids);
/**
* 导入评分量化表
*
* @param data 导入数据
*/
void importCreditScoreQuantification(List<CreditScoreQuantificationExcel> data);
/**
* 导出评分量化表
*
* @param queryWrapper 查询条件
* @return 导出数据
*/
List<CreditScoreQuantificationExcel> exportCreditScoreQuantification(Wrapper<CreditScoreQuantification> queryWrapper);
}

View File

@@ -0,0 +1,698 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.transport.excel.CreditScoreQuantificationExcel;
import org.springblade.transport.mapper.CreditRatingStandardMapper;
import org.springblade.transport.mapper.CreditScoreCategoryMapper;
import org.springblade.transport.mapper.CreditScoreItemMapper;
import org.springblade.transport.mapper.CreditScoreItemOptionMapper;
import org.springblade.transport.mapper.CreditScoreQuantificationMapper;
import org.springblade.transport.pojo.entity.CreditRatingStandard;
import org.springblade.transport.pojo.entity.CreditScoreCategory;
import org.springblade.transport.pojo.entity.CreditScoreItem;
import org.springblade.transport.pojo.entity.CreditScoreItemOption;
import org.springblade.transport.pojo.entity.CreditScoreQuantification;
import org.springblade.transport.pojo.vo.CreditRatingStandardVO;
import org.springblade.transport.pojo.vo.CreditScoreCategoryVO;
import org.springblade.transport.pojo.vo.CreditScoreItemOptionVO;
import org.springblade.transport.pojo.vo.CreditScoreItemVO;
import org.springblade.transport.pojo.vo.CreditScoreQuantificationVO;
import org.springblade.transport.service.ICreditScoreQuantificationService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 评分量化表 服务实现类
*
* @author Chill
*/
@Service
@RequiredArgsConstructor
public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<CreditScoreQuantificationMapper, CreditScoreQuantification> implements ICreditScoreQuantificationService {
private static final int STATUS_NORMAL = 1;
private static final int STATUS_DISABLED = 2;
private static final int STATUS_DRAFT = 3;
private static final int NAME_MAX_LENGTH = 30;
private static final int REMARK_MAX_LENGTH = 500;
private static final int ITEM_NAME_MAX_LENGTH = 20;
private static final int SCORE_DESCRIPTION_MAX_LENGTH = 300;
private static final int OPTION_NAME_MAX_LENGTH = 100;
private static final int STANDARD_DESCRIPTION_MAX_LENGTH = 500;
private static final String CATEGORY_BASIC = "basic";
private static final String CATEGORY_PLUS = "plus";
private static final String CATEGORY_MINUS = "minus";
private static final String ROW_TYPE_MAIN = "主表";
private static final String ROW_TYPE_ITEM = "评分项目";
private static final String ROW_TYPE_OPTION = "选项";
private static final String ROW_TYPE_STANDARD = "评估标准";
private final CreditScoreCategoryMapper categoryMapper;
private final CreditScoreItemMapper itemMapper;
private final CreditScoreItemOptionMapper optionMapper;
private final CreditRatingStandardMapper standardMapper;
@Override
public IPage<CreditScoreQuantificationVO> selectCreditScoreQuantificationPage(IPage<CreditScoreQuantificationVO> page, CreditScoreQuantificationVO quantification) {
return page.setRecords(baseMapper.selectCreditScoreQuantificationPage(page, quantification));
}
@Override
public CreditScoreQuantificationVO detail(Long id) {
if (Func.isEmpty(id)) {
throw new ServiceException("主键不能为空");
}
CreditScoreQuantification quantification = getById(id);
if (Func.isEmpty(quantification) || Objects.equals(quantification.getIsDeleted(), 1)) {
throw new ServiceException("评分量化表不存在");
}
CreditScoreQuantificationVO detail = Objects.requireNonNull(BeanUtil.copyProperties(quantification, CreditScoreQuantificationVO.class));
detail.setCategories(loadCategories(id));
detail.setStandards(loadStandards(id));
return detail;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submit(CreditScoreQuantificationVO quantification) {
prepare(quantification);
validateBase(quantification);
boolean fullValidate = Objects.equals(quantification.getStatus(), STATUS_NORMAL);
validateDetail(quantification, fullValidate);
CreditScoreQuantification entity = Objects.requireNonNull(BeanUtil.copyProperties(quantification, CreditScoreQuantification.class));
if (Func.isEmpty(entity.getStatus())) {
entity.setStatus(STATUS_DRAFT);
}
boolean result = saveOrUpdate(entity);
replaceDetail(entity.getId(), quantification);
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean publish(Long id) {
CreditScoreQuantificationVO detail = detail(id);
detail.setStatus(STATUS_NORMAL);
validateDetail(detail, true);
CreditScoreQuantification update = new CreditScoreQuantification();
update.setId(id);
update.setStatus(STATUS_NORMAL);
return updateById(update);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean changeStatus(Long id, Integer status) {
if (Func.isEmpty(id)) {
throw new ServiceException("主键不能为空");
}
if (!Objects.equals(status, STATUS_NORMAL) && !Objects.equals(status, STATUS_DISABLED)) {
throw new ServiceException("启停状态不正确");
}
CreditScoreQuantification detail = getById(id);
if (Func.isEmpty(detail) || Objects.equals(detail.getIsDeleted(), 1)) {
throw new ServiceException("评分量化表不存在");
}
if (Objects.equals(detail.getStatus(), STATUS_DRAFT)) {
throw new ServiceException("草稿量表请先发布");
}
if (Objects.equals(status, STATUS_NORMAL)) {
validateDetail(detail(id), true);
}
CreditScoreQuantification update = new CreditScoreQuantification();
update.setId(id);
update.setStatus(status);
return updateById(update);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean removeDraft(String ids) {
List<Long> idList = Func.toLongList(ids);
if (Func.isEmpty(idList)) {
throw new ServiceException("请选择需要删除的数据");
}
List<CreditScoreQuantification> list = listByIds(idList);
for (CreditScoreQuantification quantification : list) {
if (!Objects.equals(quantification.getStatus(), STATUS_DRAFT)) {
throw new ServiceException("仅草稿状态量表可删除");
}
}
deleteDetail(idList);
return deleteLogic(idList);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void importCreditScoreQuantification(List<CreditScoreQuantificationExcel> data) {
if (Func.isEmpty(data)) {
throw new ServiceException("导入数据不能为空");
}
Map<String, List<CreditScoreQuantificationExcel>> dataMap = data.stream()
.filter(row -> Func.isNotEmpty(trimToNull(row.getTableName())))
.collect(Collectors.groupingBy(row -> trimToEmpty(row.getTableName()), java.util.LinkedHashMap::new, Collectors.toList()));
if (Func.isEmpty(dataMap)) {
throw new ServiceException("评定表名称不能为空");
}
List<String> errorList = new ArrayList<>();
dataMap.forEach((tableName, rows) -> {
try {
submit(buildImportVO(tableName, rows));
} catch (Exception exception) {
errorList.add(tableName + "" + exception.getMessage());
}
});
if (Func.isNotEmpty(errorList)) {
throw new ServiceException(String.join("", errorList));
}
}
@Override
public List<CreditScoreQuantificationExcel> exportCreditScoreQuantification(Wrapper<CreditScoreQuantification> queryWrapper) {
List<CreditScoreQuantificationExcel> excelList = new ArrayList<>();
List<CreditScoreQuantification> quantificationList = list(queryWrapper);
for (CreditScoreQuantification quantification : quantificationList) {
CreditScoreQuantificationVO detail = detail(quantification.getId());
excelList.add(buildMainExcel(detail));
for (CreditScoreCategoryVO category : detail.getCategories()) {
for (CreditScoreItemVO item : category.getItems()) {
excelList.add(buildItemExcel(detail, category, item));
for (CreditScoreItemOptionVO option : item.getOptions()) {
excelList.add(buildOptionExcel(detail, category, item, option));
}
}
}
for (CreditRatingStandardVO standard : detail.getStandards()) {
excelList.add(buildStandardExcel(detail, standard));
}
}
return excelList;
}
private List<CreditScoreCategoryVO> loadCategories(Long quantificationId) {
List<CreditScoreCategory> categories = categoryMapper.selectList(Wrappers.<CreditScoreCategory>lambdaQuery()
.eq(CreditScoreCategory::getQuantificationId, quantificationId)
.eq(CreditScoreCategory::getIsDeleted, 0)
.orderByAsc(CreditScoreCategory::getSort));
if (Func.isEmpty(categories)) {
return defaultCategories();
}
List<CreditScoreItem> items = itemMapper.selectList(Wrappers.<CreditScoreItem>lambdaQuery()
.eq(CreditScoreItem::getQuantificationId, quantificationId)
.eq(CreditScoreItem::getIsDeleted, 0)
.orderByAsc(CreditScoreItem::getSort));
List<CreditScoreItemOption> options = optionMapper.selectList(Wrappers.<CreditScoreItemOption>lambdaQuery()
.eq(CreditScoreItemOption::getQuantificationId, quantificationId)
.eq(CreditScoreItemOption::getIsDeleted, 0)
.orderByAsc(CreditScoreItemOption::getSort));
Map<Long, List<CreditScoreItemOptionVO>> optionMap = options.stream()
.map(option -> Objects.requireNonNull(BeanUtil.copyProperties(option, CreditScoreItemOptionVO.class)))
.collect(Collectors.groupingBy(CreditScoreItemOptionVO::getItemId));
Map<Long, List<CreditScoreItemVO>> itemMap = items.stream().map(item -> {
CreditScoreItemVO itemVO = Objects.requireNonNull(BeanUtil.copyProperties(item, CreditScoreItemVO.class));
itemVO.setOptions(optionMap.getOrDefault(item.getId(), new ArrayList<>()));
return itemVO;
}).collect(Collectors.groupingBy(CreditScoreItemVO::getCategoryId));
return categories.stream().map(category -> {
CreditScoreCategoryVO categoryVO = Objects.requireNonNull(BeanUtil.copyProperties(category, CreditScoreCategoryVO.class));
categoryVO.setItems(itemMap.getOrDefault(category.getId(), new ArrayList<>()));
return categoryVO;
}).toList();
}
private List<CreditRatingStandardVO> loadStandards(Long quantificationId) {
return standardMapper.selectList(Wrappers.<CreditRatingStandard>lambdaQuery()
.eq(CreditRatingStandard::getQuantificationId, quantificationId)
.eq(CreditRatingStandard::getIsDeleted, 0)
.orderByDesc(CreditRatingStandard::getScoreRateLower)
.orderByAsc(CreditRatingStandard::getSort))
.stream()
.map(standard -> Objects.requireNonNull(BeanUtil.copyProperties(standard, CreditRatingStandardVO.class)))
.toList();
}
private CreditScoreQuantificationVO buildImportVO(String tableName, List<CreditScoreQuantificationExcel> rows) {
CreditScoreQuantificationVO quantification = new CreditScoreQuantificationVO();
CreditScoreQuantification existed = getOne(Wrappers.<CreditScoreQuantification>lambdaQuery()
.eq(CreditScoreQuantification::getName, tableName)
.eq(CreditScoreQuantification::getIsDeleted, 0), false);
if (Func.isNotEmpty(existed)) {
quantification.setId(existed.getId());
}
quantification.setName(tableName);
quantification.setStatus(STATUS_DRAFT);
quantification.setCategories(defaultCategories());
quantification.setStandards(new ArrayList<>());
Map<String, CreditScoreItemVO> itemMap = new HashMap<>();
for (CreditScoreQuantificationExcel row : rows) {
String rowType = trimToEmpty(row.getRowType());
if (Func.isEmpty(rowType) || ROW_TYPE_MAIN.equals(rowType)) {
quantification.setRemark(trimToNull(row.getRemark()));
quantification.setStandardDescription(trimToNull(row.getTableStandardDescription()));
quantification.setStatus(parseStatus(row.getStatusName()));
} else if (ROW_TYPE_ITEM.equals(rowType)) {
CreditScoreCategoryVO category = findCategory(quantification.getCategories(), row.getCategoryName());
CreditScoreItemVO item = new CreditScoreItemVO();
item.setItemName(trimToEmpty(row.getItemName()));
item.setScoreDescription(trimToNull(row.getScoreDescription()));
item.setOptionDescription(trimToNull(row.getOptionDescription()));
item.setOptions(new ArrayList<>());
category.getItems().add(item);
itemMap.put(itemKey(category.getCategoryName(), item.getItemName()), item);
} else if (ROW_TYPE_OPTION.equals(rowType)) {
CreditScoreCategoryVO category = findCategory(quantification.getCategories(), row.getCategoryName());
CreditScoreItemVO item = findOrCreateItem(category, row, itemMap);
CreditScoreItemOptionVO option = new CreditScoreItemOptionVO();
option.setOptionName(trimToEmpty(row.getOptionName()));
option.setScore(row.getScore());
item.getOptions().add(option);
} else if (ROW_TYPE_STANDARD.equals(rowType)) {
CreditRatingStandardVO standard = new CreditRatingStandardVO();
standard.setCreditLevel(trimToEmpty(row.getCreditLevel()));
standard.setScoreRateLower(row.getScoreRateLower());
standard.setScoreRateUpper(row.getScoreRateUpper());
standard.setScoreRateIncrease(row.getScoreRateIncrease());
standard.setCreditLimitLower(row.getCreditLimitLower());
standard.setCreditLimitUpper(row.getCreditLimitUpper());
standard.setCreditLimitIncrease(row.getCreditLimitIncrease());
standard.setStandardDescription(trimToNull(row.getRatingStandardDescription()));
quantification.getStandards().add(standard);
} else {
throw new ServiceException("数据类型仅支持主表、评分项目、选项、评估标准");
}
}
return quantification;
}
private CreditScoreCategoryVO findCategory(List<CreditScoreCategoryVO> categories, String categoryName) {
String trimCategoryName = trimToEmpty(categoryName);
for (CreditScoreCategoryVO category : categories) {
if (Objects.equals(category.getCategoryName(), trimCategoryName) || Objects.equals(category.getCategoryCode(), trimCategoryName)) {
return category;
}
}
throw new ServiceException("评分分类仅支持基础得分项、加分项目、减分项目");
}
private CreditScoreItemVO findOrCreateItem(CreditScoreCategoryVO category, CreditScoreQuantificationExcel row, Map<String, CreditScoreItemVO> itemMap) {
String itemName = trimToEmpty(row.getItemName());
String key = itemKey(category.getCategoryName(), itemName);
CreditScoreItemVO item = itemMap.get(key);
if (Func.isNotEmpty(item)) {
return item;
}
item = new CreditScoreItemVO();
item.setItemName(itemName);
item.setScoreDescription(trimToNull(row.getScoreDescription()));
item.setOptionDescription(trimToNull(row.getOptionDescription()));
item.setOptions(new ArrayList<>());
category.getItems().add(item);
itemMap.put(key, item);
return item;
}
private String itemKey(String categoryName, String itemName) {
return trimToEmpty(categoryName) + "#" + trimToEmpty(itemName);
}
private Integer parseStatus(String statusName) {
String trimStatusName = trimToNull(statusName);
if (Func.isEmpty(trimStatusName) || "草稿".equals(trimStatusName)) {
return STATUS_DRAFT;
}
if ("正常".equals(trimStatusName) || "发布".equals(trimStatusName)) {
return STATUS_NORMAL;
}
if ("停用".equals(trimStatusName)) {
return STATUS_DISABLED;
}
throw new ServiceException("状态仅支持正常、停用、草稿");
}
private CreditScoreQuantificationExcel buildMainExcel(CreditScoreQuantificationVO detail) {
CreditScoreQuantificationExcel excel = new CreditScoreQuantificationExcel();
excel.setTableName(detail.getName());
excel.setRowType(ROW_TYPE_MAIN);
excel.setRemark(detail.getRemark());
excel.setTableStandardDescription(detail.getStandardDescription());
excel.setStatusName(statusName(detail.getStatus()));
return excel;
}
private CreditScoreQuantificationExcel buildItemExcel(CreditScoreQuantificationVO detail, CreditScoreCategoryVO category, CreditScoreItemVO item) {
CreditScoreQuantificationExcel excel = new CreditScoreQuantificationExcel();
excel.setTableName(detail.getName());
excel.setRowType(ROW_TYPE_ITEM);
excel.setCategoryName(category.getCategoryName());
excel.setItemName(item.getItemName());
excel.setScoreDescription(item.getScoreDescription());
excel.setOptionDescription(item.getOptionDescription());
return excel;
}
private CreditScoreQuantificationExcel buildOptionExcel(CreditScoreQuantificationVO detail, CreditScoreCategoryVO category, CreditScoreItemVO item, CreditScoreItemOptionVO option) {
CreditScoreQuantificationExcel excel = buildItemExcel(detail, category, item);
excel.setRowType(ROW_TYPE_OPTION);
excel.setOptionName(option.getOptionName());
excel.setScore(option.getScore());
return excel;
}
private CreditScoreQuantificationExcel buildStandardExcel(CreditScoreQuantificationVO detail, CreditRatingStandardVO standard) {
CreditScoreQuantificationExcel excel = new CreditScoreQuantificationExcel();
excel.setTableName(detail.getName());
excel.setRowType(ROW_TYPE_STANDARD);
excel.setCreditLevel(standard.getCreditLevel());
excel.setScoreRateLower(standard.getScoreRateLower());
excel.setScoreRateUpper(standard.getScoreRateUpper());
excel.setScoreRateIncrease(standard.getScoreRateIncrease());
excel.setCreditLimitLower(standard.getCreditLimitLower());
excel.setCreditLimitUpper(standard.getCreditLimitUpper());
excel.setCreditLimitIncrease(standard.getCreditLimitIncrease());
excel.setRatingStandardDescription(standard.getStandardDescription());
return excel;
}
private String statusName(Integer status) {
if (Objects.equals(status, STATUS_NORMAL)) {
return "正常";
}
if (Objects.equals(status, STATUS_DISABLED)) {
return "停用";
}
return "草稿";
}
private void prepare(CreditScoreQuantificationVO quantification) {
quantification.setName(trimToEmpty(quantification.getName()));
quantification.setRemark(trimToNull(quantification.getRemark()));
quantification.setStandardDescription(trimToNull(quantification.getStandardDescription()));
if (Func.isEmpty(quantification.getStatus())) {
quantification.setStatus(STATUS_DRAFT);
}
quantification.setCategories(normalizeCategories(quantification.getCategories()));
quantification.setStandards(quantification.getStandards() == null ? new ArrayList<>() : quantification.getStandards());
}
private void validateBase(CreditScoreQuantificationVO quantification) {
if (Func.isEmpty(quantification.getName())) {
throw new ServiceException("评定表名称不能为空");
}
validateLength(quantification.getName(), NAME_MAX_LENGTH, "评定表名称最多30字符");
validateLength(quantification.getRemark(), REMARK_MAX_LENGTH, "备注最多500字符");
validateLength(quantification.getStandardDescription(), REMARK_MAX_LENGTH, "标准说明最多500字符");
LambdaQueryWrapper<CreditScoreQuantification> queryWrapper = Wrappers.<CreditScoreQuantification>lambdaQuery()
.eq(CreditScoreQuantification::getName, quantification.getName())
.eq(CreditScoreQuantification::getIsDeleted, 0);
if (Func.isNotEmpty(quantification.getId())) {
queryWrapper.ne(CreditScoreQuantification::getId, quantification.getId());
}
if (count(queryWrapper) > 0L) {
throw new ServiceException("评定表名称已存在");
}
}
private void validateDetail(CreditScoreQuantificationVO quantification, boolean fullValidate) {
Map<String, List<CreditScoreItemVO>> itemMap = new HashMap<>();
for (CreditScoreCategoryVO category : quantification.getCategories()) {
List<CreditScoreItemVO> items = category.getItems() == null ? new ArrayList<>() : category.getItems();
validateItems(category, items, fullValidate);
itemMap.put(category.getCategoryCode(), items);
}
if (fullValidate && Func.isEmpty(itemMap.get(CATEGORY_BASIC))) {
throw new ServiceException("发布前至少配置1个基础得分项目");
}
validateStandards(quantification.getStandards(), fullValidate);
}
private void validateItems(CreditScoreCategoryVO category, List<CreditScoreItemVO> items, boolean fullValidate) {
Set<String> itemNames = new HashSet<>();
for (CreditScoreItemVO item : items) {
item.setItemName(trimToEmpty(item.getItemName()));
item.setScoreDescription(trimToNull(item.getScoreDescription()));
item.setOptionDescription(trimToNull(item.getOptionDescription()));
if (Func.isEmpty(item.getItemName())) {
throw new ServiceException(category.getCategoryName() + "评分项目不能为空");
}
validateLength(item.getItemName(), ITEM_NAME_MAX_LENGTH, "评分项目最多20汉字");
validateLength(item.getScoreDescription(), SCORE_DESCRIPTION_MAX_LENGTH, "得分说明最多300字符");
validateLength(item.getOptionDescription(), OPTION_NAME_MAX_LENGTH, "选项描述最多100字符");
if (!itemNames.add(item.getItemName())) {
throw new ServiceException(category.getCategoryName() + "下评分项目名称不能重复");
}
List<CreditScoreItemOptionVO> options = item.getOptions() == null ? new ArrayList<>() : item.getOptions();
if (fullValidate && Func.isEmpty(options)) {
throw new ServiceException(item.getItemName() + "至少存在1条档位选项");
}
for (CreditScoreItemOptionVO option : options) {
option.setOptionName(trimToEmpty(option.getOptionName()));
if (Func.isEmpty(option.getOptionName())) {
throw new ServiceException(item.getItemName() + "选项描述不能为空");
}
validateLength(option.getOptionName(), OPTION_NAME_MAX_LENGTH, "选项描述最多100字符");
if (Func.isEmpty(option.getScore())) {
throw new ServiceException(item.getItemName() + "分值不能为空");
}
if (option.getScore().compareTo(BigDecimal.ZERO) < 0) {
throw new ServiceException(item.getItemName() + "分值不能小于0");
}
}
}
}
private void validateStandards(List<CreditRatingStandardVO> standards, boolean fullValidate) {
if (!fullValidate && Func.isEmpty(standards)) {
return;
}
if (Func.isEmpty(standards)) {
throw new ServiceException("发布前至少配置1条完整信用等级评估标准");
}
Set<String> creditLevels = new HashSet<>();
List<CreditRatingStandardVO> sortedStandards = standards.stream()
.sorted(Comparator.comparing(CreditRatingStandardVO::getScoreRateLower))
.toList();
int expectedLower = 0;
for (CreditRatingStandardVO standard : sortedStandards) {
prepareStandard(standard);
if (!creditLevels.add(standard.getCreditLevel())) {
throw new ServiceException("信用等级不能重复");
}
if (standard.getScoreRateLower() < 0 || standard.getScoreRateUpper() > 100) {
throw new ServiceException("得分率区间必须在0到100之间");
}
if (standard.getScoreRateLower() >= standard.getScoreRateUpper()) {
throw new ServiceException("得分率下限必须小于上限");
}
if (standard.getScoreRateLower() != expectedLower) {
throw new ServiceException("信用等级得分率区间必须连续无断层");
}
expectedLower = standard.getScoreRateUpper();
validateNonNegative(standard.getCreditLimitLower(), "最大资金使用额度下限不能小于0");
validateNonNegative(standard.getCreditLimitUpper(), "最大资金使用额度上限不能小于0");
validateNonNegative(standard.getCreditLimitIncrease(), "额度增加不能小于0");
if (standard.getCreditLimitUpper().compareTo(standard.getCreditLimitLower()) < 0) {
throw new ServiceException("最大资金使用额度上限不能小于下限");
}
validateLength(standard.getStandardDescription(), STANDARD_DESCRIPTION_MAX_LENGTH, "标准说明最多500字符");
}
if (expectedLower != 100) {
throw new ServiceException("信用等级得分率区间必须覆盖0到100");
}
}
private void prepareStandard(CreditRatingStandardVO standard) {
standard.setCreditLevel(trimToEmpty(standard.getCreditLevel()));
standard.setStandardDescription(trimToNull(standard.getStandardDescription()));
if (Func.isEmpty(standard.getCreditLevel())) {
throw new ServiceException("信用等级不能为空");
}
validateLength(standard.getCreditLevel(), NAME_MAX_LENGTH, "信用等级最多30字符");
if (Func.isEmpty(standard.getScoreRateLower()) || Func.isEmpty(standard.getScoreRateUpper())) {
throw new ServiceException("得分率上下限不能为空");
}
if (Func.isEmpty(standard.getScoreRateIncrease()) || standard.getScoreRateIncrease() < 0) {
throw new ServiceException("得分率每增加必须为大于等于0的整数");
}
if (Func.isEmpty(standard.getCreditLimitLower())) {
standard.setCreditLimitLower(BigDecimal.ZERO);
}
if (Func.isEmpty(standard.getCreditLimitUpper())) {
standard.setCreditLimitUpper(BigDecimal.ZERO);
}
if (Func.isEmpty(standard.getCreditLimitIncrease())) {
standard.setCreditLimitIncrease(BigDecimal.ZERO);
}
}
private void replaceDetail(Long quantificationId, CreditScoreQuantificationVO quantification) {
deleteDetail(List.of(quantificationId));
Map<String, Long> categoryIdMap = new HashMap<>();
for (CreditScoreCategoryVO categoryVO : quantification.getCategories()) {
Long categoryId = IdWorker.getId();
categoryIdMap.put(categoryVO.getCategoryCode(), categoryId);
CreditScoreCategory category = Objects.requireNonNull(BeanUtil.copyProperties(categoryVO, CreditScoreCategory.class));
category.setId(categoryId);
category.setQuantificationId(quantificationId);
category.setStatus(STATUS_NORMAL);
categoryMapper.insert(category);
}
for (CreditScoreCategoryVO categoryVO : quantification.getCategories()) {
List<CreditScoreItemVO> items = categoryVO.getItems() == null ? new ArrayList<>() : categoryVO.getItems();
for (int itemIndex = 0; itemIndex < items.size(); itemIndex++) {
CreditScoreItemVO itemVO = items.get(itemIndex);
Long itemId = IdWorker.getId();
CreditScoreItem item = Objects.requireNonNull(BeanUtil.copyProperties(itemVO, CreditScoreItem.class));
item.setId(itemId);
item.setQuantificationId(quantificationId);
item.setCategoryId(categoryIdMap.get(categoryVO.getCategoryCode()));
item.setCategoryCode(categoryVO.getCategoryCode());
item.setSort(itemIndex + 1);
item.setStatus(STATUS_NORMAL);
itemMapper.insert(item);
insertOptions(quantificationId, itemId, itemVO);
}
}
insertStandards(quantificationId, quantification.getStandards());
}
private void insertOptions(Long quantificationId, Long itemId, CreditScoreItemVO itemVO) {
List<CreditScoreItemOptionVO> options = itemVO.getOptions() == null ? new ArrayList<>() : itemVO.getOptions();
for (int optionIndex = 0; optionIndex < options.size(); optionIndex++) {
CreditScoreItemOption option = Objects.requireNonNull(BeanUtil.copyProperties(options.get(optionIndex), CreditScoreItemOption.class));
option.setId(IdWorker.getId());
option.setQuantificationId(quantificationId);
option.setItemId(itemId);
option.setSort(optionIndex + 1);
option.setStatus(STATUS_NORMAL);
optionMapper.insert(option);
}
}
private void insertStandards(Long quantificationId, List<CreditRatingStandardVO> standards) {
if (Func.isEmpty(standards)) {
return;
}
List<CreditRatingStandardVO> sortedStandards = standards.stream()
.sorted(Comparator.comparing(CreditRatingStandardVO::getScoreRateLower).reversed())
.toList();
for (int index = 0; index < sortedStandards.size(); index++) {
CreditRatingStandard standard = Objects.requireNonNull(BeanUtil.copyProperties(sortedStandards.get(index), CreditRatingStandard.class));
standard.setId(IdWorker.getId());
standard.setQuantificationId(quantificationId);
standard.setSort(index + 1);
standard.setStatus(STATUS_NORMAL);
standardMapper.insert(standard);
}
}
private void deleteDetail(List<Long> quantificationIds) {
if (Func.isEmpty(quantificationIds)) {
return;
}
categoryMapper.update(null, Wrappers.<CreditScoreCategory>lambdaUpdate()
.set(CreditScoreCategory::getIsDeleted, 1)
.in(CreditScoreCategory::getQuantificationId, quantificationIds));
itemMapper.update(null, Wrappers.<CreditScoreItem>lambdaUpdate()
.set(CreditScoreItem::getIsDeleted, 1)
.in(CreditScoreItem::getQuantificationId, quantificationIds));
optionMapper.update(null, Wrappers.<CreditScoreItemOption>lambdaUpdate()
.set(CreditScoreItemOption::getIsDeleted, 1)
.in(CreditScoreItemOption::getQuantificationId, quantificationIds));
standardMapper.update(null, Wrappers.<CreditRatingStandard>lambdaUpdate()
.set(CreditRatingStandard::getIsDeleted, 1)
.in(CreditRatingStandard::getQuantificationId, quantificationIds));
}
private List<CreditScoreCategoryVO> normalizeCategories(List<CreditScoreCategoryVO> categories) {
Map<String, CreditScoreCategoryVO> categoryMap = categories == null ? new HashMap<>() : categories.stream()
.filter(category -> Func.isNotEmpty(category.getCategoryCode()))
.collect(Collectors.toMap(CreditScoreCategoryVO::getCategoryCode, category -> category, (first, second) -> first));
List<CreditScoreCategoryVO> normalized = new ArrayList<>();
normalized.add(normalizeCategory(categoryMap.get(CATEGORY_BASIC), CATEGORY_BASIC, "基础得分项", 1));
normalized.add(normalizeCategory(categoryMap.get(CATEGORY_PLUS), CATEGORY_PLUS, "加分项目", 2));
normalized.add(normalizeCategory(categoryMap.get(CATEGORY_MINUS), CATEGORY_MINUS, "减分项目", 3));
return normalized;
}
private CreditScoreCategoryVO normalizeCategory(CreditScoreCategoryVO category, String code, String name, Integer sort) {
CreditScoreCategoryVO normalized = category == null ? new CreditScoreCategoryVO() : category;
normalized.setCategoryCode(code);
normalized.setCategoryName(name);
normalized.setSort(sort);
if (normalized.getItems() == null) {
normalized.setItems(new ArrayList<>());
}
return normalized;
}
private List<CreditScoreCategoryVO> defaultCategories() {
return normalizeCategories(new ArrayList<>());
}
private void validateLength(String value, int maxLength, String message) {
if (Func.isNotEmpty(value) && value.length() > maxLength) {
throw new ServiceException(message);
}
}
private void validateNonNegative(BigDecimal value, String message) {
if (Func.isNotEmpty(value) && value.compareTo(BigDecimal.ZERO) < 0) {
throw new ServiceException(message);
}
}
private String trimToEmpty(String value) {
return value == null ? "" : value.trim();
}
private String trimToNull(String value) {
String trimValue = trimToEmpty(value);
return trimValue.isEmpty() ? null : trimValue;
}
}

View File

@@ -0,0 +1,48 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.transport.pojo.entity.CreditScoreQuantification;
import org.springblade.transport.pojo.vo.CreditScoreQuantificationVO;
import java.util.Objects;
/**
* 评分量化表包装类
*
* @author Chill
*/
public class CreditScoreQuantificationWrapper extends BaseEntityWrapper<CreditScoreQuantification, CreditScoreQuantificationVO> {
public static CreditScoreQuantificationWrapper build() {
return new CreditScoreQuantificationWrapper();
}
@Override
public CreditScoreQuantificationVO entityVO(CreditScoreQuantification quantification) {
return Objects.requireNonNull(BeanUtil.copyProperties(quantification, CreditScoreQuantificationVO.class));
}
}

View File

@@ -0,0 +1,137 @@
-- ----------------------------
-- Table structure for blade_credit_score_quantification
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_score_quantification`;
CREATE TABLE `blade_credit_score_quantification` (
`id` bigint NOT NULL COMMENT '主键',
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评定表名称',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`standard_description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标准说明',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`status` int NULL DEFAULT 3 COMMENT '状态1正常2停用3草稿',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `uk_credit_score_quantification_name` (`tenant_id`, `name`, `is_deleted`) USING BTREE,
KEY `idx_credit_score_quantification_status` (`tenant_id`, `status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评分量化表';
-- ----------------------------
-- Table structure for blade_credit_score_category
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_score_category`;
CREATE TABLE `blade_credit_score_category` (
`id` bigint NOT NULL COMMENT '主键',
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
`quantification_id` bigint NOT NULL COMMENT '评分量化表ID',
`category_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类编码',
`category_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类名称',
`sort` int NULL DEFAULT 0 COMMENT '排序',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`status` int NULL DEFAULT 1 COMMENT '状态',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_credit_score_category_code` (`quantification_id`, `category_code`) USING BTREE,
KEY `idx_credit_score_category_table` (`tenant_id`, `quantification_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评分分类';
-- ----------------------------
-- Table structure for blade_credit_score_item
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_score_item`;
CREATE TABLE `blade_credit_score_item` (
`id` bigint NOT NULL COMMENT '主键',
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
`quantification_id` bigint NOT NULL COMMENT '评分量化表ID',
`category_id` bigint NOT NULL COMMENT '评分分类ID',
`category_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类编码',
`item_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评分项目',
`score_description` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '得分说明',
`option_description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '选项描述',
`sort` int NULL DEFAULT 0 COMMENT '排序',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`status` int NULL DEFAULT 1 COMMENT '状态',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_credit_score_item_name` (`quantification_id`, `category_code`, `item_name`) USING BTREE,
KEY `idx_credit_score_item_category` (`tenant_id`, `category_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评分项目';
-- ----------------------------
-- Table structure for blade_credit_score_item_option
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_score_item_option`;
CREATE TABLE `blade_credit_score_item_option` (
`id` bigint NOT NULL COMMENT '主键',
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
`quantification_id` bigint NOT NULL COMMENT '评分量化表ID',
`item_id` bigint NOT NULL COMMENT '评分项目ID',
`option_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '选项描述',
`score` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '分值',
`sort` int NULL DEFAULT 0 COMMENT '排序',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`status` int NULL DEFAULT 1 COMMENT '状态',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_credit_score_item_option_item` (`tenant_id`, `item_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评分项目选项';
-- ----------------------------
-- Table structure for blade_credit_rating_standard
-- ----------------------------
DROP TABLE IF EXISTS `blade_credit_rating_standard`;
CREATE TABLE `blade_credit_rating_standard` (
`id` bigint NOT NULL COMMENT '主键',
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
`quantification_id` bigint NOT NULL COMMENT '评分量化表ID',
`credit_level` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '信用等级',
`score_rate_lower` int NOT NULL COMMENT '得分率下限',
`score_rate_upper` int NOT NULL COMMENT '得分率上限',
`score_rate_increase` int NOT NULL DEFAULT 1 COMMENT '得分率每增加',
`credit_limit_lower` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '最大资金使用额度下限(万元)',
`credit_limit_upper` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '最大资金使用额度上限(万元)',
`credit_limit_increase` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '额度增加(万元)',
`standard_description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标准说明',
`sort` int NULL DEFAULT 0 COMMENT '排序',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`status` int NULL DEFAULT 1 COMMENT '状态',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_credit_rating_standard_level` (`quantification_id`, `credit_level`) USING BTREE,
KEY `idx_credit_rating_standard_table` (`tenant_id`, `quantification_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '信用等级评估标准';
-- ----------------------------
-- Records of blade_menu for credit score quantification
-- parent_id 默认挂载至 transport.sql 中的“车/船务管理”2075436235826896898
-- ----------------------------
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000001, 2075436235826896898, 'credit_score_quantification', '评分量化表', 'credit_score_quantification', '/vehicle/credit-score-quantification', 'iconfont iconicon_doc', 40, 1, 0, 1, '', '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000002, 2077590000000000001, 'credit_score_quantification_add', '新增', 'credit_score_quantification_add', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000003, 2077590000000000001, 'credit_score_quantification_edit', '编辑', 'credit_score_quantification_edit', '', '', 2, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000004, 2077590000000000001, 'credit_score_quantification_delete', '删除', 'credit_score_quantification_delete', '', '', 3, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000005, 2077590000000000001, 'credit_score_quantification_view', '查看', 'credit_score_quantification_view', '', '', 4, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000006, 2077590000000000001, 'credit_score_quantification_publish', '发布', 'credit_score_quantification_publish', '', '', 5, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000007, 2077590000000000001, 'credit_score_quantification_status', '启停', 'credit_score_quantification_status', '', '', 6, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000008, 2077590000000000001, 'credit_score_quantification_import', '批量导入', 'credit_score_quantification_import', '', '', 7, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000009, 2077590000000000001, 'credit_score_quantification_template', '下载模板', 'credit_score_quantification_template', '', '', 8, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2077590000000000010, 2077590000000000001, 'credit_score_quantification_export', '批量导出', 'credit_score_quantification_export', '', '', 9, 2, 0, 1, NULL, '', 0);

View File

@@ -0,0 +1,39 @@
-- ----------------------------
-- Table structure for blade_currency
-- ----------------------------
DROP TABLE IF EXISTS `blade_currency`;
CREATE TABLE `blade_currency` (
`id` bigint NOT NULL COMMENT '主键',
`code` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '币种代码',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '币种中文名称',
`english_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '币种英文名称',
`symbol` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货币符号',
`decimal_places` int NULL DEFAULT 2 COMMENT '小数位数',
`exchange_rate` decimal(18,6) NULL DEFAULT 1.000000 COMMENT '汇率',
`is_base_currency` int NULL DEFAULT 0 COMMENT '是否本位币',
`data_source` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '手工导入' COMMENT '数据来源',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`status` int NULL DEFAULT 1 COMMENT '状态',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_currency_code`(`code`) USING BTREE,
INDEX `idx_currency_base`(`is_base_currency`) USING BTREE,
INDEX `idx_currency_status`(`status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '币种主数据';
-- ----------------------------
-- Records of blade_menu for currency
-- ----------------------------
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449000000000001, 1164733399668962201, 'currency', '币种主数据', 'currency', '/base/currency', 'iconfont iconicon_exchange', 40, 1, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449000000000002, 2075449000000000001, 'currency_import', '批量导入', 'currency_import', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449000000000003, 2075449000000000001, 'currency_template', '下载模板', 'currency_template', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449000000000004, 2075449000000000001, 'currency_export', '批量导出', 'currency_export', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449000000000005, 2075449000000000001, 'currency_delete', '批量删除', 'currency_delete', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449000000000006, 2075449000000000001, 'currency_edit', '编辑', 'currency_edit', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449000000000007, 2075449000000000001, 'currency_status', '修改状态', 'currency_status', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449000000000008, 2075449000000000001, 'currency_add', '新增', 'currency_add', '', '', 1, 2, 0, 1, NULL, '', 0);

View File

@@ -0,0 +1,28 @@
-- ----------------------------
-- Table structure for blade_customer_type
-- ----------------------------
DROP TABLE IF EXISTS `blade_customer_type`;
CREATE TABLE `blade_customer_type` (
`id` bigint NOT NULL COMMENT '主键',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '中文名称',
`english_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '英文名称',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`status` int NULL DEFAULT 1 COMMENT '状态',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_customer_type_name`(`name`) USING BTREE,
INDEX `idx_customer_type_status`(`status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客商类型';
-- ----------------------------
-- Records of blade_menu for customer type
-- ----------------------------
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449100000000001, 1164733399668962201, 'customer_type', '客商类型', 'customer_type', '/base/customer-type', 'iconfont icon-hezuohuobanmiyueguanli', 50, 1, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449100000000002, 2075449100000000001, 'customer_type_delete', '批量删除', 'customer_type_delete', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449100000000003, 2075449100000000001, 'customer_type_edit', '编辑', 'customer_type_edit', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449100000000004, 2075449100000000001, 'customer_type_status', '修改状态', 'customer_type_status', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449100000000005, 2075449100000000001, 'customer_type_add', '新增', 'customer_type_add', '', '', 1, 2, 0, 1, NULL, '', 0);

View File

@@ -0,0 +1,28 @@
-- ----------------------------
-- Table structure for blade_fee_item
-- ----------------------------
DROP TABLE IF EXISTS `blade_fee_item`;
CREATE TABLE `blade_fee_item` (
`id` bigint NOT NULL COMMENT '主键',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '中文名称',
`english_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '英文名称',
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`status` int NULL DEFAULT 1 COMMENT '状态',
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_fee_item_name`(`name`) USING BTREE,
INDEX `idx_fee_item_status`(`status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '费用项';
-- ----------------------------
-- Records of blade_menu for fee item
-- ----------------------------
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449200000000001, 1164733399668962201, 'fee_item', '费用项', 'fee_item', '/base/fee-item', 'iconfont icon-shoucang', 60, 1, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449200000000002, 2075449200000000001, 'fee_item_delete', '批量删除', 'fee_item_delete', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449200000000003, 2075449200000000001, 'fee_item_edit', '编辑', 'fee_item_edit', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449200000000004, 2075449200000000001, 'fee_item_status', '修改状态', 'fee_item_status', '', '', 1, 2, 0, 1, NULL, '', 0);
INSERT INTO `blade_menu` (`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `component`, `remark`, `is_deleted`) VALUES (2075449200000000005, 2075449200000000001, 'fee_item_add', '新增', 'fee_item_add', '', '', 1, 2, 0, 1, NULL, '', 0);

View File

@@ -0,0 +1,280 @@
# 基础资料与车船务模块测试用例
## 范围说明
- 后台前端路径:`/base/region``/base/port-terminal``/base/railway-station``/base/airport-master``/vehicle/maintenance-record``/vehicle/maintenance-plan``/base/fee-item``/base/currency``/base/customer-type`
- 后端服务:基础资料走 `blade-system`,维修/保养走 `blade-transport`
- 依据:前端页面、前端 API、后端 Controller、Service、Entity 的真实字段、权限码、接口路径和校验逻辑
## 通用用例
### REQ-COMMON-01 列表与分页
- 功能点:进入页面后自动请求列表或树接口,支持分页、刷新、搜索、重置搜索。
- 异常与边界:① `current/size` 缺失时使用默认分页;② 搜索条件为空时返回全部可见数据;③ 搜索无结果时显示空表格;④ 后端返回异常时页面 loading 应结束并提示错误。
- 反例:① 无 Token 调接口返回 401② 无菜单权限访问页面或接口返回 403③ 篡改分页参数为负数或超大值不应导致服务异常。
### REQ-COMMON-02 新增与编辑
- 功能点:有新增或编辑权限时可打开表单,必填项校验通过后提交,成功后刷新列表。
- 异常与边界:① 必填字段为空前端应阻断;② 直接调接口绕过前端校验时,后端有业务校验的模块应返回失败;③ 编辑不存在或已删除数据应失败或不产生脏数据。
- 反例:① 无新增权限不显示新增按钮,直接调新增接口返回 403② 无编辑权限不显示编辑按钮,直接调编辑接口返回 403。
### REQ-COMMON-03 删除、批量删除与逻辑删除
- 功能点:单条删除、批量删除确认后调用 `remove` 接口,成功后列表移除数据。
- 异常与边界:① 未勾选数据点击批量删除提示“请选择至少一条数据”;② `ids` 为空、非数字、包含不存在 ID 不应误删其他数据;③ 删除后列表不再展示逻辑删除数据。
- 反例:① 无删除权限不显示删除按钮,直接调删除接口返回 403② 重复删除同一数据不应导致服务异常。
### REQ-COMMON-04 启用/停用
- 功能点:支持启用/停用的模块可切换状态,状态值为 `1=启用``2=停用`
- 异常与边界:① `id` 为空返回“主键不能为空”;② 状态不是 1 或 2 返回“启停状态不正确”;③ 数据不存在返回对应“不存在”提示。
- 反例:① 无状态权限不显示启停按钮;② 直接传 `status=0/3/null` 不应更新状态。
### REQ-COMMON-05 导入、导出与模板
- 功能点:支持导入导出的模块可下载模板、上传 `.xls/.xlsx`、按筛选条件或选中 ID 导出。
- 异常与边界:① 上传非 Excel 文件应失败;② 空模板导入应提示失败或无数据;③ 导入部分行错误时应返回具体行号;④ 导出选中数据时只导出选中 ID。
- 反例:① 无导入/导出/模板权限不显示对应按钮;② 直接调接口无权限返回 403。
## 行政区划 `/base/region`
### REQ-REGION-01 懒加载区划树
- 功能点:左侧树默认以 `parentCode=00` 加载省级节点,点击节点加载下级,右侧回显详情。
- 异常与边界:① 顶级、叶子节点、无子节点均应正确展示;② 节点无子节点时 `leaf=true`;③ `parentCode` 不存在时返回空列表;④ 节点切换时右侧表单数据同步更新。
- 反例:① 直接传异常 `parentCode` 不应报 500② 无 `region` 菜单权限访问 `/blade-system/region/lazy-tree` 返回 403。
### REQ-REGION-02 新增/编辑下级区划
- 功能点:点击“新增下级”后自动带出父区划编号、父区划名称,填写区划子编号、名称、等级、排序后提交 `/blade-system/region/submit`
- 异常与边界:① 父区划编号、区划编号、名称、等级、排序必填;② 子编号拼接后不能与已有区划冲突;③ 已存在区划编号时后端执行更新;④ 区划等级为省/市/区/镇/村时写入对应编码与名称字段。
- 反例:① 缺少区划名称前端应阻断;② 直接调接口传空 `code/name/regionLevel` 不应产生不可用节点;③ 非法等级不应生成错误层级数据。
### REQ-REGION-03 删除区划
- 功能点:选中无子节点的区划后可删除,调用 `/blade-system/region/remove?id=code`
- 异常与边界:① 存在子节点时返回“请先删除子节点!”;② 删除叶子节点后树刷新不再展示;③ 删除根节点或顶级关键节点需被权限/业务规则保护。
- 反例:① 传不存在 code 不应删除其他节点;② 无删除权限不显示“删除”按钮。
### REQ-REGION-04 导入与覆盖
- 功能点:下载行政区划模板,上传 Excel可选择“数据覆盖”。
- 异常与边界:① `isCovered=0` 时重复主键应失败;② `isCovered=1` 时重复主键应更新;③ Excel 必填列缺失或父子关系错误应提示;④ 大批量导入后树加载正常。
- 反例:① 非 Excel 文件上传失败;② 无导入权限不显示导入入口。
### REQ-REGION-05 导出与调试
- 功能点:导出当前筛选行政区划数据,调试弹窗可验证区划查询结果。
- 异常与边界:① 空筛选导出全量可见数据;② 按编码/名称筛选导出匹配数据;③ 数据量大时导出文件能正常生成。
- 反例:① 无导出权限不显示导出按钮;② 无调试权限不显示调试按钮。
## 港口码头主数据 `/base/port-terminal`
### REQ-PORT-01 列表、搜索与上级港口下拉
- 功能点:列表支持按编码、名称、类型、所属省份、所属城市、数据来源、状态搜索;新增码头时通过 `/port-select` 加载启用港口。
- 异常与边界:① 港口行的上级港口显示 `-`;② 码头行展示父港口名称和编码;③ 仅启用且类型为“港口”的数据进入上级港口下拉。
- 反例:① 停用港口不应出现在上级港口下拉;② 无查询权限直接调列表返回 403。
### REQ-PORT-02 新增港口
- 功能点:类型选择“港口”,填写 5 位大写字母编码、名称、所属城市、经纬度、数据来源后保存。
- 异常与边界:① 编码自动转大写;② 港口编码必须匹配 `^[A-Z]{5}$`;③ 港口保存时清空上级港口字段;④ 编码唯一。
- 反例:① 编码为空返回“编码不能为空”;② 编码为 `AB12C` 或长度不是 5 返回“港口编码为5位大写字母”③ 重复编码返回“该编码已存在”。
### REQ-PORT-03 新增码头
- 功能点:类型选择“码头”,选择上级港口,编码格式为 `港口编码-码头标识`,保存后自动写入父港口信息。
- 异常与边界:① 未选上级港口返回“码头必须选择上级港口”;② 上级类型必须为港口;③ 码头编码必须以上级港口编码加 `-` 开头;④ 保存后继承父港口所属省份/城市。
- 反例:① 编码 `ABCDE01` 返回“码头编码格式为港口编码-码头标识”;② 编码 `ZZZZZ-01` 但父港口为 `ABCDE` 返回“码头编码必须以所属港口编码开头”。
### REQ-PORT-04 编辑、启停、删除
- 功能点:可编辑港口/码头基础信息,可启用/停用,可逻辑删除。
- 异常与边界:① 停用港口前若存在已启用码头,返回“该港口下存在已启用码头,请先停用码头”;② 状态非法返回“启停状态不正确”;③ 删除后列表不展示。
- 反例:① 直接停用不存在 ID 返回“港口码头不存在”;② 无编辑/状态/删除权限时按钮不可见且接口返回 403。
### REQ-PORT-05 导入、导出、模板
- 功能点:下载“港口码头主数据模板”,批量导入港口/码头,按查询条件或选中 ID 导出。
- 异常与边界:① 导入错误返回具体 Excel 行号;② 重复编码导入失败;③ 码头行必须能匹配父港口;④ 导出状态显示“启用/停用”。
- 反例:① 非 Excel 文件上传失败;② 无导入/导出/模板权限不显示按钮。
## 铁路车站主数据 `/base/railway-station`
### REQ-RAIL-01 列表与搜索
- 功能点列表展示编码、TMIS 国标编码、电报码、车站名称、线路、省市、经纬度、数据来源、状态,支持名称、数据来源、状态等搜索。
- 异常与边界:① 空列表显示正常;② 创建/更新时间格式正确;③ 搜索重置后恢复全量列表。
- 反例:① 无菜单权限访问列表接口返回 403② 非法分页参数不应导致 500。
### REQ-RAIL-02 新增/编辑车站
- 功能点:填写 TMIS 国标编码、电报码、车站名称、所属城市、经纬度后保存;后端自动生成编码 `TL + TMIS`
- 异常与边界:① TMIS 必须 5 位数字;② 电报码必须 3 位大写字母;③ 省份、城市必选且城市必须隶属于省份;④ 备注最多 200 字。
- 反例:① TMIS 为 `1234A` 返回“TMIS国标编码为5位数字”② 电报码为 `ab1` 返回“电报码为3位大写字母”③ 省市不匹配返回“所属城市与所属省份不匹配”。
### REQ-RAIL-03 唯一性与坐标
- 功能点TMIS、电报码、编码均唯一经度范围 -180 到 180纬度范围 -90 到 90。
- 异常与边界:① 编辑自身不触发重复;② 经度/纬度为空允许保存;③ 边界值 -180、180、-90、90 可保存。
- 反例:① 重复 TMIS 返回“该TMIS编码已存在”② 重复电报码返回“该电报码已存在”;③ 经度 181 或纬度 91 返回范围错误。
### REQ-RAIL-04 启停、删除、导入导出
- 功能点:支持启停、批量删除、下载模板、批量导入、批量导出。
- 异常与边界:① 状态仅允许 1/2② 导入错误返回具体行号;③ 导出选中 ID 时只导出选中数据。
- 反例:① 不存在 ID 启停返回“铁路车站不存在”;② 无对应权限时按钮不可见且接口返回 403。
## 空港机场主数据 `/base/airport-master`
### REQ-AIRPORT-01 列表与搜索
- 功能点列表展示编码、IATA、ICAO、机场标准名称、简称、省市、经纬度、数据来源、状态支持名称、编码、数据来源、状态搜索。
- 异常与边界:① 空数据时表格正常;② 搜索无结果展示空列表;③ 时间字段格式正确。
- 反例:① 无菜单权限访问 `/blade-system/airport-master/list` 返回 403。
### REQ-AIRPORT-02 新增/编辑机场
- 功能点:填写 IATA、ICAO、机场标准名称、所属省市、经纬度后保存后端自动生成编码 `JC- + IATA`
- 异常与边界:① IATA 必须 3 位大写字母;② ICAO 必须 4 位大写字母;③ 省市必选且隶属关系正确;④ 简称可为空;⑤ 备注最多 200 字。
- 反例:① IATA 为 `PV1` 返回“IATA编码为3位大写字母”② ICAO 为 `ZSS` 返回“ICAO代码为4位大写字母”③ 省市不匹配返回“所属城市与所属省份不匹配”。
### REQ-AIRPORT-03 唯一性与坐标
- 功能点IATA、ICAO、编码唯一经纬度范围与铁路车站一致。
- 异常与边界:① 编辑自身不触发重复;② 经纬度为空允许保存;③ 边界坐标可保存。
- 反例:① 重复 IATA 返回“该IATA编码已存在”② 重复 ICAO 返回“该ICAO代码已存在”③ 经度 181 或纬度 -91 返回范围错误。
### REQ-AIRPORT-04 启停、删除、导入导出
- 功能点:支持启停、批量删除、下载模板、导入、导出。
- 异常与边界:① 状态仅允许 1/2② 导入错误返回 Excel 行号;③ 导出状态显示“启用/停用”。
- 反例:① 不存在 ID 启停返回“空港机场不存在”;② 无权限时按钮不可见且接口返回 403。
## 车辆维修记录 `/vehicle/maintenance-record`
### REQ-MAINT-RECORD-01 列表、查看与搜索
- 功能点:列表展示车船类型、车牌号/船号、维修人、维修时间、位置、费用、里程/航程、附件数量等;支持车船类型、车牌号/船号、创建时间范围搜索。
- 异常与边界:① 附件为 JSON 数组时显示数量;② 附件为逗号字符串时按逗号计数;③ 里程单位为空时默认按车船类型展示。
- 反例:① 无查看权限不显示查看按钮;② 无菜单权限调列表接口返回 403。
### REQ-MAINT-RECORD-02 新增/编辑维修记录
- 功能点:新增或编辑时填写车船类型、车牌号/船号、维修时间、费用等,保存到 `/blade-transport/maintenance-record/submit`
- 异常与边界:① 前端要求车船类型、车牌号/船号、维修时间、费用必填;② 车牌号/船号最多 30 字符;③ 维修人最多 20 字符;④ 位置/地址最多 100 字符;⑤ 更换零件最多 200 字符;⑥ 备注最多 500 字符。
- 反例:① 前端传空车牌号应阻断;② 直接调接口绕过前端传空必填字段,当前后端未做完整业务校验,应作为接口层风险重点确认;③ 超长字段前端应阻断。
### REQ-MAINT-RECORD-03 里程单位默认值
- 功能点:`mileageUnit` 为空时,车辆默认“公里”,船舶默认“海里”。
- 异常与边界:① 车船类型从车辆切换船舶后默认单位应同步;② 已手动选择单位时不应被错误覆盖;③ 详情回显单位正确。
- 反例:① `vehicleType=船舶``mileageUnit` 为空保存后不应显示“公里”;② `vehicleType=车辆` 为空不应显示“海里”。
### REQ-MAINT-RECORD-04 删除与权限
- 功能点:支持单条和批量逻辑删除,删除后列表不展示。
- 异常与边界:① 未勾选批量删除提示;② 删除多个 ID 时只删除选中数据;③ 租户数据不应跨租户可见。
- 反例:① 无删除权限不显示按钮且接口返回 403② 非本租户数据不应被查询或删除。
## 车辆保养计划 `/vehicle/maintenance-plan`
### REQ-MAINT-PLAN-01 列表、查看与搜索
- 功能点:列表展示车船类型、车牌号/船号、保养人、保养时间、保养项目、费用、里程/航程、下次保养时间、下次保养里程、附件数量等。
- 异常与边界:① 创建时间范围搜索生效;② 里程和下次保养里程展示单位;③ 附件数量展示规则与维修记录一致。
- 反例:① 无查看权限不显示查看按钮;② 无菜单权限调列表接口返回 403。
### REQ-MAINT-PLAN-02 新增/编辑保养计划
- 功能点:新增或编辑时填写车船类型、车牌号/船号、保养时间、费用、保养项目、下次保养信息等。
- 异常与边界:① 前端要求车船类型、车牌号/船号、保养时间、费用必填;② 车牌号/船号最多 30 字符;③ 保养人最多 20 字符;④ 保养项目/地址最多 100 字符;⑤ 店名最多 50 字符;⑥ 联系电话最多 20 字符;⑦ 备注最多 500 字符。
- 反例:① 费用为空前端应阻断;② 直接调接口绕过前端传空必填字段,当前后端未做完整业务校验,应作为接口层风险重点确认。
### REQ-MAINT-PLAN-03 里程单位与下次保养
- 功能点:车辆默认“公里”,船舶默认“海里”;下次保养时间、下次保养里程可为空。
- 异常与边界:① 下次保养时间早于保养时间时需确认业务是否允许;② 下次保养里程小于当前里程时需确认业务是否允许;③ 单位切换后两个里程字段展示一致。
- 反例:① 船舶默认单位不应为“公里”;② 前端或后端不应因下次保养字段为空报错。
### REQ-MAINT-PLAN-04 删除与权限
- 功能点:支持单条和批量逻辑删除。
- 异常与边界:① 未勾选批量删除提示;② 删除后列表刷新;③ 租户隔离生效。
- 反例:① 无删除权限不显示按钮且接口返回 403② 非本租户数据不应被查询或删除。
## 费用项 `/base/fee-item`
### REQ-FEE-01 列表与搜索
- 功能点:列表展示中文名称、英文名称、状态、更新时间、创建时间,支持中文名称、英文名称、状态搜索。
- 异常与边界:① 空搜索返回全部未删除数据;② 搜索不存在名称返回空列表;③ 状态标签正确显示“启用/停用”。
- 反例:① 无菜单权限调 `/blade-system/fee-item/list` 返回 403。
### REQ-FEE-02 新增/编辑费用项
- 功能点:中文名称必填,英文名称非必填;提交前去除前后空格;默认状态为启用。
- 异常与边界:① 中文名称最多 50 字;② 英文名称最多 100 字;③ 中文名称唯一;④ 编辑自身不触发重复。
- 反例:① 中文名称为空返回“中文名称不能为空”;② 重复中文名称返回“该中文名称已存在”;③ 英文名称超过 100 字返回“英文名称不能超过100字”。
### REQ-FEE-03 启停、删除与权限
- 功能点:支持启用/停用和批量逻辑删除。
- 异常与边界:① 状态仅允许 1/2② 删除后不出现在列表;③ 无选择批量删除提示。
- 反例:① 不存在 ID 启停返回“费用项不存在”;② 无新增/编辑/删除/状态权限时对应按钮不可见且接口返回 403。
## 币种主数据 `/base/currency`
### REQ-CURRENCY-01 列表与搜索
- 功能点:列表展示币种代码、中文名、英文名、符号、小数位数、汇率、本位币、数据来源、状态,支持代码、中文名、英文名、本位币、数据来源、状态搜索。
- 异常与边界:① 本位币以“是/否”标签展示;② 状态以“启用/停用”展示;③ 搜索重置后恢复全量。
- 反例:① 无菜单权限调列表接口返回 403。
### REQ-CURRENCY-02 新增/编辑币种
- 功能点:币种代码 3 位大写字母,中文名称必填,小数位数 0 到 8汇率大于 0本位币默认否数据来源默认手工导入。
- 异常与边界:① 代码自动转大写并过滤非字母;② 本位币选择“是”时汇率自动设为 1③ 备注最多 200 字;④ 编辑自身不触发代码重复。
- 反例:① 代码为空返回“币种代码不能为空”;② 代码 `US1` 返回“币种代码为3位大写字母”③ 小数位数 -1 或 9 返回“小数位数范围为0到8”④ 汇率 0 返回“汇率必须大于0”。
### REQ-CURRENCY-03 本位币唯一性
- 功能点:系统只允许一个本位币,且本位币汇率必须为 1。
- 异常与边界:① 第一条本位币可保存;② 第二条设置本位币返回失败;③ 修改已有本位币的其他字段仍应成功;④ 将非本位币改为本位币前需确保无其他本位币。
- 反例:① 本位币汇率为 6.8 返回“本位币汇率必须为1”② 已存在本位币时新增另一个本位币返回“本位币只能设置一个”。
### REQ-CURRENCY-04 启停、删除、导入导出
- 功能点:支持启停、批量删除、模板下载、批量导入、导出。
- 异常与边界:① 导入“是否本位币”仅支持 是/否/1/0② 导入重复代码返回具体行号;③ 导出本位币和状态显示中文。
- 反例:① 导入本位币填写“Y”返回“是否本位币只能填写是或否”② 不存在 ID 启停返回“币种不存在”;③ 无权限时按钮不可见且接口返回 403。
## 客商类型 `/base/customer-type`
### REQ-CUSTOMER-TYPE-01 列表与搜索
- 功能点:列表展示中文名称、英文名称、状态、更新时间、创建时间,支持中文名称、英文名称、状态搜索。
- 异常与边界:① 空搜索返回全部未删除数据;② 搜索无结果展示空表格;③ 状态标签正确。
- 反例:① 无菜单权限调 `/blade-system/customer-type/list` 返回 403。
### REQ-CUSTOMER-TYPE-02 新增/编辑客商类型
- 功能点:中文名称必填,英文名称非必填;提交前去除前后空格;默认状态为启用。
- 异常与边界:① 中文名称最多 50 字;② 英文名称最多 100 字;③ 中文名称唯一;④ 编辑自身不触发重复。
- 反例:① 中文名称为空返回“中文名称不能为空”;② 重复中文名称返回“该中文名称已存在”;③ 英文名称超过 100 字返回“英文名称不能超过100字”。
### REQ-CUSTOMER-TYPE-03 启停、删除与权限
- 功能点:支持启用/停用和批量逻辑删除。
- 异常与边界:① 状态仅允许 1/2② 删除后不出现在列表;③ 未选择数据批量删除提示。
- 反例:① 不存在 ID 启停返回“客商类型不存在”;② 无新增/编辑/删除/状态权限时对应按钮不可见且接口返回 403。
## 依赖与风险
- 行政区划是机场、铁路车站、港口/码头所属地区选择的数据基础,测试机场/铁路/港口前需准备省市区划数据。
- 港口/码头存在父子关系,停用港口前需先停用其下启用码头。
- 维修记录、保养计划目前主要依赖前端校验,后端直接 `saveOrUpdate`,接口直调空必填字段、负费用、超长字段等场景应作为风险用例重点验证。
- 所有模块均依赖 `@PreAuth(menu=...)` 和按钮权限,测试时需准备有权限、无按钮权限、无菜单权限三类账号。