diff --git a/jero-boot/db/蔚来标准sql/dev_third_record.sql b/jero-boot/db/蔚来标准sql/dev_third_record.sql index 61c6272b7..7de7fda86 100644 --- a/jero-boot/db/蔚来标准sql/dev_third_record.sql +++ b/jero-boot/db/蔚来标准sql/dev_third_record.sql @@ -417,4 +417,25 @@ ALTER TABLE `laws_weilai`.`params_report_detail` ALTER TABLE `laws_weilai`.`report_cert_category_params_info` MODIFY COLUMN `params_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数名称' AFTER `params_number`, - MODIFY COLUMN `description` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数说明' AFTER `params_name`; \ No newline at end of file + MODIFY COLUMN `description` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数说明' AFTER `params_name`; + +-- 文档翻译表 +CREATE TABLE `laws_weilai`.`doc_translation` ( + `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建日期', + `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新日期', + `sys_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门', + `buss_document_library_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文档库id', + `text_status` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文本状态', + `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件名称', + `source_language` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '翻译前语言(源语言)', + `target_language` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '翻译后语言(目标语言)', + `translation_result` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '翻译结果', + `translation_time` datetime NULL DEFAULT NULL COMMENT '转换时间', + `release_condition` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发布情况', + `source_file_id` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '源文件id', + `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; diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java index 682af6d01..925d7a8a8 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/controller/ParamsCollectManifestEOController.java @@ -381,13 +381,24 @@ public class ParamsCollectManifestEOController extends JeroController issueCollection(ParamsCollectManifestVO paramsCollectManifestVO) { - boolean isSuccess = paramsCollectManifestEOService.issueCollection(paramsCollectManifestVO); - if (isSuccess) { - return Result.OK("下发收集成功!"); - } else { - return Result.error("下发收集失败!"); - } + public Result> issueCollection(ParamsCollectManifestVO paramsCollectManifestVO) { + List msgList = paramsCollectManifestEOService.issueCollection(paramsCollectManifestVO); + return Result.OK(msgList); + } + + /** + * 一键下发收集 + * + * @param paramsCollectManifestVO + * @return + */ + @AutoLog(value = "参数项收集清单-一键下发收集") + @ApiOperation(value="参数项收集清单-一键下发收集", notes="参数项收集清单-一键下发收集") + @PostMapping(value = "/issueCollectionAll") +// @RequiresPermissions("params:collectManifest:issue") + public Result> issueCollectionAll(ParamsCollectManifestVO paramsCollectManifestVO) { + List msgList = paramsCollectManifestEOService.issueCollectionAll(paramsCollectManifestVO); + return Result.OK(msgList); } /** diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectManifestBaseEO.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectManifestBaseEO.java index ab5cc26e9..8e42caf35 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectManifestBaseEO.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/entity/ParamsCollectManifestBaseEO.java @@ -1,8 +1,6 @@ package com.jero.modules.cert.collect.entity; -import com.baomidou.mybatisplus.annotation.FieldStrategy; import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; @@ -121,7 +119,6 @@ public class ParamsCollectManifestBaseEO implements Serializable { /**工程接口人*/ @Excel(name = "工程接口人", width = 15) @ApiModelProperty(value = "工程接口人") - @TableField(updateStrategy = FieldStrategy.IGNORED) private String sdt; /**填写人*/ diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/ParamsManifestEOMapper.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/ParamsManifestEOMapper.java index 280efb58f..a64cf9c60 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/ParamsManifestEOMapper.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/ParamsManifestEOMapper.java @@ -23,4 +23,6 @@ public interface ParamsManifestEOMapper extends BaseMapper { List listInfoAll(@Param("idList") List idList); + ParamsManifestVO getProjectById(@Param("projectId") String projectId); + } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsManifestEOMapper.xml b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsManifestEOMapper.xml index 5ed28fbca..77c21dc38 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsManifestEOMapper.xml +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsManifestEOMapper.xml @@ -112,4 +112,16 @@ + + \ No newline at end of file diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java index b86067b96..73681d6b6 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/IParamsCollectManifestEOService.java @@ -126,7 +126,10 @@ public interface IParamsCollectManifestEOService extends IService issueCollection(ParamsCollectManifestVO paramsCollectManifestVO); + + // 一键下发收集 + List issueCollectionAll(ParamsCollectManifestVO paramsCollectManifestVO); // 配置-下拉选项 List> getConfigLabelList(ParamsCollectManifestVO paramsCollectManifestVO); diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/IParamsManifestEOService.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/IParamsManifestEOService.java index 972245644..624f50336 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/IParamsManifestEOService.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/IParamsManifestEOService.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.jero.modules.cert.collect.entity.ParamsManifestEO; import com.jero.modules.cert.collect.vo.ParamsManifestHistoryVO; +import com.jero.modules.cert.collect.vo.ParamsManifestVO; import com.jero.modules.cert.template.entity.ParamsTemplateEO; import java.util.List; @@ -79,4 +80,6 @@ public interface IParamsManifestEOService extends IService { IPage getAllManifest(IPage page, String projectName); ParamsManifestEO copy(ParamsManifestEO paramsManifestEO, String sourceManifestId); + + ParamsManifestVO getProjectById(String projectId); } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java index 3821d7723..9adfe5327 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java @@ -2,12 +2,14 @@ package com.jero.modules.cert.collect.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; import com.jero.common.constant.CommonConstant; +import com.jero.common.constant.WebsocketConst; import com.jero.common.constant.enums.CutEnum; import com.jero.common.constant.enums.MessageTypeEnum; import com.jero.common.constant.enums.YesOrNoEnum; @@ -16,10 +18,7 @@ import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.vo.LoginUser; import com.jero.generater.modules.online.cgform.entity.OnlCgformField; import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl; -import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO; -import com.jero.modules.cert.collect.entity.ParamsConfigDataEO; -import com.jero.modules.cert.collect.entity.ParamsConfigEO; -import com.jero.modules.cert.collect.entity.ParamsManifestEO; +import com.jero.modules.cert.collect.entity.*; import com.jero.modules.cert.collect.enums.*; import com.jero.modules.cert.collect.mapper.ParamsCollectManifestEOMapper; import com.jero.modules.cert.collect.service.IParamsCollectManifestEOService; @@ -28,6 +27,7 @@ import com.jero.modules.cert.collect.service.IParamsConfigEOService; import com.jero.modules.cert.collect.service.IParamsManifestEOService; import com.jero.modules.cert.collect.vo.ParamsCollectManifestVO; import com.jero.modules.cert.collect.vo.ParamsConfigDataVO; +import com.jero.modules.cert.collect.vo.ParamsManifestVO; import com.jero.modules.cert.report.entity.*; import com.jero.modules.cert.report.service.*; import com.jero.modules.cert.template.entity.CertCategoryParamsInfoPublishEO; @@ -37,6 +37,7 @@ import com.jero.modules.cert.template.service.ICertCategoryParamsInfoPublishEOSe import com.jero.modules.cert.template.service.IParamsInfoPublishEOService; import com.jero.modules.feishu.service.IFeishuService; import com.jero.modules.feishu.vo.FeishuMsgVo; +import com.jero.modules.message.websocket.WebSocket; import com.jero.modules.ocr.service.WebSocketServer; import com.jero.modules.ocr.util.LineHumpUtil; import com.jero.modules.oss.entity.OSSFile; @@ -62,6 +63,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.lang.reflect.Field; @@ -120,7 +122,10 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl updateEOList = new ArrayList<>(); StringBuilder connectBuilder = new StringBuilder(); connectBuilder.append("You are required to fill in "); - for (int i=0; i queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(ParamsCollectManifestEO::getId, Arrays.asList(paramsCollectManifestIdStr)) + .orderByAsc(ParamsCollectManifestEO::getDeadline).orderByAsc(ParamsCollectManifestEO::getNioNumber); + List paramsCollectManifestEOList = list(queryWrapper); + Date deadline = paramsCollectManifestEOList.get(0).getDeadline(); + int i = 0; + for (ParamsCollectManifestEO paramsCollectManifestEO : paramsCollectManifestEOList) { if (i < 3) { connectBuilder.append(paramsCollectManifestEO.getNioNumber()).append("-").append(paramsCollectManifestEO.getParamsName()).append(","); } + i++; ParamsCollectManifestEO updateEO = new ParamsCollectManifestEO(); - updateEO.setId(paramsCollectManifestIdStr[i]); + updateEO.setId(paramsCollectManifestEO.getId()); updateEO.setDre(dre); // 设置填写人 updateEO.setState(CollectManifestStateEnum.WAIT_FILL.getValue()); // 设置状态为:待填写 updateEOList.add(updateEO); @@ -1291,6 +1311,8 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImplthe link,"; String content = connectBuilder.substring(0, connectBuilder.toString().length()-1) + " and other parameter items, please enter the link to handle it."; String contentInfo = connectBuilder.substring(0, connectBuilder.toString().length()-1) + " please enter " + href + " to handle it."; + String msgTitle = "You have a homo parameter task to complete"; + // 发送系统消息 SysAnnouncement sysAnnouncement = new SysAnnouncement(); sysAnnouncement.setDelFlag("0"); @@ -1298,11 +1320,18 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl issueCollection(ParamsCollectManifestVO paramsCollectManifestVO) { if (StringUtils.isEmpty(paramsCollectManifestVO.getIds()) - || StringUtils.isEmpty(paramsCollectManifestVO.getProjectId()) || StringUtils.isEmpty(paramsCollectManifestVO.getParamsManifestId())) { + || StringUtils.isEmpty(paramsCollectManifestVO.getProjectId()) + || StringUtils.isEmpty(paramsCollectManifestVO.getParamsManifestId()) + || StringUtils.isEmpty(paramsCollectManifestVO.getCut()) + || paramsCollectManifestVO.getDeadline() == null ) { throw new JeroBootException("参数不能为空!"); } String paramsCollectManifestIds = paramsCollectManifestVO.getIds(); String projectId = paramsCollectManifestVO.getProjectId(); String paramsManifestId = paramsCollectManifestVO.getParamsManifestId(); + String cut = paramsCollectManifestVO.getCut(); + Date deadline = paramsCollectManifestVO.getDeadline(); + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录人 + ParamsManifestVO projectInfo = paramsManifestEOService.getProjectById(projectId); // 获取项目信息 + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String[] paramsCollectManifestIdStr = paramsCollectManifestIds.split(","); List updateEOList = new ArrayList<>(); + List> msgMapList = new ArrayList<>(); + List updateEOIdList = new ArrayList<>(); - for (int i=0; i paramsCollectManifestEOList = listByIds(Arrays.asList(paramsCollectManifestIdStr)); + paramsCollectManifestEOList = paramsCollectManifestEOList.stream().sorted(Comparator.comparing(ParamsCollectManifestBaseEO::getNioNumber)).collect(Collectors.toList()); // 按NIO编号升序 + for (ParamsCollectManifestEO paramsCollectManifestEO : paramsCollectManifestEOList) { + // 判断参数项状态 + if (CollectManifestStateEnum.WAIT_COLLECT.getValue().equals(paramsCollectManifestEO.getState())) { + if (StringUtils.isNotBlank(paramsCollectManifestEO.getSdt())) { + ParamsCollectManifestEO updateEO = new ParamsCollectManifestEO(); + updateEO.setId(paramsCollectManifestEO.getId()); + updateEO.setState(CollectManifestStateEnum.WAIT_SDT.getValue()); // 设置状态为:待工程接口人处理 + updateEO.setDeadline(deadline); + updateEOList.add(updateEO); + + updateEOIdList.add(paramsCollectManifestEO.getId()); + } else { + Map msgMap = new HashMap<>(); + msgMap.put("nioNumber", paramsCollectManifestEO.getNioNumber()); + msgMap.put("state", paramsCollectManifestEO.getState()); + msgMap.put("type", "1"); + msgMapList.add(msgMap); + } + + } else { + Map msgMap = new HashMap<>(); + msgMap.put("nioNumber", paramsCollectManifestEO.getNioNumber()); + msgMap.put("state", paramsCollectManifestEO.getState()); + msgMap.put("type", "2"); + msgMapList.add(msgMap); + } } boolean isSuccess = updateBatchById(updateEOList); - // 消息内容 - List paramsCollectManifestEOList = listByIds(Arrays.asList(paramsCollectManifestIdStr)); - List sdtList = paramsCollectManifestEOList.stream().map(ParamsCollectManifestEO::getSdt).distinct().collect(Collectors.toList()); - if (CollectionUtil.isEmpty(sdtList)) { - throw new JeroBootException("没有可下发的工程接口人!"); - } - for(String sdt : sdtList) { + if (isSuccess) { + // 消息内容 + List afterUpdateEOList = listByIds(updateEOIdList); + List sdtList = afterUpdateEOList.stream() + .map(ParamsCollectManifestEO::getSdt) + .distinct() + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(sdtList)) { + throw new JeroBootException("没有可下发的工程接口人!"); + } + for (String sdt : sdtList) { - StringBuilder connectBuilder = new StringBuilder(); - connectBuilder.append("You are required to fill in "); - for (int i=0; ithe link,"; + String contentInfo = connectBuilder.substring(0, connectBuilder.toString().length() - 1) + " and other parameter items, please enter " + href + " and fill in the relevant information."; + String msgTitle = "You have a homo parameter task to complete"; + + // 发送系统消息 + SysAnnouncement sysAnnouncement = new SysAnnouncement(); + sysAnnouncement.setDelFlag("0"); + sysAnnouncement.setSendStatus("0"); + sysAnnouncement.setSendTime(new Date()); + sysAnnouncement.setMsgCategory(MessageTypeEnum.HOMO_TASK.getValue());//消息类型 + sysAnnouncement.setMsgType(CommonConstant.MSG_TYPE_UESR);//指定用户 + sysAnnouncement.setTitile(msgTitle); + sysAnnouncement.setMsgContent(content); + sysAnnouncement.setMsgContentInfo(contentInfo); + sysAnnouncement.setUserIds(sysUser.getId()); + sysAnnouncementService.saveAnnouncement(sysAnnouncement); + + JSONObject obj = new JSONObject(); + obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC); + obj.put(WebsocketConst.MSG_ID, paramsManifestId); + obj.put(WebsocketConst.MSG_TXT, contentInfo); + webSocket.sendMessage(obj.toJSONString()); + + // 发送飞书消息 + try { + FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); + feishuMsgVo.setTitle(MessageTypeEnum.HOMO_TASK.getName()); + feishuMsgVo.setContent(content); + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setTaskType(MessageTypeEnum.HOMO_TASK.getName()); + feishuMsgVo.setProject(projectInfo.getProjectName()); // 车型-年款 区域 + feishuMsgVo.setInitiator(currentUser.getUsername()); + feishuMsgVo.setDueDate(sdf.format(deadline)); // 最早时间 + feishuService.sendCardMsg(thirdIds, feishuMsgVo); + } catch (IOException e) { + log.error("飞书消息推送失败"); + } + } + } + + return getMsgOfIssueCollection(msgMapList, cut); + } + + @Override + public List issueCollectionAll(ParamsCollectManifestVO paramsCollectManifestVO) { + if (StringUtils.isEmpty(paramsCollectManifestVO.getProjectId()) + || StringUtils.isEmpty(paramsCollectManifestVO.getParamsManifestId()) + || StringUtils.isEmpty(paramsCollectManifestVO.getCut()) + || paramsCollectManifestVO.getDeadline() == null ) { + throw new JeroBootException("参数不能为空!"); + } + String projectId = paramsCollectManifestVO.getProjectId(); + String paramsManifestId = paramsCollectManifestVO.getParamsManifestId(); + String cut = paramsCollectManifestVO.getCut(); + Date deadline = paramsCollectManifestVO.getDeadline(); + + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录人 + ParamsManifestVO projectInfo = paramsManifestEOService.getProjectById(projectId); // 获取项目信息 + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + List updateEOList = new ArrayList<>(); + List> msgMapList = new ArrayList<>(); + List updateEOIdList = new ArrayList<>(); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ParamsCollectManifestEO::getParamsManifestId, paramsManifestId) + .notIn(ParamsCollectManifestEO::getControlType, ControlTypeEnum.Title.getValue()) + .orderByAsc(ParamsCollectManifestEO::getNioNumber); + List paramsCollectManifestEOList = list(queryWrapper); + for (ParamsCollectManifestEO paramsCollectManifestEO : paramsCollectManifestEOList) { + // 判断参数项状态 + if (CollectManifestStateEnum.WAIT_COLLECT.getValue().equals(paramsCollectManifestEO.getState())) { + if (StringUtils.isNotBlank(paramsCollectManifestEO.getSdt())) { + ParamsCollectManifestEO updateEO = new ParamsCollectManifestEO(); + updateEO.setId(paramsCollectManifestEO.getId()); + updateEO.setState(CollectManifestStateEnum.WAIT_SDT.getValue()); // 设置状态为:待工程接口人处理 + updateEO.setDeadline(deadline); + updateEOList.add(updateEO); + + updateEOIdList.add(paramsCollectManifestEO.getId()); + } else { + Map msgMap = new HashMap<>(); + msgMap.put("nioNumber", paramsCollectManifestEO.getNioNumber()); + msgMap.put("state", paramsCollectManifestEO.getState()); + msgMap.put("state", "1"); + msgMapList.add(msgMap); + } + + } else { + Map msgMap = new HashMap<>(); + msgMap.put("nioNumber", paramsCollectManifestEO.getNioNumber()); + msgMap.put("state", paramsCollectManifestEO.getState()); + msgMap.put("type", "2"); + msgMapList.add(msgMap); + } + } + boolean isSuccess = updateBatchById(updateEOList); + + if (isSuccess) { + // 消息内容 + List afterUpdateEOList = listByIds(updateEOIdList); + List sdtList = afterUpdateEOList.stream() + .map(ParamsCollectManifestEO::getSdt) + .distinct() + .collect(Collectors.toList()); + if (CollectionUtil.isEmpty(sdtList)) { + throw new JeroBootException("没有可下发的工程接口人!"); + } + for (String sdt : sdtList) { + + StringBuilder connectBuilder = new StringBuilder(); + connectBuilder.append("You are required to fill in "); + for (int i = 0; i < afterUpdateEOList.size(); i++) { + ParamsCollectManifestEO paramsCollectManifestEO = afterUpdateEOList.get(i); + if (sdt.equals(paramsCollectManifestEO.getSdt()) && i < 3) { + connectBuilder.append(paramsCollectManifestEO.getNioNumber()).append("-").append(paramsCollectManifestEO.getParamsName()).append(","); + } + } + String content = connectBuilder.substring(0, connectBuilder.toString().length() - 1) + " and other parameter items, please enter the link to handle it."; + + SysUser sysUser = sysUserService.getUserByName(sdt); + String[] thirdIds = new String[1]; + thirdIds[0] = sysUser.getThirdId(); + String hrefFeishu = backUrl + "/ParameterItemCollection?id=" + paramsManifestId + "&projectId=" + projectId; + String href = "the link,"; + String contentInfo = connectBuilder.substring(0, connectBuilder.toString().length() - 1) + " and other parameter items, please enter " + href + " and fill in the relevant information."; + String msgTitle = "You have a homo parameter task to complete"; + + // 发送系统消息 + SysAnnouncement sysAnnouncement = new SysAnnouncement(); + sysAnnouncement.setDelFlag("0"); + sysAnnouncement.setSendStatus("0"); + sysAnnouncement.setSendTime(new Date()); + sysAnnouncement.setMsgCategory(MessageTypeEnum.HOMO_TASK.getValue());//消息类型 + sysAnnouncement.setMsgType(CommonConstant.MSG_TYPE_UESR);//指定用户 + sysAnnouncement.setTitile(msgTitle); + sysAnnouncement.setMsgContent(content); + sysAnnouncement.setMsgContentInfo(contentInfo); + sysAnnouncement.setUserIds(sysUser.getId()); + sysAnnouncementService.saveAnnouncement(sysAnnouncement); + + JSONObject obj = new JSONObject(); + obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC); + obj.put(WebsocketConst.MSG_ID, paramsManifestId); + obj.put(WebsocketConst.MSG_TXT, contentInfo); + webSocket.sendMessage(obj.toJSONString()); + + // 发送飞书消息 + try { + FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); + feishuMsgVo.setTitle(MessageTypeEnum.HOMO_TASK.getName()); + feishuMsgVo.setContent(content); + feishuMsgVo.setUrl(hrefFeishu); + feishuMsgVo.setTaskType(MessageTypeEnum.HOMO_TASK.getName()); + feishuMsgVo.setProject(projectInfo.getProjectName()); // 车型-年款 区域 + feishuMsgVo.setInitiator(currentUser.getUsername()); + feishuMsgVo.setDueDate(sdf.format(deadline)); + feishuService.sendCardMsg(thirdIds, feishuMsgVo); + } catch (IOException e) { + log.error("飞书消息推送失败"); } } - String content = connectBuilder.substring(0, connectBuilder.toString().length()-1) + " and other parameter items, please enter the link to handle it."; - - SysUser sysUser = sysUserService.getUserByName(sdt); - String[] thirdIds = new String[1]; - thirdIds[0] = sysUser.getThirdId(); - String hrefFeishu = backUrl + "/ParameterItemCollection?id=" + paramsManifestId + "&projectId=" + projectId; - String href = "the link,"; - String contentInfo = connectBuilder.substring(0, connectBuilder.toString().length()-1) + " and other parameter items, please enter " + href + " and fill in the relevant information."; - String msgTitle = "You have a homo parameter task to complete"; - - // TODO 为什么不用SendMessageUtils工具类呢? - // 发送系统消息 - SysAnnouncement sysAnnouncement = new SysAnnouncement(); - sysAnnouncement.setDelFlag("0"); - sysAnnouncement.setSendStatus("0"); - sysAnnouncement.setSendTime(new Date()); - sysAnnouncement.setMsgCategory(MessageTypeEnum.HOMO_TASK.getValue());//消息类型 - sysAnnouncement.setMsgType(CommonConstant.MSG_TYPE_UESR);//指定用户 - sysAnnouncement.setTitile(msgTitle); - sysAnnouncement.setMsgContent(content); - sysAnnouncement.setMsgContentInfo(contentInfo); - sysAnnouncement.setUserIds(sysUser.getId()); - sysAnnouncementService.saveAnnouncement(sysAnnouncement); - - // 发送飞书消息 - try { - FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); - feishuMsgVo.setTitle(MessageTypeEnum.HOMO_TASK.getName()); - feishuMsgVo.setContent(content); - feishuMsgVo.setUrl(hrefFeishu); - feishuMsgVo.setTaskType(MessageTypeEnum.HOMO_TASK.getName()); - feishuService.sendCardMsg(thirdIds, feishuMsgVo); - } catch (IOException e) { - log.error("飞书消息推送失败"); - } } - return isSuccess; + return getMsgOfIssueCollection(msgMapList, cut); } + private List getMsgOfIssueCollection(List> msgMapList, String cut) { + List msgList = new ArrayList<>(); + Map collectManifestStateEnumMap = CollectManifestStateEnum.toMap(cut); + + for (Map msgMap : msgMapList) { + String nioNumber = msgMap.get("nioNumber"); + String state = msgMap.get("state"); + String stateName = collectManifestStateEnumMap.get(state); + String type = msgMap.get("type"); + StringBuilder stringBuilder = new StringBuilder(); + if ("1".equals(type)) { + if (CutEnum.EN.getValue().equals(cut)) { + stringBuilder.append("NIO number is ").append("").append(nioNumber).append("").append(" ,the sdt has not been filled in. Please fill in the sdt before issuing and collecting."); + } else { + stringBuilder.append("NIO编号为").append("").append(nioNumber).append("").append("工程接口人没有填写,请填写完工程接口人再进行下发收集。"); + } + + } else { + if (CutEnum.EN.getValue().equals(cut)) { + stringBuilder.append("NIO number is ").append(nioNumber).append(",state is ").append("").append(stateName).append("").append(",no operation permission for this button."); + } else { + stringBuilder.append("NIO编号为").append(nioNumber).append(",状态为").append("").append(stateName).append("").append(",没有此按钮的操作权限。"); + } + + } + + msgList.add(stringBuilder.toString()); + } + if (CollectionUtil.isNotEmpty(msgMapList)) { + if (CutEnum.EN.getValue().equals(cut)) { + msgList.add("Homologation Engineer can operate when data state is 'Wait Collect'、'Sdt Back' or 'Change'"); + } else { + msgList.add("认证工程师数据状态为 '待发起收集'、'工程接口人退回'或'变更' 时,才有权限操作此按钮。"); + } + } + return msgList; + } + + @Override public List> getConfigLabelList(ParamsCollectManifestVO paramsCollectManifestVO) { String paramsManifestId = paramsCollectManifestVO.getParamsManifestId(); diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java index 51fe947a7..4225a1e7a 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java @@ -20,6 +20,7 @@ import com.jero.modules.cert.collect.mapper.ParamsConfigEOMapper; import com.jero.modules.cert.collect.mapper.ParamsManifestEOMapper; import com.jero.modules.cert.collect.service.*; import com.jero.modules.cert.collect.vo.ParamsManifestHistoryVO; +import com.jero.modules.cert.collect.vo.ParamsManifestVO; import com.jero.modules.cert.report.service.IParamsReportEOService; import com.jero.modules.cert.template.entity.ParamsInfoPublishEO; import com.jero.modules.cert.template.entity.ParamsTemplateEO; @@ -618,4 +619,9 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl page = new Page(pageNo, pageSize); IPage pageList = paramsExportTemplateEOService.page(page, queryWrapper); - List rows = pageList.getRecords(); // 处理 状态 中英文 + List rows = pageList.getRecords(); Map stateMap = ExportTemplateStateEnum.toMap(cut); rows.forEach(exportTemplateEO -> { - exportTemplateEO.setState(stateMap.get(exportTemplateEO.getState())); + exportTemplateEO.setState_dictText(stateMap.get(exportTemplateEO.getState())); }); return Result.OK(pageList); } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/controller/ParamsReportDetailEOController.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/controller/ParamsReportDetailEOController.java index a3cd6327c..010580e3e 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/controller/ParamsReportDetailEOController.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/controller/ParamsReportDetailEOController.java @@ -1,15 +1,21 @@ package com.jero.modules.cert.report.controller; +import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jero.common.api.vo.Result; import com.jero.common.aspect.annotation.AutoLog; +import com.jero.common.exception.JeroBootException; import com.jero.common.system.base.controller.JeroController; +import com.jero.modules.cert.report.entity.ParamsExportTemplateEO; import com.jero.modules.cert.report.entity.ParamsReportConfigEO; import com.jero.modules.cert.report.entity.ParamsReportDetailEO; +import com.jero.modules.cert.report.service.IParamsExportTemplateEOService; import com.jero.modules.cert.report.service.IParamsReportConfigEOService; import com.jero.modules.cert.report.service.IParamsReportDetailEOService; import com.jero.modules.cert.report.vo.ParamsReportDetailVO; +import com.jero.modules.oss.entity.OSSFile; +import com.jero.modules.oss.service.IOSSFileService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -43,6 +49,13 @@ public class ParamsReportDetailEOController extends JeroController ossFiles = ossFileService.getFileInfosByConnectId(paramsExportTemplateEO.getFileConnectId()); + if (CollectionUtil.isNotEmpty(ossFiles)) { + String fileName = ossFiles.get(0).getFileName(); + String templateFileType = fileName.substring(fileName.lastIndexOf(".")); + if (".doc,.DOC,.docx,.DOCX".contains(templateFileType)) { + paramsReportDetailEOService.exportCustomWord(paramsReportDetailVO, response, request); -// @ApiOperation(value = "上报库参数项-自定义导出excel") -// @GetMapping(value = "/exportCustomExcel") -//// @RequiresPermissions("report:detail:export:custom") -// public void exportCustomExcel(ParamsReportDetailVO paramsReportDetailVO, -// HttpServletResponse response, -// HttpServletRequest request) { -// paramsReportDetailEOService.exportCustomExcel(paramsReportDetailVO, response, request); -// } + } else if (".xls, .XLS,.xlsx,.XLSX".contains(templateFileType)) { + paramsReportDetailEOService.exportCustomExcel(paramsReportDetailVO, response, request); + + } + } else { + throw new JeroBootException("没有找到导出模板!"); + + } + } /** * 列表查询 diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/entity/ParamsExportTemplateEO.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/entity/ParamsExportTemplateEO.java index 0bdd40ab1..f60c054a5 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/entity/ParamsExportTemplateEO.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/entity/ParamsExportTemplateEO.java @@ -82,4 +82,7 @@ public class ParamsExportTemplateEO implements Serializable { @TableField(exist = false) private String cut; + @TableField(exist = false) + private String state_dictText; + } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/IParamsReportDetailEOService.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/IParamsReportDetailEOService.java index 3ac662c11..925a271be 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/IParamsReportDetailEOService.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/IParamsReportDetailEOService.java @@ -50,6 +50,9 @@ public interface IParamsReportDetailEOService extends IService> getTemplateLabelList(); - void exportCustom(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request); + // 自定义导出-word模板 + void exportCustomWord(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request); + + void exportCustomExcel(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request); } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java index 1881e36a6..54b443582 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java @@ -1,5 +1,7 @@ package com.jero.modules.cert.report.service.impl; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ZipUtil; @@ -23,23 +25,25 @@ import com.jero.modules.cert.report.entity.*; import com.jero.modules.cert.report.enums.ExportTypeEnum; import com.jero.modules.cert.report.mapper.ParamsReportDetailEOMapper; import com.jero.modules.cert.report.service.*; -import com.jero.modules.cert.report.util.Docx4jUtil; import com.jero.modules.cert.report.vo.ParamsReportDetailVO; import com.jero.modules.cert.template.enums.ControlTypeEnum; import com.jero.modules.ocr.util.LineHumpUtil; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; +import com.jero.modules.project.util.WordUtil; import com.jero.modules.split.common.ReadExcel; import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.service.ISysDictItemService; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.http.entity.ContentType; import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.*; import org.aspectj.util.FileUtil; +import org.docx4j.Docx4J; import org.docx4j.openpackaging.exceptions.Docx4JException; +import org.docx4j.openpackaging.packages.WordprocessingMLPackage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.mock.web.MockMultipartFile; @@ -504,7 +508,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl allParamsInfoList = queryForExportCustom(paramsReportDetailVO); Map params = allParamsInfoList.get(0); + List> imgListAll = (List>) allParamsInfoList.get(1).get("imgListAll"); String templateUrl = ""; ParamsExportTemplateEO paramsExportTemplateEO = paramsExportTemplateEOService.getById(paramsReportDetailVO.getExportTemplateId()); @@ -702,7 +707,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl allRelevFileList = (List) allParamsInfoList.get(1).get("fileListAll"); + List allRelevFileList = (List) allParamsInfoList.get(2).get("fileListAll"); if (allRelevFileList != null && !allRelevFileList.isEmpty()) { allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList()); downLoadFileList(allRelevFileList,fileNowPath + File.separator + "导出文件"); @@ -713,23 +718,15 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl allParamsInfoList = queryForExportCustom(paramsReportDetailVO); + Map params = allParamsInfoList.get(0); + + String templateUrl = ""; + ParamsExportTemplateEO paramsExportTemplateEO = paramsExportTemplateEOService.getById(paramsReportDetailVO.getExportTemplateId()); + List ossFiles = ossFileService.getFileInfosByConnectId(paramsExportTemplateEO.getFileConnectId()); + if (CollectionUtil.isNotEmpty(ossFiles)) { + templateUrl = ossFiles.get(0).getUrl(); + } + + // 替换模板中的占位符 + try { + + // 拿取模板 + String repFileName = fileName.replaceAll("/","_"); + wordOS = new FileOutputStream(fileNowPath + File.separator + repFileName); + if (CosBootUtil.doesObjectExist(templateUrl)) { + InputStream wordTemplate = CosBootUtil.download(templateUrl); + com.qcloud.cos.utils.IOUtils.copy(wordTemplate, wordOS); + } + + // 替换占位符内容 + TemplateExportParams templateExportParams = new TemplateExportParams(); + templateExportParams.setTemplateUrl(fileNowPath + File.separator + repFileName); + Workbook workbook = ExcelExportUtil.exportExcel(templateExportParams, params); + + OutputStream word = new FileOutputStream(fileNowPath + File.separator + repFileName); + workbook.write(word); + wordOS.flush(); + wordOS.close(); + word.flush(); + word.close(); + + // 打包导出压缩包 + response.setHeader("Content-Disposition", + "attachment; filename=\""+ ReadExcel.encodeFileName(fileOriName+".zip", request) +"\""); + response.setContentType("application/force-download"); + response.flushBuffer(); + os = response.getOutputStream(); + ZipUtil.zip(fileNowPath,fileNowPath+".zip"); + FileInputStream fis = new FileInputStream(fileNowPath+".zip"); + int len2 = 0; + while ((len2 = fis.read()) != -1) { + os.write(len2); + } + + os.flush(); + os.close(); // 后开先关 + fis.close(); // 先开后关 + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new JeroBootException("下载文件失败,请重试"); + + } finally { + IOUtils.closeQuietly(os); + IOUtils.closeQuietly(wordOS); + File tempZipFile = new File(uploadpath + "/tempZip"); + FileUtil.deleteContents(tempZipFile); + } + + } + private void downLoadFileList(List allRelevFileList,String fileNowPath) { File nowFile = new File(fileNowPath); if (nowFile.exists()){ @@ -852,23 +934,23 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl ossFileList = ossFileService.getFileInfosByConnectId(paramsConfigDataEO.getFileConnectId()); if (CollectionUtil.isNotEmpty(ossFileList)) { - configDataBuilder.append(ossFileList.get(0).getFileName()).append("&"); + configDataBuilder.append(ossFileList.get(0).getFileName()).append("#"); fileList.addAll(ossFileList); } } String configData = configDataBuilder.toString(); - if (configData.contains("&")) { - configData = configData.substring(0, configData.lastIndexOf("&")); + if (configData.contains("#")) { + configData = configData.substring(0, configData.lastIndexOf("#")); } record1.put(paramsConfigEO.getId(), configData); @@ -902,17 +984,17 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl queryForExportCustom(ParamsReportDetailVO paramsReportDetailVO) { - paramsReportDetailVO.setSeparator("&"); // 设置分隔符 + paramsReportDetailVO.setSeparator("*"); // 设置分隔符 List idList = new ArrayList<>(); if (StringUtils.isNotEmpty(paramsReportDetailVO.getIds())) { idList = Arrays.asList(paramsReportDetailVO.getIds().split(",")); } - List configIdList = Arrays.asList(paramsReportDetailVO.getConfigIds().split(",")); - List> dataList = paramsReportDetailEOMapper.listInfoForExport(idList, paramsReportDetailVO); + List configIdList = Arrays.asList(paramsReportDetailVO.getConfigIds().split(",")); // 需要导出的配置列 + List> dataList = paramsReportDetailEOMapper.listInfoForExport(idList, paramsReportDetailVO); // 查询需要导出的数据 List paramsConfigEOList = paramsReportConfigEOService.queryList(paramsReportDetailVO.getParamsManifestId()); // 查询所有配置列 List resultList = new ArrayList<>(); Map resultMap = new HashMap<>(); - List fileListAll = new ArrayList<>(); + + List> imgListAll = new ArrayList<>(); // 存放图片信息 + List fileListAll = new ArrayList<>(); // 存放文件 + String fileTypeStr = ".png,.PNG,.jfif,.JFIF,.pjpeg,.PJPEG,.jpeg,.JPEG,.pjp,.PJP,.jpg,.JPG"; // 查询配置列数据 for (Map record1 : dataList) { String paramsCollectManifestId = (String) record1.get("id"); String nioNumber = (String) record1.get("nio_number"); + String controlType = (String) record1.get("control_type"); if (CollectionUtil.isNotEmpty(paramsConfigEOList)) { List fileList = new ArrayList<>(); + List imgFileList = new ArrayList<>(); // 合并配置数据 String configData = ""; List paramsReportConfigDataEOS = paramsReportConfigDataEOService.queryByConfigIdListAndCollectManifestId(configIdList, paramsCollectManifestId); String textDatas = paramsReportConfigDataEOS.stream().filter(e->StringUtils.isNotEmpty(e.getTextData())) - .map(ParamsReportConfigDataEO::getTextData).distinct().collect(Collectors.joining(paramsReportDetailVO.getSeparator())); + .map(ParamsReportConfigDataEO::getTextData).distinct().collect(Collectors.joining(paramsReportDetailVO.getSeparator())); // 整合文本数据 String pullDatas = paramsReportConfigDataEOS.stream().filter(e->StringUtils.isNotEmpty(e.getPullData())) - .map(ParamsReportConfigDataEO::getPullData).distinct().collect(Collectors.joining(paramsReportDetailVO.getSeparator())); + .map(ParamsReportConfigDataEO::getPullData).distinct().collect(Collectors.joining(paramsReportDetailVO.getSeparator())); // 整合下拉数据 List fileNameList = new ArrayList<>(); - paramsReportConfigDataEOS.forEach(paramsReportConfigDataEO -> { + for (ParamsReportConfigDataEO paramsReportConfigDataEO : paramsReportConfigDataEOS) { // 获取”导出文件夹“下的文件 if (StringUtils.isNotEmpty(paramsReportConfigDataEO.getFileConnectId())) { List ossFileList = ossFileService.getFileInfosByConnectId(paramsReportConfigDataEO.getFileConnectId()); if (CollectionUtil.isNotEmpty(ossFileList)) { - fileNameList.add(ossFileList.get(0).getFileName()); + String fileName = ossFileList.get(0).getFileName(); + if (!fileTypeStr.contains(fileName.substring(fileName.lastIndexOf(".")))) { // 图片不放入”导出文件夹“下,直接插入正文 + fileNameList.add(ossFileList.get(0).getFileName()); - fileList.addAll(ossFileList); + fileList.addAll(ossFileList); + } else { + imgFileList.addAll(ossFileList); + } } } - }); + } + fileListAll.addAll(fileList); StringBuilder configDataBuilder = new StringBuilder(); // 重新组合配置数据 - if (StringUtils.isNotEmpty(textDatas)) { - configDataBuilder.append(textDatas).append("&"); - } - if (StringUtils.isNotEmpty(pullDatas)) { - configDataBuilder.append(pullDatas).append("&"); - } - if (CollectionUtil.isNotEmpty(fileNameList)) { - configDataBuilder.append(StringUtils.join(fileNameList, ",")).append("&"); - } - configData = configDataBuilder.toString(); - if (configData.contains("&")) { - configData = configData.substring(0, configData.lastIndexOf("&")); - } - resultMap.put(nioNumber, configData); + if ((ControlTypeEnum.FILE.getValue().equals(controlType) + || ControlTypeEnum.TEXT_FILE.getValue().equals(controlType) + || ControlTypeEnum.PULL_SINGLE_FILE.getValue().equals(controlType) + || ControlTypeEnum.PULL_MORE_FILE.getValue().equals(controlType) + || ControlTypeEnum.TEXT_PULL_SINGLE_FILE.getValue().equals(controlType)) && CollectionUtil.isNotEmpty(imgFileList)) { + // 获取图片字节 + // 附件为图片类型的配置数据,直接插入正文 + Map imgMap = new HashMap<>(); + List bytesList =new ArrayList<>(); - fileListAll.addAll(fileList); + int lengthTotal = 0; // 总长度 + for (OSSFile ossFile : imgFileList){ + if (CosBootUtil.doesObjectExist(ossFile.getUrl())) { + InputStream is = CosBootUtil.download(ossFile.getUrl()); + ByteArrayOutputStream os = new ByteArrayOutputStream(); + try { + IOUtils.copy(is, os); + } catch (IOException e) { + log.error(e.getMessage(), e); + throw new JeroBootException(e.getMessage()); + } + byte[] bytes = os.toByteArray(); + lengthTotal += bytes.length; + bytesList.add(bytes); + } + } + + // 合并多个bytes + byte[] totalByte = new byte[lengthTotal]; + int begin = 0; + for (byte[] bytes : bytesList){ + System.arraycopy(bytes, 0, totalByte, begin, bytes.length); + begin += bytes.length; + } + + if (StringUtils.isNotEmpty(textDatas)) { + configDataBuilder.append(textDatas).append("#"); // + } + if (StringUtils.isNotEmpty(pullDatas)) { + configDataBuilder.append(pullDatas).append("#"); // + } + configData = configDataBuilder.toString(); + if (configData.contains("#")) { // + configData = configData.substring(0, configData.lastIndexOf("#")); + } + + imgMap.put("key", nioNumber); + imgMap.put("text", configData); + imgMap.put("bytes", totalByte); + + imgListAll.add(imgMap); + + } else { + + if (StringUtils.isNotEmpty(textDatas)) { + configDataBuilder.append(textDatas).append("#"); + } + if (StringUtils.isNotEmpty(pullDatas)) { + configDataBuilder.append(pullDatas).append("#"); + } + if (CollectionUtil.isNotEmpty(fileNameList)) { + configDataBuilder.append(StringUtils.join(fileNameList, ",")).append("#"); + } + configData = configDataBuilder.toString(); + if (configData.contains("#")) { + configData = configData.substring(0, configData.lastIndexOf("#")); + } + + resultMap.put(nioNumber, configData); + } } } + Map imgMap = new HashMap<>(); + imgMap.put("imgListAll", imgListAll); Map fileMap = new HashMap<>(); fileMap.put("fileListAll", fileListAll); resultList.add(resultMap); + resultList.add(imgMap); resultList.add(fileMap); return resultList; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/controller/DocTranslationEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/controller/DocTranslationEOController.java new file mode 100644 index 000000000..3383c9982 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/controller/DocTranslationEOController.java @@ -0,0 +1,170 @@ +package com.jero.modules.docTranslation.controller; + +import java.util.Arrays; +import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import com.jero.common.api.vo.Result; +import com.jero.common.system.query.QueryGenerator; +import com.jero.modules.docTranslation.entity.DocTranslationEO; +import com.jero.modules.docTranslation.service.IDocTranslationEOService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import com.jero.common.system.base.controller.JeroController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import com.jero.common.aspect.annotation.AutoLog; + + + /** + * @Description: 文档翻译表 + * @Author: jero-boot + * @Date: 2022-07-20 + * @Version: V1.0 + */ +@Api(tags="文档翻译表") +@RestController +@RequestMapping("/docTranslation/docTranslationEO") +@Slf4j +public class DocTranslationEOController extends JeroController { + @Autowired + private IDocTranslationEOService docTranslationEOService; + + /** + * 分页列表查询 + * + * @param docTranslationEO + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "文档翻译表-分页列表查询") + @ApiOperation(value="文档翻译表-分页列表查询", notes="文档翻译表-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(DocTranslationEO docTranslationEO, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(docTranslationEO, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = docTranslationEOService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "文档翻译表-列表查询") + @ApiOperation(value="文档翻译表-列表查询", notes="文档翻译表-列表查询") + @GetMapping(value = "/list") + public Result> queryList() { + List list = docTranslationEOService.queryList(); + return Result.OK(list); + } + + /** + * 添加 + * + * @param docTranslationEO + * @return + */ + @AutoLog(value = "文档翻译表-添加") + @ApiOperation(value="文档翻译表-添加", notes="文档翻译表-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody DocTranslationEO docTranslationEO) { + docTranslationEOService.add(docTranslationEO); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param docTranslationEO + * @return + */ + @AutoLog(value = "文档翻译表-编辑") + @ApiOperation(value="文档翻译表-编辑", notes="文档翻译表-编辑") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody DocTranslationEO docTranslationEO) { + docTranslationEOService.editById(docTranslationEO); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "文档翻译表-通过id删除") + @ApiOperation(value="文档翻译表-通过id删除", notes="文档翻译表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + docTranslationEOService.deleteById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "文档翻译表-批量删除") + @ApiOperation(value="文档翻译表-批量删除", notes="文档翻译表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.docTranslationEOService.deleteByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "文档翻译表-通过id查询") + @ApiOperation(value="文档翻译表-通过id查询", notes="文档翻译表-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + DocTranslationEO docTranslationEO = docTranslationEOService.queryById(id); + if(docTranslationEO==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(docTranslationEO); + } + + /** + * 导出excel + * + * @param request + * @param docTranslationEO + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, DocTranslationEO docTranslationEO) { + return super.exportXls(request, docTranslationEO, DocTranslationEO.class, "文档翻译表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, DocTranslationEO.class); + } + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/entity/DocTranslationEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/entity/DocTranslationEO.java new file mode 100644 index 000000000..b6ca2dbff --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/entity/DocTranslationEO.java @@ -0,0 +1,116 @@ +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; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import com.jero.common.aspect.annotation.Dict; +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: 文档翻译表 + * @Author: jero-boot + * @Date: 2022-07-20 + * @Version: V1.0 + */ +@Data +@TableName("doc_translation") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="doc_translation对象", description="文档翻译表") +public class DocTranslationEO implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + + /**文档库id*/ + @Excel(name = "文档库id", width = 15) + @ApiModelProperty(value = "文档库id") + private java.lang.String bussDocumentLibraryId; + + /**文本状态*/ + @Excel(name = "文本状态", width = 15) + @ApiModelProperty(value = "文本状态") + private java.lang.String textStatus; + + /**文件名称*/ + @Excel(name = "文件名称", width = 15) + @ApiModelProperty(value = "文件名称") + private java.lang.String fileName; + + /**翻译前语言(源语言)*/ + @Excel(name = "翻译前语言(源语言)", width = 15) + @ApiModelProperty(value = "翻译前语言(源语言)") + private java.lang.String sourceLanguage; + + /**翻译后语言(目标语言)*/ + @Excel(name = "翻译后语言(目标语言)", width = 15) + @ApiModelProperty(value = "翻译后语言(目标语言)") + private java.lang.String targetLanguage; + + /**翻译结果*/ + @Excel(name = "翻译结果", width = 15) + @ApiModelProperty(value = "翻译结果") + private java.lang.String translationResult; + + /**转换时间*/ + @Excel(name = "转换时间", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "转换时间") + private java.util.Date translationTime; + + /**发布情况*/ + @Excel(name = "发布情况", width = 15) + @ApiModelProperty(value = "发布情况") + private java.lang.String releaseCondition; + + /**源文件id*/ + @Excel(name = "源文件id", width = 15) + @ApiModelProperty(value = "源文件id") + private java.lang.String sourceFileId; + + /**目标文件id*/ + @Excel(name = "目标文件id", width = 15) + @ApiModelProperty(value = "目标文件id") + private java.lang.String targetFileId; + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/mapper/DocTranslationEOMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/mapper/DocTranslationEOMapper.java new file mode 100644 index 000000000..0030c2e5c --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/mapper/DocTranslationEOMapper.java @@ -0,0 +1,17 @@ +package com.jero.modules.docTranslation.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import com.jero.modules.docTranslation.entity.DocTranslationEO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 文档翻译表 + * @Author: jero-boot + * @Date: 2022-07-20 + * @Version: V1.0 + */ +public interface DocTranslationEOMapper extends BaseMapper { + +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/mapper/xml/DocTranslationEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/mapper/xml/DocTranslationEOMapper.xml new file mode 100644 index 000000000..1fbb8484f --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/mapper/xml/DocTranslationEOMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/IDocTranslationEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/IDocTranslationEOService.java new file mode 100644 index 000000000..432741eb5 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/IDocTranslationEOService.java @@ -0,0 +1,61 @@ +package com.jero.modules.docTranslation.service; + +import com.jero.modules.docTranslation.entity.DocTranslationEO; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * @Description: 文档翻译表 + * @Author: jero-boot + * @Date: 2022-07-20 + * @Version: V1.0 + */ +public interface IDocTranslationEOService extends IService { + + /** + * 保存 + * + * @param docTranslationEO + * @return + */ + void add(DocTranslationEO docTranslationEO); + + /** + * 更新 + * + * @param docTranslationEO + * @return + */ + void editById(DocTranslationEO docTranslationEO); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + DocTranslationEO queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(); +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/impl/DocTranslationEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/impl/DocTranslationEOServiceImpl.java new file mode 100644 index 000000000..344364cc1 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/impl/DocTranslationEOServiceImpl.java @@ -0,0 +1,89 @@ +package com.jero.modules.docTranslation.service.impl; + +import com.jero.modules.docTranslation.entity.DocTranslationEO; +import com.jero.modules.docTranslation.mapper.DocTranslationEOMapper; +import com.jero.modules.docTranslation.service.IDocTranslationEOService; +import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Date; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 文档翻译表 + * @Author: jero-boot + * @Date: 2022-07-20 + * @Version: V1.0 + */ +@Service +public class DocTranslationEOServiceImpl extends ServiceImpl implements IDocTranslationEOService { + + /** + * 保存 + * + * @param docTranslationEO + * @return + */ + @Override + public void add(DocTranslationEO docTranslationEO) { + Date now = new Date(); + docTranslationEO.setCreateTime(now); + docTranslationEO.setUpdateTime(now); + save(docTranslationEO); + } + + /** + * 更新 + * + * @param docTranslationEO + * @return + */ + @Override + public void editById(DocTranslationEO docTranslationEO) { + Date now = new Date(); + docTranslationEO.setUpdateTime(now); + saveOrUpdate(docTranslationEO); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @Override + public void deleteById(String id) { + removeById(id); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @Override + public void deleteByIds(List ids) { + removeByIds(ids); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @Override + public DocTranslationEO queryById(String id) { + return getById(id); + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List queryList() { + return list(); + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/LawsComplianceBoardController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/LawsComplianceBoardController.java index b5167fba8..5fe107e70 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/LawsComplianceBoardController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/LawsComplianceBoardController.java @@ -9,11 +9,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -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.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.Map; @Api(tags="法规符合性看板") @@ -27,8 +26,8 @@ public class LawsComplianceBoardController { @AutoLog(value = "项目库-法规符合性看板列表分页查询") @ApiOperation(value="项目库-法规符合性看板列表分页查询", notes="项目库-法规符合性看板列表分页查询") - @GetMapping(value = "/page") - public JSONObject queryPageList(@RequestParam Map params){ + @PostMapping(value = "/page") + public JSONObject queryPageList(@RequestBody Map params){ IPage infoPage = this.lawsComplianceBoardService.queryPageList(params); Result ok = Result.OK(infoPage); JSONObject jsonResult = JSONObject.fromObject(ok); @@ -42,4 +41,26 @@ public class LawsComplianceBoardController { JSONObject result = this.lawsComplianceBoardService.queryComplianceResultList(params); return Result.OK(result); } + + /** + * 导出符合性结果 + * @param response + * @param request + * @param params + */ + @RequestMapping(value = "/exportComplianceResult") + public void exportComplianceResult(HttpServletResponse response, HttpServletRequest request,@RequestParam Map params){ + this.lawsComplianceBoardService.exportComplianceResult(response,request,params); + } + + /** + * 导出符合性结果明细 + * @param response + * @param request + * @param params + */ + @RequestMapping(value = "/exportComplianceResultDetail") + public void exportComplianceResultDetail(HttpServletResponse response, HttpServletRequest request,@RequestParam Map params){ + this.lawsComplianceBoardService.exportComplianceResultDetail(response,request,params); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/LawsComplianceBoardMapper.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/LawsComplianceBoardMapper.java index cc7849ae8..3d02c2dd9 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/LawsComplianceBoardMapper.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/LawsComplianceBoardMapper.java @@ -8,7 +8,7 @@ import java.util.Map; public interface LawsComplianceBoardMapper { /** - * 查询出 启动过 设计、prehomo、验证符合性、法规技术评估、法规意见收集其中一个流程 的数据 + * 分页查询出 启动过 设计、prehomo、验证符合性、法规技术评估、法规意见收集其中一个流程 的数据 * @param page * @param params * @return @@ -21,4 +21,11 @@ public interface LawsComplianceBoardMapper { * @return */ List> queryComplianceResultList(@Param("params") Map params); + + /** + * 查询出 启动过 设计、prehomo、验证符合性、法规技术评估、法规意见收集其中一个流程 的数据列表 + * @param params + * @return + */ + List> queryList(@Param("params") Map params); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/LawsComplianceBoardMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/LawsComplianceBoardMapper.xml index 08027e0bf..1e4382b0e 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/LawsComplianceBoardMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/mapper/xml/LawsComplianceBoardMapper.xml @@ -38,7 +38,7 @@ pyni.year_name as "yearName", pti.design_status as "designStatus", pti.design_p_id as "designPId", - pti.prehomo_status as "prehomoStatsu", + pti.prehomo_status as "prehomoStatus", pti.prehomo_p_id as "prehomoPId", pti.verify_status as "verifyStatus", pti.verify_p_id as "verifyPId", @@ -50,16 +50,53 @@ LEFT JOIN project_name_info pni ON ( pni.id = plb.project_name_id ) LEFT JOIN project_year_name_info pyni ON ( pyni.id = plb.year_name_id ) WHERE - pli.stand_id = #{params.id} - AND( pti.design_p_id IS NOT NULL OR pti.prehomo_p_id IS NOT NULL OR pti.verify_p_id IS NOT NULL ) - + 1=1 + + and pli.stand_id = #{params.id} + + and ( pti.design_p_id is not null or pti.prehomo_p_id is not null or pti.verify_p_id is not null ) + and pli.duty_territory like CONCAT(CONCAT('%',#{params.dutyTerritory}),'%') - + and pni.id like CONCAT(CONCAT('%',#{params.projectNameId}),'%') - + and pni.project_name like CONCAT(CONCAT('%',#{params.projectName}),'%') + + and pli.stand_id in + + #{item} + + + order by pli.create_time desc + + + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/ILawsComplianceBoardService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/ILawsComplianceBoardService.java index 12260ef23..67fe9e557 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/ILawsComplianceBoardService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/ILawsComplianceBoardService.java @@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.jero.common.api.vo.Result; import net.sf.json.JSONObject; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; import java.util.Map; public interface ILawsComplianceBoardService { @@ -15,4 +18,27 @@ public interface ILawsComplianceBoardService { * @return */ JSONObject queryComplianceResultList(Map params); + + /** + * 导出符合性结果 + * @param response + * @param request + * @param params + */ + void exportComplianceResult(HttpServletResponse response, HttpServletRequest request, Map params); + + /** + * 导出符合性结果明细 + * @param response + * @param request + * @param params + */ + void exportComplianceResultDetail(HttpServletResponse response, HttpServletRequest request, Map params); + + /** + * 法规符合性列表数据处理 + * @param datas + * @param cut + */ + void disposeData(List datas,String cut); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java index c95840dda..8277a6789 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java @@ -3,6 +3,9 @@ package com.jero.modules.project.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.jero.common.constant.enums.CutEnum; +import com.jero.common.exception.JeroBootException; +import com.jero.common.system.query.QueryRuleEnum; import com.jero.modules.document.enums.FieldTypeEnum; import com.jero.modules.document.service.IBussDocumentLibraryEOService; import com.jero.modules.document.vo.QueryConditionVO; @@ -10,20 +13,32 @@ import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO; import com.jero.modules.lawsOpinionGather.service.ILawsOpinionGatherEOService; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService; +import com.jero.modules.project.enums.DesignComplianceStatusEnum; import com.jero.modules.project.mapper.LawsComplianceBoardMapper; import com.jero.modules.project.service.ILawsComplianceBoardService; +import com.jero.modules.system.entity.SysCategory; +import com.jero.modules.system.entity.SysDictItem; +import com.jero.modules.system.service.ISysDictItemService; +import com.jero.modules.system.service.impl.SysCategoryServiceImpl; +import com.jero.modules.system.service.impl.SysDictItemServiceImpl; import com.jero.modules.system.util.StringUtils; import net.sf.json.JSONObject; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import java.util.List; -import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.util.*; +import java.util.stream.Collectors; @Service @Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) @@ -37,11 +52,18 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi private ILawsTechnologyEvaluationEOService lawsTechnologyEvaluationEOService; @Autowired private IBussDocumentLibraryEOService bussDocumentLibraryEOService; + @Autowired + private SysDictItemServiceImpl sysDictItemServiceImpl; + @Autowired + private SysCategoryServiceImpl sysCategoryService; + @Autowired + private ISysDictItemService sysDictItemService; @Override public IPage queryPageList(Map params) { int pageNo = Integer.parseInt(params.get("pageNo").toString()); int pageSize = Integer.parseInt(params.get("pageSize").toString()); + String cut = (String) params.get("cut"); //封装查询条件(包含高级搜索) String condition = this.getConditionStr(params); @@ -49,14 +71,58 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi IPage page = new Page(pageNo, pageSize); IPage infoPage = this.lawsComplianceBoardMapper.queryPageList(page, params); List records = infoPage.getRecords(); - this.disposeData(records); + this.disposeData(records,cut); return infoPage; } - public void disposeData(List datas){ + @Override + public void disposeData(List datas, String cut){ if (CollectionUtils.isNotEmpty(datas)) { + //获取数据字典 + List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); + //树形数据字典 + List technologyTerritoryList = sysCategoryService.list(); + + List stateSysDictItems = sysDictItems.stream().filter(sysDictItem -> { + boolean flag = false; + if (StringUtils.equals(sysDictItem.getDictCode(), "state")) { + flag = true; + } + return flag; + }).collect(Collectors.toList()); + for (Object data : datas) { Map dataMap = (Map) data; + dataMap.entrySet().forEach(map -> { + if(map.getValue() == null){ + map.setValue(""); + } + }); + if(dataMap.get("state") != null){ + String state_dicText = ""; + if(StringUtils.equals(cut,CutEnum.CN.getValue())){ + state_dicText = stateSysDictItems.stream().filter(sysDictItem -> { + boolean flag = false; + if(StringUtils.equals(dataMap.get("state").toString(),sysDictItem.getItemValue())){ + flag = true; + } + return flag; + }).map(SysDictItem::getItemText).distinct().collect(Collectors.joining(",")); + }else { + state_dicText = stateSysDictItems.stream().filter(sysDictItem -> { + boolean flag = false; + if(StringUtils.equals(dataMap.get("state").toString(),sysDictItem.getItemValue())){ + flag = true; + } + return flag; + }).map(SysDictItem::getEnName).distinct().collect(Collectors.joining(",")); + } + dataMap.put("state_dicText",state_dicText); + } + if(dataMap.get("technologyTerritory") != null){ + String technologyTerritory_dictText = disposeTechnologyTerritory(technologyTerritoryList, dataMap.get("technologyTerritory").toString(), cut); + dataMap.put("technologyTerritory_dicText",technologyTerritory_dictText); + } } } } @@ -66,8 +132,9 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi JSONObject result = new JSONObject(); String id = (String) params.get("id"); String cut = (String) params.get("cut"); - List> cmplianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params); - result.put("cmplianceResultList",cmplianceResultList); + List> complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params); + this.disposeComplianceResult(complianceResultList,cut); + result.put("complianceResultList",complianceResultList); //查询当前数据是否有法规意见收集流程数据 QueryWrapper opinionGatherEOQueryWrapper = new QueryWrapper<>(); @@ -83,6 +150,258 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi return result; } + public void disposeComplianceResult(List> complianceResultList,String cut){ + if(CollectionUtils.isNotEmpty(complianceResultList)){ + List dutyTerritoryDictItemList = sysDictItemService.selectItemsByDictCode("duty_territory"); + for (Map complianceResult : complianceResultList) { + if (complianceResult.get("designStatus") != null) { + String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("designStatus").toString(), cut); + complianceResult.put("designStatus_dicText",textByValue); + } + if (complianceResult.get("prehomoStatus") != null && complianceResult.get("prehomoStatus") != "") { + String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("prehomoStatus").toString(), cut); + complianceResult.put("prehomoStatus_dicText",textByValue); + } + if (complianceResult.get("verifyStatus") != null) { + String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("verifyStatus").toString(), cut); + complianceResult.put("verifyStatus_dicText",textByValue); + } + if (complianceResult.get("dutyTerritory") != null) { + String dutyTerritory_dicText = ""; + if (CutEnum.EN.getValue().equals(cut)) { + dutyTerritory_dicText = dutyTerritoryDictItemList.stream().filter(dictItem -> { + boolean flag = false; + String[] dutyTerritoryArr = complianceResult.get("dutyTerritory").toString().split(","); + for (String duty : dutyTerritoryArr) { + if(StringUtils.equals(dictItem.getItemValue(),duty)){ + flag = true; + } + } + return flag; + }).map(SysDictItem::getEnName).collect(Collectors.joining(",")); + } else { + dutyTerritory_dicText = dutyTerritoryDictItemList.stream().filter(dictItem -> { + boolean flag = false; + String[] dutyTerritoryArr = complianceResult.get("dutyTerritory").toString().split(","); + for (String duty : dutyTerritoryArr) { + if(StringUtils.equals(dictItem.getItemValue(),duty)){ + flag = true; + } + } + return flag; + }).map(SysDictItem::getItemText).collect(Collectors.joining(",")); + } + complianceResult.put("dutyTerritory_dicText",dutyTerritory_dicText); + } + + Map dataMap = (Map) complianceResult; + dataMap.entrySet().forEach(map -> { + if(map.getValue() == null){ + map.setValue(""); + } + }); + } + } + } + + @Override + public void exportComplianceResult(HttpServletResponse response, HttpServletRequest request, Map params) { + String cut = (String) params.get("cut"); + String exportAll = (String) params.get("exportAll"); + String condition = this.getConditionStr(params); + params.put("condition",StringUtils.isNotEmpty(condition) ? condition : ""); + List> exportData = new ArrayList<>(); + if(StringUtils.equals(exportAll,"no")){ + IPage page = this.queryPageList(params); + exportData = page.getRecords(); + }else { + exportData = this.lawsComplianceBoardMapper.queryList(params); + } + this.disposeData(exportData,cut); + if(CollectionUtils.isNotEmpty(exportData)){ + List idList = new ArrayList<>(); + exportData.forEach(data -> { + idList.add(data.get("id").toString()); + }); + params.put("idList",idList); + List> complianceResultList = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(idList)){ + complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params); + this.disposeComplianceResult(complianceResultList,cut); + } + + String title = ""; + String fileName = ""; + if(StringUtils.equals(cut, CutEnum.CN.getValue())){ + title = "编号,标题,状态,技术领域,责任领域,相关项目,设计符合性,Pre-Homo确认,验证符合性"; + fileName = "符合性结果" + ".xlsx"; + }else if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + title = "Serial number,Title,State,Technology territory,Responsible Field,Relevant project,Design conformance,Pre-Homo Confirm,Verify conformance"; + fileName = "Compliance results" + ".xlsx"; + } + OutputStream os = null; + HSSFWorkbook workbook = new HSSFWorkbook(); + + try { + response.setHeader("Content-Disposition", + "attachment; filename=" + fileName); + response.setContentType("application/force-download"); + + HSSFSheet sheet = workbook.createSheet("sheet1"); + + CellStyle titleCellStyle = workbook.createCellStyle(); + titleCellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中 + titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中 + titleCellStyle.setWrapText(true);//自动换行 + + //创建表头 + String[] firstLineTitleArr = title.split(","); + Row firstRow = sheet.createRow(0); + + //设置居中、表头值。 + for (int i = 0; i < firstLineTitleArr.length; i++){ + sheet.setColumnWidth(i,5000); + Cell cell = firstRow.createCell(i); + cell.setCellStyle(titleCellStyle); + cell.setCellValue(firstLineTitleArr[i]); + } + + //设置导出数据 + if(CollectionUtils.isNotEmpty(exportData)) { + int rowIndex = 1; + for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) { + + List> byStandIdcomplianceResultList = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(complianceResultList)){ + for (Map comlianceResult : complianceResultList) { + if (StringUtils.equals(comlianceResult.get("standId").toString(), exportData.get(dataIndex).get("id").toString())) { + byStandIdcomplianceResultList.add(comlianceResult); + } + } + } + if(CollectionUtils.isNotEmpty(byStandIdcomplianceResultList)){ + int byStandIdComlianceResultSize = byStandIdcomplianceResultList.size(); + for (int i=0; i 1 && i != (byStandIdComlianceResultSize - 1)){ + rowIndex ++; + } + } + }else { + Row dataRow = sheet.createRow(rowIndex); + dataRow.createCell(0).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("serialNumber"))); + dataRow.createCell(1).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("title"))); + dataRow.createCell(2).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("state_dicText"))); + dataRow.createCell(3).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("technologyTerritory_dicText"))); + } + rowIndex ++; + } + } + os = response.getOutputStream(); + workbook.write(os); + os.flush(); + }catch (IOException ex){ + if(CutEnum.CN.getValue().equals(cut)){ + throw new JeroBootException("下载文件失败"); + }else{ + throw new JeroBootException("Failed to download file"); + } + } + } + } + + /** + * 验证值是否是null + * @param str + * @return + */ + public String checkValueIsNotNull(Object str){ + String result = ""; + if(str != null){ + result = str.toString(); + } + return result; + } + + @Override + public void exportComplianceResultDetail(HttpServletResponse response, HttpServletRequest request, Map params) { + String cut = (String) params.get("cut"); + List> exportData = this.lawsComplianceBoardMapper.queryComplianceResultList(params); + this.disposeComplianceResult(exportData,cut); + if(CollectionUtils.isNotEmpty(exportData)){ + String title = ""; + String fileName = ""; + if(StringUtils.equals(cut, CutEnum.CN.getValue())){ + title = "责任领域,相关项目,设计符合性,Pre-Homo确认,验证符合性"; + fileName = "符合性结果" + ".xlsx"; + }else if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + title = "Responsible Field,Relevant project,Design conformance,Pre-Homo Confirm,Verify conformance"; + fileName = "Compliance results" + ".xlsx"; + } + OutputStream os = null; + HSSFWorkbook workbook = new HSSFWorkbook(); + + try { + response.setHeader("Content-Disposition", + "attachment; filename=" + fileName); + response.setContentType("application/force-download"); + + HSSFSheet sheet = workbook.createSheet("sheet1"); + + CellStyle titleCellStyle = workbook.createCellStyle(); + titleCellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中 + titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中 + titleCellStyle.setWrapText(true);//自动换行 + + //创建表头 + String[] firstLineTitleArr = title.split(","); + Row firstRow = sheet.createRow(0); + + //设置居中、表头值。 + for (int i = 0; i < firstLineTitleArr.length; i++){ + sheet.setColumnWidth(i,5000); + Cell cell = firstRow.createCell(i); + cell.setCellStyle(titleCellStyle); + cell.setCellValue(firstLineTitleArr[i]); + } + + //设置导出数据 + if(CollectionUtils.isNotEmpty(exportData)) { + int rowIndex = 1; + for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) { + Row dataRow = sheet.createRow(rowIndex); + dataRow.createCell(0).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("dutyTerritory_dicText"))); + dataRow.createCell(1).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("projectName"))); + dataRow.createCell(2).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("designStatus_dicText"))); + dataRow.createCell(3).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("prehomoStatus_dicText"))); + dataRow.createCell(4).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("verifyStatus_dicText"))); + rowIndex ++; + } + } + os = response.getOutputStream(); + workbook.write(os); + os.flush(); + }catch (IOException ex){ + if(CutEnum.CN.getValue().equals(cut)){ + throw new JeroBootException("下载文件失败"); + }else{ + throw new JeroBootException("Failed to download file"); + } + } + } + } + @NotNull public String getConditionStr(Map parameter) { @@ -113,7 +432,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi if (value.contains("%")) { value = value.replace("%", "/%"); } - conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'"); + conditionSb.append(" and bdl." + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'"); } else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(fieldType) || FieldTypeEnum.PULL_MORE.getValue().equals(fieldType) || FieldTypeEnum.TREE.getValue().equals(fieldType)) { @@ -121,27 +440,27 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi StringBuilder condition = new StringBuilder(); for (String valueTemp : value.split(",")) { valueSb.append("'" + valueTemp + "',"); - condition.append(" or " + key + " like concat(concat('%','" + valueTemp + "'),'%')"); + condition.append(" or bdl." + key + " like concat(concat('%','" + valueTemp + "'),'%')"); } condition.append(")"); String substring = valueSb.substring(0, valueSb.length() - 1); //下拉单选或下拉多选 - conditionSb.append(" and (" + key + " in(" + substring + ")" + condition.toString()); + conditionSb.append(" and (bdl." + key + " in(" + substring + ")" + condition.toString()); } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldType)) { //日期(区分单日期还时间范围) if (value.contains(",")) { - conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'" + conditionSb.append(" and " + "date_format(bdl." + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'" + " and " + "date_format(" + key + ",'%Y-%m-%d') <= '" + value.split(",")[1] + "'"); } else { - conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') = '" + value + "'"); + conditionSb.append(" and " + "date_format(bdl." + key + ",'%Y-%m-%d') = '" + value + "'"); } } else if (FieldTypeEnum.PERSON.getValue().equals(fieldType)) { //输入框 LIKE CONCAT("%", '/%', "%") ESCAPE '/' if (value.contains("%")) { value = value.replace("%", "/%"); } - conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'"); + conditionSb.append(" and bdl." + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'"); } } } @@ -177,13 +496,26 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi String queryConditionVOListStr = (String) parameter.get("queryConditionVOList"); List queryConditionVOList = com.alibaba.fastjson.JSONObject.parseArray(queryConditionVOListStr, QueryConditionVO.class); if(ObjectUtils.isNotEmpty(queryConditionVOList)){ - String queryCondition = this.bussDocumentLibraryEOService.sqlJoint(queryConditionVOList); + String queryCondition = this.sqlJoint(queryConditionVOList); if(StringUtils.isNotBlank(queryCondition)){ conditionSb.append(" and " + queryCondition); } } } + String ids = (String) parameter.get("ids"); + if(StringUtils.isNotEmpty(ids)){ + List idList = Arrays.asList(ids.split(",")); + String idStr = ""; + for (String id : idList) { + idStr += "'"+id+"',"; + } + if(StringUtils.isNotEmpty(idStr)){ + idStr = idStr.substring(0,idStr.length()-1); + conditionSb.append(" and id in("+idStr+")"); + } + } + //处理列表表头排序 /*if (StringUtils.isNotBlank((String) parameter.get("orderByField"))) { conditionSb.append(" order by " + (String) parameter.get("orderByField")); @@ -198,4 +530,115 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi String condition = conditionSb.toString(); return condition; } + + public String sqlJoint(List queryConditionVOList){ + StringBuilder sb = new StringBuilder(); + if(queryConditionVOList.size() != 0){ + int count =0; + for (QueryConditionVO queryConditionVO : queryConditionVOList) { + String type = queryConditionVO.getType();//and或or + String rule = queryConditionVO.getRule(); + String ruleLike = ""; + if(QueryRuleEnum.LEFT_LIKE.getCondition().equals(rule) || QueryRuleEnum.RIGHT_LIKE.getCondition().equals(rule)){ + ruleLike = QueryRuleEnum.LIKE.getCondition(); + } + String field = queryConditionVO.getField(); + String val = queryConditionVO.getVal(); + //如果查询字段对应的搜索条件值为空,则不作处理 + if(StringUtils.isNotBlank(val)) { + field = "bdl." + field; + count++;//从第二个查询条件开始拼接type(and或or) + if (count > 1) { + sb.append(" " + type + " "); + } + sb.append(" " + field + " "); + //查询类型 + String ruleTemp = queryType(rule); + if (StringUtils.isNotBlank(ruleLike)) { + sb.append(ruleLike + " "); + } else { + sb.append(ruleTemp + " "); + } + //like和in需要特殊处理 + if (QueryRuleEnum.IN.getCondition().equals(rule)) { + if (val.contains(",")) { + StringBuilder sbTemp = new StringBuilder(); + for (String valTemp : val.split(",")) { + sbTemp.append("'" + valTemp + "' ,"); + } + if (StringUtils.isNotBlank(sbTemp)) { + String substring = sbTemp.substring(0, sbTemp.length() - 1); + sb.append("(" + substring + ")"); + } + } + sb.append("('" + val + "')"); + } else if (QueryRuleEnum.LIKE.getCondition().equals(rule)) { + sb.append("'%" + val + "%'"); + } else if (QueryRuleEnum.LEFT_LIKE.getCondition().equals(rule)) { + sb.append("'%" + val + "'"); + } else if (QueryRuleEnum.RIGHT_LIKE.getCondition().equals(rule)) { + sb.append("'" + val + "%'"); + } else { + sb.append("'" + val + "'"); + } + } + } + } + return sb.toString(); + } + + public String queryType(String rule){ + String value =""; + if(QueryRuleEnum.GT.getCondition().equals(rule)){ + value = QueryRuleEnum.GT.getValue(); + }else if(QueryRuleEnum.GE.getCondition().equals(rule)){ + value = QueryRuleEnum.GE.getValue(); + }else if(QueryRuleEnum.LT.getCondition().equals(rule)){ + value = QueryRuleEnum.LT.getValue(); + }else if(QueryRuleEnum.LE.getCondition().equals(rule)){ + value = QueryRuleEnum.LE.getValue(); + }else if(QueryRuleEnum.EQ.getCondition().equals(rule)){ + value = QueryRuleEnum.EQ.getValue(); + }else if(QueryRuleEnum.NE.getCondition().equals(rule)){ + value = QueryRuleEnum.NE.getValue(); + }else if(QueryRuleEnum.LIKE.getCondition().equals(rule)){ + value = QueryRuleEnum.LIKE.getValue(); + }else if(QueryRuleEnum.LEFT_LIKE.getCondition().equals(rule)){ + value = QueryRuleEnum.LEFT_LIKE.getValue(); + }else if(QueryRuleEnum.RIGHT_LIKE.getCondition().equals(rule)){ + value = QueryRuleEnum.RIGHT_LIKE.getValue(); + }else if(QueryRuleEnum.IN.getCondition().equals(rule)){ + value = QueryRuleEnum.IN.getValue(); + } + return value; + } + + /** + * 处理技术领域展示字段 + * @param technologyTerritoryList + * @param technologyTerritory + * @param cut + * @return + */ + public String disposeTechnologyTerritory(List technologyTerritoryList, String technologyTerritory, String cut){ + String result = ""; + // technology_territory + if(org.apache.commons.lang3.StringUtils.isNotEmpty(technologyTerritory)){ + StringBuilder sb = new StringBuilder(); + for (String technologyTerritoryId : technologyTerritory.split(",")) { + List collect = technologyTerritoryList.stream().filter(e -> e.getId().equals(technologyTerritoryId)).collect(Collectors.toList()); + if(collect.size() != 0){ + if(CutEnum.CN.getValue().equals(cut)){ + sb.append(collect.get(0).getName()+","); + }else{ + sb.append(collect.get(0).getEnName()+","); + } + } + } + if(org.apache.commons.lang3.StringUtils.isNotEmpty(sb)){ + result = sb.substring(0, sb.length() - 1); + } + } + return result; + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/util/WordUtil.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/util/WordUtil.java index 3872677ca..f6945d179 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/util/WordUtil.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/util/WordUtil.java @@ -1,14 +1,5 @@ package com.jero.modules.project.util; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import org.apache.commons.io.IOUtils; import org.docx4j.Docx4J; import org.docx4j.TraversalUtil; import org.docx4j.XmlUtils; @@ -20,23 +11,24 @@ import org.docx4j.finders.RangeFinder; import org.docx4j.fonts.IdentityPlusMapper; import org.docx4j.fonts.Mapper; import org.docx4j.fonts.PhysicalFonts; +import org.docx4j.jaxb.Context; import org.docx4j.openpackaging.packages.WordprocessingMLPackage; import org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage; import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart; -import org.docx4j.wml.Body; -import org.docx4j.wml.CTBookmark; -import org.docx4j.wml.Document; -import org.docx4j.wml.Drawing; -import org.docx4j.wml.ObjectFactory; -import org.docx4j.wml.P; -import org.docx4j.wml.R; -import org.docx4j.wml.Tbl; -import org.docx4j.wml.Text; -import org.docx4j.wml.Tr; +import org.docx4j.wml.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.FileCopyUtils; +import javax.xml.bind.JAXBElement; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public class WordUtil { private static final Logger log = LoggerFactory.getLogger(WordUtil.class); @@ -126,7 +118,16 @@ public class WordUtil { table.getContent().remove(rowNum - 1); } - public static void replacePicture(WordprocessingMLPackage wordMLPackage, String bookmarkName, InputStream inputStream) throws Exception { + /** + * 通过书签识别需要插入的图片位置,并替换书签对应的文本为图片 + * @param wordMLPackage + * @param bookmarkName 书签名称 + * @param text 图片前需要加的文本 + * @param bytes 图片 + * @throws Exception + * @author liyawei + */ + public static void replacePictureBM(WordprocessingMLPackage wordMLPackage, String bookmarkName, Object text, byte[] bytes) throws Exception { try { MainDocumentPart mainDocumentPart = wordMLPackage.getMainDocumentPart(); Document wmlDoc = (Document)mainDocumentPart.getJaxbElement(); @@ -139,23 +140,277 @@ public class WordUtil { while(var8.hasNext()) { CTBookmark bm = (CTBookmark)var8.next(); if (bm.getName().equals(bookmarkName)) { - byte[] bytes = IOUtils.toByteArray(inputStream); BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes); Inline inline = imagePart.createImageInline("", "", 0, 1, true); - P p = (P)((P)bm.getParent()); ObjectFactory factory = new ObjectFactory(); R run = factory.createR(); Drawing drawing = factory.createDrawing(); drawing.getAnchorOrInline().add(inline); run.getContent().add(drawing); - p.getContent().add(run); + replaceTextToImage(bm, text, wordMLPackage, bytes); } } } catch (Exception var17) { + log.error(var17.getMessage(), var17); } } + /** + * 通过 占位符的key 识别需要插入的图片位置,并替换占位符为图片 + * @param wordMLPackage + * @param key 占位符的key ${key} + * @param text 图片前需要加的文本 + * @param bytes 图片 + * @throws Exception + */ + public static void replacePicture(WordprocessingMLPackage wordMLPackage, String key, Object text, byte[] bytes) throws Exception { + try { + MainDocumentPart mainDocumentPart = wordMLPackage.getMainDocumentPart(); + Docx4jUtils.cleanDocumentPart(mainDocumentPart); + Document wmlDoc = (Document)mainDocumentPart.getJaxbElement(); + Body body = wmlDoc.getBody(); + Iterator var8 = getAllPlaceholderElementFromObject(body).iterator(); + + while(var8.hasNext()) { + Text bm = (Text) var8.next(); + if (bm.getValue().equals("${" + key + "}")) { + BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes); + Inline inline = imagePart.createImageInline("", "", 0, 1, true); + ObjectFactory factory = new ObjectFactory(); + R run = factory.createR(); + Drawing drawing = factory.createDrawing(); + drawing.getAnchorOrInline().add(inline); + run.getContent().add(drawing); + replaceTextToImage(bm, text, wordMLPackage, bytes); + } + } + } catch (Exception var17) { + log.error(var17.getMessage(), var17); + } + + } + + /** + * 通过 占位符的key 识别需要插入的图片位置,并替换占位符为图片 + * 批量替换 + * @param wordMLPackage + * @param picList + * @throws Exception + */ + public static void replacePictureBatch(WordprocessingMLPackage wordMLPackage, List> picList) throws Exception { + try { + MainDocumentPart mainDocumentPart = wordMLPackage.getMainDocumentPart(); + Docx4jUtils.cleanDocumentPart(mainDocumentPart); + Document wmlDoc = (Document)mainDocumentPart.getJaxbElement(); + Body body = wmlDoc.getBody(); + List textList = getAllPlaceholderElementFromObject(body); // 获取文档中所有占位符 + + for (Map picMap :picList) { + String key = (String) picMap.get("key"); + Object text = picMap.get("text"); + byte[] bytes = (byte[]) picMap.get("bytes"); + + for(Text bm : textList) { + if (bm.getValue().equals("${" + key + "}")) { + BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes); + Inline inline = imagePart.createImageInline("", "", 0, 1, true); + ObjectFactory factory = new ObjectFactory(); + R run = factory.createR(); + Drawing drawing = factory.createDrawing(); + drawing.getAnchorOrInline().add(inline); + run.getContent().add(drawing); + replaceTextToImage(bm, text, wordMLPackage, bytes); + } + } + } + } catch (Exception var17) { + log.error(var17.getMessage(), var17); + } + + } + + /** + * 发现docx文档包含占位符的文本节点 + * 未解决问题:两个连着的相同占位符会识别成一个。如 原文:${key1}${key1} + * @param obj + * @return + * @author liyawei + */ + private static List getAllPlaceholderElementFromObject(Object obj) { + List result = new ArrayList<>(); + Class toSearch = Text.class; + Text textPlaceholder; + if (obj instanceof JAXBElement) { + obj = ((JAXBElement) obj).getValue(); + } + if (obj.getClass().equals(toSearch)) { + textPlaceholder = (Text) obj; + if (isPlaceholder(textPlaceholder.getValue())) { + result.add((Text) obj); + } + } else if (obj instanceof ContentAccessor) { + List children = ((ContentAccessor) obj).getContent(); + for (Object child : children) { + result.addAll(getAllPlaceholderElementFromObject(child)); + } + } + return result; + + } + + /** + * 判断字符串是否有${}占位符 + * + * @param str 需要判断的字符串 + * @return 是否字符串是否有${}占位符 + * @author liyawei + */ + private static boolean isPlaceholder(String str) { + if (str != null && !str.isEmpty()) { + Pattern pattern = Pattern.compile("([$]\\{[A-Za-z0-9./ -]+\\})"); // 识别范围 认证模块专用 + Matcher m = pattern.matcher(str); + return m.find(); + } + return false; + } + + /** + * 在标签处插入替换内容 + * + * @param bm + * @param object + * @throws Exception + * @author liyawei + */ + public static void replaceTextToImage(CTBookmark bm, Object object, WordprocessingMLPackage wordMLPackage , byte[] bytes) throws Exception { + if (wordMLPackage == null) { + return; + } + if (bm.getName() == null){ + return; + } + String text = object.toString(); + try { + List theList = null; + ParaRPr rpr = null; + if (bm.getParent() instanceof P) { + PPr pprTemp = ((P) (bm.getParent())).getPPr(); + if (pprTemp == null) { + rpr = null; + } else { + rpr = ((P) (bm.getParent())).getPPr().getRPr(); + } + theList = ((ContentAccessor) (bm.getParent())).getContent(); + } else { + return; + } + int rangeStart = -1; + int rangeEnd = -1; + int i = 0; + for (Object ox : theList) { + Object listEntry = XmlUtils.unwrap(ox); + if (listEntry.equals(bm)) { + if (((CTBookmark) listEntry).getName() != null) { + rangeStart = i + 1; + } + } else if (listEntry instanceof CTMarkupRange) { + if (((CTMarkupRange) listEntry).getId().equals(bm.getId())) { + rangeEnd = i - 1; + break; + } + } + i++; + } + int x = i - 1; + for (int j = x; j >= rangeStart; j--) { + theList.remove(j); + } + + BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes); + Inline inline = imagePart.createImageInline("", "", 0, 1, true); + ObjectFactory factory = Context.getWmlObjectFactory(); + R run = factory.createR(); + Drawing drawing = factory.createDrawing(); + if(text != null){ + Text txt = factory.createText(); + txt.setValue(text); + run.getContent().add(txt); + } + run.getContent().add(drawing); + drawing.getAnchorOrInline().add(inline); + theList.add(rangeStart, run); + } catch (ClassCastException cce) { + + } + } + + + /** + * 在占位符处插入替换内容 + * + * @param bm + * @param object + * @throws Exception + * @author liyawei + */ + public static void replaceTextToImage(Text bm, Object object, WordprocessingMLPackage wordMLPackage , byte[] bytes) throws Exception { + if (wordMLPackage == null) { + return; + } + + String text = object.toString(); + try { + List theList = null; + ParaRPr rpr = null; + if (bm.getParent() instanceof P) { + PPr pprTemp = ((P) (bm.getParent())).getPPr(); + if (pprTemp == null) { + rpr = null; + } else { + rpr = ((P) (bm.getParent())).getPPr().getRPr(); + } + theList = ((ContentAccessor) (bm.getParent())).getContent(); + } else { + R r = (R) bm.getParent(); + if (r.getParent() instanceof P) { + theList = ((ContentAccessor) (r.getParent())).getContent(); + + int rangeStart = -1; // 记录占位符run位置 + int i = 0; + for (Object ox : theList) { + Object listEntry = XmlUtils.unwrap(ox); + if (listEntry.equals(r)) { + rangeStart = i; + } + i++; + } + theList.remove(rangeStart); // 移除原占位符 + + BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes); + Inline inline = imagePart.createImageInline("", "", 0, 1, true); + ObjectFactory factory = Context.getWmlObjectFactory(); + R run = factory.createR(); + Drawing drawing = factory.createDrawing(); + if(text != null){ + Text txt = factory.createText(); + txt.setValue(text); + run.getContent().add(txt); + } + run.getContent().add(drawing); + drawing.getAnchorOrInline().add(inline); + theList.add(rangeStart, run); // 添加图片到原占位符位置 + + } else { + return; + } + } + + } catch (ClassCastException cce) { + log.error(cce.getMessage(), cce); + } + } + public static void replaceForTemplate(String templatePath, Map map, int tableNum, List> dataList, String outPath) throws Exception { WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new File(templatePath)); MainDocumentPart mainDocumentPart = wordMLPackage.getMainDocumentPart(); diff --git a/jero-web/src/common/lang/en-us.js b/jero-web/src/common/lang/en-us.js index 5dd92cd36..2f5a87c4c 100644 --- a/jero-web/src/common/lang/en-us.js +++ b/jero-web/src/common/lang/en-us.js @@ -770,6 +770,7 @@ module.exports = { SynchronousReportLibrary: 'Synchronous Report Library', FreezeConfiguration: 'Freeze Configuration', distributionAndCollection: 'Distribution And Collection', + OneclickCollection: 'One-click Collection', deleteConfiguration: 'Delete Configuration', addConfiguration: 'Add Configuration', electricMachinery: 'ElectricMachinery', @@ -1152,4 +1153,16 @@ module.exports = { TechnicalEvaluationResultsForReference:'Technical Evaluation Results For Reference', ComplianceConfirmationRecord:'Compliance Confirmation Record', complianceConfirmation:'Compliance Confirmation', + noComparisonDocumentSelected:'No comparison document selected', + RemarkInfo:'Remarks Info', + initiateDocumentComparison:'Initiate Document Comparison', + comparativeComments:'Comparative Comments', + viewTheComparisonResults:'View The Comparison Results', + addFullTextComment:'Add Full Text Comment', + turnOffAutomaticMatching:'Turn Off Automatic Matching', + Deriveconformanceresults:'Derive Conformance Results', + Regulatorycompliancekanban:'Regulatory Compliance Kanban', + exportComparisonReport:'Export Comparison Report', + comparisonDifferenceComment:'Comparison Difference Comment', + fullTextComments:'Full text comments', } \ No newline at end of file diff --git a/jero-web/src/common/lang/zh-cn.js b/jero-web/src/common/lang/zh-cn.js index 7f6f9e1aa..0634c24d7 100644 --- a/jero-web/src/common/lang/zh-cn.js +++ b/jero-web/src/common/lang/zh-cn.js @@ -785,6 +785,7 @@ module.exports = { SynchronousReportLibrary: '同步上报库', FreezeConfiguration: '冻结配置', distributionAndCollection: '下发收集', + OneclickCollection: '一键下发收集', deleteConfiguration: '删除配置', addConfiguration: '添加配置', electricMachinery: '电机', @@ -1156,4 +1157,16 @@ module.exports = { TechnicalEvaluationResultsForReference:'技术评估结果参考', ComplianceConfirmationRecord:'符合性确认记录', complianceConfirmation:'符合性确认', + Deriveconformanceresults:'导出符合性结果', + Regulatorycompliancekanban:'法规符合性看板', + noComparisonDocumentSelected:'未选择对比文档', + RemarkInfo:'备注信息', + initiateDocumentComparison:'发起文档对比', + comparativeComments:'对比评论', + viewTheComparisonResults:'查看对比结果', + addFullTextComment:'添加全文评论', + turnOffAutomaticMatching:'关闭自动匹配', + exportComparisonReport:'导出对比报告', + comparisonDifferenceComment:'对比差异评论', + fullTextComments:'全文评论', } \ No newline at end of file diff --git a/jero-web/src/components/TaskCutOffTime/index.vue b/jero-web/src/components/TaskCutOffTime/index.vue index 52b1da1ed..c8f892d6d 100644 --- a/jero-web/src/components/TaskCutOffTime/index.vue +++ b/jero-web/src/components/TaskCutOffTime/index.vue @@ -2,7 +2,7 @@
- - {{$t('cutoffTime')}} - - + +
+
+ * + + {{$t('cutoffTime')}} +
+ + + +
+ + + + +
@@ -22,6 +41,33 @@ {{ $t('cancel') }} {{ $t('submit') }}
+ + + + +
+ + + + +
+
+
+ +
@@ -43,7 +89,9 @@ export default { selectedRowKeysDate: {}, loading: false, editId: '', + visibleoperationFailed:false, newVisible: false, + NotSelectedRowKeysValue:[], labelCol: { xs: { span: 24 }, sm: { span: 7 } @@ -53,7 +101,11 @@ export default { sm: { span: 14 } }, form: {}, - rules: {}, + rules: { + legalTaskConfirmation:[ + { required: true, message: this.$t('PleaseSelect')+this.$t('cutoffTime'), trigger: 'change' } + ] + }, areaTable: [], flag: false, //表单提交标识 spinLoading: false, @@ -62,6 +114,7 @@ export default { pageNo: 1, pageSize: 10, pickerDate: '', + bodystyle:{} } }, props: { @@ -73,6 +126,11 @@ export default { }, mounted() { this.loadData() + this.bodystyle = { + height: '480px', + overflow: 'hidden', + overflowY: 'scroll', + } }, methods: { loadData() { @@ -105,19 +163,90 @@ export default { }, //保存 handleSubmit() { - let _this = this - let param = {ids: this.selectedRowKeysArray, deadline: `${this.pickerDate}`, } - this.confirmLoading = true - postAction('/params/collectManifest/updateDeadlineBatch', param).then((res) => { - if (res.success) { - this.$emit('areaVisibleTaskCutOffTimeflag', false) - this.$message.success(_this.$t('OperationSuccessful')) - this.confirmLoading = false - } else { - this.$message.warning(_this.$t('operationFailed')) - this.confirmLoading = false + // let _this = this + // let param = {ids: this.selectedRowKeysArray, deadline: `${this.pickerDate}`, } + // this.confirmLoading = true + // postAction('/params/collectManifest/updateDeadlineBatch', param).then((res) => { + // if (res.success) { + // this.$emit('areaVisibleTaskCutOffTimeflag', false) + // this.$message.success(_this.$t('OperationSuccessful')) + // this.confirmLoading = false + // } else { + // this.$message.warning(_this.$t('operationFailed')) + // this.confirmLoading = false + // } + // }) + this.$refs.ruleForm.validate(valid => { + if(valid){ + let long = localStorage.getItem('language') + let cut = '' + if (long && long == 'zh-cn') { + this.cut = 'cn' + } else if (long && long == 'en-us') { + this.cut = 'en' } - }) + // let _array = [] + // this.selectedRowKeysValue.forEach((item, index) => { + // _array.push(item.id) + // }) + let _this = this + let param = { + paramsManifestId: this.$route.query.id, + projectId: this.$route.query.projectId, + ids: this.selectedRowKeysArray, + cut: this.cut, + deadline: `${this.pickerDate}` + + } + this.textLoading = true + axios({ + url: '/jero-boot/params/collectManifest/issueCollection', + method: 'post', + data: param, + transformRequest: [function(data) { + let ret = '' + for (let it in data) { + ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&' + } + return ret + }], + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'X-Access-Token': _this.token + } + }) + .then((res) => { + if (res.data.success) { + // _this.$message.success(this.$t('OperationSuccessful')) + if(res.data.result.length == 0){ + this.visibleoperationFailed = false + _this.$message.success(this.$t('OperationSuccessful')) + this.$emit('areaVisibleTaskCutOffTimeflag', false) + this.$emit('GetgetTableList') + + }else{ + this.NotSelectedRowKeysValue = res.data.result + this.visibleoperationFailed = true + } + + // this.$emit('areaVisibleTaskCutOffTimeflag', false) + // this.$emit('GetgetTableList') + } else { + _this.$message.warning(this.$t('operationFailed')) + } + }) + .catch((error) => { + this.textLoading = false + }) + } + }) + }, + // 错误数据的弹框 + cancleoperationFailed() { + this.visibleoperationFailed = false + this.$emit('areaVisibleTaskCutOffTimeflag', false) + this.$emit('GetgetTableList') + // this.GetgetTableList() }, onChange(val) { this.pickerDate = moment(val).format('YYYY-MM-DD HH:mm:ss') @@ -131,7 +260,10 @@ export default { + + + \ No newline at end of file diff --git a/jero-web/src/components/layouts/TabLayout.vue b/jero-web/src/components/layouts/TabLayout.vue index 216d49f12..3d15fba0b 100644 --- a/jero-web/src/components/layouts/TabLayout.vue +++ b/jero-web/src/components/layouts/TabLayout.vue @@ -97,6 +97,9 @@ this.$route.path == '/handshakeProcess' || this.$route.path == '/projectStatusAndProgress' || this.$route.path == '/TaskPlanList' || + this.$route.path == '/documentDataComparison' || + this.$route.path == '/comparisonResults' || + this.$route.path == '/initiateDocumentComparison' || this.$route.path == '/evaluationProcess' || this.$route.path == '/evaluationResultsClause' || this.$route.path == '/evaluationResultsWhole' || diff --git a/jero-web/src/components/uploadFileChange/file.vue b/jero-web/src/components/uploadFileChange/file.vue index 60d65ec72..a27e816c9 100644 --- a/jero-web/src/components/uploadFileChange/file.vue +++ b/jero-web/src/components/uploadFileChange/file.vue @@ -9,7 +9,7 @@ name="file" :file-list="myfileList" :multiple="true" - :action="uploadAction+'?state='+state+'&cut='+cut" + :action="uploadAction+'?state='+2+'&cut='+cut" :headers="headers" @preview="preview" :before-upload="beforeUpload" diff --git a/jero-web/src/config/router.config.js b/jero-web/src/config/router.config.js index 648696c1d..be6370596 100644 --- a/jero-web/src/config/router.config.js +++ b/jero-web/src/config/router.config.js @@ -382,6 +382,21 @@ export const constantRouterMap = [ name: 'evaluationProcess', component: () => import(/* webpackChunkName: "user" */ '@/views/processCenter/processForm/evaluationProcess/index') }, + { + path: '/initiateDocumentComparison', + name: 'initiateDocumentComparison', + component: () => import(/* webpackChunkName: "user" */ '@/views/documentTools/documentComparison/components/initiateComparison') + }, + { + path: '/documentDataComparison', + name: 'documentDataComparison', + component: () => import(/* webpackChunkName: "user" */ '@/views/documentTools/documentComparison/components/documentDataComparison') + }, + { + path: '/comparisonResults', + name: 'comparisonResults', + component: () => import(/* webpackChunkName: "user" */ '@/views/documentTools/documentComparison/components/comparisonResults') + }, { path: '/handshakeProcess', name: 'handshakeProcess', diff --git a/jero-web/src/views/businessSupport/collectionOfRegulatoryOpinions/index.vue b/jero-web/src/views/businessSupport/collectionOfRegulatoryOpinions/index.vue index e342a2161..b5c89571c 100644 --- a/jero-web/src/views/businessSupport/collectionOfRegulatoryOpinions/index.vue +++ b/jero-web/src/views/businessSupport/collectionOfRegulatoryOpinions/index.vue @@ -139,6 +139,7 @@ pageSize: 10, pageNo: 1, CategoryTreeList:[], + serialNumber:'', queryParam: {}, gatherResultList:[ { @@ -224,6 +225,7 @@ }, searchReset() { this.queryParam = {} + this.$route.query.serialNumber = '' this.pageNo = 1 this.getList() }, @@ -246,6 +248,7 @@ let query = { pageNo: this.pageNo, pageSize: this.pageSize, + serialNumber: this.$route.query.serialNumber?this.$route.query.serialNumber:'', ...queryParam } this.loading = true diff --git a/jero-web/src/views/businessSupport/technologyAssessment/index.vue b/jero-web/src/views/businessSupport/technologyAssessment/index.vue index 93a0137a8..3c1a9f42c 100644 --- a/jero-web/src/views/businessSupport/technologyAssessment/index.vue +++ b/jero-web/src/views/businessSupport/technologyAssessment/index.vue @@ -174,6 +174,7 @@ toggleSearchStatus: false, dataSource: [], selectedRowKeys: [], + serialNumber:'', total: 0, pageSize: 10, pageNo: 1, @@ -297,6 +298,7 @@ }, searchReset() { this.queryParam = {} + this.$route.query.serialNumber = '' this.pageNo = 1 this.getList() }, @@ -319,6 +321,7 @@ let query = { pageNo: this.pageNo, pageSize: this.pageSize, + serialNumber: this.$route.query.serialNumber?this.$route.query.serialNumber:'', ...queryParam } this.loading = true diff --git a/jero-web/src/views/documentTools/documentComparison/components/comparisonResults.vue b/jero-web/src/views/documentTools/documentComparison/components/comparisonResults.vue new file mode 100644 index 000000000..9c73a544e --- /dev/null +++ b/jero-web/src/views/documentTools/documentComparison/components/comparisonResults.vue @@ -0,0 +1,464 @@ + + + + + \ No newline at end of file diff --git a/jero-web/src/views/documentTools/documentComparison/components/documentDataComparison.vue b/jero-web/src/views/documentTools/documentComparison/components/documentDataComparison.vue new file mode 100644 index 000000000..4b0eee9f0 --- /dev/null +++ b/jero-web/src/views/documentTools/documentComparison/components/documentDataComparison.vue @@ -0,0 +1,385 @@ + + + + + \ No newline at end of file diff --git a/jero-web/src/views/documentTools/documentComparison/components/initiateComparison.vue b/jero-web/src/views/documentTools/documentComparison/components/initiateComparison.vue new file mode 100644 index 000000000..5d8f4bae2 --- /dev/null +++ b/jero-web/src/views/documentTools/documentComparison/components/initiateComparison.vue @@ -0,0 +1,445 @@ + + + + + \ No newline at end of file diff --git a/jero-web/src/views/documentTools/documentComparison/index.vue b/jero-web/src/views/documentTools/documentComparison/index.vue index 9038af696..cb3f06ed6 100644 --- a/jero-web/src/views/documentTools/documentComparison/index.vue +++ b/jero-web/src/views/documentTools/documentComparison/index.vue @@ -106,10 +106,10 @@ //url传参严格按照当前命名 url: { list: '', - deleteBatch:'', + deleteBatch: '' }, loading: false, - dataSource: [], + dataSource: [{}], selectedRowKeys: [], total: 0, pageSize: 10, @@ -203,7 +203,7 @@ } }, mounted() { - this.getList() + // this.getList() }, methods: { searchQuery() { @@ -251,18 +251,24 @@ this.selectedRowKeys = value }, comparisonResultsClick() { - + let newUrl = this.$router.resolve({ + path: '/comparisonResults' + }) + window.open(newUrl.href, '_blank') }, subscribe() { }, - edit(){ + edit() { }, - initiatingProcessClick(){ - + initiatingProcessClick() { + let newUrl = this.$router.resolve({ + path: '/initiateDocumentComparison' + }) + window.open(newUrl.href, '_blank') }, - deleteData(val){ + deleteData(val) { let _this = this this.$confirm({ content: _this.$t('ConfirmDelete'), @@ -277,7 +283,7 @@ }) } }) - }, + } } } diff --git a/jero-web/src/views/parameter/parameterexport/index.vue b/jero-web/src/views/parameter/parameterexport/index.vue index b0a816217..f40c865c6 100644 --- a/jero-web/src/views/parameter/parameterexport/index.vue +++ b/jero-web/src/views/parameter/parameterexport/index.vue @@ -158,7 +158,7 @@ export default { title: this.$t('status'), align: 'center', width: '5%', - dataIndex: 'state' + dataIndex: 'state_dictText' }, { title: this.$t('creater'), diff --git a/jero-web/src/views/projectManagement/components/ParameterItemCollectionList.vue b/jero-web/src/views/projectManagement/components/ParameterItemCollectionList.vue index 73f000e8c..811b60cf9 100644 --- a/jero-web/src/views/projectManagement/components/ParameterItemCollectionList.vue +++ b/jero-web/src/views/projectManagement/components/ParameterItemCollectionList.vue @@ -3,7 +3,7 @@
- {{$t('ParameteItemCollectionList')}} + {{$t('ParameteItemCollectionList')}}(Model - year market)——{{$t(this.paramsManifest.title)}}
@@ -115,10 +115,15 @@ {{$t('addTo')}} - -
+ + + + + + +
- {{$t('distributionAndCollection')}} + {{$t('OneclickCollection')}}
@@ -131,10 +136,10 @@ {{$t('SynchronousReportLibrary')}}
-
- - {{$t('TaskCutOffTime')}} -
+ + + +
@@ -149,6 +154,12 @@ ...{{ $t('more') }}
+ +
+ + {{$t('distributionAndCollection')}} +
+
@@ -252,12 +263,19 @@ @GetgetLoginUserType='GetgetLoginUserType' @areaVisibleAssignedbyflag='areaVisibleAssignedbyflag' @areaVisible='areaVisibleAssignedby = false'/> - - + + + + + + + { - _array.push(item.id) - }) - let _this = this - let param = { - paramsManifestId: this.$route.query.id, - projectId: this.$route.query.projectId, - ids: _array.join(',') - } - this.textLoading = true - axios({ - url: '/jero-boot/params/collectManifest/issueCollection', - method: 'post', - data: param, - transformRequest: [function(data) { - let ret = '' - for (let it in data) { - ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&' - } - return ret - }], - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-Access-Token': _this.token - } - }) - .then((res) => { - if (res.data.success) { - _this.$message.success(this.$t('OperationSuccessful')) - _this.areaVisible = false - this.textLoading = false - _this.GetgetTableList() - } else { - this.textLoading = false - _this.$message.warning(this.$t('operationFailed')) - } - }) - .catch((error) => { - this.textLoading = false - }) + // 一键下发收集 + defOneclickCollection() { + this.OneclickCollection = true }, + // // 下发收集---请求接口 + // distributionAndCollection() { + // + // let _array = [] + // this.selectedRowKeysValue.forEach((item, index) => { + // _array.push(item.id) + // }) + // let _this = this + // let param = { + // paramsManifestId: this.$route.query.id, + // projectId: this.$route.query.projectId, + // ids: _array.join(',') + // } + // this.textLoading = true + // axios({ + // url: '/jero-boot/params/collectManifest/issueCollection', + // method: 'post', + // data: param, + // transformRequest: [function(data) { + // let ret = '' + // for (let it in data) { + // ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&' + // } + // return ret + // }], + // headers: { + // 'Content-Type': 'application/x-www-form-urlencoded', + // 'X-Access-Token': _this.token + // } + // }) + // .then((res) => { + // if (res.data.success) { + // _this.$message.success(this.$t('OperationSuccessful')) + // _this.areaVisible = false + // this.textLoading = false + // _this.GetgetTableList() + // } else { + // this.textLoading = false + // _this.$message.warning(this.$t('operationFailed')) + // } + // }) + // .catch((error) => { + // this.textLoading = false + // }) + // }, // 同步上报库 权限 handleSynchronousReportLibraryJurisdiction() { let homoJurisdictionSynchronousLibrary = this.homoJurisdictionSynchronousLibrary() @@ -1402,20 +1438,26 @@ this.areaVisibleAssignedby = val }, // 截止时间 - TaskCutOffTimeLibrary() { - let dreTaskCutOffTimeLibrary = this.dreTaskCutOffTimeLibrary() - if (dreTaskCutOffTimeLibrary == 1) { - this.areaVisibleTaskCutOffTime = true - } else if (dreTaskCutOffTimeLibrary == 0) { - this.visibleoperationFailed = true - this.jurisdiction = 'HOMOJZSJ' - } - }, + // TaskCutOffTimeLibrary() { + // let dreTaskCutOffTimeLibrary = this.dreTaskCutOffTimeLibrary() + // if (dreTaskCutOffTimeLibrary == 1) { + // this.areaVisibleTaskCutOffTime = true + // } else if (dreTaskCutOffTimeLibrary == 0) { + // this.visibleoperationFailed = true + // this.jurisdiction = 'HOMOJZSJ' + // } + // }, // 截至时间确定弹框关闭 areaVisibleTaskCutOffTimeflag(val) { + console.log(val) this.areaVisibleTaskCutOffTime = val this.$refs.CollectionTabel.getTableList() }, + areaVisibleTaskCutOffTimeAll(val){ + console.log(val) + this.OneclickCollection = val + this.$refs.CollectionTabel.getTableList() + }, //引用参数 referenceparameter() { let dreJurisdictionreferenceParameter = this.dreJurisdictionreferenceParameter() diff --git a/jero-web/src/views/projectManagement/dialog/configure.vue b/jero-web/src/views/projectManagement/dialog/configure.vue index 71e7e0c24..f75ab52eb 100644 --- a/jero-web/src/views/projectManagement/dialog/configure.vue +++ b/jero-web/src/views/projectManagement/dialog/configure.vue @@ -226,7 +226,8 @@ if (res.success) { this.conFlag = res.result if (this.conFlag == true) { - this.paramsConfigEOList.splice(item.displaySeq + 1, 0, { + console.log(this.paramsConfigEOList) + this.paramsConfigEOList.splice(this.paramsConfigEOList.length + 1, 0, { id: '', configName: '', // 配置名称 version: '', // 版本 diff --git a/jero-web/src/views/regulationsKanban/components/addModel.vue b/jero-web/src/views/regulationsKanban/components/addModel.vue index 6039934a4..67d93b664 100644 --- a/jero-web/src/views/regulationsKanban/components/addModel.vue +++ b/jero-web/src/views/regulationsKanban/components/addModel.vue @@ -12,7 +12,7 @@ - @@ -20,10 +20,10 @@ - - - {{element.label}} + + {{element.projectName}} @@ -69,8 +69,8 @@
- {{ $t('CommentsCollectionResultsForReference') }} - {{ $t('TechnicalEvaluationResultsForReference') }} + {{ $t('CommentsCollectionResultsForReference') }} + {{ $t('TechnicalEvaluationResultsForReference') }}
@@ -94,13 +94,15 @@ export default { title: this.$t('add'), total: 0, selectedRowKeysDate: {}, + opinionGather:'', + technologyEvaluation:'', loading: false, editId: '', RelatedItemList:[], columns: [ { title: this.$t('areaOfResponsibility'), - dataIndex: 'areaOfResponsibility', + dataIndex: 'dutyTerritory_dicText', width: 120, align: 'center', ellipsis: true @@ -109,28 +111,28 @@ export default { title: this.$t('RelatedItems'), align: 'center', width: 120, - dataIndex: 'RelatedItems', + dataIndex: 'projectName', ellipsis: true }, { title: this.$t('designComplianceReview'), align: 'center', width: 250, - dataIndex: 'designComplianceReview', + dataIndex: 'designStatus_dicText', ellipsis: true }, { title: this.$t('preHomeConfirmation'), align: 'center', width: 270, - dataIndex: 'preHomeConfirmation', + dataIndex: 'prehomoStatus_dicText', ellipsis: true }, { title: this.$t('verificationComplianceReview'), align: 'center', width: 270, - dataIndex: 'verificationComplianceReview', + dataIndex: 'verifyStatus_dicText', scopedSlots: { customRender: 'file' }, ellipsis: true } @@ -161,61 +163,31 @@ export default { pageNo: 1, pageSize: 10, listVisible: false, - listVisibleRowDate: {} } }, props: { - version: { - type: Number, - default: '', - required: false - }, - projectId: { - type: String, - default: '', - require: true - }, item: { - type: String, + type: Object, default: '', require: true }, paramsManifestId: { - type: Object, + type: String, default: '', require: true }, - url: { - type: Object, - default: '', - require: true - } }, mounted() { this.loadData() - console.log(this.item) + this.getRelatedItemList() }, methods: { - // 清单列表传出数据 - listVisibleRow(val) { - this.selectedRowKeys = [] - let newAreaTable=JSON.parse(JSON.stringify(this.areaTable)) - newAreaTable.forEach((item, index) => { - if( item.id == this.listVisibleRowDate.id ) { - let _obj = {...item} - _obj.paramsTemplateId = val[0].id - _obj.paramsTemplateName = val[0].paramsTemplateName - this.areaTable.splice(index, 1,_obj) + getRelatedItemList(){ + getAction('/project/projectNameInfoEO/list', {}).then((res) => { + if (res.success) { + this.RelatedItemList = res.result } }) - console.log(this.areaTable,'this.areaTable') - this.listVisible = false - }, - // 下载文件 - editArea(val) { - // this.listVisibleRowDate = val - console.log(val) - // this.listVisible = true }, pageOnChange(page, pageSize) { this.pageNo = page @@ -226,30 +198,51 @@ export default { this.pageSize = pageSize this.loadData() }, - dowloadfile(item){ - let query = { - id: item.exportFileId - } - downloadFile('/sys/common/downLoadFile', item.exportFileName, query, this.Deselect) + // 法规意见收集列表 + handlecomments(){ + this.$router.push({ + path: '/collectionOfRegulatoryOpinions', + query:{ + serialNumber:this.item.serialNumber + } + }) + }, + // 法规技术评估列表 + handletechnical(){ + + this.$router.push({ + path: '/technologyAssessment', + query:{ + serialNumber:this.item.serialNumber + } + }) }, loadData() { - let _this = this let params = { - pageNo: this.pageNo, - pageSize: this.pageSize, - paramsManifestId:this.paramsManifestId, - ...this.formData + id:this.paramsManifestId, + dutyTerritory:this.formData.dutyTerritory?this.formData.dutyTerritory:'', + projectName:this.formData.projectName?this.formData.projectName:'', + projectNameId:this.formData.projectNameId?this.formData.projectNameId:'', } - getAction('params/report/exportHistoryPage', params).then((res) => { + this.loading = true + getAction('project/lawsComplianceBoard/queryComplianceResultList', params).then((res) => { if (res.success) { - this.areaTable = res.result.records - this.total = res.result.total + this.areaTable = res.result.complianceResultList + this.opinionGather = res.result.opinionGather + this.technologyEvaluation = res.result.technologyEvaluation + this.loading = false + }else{ + this.loading = false } }) }, //导出 handleExportXls(){ - + let query = { + id:this.paramsManifestId, + ...this.formData + } + downloadFile('/project/lawsComplianceBoard/exportComplianceResultDetail', this.$t('complianceResults')+'.xls', query, this.Deselect) }, searchQuery() { this.loadData() @@ -273,65 +266,6 @@ export default { this.newVisible = true this.form = {} }, - //新增 - handleSubmit() { - let _this = this - if (this.selectedRowKeys.length == 0) { - this.$message.warning(this.$t('pleaseSelectData')) - } else if (this.selectedRowKeys.length > 1) { - this.$message.warning(this.$t('OnlyOneSelected')) - } else { - this.$refs.ruleForm.validate(valid => { - if (valid) { - this.flag = true - this.spinLoading = true - this.confirmLoading = true - let _tt = { - paramsTemplateId: this.selectedRowKeysDate[0].paramsTemplateId, - projectId: this.selectedRowKeysDate[0].projectId, - title: this.selectedRowKeysDate[0].title, - paramsTemplatePublishVersion: this.selectedRowKeysDate[0].paramsTemplatePublishVersion, - sourceManifestId: this.selectedRowKeysDate[0].id, - } - axios({ - url: `/jero-boot/params/manifest/copy`, - method: 'post', - data: _tt, - transformRequest: [function (data) { - let ret = '' - for (let it in data) { - ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&' - } - return ret - }], - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-Access-Token':_this.token - } - }) - .then( (res) =>{ - if (res.data.success) { - _this.$emit('copysubmit') - _this.$message.success(res.data.message) - _this.flag = false - _this.spinLoading = false - _this.confirmLoading = false - }else{ - _this.$message.warning(res.data.message) - _this.flag = false - _this.spinLoading = false - _this.confirmLoading = false - } - }) - .catch( (error) =>{ - console.log(error); - }); - } else { - return false - } - }) - } - }, }, watch: { selectedRowKeyS(val) { diff --git a/jero-web/src/views/regulationsKanban/index.vue b/jero-web/src/views/regulationsKanban/index.vue index bbbf53682..157836add 100644 --- a/jero-web/src/views/regulationsKanban/index.vue +++ b/jero-web/src/views/regulationsKanban/index.vue @@ -8,8 +8,8 @@
{{ $t('standard') }}
- +
@@ -17,8 +17,8 @@
{{$t('title')}}
- +
@@ -26,10 +26,10 @@
{{ $t('status') }}
- + :triggerChange="false" :dictCode="'state'"/>
@@ -37,10 +37,21 @@
{{ $t('technicalField') }}
- + + + + +
@@ -56,6 +67,14 @@ +
+
+
+ + {{ $t('Deriveconformanceresults') }} +
+
+
{ + if (res.success) { + this.fieldList = res.result || [] + } else { + this.fieldList = [] + } + }) + }, handleCancel() { this.areaVisible = false }, @@ -233,35 +245,39 @@ export default { } }) }, + getSysCategoryTree() { + getAction(this.url.getSysCategoryTree, {}).then((res) => { + if (res.success) { + this.CategoryTreeList = res.result + } else { + this.CategoryTreeList = [] + } + }) + }, handleToggleSearch() { this.toggleSearchStatus = !this.toggleSearchStatus }, onSelectChange(value) { - this.selectedRowKeys = value this.selectedRowKeysArray = this.selectedRowKeys.join(',') }, + deriveconformanceresults(){ + let query = { + ...this.queryParam, + exportAll:'yes', + ids: this.selectedRowKeys.join(',') + } + downloadFile('/project/lawsComplianceBoard/exportComplianceResult', this.$t('complianceResults')+'.xls', query, this.Deselect) + }, // 导出历史 handlecody(e) { this.drawerVisible = true - this.titleTag = e.standard + this.$t('ComplianceConfirmationRecord') + this.titleTag = e.serialNumber + this.$t('ComplianceConfirmationRecord') this.paramsManifestId = e.id this.item = {...e} }, hideModal() { this.visible = false }, - //编辑 - edit(item) { - this.$refs.addModelRef.editModel(JSON.parse(JSON.stringify(item))) - }, - //删除 - deleteLib(val) { - let newUrl = this.$router.resolve({ - path: '/managementdetails', - query: val - }) - window.open(newUrl.href, '_blank') - }, //虚拟清单名称事件 entryNameClick(item) { this.$router.push({ @@ -275,6 +291,8 @@ export default { }, searchReset() { this.queryParam = {} + this.territory = '' + this.queryConditionVOList = [] this.$refs.globalAdvancedQueryRef.resetLine() this.$refs.globalAdvancedQueryRef.emitCallback() }, @@ -298,31 +316,43 @@ export default { handleSuperQuery(params, matchType) { let sqp = {} if (!params || (params && params.length == 0)) { - sqp['superQueryParams'] = '' + this.queryConditionVOList = [] this.$refs.globalAdvancedQueryRef.superQueryFlag = false } else { this.$refs.globalAdvancedQueryRef.superQueryFlag = true - sqp['superQueryParams'] = encodeURI(JSON.stringify(params)) - sqp['superQueryMatchType'] = matchType + this.queryConditionVOList = params + this.queryConditionVOList.forEach(res => { + res.type = matchType + }) } - this.queryParamQuery = sqp this.getList() }, getList() { + let territory = '' + if (this.queryParam.technologyTerritory) { + this.territory = this.queryParam.technologyTerritory.join(',') + } + // let queryParam = JSON.parse(JSON.stringify(this.queryParam)) + let queryConditionVOList = JSON.parse(JSON.stringify(this.queryConditionVOList)) let query = { pageNo: this.pageNo, pageSize: this.pageSize, - ...this.queryParamQuery, - ...this.queryParam + queryConditionVOList: JSON.stringify(queryConditionVOList), + technology_territory: this.territory, + serial_number:this.queryParam.serialNumber, + title:this.queryParam.title, + state:this.queryParam.state + } this.loading = true - getAction(this.url.list, query).then((res) => { - if (res.success) { + postAction(this.url.list, query).then((res) => { + if (res) { if (res.result.current > 1 && res.result.records.length == 0) { this.pageNo = res.result.current - 1 this.getList() return } + console.log(res.result) this.dataSource = res.result.records || [] this.total = res.result.total