合并分支 'dev_third_stage' 到 'master'
Dev third stage 查看合并请求 laws-nio/laws-weilai!103
This commit is contained in:
@@ -439,3 +439,58 @@ CREATE TABLE `laws_weilai`.`doc_translation` (
|
||||
`target_file_id` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '目标文件id',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文档翻译表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- 文档翻译-源语言数据字典
|
||||
INSERT INTO `laws_weilai`.`sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `type`, `dict_en_name`, `is_tag_dict`, `is_read_only`, `attribute_type`, `order_num`) VALUES ('1550306517749547010', '文档翻译-翻译语言-源语言', 'source_language', '文档翻译-翻译语言-源语言', 0, 'admin', '2022-07-22 10:27:32', 'admin', '2022-07-22 10:29:17', NULL, NULL, 1, 0, '1', 2);
|
||||
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('155030756958032691412', '1550306517749547010', '中文', 'zh', '中文', 2, 1, 'admin', '2022-07-22 10:31:43', 'admin', '2022-07-22 10:31:59', 1, NULL, NULL, '0', 'Chinese');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('155030763691987763313', '1550306517749547010', '英文', 'en', '英文', 1, 1, 'admin', '2022-07-22 10:31:59', NULL, NULL, 1, NULL, NULL, '0', 'English');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('155030778369954611414', '1550306517749547010', '日语', 'ja', '日语', 3, 1, 'admin', '2022-07-22 10:32:34', NULL, NULL, 1, NULL, NULL, '0', 'Japanese');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('155030790598028493015', '1550306517749547010', '俄语', 'ru', '俄语', 4, 1, 'admin', '2022-07-22 10:33:03', NULL, NULL, 1, NULL, NULL, '0', 'Russian');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('155030797657042124916', '1550306517749547010', '德语', 'de', '德语', 5, 1, 'admin', '2022-07-22 10:33:20', 'admin', '2022-07-22 10:34:58', 1, NULL, NULL, '0', 'German');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503088022275522577', '1550306517749547010', '法语', 'fr', '法语', 6, 1, 'admin', '2022-07-22 10:36:36', NULL, NULL, 1, NULL, NULL, '0', 'French');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503112074344038418', '1550306517749547010', '意大利语', 'it', '意大利语', 7, 1, 'admin', '2022-07-22 10:46:10', NULL, NULL, 1, NULL, NULL, '0', 'Italian');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503112704622100509', '1550306517749547010', '波兰语', 'pl', '波兰语', 8, 1, 'admin', '2022-07-22 10:46:25', NULL, NULL, 1, NULL, NULL, '0', 'Polish');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503114101073674251', '1550306517749547010', '泰语', 'th', '泰语', 9, 1, 'admin', '2022-07-22 10:46:58', NULL, NULL, 1, NULL, NULL, '0', 'Thai language');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503115557294080012', '1550306517749547010', '印地语', 'hi', '印地语', 11, 1, 'admin', '2022-07-22 10:47:33', NULL, NULL, 1, NULL, NULL, '0', 'Hindi');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503116395022417943', '1550306517749547010', '印尼语', 'id', '印尼语', 12, 1, 'admin', '2022-07-22 10:47:53', NULL, NULL, 1, NULL, NULL, '0', 'Indonesian');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503117185522892814', '1550306517749547010', '西班牙语', 'es', '西班牙语', 13, 1, 'admin', '2022-07-22 10:48:12', NULL, NULL, 1, NULL, NULL, '0', 'Spanish language');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503118402584084505', '1550306517749547010', '葡萄牙语', 'pt', '葡萄牙语', 17, 1, 'admin', '2022-07-22 10:48:41', 'admin', '2022-07-22 10:49:21', 1, NULL, NULL, '0', 'Portuguese');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503119403009474586', '1550306517749547010', '朝鲜语', 'ko', '朝鲜语', 15, 1, 'admin', '2022-07-22 10:49:05', NULL, NULL, 1, NULL, NULL, '0', 'Korean');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503120084961361947', '1550306517749547010', '越南语', 'vi', '越南语', 16, 1, 'admin', '2022-07-22 10:49:21', NULL, NULL, 1, NULL, NULL, '0', 'Vietnamese');
|
||||
|
||||
-- 文档翻译-目标语言数据字典
|
||||
INSERT INTO `laws_weilai`.`sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `type`, `dict_en_name`, `is_tag_dict`, `is_read_only`, `attribute_type`, `order_num`) VALUES ('1550306581909815297', '文档翻译-翻译语言-目标语言', 'target_language', '文档翻译-翻译语言-目标语言', 0, 'admin', '2022-07-22 10:27:47', 'admin', '2022-07-22 10:29:13', NULL, NULL, 1, 0, '1', 1);
|
||||
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503075695803269141', '1550306581909815297', '中文', 'zh', '中文', 2, 1, 'admin', '2022-07-22 10:31:43', 'admin', '2022-07-22 10:31:59', 1, NULL, NULL, '0', 'Chinese');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503076369198776331', '1550306581909815297', '英文', 'en', '英文', 1, 1, 'admin', '2022-07-22 10:31:59', NULL, NULL, 1, NULL, NULL, '0', 'English');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503077836995461141', '1550306581909815297', '日语', 'ja', '日语', 3, 1, 'admin', '2022-07-22 10:32:34', NULL, NULL, 1, NULL, NULL, '0', 'Japanese');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503079059802849301', '1550306581909815297', '俄语', 'ru', '俄语', 4, 1, 'admin', '2022-07-22 10:33:03', NULL, NULL, 1, NULL, NULL, '0', 'Russian');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('15503079765704212491', '1550306581909815297', '德语', 'de', '德语', 5, 1, 'admin', '2022-07-22 10:33:20', 'admin', '2022-07-22 10:34:58', 1, NULL, NULL, '0', 'German');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550308802227552257', '1550306581909815297', '法语', 'fr', '法语', 6, 1, 'admin', '2022-07-22 10:36:36', NULL, NULL, 1, NULL, NULL, '0', 'French');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550311207434403841', '1550306581909815297', '意大利语', 'it', '意大利语', 7, 1, 'admin', '2022-07-22 10:46:10', NULL, NULL, 1, NULL, NULL, '0', 'Italian');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550311270462210050', '1550306581909815297', '波兰语', 'pl', '波兰语', 8, 1, 'admin', '2022-07-22 10:46:25', NULL, NULL, 1, NULL, NULL, '0', 'Polish');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550311410107367425', '1550306581909815297', '泰语', 'th', '泰语', 9, 1, 'admin', '2022-07-22 10:46:58', NULL, NULL, 1, NULL, NULL, '0', 'Thai language');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550311555729408001', '1550306581909815297', '印地语', 'hi', '印地语', 11, 1, 'admin', '2022-07-22 10:47:33', NULL, NULL, 1, NULL, NULL, '0', 'Hindi');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550311639502241794', '1550306581909815297', '印尼语', 'id', '印尼语', 12, 1, 'admin', '2022-07-22 10:47:53', NULL, NULL, 1, NULL, NULL, '0', 'Indonesian');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550311718552289281', '1550306581909815297', '西班牙语', 'es', '西班牙语', 13, 1, 'admin', '2022-07-22 10:48:12', NULL, NULL, 1, NULL, NULL, '0', 'Spanish language');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550311840258408450', '1550306581909815297', '葡萄牙语', 'pt', '葡萄牙语', 17, 1, 'admin', '2022-07-22 10:48:41', 'admin', '2022-07-22 10:49:21', 1, NULL, NULL, '0', 'Portuguese');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550311940300947458', '1550306581909815297', '朝鲜语', 'ko', '朝鲜语', 15, 1, 'admin', '2022-07-22 10:49:05', NULL, NULL, 1, NULL, NULL, '0', 'Korean');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550312008496136194', '1550306581909815297', '越南语', 'vi', '越南语', 16, 1, 'admin', '2022-07-22 10:49:21', NULL, NULL, 1, NULL, NULL, '0', 'Vietnamese');
|
||||
|
||||
-- 文档翻译-发布情况数据字典
|
||||
INSERT INTO `laws_weilai`.`sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `type`, `dict_en_name`, `is_tag_dict`, `is_read_only`, `attribute_type`, `order_num`) VALUES ('1550314527293128705', '文档翻译-发布情况', 'release_condition', '文档翻译-发布情况', 0, 'admin', '2022-07-22 10:59:21', 'admin', '2022-07-22 11:01:07', NULL, NULL, 1, 0, '1', 2);
|
||||
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550314666682433537', '1550314527293128705', '已发布', 'published', '已发布', 1, 1, 'admin', '2022-07-22 10:59:55', NULL, NULL, 1, NULL, NULL, '0', 'Have published');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550314731320852482', '1550314527293128705', '草稿', 'draft', '草稿', 2, 1, 'admin', '2022-07-22 11:00:10', NULL, NULL, 1, NULL, NULL, '0', 'Draft');
|
||||
|
||||
-- 文档翻译-翻译结果数据字典
|
||||
INSERT INTO `laws_weilai`.`sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `type`, `dict_en_name`, `is_tag_dict`, `is_read_only`, `attribute_type`, `order_num`) VALUES ('1550314971079852034', '文档翻译-翻译结果', 'translation_result', '文档翻译-翻译结果', 0, 'admin', '2022-07-22 11:01:07', NULL, NULL, NULL, NULL, 1, 0, '1', 1);
|
||||
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550315090797871105', '1550314971079852034', '翻译中', 'In the translation', '翻译中', 1, 1, 'admin', '2022-07-22 11:01:36', NULL, NULL, 1, NULL, NULL, '0', 'In the translation');
|
||||
INSERT INTO `laws_weilai`.`sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `sort_order`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `is_tag_dict`, `is_read_only`, `attribute_type`, `del_flag`, `en_name`) VALUES ('1550315193285689345', '1550314971079852034', '翻译完成', 'Translation done', '翻译完成', 2, 1, 'admin', '2022-07-22 11:02:00', NULL, NULL, 1, NULL, NULL, '0', 'Translation done');
|
||||
|
||||
-- 文档翻译表-增加字段 编号、标题
|
||||
ALTER TABLE `laws_weilai`.`doc_translation`
|
||||
ADD COLUMN `serial_number` varchar(255) NULL COMMENT '编号' AFTER `buss_document_library_id`,
|
||||
ADD COLUMN `title` varchar(255) NULL COMMENT '标题' AFTER `serial_number`;
|
||||
|
||||
+20
-22
@@ -49,7 +49,6 @@ import com.jero.modules.project.entity.ProjectLibraryBase;
|
||||
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
||||
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
|
||||
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
|
||||
import com.jero.modules.split.common.ReadExcel;
|
||||
import com.jero.modules.system.entity.SysAnnouncement;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
@@ -2009,7 +2008,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
|
||||
@Override
|
||||
public void exportAll(ParamsCollectManifestVO paramsCollectManifestVO, HttpServletResponse response, HttpServletRequest request) {
|
||||
OutputStream os = null;
|
||||
// OutputStream os = null;
|
||||
OutputStream excelOS = null;
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
String fileOriName = "参数项清单导出信息";
|
||||
@@ -2105,20 +2104,20 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
|
||||
String repFileName = fileName.replaceAll("/","_");
|
||||
excelOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\""+ ReadExcel.encodeFileName(fileOriName+".zip", request) +"\"");
|
||||
response.setContentType("application/force-download");
|
||||
response.flushBuffer();
|
||||
os = response.getOutputStream();
|
||||
// response.setHeader("Content-Disposition",
|
||||
// "attachment; filename=\""+ ReadExcel.encodeFileName(fileOriName+".zip", request) +"\"");
|
||||
// response.setContentType("application/force-download");
|
||||
// response.flushBuffer();
|
||||
// os = response.getOutputStream();
|
||||
workbook.write(excelOS);
|
||||
excelOS.flush();
|
||||
excelOS.close();
|
||||
ZipUtil.zip(fileNowPath,fileNowPath+".zip");
|
||||
FileInputStream fis = new FileInputStream(fileNowPath+".zip");
|
||||
int len = 0;
|
||||
while ((len = fis.read()) != -1) {
|
||||
os.write(len);
|
||||
}
|
||||
// FileInputStream fis = new FileInputStream(fileNowPath+".zip");
|
||||
// int len = 0;
|
||||
// while ((len = fis.read()) != -1) {
|
||||
// os.write(len);
|
||||
// }
|
||||
|
||||
// 将导出文件上传到cos上
|
||||
String uploadFileName = fileOriName + ".zip";
|
||||
@@ -2128,11 +2127,11 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
|
||||
// 系统向用户发消息
|
||||
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录人
|
||||
String msgTitle = "您导出的" + paramsCollectManifestVO.getExportName() + "已经生成完毕";
|
||||
String content = "您导出的" + paramsCollectManifestVO.getExportName() + "已经生成完毕,请点击下载。";
|
||||
String msgTitle = "The file " + paramsCollectManifestVO.getExportName() + " that you exported has been generated.";
|
||||
String content = "The file " + paramsCollectManifestVO.getExportName() + " that you exported has been generated, please click download.";
|
||||
|
||||
String href = "<a href='/jero-boot/sys/common/downLoadFile?id=" + ossFile.getId() + "'" + " target='_blank'>下载</a>。";
|
||||
String contentInfo = "您导出的" + paramsCollectManifestVO.getExportName() + "已经生成完毕,请点击" + href;
|
||||
String href = "<a href='/jero-boot/sys/common/downLoadFile?id=" + ossFile.getId() + "'" + " target='_blank'>download</a>.";
|
||||
String contentInfo = "The file " + paramsCollectManifestVO.getExportName() + " that you exported has been generated, please click " + href;
|
||||
|
||||
SysAnnouncement sysAnnouncement = new SysAnnouncement();
|
||||
sysAnnouncement.setDelFlag("0");
|
||||
@@ -2154,14 +2153,14 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
|
||||
uploadFileio.close();
|
||||
os.flush();
|
||||
os.close(); // 后开先关
|
||||
fis.close(); // 先开后关
|
||||
// os.flush();
|
||||
// os.close(); // 后开先关
|
||||
// fis.close(); // 先开后关
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new JeroBootException("下载文件失败,请重试");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
// IOUtils.closeQuietly(os);
|
||||
IOUtils.closeQuietly(excelOS);
|
||||
File tempZipFile = new File(uploadpath + "/tempZip");
|
||||
FileUtil.deleteContents(tempZipFile);
|
||||
@@ -2186,7 +2185,6 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
int indexOfDescription = 1; // 参数名称的位置
|
||||
for (int i = 0; i < fieldList.size(); i++) {
|
||||
OnlCgformField onlCgformField = fieldList.get(i);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String dbFieldName = onlCgformField.getDbFieldName();
|
||||
if (!"deadline".equals(dbFieldName) && !"cert_category".equals(dbFieldName) && !"description".equals(dbFieldName)) {
|
||||
dbFieldList.add(dbFieldName);
|
||||
@@ -2216,7 +2214,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
|
||||
} else {
|
||||
sysDictItemList.forEach(sysDictItem -> {
|
||||
dbFieldListCC.add(sysDictItem.getItemValue());
|
||||
dbFieldNameListCC.add(sysDictItem.getItemText() + " 编号");
|
||||
dbFieldNameListCC.add(sysDictItem.getItemText() + "编号");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -151,4 +151,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
List<SysUser> queryByDepIds(@Param("departIds")List<String> departIds,@Param("username") String username);
|
||||
|
||||
List<SysUser> getPPEmployeeList(@Param("thirdType") String thirdType);
|
||||
|
||||
void updateByIdPP (SysUser sysUser);
|
||||
}
|
||||
|
||||
+22
@@ -200,4 +200,26 @@
|
||||
select * from sys_user where third_type = #{thirdType}
|
||||
</select>
|
||||
|
||||
<update id="updateByIdPP">
|
||||
UPDATE
|
||||
sys_user
|
||||
SET
|
||||
username = #{username},
|
||||
realname = #{realname},
|
||||
status = #{status},
|
||||
del_flag = #{delFlag},
|
||||
third_id = #{thirdId},
|
||||
work_no = #{workNo},
|
||||
worker_type = #{workerType},
|
||||
create_time = #{createTime},
|
||||
update_time = #{updateTime},
|
||||
job_code = #{jobCode},
|
||||
job_title = #{jobTitle},
|
||||
org_code = #{orgCode},
|
||||
email = #{email},
|
||||
telephone = #{telephone}
|
||||
WHERE
|
||||
id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
+1
-1
@@ -562,7 +562,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}
|
||||
}
|
||||
|
||||
updateById(sysUser);
|
||||
this.baseMapper.updateByIdPP(sysUser);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -35,7 +35,7 @@ import com.jero.common.aspect.annotation.AutoLog;
|
||||
public class DocTranslationEOController extends JeroController<DocTranslationEO, IDocTranslationEOService> {
|
||||
@Autowired
|
||||
private IDocTranslationEOService docTranslationEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -51,11 +51,12 @@ public class DocTranslationEOController extends JeroController<DocTranslationEO,
|
||||
public Result<?> queryPageList(DocTranslationEO docTranslationEO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name="cut", defaultValue="cn") String cut,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<DocTranslationEO> queryWrapper = QueryGenerator.initQueryWrapper(docTranslationEO, req.getParameterMap());
|
||||
Page<DocTranslationEO> page = new Page<DocTranslationEO>(pageNo, pageSize);
|
||||
IPage<DocTranslationEO> pageList = docTranslationEOService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
return Result.OK(cut,pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+15
-4
@@ -1,8 +1,6 @@
|
||||
package com.jero.modules.docTranslation.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -15,8 +13,6 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档翻译表
|
||||
@@ -66,7 +62,18 @@ public class DocTranslationEO implements Serializable {
|
||||
@ApiModelProperty(value = "文档库id")
|
||||
private java.lang.String bussDocumentLibraryId;
|
||||
|
||||
/**编号*/
|
||||
@Excel(name = "编号", width = 15)
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String serialNumber;
|
||||
|
||||
/**标题*/
|
||||
@Excel(name = "标题", width = 15)
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
/**文本状态*/
|
||||
@Dict(dicCode = "state")
|
||||
@Excel(name = "文本状态", width = 15)
|
||||
@ApiModelProperty(value = "文本状态")
|
||||
private java.lang.String textStatus;
|
||||
@@ -77,16 +84,19 @@ public class DocTranslationEO implements Serializable {
|
||||
private java.lang.String fileName;
|
||||
|
||||
/**翻译前语言(源语言)*/
|
||||
@Dict(dicCode = "source_language")
|
||||
@Excel(name = "翻译前语言(源语言)", width = 15)
|
||||
@ApiModelProperty(value = "翻译前语言(源语言)")
|
||||
private java.lang.String sourceLanguage;
|
||||
|
||||
/**翻译后语言(目标语言)*/
|
||||
@Dict(dicCode = "target_language")
|
||||
@Excel(name = "翻译后语言(目标语言)", width = 15)
|
||||
@ApiModelProperty(value = "翻译后语言(目标语言)")
|
||||
private java.lang.String targetLanguage;
|
||||
|
||||
/**翻译结果*/
|
||||
@Dict(dicCode = "translation_result")
|
||||
@Excel(name = "翻译结果", width = 15)
|
||||
@ApiModelProperty(value = "翻译结果")
|
||||
private java.lang.String translationResult;
|
||||
@@ -99,6 +109,7 @@ public class DocTranslationEO implements Serializable {
|
||||
private java.util.Date translationTime;
|
||||
|
||||
/**发布情况*/
|
||||
@Dict(dicCode = "release_condition")
|
||||
@Excel(name = "发布情况", width = 15)
|
||||
@ApiModelProperty(value = "发布情况")
|
||||
private java.lang.String releaseCondition;
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.jero.modules.docTranslation.enums;
|
||||
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 发布情况枚举类
|
||||
*/
|
||||
public enum ReleaseConditionEnum {
|
||||
|
||||
PUBLISHED("已发布","published","Have published"),
|
||||
DRAFT("草稿","draft","Draft"),
|
||||
;
|
||||
|
||||
|
||||
String cnName;
|
||||
String enName;
|
||||
String value;
|
||||
|
||||
private ReleaseConditionEnum(String cnName, String value, String enName) {
|
||||
this.cnName = cnName;
|
||||
this.value = value;
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public String getCnName() {
|
||||
return cnName;
|
||||
}
|
||||
|
||||
public void setCnName(String cnName) {
|
||||
this.cnName = cnName;
|
||||
}
|
||||
|
||||
public String getEnName() {
|
||||
return enName;
|
||||
}
|
||||
|
||||
public void setEnName(String enName) {
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static String getTextByValue(String value,String cut) {
|
||||
ReleaseConditionEnum[] values = values();
|
||||
for (ReleaseConditionEnum releaseConditionEnum : values) {
|
||||
if (releaseConditionEnum.value.equals(value)) {
|
||||
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
|
||||
return releaseConditionEnum.cnName;
|
||||
}else if(StringUtils.equals(cut, CutEnum.EN.getValue())){
|
||||
return releaseConditionEnum.enName;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.jero.modules.docTranslation.enums;
|
||||
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 翻译结果枚举类
|
||||
*/
|
||||
public enum TranslationResultEnum {
|
||||
|
||||
IN_THE_TRANSLATION("翻译中","In the translation","In the translation"),
|
||||
TRANSLATION_DONE("翻译完成","Translation done","Translation done"),
|
||||
;
|
||||
|
||||
|
||||
String cnName;
|
||||
String enName;
|
||||
String value;
|
||||
|
||||
private TranslationResultEnum(String cnName, String value, String enName) {
|
||||
this.cnName = cnName;
|
||||
this.value = value;
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public String getCnName() {
|
||||
return cnName;
|
||||
}
|
||||
|
||||
public void setCnName(String cnName) {
|
||||
this.cnName = cnName;
|
||||
}
|
||||
|
||||
public String getEnName() {
|
||||
return enName;
|
||||
}
|
||||
|
||||
public void setEnName(String enName) {
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static String getTextByValue(String value,String cut) {
|
||||
TranslationResultEnum[] values = values();
|
||||
for (TranslationResultEnum translationResultEnum : values) {
|
||||
if (translationResultEnum.value.equals(value)) {
|
||||
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
|
||||
return translationResultEnum.cnName;
|
||||
}else if(StringUtils.equals(cut, CutEnum.EN.getValue())){
|
||||
return translationResultEnum.enName;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+20
-3
@@ -1,12 +1,19 @@
|
||||
package com.jero.modules.docTranslation.service.impl;
|
||||
|
||||
import com.jero.modules.docTranslation.entity.DocTranslationEO;
|
||||
import com.jero.modules.docTranslation.enums.ReleaseConditionEnum;
|
||||
import com.jero.modules.docTranslation.enums.TranslationResultEnum;
|
||||
import com.jero.modules.docTranslation.mapper.DocTranslationEOMapper;
|
||||
import com.jero.modules.docTranslation.service.IDocTranslationEOService;
|
||||
import com.jero.modules.docTranslation.utils.TranslationDocumentUtils;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @Description: 文档翻译表
|
||||
@@ -15,6 +22,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class DocTranslationEOServiceImpl extends ServiceImpl<DocTranslationEOMapper, DocTranslationEO> implements IDocTranslationEOService {
|
||||
|
||||
/**
|
||||
@@ -28,7 +36,16 @@ public class DocTranslationEOServiceImpl extends ServiceImpl<DocTranslationEOMap
|
||||
Date now = new Date();
|
||||
docTranslationEO.setCreateTime(now);
|
||||
docTranslationEO.setUpdateTime(now);
|
||||
save(docTranslationEO);
|
||||
docTranslationEO.setTranslationTime(now);
|
||||
docTranslationEO.setReleaseCondition(ReleaseConditionEnum.DRAFT.getValue());
|
||||
//翻译文档,将翻译后的文件id设置到当前对象中。
|
||||
OSSFile translateAfterFile = TranslationDocumentUtils.translationDocument(docTranslationEO);
|
||||
//如果翻译后的文件不为空,则证明翻译成功
|
||||
if(!Objects.isNull(translateAfterFile)){
|
||||
docTranslationEO.setTargetFileId(translateAfterFile.getId());
|
||||
docTranslationEO.setTranslationResult(TranslationResultEnum.TRANSLATION_DONE.getValue());
|
||||
}
|
||||
save(docTranslationEO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
package com.jero.modules.docTranslation.utils;
|
||||
|
||||
import com.jero.modules.docTranslation.entity.DocTranslationEO;
|
||||
import com.jero.modules.document.utils.ReadWordUtil;
|
||||
import com.jero.modules.feishu.service.IFeishuService;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 翻译文档工具类
|
||||
* @Author: wzj
|
||||
* @Date: 2022/7/22 13:53
|
||||
**/
|
||||
@Component
|
||||
public class TranslationDocumentUtils {
|
||||
private final static Logger logger= LoggerFactory.getLogger(TranslationDocumentUtils.class);
|
||||
|
||||
|
||||
private static String uploadpath;
|
||||
@Value(value = "${jero.path.upload}")
|
||||
public void setUploadpath(String uploadpath){
|
||||
TranslationDocumentUtils.uploadpath = uploadpath;
|
||||
}
|
||||
|
||||
private static IOSSFileService iossFileService;
|
||||
@Autowired
|
||||
public void setIossFileService(IOSSFileService iossFileService){
|
||||
TranslationDocumentUtils.iossFileService = iossFileService;
|
||||
}
|
||||
|
||||
private static IFeishuService feishuService;
|
||||
@Autowired
|
||||
public void setFeishuService(IFeishuService feishuService){
|
||||
TranslationDocumentUtils.feishuService = feishuService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 翻译文档
|
||||
* @param docTranslationEO
|
||||
*/
|
||||
public static OSSFile translationDocument(DocTranslationEO docTranslationEO){
|
||||
OSSFile translateAfterFile = null;
|
||||
//翻译文档
|
||||
String sourceFileId = docTranslationEO.getSourceFileId();
|
||||
List<OSSFile> sourceFileList = iossFileService.getFileInfos(sourceFileId);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(sourceFileList)){
|
||||
OSSFile sourceOssFile = sourceFileList.get(0);
|
||||
String translateFrontText = ReadWordUtil.readWord(sourceOssFile.getUrl(),uploadpath);
|
||||
|
||||
String translateAfter ="";
|
||||
StringBuffer translateAfterSb = new StringBuffer();
|
||||
|
||||
String tenantAccessToken = "";
|
||||
try {
|
||||
tenantAccessToken = feishuService.getTenantAccessToken();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Map<String,Object> feishuTranslateParamsMap = new HashMap<>();
|
||||
feishuTranslateParamsMap.put("sourceLanguage",docTranslationEO.getSourceLanguage());
|
||||
feishuTranslateParamsMap.put("targetLanguage",docTranslationEO.getTargetLanguage());
|
||||
feishuTranslateParamsMap.put("tenantAccessToken",tenantAccessToken);
|
||||
|
||||
//分隔长度
|
||||
int splitLength = 1000;
|
||||
if(translateFrontText.length() > splitLength){
|
||||
//计算出能分隔几次
|
||||
int translateArrLength = translateFrontText.length() / splitLength + 1;
|
||||
String translateFrontTextSplit = "";
|
||||
for (int i = 0; i < translateArrLength; i ++){
|
||||
if(i == 0){
|
||||
translateFrontTextSplit = translateFrontText.substring(0,splitLength);
|
||||
}else {
|
||||
//如果长度不够根据splitLength再截取一次。
|
||||
if(translateFrontText.length() < i*splitLength+(splitLength+1)){
|
||||
translateFrontTextSplit = translateFrontText.substring(i*(splitLength + 1),translateFrontText.length());
|
||||
}else {
|
||||
translateFrontTextSplit = translateFrontText.substring(i*(splitLength + 1),i*splitLength+(splitLength+1));
|
||||
}
|
||||
}
|
||||
|
||||
feishuTranslateParamsMap.put("translateFrontText",translateFrontTextSplit);
|
||||
translateAfter = feishuService.translateText(feishuTranslateParamsMap);
|
||||
translateAfterSb.append(translateAfter);
|
||||
}
|
||||
}else {
|
||||
feishuTranslateParamsMap.put("translateFrontText",translateFrontText);
|
||||
translateAfter = feishuService.translateText(feishuTranslateParamsMap);
|
||||
translateAfterSb.append(translateAfter);
|
||||
}
|
||||
|
||||
logger.debug("源文本:\n" + translateFrontText);
|
||||
logger.debug("翻译后文本:\n" + translateAfter);
|
||||
|
||||
//翻译后的文件路径
|
||||
String translateAfterFilePath = uploadpath + "/tempZip/translationTempFile";
|
||||
try {
|
||||
translateAfterFile = createTranslateAfterFile(translateAfterFilePath, translateAfterSb.toString(),sourceOssFile.getFileName());
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
logger.error("翻译文档-写入文档失败:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return translateAfterFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建翻译后的文件,把翻译后的语言放进去。
|
||||
* @param translateAfterFilePath
|
||||
* @throws Exception
|
||||
*/
|
||||
public static OSSFile createTranslateAfterFile(String translateAfterFilePath,String translateAfter,String fileName) throws Exception{
|
||||
OSSFile ossFile = null;
|
||||
File newFilePath = new File(translateAfterFilePath);
|
||||
if (!newFilePath.exists()) {
|
||||
newFilePath.mkdirs();
|
||||
}
|
||||
translateAfterFilePath = translateAfterFilePath + "/" + fileName;
|
||||
File newFile = new File(translateAfterFilePath);
|
||||
if (!newFile.exists()) {
|
||||
newFile.createNewFile();
|
||||
}
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(newFile);
|
||||
|
||||
MultipartFile multipartFile = createMfileByPath(translateAfterFilePath);
|
||||
ossFile = iossFileService.uploadLocalOfCos(multipartFile, "", null, null);
|
||||
out.write(translateAfter.getBytes("UTF-8"));
|
||||
out.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
//将翻译后的本地文件删除
|
||||
File file = new File(translateAfterFilePath);
|
||||
FileUtil.deleteContents(file);
|
||||
}
|
||||
return ossFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据路径创建文件
|
||||
* @param translateAfterFilePath
|
||||
* @return
|
||||
*/
|
||||
private static MultipartFile createMfileByPath(String translateAfterFilePath) {
|
||||
MultipartFile mFile = null;
|
||||
try {
|
||||
File file = new File(translateAfterFilePath);
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
|
||||
String fileName = file.getName();
|
||||
fileName = fileName.substring((fileName.lastIndexOf(File.separator) + 1));
|
||||
mFile = new MockMultipartFile(fileName, fileName, ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
logger.error("封装文件出现错误:{}", ex.getMessage());
|
||||
}
|
||||
return mFile;
|
||||
}
|
||||
}
|
||||
+8
@@ -3,6 +3,7 @@ package com.jero.modules.feishu.service;
|
||||
import com.jero.modules.feishu.vo.FeishuMsgVo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: liyawei
|
||||
@@ -35,4 +36,11 @@ public interface IFeishuService {
|
||||
* @return
|
||||
*/
|
||||
String sendCardMsg(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
|
||||
|
||||
/**
|
||||
* 翻译文本
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
String translateText(Map<String,Object> params);
|
||||
}
|
||||
|
||||
+68
@@ -37,6 +37,9 @@ public class FeishuServiceImpl implements IFeishuService {
|
||||
@Value("${Feishu.batchSendMessageUrl}")
|
||||
private String batchSendMessageUrl;
|
||||
|
||||
@Value("${Feishu.translateTextUrl}")
|
||||
private String translateTextUrl;
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
* @return
|
||||
@@ -238,4 +241,69 @@ public class FeishuServiceImpl implements IFeishuService {
|
||||
return tokenJson.get("msg").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 翻译文本
|
||||
* 参数:
|
||||
* params:{
|
||||
* "translateFrontText":"翻译前文本",
|
||||
* "sourceLanguage":"源语言",
|
||||
* "targetLanguage":"目标语言",
|
||||
* "tenantAccessToken":"登录令牌(飞书token)",
|
||||
* }
|
||||
*/
|
||||
@Override
|
||||
public String translateText(Map<String, Object> params) {
|
||||
String result = null;
|
||||
|
||||
String translateFrontText = (String) params.get("translateFrontText");
|
||||
String sourceLanguage = (String) params.get("sourceLanguage");
|
||||
String targetLanguage = (String) params.get("targetLanguage");
|
||||
String tenantAccessToken = (String) params.get("tenantAccessToken");
|
||||
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
headerMap.put("Content-Type", "application/json; charset=utf-8");
|
||||
headerMap.put("Authorization", "Bearer "+tenantAccessToken);
|
||||
|
||||
List<Map<String,Object>> glossaryList = new ArrayList<>();
|
||||
Map<String,Object> glossaryMap = new HashMap<>();
|
||||
glossaryMap.put("from","飞书");
|
||||
glossaryMap.put("to","Lark");
|
||||
glossaryList.add(glossaryMap);
|
||||
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
//请求级术语表,携带术语,仅在本次翻译中生效(最多能携带 128个术语词)
|
||||
paramsMap.put("glossary", glossaryList);
|
||||
//源语言
|
||||
paramsMap.put("source_language", sourceLanguage);
|
||||
//源文本
|
||||
paramsMap.put("text", translateFrontText);
|
||||
//目标语言
|
||||
paramsMap.put("target_language", targetLanguage);
|
||||
|
||||
try {
|
||||
String response = null;
|
||||
response = HttpRequestUtil.getResponseOfPOST(translateTextUrl, headerMap, JSON.toJSONString(paramsMap));
|
||||
//返回结果样例: {"code":0,"data":{"text":"Try using Lark."},"msg":"Success"}
|
||||
JSONObject translateAfterJson = JSONObject.parseObject(response);
|
||||
|
||||
if(response != null && translateAfterJson != null){
|
||||
if(!translateAfterJson.get("code").toString().equals("0")) {
|
||||
result = null;
|
||||
}
|
||||
result = JSONObject.parseObject(translateAfterJson.get("data").toString()).getString("text");
|
||||
}else {
|
||||
//如果出现了异常,把翻译前的文本返回
|
||||
result = translateFrontText;
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
//如果出现了异常,把翻译前的文本返回
|
||||
result = translateFrontText;
|
||||
ex.printStackTrace();
|
||||
log.error("飞书翻译-文本翻译失败:{}",ex.getMessage());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
@@ -36,6 +36,8 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -47,6 +49,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class LawsOpinionAssessmentResultEOServiceImpl extends ServiceImpl<LawsOpinionAssessmentResultEOMapper, LawsOpinionAssessmentResultEO> implements ILawsOpinionAssessmentResultEOService {
|
||||
|
||||
@Value(value = "${jero.path.upload}")
|
||||
|
||||
+3
@@ -23,6 +23,8 @@ import java.util.Date;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @Description: 法规意见收集表
|
||||
@@ -31,6 +33,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGatherEOMapper, LawsOpinionGatherEO> implements ILawsOpinionGatherEOService {
|
||||
|
||||
@Autowired
|
||||
|
||||
+3
@@ -28,6 +28,8 @@ import java.util.Date;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -38,6 +40,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class LawsProcessHistoryEOServiceImpl extends ServiceImpl<LawsProcessHistoryEOMapper, LawsProcessHistoryEO> implements ILawsProcessHistoryEOService {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -410,14 +410,18 @@ people:
|
||||
## Feishu
|
||||
Feishu:
|
||||
# 测试
|
||||
appId: cli_a16d47ca9f381013
|
||||
appSecret: DSfCrj70xku2VUjqwHBIuuY6HZnz7ppe
|
||||
# appId: cli_a16d47ca9f381013
|
||||
# appSecret: DSfCrj70xku2VUjqwHBIuuY6HZnz7ppe
|
||||
|
||||
appId: cli_a25c9fdae5bc100c
|
||||
appSecret: zIS7BLzcWaFvlpdz7CqRJbwVml4g4ESy
|
||||
|
||||
# 正式
|
||||
# appId: cli_a2a1a6014679500d
|
||||
# appSecret: AeHwisC82S0fhiREJg6bkdxhIZMevnZZ
|
||||
getTenantAccessTokenUrl: https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal
|
||||
batchSendMessageUrl: https://open.feishu.cn/open-apis/message/v4/batch_send/
|
||||
translateTextUrl: https://open.feishu.cn/open-apis/translation/v1/text/translate
|
||||
local-tool:
|
||||
uri: http://139.9.235.66:9022
|
||||
opensso:
|
||||
|
||||
Reference in New Issue
Block a user