feat(translate): 新增阿里云翻译工具类及接口
- 添加阿里云机器翻译工具类AliyunTranslateUtil - 实现单文本和批量翻译功能 - 配置阿里云翻译相关参数 - 创建翻译控制器TranslateController - 支持自动检测源语言翻译 - 提供翻译结果封装响应结构
This commit is contained in:
@@ -140,14 +140,20 @@ public class CreditUserController extends BaseController {
|
|||||||
@PreAuthorize("hasAuthority('credit:creditUser:save')")
|
@PreAuthorize("hasAuthority('credit:creditUser:save')")
|
||||||
@Operation(summary = "批量导入赊账客户")
|
@Operation(summary = "批量导入赊账客户")
|
||||||
@PostMapping("/import")
|
@PostMapping("/import")
|
||||||
public ApiResult<List<String>> importBatch(MultipartFile file) {
|
public ApiResult<List<String>> importBatch(@RequestParam("file") MultipartFile file) {
|
||||||
ImportParams importParams = new ImportParams();
|
ImportParams importParams = new ImportParams();
|
||||||
|
importParams.setTitleRows(1);
|
||||||
|
importParams.setHeadRows(1);
|
||||||
List<String> errorMessages = new ArrayList<>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<CreditUserImportParam> list = ExcelImportUtil.importExcel(file.getInputStream(), CreditUserImportParam.class, importParams);
|
List<CreditUserImportParam> list = ExcelImportUtil.importExcel(file.getInputStream(), CreditUserImportParam.class, importParams);
|
||||||
|
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
return fail("未读取到数据,请确认模板表头与示例格式一致", null);
|
||||||
|
}
|
||||||
|
|
||||||
User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||||
|
|
||||||
@@ -155,7 +161,6 @@ public class CreditUserController extends BaseController {
|
|||||||
CreditUserImportParam param = list.get(i);
|
CreditUserImportParam param = list.get(i);
|
||||||
try {
|
try {
|
||||||
CreditUser item = convertImportParamToEntity(param);
|
CreditUser item = convertImportParamToEntity(param);
|
||||||
System.out.println("item = " + item);
|
|
||||||
|
|
||||||
// 设置默认值
|
// 设置默认值
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.gxwebsoft.credit.param;
|
||||||
|
|
||||||
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赊账客户导入参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2025-12-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CreditUserImportParam implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Excel(name = "客户名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Excel(name = "唯一标识")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Excel(name = "类型", replace = {"普通用户_0", "招投标_1"})
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Excel(name = "企业角色")
|
||||||
|
private String role;
|
||||||
|
|
||||||
|
@Excel(name = "上级ID")
|
||||||
|
private Integer parentId;
|
||||||
|
|
||||||
|
@Excel(name = "信息类型")
|
||||||
|
private String infoType;
|
||||||
|
|
||||||
|
@Excel(name = "所在国家")
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
@Excel(name = "所在省份")
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
@Excel(name = "所在城市")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
@Excel(name = "所在辖区")
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
@Excel(name = "街道地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Excel(name = "招采单位名称")
|
||||||
|
private String procurementName;
|
||||||
|
|
||||||
|
@Excel(name = "中标单位名称")
|
||||||
|
private String winningName;
|
||||||
|
|
||||||
|
@Excel(name = "中标金额")
|
||||||
|
private String winningPrice;
|
||||||
|
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@Excel(name = "是否推荐", replace = {"否_0", "是_1"})
|
||||||
|
private Integer recommend;
|
||||||
|
|
||||||
|
@Excel(name = "到期时间", format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private String expirationTime;
|
||||||
|
|
||||||
|
@Excel(name = "排序")
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
@Excel(name = "状态", replace = {"正常_0", "冻结_1"})
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Excel(name = "用户ID")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@Excel(name = "租户ID")
|
||||||
|
private Integer tenantId;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user